vendor.js 414 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!*********************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  5. \*********************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", {
  10. value: true
  11. });
  12. exports.default = void 0;
  13. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  14. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  15. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  16. return this;
  17. }();
  18. var key = ['w', 'x'].join('');
  19. var oldWx = target[key];
  20. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  21. function isWxKey(key) {
  22. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  23. return false;
  24. }
  25. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  26. }
  27. function initWx() {
  28. var newWx = {};
  29. for (var _key in oldWx) {
  30. if (isWxKey(_key)) {
  31. // TODO wrapper function
  32. newWx[_key] = oldWx[_key];
  33. }
  34. }
  35. return newWx;
  36. }
  37. target[key] = initWx();
  38. var _default = target[key];
  39. exports.default = _default;
  40. /***/ }),
  41. /***/ 10:
  42. /*!****************************************************************!*\
  43. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  44. \****************************************************************/
  45. /*! no static exports found */
  46. /***/ (function(module, exports) {
  47. function _nonIterableRest() {
  48. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  49. }
  50. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  51. /***/ }),
  52. /***/ 11:
  53. /*!***************************************************************!*\
  54. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  55. \***************************************************************/
  56. /*! no static exports found */
  57. /***/ (function(module, exports, __webpack_require__) {
  58. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  59. function _defineProperty(obj, key, value) {
  60. key = toPropertyKey(key);
  61. if (key in obj) {
  62. Object.defineProperty(obj, key, {
  63. value: value,
  64. enumerable: true,
  65. configurable: true,
  66. writable: true
  67. });
  68. } else {
  69. obj[key] = value;
  70. }
  71. return obj;
  72. }
  73. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  74. /***/ }),
  75. /***/ 12:
  76. /*!**************************************************************!*\
  77. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  78. \**************************************************************/
  79. /*! no static exports found */
  80. /***/ (function(module, exports, __webpack_require__) {
  81. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  82. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  83. function toPropertyKey(t) {
  84. var i = toPrimitive(t, "string");
  85. return "symbol" == _typeof(i) ? i : i + "";
  86. }
  87. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  88. /***/ }),
  89. /***/ 13:
  90. /*!*******************************************************!*\
  91. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  92. \*******************************************************/
  93. /*! no static exports found */
  94. /***/ (function(module, exports) {
  95. function _typeof(o) {
  96. "@babel/helpers - typeof";
  97. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  98. return typeof o;
  99. } : function (o) {
  100. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  101. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  102. }
  103. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  104. /***/ }),
  105. /***/ 14:
  106. /*!************************************************************!*\
  107. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  108. \************************************************************/
  109. /*! no static exports found */
  110. /***/ (function(module, exports, __webpack_require__) {
  111. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  112. function toPrimitive(t, r) {
  113. if ("object" != _typeof(t) || !t) return t;
  114. var e = t[Symbol.toPrimitive];
  115. if (void 0 !== e) {
  116. var i = e.call(t, r || "default");
  117. if ("object" != _typeof(i)) return i;
  118. throw new TypeError("@@toPrimitive must return a primitive value.");
  119. }
  120. return ("string" === r ? String : Number)(t);
  121. }
  122. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  123. /***/ }),
  124. /***/ 15:
  125. /*!**********************************************************!*\
  126. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  127. \**********************************************************/
  128. /*! no static exports found */
  129. /***/ (function(module, exports, __webpack_require__) {
  130. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  131. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  132. function _construct(t, e, r) {
  133. if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  134. var o = [null];
  135. o.push.apply(o, e);
  136. var p = new (t.bind.apply(t, o))();
  137. return r && setPrototypeOf(p, r.prototype), p;
  138. }
  139. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  140. /***/ }),
  141. /***/ 16:
  142. /*!***************************************************************!*\
  143. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  144. \***************************************************************/
  145. /*! no static exports found */
  146. /***/ (function(module, exports) {
  147. function _setPrototypeOf(o, p) {
  148. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  149. o.__proto__ = p;
  150. return o;
  151. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  152. return _setPrototypeOf(o, p);
  153. }
  154. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  155. /***/ }),
  156. /***/ 17:
  157. /*!*************************************************************************!*\
  158. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  159. \*************************************************************************/
  160. /*! no static exports found */
  161. /***/ (function(module, exports) {
  162. function _isNativeReflectConstruct() {
  163. try {
  164. var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  165. } catch (t) {}
  166. return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() {
  167. return !!t;
  168. }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
  169. }
  170. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  171. /***/ }),
  172. /***/ 18:
  173. /*!******************************************************************!*\
  174. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  175. \******************************************************************/
  176. /*! no static exports found */
  177. /***/ (function(module, exports, __webpack_require__) {
  178. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  179. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  180. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  181. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  182. function _toConsumableArray(arr) {
  183. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  184. }
  185. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  186. /***/ }),
  187. /***/ 19:
  188. /*!******************************************************************!*\
  189. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  190. \******************************************************************/
  191. /*! no static exports found */
  192. /***/ (function(module, exports, __webpack_require__) {
  193. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  194. function _arrayWithoutHoles(arr) {
  195. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  196. }
  197. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  198. /***/ }),
  199. /***/ 2:
  200. /*!************************************************************!*\
  201. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  202. \************************************************************/
  203. /*! no static exports found */
  204. /***/ (function(module, exports, __webpack_require__) {
  205. "use strict";
  206. /* WEBPACK VAR INJECTION */(function(wx, global) {
  207. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  208. Object.defineProperty(exports, "__esModule", {
  209. value: true
  210. });
  211. exports.createApp = createApp;
  212. exports.createComponent = createComponent;
  213. exports.createPage = createPage;
  214. exports.createPlugin = createPlugin;
  215. exports.createSubpackageApp = createSubpackageApp;
  216. exports.default = void 0;
  217. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  218. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  219. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  220. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  221. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  222. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  223. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  224. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  225. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  226. var realAtob;
  227. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  228. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  229. if (typeof atob !== 'function') {
  230. realAtob = function realAtob(str) {
  231. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  232. if (!b64re.test(str)) {
  233. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  234. }
  235. // Adding the padding if missing, for semplicity
  236. str += '=='.slice(2 - (str.length & 3));
  237. var bitmap;
  238. var result = '';
  239. var r1;
  240. var r2;
  241. var i = 0;
  242. for (; i < str.length;) {
  243. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  244. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  245. }
  246. return result;
  247. };
  248. } else {
  249. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  250. realAtob = atob;
  251. }
  252. function b64DecodeUnicode(str) {
  253. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  254. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  255. }).join(''));
  256. }
  257. function getCurrentUserInfo() {
  258. var token = wx.getStorageSync('uni_id_token') || '';
  259. var tokenArr = token.split('.');
  260. if (!token || tokenArr.length !== 3) {
  261. return {
  262. uid: null,
  263. role: [],
  264. permission: [],
  265. tokenExpired: 0
  266. };
  267. }
  268. var userInfo;
  269. try {
  270. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  271. } catch (error) {
  272. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  273. }
  274. userInfo.tokenExpired = userInfo.exp * 1000;
  275. delete userInfo.exp;
  276. delete userInfo.iat;
  277. return userInfo;
  278. }
  279. function uniIdMixin(Vue) {
  280. Vue.prototype.uniIDHasRole = function (roleId) {
  281. var _getCurrentUserInfo = getCurrentUserInfo(),
  282. role = _getCurrentUserInfo.role;
  283. return role.indexOf(roleId) > -1;
  284. };
  285. Vue.prototype.uniIDHasPermission = function (permissionId) {
  286. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  287. permission = _getCurrentUserInfo2.permission;
  288. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  289. };
  290. Vue.prototype.uniIDTokenValid = function () {
  291. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  292. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  293. return tokenExpired > Date.now();
  294. };
  295. }
  296. var _toString = Object.prototype.toString;
  297. var hasOwnProperty = Object.prototype.hasOwnProperty;
  298. function isFn(fn) {
  299. return typeof fn === 'function';
  300. }
  301. function isStr(str) {
  302. return typeof str === 'string';
  303. }
  304. function isObject(obj) {
  305. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  306. }
  307. function isPlainObject(obj) {
  308. return _toString.call(obj) === '[object Object]';
  309. }
  310. function hasOwn(obj, key) {
  311. return hasOwnProperty.call(obj, key);
  312. }
  313. function noop() {}
  314. /**
  315. * Create a cached version of a pure function.
  316. */
  317. function cached(fn) {
  318. var cache = Object.create(null);
  319. return function cachedFn(str) {
  320. var hit = cache[str];
  321. return hit || (cache[str] = fn(str));
  322. };
  323. }
  324. /**
  325. * Camelize a hyphen-delimited string.
  326. */
  327. var camelizeRE = /-(\w)/g;
  328. var camelize = cached(function (str) {
  329. return str.replace(camelizeRE, function (_, c) {
  330. return c ? c.toUpperCase() : '';
  331. });
  332. });
  333. function sortObject(obj) {
  334. var sortObj = {};
  335. if (isPlainObject(obj)) {
  336. Object.keys(obj).sort().forEach(function (key) {
  337. sortObj[key] = obj[key];
  338. });
  339. }
  340. return !Object.keys(sortObj) ? obj : sortObj;
  341. }
  342. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  343. var globalInterceptors = {};
  344. var scopedInterceptors = {};
  345. function mergeHook(parentVal, childVal) {
  346. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  347. return res ? dedupeHooks(res) : res;
  348. }
  349. function dedupeHooks(hooks) {
  350. var res = [];
  351. for (var i = 0; i < hooks.length; i++) {
  352. if (res.indexOf(hooks[i]) === -1) {
  353. res.push(hooks[i]);
  354. }
  355. }
  356. return res;
  357. }
  358. function removeHook(hooks, hook) {
  359. var index = hooks.indexOf(hook);
  360. if (index !== -1) {
  361. hooks.splice(index, 1);
  362. }
  363. }
  364. function mergeInterceptorHook(interceptor, option) {
  365. Object.keys(option).forEach(function (hook) {
  366. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  367. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  368. }
  369. });
  370. }
  371. function removeInterceptorHook(interceptor, option) {
  372. if (!interceptor || !option) {
  373. return;
  374. }
  375. Object.keys(option).forEach(function (hook) {
  376. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  377. removeHook(interceptor[hook], option[hook]);
  378. }
  379. });
  380. }
  381. function addInterceptor(method, option) {
  382. if (typeof method === 'string' && isPlainObject(option)) {
  383. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  384. } else if (isPlainObject(method)) {
  385. mergeInterceptorHook(globalInterceptors, method);
  386. }
  387. }
  388. function removeInterceptor(method, option) {
  389. if (typeof method === 'string') {
  390. if (isPlainObject(option)) {
  391. removeInterceptorHook(scopedInterceptors[method], option);
  392. } else {
  393. delete scopedInterceptors[method];
  394. }
  395. } else if (isPlainObject(method)) {
  396. removeInterceptorHook(globalInterceptors, method);
  397. }
  398. }
  399. function wrapperHook(hook, params) {
  400. return function (data) {
  401. return hook(data, params) || data;
  402. };
  403. }
  404. function isPromise(obj) {
  405. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  406. }
  407. function queue(hooks, data, params) {
  408. var promise = false;
  409. for (var i = 0; i < hooks.length; i++) {
  410. var hook = hooks[i];
  411. if (promise) {
  412. promise = Promise.resolve(wrapperHook(hook, params));
  413. } else {
  414. var res = hook(data, params);
  415. if (isPromise(res)) {
  416. promise = Promise.resolve(res);
  417. }
  418. if (res === false) {
  419. return {
  420. then: function then() {}
  421. };
  422. }
  423. }
  424. }
  425. return promise || {
  426. then: function then(callback) {
  427. return callback(data);
  428. }
  429. };
  430. }
  431. function wrapperOptions(interceptor) {
  432. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  433. ['success', 'fail', 'complete'].forEach(function (name) {
  434. if (Array.isArray(interceptor[name])) {
  435. var oldCallback = options[name];
  436. options[name] = function callbackInterceptor(res) {
  437. queue(interceptor[name], res, options).then(function (res) {
  438. /* eslint-disable no-mixed-operators */
  439. return isFn(oldCallback) && oldCallback(res) || res;
  440. });
  441. };
  442. }
  443. });
  444. return options;
  445. }
  446. function wrapperReturnValue(method, returnValue) {
  447. var returnValueHooks = [];
  448. if (Array.isArray(globalInterceptors.returnValue)) {
  449. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  450. }
  451. var interceptor = scopedInterceptors[method];
  452. if (interceptor && Array.isArray(interceptor.returnValue)) {
  453. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  454. }
  455. returnValueHooks.forEach(function (hook) {
  456. returnValue = hook(returnValue) || returnValue;
  457. });
  458. return returnValue;
  459. }
  460. function getApiInterceptorHooks(method) {
  461. var interceptor = Object.create(null);
  462. Object.keys(globalInterceptors).forEach(function (hook) {
  463. if (hook !== 'returnValue') {
  464. interceptor[hook] = globalInterceptors[hook].slice();
  465. }
  466. });
  467. var scopedInterceptor = scopedInterceptors[method];
  468. if (scopedInterceptor) {
  469. Object.keys(scopedInterceptor).forEach(function (hook) {
  470. if (hook !== 'returnValue') {
  471. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  472. }
  473. });
  474. }
  475. return interceptor;
  476. }
  477. function invokeApi(method, api, options) {
  478. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  479. params[_key - 3] = arguments[_key];
  480. }
  481. var interceptor = getApiInterceptorHooks(method);
  482. if (interceptor && Object.keys(interceptor).length) {
  483. if (Array.isArray(interceptor.invoke)) {
  484. var res = queue(interceptor.invoke, options);
  485. return res.then(function (options) {
  486. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  487. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  488. });
  489. } else {
  490. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  491. }
  492. }
  493. return api.apply(void 0, [options].concat(params));
  494. }
  495. var promiseInterceptor = {
  496. returnValue: function returnValue(res) {
  497. if (!isPromise(res)) {
  498. return res;
  499. }
  500. return new Promise(function (resolve, reject) {
  501. res.then(function (res) {
  502. if (res[0]) {
  503. reject(res[0]);
  504. } else {
  505. resolve(res[1]);
  506. }
  507. });
  508. });
  509. }
  510. };
  511. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  512. var CONTEXT_API_RE = /^create|Manager$/;
  513. // Context例外情况
  514. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  515. // 同步例外情况
  516. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  517. var CALLBACK_API_RE = /^on|^off/;
  518. function isContextApi(name) {
  519. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  520. }
  521. function isSyncApi(name) {
  522. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  523. }
  524. function isCallbackApi(name) {
  525. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  526. }
  527. function handlePromise(promise) {
  528. return promise.then(function (data) {
  529. return [null, data];
  530. }).catch(function (err) {
  531. return [err];
  532. });
  533. }
  534. function shouldPromise(name) {
  535. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  536. return false;
  537. }
  538. return true;
  539. }
  540. /* eslint-disable no-extend-native */
  541. if (!Promise.prototype.finally) {
  542. Promise.prototype.finally = function (callback) {
  543. var promise = this.constructor;
  544. return this.then(function (value) {
  545. return promise.resolve(callback()).then(function () {
  546. return value;
  547. });
  548. }, function (reason) {
  549. return promise.resolve(callback()).then(function () {
  550. throw reason;
  551. });
  552. });
  553. };
  554. }
  555. function promisify(name, api) {
  556. if (!shouldPromise(name) || !isFn(api)) {
  557. return api;
  558. }
  559. return function promiseApi() {
  560. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  561. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  562. params[_key2 - 1] = arguments[_key2];
  563. }
  564. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  565. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  566. }
  567. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  568. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  569. success: resolve,
  570. fail: reject
  571. })].concat(params));
  572. })));
  573. };
  574. }
  575. var EPS = 1e-4;
  576. var BASE_DEVICE_WIDTH = 750;
  577. var isIOS = false;
  578. var deviceWidth = 0;
  579. var deviceDPR = 0;
  580. function checkDeviceWidth() {
  581. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  582. platform = _wx$getSystemInfoSync.platform,
  583. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  584. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  585. deviceWidth = windowWidth;
  586. deviceDPR = pixelRatio;
  587. isIOS = platform === 'ios';
  588. }
  589. function upx2px(number, newDeviceWidth) {
  590. if (deviceWidth === 0) {
  591. checkDeviceWidth();
  592. }
  593. number = Number(number);
  594. if (number === 0) {
  595. return 0;
  596. }
  597. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  598. if (result < 0) {
  599. result = -result;
  600. }
  601. result = Math.floor(result + EPS);
  602. if (result === 0) {
  603. if (deviceDPR === 1 || !isIOS) {
  604. result = 1;
  605. } else {
  606. result = 0.5;
  607. }
  608. }
  609. return number < 0 ? -result : result;
  610. }
  611. var LOCALE_ZH_HANS = 'zh-Hans';
  612. var LOCALE_ZH_HANT = 'zh-Hant';
  613. var LOCALE_EN = 'en';
  614. var LOCALE_FR = 'fr';
  615. var LOCALE_ES = 'es';
  616. var messages = {};
  617. var locale;
  618. {
  619. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  620. }
  621. function initI18nMessages() {
  622. if (!isEnableLocale()) {
  623. return;
  624. }
  625. var localeKeys = Object.keys(__uniConfig.locales);
  626. if (localeKeys.length) {
  627. localeKeys.forEach(function (locale) {
  628. var curMessages = messages[locale];
  629. var userMessages = __uniConfig.locales[locale];
  630. if (curMessages) {
  631. Object.assign(curMessages, userMessages);
  632. } else {
  633. messages[locale] = userMessages;
  634. }
  635. });
  636. }
  637. }
  638. initI18nMessages();
  639. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  640. var t = i18n.t;
  641. var i18nMixin = i18n.mixin = {
  642. beforeCreate: function beforeCreate() {
  643. var _this = this;
  644. var unwatch = i18n.i18n.watchLocale(function () {
  645. _this.$forceUpdate();
  646. });
  647. this.$once('hook:beforeDestroy', function () {
  648. unwatch();
  649. });
  650. },
  651. methods: {
  652. $$t: function $$t(key, values) {
  653. return t(key, values);
  654. }
  655. }
  656. };
  657. var setLocale = i18n.setLocale;
  658. var getLocale = i18n.getLocale;
  659. function initAppLocale(Vue, appVm, locale) {
  660. var state = Vue.observable({
  661. locale: locale || i18n.getLocale()
  662. });
  663. var localeWatchers = [];
  664. appVm.$watchLocale = function (fn) {
  665. localeWatchers.push(fn);
  666. };
  667. Object.defineProperty(appVm, '$locale', {
  668. get: function get() {
  669. return state.locale;
  670. },
  671. set: function set(v) {
  672. state.locale = v;
  673. localeWatchers.forEach(function (watch) {
  674. return watch(v);
  675. });
  676. }
  677. });
  678. }
  679. function isEnableLocale() {
  680. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  681. }
  682. function include(str, parts) {
  683. return !!parts.find(function (part) {
  684. return str.indexOf(part) !== -1;
  685. });
  686. }
  687. function startsWith(str, parts) {
  688. return parts.find(function (part) {
  689. return str.indexOf(part) === 0;
  690. });
  691. }
  692. function normalizeLocale(locale, messages) {
  693. if (!locale) {
  694. return;
  695. }
  696. locale = locale.trim().replace(/_/g, '-');
  697. if (messages && messages[locale]) {
  698. return locale;
  699. }
  700. locale = locale.toLowerCase();
  701. if (locale === 'chinese') {
  702. // 支付宝
  703. return LOCALE_ZH_HANS;
  704. }
  705. if (locale.indexOf('zh') === 0) {
  706. if (locale.indexOf('-hans') > -1) {
  707. return LOCALE_ZH_HANS;
  708. }
  709. if (locale.indexOf('-hant') > -1) {
  710. return LOCALE_ZH_HANT;
  711. }
  712. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  713. return LOCALE_ZH_HANT;
  714. }
  715. return LOCALE_ZH_HANS;
  716. }
  717. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  718. if (lang) {
  719. return lang;
  720. }
  721. }
  722. // export function initI18n() {
  723. // const localeKeys = Object.keys(__uniConfig.locales || {})
  724. // if (localeKeys.length) {
  725. // localeKeys.forEach((locale) =>
  726. // i18n.add(locale, __uniConfig.locales[locale])
  727. // )
  728. // }
  729. // }
  730. function getLocale$1() {
  731. // 优先使用 $locale
  732. if (isFn(getApp)) {
  733. var app = getApp({
  734. allowDefault: true
  735. });
  736. if (app && app.$vm) {
  737. return app.$vm.$locale;
  738. }
  739. }
  740. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  741. }
  742. function setLocale$1(locale) {
  743. var app = isFn(getApp) ? getApp() : false;
  744. if (!app) {
  745. return false;
  746. }
  747. var oldLocale = app.$vm.$locale;
  748. if (oldLocale !== locale) {
  749. app.$vm.$locale = locale;
  750. onLocaleChangeCallbacks.forEach(function (fn) {
  751. return fn({
  752. locale: locale
  753. });
  754. });
  755. return true;
  756. }
  757. return false;
  758. }
  759. var onLocaleChangeCallbacks = [];
  760. function onLocaleChange(fn) {
  761. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  762. onLocaleChangeCallbacks.push(fn);
  763. }
  764. }
  765. if (typeof global !== 'undefined') {
  766. global.getLocale = getLocale$1;
  767. }
  768. var interceptors = {
  769. promiseInterceptor: promiseInterceptor
  770. };
  771. var baseApi = /*#__PURE__*/Object.freeze({
  772. __proto__: null,
  773. upx2px: upx2px,
  774. getLocale: getLocale$1,
  775. setLocale: setLocale$1,
  776. onLocaleChange: onLocaleChange,
  777. addInterceptor: addInterceptor,
  778. removeInterceptor: removeInterceptor,
  779. interceptors: interceptors
  780. });
  781. function findExistsPageIndex(url) {
  782. var pages = getCurrentPages();
  783. var len = pages.length;
  784. while (len--) {
  785. var page = pages[len];
  786. if (page.$page && page.$page.fullPath === url) {
  787. return len;
  788. }
  789. }
  790. return -1;
  791. }
  792. var redirectTo = {
  793. name: function name(fromArgs) {
  794. if (fromArgs.exists === 'back' && fromArgs.delta) {
  795. return 'navigateBack';
  796. }
  797. return 'redirectTo';
  798. },
  799. args: function args(fromArgs) {
  800. if (fromArgs.exists === 'back' && fromArgs.url) {
  801. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  802. if (existsPageIndex !== -1) {
  803. var delta = getCurrentPages().length - 1 - existsPageIndex;
  804. if (delta > 0) {
  805. fromArgs.delta = delta;
  806. }
  807. }
  808. }
  809. }
  810. };
  811. var previewImage = {
  812. args: function args(fromArgs) {
  813. var currentIndex = parseInt(fromArgs.current);
  814. if (isNaN(currentIndex)) {
  815. return;
  816. }
  817. var urls = fromArgs.urls;
  818. if (!Array.isArray(urls)) {
  819. return;
  820. }
  821. var len = urls.length;
  822. if (!len) {
  823. return;
  824. }
  825. if (currentIndex < 0) {
  826. currentIndex = 0;
  827. } else if (currentIndex >= len) {
  828. currentIndex = len - 1;
  829. }
  830. if (currentIndex > 0) {
  831. fromArgs.current = urls[currentIndex];
  832. fromArgs.urls = urls.filter(function (item, index) {
  833. return index < currentIndex ? item !== urls[currentIndex] : true;
  834. });
  835. } else {
  836. fromArgs.current = urls[0];
  837. }
  838. return {
  839. indicator: false,
  840. loop: false
  841. };
  842. }
  843. };
  844. var UUID_KEY = '__DC_STAT_UUID';
  845. var deviceId;
  846. function useDeviceId(result) {
  847. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  848. if (!deviceId) {
  849. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  850. wx.setStorage({
  851. key: UUID_KEY,
  852. data: deviceId
  853. });
  854. }
  855. result.deviceId = deviceId;
  856. }
  857. function addSafeAreaInsets(result) {
  858. if (result.safeArea) {
  859. var safeArea = result.safeArea;
  860. result.safeAreaInsets = {
  861. top: safeArea.top,
  862. left: safeArea.left,
  863. right: result.windowWidth - safeArea.right,
  864. bottom: result.screenHeight - safeArea.bottom
  865. };
  866. }
  867. }
  868. function populateParameters(result) {
  869. var _result$brand = result.brand,
  870. brand = _result$brand === void 0 ? '' : _result$brand,
  871. _result$model = result.model,
  872. model = _result$model === void 0 ? '' : _result$model,
  873. _result$system = result.system,
  874. system = _result$system === void 0 ? '' : _result$system,
  875. _result$language = result.language,
  876. language = _result$language === void 0 ? '' : _result$language,
  877. theme = result.theme,
  878. version = result.version,
  879. platform = result.platform,
  880. fontSizeSetting = result.fontSizeSetting,
  881. SDKVersion = result.SDKVersion,
  882. pixelRatio = result.pixelRatio,
  883. deviceOrientation = result.deviceOrientation;
  884. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  885. var extraParam = {};
  886. // osName osVersion
  887. var osName = '';
  888. var osVersion = '';
  889. {
  890. osName = system.split(' ')[0] || '';
  891. osVersion = system.split(' ')[1] || '';
  892. }
  893. var hostVersion = version;
  894. // deviceType
  895. var deviceType = getGetDeviceType(result, model);
  896. // deviceModel
  897. var deviceBrand = getDeviceBrand(brand);
  898. // hostName
  899. var _hostName = getHostName(result);
  900. // deviceOrientation
  901. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  902. // devicePixelRatio
  903. var _devicePixelRatio = pixelRatio;
  904. // SDKVersion
  905. var _SDKVersion = SDKVersion;
  906. // hostLanguage
  907. var hostLanguage = language.replace(/_/g, '-');
  908. // wx.getAccountInfoSync
  909. var parameters = {
  910. appId: "__UNI__C0ABCC1",
  911. appName: "chargingPile",
  912. appVersion: "1.0.0",
  913. appVersionCode: "100",
  914. appLanguage: getAppLanguage(hostLanguage),
  915. uniCompileVersion: "4.29",
  916. uniRuntimeVersion: "4.29",
  917. uniPlatform: undefined || "mp-weixin",
  918. deviceBrand: deviceBrand,
  919. deviceModel: model,
  920. deviceType: deviceType,
  921. devicePixelRatio: _devicePixelRatio,
  922. deviceOrientation: _deviceOrientation,
  923. osName: osName.toLocaleLowerCase(),
  924. osVersion: osVersion,
  925. hostTheme: theme,
  926. hostVersion: hostVersion,
  927. hostLanguage: hostLanguage,
  928. hostName: _hostName,
  929. hostSDKVersion: _SDKVersion,
  930. hostFontSizeSetting: fontSizeSetting,
  931. windowTop: 0,
  932. windowBottom: 0,
  933. // TODO
  934. osLanguage: undefined,
  935. osTheme: undefined,
  936. ua: undefined,
  937. hostPackageName: undefined,
  938. browserName: undefined,
  939. browserVersion: undefined
  940. };
  941. Object.assign(result, parameters, extraParam);
  942. }
  943. function getGetDeviceType(result, model) {
  944. var deviceType = result.deviceType || 'phone';
  945. {
  946. var deviceTypeMaps = {
  947. ipad: 'pad',
  948. windows: 'pc',
  949. mac: 'pc'
  950. };
  951. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  952. var _model = model.toLocaleLowerCase();
  953. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  954. var _m = deviceTypeMapsKeys[index];
  955. if (_model.indexOf(_m) !== -1) {
  956. deviceType = deviceTypeMaps[_m];
  957. break;
  958. }
  959. }
  960. }
  961. return deviceType;
  962. }
  963. function getDeviceBrand(brand) {
  964. var deviceBrand = brand;
  965. if (deviceBrand) {
  966. deviceBrand = brand.toLocaleLowerCase();
  967. }
  968. return deviceBrand;
  969. }
  970. function getAppLanguage(defaultLanguage) {
  971. return getLocale$1 ? getLocale$1() : defaultLanguage;
  972. }
  973. function getHostName(result) {
  974. var _platform = 'WeChat';
  975. var _hostName = result.hostName || _platform; // mp-jd
  976. {
  977. if (result.environment) {
  978. _hostName = result.environment;
  979. } else if (result.host && result.host.env) {
  980. _hostName = result.host.env;
  981. }
  982. }
  983. return _hostName;
  984. }
  985. var getSystemInfo = {
  986. returnValue: function returnValue(result) {
  987. useDeviceId(result);
  988. addSafeAreaInsets(result);
  989. populateParameters(result);
  990. }
  991. };
  992. var showActionSheet = {
  993. args: function args(fromArgs) {
  994. if ((0, _typeof2.default)(fromArgs) === 'object') {
  995. fromArgs.alertText = fromArgs.title;
  996. }
  997. }
  998. };
  999. var getAppBaseInfo = {
  1000. returnValue: function returnValue(result) {
  1001. var _result = result,
  1002. version = _result.version,
  1003. language = _result.language,
  1004. SDKVersion = _result.SDKVersion,
  1005. theme = _result.theme;
  1006. var _hostName = getHostName(result);
  1007. var hostLanguage = language.replace('_', '-');
  1008. result = sortObject(Object.assign(result, {
  1009. appId: "__UNI__C0ABCC1",
  1010. appName: "chargingPile",
  1011. appVersion: "1.0.0",
  1012. appVersionCode: "100",
  1013. appLanguage: getAppLanguage(hostLanguage),
  1014. hostVersion: version,
  1015. hostLanguage: hostLanguage,
  1016. hostName: _hostName,
  1017. hostSDKVersion: SDKVersion,
  1018. hostTheme: theme
  1019. }));
  1020. }
  1021. };
  1022. var getDeviceInfo = {
  1023. returnValue: function returnValue(result) {
  1024. var _result2 = result,
  1025. brand = _result2.brand,
  1026. model = _result2.model;
  1027. var deviceType = getGetDeviceType(result, model);
  1028. var deviceBrand = getDeviceBrand(brand);
  1029. useDeviceId(result);
  1030. result = sortObject(Object.assign(result, {
  1031. deviceType: deviceType,
  1032. deviceBrand: deviceBrand,
  1033. deviceModel: model
  1034. }));
  1035. }
  1036. };
  1037. var getWindowInfo = {
  1038. returnValue: function returnValue(result) {
  1039. addSafeAreaInsets(result);
  1040. result = sortObject(Object.assign(result, {
  1041. windowTop: 0,
  1042. windowBottom: 0
  1043. }));
  1044. }
  1045. };
  1046. var getAppAuthorizeSetting = {
  1047. returnValue: function returnValue(result) {
  1048. var locationReducedAccuracy = result.locationReducedAccuracy;
  1049. result.locationAccuracy = 'unsupported';
  1050. if (locationReducedAccuracy === true) {
  1051. result.locationAccuracy = 'reduced';
  1052. } else if (locationReducedAccuracy === false) {
  1053. result.locationAccuracy = 'full';
  1054. }
  1055. }
  1056. };
  1057. // import navigateTo from 'uni-helpers/navigate-to'
  1058. var compressImage = {
  1059. args: function args(fromArgs) {
  1060. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  1061. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  1062. fromArgs.compressHeight = fromArgs.compressedHeight;
  1063. }
  1064. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  1065. fromArgs.compressWidth = fromArgs.compressedWidth;
  1066. }
  1067. }
  1068. };
  1069. var protocols = {
  1070. redirectTo: redirectTo,
  1071. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  1072. previewImage: previewImage,
  1073. getSystemInfo: getSystemInfo,
  1074. getSystemInfoSync: getSystemInfo,
  1075. showActionSheet: showActionSheet,
  1076. getAppBaseInfo: getAppBaseInfo,
  1077. getDeviceInfo: getDeviceInfo,
  1078. getWindowInfo: getWindowInfo,
  1079. getAppAuthorizeSetting: getAppAuthorizeSetting,
  1080. compressImage: compressImage
  1081. };
  1082. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  1083. var canIUses = [];
  1084. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  1085. function processCallback(methodName, method, returnValue) {
  1086. return function (res) {
  1087. return method(processReturnValue(methodName, res, returnValue));
  1088. };
  1089. }
  1090. function processArgs(methodName, fromArgs) {
  1091. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1092. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  1093. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1094. if (isPlainObject(fromArgs)) {
  1095. // 一般 api 的参数解析
  1096. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  1097. if (isFn(argsOption)) {
  1098. argsOption = argsOption(fromArgs, toArgs) || {};
  1099. }
  1100. for (var key in fromArgs) {
  1101. if (hasOwn(argsOption, key)) {
  1102. var keyOption = argsOption[key];
  1103. if (isFn(keyOption)) {
  1104. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1105. }
  1106. if (!keyOption) {
  1107. // 不支持的参数
  1108. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  1109. } else if (isStr(keyOption)) {
  1110. // 重写参数 key
  1111. toArgs[keyOption] = fromArgs[key];
  1112. } else if (isPlainObject(keyOption)) {
  1113. // {name:newName,value:value}可重新指定参数 key:value
  1114. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1115. }
  1116. } else if (CALLBACKS.indexOf(key) !== -1) {
  1117. if (isFn(fromArgs[key])) {
  1118. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  1119. }
  1120. } else {
  1121. if (!keepFromArgs) {
  1122. toArgs[key] = fromArgs[key];
  1123. }
  1124. }
  1125. }
  1126. return toArgs;
  1127. } else if (isFn(fromArgs)) {
  1128. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1129. }
  1130. return fromArgs;
  1131. }
  1132. function processReturnValue(methodName, res, returnValue) {
  1133. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1134. if (isFn(protocols.returnValue)) {
  1135. // 处理通用 returnValue
  1136. res = protocols.returnValue(methodName, res);
  1137. }
  1138. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1139. }
  1140. function wrapper(methodName, method) {
  1141. if (hasOwn(protocols, methodName)) {
  1142. var protocol = protocols[methodName];
  1143. if (!protocol) {
  1144. // 暂不支持的 api
  1145. return function () {
  1146. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  1147. };
  1148. }
  1149. return function (arg1, arg2) {
  1150. // 目前 api 最多两个参数
  1151. var options = protocol;
  1152. if (isFn(protocol)) {
  1153. options = protocol(arg1);
  1154. }
  1155. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1156. var args = [arg1];
  1157. if (typeof arg2 !== 'undefined') {
  1158. args.push(arg2);
  1159. }
  1160. if (isFn(options.name)) {
  1161. methodName = options.name(arg1);
  1162. } else if (isStr(options.name)) {
  1163. methodName = options.name;
  1164. }
  1165. var returnValue = wx[methodName].apply(wx, args);
  1166. if (isSyncApi(methodName)) {
  1167. // 同步 api
  1168. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1169. }
  1170. return returnValue;
  1171. };
  1172. }
  1173. return method;
  1174. }
  1175. var todoApis = Object.create(null);
  1176. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1177. function createTodoApi(name) {
  1178. return function todoApi(_ref) {
  1179. var fail = _ref.fail,
  1180. complete = _ref.complete;
  1181. var res = {
  1182. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1183. };
  1184. isFn(fail) && fail(res);
  1185. isFn(complete) && complete(res);
  1186. };
  1187. }
  1188. TODOS.forEach(function (name) {
  1189. todoApis[name] = createTodoApi(name);
  1190. });
  1191. var providers = {
  1192. oauth: ['weixin'],
  1193. share: ['weixin'],
  1194. payment: ['wxpay'],
  1195. push: ['weixin']
  1196. };
  1197. function getProvider(_ref2) {
  1198. var service = _ref2.service,
  1199. success = _ref2.success,
  1200. fail = _ref2.fail,
  1201. complete = _ref2.complete;
  1202. var res = false;
  1203. if (providers[service]) {
  1204. res = {
  1205. errMsg: 'getProvider:ok',
  1206. service: service,
  1207. provider: providers[service]
  1208. };
  1209. isFn(success) && success(res);
  1210. } else {
  1211. res = {
  1212. errMsg: 'getProvider:fail service not found'
  1213. };
  1214. isFn(fail) && fail(res);
  1215. }
  1216. isFn(complete) && complete(res);
  1217. }
  1218. var extraApi = /*#__PURE__*/Object.freeze({
  1219. __proto__: null,
  1220. getProvider: getProvider
  1221. });
  1222. var getEmitter = function () {
  1223. var Emitter;
  1224. return function getUniEmitter() {
  1225. if (!Emitter) {
  1226. Emitter = new _vue.default();
  1227. }
  1228. return Emitter;
  1229. };
  1230. }();
  1231. function apply(ctx, method, args) {
  1232. return ctx[method].apply(ctx, args);
  1233. }
  1234. function $on() {
  1235. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1236. }
  1237. function $off() {
  1238. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1239. }
  1240. function $once() {
  1241. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1242. }
  1243. function $emit() {
  1244. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1245. }
  1246. var eventApi = /*#__PURE__*/Object.freeze({
  1247. __proto__: null,
  1248. $on: $on,
  1249. $off: $off,
  1250. $once: $once,
  1251. $emit: $emit
  1252. });
  1253. /**
  1254. * 框架内 try-catch
  1255. */
  1256. /**
  1257. * 开发者 try-catch
  1258. */
  1259. function tryCatch(fn) {
  1260. return function () {
  1261. try {
  1262. return fn.apply(fn, arguments);
  1263. } catch (e) {
  1264. // TODO
  1265. console.error(e);
  1266. }
  1267. };
  1268. }
  1269. function getApiCallbacks(params) {
  1270. var apiCallbacks = {};
  1271. for (var name in params) {
  1272. var param = params[name];
  1273. if (isFn(param)) {
  1274. apiCallbacks[name] = tryCatch(param);
  1275. delete params[name];
  1276. }
  1277. }
  1278. return apiCallbacks;
  1279. }
  1280. var cid;
  1281. var cidErrMsg;
  1282. var enabled;
  1283. function normalizePushMessage(message) {
  1284. try {
  1285. return JSON.parse(message);
  1286. } catch (e) {}
  1287. return message;
  1288. }
  1289. function invokePushCallback(args) {
  1290. if (args.type === 'enabled') {
  1291. enabled = true;
  1292. } else if (args.type === 'clientId') {
  1293. cid = args.cid;
  1294. cidErrMsg = args.errMsg;
  1295. invokeGetPushCidCallbacks(cid, args.errMsg);
  1296. } else if (args.type === 'pushMsg') {
  1297. var message = {
  1298. type: 'receive',
  1299. data: normalizePushMessage(args.message)
  1300. };
  1301. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1302. var callback = onPushMessageCallbacks[i];
  1303. callback(message);
  1304. // 该消息已被阻止
  1305. if (message.stopped) {
  1306. break;
  1307. }
  1308. }
  1309. } else if (args.type === 'click') {
  1310. onPushMessageCallbacks.forEach(function (callback) {
  1311. callback({
  1312. type: 'click',
  1313. data: normalizePushMessage(args.message)
  1314. });
  1315. });
  1316. }
  1317. }
  1318. var getPushCidCallbacks = [];
  1319. function invokeGetPushCidCallbacks(cid, errMsg) {
  1320. getPushCidCallbacks.forEach(function (callback) {
  1321. callback(cid, errMsg);
  1322. });
  1323. getPushCidCallbacks.length = 0;
  1324. }
  1325. function getPushClientId(args) {
  1326. if (!isPlainObject(args)) {
  1327. args = {};
  1328. }
  1329. var _getApiCallbacks = getApiCallbacks(args),
  1330. success = _getApiCallbacks.success,
  1331. fail = _getApiCallbacks.fail,
  1332. complete = _getApiCallbacks.complete;
  1333. var hasSuccess = isFn(success);
  1334. var hasFail = isFn(fail);
  1335. var hasComplete = isFn(complete);
  1336. Promise.resolve().then(function () {
  1337. if (typeof enabled === 'undefined') {
  1338. enabled = false;
  1339. cid = '';
  1340. cidErrMsg = 'uniPush is not enabled';
  1341. }
  1342. getPushCidCallbacks.push(function (cid, errMsg) {
  1343. var res;
  1344. if (cid) {
  1345. res = {
  1346. errMsg: 'getPushClientId:ok',
  1347. cid: cid
  1348. };
  1349. hasSuccess && success(res);
  1350. } else {
  1351. res = {
  1352. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1353. };
  1354. hasFail && fail(res);
  1355. }
  1356. hasComplete && complete(res);
  1357. });
  1358. if (typeof cid !== 'undefined') {
  1359. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1360. }
  1361. });
  1362. }
  1363. var onPushMessageCallbacks = [];
  1364. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1365. var onPushMessage = function onPushMessage(fn) {
  1366. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1367. onPushMessageCallbacks.push(fn);
  1368. }
  1369. };
  1370. var offPushMessage = function offPushMessage(fn) {
  1371. if (!fn) {
  1372. onPushMessageCallbacks.length = 0;
  1373. } else {
  1374. var index = onPushMessageCallbacks.indexOf(fn);
  1375. if (index > -1) {
  1376. onPushMessageCallbacks.splice(index, 1);
  1377. }
  1378. }
  1379. };
  1380. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1381. if (!baseInfo) {
  1382. baseInfo = wx.getSystemInfoSync();
  1383. }
  1384. var host = baseInfo ? baseInfo.host : null;
  1385. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1386. var api = /*#__PURE__*/Object.freeze({
  1387. __proto__: null,
  1388. shareVideoMessage: shareVideoMessage,
  1389. getPushClientId: getPushClientId,
  1390. onPushMessage: onPushMessage,
  1391. offPushMessage: offPushMessage,
  1392. invokePushCallback: invokePushCallback
  1393. });
  1394. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1395. function findVmByVueId(vm, vuePid) {
  1396. var $children = vm.$children;
  1397. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1398. for (var i = $children.length - 1; i >= 0; i--) {
  1399. var childVm = $children[i];
  1400. if (childVm.$scope._$vueId === vuePid) {
  1401. return childVm;
  1402. }
  1403. }
  1404. // 反向递归查找
  1405. var parentVm;
  1406. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1407. parentVm = findVmByVueId($children[_i], vuePid);
  1408. if (parentVm) {
  1409. return parentVm;
  1410. }
  1411. }
  1412. }
  1413. function initBehavior(options) {
  1414. return Behavior(options);
  1415. }
  1416. function isPage() {
  1417. return !!this.route;
  1418. }
  1419. function initRelation(detail) {
  1420. this.triggerEvent('__l', detail);
  1421. }
  1422. function selectAllComponents(mpInstance, selector, $refs) {
  1423. var components = mpInstance.selectAllComponents(selector) || [];
  1424. components.forEach(function (component) {
  1425. var ref = component.dataset.ref;
  1426. $refs[ref] = component.$vm || toSkip(component);
  1427. {
  1428. if (component.dataset.vueGeneric === 'scoped') {
  1429. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1430. selectAllComponents(scopedComponent, selector, $refs);
  1431. });
  1432. }
  1433. }
  1434. });
  1435. }
  1436. function syncRefs(refs, newRefs) {
  1437. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1438. var newKeys = Object.keys(newRefs);
  1439. newKeys.forEach(function (key) {
  1440. var oldValue = refs[key];
  1441. var newValue = newRefs[key];
  1442. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1443. return oldValue.includes(value);
  1444. })) {
  1445. return;
  1446. }
  1447. refs[key] = newValue;
  1448. oldKeys.delete(key);
  1449. });
  1450. oldKeys.forEach(function (key) {
  1451. delete refs[key];
  1452. });
  1453. return refs;
  1454. }
  1455. function initRefs(vm) {
  1456. var mpInstance = vm.$scope;
  1457. var refs = {};
  1458. Object.defineProperty(vm, '$refs', {
  1459. get: function get() {
  1460. var $refs = {};
  1461. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1462. // TODO 暂不考虑 for 中的 scoped
  1463. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1464. forComponents.forEach(function (component) {
  1465. var ref = component.dataset.ref;
  1466. if (!$refs[ref]) {
  1467. $refs[ref] = [];
  1468. }
  1469. $refs[ref].push(component.$vm || toSkip(component));
  1470. });
  1471. return syncRefs(refs, $refs);
  1472. }
  1473. });
  1474. }
  1475. function handleLink(event) {
  1476. var _ref3 = event.detail || event.value,
  1477. vuePid = _ref3.vuePid,
  1478. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1479. var parentVm;
  1480. if (vuePid) {
  1481. parentVm = findVmByVueId(this.$vm, vuePid);
  1482. }
  1483. if (!parentVm) {
  1484. parentVm = this.$vm;
  1485. }
  1486. vueOptions.parent = parentVm;
  1487. }
  1488. function markMPComponent(component) {
  1489. // 在 Vue 中标记为小程序组件
  1490. var IS_MP = '__v_isMPComponent';
  1491. Object.defineProperty(component, IS_MP, {
  1492. configurable: true,
  1493. enumerable: false,
  1494. value: true
  1495. });
  1496. return component;
  1497. }
  1498. function toSkip(obj) {
  1499. var OB = '__ob__';
  1500. var SKIP = '__v_skip';
  1501. if (isObject(obj) && Object.isExtensible(obj)) {
  1502. // 避免被 @vue/composition-api 观测
  1503. Object.defineProperty(obj, OB, {
  1504. configurable: true,
  1505. enumerable: false,
  1506. value: (0, _defineProperty2.default)({}, SKIP, true)
  1507. });
  1508. }
  1509. return obj;
  1510. }
  1511. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1512. function initWorkletMethods(mpMethods, vueMethods) {
  1513. if (vueMethods) {
  1514. Object.keys(vueMethods).forEach(function (name) {
  1515. var matches = name.match(WORKLET_RE);
  1516. if (matches) {
  1517. var workletName = matches[1];
  1518. mpMethods[name] = vueMethods[name];
  1519. mpMethods[workletName] = vueMethods[workletName];
  1520. }
  1521. });
  1522. }
  1523. }
  1524. var MPPage = Page;
  1525. var MPComponent = Component;
  1526. var customizeRE = /:/g;
  1527. var customize = cached(function (str) {
  1528. return camelize(str.replace(customizeRE, '-'));
  1529. });
  1530. function initTriggerEvent(mpInstance) {
  1531. var oldTriggerEvent = mpInstance.triggerEvent;
  1532. var newTriggerEvent = function newTriggerEvent(event) {
  1533. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1534. args[_key3 - 1] = arguments[_key3];
  1535. }
  1536. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1537. if (this.$vm || this.dataset && this.dataset.comType) {
  1538. event = customize(event);
  1539. } else {
  1540. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1541. var newEvent = customize(event);
  1542. if (newEvent !== event) {
  1543. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1544. }
  1545. }
  1546. return oldTriggerEvent.apply(this, [event].concat(args));
  1547. };
  1548. try {
  1549. // 京东小程序 triggerEvent 为只读
  1550. mpInstance.triggerEvent = newTriggerEvent;
  1551. } catch (error) {
  1552. mpInstance._triggerEvent = newTriggerEvent;
  1553. }
  1554. }
  1555. function initHook(name, options, isComponent) {
  1556. var oldHook = options[name];
  1557. options[name] = function () {
  1558. markMPComponent(this);
  1559. initTriggerEvent(this);
  1560. if (oldHook) {
  1561. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1562. args[_key4] = arguments[_key4];
  1563. }
  1564. return oldHook.apply(this, args);
  1565. }
  1566. };
  1567. }
  1568. if (!MPPage.__$wrappered) {
  1569. MPPage.__$wrappered = true;
  1570. Page = function Page() {
  1571. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1572. initHook('onLoad', options);
  1573. return MPPage(options);
  1574. };
  1575. Page.after = MPPage.after;
  1576. Component = function Component() {
  1577. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1578. initHook('created', options);
  1579. return MPComponent(options);
  1580. };
  1581. }
  1582. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1583. function initMocks(vm, mocks) {
  1584. var mpInstance = vm.$mp[vm.mpType];
  1585. mocks.forEach(function (mock) {
  1586. if (hasOwn(mpInstance, mock)) {
  1587. vm[mock] = mpInstance[mock];
  1588. }
  1589. });
  1590. }
  1591. function hasHook(hook, vueOptions) {
  1592. if (!vueOptions) {
  1593. return true;
  1594. }
  1595. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1596. return true;
  1597. }
  1598. vueOptions = vueOptions.default || vueOptions;
  1599. if (isFn(vueOptions)) {
  1600. if (isFn(vueOptions.extendOptions[hook])) {
  1601. return true;
  1602. }
  1603. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1604. return true;
  1605. }
  1606. return false;
  1607. }
  1608. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1609. return true;
  1610. }
  1611. var mixins = vueOptions.mixins;
  1612. if (Array.isArray(mixins)) {
  1613. return !!mixins.find(function (mixin) {
  1614. return hasHook(hook, mixin);
  1615. });
  1616. }
  1617. }
  1618. function initHooks(mpOptions, hooks, vueOptions) {
  1619. hooks.forEach(function (hook) {
  1620. if (hasHook(hook, vueOptions)) {
  1621. mpOptions[hook] = function (args) {
  1622. return this.$vm && this.$vm.__call_hook(hook, args);
  1623. };
  1624. }
  1625. });
  1626. }
  1627. function initUnknownHooks(mpOptions, vueOptions) {
  1628. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1629. findHooks(vueOptions).forEach(function (hook) {
  1630. return initHook$1(mpOptions, hook, excludes);
  1631. });
  1632. }
  1633. function findHooks(vueOptions) {
  1634. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1635. if (vueOptions) {
  1636. Object.keys(vueOptions).forEach(function (name) {
  1637. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1638. hooks.push(name);
  1639. }
  1640. });
  1641. }
  1642. return hooks;
  1643. }
  1644. function initHook$1(mpOptions, hook, excludes) {
  1645. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1646. mpOptions[hook] = function (args) {
  1647. return this.$vm && this.$vm.__call_hook(hook, args);
  1648. };
  1649. }
  1650. }
  1651. function initVueComponent(Vue, vueOptions) {
  1652. vueOptions = vueOptions.default || vueOptions;
  1653. var VueComponent;
  1654. if (isFn(vueOptions)) {
  1655. VueComponent = vueOptions;
  1656. } else {
  1657. VueComponent = Vue.extend(vueOptions);
  1658. }
  1659. vueOptions = VueComponent.options;
  1660. return [VueComponent, vueOptions];
  1661. }
  1662. function initSlots(vm, vueSlots) {
  1663. if (Array.isArray(vueSlots) && vueSlots.length) {
  1664. var $slots = Object.create(null);
  1665. vueSlots.forEach(function (slotName) {
  1666. $slots[slotName] = true;
  1667. });
  1668. vm.$scopedSlots = vm.$slots = $slots;
  1669. }
  1670. }
  1671. function initVueIds(vueIds, mpInstance) {
  1672. vueIds = (vueIds || '').split(',');
  1673. var len = vueIds.length;
  1674. if (len === 1) {
  1675. mpInstance._$vueId = vueIds[0];
  1676. } else if (len === 2) {
  1677. mpInstance._$vueId = vueIds[0];
  1678. mpInstance._$vuePid = vueIds[1];
  1679. }
  1680. }
  1681. function initData(vueOptions, context) {
  1682. var data = vueOptions.data || {};
  1683. var methods = vueOptions.methods || {};
  1684. if (typeof data === 'function') {
  1685. try {
  1686. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1687. } catch (e) {
  1688. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1689. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1690. }
  1691. }
  1692. } else {
  1693. try {
  1694. // 对 data 格式化
  1695. data = JSON.parse(JSON.stringify(data));
  1696. } catch (e) {}
  1697. }
  1698. if (!isPlainObject(data)) {
  1699. data = {};
  1700. }
  1701. Object.keys(methods).forEach(function (methodName) {
  1702. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1703. data[methodName] = methods[methodName];
  1704. }
  1705. });
  1706. return data;
  1707. }
  1708. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1709. function createObserver(name) {
  1710. return function observer(newVal, oldVal) {
  1711. if (this.$vm) {
  1712. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1713. }
  1714. };
  1715. }
  1716. function initBehaviors(vueOptions, initBehavior) {
  1717. var vueBehaviors = vueOptions.behaviors;
  1718. var vueExtends = vueOptions.extends;
  1719. var vueMixins = vueOptions.mixins;
  1720. var vueProps = vueOptions.props;
  1721. if (!vueProps) {
  1722. vueOptions.props = vueProps = [];
  1723. }
  1724. var behaviors = [];
  1725. if (Array.isArray(vueBehaviors)) {
  1726. vueBehaviors.forEach(function (behavior) {
  1727. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1728. if (behavior === 'uni://form-field') {
  1729. if (Array.isArray(vueProps)) {
  1730. vueProps.push('name');
  1731. vueProps.push('value');
  1732. } else {
  1733. vueProps.name = {
  1734. type: String,
  1735. default: ''
  1736. };
  1737. vueProps.value = {
  1738. type: [String, Number, Boolean, Array, Object, Date],
  1739. default: ''
  1740. };
  1741. }
  1742. }
  1743. });
  1744. }
  1745. if (isPlainObject(vueExtends) && vueExtends.props) {
  1746. behaviors.push(initBehavior({
  1747. properties: initProperties(vueExtends.props, true)
  1748. }));
  1749. }
  1750. if (Array.isArray(vueMixins)) {
  1751. vueMixins.forEach(function (vueMixin) {
  1752. if (isPlainObject(vueMixin) && vueMixin.props) {
  1753. behaviors.push(initBehavior({
  1754. properties: initProperties(vueMixin.props, true)
  1755. }));
  1756. }
  1757. });
  1758. }
  1759. return behaviors;
  1760. }
  1761. function parsePropType(key, type, defaultValue, file) {
  1762. // [String]=>String
  1763. if (Array.isArray(type) && type.length === 1) {
  1764. return type[0];
  1765. }
  1766. return type;
  1767. }
  1768. function initProperties(props) {
  1769. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1770. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1771. var options = arguments.length > 3 ? arguments[3] : undefined;
  1772. var properties = {};
  1773. if (!isBehavior) {
  1774. properties.vueId = {
  1775. type: String,
  1776. value: ''
  1777. };
  1778. {
  1779. if (options.virtualHost) {
  1780. properties.virtualHostStyle = {
  1781. type: null,
  1782. value: ''
  1783. };
  1784. properties.virtualHostClass = {
  1785. type: null,
  1786. value: ''
  1787. };
  1788. }
  1789. }
  1790. // scopedSlotsCompiler auto
  1791. properties.scopedSlotsCompiler = {
  1792. type: String,
  1793. value: ''
  1794. };
  1795. properties.vueSlots = {
  1796. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1797. type: null,
  1798. value: [],
  1799. observer: function observer(newVal, oldVal) {
  1800. var $slots = Object.create(null);
  1801. newVal.forEach(function (slotName) {
  1802. $slots[slotName] = true;
  1803. });
  1804. this.setData({
  1805. $slots: $slots
  1806. });
  1807. }
  1808. };
  1809. }
  1810. if (Array.isArray(props)) {
  1811. // ['title']
  1812. props.forEach(function (key) {
  1813. properties[key] = {
  1814. type: null,
  1815. observer: createObserver(key)
  1816. };
  1817. });
  1818. } else if (isPlainObject(props)) {
  1819. // {title:{type:String,default:''},content:String}
  1820. Object.keys(props).forEach(function (key) {
  1821. var opts = props[key];
  1822. if (isPlainObject(opts)) {
  1823. // title:{type:String,default:''}
  1824. var value = opts.default;
  1825. if (isFn(value)) {
  1826. value = value();
  1827. }
  1828. opts.type = parsePropType(key, opts.type);
  1829. properties[key] = {
  1830. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1831. value: value,
  1832. observer: createObserver(key)
  1833. };
  1834. } else {
  1835. // content:String
  1836. var type = parsePropType(key, opts);
  1837. properties[key] = {
  1838. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1839. observer: createObserver(key)
  1840. };
  1841. }
  1842. });
  1843. }
  1844. return properties;
  1845. }
  1846. function wrapper$1(event) {
  1847. // TODO 又得兼容 mpvue 的 mp 对象
  1848. try {
  1849. event.mp = JSON.parse(JSON.stringify(event));
  1850. } catch (e) {}
  1851. event.stopPropagation = noop;
  1852. event.preventDefault = noop;
  1853. event.target = event.target || {};
  1854. if (!hasOwn(event, 'detail')) {
  1855. event.detail = {};
  1856. }
  1857. if (hasOwn(event, 'markerId')) {
  1858. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1859. event.detail.markerId = event.markerId;
  1860. }
  1861. if (isPlainObject(event.detail)) {
  1862. event.target = Object.assign({}, event.target, event.detail);
  1863. }
  1864. return event;
  1865. }
  1866. function getExtraValue(vm, dataPathsArray) {
  1867. var context = vm;
  1868. dataPathsArray.forEach(function (dataPathArray) {
  1869. var dataPath = dataPathArray[0];
  1870. var value = dataPathArray[2];
  1871. if (dataPath || typeof value !== 'undefined') {
  1872. // ['','',index,'disable']
  1873. var propPath = dataPathArray[1];
  1874. var valuePath = dataPathArray[3];
  1875. var vFor;
  1876. if (Number.isInteger(dataPath)) {
  1877. vFor = dataPath;
  1878. } else if (!dataPath) {
  1879. vFor = context;
  1880. } else if (typeof dataPath === 'string' && dataPath) {
  1881. if (dataPath.indexOf('#s#') === 0) {
  1882. vFor = dataPath.substr(3);
  1883. } else {
  1884. vFor = vm.__get_value(dataPath, context);
  1885. }
  1886. }
  1887. if (Number.isInteger(vFor)) {
  1888. context = value;
  1889. } else if (!propPath) {
  1890. context = vFor[value];
  1891. } else {
  1892. if (Array.isArray(vFor)) {
  1893. context = vFor.find(function (vForItem) {
  1894. return vm.__get_value(propPath, vForItem) === value;
  1895. });
  1896. } else if (isPlainObject(vFor)) {
  1897. context = Object.keys(vFor).find(function (vForKey) {
  1898. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1899. });
  1900. } else {
  1901. console.error('v-for 暂不支持循环数据:', vFor);
  1902. }
  1903. }
  1904. if (valuePath) {
  1905. context = vm.__get_value(valuePath, context);
  1906. }
  1907. }
  1908. });
  1909. return context;
  1910. }
  1911. function processEventExtra(vm, extra, event, __args__) {
  1912. var extraObj = {};
  1913. if (Array.isArray(extra) && extra.length) {
  1914. /**
  1915. *[
  1916. * ['data.items', 'data.id', item.data.id],
  1917. * ['metas', 'id', meta.id]
  1918. *],
  1919. *[
  1920. * ['data.items', 'data.id', item.data.id],
  1921. * ['metas', 'id', meta.id]
  1922. *],
  1923. *'test'
  1924. */
  1925. extra.forEach(function (dataPath, index) {
  1926. if (typeof dataPath === 'string') {
  1927. if (!dataPath) {
  1928. // model,prop.sync
  1929. extraObj['$' + index] = vm;
  1930. } else {
  1931. if (dataPath === '$event') {
  1932. // $event
  1933. extraObj['$' + index] = event;
  1934. } else if (dataPath === 'arguments') {
  1935. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1936. } else if (dataPath.indexOf('$event.') === 0) {
  1937. // $event.target.value
  1938. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1939. } else {
  1940. extraObj['$' + index] = vm.__get_value(dataPath);
  1941. }
  1942. }
  1943. } else {
  1944. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1945. }
  1946. });
  1947. }
  1948. return extraObj;
  1949. }
  1950. function getObjByArray(arr) {
  1951. var obj = {};
  1952. for (var i = 1; i < arr.length; i++) {
  1953. var element = arr[i];
  1954. obj[element[0]] = element[1];
  1955. }
  1956. return obj;
  1957. }
  1958. function processEventArgs(vm, event) {
  1959. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1960. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1961. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1962. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1963. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1964. // fixed 用户直接触发 mpInstance.triggerEvent
  1965. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  1966. if (isCustom) {
  1967. // 自定义事件
  1968. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  1969. if (!args.length) {
  1970. // 无参数,直接传入 event 或 detail 数组
  1971. if (isCustomMPEvent) {
  1972. return [event];
  1973. }
  1974. return __args__;
  1975. }
  1976. }
  1977. var extraObj = processEventExtra(vm, extra, event, __args__);
  1978. var ret = [];
  1979. args.forEach(function (arg) {
  1980. if (arg === '$event') {
  1981. if (methodName === '__set_model' && !isCustom) {
  1982. // input v-model value
  1983. ret.push(event.target.value);
  1984. } else {
  1985. if (isCustom && !isCustomMPEvent) {
  1986. ret.push(__args__[0]);
  1987. } else {
  1988. // wxcomponent 组件或内置组件
  1989. ret.push(event);
  1990. }
  1991. }
  1992. } else {
  1993. if (Array.isArray(arg) && arg[0] === 'o') {
  1994. ret.push(getObjByArray(arg));
  1995. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1996. ret.push(extraObj[arg]);
  1997. } else {
  1998. ret.push(arg);
  1999. }
  2000. }
  2001. });
  2002. return ret;
  2003. }
  2004. var ONCE = '~';
  2005. var CUSTOM = '^';
  2006. function isMatchEventType(eventType, optType) {
  2007. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  2008. }
  2009. function getContextVm(vm) {
  2010. var $parent = vm.$parent;
  2011. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  2012. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  2013. $parent = $parent.$parent;
  2014. }
  2015. return $parent && $parent.$parent;
  2016. }
  2017. function handleEvent(event) {
  2018. var _this2 = this;
  2019. event = wrapper$1(event);
  2020. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  2021. var dataset = (event.currentTarget || event.target).dataset;
  2022. if (!dataset) {
  2023. return console.warn('事件信息不存在');
  2024. }
  2025. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  2026. if (!eventOpts) {
  2027. return console.warn('事件信息不存在');
  2028. }
  2029. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  2030. var eventType = event.type;
  2031. var ret = [];
  2032. eventOpts.forEach(function (eventOpt) {
  2033. var type = eventOpt[0];
  2034. var eventsArray = eventOpt[1];
  2035. var isCustom = type.charAt(0) === CUSTOM;
  2036. type = isCustom ? type.slice(1) : type;
  2037. var isOnce = type.charAt(0) === ONCE;
  2038. type = isOnce ? type.slice(1) : type;
  2039. if (eventsArray && isMatchEventType(eventType, type)) {
  2040. eventsArray.forEach(function (eventArray) {
  2041. var methodName = eventArray[0];
  2042. if (methodName) {
  2043. var handlerCtx = _this2.$vm;
  2044. if (handlerCtx.$options.generic) {
  2045. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  2046. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  2047. }
  2048. if (methodName === '$emit') {
  2049. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  2050. return;
  2051. }
  2052. var handler = handlerCtx[methodName];
  2053. if (!isFn(handler)) {
  2054. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  2055. var path = _this2.route || _this2.is;
  2056. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  2057. }
  2058. if (isOnce) {
  2059. if (handler.once) {
  2060. return;
  2061. }
  2062. handler.once = true;
  2063. }
  2064. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  2065. params = Array.isArray(params) ? params : [];
  2066. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  2067. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  2068. // eslint-disable-next-line no-sparse-arrays
  2069. params = params.concat([,,,,,,,,,, event]);
  2070. }
  2071. ret.push(handler.apply(handlerCtx, params));
  2072. }
  2073. });
  2074. }
  2075. });
  2076. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  2077. return ret[0];
  2078. }
  2079. }
  2080. var eventChannels = {};
  2081. function getEventChannel(id) {
  2082. var eventChannel = eventChannels[id];
  2083. delete eventChannels[id];
  2084. return eventChannel;
  2085. }
  2086. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  2087. function initEventChannel() {
  2088. _vue.default.prototype.getOpenerEventChannel = function () {
  2089. // 微信小程序使用自身getOpenerEventChannel
  2090. {
  2091. return this.$scope.getOpenerEventChannel();
  2092. }
  2093. };
  2094. var callHook = _vue.default.prototype.__call_hook;
  2095. _vue.default.prototype.__call_hook = function (hook, args) {
  2096. if (hook === 'onLoad' && args && args.__id__) {
  2097. this.__eventChannel__ = getEventChannel(args.__id__);
  2098. delete args.__id__;
  2099. }
  2100. return callHook.call(this, hook, args);
  2101. };
  2102. }
  2103. function initScopedSlotsParams() {
  2104. var center = {};
  2105. var parents = {};
  2106. function currentId(fn) {
  2107. var vueIds = this.$options.propsData.vueId;
  2108. if (vueIds) {
  2109. var vueId = vueIds.split(',')[0];
  2110. fn(vueId);
  2111. }
  2112. }
  2113. _vue.default.prototype.$hasSSP = function (vueId) {
  2114. var slot = center[vueId];
  2115. if (!slot) {
  2116. parents[vueId] = this;
  2117. this.$on('hook:destroyed', function () {
  2118. delete parents[vueId];
  2119. });
  2120. }
  2121. return slot;
  2122. };
  2123. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  2124. var slot = center[vueId];
  2125. if (slot) {
  2126. var params = slot[name] || [];
  2127. if (needAll) {
  2128. return params;
  2129. }
  2130. return params[0];
  2131. }
  2132. };
  2133. _vue.default.prototype.$setSSP = function (name, value) {
  2134. var index = 0;
  2135. currentId.call(this, function (vueId) {
  2136. var slot = center[vueId];
  2137. var params = slot[name] = slot[name] || [];
  2138. params.push(value);
  2139. index = params.length - 1;
  2140. });
  2141. return index;
  2142. };
  2143. _vue.default.prototype.$initSSP = function () {
  2144. currentId.call(this, function (vueId) {
  2145. center[vueId] = {};
  2146. });
  2147. };
  2148. _vue.default.prototype.$callSSP = function () {
  2149. currentId.call(this, function (vueId) {
  2150. if (parents[vueId]) {
  2151. parents[vueId].$forceUpdate();
  2152. }
  2153. });
  2154. };
  2155. _vue.default.mixin({
  2156. destroyed: function destroyed() {
  2157. var propsData = this.$options.propsData;
  2158. var vueId = propsData && propsData.vueId;
  2159. if (vueId) {
  2160. delete center[vueId];
  2161. delete parents[vueId];
  2162. }
  2163. }
  2164. });
  2165. }
  2166. function parseBaseApp(vm, _ref4) {
  2167. var mocks = _ref4.mocks,
  2168. initRefs = _ref4.initRefs;
  2169. initEventChannel();
  2170. {
  2171. initScopedSlotsParams();
  2172. }
  2173. if (vm.$options.store) {
  2174. _vue.default.prototype.$store = vm.$options.store;
  2175. }
  2176. uniIdMixin(_vue.default);
  2177. _vue.default.prototype.mpHost = "mp-weixin";
  2178. _vue.default.mixin({
  2179. beforeCreate: function beforeCreate() {
  2180. if (!this.$options.mpType) {
  2181. return;
  2182. }
  2183. this.mpType = this.$options.mpType;
  2184. this.$mp = (0, _defineProperty2.default)({
  2185. data: {}
  2186. }, this.mpType, this.$options.mpInstance);
  2187. this.$scope = this.$options.mpInstance;
  2188. delete this.$options.mpType;
  2189. delete this.$options.mpInstance;
  2190. if (this.mpType === 'page' && typeof getApp === 'function') {
  2191. // hack vue-i18n
  2192. var app = getApp();
  2193. if (app.$vm && app.$vm.$i18n) {
  2194. this._i18n = app.$vm.$i18n;
  2195. }
  2196. }
  2197. if (this.mpType !== 'app') {
  2198. initRefs(this);
  2199. initMocks(this, mocks);
  2200. }
  2201. }
  2202. });
  2203. var appOptions = {
  2204. onLaunch: function onLaunch(args) {
  2205. if (this.$vm) {
  2206. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2207. return;
  2208. }
  2209. {
  2210. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2211. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2212. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2213. }
  2214. }
  2215. this.$vm = vm;
  2216. this.$vm.$mp = {
  2217. app: this
  2218. };
  2219. this.$vm.$scope = this;
  2220. // vm 上也挂载 globalData
  2221. this.$vm.globalData = this.globalData;
  2222. this.$vm._isMounted = true;
  2223. this.$vm.__call_hook('mounted', args);
  2224. this.$vm.__call_hook('onLaunch', args);
  2225. }
  2226. };
  2227. // 兼容旧版本 globalData
  2228. appOptions.globalData = vm.$options.globalData || {};
  2229. // 将 methods 中的方法挂在 getApp() 中
  2230. var methods = vm.$options.methods;
  2231. if (methods) {
  2232. Object.keys(methods).forEach(function (name) {
  2233. appOptions[name] = methods[name];
  2234. });
  2235. }
  2236. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  2237. initHooks(appOptions, hooks);
  2238. initUnknownHooks(appOptions, vm.$options);
  2239. return appOptions;
  2240. }
  2241. function parseApp(vm) {
  2242. return parseBaseApp(vm, {
  2243. mocks: mocks,
  2244. initRefs: initRefs
  2245. });
  2246. }
  2247. function createApp(vm) {
  2248. App(parseApp(vm));
  2249. return vm;
  2250. }
  2251. var encodeReserveRE = /[!'()*]/g;
  2252. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2253. return '%' + c.charCodeAt(0).toString(16);
  2254. };
  2255. var commaRE = /%2C/g;
  2256. // fixed encodeURIComponent which is more conformant to RFC3986:
  2257. // - escapes [!'()*]
  2258. // - preserve commas
  2259. var encode = function encode(str) {
  2260. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2261. };
  2262. function stringifyQuery(obj) {
  2263. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2264. var res = obj ? Object.keys(obj).map(function (key) {
  2265. var val = obj[key];
  2266. if (val === undefined) {
  2267. return '';
  2268. }
  2269. if (val === null) {
  2270. return encodeStr(key);
  2271. }
  2272. if (Array.isArray(val)) {
  2273. var result = [];
  2274. val.forEach(function (val2) {
  2275. if (val2 === undefined) {
  2276. return;
  2277. }
  2278. if (val2 === null) {
  2279. result.push(encodeStr(key));
  2280. } else {
  2281. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2282. }
  2283. });
  2284. return result.join('&');
  2285. }
  2286. return encodeStr(key) + '=' + encodeStr(val);
  2287. }).filter(function (x) {
  2288. return x.length > 0;
  2289. }).join('&') : null;
  2290. return res ? "?".concat(res) : '';
  2291. }
  2292. function parseBaseComponent(vueComponentOptions) {
  2293. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2294. isPage = _ref5.isPage,
  2295. initRelation = _ref5.initRelation;
  2296. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2297. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2298. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2299. VueComponent = _initVueComponent2[0],
  2300. vueOptions = _initVueComponent2[1];
  2301. var options = _objectSpread({
  2302. multipleSlots: true,
  2303. // styleIsolation: 'apply-shared',
  2304. addGlobalClass: true
  2305. }, vueOptions.options || {});
  2306. {
  2307. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2308. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2309. Object.assign(options, vueOptions['mp-weixin'].options);
  2310. }
  2311. }
  2312. var componentOptions = {
  2313. options: options,
  2314. data: initData(vueOptions, _vue.default.prototype),
  2315. behaviors: initBehaviors(vueOptions, initBehavior),
  2316. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2317. lifetimes: {
  2318. attached: function attached() {
  2319. var properties = this.properties;
  2320. var options = {
  2321. mpType: isPage.call(this) ? 'page' : 'component',
  2322. mpInstance: this,
  2323. propsData: properties
  2324. };
  2325. initVueIds(properties.vueId, this);
  2326. // 处理父子关系
  2327. initRelation.call(this, {
  2328. vuePid: this._$vuePid,
  2329. vueOptions: options
  2330. });
  2331. // 初始化 vue 实例
  2332. this.$vm = new VueComponent(options);
  2333. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2334. initSlots(this.$vm, properties.vueSlots);
  2335. // 触发首次 setData
  2336. this.$vm.$mount();
  2337. },
  2338. ready: function ready() {
  2339. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2340. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2341. if (this.$vm) {
  2342. this.$vm._isMounted = true;
  2343. this.$vm.__call_hook('mounted');
  2344. this.$vm.__call_hook('onReady');
  2345. }
  2346. },
  2347. detached: function detached() {
  2348. this.$vm && this.$vm.$destroy();
  2349. }
  2350. },
  2351. pageLifetimes: {
  2352. show: function show(args) {
  2353. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2354. },
  2355. hide: function hide() {
  2356. this.$vm && this.$vm.__call_hook('onPageHide');
  2357. },
  2358. resize: function resize(size) {
  2359. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2360. }
  2361. },
  2362. methods: {
  2363. __l: handleLink,
  2364. __e: handleEvent
  2365. }
  2366. };
  2367. // externalClasses
  2368. if (vueOptions.externalClasses) {
  2369. componentOptions.externalClasses = vueOptions.externalClasses;
  2370. }
  2371. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2372. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2373. componentOptions.methods[callMethod] = function (args) {
  2374. return this.$vm[callMethod](args);
  2375. };
  2376. });
  2377. }
  2378. if (needVueOptions) {
  2379. return [componentOptions, vueOptions, VueComponent];
  2380. }
  2381. if (isPage) {
  2382. return componentOptions;
  2383. }
  2384. return [componentOptions, VueComponent];
  2385. }
  2386. function parseComponent(vueComponentOptions, needVueOptions) {
  2387. return parseBaseComponent(vueComponentOptions, {
  2388. isPage: isPage,
  2389. initRelation: initRelation
  2390. }, needVueOptions);
  2391. }
  2392. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2393. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2394. function parseBasePage(vuePageOptions) {
  2395. var _parseComponent = parseComponent(vuePageOptions, true),
  2396. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2397. pageOptions = _parseComponent2[0],
  2398. vueOptions = _parseComponent2[1];
  2399. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2400. pageOptions.methods.onLoad = function (query) {
  2401. this.options = query;
  2402. var copyQuery = Object.assign({}, query);
  2403. delete copyQuery.__id__;
  2404. this.$page = {
  2405. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2406. };
  2407. this.$vm.$mp.query = query; // 兼容 mpvue
  2408. this.$vm.__call_hook('onLoad', query);
  2409. };
  2410. {
  2411. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2412. }
  2413. {
  2414. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2415. }
  2416. return pageOptions;
  2417. }
  2418. function parsePage(vuePageOptions) {
  2419. return parseBasePage(vuePageOptions);
  2420. }
  2421. function createPage(vuePageOptions) {
  2422. {
  2423. return Component(parsePage(vuePageOptions));
  2424. }
  2425. }
  2426. function createComponent(vueOptions) {
  2427. {
  2428. return Component(parseComponent(vueOptions));
  2429. }
  2430. }
  2431. function createSubpackageApp(vm) {
  2432. var appOptions = parseApp(vm);
  2433. var app = getApp({
  2434. allowDefault: true
  2435. });
  2436. vm.$scope = app;
  2437. var globalData = app.globalData;
  2438. if (globalData) {
  2439. Object.keys(appOptions.globalData).forEach(function (name) {
  2440. if (!hasOwn(globalData, name)) {
  2441. globalData[name] = appOptions.globalData[name];
  2442. }
  2443. });
  2444. }
  2445. Object.keys(appOptions).forEach(function (name) {
  2446. if (!hasOwn(app, name)) {
  2447. app[name] = appOptions[name];
  2448. }
  2449. });
  2450. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2451. wx.onAppShow(function () {
  2452. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2453. args[_key5] = arguments[_key5];
  2454. }
  2455. vm.__call_hook('onShow', args);
  2456. });
  2457. }
  2458. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2459. wx.onAppHide(function () {
  2460. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2461. args[_key6] = arguments[_key6];
  2462. }
  2463. vm.__call_hook('onHide', args);
  2464. });
  2465. }
  2466. if (isFn(appOptions.onLaunch)) {
  2467. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2468. vm.__call_hook('onLaunch', args);
  2469. }
  2470. return vm;
  2471. }
  2472. function createPlugin(vm) {
  2473. var appOptions = parseApp(vm);
  2474. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2475. wx.onAppShow(function () {
  2476. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2477. args[_key7] = arguments[_key7];
  2478. }
  2479. vm.__call_hook('onShow', args);
  2480. });
  2481. }
  2482. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2483. wx.onAppHide(function () {
  2484. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2485. args[_key8] = arguments[_key8];
  2486. }
  2487. vm.__call_hook('onHide', args);
  2488. });
  2489. }
  2490. if (isFn(appOptions.onLaunch)) {
  2491. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2492. vm.__call_hook('onLaunch', args);
  2493. }
  2494. return vm;
  2495. }
  2496. todos.forEach(function (todoApi) {
  2497. protocols[todoApi] = false;
  2498. });
  2499. canIUses.forEach(function (canIUseApi) {
  2500. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2501. if (!wx.canIUse(apiName)) {
  2502. protocols[canIUseApi] = false;
  2503. }
  2504. });
  2505. var uni = {};
  2506. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2507. uni = new Proxy({}, {
  2508. get: function get(target, name) {
  2509. if (hasOwn(target, name)) {
  2510. return target[name];
  2511. }
  2512. if (baseApi[name]) {
  2513. return baseApi[name];
  2514. }
  2515. if (api[name]) {
  2516. return promisify(name, api[name]);
  2517. }
  2518. {
  2519. if (extraApi[name]) {
  2520. return promisify(name, extraApi[name]);
  2521. }
  2522. if (todoApis[name]) {
  2523. return promisify(name, todoApis[name]);
  2524. }
  2525. }
  2526. if (eventApi[name]) {
  2527. return eventApi[name];
  2528. }
  2529. return promisify(name, wrapper(name, wx[name]));
  2530. },
  2531. set: function set(target, name, value) {
  2532. target[name] = value;
  2533. return true;
  2534. }
  2535. });
  2536. } else {
  2537. Object.keys(baseApi).forEach(function (name) {
  2538. uni[name] = baseApi[name];
  2539. });
  2540. {
  2541. Object.keys(todoApis).forEach(function (name) {
  2542. uni[name] = promisify(name, todoApis[name]);
  2543. });
  2544. Object.keys(extraApi).forEach(function (name) {
  2545. uni[name] = promisify(name, extraApi[name]);
  2546. });
  2547. }
  2548. Object.keys(eventApi).forEach(function (name) {
  2549. uni[name] = eventApi[name];
  2550. });
  2551. Object.keys(api).forEach(function (name) {
  2552. uni[name] = promisify(name, api[name]);
  2553. });
  2554. Object.keys(wx).forEach(function (name) {
  2555. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2556. uni[name] = promisify(name, wrapper(name, wx[name]));
  2557. }
  2558. });
  2559. }
  2560. wx.createApp = createApp;
  2561. wx.createPage = createPage;
  2562. wx.createComponent = createComponent;
  2563. wx.createSubpackageApp = createSubpackageApp;
  2564. wx.createPlugin = createPlugin;
  2565. var uni$1 = uni;
  2566. var _default = uni$1;
  2567. exports.default = _default;
  2568. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  2569. /***/ }),
  2570. /***/ 20:
  2571. /*!****************************************************************!*\
  2572. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2573. \****************************************************************/
  2574. /*! no static exports found */
  2575. /***/ (function(module, exports) {
  2576. function _iterableToArray(iter) {
  2577. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2578. }
  2579. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2580. /***/ }),
  2581. /***/ 21:
  2582. /*!******************************************************************!*\
  2583. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2584. \******************************************************************/
  2585. /*! no static exports found */
  2586. /***/ (function(module, exports) {
  2587. function _nonIterableSpread() {
  2588. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2589. }
  2590. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2591. /***/ }),
  2592. /***/ 211:
  2593. /*!**********************************************************************************!*\
  2594. !*** E:/zswl/code/charge_miniapp/charge_miniapp/components/r-canvas/r-canvas.js ***!
  2595. \**********************************************************************************/
  2596. /*! no static exports found */
  2597. /***/ (function(module, exports, __webpack_require__) {
  2598. "use strict";
  2599. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  2600. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  2601. Object.defineProperty(exports, "__esModule", {
  2602. value: true
  2603. });
  2604. exports.default = void 0;
  2605. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  2606. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  2607. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  2608. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  2609. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  2610. var _default = {
  2611. data: function data() {
  2612. return {
  2613. system_info: {},
  2614. //system info
  2615. canvas_width: 0,
  2616. //canvas width px
  2617. canvas_height: 0,
  2618. //canvas height px
  2619. ctx: null,
  2620. //canvas object
  2621. canvas_id: null,
  2622. //canvas id
  2623. hidden: true,
  2624. //Whether to hide canvas
  2625. scale: 1,
  2626. //canvas scale
  2627. r_canvas_scale: 1,
  2628. if_ctx: true
  2629. };
  2630. },
  2631. methods: {
  2632. /**
  2633. * save r-canvas.vue object
  2634. * @param {Object} that
  2635. */
  2636. // saveThis(that){
  2637. // rCanvasThis = that
  2638. // },
  2639. /**
  2640. * Draw round rect text
  2641. * @param {Object} config
  2642. * @param {Number} config.x x坐标
  2643. * @param {Number} config.y y坐标
  2644. * @param {Number} config.w 宽度
  2645. * @param {Number} config.h 高度
  2646. * @param {Number} config.radius 圆角弧度
  2647. * @param {String} config.fill_color 矩形颜色
  2648. */
  2649. fillRoundRect: function fillRoundRect(config) {
  2650. var _this = this;
  2651. return new Promise(function (resolve, reject) {
  2652. var x = _this.compatibilitySize(parseFloat(config.x) * _this.scale);
  2653. var y = _this.compatibilitySize(parseFloat(config.y) * _this.scale);
  2654. var w = _this.compatibilitySize(parseFloat(config.w) * _this.scale);
  2655. var h = _this.compatibilitySize(parseFloat(config.h) * _this.scale);
  2656. var radius = config.radius ? parseFloat(config.radius) * _this.scale : 10 * _this.scale;
  2657. var fill_color = config.fill_color || "black";
  2658. // The diameter of the circle must be less than the width and height of the rectangle
  2659. if (2 * radius > w || 2 * radius > h) {
  2660. reject("The diameter of the circle must be less than the width and height of the rectangle");
  2661. return false;
  2662. }
  2663. _this.ctx.save();
  2664. _this.ctx.translate(x, y);
  2665. //
  2666. _this.drawRoundRectPath({
  2667. w: w,
  2668. h: h,
  2669. radius: radius
  2670. });
  2671. _this.ctx.fillStyle = fill_color;
  2672. _this.ctx.fill();
  2673. _this.ctx.restore();
  2674. resolve();
  2675. });
  2676. },
  2677. /**
  2678. * Draws the sides of a rounded rectangle
  2679. * @param {Object} config
  2680. * @param {Number} config.w 宽度
  2681. * @param {Number} config.h 高度
  2682. * @param {Number} config.radius 圆角弧度
  2683. */
  2684. drawRoundRectPath: function drawRoundRectPath(config) {
  2685. this.ctx.beginPath(0);
  2686. this.ctx.arc(config.w - config.radius, config.h - config.radius, config.radius, 0, Math.PI / 2);
  2687. this.ctx.lineTo(config.radius, config.h);
  2688. this.ctx.arc(config.radius, config.h - config.radius, config.radius, Math.PI / 2, Math.PI);
  2689. this.ctx.lineTo(0, config.radius);
  2690. this.ctx.arc(config.radius, config.radius, config.radius, Math.PI, Math.PI * 3 / 2);
  2691. this.ctx.lineTo(config.w - config.radius, 0);
  2692. this.ctx.arc(config.w - config.radius, config.radius, config.radius, Math.PI * 3 / 2, Math.PI * 2);
  2693. this.ctx.lineTo(config.w, config.h - config.radius);
  2694. this.ctx.closePath();
  2695. },
  2696. /**
  2697. * Draw special Text,line wrapping is not supported
  2698. * @param {Object} config
  2699. * @param {String} config.text 文字
  2700. * @param {Number} config.x x坐标
  2701. * @param {Number} config.y y坐标
  2702. * @param {String} config.font_color 文字颜色
  2703. * @param {String} config.font_family 文字字体
  2704. * @param {Number} config.font_size 文字大小(px)
  2705. */
  2706. drawSpecialText: function drawSpecialText(params) {
  2707. var _this2 = this;
  2708. var general = params.general;
  2709. var list = params.list;
  2710. return new Promise( /*#__PURE__*/function () {
  2711. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
  2712. var i, font_size;
  2713. return _regenerator.default.wrap(function _callee$(_context) {
  2714. while (1) {
  2715. switch (_context.prev = _context.next) {
  2716. case 0:
  2717. if (general) {
  2718. _context.next = 5;
  2719. break;
  2720. }
  2721. reject("general cannot be empty:101");
  2722. return _context.abrupt("return");
  2723. case 5:
  2724. if (!(list && list.length > 0)) {
  2725. _context.next = 19;
  2726. break;
  2727. }
  2728. _context.t0 = _regenerator.default.keys(list);
  2729. case 7:
  2730. if ((_context.t1 = _context.t0()).done) {
  2731. _context.next = 16;
  2732. break;
  2733. }
  2734. i = _context.t1.value;
  2735. if (i != 0) {
  2736. font_size = list[i - 1].font_size ? parseFloat(list[i - 1].font_size) : 20;
  2737. _this2.ctx.setFontSize(font_size);
  2738. general.x = parseFloat(general.x) + _this2.ctx.measureText(list[i - 1].text).width;
  2739. }
  2740. list[i].x = general.x;
  2741. list[i].y = general.y + (list[i].margin_top ? parseFloat(list[i].margin_top) : 0);
  2742. _context.next = 14;
  2743. return _this2.drawText(list[i]);
  2744. case 14:
  2745. _context.next = 7;
  2746. break;
  2747. case 16:
  2748. resolve();
  2749. _context.next = 21;
  2750. break;
  2751. case 19:
  2752. reject("The length of config arr is less than 0");
  2753. return _context.abrupt("return");
  2754. case 21:
  2755. case "end":
  2756. return _context.stop();
  2757. }
  2758. }
  2759. }, _callee);
  2760. }));
  2761. return function (_x, _x2) {
  2762. return _ref.apply(this, arguments);
  2763. };
  2764. }());
  2765. },
  2766. /**
  2767. * array delete empty
  2768. * @param {Object} arr
  2769. */
  2770. arrDeleteEmpty: function arrDeleteEmpty(arr) {
  2771. var newArr = [];
  2772. for (var i in arr) {
  2773. if (arr[i]) {
  2774. newArr.push(arr[i]);
  2775. }
  2776. }
  2777. return newArr;
  2778. },
  2779. /**
  2780. * Draw Text,support line
  2781. * @param {Object} config
  2782. * @param {String} config.text 文字
  2783. * @param {Number} config.max_width 文字最大宽度(大于宽度自动换行)
  2784. * @param {Number} config.line_height 文字上下行间距
  2785. * @param {Number} config.x x坐标
  2786. * @param {Number} config.y y坐标
  2787. * @param {String} config.font_color 文字颜色
  2788. * @param {String} config.font_family 文字字体 默认值:Arial
  2789. * @param {String} config.text_align 文字对齐方式(left/center/right)
  2790. * @param {Number} config.font_size 文字大小(px)
  2791. * @param {Boolean} config.line_through_height 中划线大小
  2792. * @param {Boolean} config.line_through_color 中划线颜色
  2793. * @param {String} config.font_style 规定文字样式
  2794. * @param {String} config.font_variant 规定字体变体
  2795. * @param {String} config.font_weight 规定字体粗细
  2796. * @param {String} config.line_through_cap 线末端类型
  2797. * @param {String} config.line_clamp 最大行数
  2798. * @param {String} config.line_clamp_hint 超过line_clamp后,尾部显示的自定义标识 如 ...
  2799. * @param {String} config.is_line_break 是否开启换行符换行
  2800. *
  2801. */
  2802. drawText: function drawText(config) {
  2803. var _this3 = this;
  2804. var configuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2805. configuration['line_num'] = configuration.line_num ? configuration.line_num : 0;
  2806. configuration['text_width'] = configuration.text_width ? configuration.text_width : 0;
  2807. return new Promise( /*#__PURE__*/function () {
  2808. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
  2809. var draw_width, draw_height, draw_x, draw_y, font_size, font_color, font_family, line_height, text_align, font_weight, font_variant, font_style, line_clamp_hint, lineBreakJoinText, max_width, splitTextArr, newSplitTextArr, current_text, text_arr, i, current_text_arr, json_current_text, x, w, y;
  2810. return _regenerator.default.wrap(function _callee2$(_context2) {
  2811. while (1) {
  2812. switch (_context2.prev = _context2.next) {
  2813. case 0:
  2814. if (!config.text) {
  2815. _context2.next = 85;
  2816. break;
  2817. }
  2818. draw_width = 0, draw_height = 0, draw_x = config.x, draw_y = config.y;
  2819. font_size = config.font_size ? parseFloat(config.font_size) * _this3.scale : 20 * _this3.scale;
  2820. font_color = config.font_color || "#000";
  2821. font_family = config.font_family || "Arial";
  2822. line_height = config.line_height || config.font_size || 20;
  2823. text_align = config.text_align || "left";
  2824. font_weight = config.font_weight || "normal";
  2825. font_variant = config.font_variant || "normal";
  2826. font_style = config.font_style || "normal";
  2827. line_clamp_hint = config.line_clamp_hint || '...';
  2828. lineBreakJoinText = "";
  2829. max_width = config.max_width ? parseFloat(config.max_width) * _this3.scale : 0; // checkout is line break
  2830. if (!config.is_line_break) {
  2831. _context2.next = 28;
  2832. break;
  2833. }
  2834. splitTextArr = config.text.split(/[\n]/g);
  2835. if (!(splitTextArr && splitTextArr.length > 0)) {
  2836. _context2.next = 26;
  2837. break;
  2838. }
  2839. newSplitTextArr = _this3.arrDeleteEmpty(splitTextArr);
  2840. if (!(newSplitTextArr && newSplitTextArr.length > 0)) {
  2841. _context2.next = 22;
  2842. break;
  2843. }
  2844. lineBreakJoinText = newSplitTextArr.slice(1).join("\n");
  2845. config.text = newSplitTextArr[0];
  2846. _context2.next = 24;
  2847. break;
  2848. case 22:
  2849. reject("Text cannot be empty:103");
  2850. return _context2.abrupt("return");
  2851. case 24:
  2852. _context2.next = 28;
  2853. break;
  2854. case 26:
  2855. reject("Text cannot be empty:102");
  2856. return _context2.abrupt("return");
  2857. case 28:
  2858. _this3.ctx.setFillStyle(font_color); // color
  2859. _this3.ctx.textAlign = text_align;
  2860. _this3.ctx.font = "".concat(font_style, " ").concat(font_variant, " ").concat(font_weight, " ").concat(parseInt(font_size), "px ").concat(font_family);
  2861. if (configuration.text_width >= _this3.ctx.measureText(config.text).width) {
  2862. draw_width = configuration.text_width;
  2863. } else if (max_width > 0) {
  2864. draw_width = max_width < _this3.ctx.measureText(config.text).width ? _this3.resetCompatibilitySize(max_width) : _this3.resetCompatibilitySize(_this3.ctx.measureText(config.text).width);
  2865. } else {
  2866. draw_width = _this3.ctx.measureText(config.text).width;
  2867. }
  2868. configuration.text_width = draw_width / _this3.scale;
  2869. if (!(max_width && _this3.compatibilitySize(_this3.ctx.measureText(config.text).width) > _this3.compatibilitySize(max_width))) {
  2870. _context2.next = 72;
  2871. break;
  2872. }
  2873. current_text = "";
  2874. text_arr = config.text.split("");
  2875. _context2.t0 = _regenerator.default.keys(text_arr);
  2876. case 37:
  2877. if ((_context2.t1 = _context2.t0()).done) {
  2878. _context2.next = 70;
  2879. break;
  2880. }
  2881. i = _context2.t1.value;
  2882. if (!(_this3.compatibilitySize(_this3.ctx.measureText(current_text + text_arr[i]).width) > _this3.compatibilitySize(max_width))) {
  2883. _context2.next = 67;
  2884. break;
  2885. }
  2886. if (!(config.line_clamp && parseInt(config.line_clamp) == 1)) {
  2887. _context2.next = 56;
  2888. break;
  2889. }
  2890. // Subtracting the current_text tail width from the line_clamp_hint width
  2891. current_text_arr = current_text.split('');
  2892. json_current_text = '';
  2893. case 43:
  2894. if (false) {}
  2895. current_text_arr = current_text_arr.slice(1);
  2896. json_current_text = current_text_arr.join('');
  2897. if (!(_this3.compatibilitySize(_this3.ctx.measureText(json_current_text).width) <= _this3.compatibilitySize(_this3.ctx.measureText(line_clamp_hint).width))) {
  2898. _context2.next = 49;
  2899. break;
  2900. }
  2901. current_text = current_text.replace(json_current_text, '');
  2902. return _context2.abrupt("break", 51);
  2903. case 49:
  2904. _context2.next = 43;
  2905. break;
  2906. case 51:
  2907. configuration.line_num += 1;
  2908. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  2909. _this3.ctx.fillText(current_text + line_clamp_hint, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  2910. _context2.next = 64;
  2911. break;
  2912. case 56:
  2913. configuration.line_num += 1;
  2914. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  2915. _this3.ctx.fillText(current_text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  2916. config.text = text_arr.slice(i).join("");
  2917. config.y = config.y + line_height;
  2918. if (config.line_clamp) {
  2919. config.line_clamp = parseInt(config.line_clamp) - 1;
  2920. }
  2921. _context2.next = 64;
  2922. return _this3.drawText(config, configuration);
  2923. case 64:
  2924. return _context2.abrupt("break", 70);
  2925. case 67:
  2926. current_text = current_text + text_arr[i];
  2927. case 68:
  2928. _context2.next = 37;
  2929. break;
  2930. case 70:
  2931. _context2.next = 77;
  2932. break;
  2933. case 72:
  2934. if (config.line_through_height) {
  2935. x = parseFloat(config.x) * _this3.scale;
  2936. y = parseFloat(config.y) * _this3.scale - font_size / 2.6;
  2937. if (text_align == "left") {
  2938. w = _this3.ctx.measureText(config.text).width / 1.1 + parseFloat(config.x) * _this3.scale;
  2939. } else if (text_align == "right") {
  2940. w = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1;
  2941. } else if (text_align == "center") {
  2942. x = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1 / 2;
  2943. w = parseFloat(config.x) * _this3.scale + _this3.ctx.measureText(config.text).width / 1.1 / 2;
  2944. }
  2945. _this3.drawLineTo({
  2946. x: x,
  2947. y: y,
  2948. w: w,
  2949. h: y,
  2950. line_width: config.line_through_height,
  2951. line_color: config.line_through_color,
  2952. line_cap: config.line_through_cap
  2953. });
  2954. }
  2955. configuration.line_num += 1;
  2956. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  2957. _this3.ctx.fillText(config.text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  2958. if (config.line_clamp) {
  2959. config.line_clamp = parseInt(config.line_clamp) - 1;
  2960. }
  2961. case 77:
  2962. if (!lineBreakJoinText) {
  2963. _context2.next = 80;
  2964. break;
  2965. }
  2966. _context2.next = 80;
  2967. return _this3.drawText(_objectSpread(_objectSpread({}, config), {}, {
  2968. text: lineBreakJoinText,
  2969. y: config.y + line_height
  2970. }), configuration);
  2971. case 80:
  2972. draw_height = config.font_size * configuration.line_num;
  2973. draw_width = configuration.text_width;
  2974. resolve({
  2975. draw_width: draw_width,
  2976. draw_height: draw_height,
  2977. draw_x: draw_x,
  2978. draw_y: draw_y
  2979. });
  2980. _context2.next = 86;
  2981. break;
  2982. case 85:
  2983. reject("Text cannot be empty:101");
  2984. case 86:
  2985. case "end":
  2986. return _context2.stop();
  2987. }
  2988. }
  2989. }, _callee2);
  2990. }));
  2991. return function (_x3, _x4) {
  2992. return _ref2.apply(this, arguments);
  2993. };
  2994. }());
  2995. },
  2996. /**
  2997. * Draw Line
  2998. * @param {Object} config
  2999. * @param {Object} config.x x坐标
  3000. * @param {Object} config.y y坐标
  3001. * @param {Object} config.w 线的宽度
  3002. * @param {Object} config.h 线的高度
  3003. * @param {Object} config.line_width 线的宽度
  3004. * @param {Object} config.line_color 线条颜色
  3005. */
  3006. drawLineTo: function drawLineTo(config) {
  3007. var x = this.compatibilitySize(config.x);
  3008. var y = this.compatibilitySize(config.y);
  3009. var w = this.compatibilitySize(config.w);
  3010. var h = this.compatibilitySize(config.h);
  3011. var line_width = config.line_width ? parseFloat(config.line_width) * this.scale : 1 * this.scale;
  3012. var line_color = config.line_color || "black";
  3013. var line_cap = config.line_cap || "butt";
  3014. this.ctx.beginPath();
  3015. this.ctx.lineCap = line_cap;
  3016. this.ctx.lineWidth = line_width;
  3017. this.ctx.strokeStyle = line_color;
  3018. this.ctx.moveTo(x, y);
  3019. this.ctx.lineTo(w, h);
  3020. this.ctx.stroke();
  3021. },
  3022. /**
  3023. * Compatibility px
  3024. * @param {Object} size
  3025. */
  3026. compatibilitySize: function compatibilitySize(size) {
  3027. var canvasSize = parseFloat(size) / 750 * this.system_info.windowWidth;
  3028. canvasSize = parseFloat(canvasSize * 2);
  3029. return canvasSize;
  3030. },
  3031. /**
  3032. * Restore compatibility px
  3033. * @param {Object} size
  3034. */
  3035. resetCompatibilitySize: function resetCompatibilitySize(size) {
  3036. var canvasSize = parseFloat(size / 2) / this.system_info.windowWidth * 750;
  3037. return canvasSize;
  3038. },
  3039. /**
  3040. * Init canvas
  3041. */
  3042. init: function init(config) {
  3043. var _this4 = this;
  3044. return new Promise( /*#__PURE__*/function () {
  3045. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  3046. var system_info;
  3047. return _regenerator.default.wrap(function _callee3$(_context3) {
  3048. while (1) {
  3049. switch (_context3.prev = _context3.next) {
  3050. case 0:
  3051. if (config.canvas_id) {
  3052. _context3.next = 3;
  3053. break;
  3054. }
  3055. reject("Canvas ID cannot be empty, please refer to the usage example");
  3056. return _context3.abrupt("return");
  3057. case 3:
  3058. _this4.hidden = config.hidden;
  3059. _this4.canvas_id = config.canvas_id;
  3060. _context3.next = 7;
  3061. return uni.getSystemInfoSync();
  3062. case 7:
  3063. system_info = _context3.sent;
  3064. _this4.system_info = system_info;
  3065. _this4.scale = config.scale && parseFloat(config.scale) > 0 ? parseInt(config.scale) : 1;
  3066. _this4.canvas_width = (config.canvas_width ? _this4.compatibilitySize(config.canvas_width) : system_info.windowWidth) * _this4.scale;
  3067. _this4.canvas_height = (config.canvas_height ? _this4.compatibilitySize(config.canvas_height) : system_info.windowHeight) * _this4.scale, _this4.r_canvas_scale = 1 / _this4.scale;
  3068. _this4.ctx = uni.createCanvasContext(_this4.canvas_id, _this4);
  3069. _this4.setCanvasConfig({
  3070. global_alpha: config.global_alpha ? parseFloat(config.global_alpha) : 1,
  3071. backgroundColor: config.background_color ? config.background_color : "transparent"
  3072. });
  3073. resolve();
  3074. case 15:
  3075. case "end":
  3076. return _context3.stop();
  3077. }
  3078. }
  3079. }, _callee3);
  3080. }));
  3081. return function (_x5, _x6) {
  3082. return _ref3.apply(this, arguments);
  3083. };
  3084. }());
  3085. },
  3086. /**
  3087. * clear canvas all path
  3088. */
  3089. clearCanvas: function clearCanvas() {
  3090. var _this5 = this;
  3091. return new Promise( /*#__PURE__*/function () {
  3092. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  3093. return _regenerator.default.wrap(function _callee4$(_context4) {
  3094. while (1) {
  3095. switch (_context4.prev = _context4.next) {
  3096. case 0:
  3097. if (_this5.ctx) {
  3098. _context4.next = 5;
  3099. break;
  3100. }
  3101. reject("canvas is not initialized:101");
  3102. return _context4.abrupt("return");
  3103. case 5:
  3104. _this5.ctx.clearRect(0, 0, parseFloat(_this5.canvas_width) * _this5.scale, parseFloat(_this5.canvas_height) * _this5.scale);
  3105. _context4.next = 8;
  3106. return _this5.draw();
  3107. case 8:
  3108. resolve();
  3109. case 9:
  3110. case "end":
  3111. return _context4.stop();
  3112. }
  3113. }
  3114. }, _callee4);
  3115. }));
  3116. return function (_x7, _x8) {
  3117. return _ref4.apply(this, arguments);
  3118. };
  3119. }());
  3120. },
  3121. /**
  3122. * Set canvas config
  3123. * @param {Object} config
  3124. */
  3125. setCanvasConfig: function setCanvasConfig(config) {
  3126. this.ctx.globalAlpha = config.global_alpha;
  3127. this.ctx.fillStyle = config.backgroundColor;
  3128. this.ctx.fillRect(0, 0, parseFloat(this.canvas_width) * this.scale, parseFloat(this.canvas_height) * this.scale);
  3129. },
  3130. /**
  3131. * set canvas width
  3132. * @param {Object} width
  3133. */
  3134. setCanvasWidth: function setCanvasWidth(width) {
  3135. if (!width) {
  3136. uni.showToast({
  3137. title: 'setCanvasWidth:width error',
  3138. icon: 'none'
  3139. });
  3140. }
  3141. this.canvas_width = this.compatibilitySize(parseFloat(width)) * this.scale;
  3142. this.ctx.width = this.canvas_width;
  3143. },
  3144. /**
  3145. * set canvas height
  3146. * @param {Object} height
  3147. */
  3148. setCanvasHeight: function setCanvasHeight(height) {
  3149. if (!height) {
  3150. uni.showToast({
  3151. title: 'setCanvasWidth:height error',
  3152. icon: 'none'
  3153. });
  3154. }
  3155. this.canvas_height = this.compatibilitySize(parseFloat(height)) * this.scale;
  3156. this.ctx.height = this.canvas_height;
  3157. },
  3158. /**
  3159. * Draw to filepath
  3160. */
  3161. draw: function draw(callback) {
  3162. var _this6 = this;
  3163. return new Promise(function (resolve, reject) {
  3164. var stop = setTimeout(function () {
  3165. _this6.ctx.draw(false, setTimeout(function () {
  3166. uni.canvasToTempFilePath({
  3167. canvasId: _this6.canvas_id,
  3168. quality: 1,
  3169. success: function success(res) {
  3170. console.log('res', res);
  3171. resolve(res);
  3172. callback && callback(res);
  3173. },
  3174. fail: function fail(err) {
  3175. reject(JSON.stringify(err) || "Failed to generate poster:101");
  3176. }
  3177. }, _this6);
  3178. }, 300));
  3179. clearTimeout(stop);
  3180. }, 300);
  3181. });
  3182. },
  3183. /**
  3184. * draw rect
  3185. * @param {Number} config.x x坐标
  3186. * @param {Number} config.y y坐标
  3187. * @param {Number} config.w 图形宽度(px)
  3188. * @param {Number} config.h 图形高度(px)
  3189. * @param {Number} config.color 图形颜色
  3190. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  3191. * @param {Number} config.border_width 边框大小
  3192. * @param {Number} config.border_color 边框颜色
  3193. *
  3194. */
  3195. drawRect: function drawRect(config) {
  3196. var _this7 = this;
  3197. return new Promise( /*#__PURE__*/function () {
  3198. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(resolve, reject) {
  3199. var sub_config, color;
  3200. return _regenerator.default.wrap(function _callee5$(_context5) {
  3201. while (1) {
  3202. switch (_context5.prev = _context5.next) {
  3203. case 0:
  3204. if (!config.border_width || config.border_width <= 0) {
  3205. config.border_width = 0;
  3206. } else {
  3207. config.border_width = parseFloat(config.border_width);
  3208. }
  3209. if (!(parseFloat(config.border_width) > 0)) {
  3210. _context5.next = 10;
  3211. break;
  3212. }
  3213. sub_config = JSON.parse(JSON.stringify(config));
  3214. sub_config.border_width = 0;
  3215. sub_config.w = config.w + config.border_width;
  3216. sub_config.h = config.h + config.border_width;
  3217. sub_config.color = config.border_color || 'black';
  3218. if (sub_config.border_radius) {
  3219. sub_config.border_radius = parseFloat(sub_config.border_radius) + parseFloat(config.border_width) / 2;
  3220. }
  3221. _context5.next = 10;
  3222. return _this7.drawRect(sub_config);
  3223. case 10:
  3224. color = config.color || 'white';
  3225. config.x = parseFloat(config.x) + config.border_width / 2;
  3226. config.y = parseFloat(config.y) + config.border_width / 2;
  3227. config['color'] = color;
  3228. _this7.ctx.fillStyle = color;
  3229. if (config.is_radius || config.border_radius) {
  3230. _this7.setNativeBorderRadius(config);
  3231. _this7.ctx.fill();
  3232. } else {
  3233. console.log('config.border_width', config.border_width);
  3234. _this7.ctx.fillRect(_this7.compatibilitySize(config.x * _this7.scale), _this7.compatibilitySize(config.y * _this7.scale), _this7.compatibilitySize(parseFloat(config.w) * _this7.scale), _this7.compatibilitySize(parseFloat(config.h) * _this7.scale));
  3235. }
  3236. resolve();
  3237. case 17:
  3238. case "end":
  3239. return _context5.stop();
  3240. }
  3241. }
  3242. }, _callee5);
  3243. }));
  3244. return function (_x9, _x10) {
  3245. return _ref5.apply(this, arguments);
  3246. };
  3247. }());
  3248. },
  3249. /**
  3250. * Draw image
  3251. * @param {Object} config
  3252. * @param {String} config.url 图片链接
  3253. * @param {Number} config.x x坐标
  3254. * @param {Number} config.y y坐标
  3255. * @param {Number} config.w 图片宽度(px)
  3256. * @param {Number} config.h 图片高度(px)
  3257. * @param {Number} config.border_width 边大小
  3258. * @param {Number} config.border_color 边颜色
  3259. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  3260. * @param {Number} config.border_radius 圆角弧度
  3261. */
  3262. drawImage: function drawImage(config) {
  3263. var _this8 = this;
  3264. return new Promise( /*#__PURE__*/function () {
  3265. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  3266. var type, image_url, reg, imageInfoResult, base64, border_radius, multiple, err_msg;
  3267. return _regenerator.default.wrap(function _callee6$(_context6) {
  3268. while (1) {
  3269. switch (_context6.prev = _context6.next) {
  3270. case 0:
  3271. if (!config.url) {
  3272. _context6.next = 49;
  3273. break;
  3274. }
  3275. type = 0; // 1、network image 2、native image 3、base64 image
  3276. reg = /^https?/ig;
  3277. if (reg.test(config.url)) {
  3278. type = 1;
  3279. } else {
  3280. if (config.url.indexOf("data:image/png;base64") != -1 || config.url.indexOf("data:image/jpeg;base64") != -1 || config.url.indexOf("data:image/gif;base64") != -1) {
  3281. type = 3;
  3282. } else {
  3283. type = 2;
  3284. }
  3285. }
  3286. if (!(type == 1)) {
  3287. _context6.next = 9;
  3288. break;
  3289. }
  3290. _context6.next = 7;
  3291. return _this8.downLoadNetworkFile(config.url).then(function (res) {
  3292. // two function
  3293. image_url = res;
  3294. }).catch(function (err) {
  3295. reject(err);
  3296. return;
  3297. });
  3298. case 7:
  3299. _context6.next = 37;
  3300. break;
  3301. case 9:
  3302. if (!(type == 2)) {
  3303. _context6.next = 30;
  3304. break;
  3305. }
  3306. _context6.next = 12;
  3307. return uni.getImageInfo({
  3308. src: config.url
  3309. });
  3310. case 12:
  3311. imageInfoResult = _context6.sent;
  3312. _context6.prev = 13;
  3313. if (!(imageInfoResult.length <= 1)) {
  3314. _context6.next = 17;
  3315. break;
  3316. }
  3317. reject(imageInfoResult[0].errMsg + ':404');
  3318. return _context6.abrupt("return");
  3319. case 17:
  3320. _context6.next = 23;
  3321. break;
  3322. case 19:
  3323. _context6.prev = 19;
  3324. _context6.t0 = _context6["catch"](13);
  3325. reject(_context6.t0 + ':500');
  3326. return _context6.abrupt("return");
  3327. case 23:
  3328. _context6.next = 25;
  3329. return _this8.urlToBase64({
  3330. url: imageInfoResult[1].path
  3331. });
  3332. case 25:
  3333. base64 = _context6.sent;
  3334. _context6.next = 28;
  3335. return _this8.base64ToNative({
  3336. url: base64
  3337. }).then(function (res) {
  3338. image_url = res;
  3339. }).catch(function (err) {
  3340. reject(JSON.stringify(err) + ":501");
  3341. return;
  3342. });
  3343. case 28:
  3344. _context6.next = 37;
  3345. break;
  3346. case 30:
  3347. if (!(type == 3)) {
  3348. _context6.next = 35;
  3349. break;
  3350. }
  3351. _context6.next = 33;
  3352. return _this8.base64ToNative({
  3353. url: config.url
  3354. }).then(function (res) {
  3355. image_url = res;
  3356. }).catch(function (err) {
  3357. reject(JSON.stringify(err) + ":500");
  3358. return;
  3359. });
  3360. case 33:
  3361. _context6.next = 37;
  3362. break;
  3363. case 35:
  3364. reject("Other Type Errors:101");
  3365. return _context6.abrupt("return");
  3366. case 37:
  3367. if (!config.border_width) {
  3368. _context6.next = 42;
  3369. break;
  3370. }
  3371. border_radius = 0;
  3372. if (config.border_radius) {
  3373. multiple = config.w / config.border_radius;
  3374. border_radius = (parseFloat(config.w) + parseFloat(config.border_width)) / multiple;
  3375. }
  3376. // drawRect
  3377. _context6.next = 42;
  3378. return _this8.drawRect({
  3379. x: parseFloat(config.x) - parseFloat(config.border_width) / 2,
  3380. y: parseFloat(config.y) - parseFloat(config.border_width) / 2,
  3381. w: parseFloat(config.w) + parseFloat(config.border_width),
  3382. h: parseFloat(config.h) + parseFloat(config.border_width),
  3383. color: config.border_color,
  3384. border_radius: border_radius,
  3385. border_width: config.border_width,
  3386. is_radius: config.is_radius
  3387. });
  3388. case 42:
  3389. if (config.border_radius) {
  3390. config.color = config.color ? config.color : 'rgba(0,0,0,0)';
  3391. // 圆角有白边,+0.5的误差
  3392. config.w = config.w + 0.3;
  3393. config.h = config.h + 0.3;
  3394. _this8.setNativeBorderRadius(config);
  3395. } else if (config.is_radius) {
  3396. //已废弃 is_radius
  3397. _this8.ctx.setStrokeStyle("rgba(0,0,0,0)");
  3398. _this8.ctx.save();
  3399. _this8.ctx.beginPath();
  3400. _this8.ctx.arc(_this8.compatibilitySize(parseFloat(config.x) * _this8.scale + parseFloat(config.w) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale + parseFloat(config.h) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale / 2), 0, 2 * Math.PI, false);
  3401. _this8.ctx.stroke();
  3402. _this8.ctx.clip();
  3403. }
  3404. _context6.next = 45;
  3405. return _this8.ctx.drawImage(image_url, _this8.compatibilitySize(parseFloat(config.x) * _this8.scale), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale), _this8.compatibilitySize(parseFloat(config.h) * _this8.scale));
  3406. case 45:
  3407. _this8.ctx.restore(); //Restore previously saved drawing context
  3408. resolve();
  3409. _context6.next = 51;
  3410. break;
  3411. case 49:
  3412. err_msg = "Links cannot be empty:101";
  3413. reject(err_msg);
  3414. case 51:
  3415. case "end":
  3416. return _context6.stop();
  3417. }
  3418. }
  3419. }, _callee6, null, [[13, 19]]);
  3420. }));
  3421. return function (_x11, _x12) {
  3422. return _ref6.apply(this, arguments);
  3423. };
  3424. }());
  3425. },
  3426. /**
  3427. * base64 to native available path
  3428. * @param {Object} config
  3429. */
  3430. base64ToNative: function base64ToNative(config) {
  3431. return new Promise(function (resolve, reject) {
  3432. var fileName = new Date().getTime();
  3433. var filePath = "".concat(wx.env.USER_DATA_PATH, "/").concat(fileName, "_rCanvas.png");
  3434. wx.getFileSystemManager().writeFile({
  3435. filePath: filePath,
  3436. data: config.url.replace(/^data:\S+\/\S+;base64,/, ''),
  3437. encoding: 'base64',
  3438. success: function success() {
  3439. resolve(filePath);
  3440. },
  3441. fail: function fail(error) {
  3442. reject(error);
  3443. }
  3444. });
  3445. });
  3446. },
  3447. /**
  3448. * native url to base64
  3449. * @param {Object} config
  3450. */
  3451. urlToBase64: function urlToBase64(config) {
  3452. var _this9 = this;
  3453. return new Promise( /*#__PURE__*/function () {
  3454. var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(resolve, reject) {
  3455. return _regenerator.default.wrap(function _callee7$(_context7) {
  3456. while (1) {
  3457. switch (_context7.prev = _context7.next) {
  3458. case 0:
  3459. if (!(typeof window != 'undefined')) {
  3460. _context7.next = 5;
  3461. break;
  3462. }
  3463. _context7.next = 3;
  3464. return _this9.downLoadNetworkFile(config.url).then(function (res) {
  3465. // two function
  3466. resolve(res);
  3467. }).catch(function (err) {
  3468. reject(err);
  3469. });
  3470. case 3:
  3471. _context7.next = 6;
  3472. break;
  3473. case 5:
  3474. if (typeof plus != 'undefined') {
  3475. plus.io.resolveLocalFileSystemURL(config.url, function (obj) {
  3476. obj.file(function (file) {
  3477. var fileReader = new plus.io.FileReader();
  3478. fileReader.onload = function (res) {
  3479. resolve(res.target.result);
  3480. };
  3481. fileReader.onerror = function (err) {
  3482. reject(err);
  3483. };
  3484. fileReader.readAsDataURL(file);
  3485. }, function (err) {
  3486. reject(err);
  3487. });
  3488. }, function (err) {
  3489. reject(err);
  3490. });
  3491. } else if (typeof wx != 'undefined') {
  3492. wx.getFileSystemManager().readFile({
  3493. filePath: config.url,
  3494. encoding: 'base64',
  3495. success: function success(res) {
  3496. resolve('data:image/png;base64,' + res.data);
  3497. },
  3498. fail: function fail(error) {
  3499. reject(error);
  3500. }
  3501. });
  3502. }
  3503. case 6:
  3504. case "end":
  3505. return _context7.stop();
  3506. }
  3507. }
  3508. }, _callee7);
  3509. }));
  3510. return function (_x13, _x14) {
  3511. return _ref7.apply(this, arguments);
  3512. };
  3513. }());
  3514. },
  3515. setNativeBorderRadius: function setNativeBorderRadius(config) {
  3516. var border_radius = config.border_radius ? parseFloat(config.border_radius) * this.scale : 20 * this.scale;
  3517. if (parseFloat(config.w) * this.scale < 2 * border_radius) border_radius = parseFloat(config.w) * this.scale / 2;
  3518. if (parseFloat(config.h) * this.scale < 2 * border_radius) border_radius = parseFloat(config.h) * this.scale / 2;
  3519. this.ctx.beginPath();
  3520. this.ctx.moveTo(this.compatibilitySize(parseFloat(config.x) * this.scale + border_radius), this.compatibilitySize(parseFloat(config.y) * this.scale));
  3521. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  3522. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  3523. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  3524. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  3525. this.ctx.closePath();
  3526. this.ctx.strokeStyle = config.color || config.border_color || 'rgba(0,0,0,0)'; // 设置绘制边框的颜色
  3527. this.ctx.stroke();
  3528. this.ctx.save();
  3529. this.ctx.clip();
  3530. },
  3531. /**
  3532. * Download network file
  3533. * @param {Object} url : download url
  3534. */
  3535. downLoadNetworkFile: function downLoadNetworkFile(url) {
  3536. return new Promise(function (resolve, reject) {
  3537. uni.downloadFile({
  3538. url: url,
  3539. success: function success(res) {
  3540. if (res.statusCode == 200) {
  3541. resolve(res.tempFilePath);
  3542. } else {
  3543. reject("Download Image Fail:102");
  3544. }
  3545. },
  3546. fail: function fail(err) {
  3547. reject("Download Image Fail:101");
  3548. }
  3549. });
  3550. });
  3551. },
  3552. /**
  3553. * Save image to natice
  3554. * @param {Object} filePath : native imageUrl
  3555. */
  3556. saveImage: function saveImage(filePath) {
  3557. return new Promise(function (resolve, reject) {
  3558. if (!filePath) {
  3559. reject("FilePath cannot be null:101");
  3560. return;
  3561. }
  3562. uni.saveImageToPhotosAlbum({
  3563. filePath: filePath,
  3564. success: function success(res) {
  3565. resolve(res);
  3566. },
  3567. fail: function fail(err) {
  3568. reject(err);
  3569. }
  3570. });
  3571. });
  3572. }
  3573. }
  3574. };
  3575. exports.default = _default;
  3576. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  3577. /***/ }),
  3578. /***/ 22:
  3579. /*!*************************************************************!*\
  3580. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  3581. \*************************************************************/
  3582. /*! no static exports found */
  3583. /***/ (function(module, exports, __webpack_require__) {
  3584. "use strict";
  3585. /* WEBPACK VAR INJECTION */(function(uni, global) {
  3586. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3587. Object.defineProperty(exports, "__esModule", {
  3588. value: true
  3589. });
  3590. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  3591. exports.compileI18nJsonStr = compileI18nJsonStr;
  3592. exports.hasI18nJson = hasI18nJson;
  3593. exports.initVueI18n = initVueI18n;
  3594. exports.isI18nStr = isI18nStr;
  3595. exports.isString = void 0;
  3596. exports.normalizeLocale = normalizeLocale;
  3597. exports.parseI18nJson = parseI18nJson;
  3598. exports.resolveLocale = resolveLocale;
  3599. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  3600. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  3601. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  3602. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  3603. var isObject = function isObject(val) {
  3604. return val !== null && (0, _typeof2.default)(val) === 'object';
  3605. };
  3606. var defaultDelimiters = ['{', '}'];
  3607. var BaseFormatter = /*#__PURE__*/function () {
  3608. function BaseFormatter() {
  3609. (0, _classCallCheck2.default)(this, BaseFormatter);
  3610. this._caches = Object.create(null);
  3611. }
  3612. (0, _createClass2.default)(BaseFormatter, [{
  3613. key: "interpolate",
  3614. value: function interpolate(message, values) {
  3615. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  3616. if (!values) {
  3617. return [message];
  3618. }
  3619. var tokens = this._caches[message];
  3620. if (!tokens) {
  3621. tokens = parse(message, delimiters);
  3622. this._caches[message] = tokens;
  3623. }
  3624. return compile(tokens, values);
  3625. }
  3626. }]);
  3627. return BaseFormatter;
  3628. }();
  3629. exports.Formatter = BaseFormatter;
  3630. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  3631. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  3632. function parse(format, _ref) {
  3633. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  3634. startDelimiter = _ref2[0],
  3635. endDelimiter = _ref2[1];
  3636. var tokens = [];
  3637. var position = 0;
  3638. var text = '';
  3639. while (position < format.length) {
  3640. var char = format[position++];
  3641. if (char === startDelimiter) {
  3642. if (text) {
  3643. tokens.push({
  3644. type: 'text',
  3645. value: text
  3646. });
  3647. }
  3648. text = '';
  3649. var sub = '';
  3650. char = format[position++];
  3651. while (char !== undefined && char !== endDelimiter) {
  3652. sub += char;
  3653. char = format[position++];
  3654. }
  3655. var isClosed = char === endDelimiter;
  3656. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  3657. tokens.push({
  3658. value: sub,
  3659. type: type
  3660. });
  3661. }
  3662. // else if (char === '%') {
  3663. // // when found rails i18n syntax, skip text capture
  3664. // if (format[position] !== '{') {
  3665. // text += char
  3666. // }
  3667. // }
  3668. else {
  3669. text += char;
  3670. }
  3671. }
  3672. text && tokens.push({
  3673. type: 'text',
  3674. value: text
  3675. });
  3676. return tokens;
  3677. }
  3678. function compile(tokens, values) {
  3679. var compiled = [];
  3680. var index = 0;
  3681. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  3682. if (mode === 'unknown') {
  3683. return compiled;
  3684. }
  3685. while (index < tokens.length) {
  3686. var token = tokens[index];
  3687. switch (token.type) {
  3688. case 'text':
  3689. compiled.push(token.value);
  3690. break;
  3691. case 'list':
  3692. compiled.push(values[parseInt(token.value, 10)]);
  3693. break;
  3694. case 'named':
  3695. if (mode === 'named') {
  3696. compiled.push(values[token.value]);
  3697. } else {
  3698. if (true) {
  3699. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  3700. }
  3701. }
  3702. break;
  3703. case 'unknown':
  3704. if (true) {
  3705. console.warn("Detect 'unknown' type of token!");
  3706. }
  3707. break;
  3708. }
  3709. index++;
  3710. }
  3711. return compiled;
  3712. }
  3713. var LOCALE_ZH_HANS = 'zh-Hans';
  3714. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  3715. var LOCALE_ZH_HANT = 'zh-Hant';
  3716. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  3717. var LOCALE_EN = 'en';
  3718. exports.LOCALE_EN = LOCALE_EN;
  3719. var LOCALE_FR = 'fr';
  3720. exports.LOCALE_FR = LOCALE_FR;
  3721. var LOCALE_ES = 'es';
  3722. exports.LOCALE_ES = LOCALE_ES;
  3723. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3724. var hasOwn = function hasOwn(val, key) {
  3725. return hasOwnProperty.call(val, key);
  3726. };
  3727. var defaultFormatter = new BaseFormatter();
  3728. function include(str, parts) {
  3729. return !!parts.find(function (part) {
  3730. return str.indexOf(part) !== -1;
  3731. });
  3732. }
  3733. function startsWith(str, parts) {
  3734. return parts.find(function (part) {
  3735. return str.indexOf(part) === 0;
  3736. });
  3737. }
  3738. function normalizeLocale(locale, messages) {
  3739. if (!locale) {
  3740. return;
  3741. }
  3742. locale = locale.trim().replace(/_/g, '-');
  3743. if (messages && messages[locale]) {
  3744. return locale;
  3745. }
  3746. locale = locale.toLowerCase();
  3747. if (locale === 'chinese') {
  3748. // 支付宝
  3749. return LOCALE_ZH_HANS;
  3750. }
  3751. if (locale.indexOf('zh') === 0) {
  3752. if (locale.indexOf('-hans') > -1) {
  3753. return LOCALE_ZH_HANS;
  3754. }
  3755. if (locale.indexOf('-hant') > -1) {
  3756. return LOCALE_ZH_HANT;
  3757. }
  3758. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  3759. return LOCALE_ZH_HANT;
  3760. }
  3761. return LOCALE_ZH_HANS;
  3762. }
  3763. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  3764. if (messages && Object.keys(messages).length > 0) {
  3765. locales = Object.keys(messages);
  3766. }
  3767. var lang = startsWith(locale, locales);
  3768. if (lang) {
  3769. return lang;
  3770. }
  3771. }
  3772. var I18n = /*#__PURE__*/function () {
  3773. function I18n(_ref3) {
  3774. var locale = _ref3.locale,
  3775. fallbackLocale = _ref3.fallbackLocale,
  3776. messages = _ref3.messages,
  3777. watcher = _ref3.watcher,
  3778. formater = _ref3.formater;
  3779. (0, _classCallCheck2.default)(this, I18n);
  3780. this.locale = LOCALE_EN;
  3781. this.fallbackLocale = LOCALE_EN;
  3782. this.message = {};
  3783. this.messages = {};
  3784. this.watchers = [];
  3785. if (fallbackLocale) {
  3786. this.fallbackLocale = fallbackLocale;
  3787. }
  3788. this.formater = formater || defaultFormatter;
  3789. this.messages = messages || {};
  3790. this.setLocale(locale || LOCALE_EN);
  3791. if (watcher) {
  3792. this.watchLocale(watcher);
  3793. }
  3794. }
  3795. (0, _createClass2.default)(I18n, [{
  3796. key: "setLocale",
  3797. value: function setLocale(locale) {
  3798. var _this = this;
  3799. var oldLocale = this.locale;
  3800. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  3801. if (!this.messages[this.locale]) {
  3802. // 可能初始化时不存在
  3803. this.messages[this.locale] = {};
  3804. }
  3805. this.message = this.messages[this.locale];
  3806. // 仅发生变化时,通知
  3807. if (oldLocale !== this.locale) {
  3808. this.watchers.forEach(function (watcher) {
  3809. watcher(_this.locale, oldLocale);
  3810. });
  3811. }
  3812. }
  3813. }, {
  3814. key: "getLocale",
  3815. value: function getLocale() {
  3816. return this.locale;
  3817. }
  3818. }, {
  3819. key: "watchLocale",
  3820. value: function watchLocale(fn) {
  3821. var _this2 = this;
  3822. var index = this.watchers.push(fn) - 1;
  3823. return function () {
  3824. _this2.watchers.splice(index, 1);
  3825. };
  3826. }
  3827. }, {
  3828. key: "add",
  3829. value: function add(locale, message) {
  3830. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3831. var curMessages = this.messages[locale];
  3832. if (curMessages) {
  3833. if (override) {
  3834. Object.assign(curMessages, message);
  3835. } else {
  3836. Object.keys(message).forEach(function (key) {
  3837. if (!hasOwn(curMessages, key)) {
  3838. curMessages[key] = message[key];
  3839. }
  3840. });
  3841. }
  3842. } else {
  3843. this.messages[locale] = message;
  3844. }
  3845. }
  3846. }, {
  3847. key: "f",
  3848. value: function f(message, values, delimiters) {
  3849. return this.formater.interpolate(message, values, delimiters).join('');
  3850. }
  3851. }, {
  3852. key: "t",
  3853. value: function t(key, locale, values) {
  3854. var message = this.message;
  3855. if (typeof locale === 'string') {
  3856. locale = normalizeLocale(locale, this.messages);
  3857. locale && (message = this.messages[locale]);
  3858. } else {
  3859. values = locale;
  3860. }
  3861. if (!hasOwn(message, key)) {
  3862. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3863. return key;
  3864. }
  3865. return this.formater.interpolate(message[key], values).join('');
  3866. }
  3867. }]);
  3868. return I18n;
  3869. }();
  3870. exports.I18n = I18n;
  3871. function watchAppLocale(appVm, i18n) {
  3872. // 需要保证 watch 的触发在组件渲染之前
  3873. if (appVm.$watchLocale) {
  3874. // vue2
  3875. appVm.$watchLocale(function (newLocale) {
  3876. i18n.setLocale(newLocale);
  3877. });
  3878. } else {
  3879. appVm.$watch(function () {
  3880. return appVm.$locale;
  3881. }, function (newLocale) {
  3882. i18n.setLocale(newLocale);
  3883. });
  3884. }
  3885. }
  3886. function getDefaultLocale() {
  3887. if (typeof uni !== 'undefined' && uni.getLocale) {
  3888. return uni.getLocale();
  3889. }
  3890. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3891. if (typeof global !== 'undefined' && global.getLocale) {
  3892. return global.getLocale();
  3893. }
  3894. return LOCALE_EN;
  3895. }
  3896. function initVueI18n(locale) {
  3897. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3898. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3899. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3900. // 兼容旧版本入参
  3901. if (typeof locale !== 'string') {
  3902. var _ref4 = [messages, locale];
  3903. locale = _ref4[0];
  3904. messages = _ref4[1];
  3905. }
  3906. if (typeof locale !== 'string') {
  3907. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3908. locale = getDefaultLocale();
  3909. }
  3910. if (typeof fallbackLocale !== 'string') {
  3911. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3912. }
  3913. var i18n = new I18n({
  3914. locale: locale,
  3915. fallbackLocale: fallbackLocale,
  3916. messages: messages,
  3917. watcher: watcher
  3918. });
  3919. var _t = function t(key, values) {
  3920. if (typeof getApp !== 'function') {
  3921. // app view
  3922. /* eslint-disable no-func-assign */
  3923. _t = function t(key, values) {
  3924. return i18n.t(key, values);
  3925. };
  3926. } else {
  3927. var isWatchedAppLocale = false;
  3928. _t = function t(key, values) {
  3929. var appVm = getApp().$vm;
  3930. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3931. // options: {
  3932. // type: Array,
  3933. // default () {
  3934. // return [{
  3935. // icon: 'shop',
  3936. // text: t("uni-goods-nav.options.shop"),
  3937. // }, {
  3938. // icon: 'cart',
  3939. // text: t("uni-goods-nav.options.cart")
  3940. // }]
  3941. // }
  3942. // },
  3943. if (appVm) {
  3944. // 触发响应式
  3945. appVm.$locale;
  3946. if (!isWatchedAppLocale) {
  3947. isWatchedAppLocale = true;
  3948. watchAppLocale(appVm, i18n);
  3949. }
  3950. }
  3951. return i18n.t(key, values);
  3952. };
  3953. }
  3954. return _t(key, values);
  3955. };
  3956. return {
  3957. i18n: i18n,
  3958. f: function f(message, values, delimiters) {
  3959. return i18n.f(message, values, delimiters);
  3960. },
  3961. t: function t(key, values) {
  3962. return _t(key, values);
  3963. },
  3964. add: function add(locale, message) {
  3965. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3966. return i18n.add(locale, message, override);
  3967. },
  3968. watch: function watch(fn) {
  3969. return i18n.watchLocale(fn);
  3970. },
  3971. getLocale: function getLocale() {
  3972. return i18n.getLocale();
  3973. },
  3974. setLocale: function setLocale(newLocale) {
  3975. return i18n.setLocale(newLocale);
  3976. }
  3977. };
  3978. }
  3979. var isString = function isString(val) {
  3980. return typeof val === 'string';
  3981. };
  3982. exports.isString = isString;
  3983. var formater;
  3984. function hasI18nJson(jsonObj, delimiters) {
  3985. if (!formater) {
  3986. formater = new BaseFormatter();
  3987. }
  3988. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3989. var value = jsonObj[key];
  3990. if (isString(value)) {
  3991. if (isI18nStr(value, delimiters)) {
  3992. return true;
  3993. }
  3994. } else {
  3995. return hasI18nJson(value, delimiters);
  3996. }
  3997. });
  3998. }
  3999. function parseI18nJson(jsonObj, values, delimiters) {
  4000. if (!formater) {
  4001. formater = new BaseFormatter();
  4002. }
  4003. walkJsonObj(jsonObj, function (jsonObj, key) {
  4004. var value = jsonObj[key];
  4005. if (isString(value)) {
  4006. if (isI18nStr(value, delimiters)) {
  4007. jsonObj[key] = compileStr(value, values, delimiters);
  4008. }
  4009. } else {
  4010. parseI18nJson(value, values, delimiters);
  4011. }
  4012. });
  4013. return jsonObj;
  4014. }
  4015. function compileI18nJsonStr(jsonStr, _ref5) {
  4016. var locale = _ref5.locale,
  4017. locales = _ref5.locales,
  4018. delimiters = _ref5.delimiters;
  4019. if (!isI18nStr(jsonStr, delimiters)) {
  4020. return jsonStr;
  4021. }
  4022. if (!formater) {
  4023. formater = new BaseFormatter();
  4024. }
  4025. var localeValues = [];
  4026. Object.keys(locales).forEach(function (name) {
  4027. if (name !== locale) {
  4028. localeValues.push({
  4029. locale: name,
  4030. values: locales[name]
  4031. });
  4032. }
  4033. });
  4034. localeValues.unshift({
  4035. locale: locale,
  4036. values: locales[locale]
  4037. });
  4038. try {
  4039. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  4040. } catch (e) {}
  4041. return jsonStr;
  4042. }
  4043. function isI18nStr(value, delimiters) {
  4044. return value.indexOf(delimiters[0]) > -1;
  4045. }
  4046. function compileStr(value, values, delimiters) {
  4047. return formater.interpolate(value, values, delimiters).join('');
  4048. }
  4049. function compileValue(jsonObj, key, localeValues, delimiters) {
  4050. var value = jsonObj[key];
  4051. if (isString(value)) {
  4052. // 存在国际化
  4053. if (isI18nStr(value, delimiters)) {
  4054. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  4055. if (localeValues.length > 1) {
  4056. // 格式化国际化语言
  4057. var valueLocales = jsonObj[key + 'Locales'] = {};
  4058. localeValues.forEach(function (localValue) {
  4059. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  4060. });
  4061. }
  4062. }
  4063. } else {
  4064. compileJsonObj(value, localeValues, delimiters);
  4065. }
  4066. }
  4067. function compileJsonObj(jsonObj, localeValues, delimiters) {
  4068. walkJsonObj(jsonObj, function (jsonObj, key) {
  4069. compileValue(jsonObj, key, localeValues, delimiters);
  4070. });
  4071. return jsonObj;
  4072. }
  4073. function walkJsonObj(jsonObj, walk) {
  4074. if (Array.isArray(jsonObj)) {
  4075. for (var i = 0; i < jsonObj.length; i++) {
  4076. if (walk(jsonObj, i)) {
  4077. return true;
  4078. }
  4079. }
  4080. } else if (isObject(jsonObj)) {
  4081. for (var key in jsonObj) {
  4082. if (walk(jsonObj, key)) {
  4083. return true;
  4084. }
  4085. }
  4086. }
  4087. return false;
  4088. }
  4089. function resolveLocale(locales) {
  4090. return function (locale) {
  4091. if (!locale) {
  4092. return locale;
  4093. }
  4094. locale = normalizeLocale(locale) || locale;
  4095. return resolveLocaleChain(locale).find(function (locale) {
  4096. return locales.indexOf(locale) > -1;
  4097. });
  4098. };
  4099. }
  4100. function resolveLocaleChain(locale) {
  4101. var chain = [];
  4102. var tokens = locale.split('-');
  4103. while (tokens.length) {
  4104. chain.push(tokens.join('-'));
  4105. tokens.pop();
  4106. }
  4107. return chain;
  4108. }
  4109. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  4110. /***/ }),
  4111. /***/ 23:
  4112. /*!***************************************************************!*\
  4113. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  4114. \***************************************************************/
  4115. /*! no static exports found */
  4116. /***/ (function(module, exports) {
  4117. function _classCallCheck(instance, Constructor) {
  4118. if (!(instance instanceof Constructor)) {
  4119. throw new TypeError("Cannot call a class as a function");
  4120. }
  4121. }
  4122. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4123. /***/ }),
  4124. /***/ 24:
  4125. /*!************************************************************!*\
  4126. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  4127. \************************************************************/
  4128. /*! no static exports found */
  4129. /***/ (function(module, exports, __webpack_require__) {
  4130. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  4131. function _defineProperties(target, props) {
  4132. for (var i = 0; i < props.length; i++) {
  4133. var descriptor = props[i];
  4134. descriptor.enumerable = descriptor.enumerable || false;
  4135. descriptor.configurable = true;
  4136. if ("value" in descriptor) descriptor.writable = true;
  4137. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  4138. }
  4139. }
  4140. function _createClass(Constructor, protoProps, staticProps) {
  4141. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  4142. if (staticProps) _defineProperties(Constructor, staticProps);
  4143. Object.defineProperty(Constructor, "prototype", {
  4144. writable: false
  4145. });
  4146. return Constructor;
  4147. }
  4148. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4149. /***/ }),
  4150. /***/ 25:
  4151. /*!******************************************************************************************!*\
  4152. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  4153. \******************************************************************************************/
  4154. /*! exports provided: default */
  4155. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4156. "use strict";
  4157. __webpack_require__.r(__webpack_exports__);
  4158. /* WEBPACK VAR INJECTION */(function(global) {/*!
  4159. * Vue.js v2.6.11
  4160. * (c) 2014-2023 Evan You
  4161. * Released under the MIT License.
  4162. */
  4163. /* */
  4164. var emptyObject = Object.freeze({});
  4165. // These helpers produce better VM code in JS engines due to their
  4166. // explicitness and function inlining.
  4167. function isUndef (v) {
  4168. return v === undefined || v === null
  4169. }
  4170. function isDef (v) {
  4171. return v !== undefined && v !== null
  4172. }
  4173. function isTrue (v) {
  4174. return v === true
  4175. }
  4176. function isFalse (v) {
  4177. return v === false
  4178. }
  4179. /**
  4180. * Check if value is primitive.
  4181. */
  4182. function isPrimitive (value) {
  4183. return (
  4184. typeof value === 'string' ||
  4185. typeof value === 'number' ||
  4186. // $flow-disable-line
  4187. typeof value === 'symbol' ||
  4188. typeof value === 'boolean'
  4189. )
  4190. }
  4191. /**
  4192. * Quick object check - this is primarily used to tell
  4193. * Objects from primitive values when we know the value
  4194. * is a JSON-compliant type.
  4195. */
  4196. function isObject (obj) {
  4197. return obj !== null && typeof obj === 'object'
  4198. }
  4199. /**
  4200. * Get the raw type string of a value, e.g., [object Object].
  4201. */
  4202. var _toString = Object.prototype.toString;
  4203. function toRawType (value) {
  4204. return _toString.call(value).slice(8, -1)
  4205. }
  4206. /**
  4207. * Strict object type check. Only returns true
  4208. * for plain JavaScript objects.
  4209. */
  4210. function isPlainObject (obj) {
  4211. return _toString.call(obj) === '[object Object]'
  4212. }
  4213. function isRegExp (v) {
  4214. return _toString.call(v) === '[object RegExp]'
  4215. }
  4216. /**
  4217. * Check if val is a valid array index.
  4218. */
  4219. function isValidArrayIndex (val) {
  4220. var n = parseFloat(String(val));
  4221. return n >= 0 && Math.floor(n) === n && isFinite(val)
  4222. }
  4223. function isPromise (val) {
  4224. return (
  4225. isDef(val) &&
  4226. typeof val.then === 'function' &&
  4227. typeof val.catch === 'function'
  4228. )
  4229. }
  4230. /**
  4231. * Convert a value to a string that is actually rendered.
  4232. */
  4233. function toString (val) {
  4234. return val == null
  4235. ? ''
  4236. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  4237. ? JSON.stringify(val, null, 2)
  4238. : String(val)
  4239. }
  4240. /**
  4241. * Convert an input value to a number for persistence.
  4242. * If the conversion fails, return original string.
  4243. */
  4244. function toNumber (val) {
  4245. var n = parseFloat(val);
  4246. return isNaN(n) ? val : n
  4247. }
  4248. /**
  4249. * Make a map and return a function for checking if a key
  4250. * is in that map.
  4251. */
  4252. function makeMap (
  4253. str,
  4254. expectsLowerCase
  4255. ) {
  4256. var map = Object.create(null);
  4257. var list = str.split(',');
  4258. for (var i = 0; i < list.length; i++) {
  4259. map[list[i]] = true;
  4260. }
  4261. return expectsLowerCase
  4262. ? function (val) { return map[val.toLowerCase()]; }
  4263. : function (val) { return map[val]; }
  4264. }
  4265. /**
  4266. * Check if a tag is a built-in tag.
  4267. */
  4268. var isBuiltInTag = makeMap('slot,component', true);
  4269. /**
  4270. * Check if an attribute is a reserved attribute.
  4271. */
  4272. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  4273. /**
  4274. * Remove an item from an array.
  4275. */
  4276. function remove (arr, item) {
  4277. if (arr.length) {
  4278. var index = arr.indexOf(item);
  4279. if (index > -1) {
  4280. return arr.splice(index, 1)
  4281. }
  4282. }
  4283. }
  4284. /**
  4285. * Check whether an object has the property.
  4286. */
  4287. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4288. function hasOwn (obj, key) {
  4289. return hasOwnProperty.call(obj, key)
  4290. }
  4291. /**
  4292. * Create a cached version of a pure function.
  4293. */
  4294. function cached (fn) {
  4295. var cache = Object.create(null);
  4296. return (function cachedFn (str) {
  4297. var hit = cache[str];
  4298. return hit || (cache[str] = fn(str))
  4299. })
  4300. }
  4301. /**
  4302. * Camelize a hyphen-delimited string.
  4303. */
  4304. var camelizeRE = /-(\w)/g;
  4305. var camelize = cached(function (str) {
  4306. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  4307. });
  4308. /**
  4309. * Capitalize a string.
  4310. */
  4311. var capitalize = cached(function (str) {
  4312. return str.charAt(0).toUpperCase() + str.slice(1)
  4313. });
  4314. /**
  4315. * Hyphenate a camelCase string.
  4316. */
  4317. var hyphenateRE = /\B([A-Z])/g;
  4318. var hyphenate = cached(function (str) {
  4319. return str.replace(hyphenateRE, '-$1').toLowerCase()
  4320. });
  4321. /**
  4322. * Simple bind polyfill for environments that do not support it,
  4323. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  4324. * since native bind is now performant enough in most browsers.
  4325. * But removing it would mean breaking code that was able to run in
  4326. * PhantomJS 1.x, so this must be kept for backward compatibility.
  4327. */
  4328. /* istanbul ignore next */
  4329. function polyfillBind (fn, ctx) {
  4330. function boundFn (a) {
  4331. var l = arguments.length;
  4332. return l
  4333. ? l > 1
  4334. ? fn.apply(ctx, arguments)
  4335. : fn.call(ctx, a)
  4336. : fn.call(ctx)
  4337. }
  4338. boundFn._length = fn.length;
  4339. return boundFn
  4340. }
  4341. function nativeBind (fn, ctx) {
  4342. return fn.bind(ctx)
  4343. }
  4344. var bind = Function.prototype.bind
  4345. ? nativeBind
  4346. : polyfillBind;
  4347. /**
  4348. * Convert an Array-like object to a real Array.
  4349. */
  4350. function toArray (list, start) {
  4351. start = start || 0;
  4352. var i = list.length - start;
  4353. var ret = new Array(i);
  4354. while (i--) {
  4355. ret[i] = list[i + start];
  4356. }
  4357. return ret
  4358. }
  4359. /**
  4360. * Mix properties into target object.
  4361. */
  4362. function extend (to, _from) {
  4363. for (var key in _from) {
  4364. to[key] = _from[key];
  4365. }
  4366. return to
  4367. }
  4368. /**
  4369. * Merge an Array of Objects into a single Object.
  4370. */
  4371. function toObject (arr) {
  4372. var res = {};
  4373. for (var i = 0; i < arr.length; i++) {
  4374. if (arr[i]) {
  4375. extend(res, arr[i]);
  4376. }
  4377. }
  4378. return res
  4379. }
  4380. /* eslint-disable no-unused-vars */
  4381. /**
  4382. * Perform no operation.
  4383. * Stubbing args to make Flow happy without leaving useless transpiled code
  4384. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  4385. */
  4386. function noop (a, b, c) {}
  4387. /**
  4388. * Always return false.
  4389. */
  4390. var no = function (a, b, c) { return false; };
  4391. /* eslint-enable no-unused-vars */
  4392. /**
  4393. * Return the same value.
  4394. */
  4395. var identity = function (_) { return _; };
  4396. /**
  4397. * Check if two values are loosely equal - that is,
  4398. * if they are plain objects, do they have the same shape?
  4399. */
  4400. function looseEqual (a, b) {
  4401. if (a === b) { return true }
  4402. var isObjectA = isObject(a);
  4403. var isObjectB = isObject(b);
  4404. if (isObjectA && isObjectB) {
  4405. try {
  4406. var isArrayA = Array.isArray(a);
  4407. var isArrayB = Array.isArray(b);
  4408. if (isArrayA && isArrayB) {
  4409. return a.length === b.length && a.every(function (e, i) {
  4410. return looseEqual(e, b[i])
  4411. })
  4412. } else if (a instanceof Date && b instanceof Date) {
  4413. return a.getTime() === b.getTime()
  4414. } else if (!isArrayA && !isArrayB) {
  4415. var keysA = Object.keys(a);
  4416. var keysB = Object.keys(b);
  4417. return keysA.length === keysB.length && keysA.every(function (key) {
  4418. return looseEqual(a[key], b[key])
  4419. })
  4420. } else {
  4421. /* istanbul ignore next */
  4422. return false
  4423. }
  4424. } catch (e) {
  4425. /* istanbul ignore next */
  4426. return false
  4427. }
  4428. } else if (!isObjectA && !isObjectB) {
  4429. return String(a) === String(b)
  4430. } else {
  4431. return false
  4432. }
  4433. }
  4434. /**
  4435. * Return the first index at which a loosely equal value can be
  4436. * found in the array (if value is a plain object, the array must
  4437. * contain an object of the same shape), or -1 if it is not present.
  4438. */
  4439. function looseIndexOf (arr, val) {
  4440. for (var i = 0; i < arr.length; i++) {
  4441. if (looseEqual(arr[i], val)) { return i }
  4442. }
  4443. return -1
  4444. }
  4445. /**
  4446. * Ensure a function is called only once.
  4447. */
  4448. function once (fn) {
  4449. var called = false;
  4450. return function () {
  4451. if (!called) {
  4452. called = true;
  4453. fn.apply(this, arguments);
  4454. }
  4455. }
  4456. }
  4457. var ASSET_TYPES = [
  4458. 'component',
  4459. 'directive',
  4460. 'filter'
  4461. ];
  4462. var LIFECYCLE_HOOKS = [
  4463. 'beforeCreate',
  4464. 'created',
  4465. 'beforeMount',
  4466. 'mounted',
  4467. 'beforeUpdate',
  4468. 'updated',
  4469. 'beforeDestroy',
  4470. 'destroyed',
  4471. 'activated',
  4472. 'deactivated',
  4473. 'errorCaptured',
  4474. 'serverPrefetch'
  4475. ];
  4476. /* */
  4477. var config = ({
  4478. /**
  4479. * Option merge strategies (used in core/util/options)
  4480. */
  4481. // $flow-disable-line
  4482. optionMergeStrategies: Object.create(null),
  4483. /**
  4484. * Whether to suppress warnings.
  4485. */
  4486. silent: false,
  4487. /**
  4488. * Show production mode tip message on boot?
  4489. */
  4490. productionTip: "development" !== 'production',
  4491. /**
  4492. * Whether to enable devtools
  4493. */
  4494. devtools: "development" !== 'production',
  4495. /**
  4496. * Whether to record perf
  4497. */
  4498. performance: false,
  4499. /**
  4500. * Error handler for watcher errors
  4501. */
  4502. errorHandler: null,
  4503. /**
  4504. * Warn handler for watcher warns
  4505. */
  4506. warnHandler: null,
  4507. /**
  4508. * Ignore certain custom elements
  4509. */
  4510. ignoredElements: [],
  4511. /**
  4512. * Custom user key aliases for v-on
  4513. */
  4514. // $flow-disable-line
  4515. keyCodes: Object.create(null),
  4516. /**
  4517. * Check if a tag is reserved so that it cannot be registered as a
  4518. * component. This is platform-dependent and may be overwritten.
  4519. */
  4520. isReservedTag: no,
  4521. /**
  4522. * Check if an attribute is reserved so that it cannot be used as a component
  4523. * prop. This is platform-dependent and may be overwritten.
  4524. */
  4525. isReservedAttr: no,
  4526. /**
  4527. * Check if a tag is an unknown element.
  4528. * Platform-dependent.
  4529. */
  4530. isUnknownElement: no,
  4531. /**
  4532. * Get the namespace of an element
  4533. */
  4534. getTagNamespace: noop,
  4535. /**
  4536. * Parse the real tag name for the specific platform.
  4537. */
  4538. parsePlatformTagName: identity,
  4539. /**
  4540. * Check if an attribute must be bound using property, e.g. value
  4541. * Platform-dependent.
  4542. */
  4543. mustUseProp: no,
  4544. /**
  4545. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  4546. * This will significantly reduce performance if set to false.
  4547. */
  4548. async: true,
  4549. /**
  4550. * Exposed for legacy reasons
  4551. */
  4552. _lifecycleHooks: LIFECYCLE_HOOKS
  4553. });
  4554. /* */
  4555. /**
  4556. * unicode letters used for parsing html tags, component names and property paths.
  4557. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  4558. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  4559. */
  4560. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  4561. /**
  4562. * Check if a string starts with $ or _
  4563. */
  4564. function isReserved (str) {
  4565. var c = (str + '').charCodeAt(0);
  4566. return c === 0x24 || c === 0x5F
  4567. }
  4568. /**
  4569. * Define a property.
  4570. */
  4571. function def (obj, key, val, enumerable) {
  4572. Object.defineProperty(obj, key, {
  4573. value: val,
  4574. enumerable: !!enumerable,
  4575. writable: true,
  4576. configurable: true
  4577. });
  4578. }
  4579. /**
  4580. * Parse simple path.
  4581. */
  4582. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  4583. function parsePath (path) {
  4584. if (bailRE.test(path)) {
  4585. return
  4586. }
  4587. var segments = path.split('.');
  4588. return function (obj) {
  4589. for (var i = 0; i < segments.length; i++) {
  4590. if (!obj) { return }
  4591. obj = obj[segments[i]];
  4592. }
  4593. return obj
  4594. }
  4595. }
  4596. /* */
  4597. // can we use __proto__?
  4598. var hasProto = '__proto__' in {};
  4599. // Browser environment sniffing
  4600. var inBrowser = typeof window !== 'undefined';
  4601. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  4602. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  4603. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  4604. var isIE = UA && /msie|trident/.test(UA);
  4605. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  4606. var isEdge = UA && UA.indexOf('edge/') > 0;
  4607. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  4608. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  4609. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  4610. var isPhantomJS = UA && /phantomjs/.test(UA);
  4611. var isFF = UA && UA.match(/firefox\/(\d+)/);
  4612. // Firefox has a "watch" function on Object.prototype...
  4613. var nativeWatch = ({}).watch;
  4614. if (inBrowser) {
  4615. try {
  4616. var opts = {};
  4617. Object.defineProperty(opts, 'passive', ({
  4618. get: function get () {
  4619. }
  4620. })); // https://github.com/facebook/flow/issues/285
  4621. window.addEventListener('test-passive', null, opts);
  4622. } catch (e) {}
  4623. }
  4624. // this needs to be lazy-evaled because vue may be required before
  4625. // vue-server-renderer can set VUE_ENV
  4626. var _isServer;
  4627. var isServerRendering = function () {
  4628. if (_isServer === undefined) {
  4629. /* istanbul ignore if */
  4630. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  4631. // detect presence of vue-server-renderer and avoid
  4632. // Webpack shimming the process
  4633. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  4634. } else {
  4635. _isServer = false;
  4636. }
  4637. }
  4638. return _isServer
  4639. };
  4640. // detect devtools
  4641. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4642. /* istanbul ignore next */
  4643. function isNative (Ctor) {
  4644. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  4645. }
  4646. var hasSymbol =
  4647. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  4648. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  4649. var _Set;
  4650. /* istanbul ignore if */ // $flow-disable-line
  4651. if (typeof Set !== 'undefined' && isNative(Set)) {
  4652. // use native Set when available.
  4653. _Set = Set;
  4654. } else {
  4655. // a non-standard Set polyfill that only works with primitive keys.
  4656. _Set = /*@__PURE__*/(function () {
  4657. function Set () {
  4658. this.set = Object.create(null);
  4659. }
  4660. Set.prototype.has = function has (key) {
  4661. return this.set[key] === true
  4662. };
  4663. Set.prototype.add = function add (key) {
  4664. this.set[key] = true;
  4665. };
  4666. Set.prototype.clear = function clear () {
  4667. this.set = Object.create(null);
  4668. };
  4669. return Set;
  4670. }());
  4671. }
  4672. /* */
  4673. var warn = noop;
  4674. var tip = noop;
  4675. var generateComponentTrace = (noop); // work around flow check
  4676. var formatComponentName = (noop);
  4677. if (true) {
  4678. var hasConsole = typeof console !== 'undefined';
  4679. var classifyRE = /(?:^|[-_])(\w)/g;
  4680. var classify = function (str) { return str
  4681. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  4682. .replace(/[-_]/g, ''); };
  4683. warn = function (msg, vm) {
  4684. var trace = vm ? generateComponentTrace(vm) : '';
  4685. if (config.warnHandler) {
  4686. config.warnHandler.call(null, msg, vm, trace);
  4687. } else if (hasConsole && (!config.silent)) {
  4688. console.error(("[Vue warn]: " + msg + trace));
  4689. }
  4690. };
  4691. tip = function (msg, vm) {
  4692. if (hasConsole && (!config.silent)) {
  4693. console.warn("[Vue tip]: " + msg + (
  4694. vm ? generateComponentTrace(vm) : ''
  4695. ));
  4696. }
  4697. };
  4698. formatComponentName = function (vm, includeFile) {
  4699. if (vm.$root === vm) {
  4700. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  4701. return ('') + vm.$options.__file
  4702. }
  4703. return '<Root>'
  4704. }
  4705. var options = typeof vm === 'function' && vm.cid != null
  4706. ? vm.options
  4707. : vm._isVue
  4708. ? vm.$options || vm.constructor.options
  4709. : vm;
  4710. var name = options.name || options._componentTag;
  4711. var file = options.__file;
  4712. if (!name && file) {
  4713. var match = file.match(/([^/\\]+)\.vue$/);
  4714. name = match && match[1];
  4715. }
  4716. return (
  4717. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  4718. (file && includeFile !== false ? (" at " + file) : '')
  4719. )
  4720. };
  4721. var repeat = function (str, n) {
  4722. var res = '';
  4723. while (n) {
  4724. if (n % 2 === 1) { res += str; }
  4725. if (n > 1) { str += str; }
  4726. n >>= 1;
  4727. }
  4728. return res
  4729. };
  4730. generateComponentTrace = function (vm) {
  4731. if (vm._isVue && vm.$parent) {
  4732. var tree = [];
  4733. var currentRecursiveSequence = 0;
  4734. while (vm && vm.$options.name !== 'PageBody') {
  4735. if (tree.length > 0) {
  4736. var last = tree[tree.length - 1];
  4737. if (last.constructor === vm.constructor) {
  4738. currentRecursiveSequence++;
  4739. vm = vm.$parent;
  4740. continue
  4741. } else if (currentRecursiveSequence > 0) {
  4742. tree[tree.length - 1] = [last, currentRecursiveSequence];
  4743. currentRecursiveSequence = 0;
  4744. }
  4745. }
  4746. !vm.$options.isReserved && tree.push(vm);
  4747. vm = vm.$parent;
  4748. }
  4749. return '\n\nfound in\n\n' + tree
  4750. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  4751. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  4752. : formatComponentName(vm))); })
  4753. .join('\n')
  4754. } else {
  4755. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  4756. }
  4757. };
  4758. }
  4759. /* */
  4760. var uid = 0;
  4761. /**
  4762. * A dep is an observable that can have multiple
  4763. * directives subscribing to it.
  4764. */
  4765. var Dep = function Dep () {
  4766. this.id = uid++;
  4767. this.subs = [];
  4768. };
  4769. Dep.prototype.addSub = function addSub (sub) {
  4770. this.subs.push(sub);
  4771. };
  4772. Dep.prototype.removeSub = function removeSub (sub) {
  4773. remove(this.subs, sub);
  4774. };
  4775. Dep.prototype.depend = function depend () {
  4776. if (Dep.SharedObject.target) {
  4777. Dep.SharedObject.target.addDep(this);
  4778. }
  4779. };
  4780. Dep.prototype.notify = function notify () {
  4781. // stabilize the subscriber list first
  4782. var subs = this.subs.slice();
  4783. if ( true && !config.async) {
  4784. // subs aren't sorted in scheduler if not running async
  4785. // we need to sort them now to make sure they fire in correct
  4786. // order
  4787. subs.sort(function (a, b) { return a.id - b.id; });
  4788. }
  4789. for (var i = 0, l = subs.length; i < l; i++) {
  4790. subs[i].update();
  4791. }
  4792. };
  4793. // The current target watcher being evaluated.
  4794. // This is globally unique because only one watcher
  4795. // can be evaluated at a time.
  4796. // fixed by xxxxxx (nvue shared vuex)
  4797. /* eslint-disable no-undef */
  4798. Dep.SharedObject = {};
  4799. Dep.SharedObject.target = null;
  4800. Dep.SharedObject.targetStack = [];
  4801. function pushTarget (target) {
  4802. Dep.SharedObject.targetStack.push(target);
  4803. Dep.SharedObject.target = target;
  4804. Dep.target = target;
  4805. }
  4806. function popTarget () {
  4807. Dep.SharedObject.targetStack.pop();
  4808. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  4809. Dep.target = Dep.SharedObject.target;
  4810. }
  4811. /* */
  4812. var VNode = function VNode (
  4813. tag,
  4814. data,
  4815. children,
  4816. text,
  4817. elm,
  4818. context,
  4819. componentOptions,
  4820. asyncFactory
  4821. ) {
  4822. this.tag = tag;
  4823. this.data = data;
  4824. this.children = children;
  4825. this.text = text;
  4826. this.elm = elm;
  4827. this.ns = undefined;
  4828. this.context = context;
  4829. this.fnContext = undefined;
  4830. this.fnOptions = undefined;
  4831. this.fnScopeId = undefined;
  4832. this.key = data && data.key;
  4833. this.componentOptions = componentOptions;
  4834. this.componentInstance = undefined;
  4835. this.parent = undefined;
  4836. this.raw = false;
  4837. this.isStatic = false;
  4838. this.isRootInsert = true;
  4839. this.isComment = false;
  4840. this.isCloned = false;
  4841. this.isOnce = false;
  4842. this.asyncFactory = asyncFactory;
  4843. this.asyncMeta = undefined;
  4844. this.isAsyncPlaceholder = false;
  4845. };
  4846. var prototypeAccessors = { child: { configurable: true } };
  4847. // DEPRECATED: alias for componentInstance for backwards compat.
  4848. /* istanbul ignore next */
  4849. prototypeAccessors.child.get = function () {
  4850. return this.componentInstance
  4851. };
  4852. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4853. var createEmptyVNode = function (text) {
  4854. if ( text === void 0 ) text = '';
  4855. var node = new VNode();
  4856. node.text = text;
  4857. node.isComment = true;
  4858. return node
  4859. };
  4860. function createTextVNode (val) {
  4861. return new VNode(undefined, undefined, undefined, String(val))
  4862. }
  4863. // optimized shallow clone
  4864. // used for static nodes and slot nodes because they may be reused across
  4865. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4866. // on their elm reference.
  4867. function cloneVNode (vnode) {
  4868. var cloned = new VNode(
  4869. vnode.tag,
  4870. vnode.data,
  4871. // #7975
  4872. // clone children array to avoid mutating original in case of cloning
  4873. // a child.
  4874. vnode.children && vnode.children.slice(),
  4875. vnode.text,
  4876. vnode.elm,
  4877. vnode.context,
  4878. vnode.componentOptions,
  4879. vnode.asyncFactory
  4880. );
  4881. cloned.ns = vnode.ns;
  4882. cloned.isStatic = vnode.isStatic;
  4883. cloned.key = vnode.key;
  4884. cloned.isComment = vnode.isComment;
  4885. cloned.fnContext = vnode.fnContext;
  4886. cloned.fnOptions = vnode.fnOptions;
  4887. cloned.fnScopeId = vnode.fnScopeId;
  4888. cloned.asyncMeta = vnode.asyncMeta;
  4889. cloned.isCloned = true;
  4890. return cloned
  4891. }
  4892. /*
  4893. * not type checking this file because flow doesn't play well with
  4894. * dynamically accessing methods on Array prototype
  4895. */
  4896. var arrayProto = Array.prototype;
  4897. var arrayMethods = Object.create(arrayProto);
  4898. var methodsToPatch = [
  4899. 'push',
  4900. 'pop',
  4901. 'shift',
  4902. 'unshift',
  4903. 'splice',
  4904. 'sort',
  4905. 'reverse'
  4906. ];
  4907. /**
  4908. * Intercept mutating methods and emit events
  4909. */
  4910. methodsToPatch.forEach(function (method) {
  4911. // cache original method
  4912. var original = arrayProto[method];
  4913. def(arrayMethods, method, function mutator () {
  4914. var args = [], len = arguments.length;
  4915. while ( len-- ) args[ len ] = arguments[ len ];
  4916. var result = original.apply(this, args);
  4917. var ob = this.__ob__;
  4918. var inserted;
  4919. switch (method) {
  4920. case 'push':
  4921. case 'unshift':
  4922. inserted = args;
  4923. break
  4924. case 'splice':
  4925. inserted = args.slice(2);
  4926. break
  4927. }
  4928. if (inserted) { ob.observeArray(inserted); }
  4929. // notify change
  4930. ob.dep.notify();
  4931. return result
  4932. });
  4933. });
  4934. /* */
  4935. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4936. /**
  4937. * In some cases we may want to disable observation inside a component's
  4938. * update computation.
  4939. */
  4940. var shouldObserve = true;
  4941. function toggleObserving (value) {
  4942. shouldObserve = value;
  4943. }
  4944. /**
  4945. * Observer class that is attached to each observed
  4946. * object. Once attached, the observer converts the target
  4947. * object's property keys into getter/setters that
  4948. * collect dependencies and dispatch updates.
  4949. */
  4950. var Observer = function Observer (value) {
  4951. this.value = value;
  4952. this.dep = new Dep();
  4953. this.vmCount = 0;
  4954. def(value, '__ob__', this);
  4955. if (Array.isArray(value)) {
  4956. if (hasProto) {
  4957. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4958. if(value.push !== value.__proto__.push){
  4959. copyAugment(value, arrayMethods, arrayKeys);
  4960. } else {
  4961. protoAugment(value, arrayMethods);
  4962. }
  4963. }
  4964. } else {
  4965. copyAugment(value, arrayMethods, arrayKeys);
  4966. }
  4967. this.observeArray(value);
  4968. } else {
  4969. this.walk(value);
  4970. }
  4971. };
  4972. /**
  4973. * Walk through all properties and convert them into
  4974. * getter/setters. This method should only be called when
  4975. * value type is Object.
  4976. */
  4977. Observer.prototype.walk = function walk (obj) {
  4978. var keys = Object.keys(obj);
  4979. for (var i = 0; i < keys.length; i++) {
  4980. defineReactive$$1(obj, keys[i]);
  4981. }
  4982. };
  4983. /**
  4984. * Observe a list of Array items.
  4985. */
  4986. Observer.prototype.observeArray = function observeArray (items) {
  4987. for (var i = 0, l = items.length; i < l; i++) {
  4988. observe(items[i]);
  4989. }
  4990. };
  4991. // helpers
  4992. /**
  4993. * Augment a target Object or Array by intercepting
  4994. * the prototype chain using __proto__
  4995. */
  4996. function protoAugment (target, src) {
  4997. /* eslint-disable no-proto */
  4998. target.__proto__ = src;
  4999. /* eslint-enable no-proto */
  5000. }
  5001. /**
  5002. * Augment a target Object or Array by defining
  5003. * hidden properties.
  5004. */
  5005. /* istanbul ignore next */
  5006. function copyAugment (target, src, keys) {
  5007. for (var i = 0, l = keys.length; i < l; i++) {
  5008. var key = keys[i];
  5009. def(target, key, src[key]);
  5010. }
  5011. }
  5012. /**
  5013. * Attempt to create an observer instance for a value,
  5014. * returns the new observer if successfully observed,
  5015. * or the existing observer if the value already has one.
  5016. */
  5017. function observe (value, asRootData) {
  5018. if (!isObject(value) || value instanceof VNode) {
  5019. return
  5020. }
  5021. var ob;
  5022. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  5023. ob = value.__ob__;
  5024. } else if (
  5025. shouldObserve &&
  5026. !isServerRendering() &&
  5027. (Array.isArray(value) || isPlainObject(value)) &&
  5028. Object.isExtensible(value) &&
  5029. !value._isVue &&
  5030. !value.__v_isMPComponent
  5031. ) {
  5032. ob = new Observer(value);
  5033. }
  5034. if (asRootData && ob) {
  5035. ob.vmCount++;
  5036. }
  5037. return ob
  5038. }
  5039. /**
  5040. * Define a reactive property on an Object.
  5041. */
  5042. function defineReactive$$1 (
  5043. obj,
  5044. key,
  5045. val,
  5046. customSetter,
  5047. shallow
  5048. ) {
  5049. var dep = new Dep();
  5050. var property = Object.getOwnPropertyDescriptor(obj, key);
  5051. if (property && property.configurable === false) {
  5052. return
  5053. }
  5054. // cater for pre-defined getter/setters
  5055. var getter = property && property.get;
  5056. var setter = property && property.set;
  5057. if ((!getter || setter) && arguments.length === 2) {
  5058. val = obj[key];
  5059. }
  5060. var childOb = !shallow && observe(val);
  5061. Object.defineProperty(obj, key, {
  5062. enumerable: true,
  5063. configurable: true,
  5064. get: function reactiveGetter () {
  5065. var value = getter ? getter.call(obj) : val;
  5066. if (Dep.SharedObject.target) { // fixed by xxxxxx
  5067. dep.depend();
  5068. if (childOb) {
  5069. childOb.dep.depend();
  5070. if (Array.isArray(value)) {
  5071. dependArray(value);
  5072. }
  5073. }
  5074. }
  5075. return value
  5076. },
  5077. set: function reactiveSetter (newVal) {
  5078. var value = getter ? getter.call(obj) : val;
  5079. /* eslint-disable no-self-compare */
  5080. if (newVal === value || (newVal !== newVal && value !== value)) {
  5081. return
  5082. }
  5083. /* eslint-enable no-self-compare */
  5084. if ( true && customSetter) {
  5085. customSetter();
  5086. }
  5087. // #7981: for accessor properties without setter
  5088. if (getter && !setter) { return }
  5089. if (setter) {
  5090. setter.call(obj, newVal);
  5091. } else {
  5092. val = newVal;
  5093. }
  5094. childOb = !shallow && observe(newVal);
  5095. dep.notify();
  5096. }
  5097. });
  5098. }
  5099. /**
  5100. * Set a property on an object. Adds the new property and
  5101. * triggers change notification if the property doesn't
  5102. * already exist.
  5103. */
  5104. function set (target, key, val) {
  5105. if ( true &&
  5106. (isUndef(target) || isPrimitive(target))
  5107. ) {
  5108. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  5109. }
  5110. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5111. target.length = Math.max(target.length, key);
  5112. target.splice(key, 1, val);
  5113. return val
  5114. }
  5115. if (key in target && !(key in Object.prototype)) {
  5116. target[key] = val;
  5117. return val
  5118. }
  5119. var ob = (target).__ob__;
  5120. if (target._isVue || (ob && ob.vmCount)) {
  5121. true && warn(
  5122. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  5123. 'at runtime - declare it upfront in the data option.'
  5124. );
  5125. return val
  5126. }
  5127. if (!ob) {
  5128. target[key] = val;
  5129. return val
  5130. }
  5131. defineReactive$$1(ob.value, key, val);
  5132. ob.dep.notify();
  5133. return val
  5134. }
  5135. /**
  5136. * Delete a property and trigger change if necessary.
  5137. */
  5138. function del (target, key) {
  5139. if ( true &&
  5140. (isUndef(target) || isPrimitive(target))
  5141. ) {
  5142. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  5143. }
  5144. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5145. target.splice(key, 1);
  5146. return
  5147. }
  5148. var ob = (target).__ob__;
  5149. if (target._isVue || (ob && ob.vmCount)) {
  5150. true && warn(
  5151. 'Avoid deleting properties on a Vue instance or its root $data ' +
  5152. '- just set it to null.'
  5153. );
  5154. return
  5155. }
  5156. if (!hasOwn(target, key)) {
  5157. return
  5158. }
  5159. delete target[key];
  5160. if (!ob) {
  5161. return
  5162. }
  5163. ob.dep.notify();
  5164. }
  5165. /**
  5166. * Collect dependencies on array elements when the array is touched, since
  5167. * we cannot intercept array element access like property getters.
  5168. */
  5169. function dependArray (value) {
  5170. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  5171. e = value[i];
  5172. e && e.__ob__ && e.__ob__.dep.depend();
  5173. if (Array.isArray(e)) {
  5174. dependArray(e);
  5175. }
  5176. }
  5177. }
  5178. /* */
  5179. /**
  5180. * Option overwriting strategies are functions that handle
  5181. * how to merge a parent option value and a child option
  5182. * value into the final value.
  5183. */
  5184. var strats = config.optionMergeStrategies;
  5185. /**
  5186. * Options with restrictions
  5187. */
  5188. if (true) {
  5189. strats.el = strats.propsData = function (parent, child, vm, key) {
  5190. if (!vm) {
  5191. warn(
  5192. "option \"" + key + "\" can only be used during instance " +
  5193. 'creation with the `new` keyword.'
  5194. );
  5195. }
  5196. return defaultStrat(parent, child)
  5197. };
  5198. }
  5199. /**
  5200. * Helper that recursively merges two data objects together.
  5201. */
  5202. function mergeData (to, from) {
  5203. if (!from) { return to }
  5204. var key, toVal, fromVal;
  5205. var keys = hasSymbol
  5206. ? Reflect.ownKeys(from)
  5207. : Object.keys(from);
  5208. for (var i = 0; i < keys.length; i++) {
  5209. key = keys[i];
  5210. // in case the object is already observed...
  5211. if (key === '__ob__') { continue }
  5212. toVal = to[key];
  5213. fromVal = from[key];
  5214. if (!hasOwn(to, key)) {
  5215. set(to, key, fromVal);
  5216. } else if (
  5217. toVal !== fromVal &&
  5218. isPlainObject(toVal) &&
  5219. isPlainObject(fromVal)
  5220. ) {
  5221. mergeData(toVal, fromVal);
  5222. }
  5223. }
  5224. return to
  5225. }
  5226. /**
  5227. * Data
  5228. */
  5229. function mergeDataOrFn (
  5230. parentVal,
  5231. childVal,
  5232. vm
  5233. ) {
  5234. if (!vm) {
  5235. // in a Vue.extend merge, both should be functions
  5236. if (!childVal) {
  5237. return parentVal
  5238. }
  5239. if (!parentVal) {
  5240. return childVal
  5241. }
  5242. // when parentVal & childVal are both present,
  5243. // we need to return a function that returns the
  5244. // merged result of both functions... no need to
  5245. // check if parentVal is a function here because
  5246. // it has to be a function to pass previous merges.
  5247. return function mergedDataFn () {
  5248. return mergeData(
  5249. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  5250. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  5251. )
  5252. }
  5253. } else {
  5254. return function mergedInstanceDataFn () {
  5255. // instance merge
  5256. var instanceData = typeof childVal === 'function'
  5257. ? childVal.call(vm, vm)
  5258. : childVal;
  5259. var defaultData = typeof parentVal === 'function'
  5260. ? parentVal.call(vm, vm)
  5261. : parentVal;
  5262. if (instanceData) {
  5263. return mergeData(instanceData, defaultData)
  5264. } else {
  5265. return defaultData
  5266. }
  5267. }
  5268. }
  5269. }
  5270. strats.data = function (
  5271. parentVal,
  5272. childVal,
  5273. vm
  5274. ) {
  5275. if (!vm) {
  5276. if (childVal && typeof childVal !== 'function') {
  5277. true && warn(
  5278. 'The "data" option should be a function ' +
  5279. 'that returns a per-instance value in component ' +
  5280. 'definitions.',
  5281. vm
  5282. );
  5283. return parentVal
  5284. }
  5285. return mergeDataOrFn(parentVal, childVal)
  5286. }
  5287. return mergeDataOrFn(parentVal, childVal, vm)
  5288. };
  5289. /**
  5290. * Hooks and props are merged as arrays.
  5291. */
  5292. function mergeHook (
  5293. parentVal,
  5294. childVal
  5295. ) {
  5296. var res = childVal
  5297. ? parentVal
  5298. ? parentVal.concat(childVal)
  5299. : Array.isArray(childVal)
  5300. ? childVal
  5301. : [childVal]
  5302. : parentVal;
  5303. return res
  5304. ? dedupeHooks(res)
  5305. : res
  5306. }
  5307. function dedupeHooks (hooks) {
  5308. var res = [];
  5309. for (var i = 0; i < hooks.length; i++) {
  5310. if (res.indexOf(hooks[i]) === -1) {
  5311. res.push(hooks[i]);
  5312. }
  5313. }
  5314. return res
  5315. }
  5316. LIFECYCLE_HOOKS.forEach(function (hook) {
  5317. strats[hook] = mergeHook;
  5318. });
  5319. /**
  5320. * Assets
  5321. *
  5322. * When a vm is present (instance creation), we need to do
  5323. * a three-way merge between constructor options, instance
  5324. * options and parent options.
  5325. */
  5326. function mergeAssets (
  5327. parentVal,
  5328. childVal,
  5329. vm,
  5330. key
  5331. ) {
  5332. var res = Object.create(parentVal || null);
  5333. if (childVal) {
  5334. true && assertObjectType(key, childVal, vm);
  5335. return extend(res, childVal)
  5336. } else {
  5337. return res
  5338. }
  5339. }
  5340. ASSET_TYPES.forEach(function (type) {
  5341. strats[type + 's'] = mergeAssets;
  5342. });
  5343. /**
  5344. * Watchers.
  5345. *
  5346. * Watchers hashes should not overwrite one
  5347. * another, so we merge them as arrays.
  5348. */
  5349. strats.watch = function (
  5350. parentVal,
  5351. childVal,
  5352. vm,
  5353. key
  5354. ) {
  5355. // work around Firefox's Object.prototype.watch...
  5356. if (parentVal === nativeWatch) { parentVal = undefined; }
  5357. if (childVal === nativeWatch) { childVal = undefined; }
  5358. /* istanbul ignore if */
  5359. if (!childVal) { return Object.create(parentVal || null) }
  5360. if (true) {
  5361. assertObjectType(key, childVal, vm);
  5362. }
  5363. if (!parentVal) { return childVal }
  5364. var ret = {};
  5365. extend(ret, parentVal);
  5366. for (var key$1 in childVal) {
  5367. var parent = ret[key$1];
  5368. var child = childVal[key$1];
  5369. if (parent && !Array.isArray(parent)) {
  5370. parent = [parent];
  5371. }
  5372. ret[key$1] = parent
  5373. ? parent.concat(child)
  5374. : Array.isArray(child) ? child : [child];
  5375. }
  5376. return ret
  5377. };
  5378. /**
  5379. * Other object hashes.
  5380. */
  5381. strats.props =
  5382. strats.methods =
  5383. strats.inject =
  5384. strats.computed = function (
  5385. parentVal,
  5386. childVal,
  5387. vm,
  5388. key
  5389. ) {
  5390. if (childVal && "development" !== 'production') {
  5391. assertObjectType(key, childVal, vm);
  5392. }
  5393. if (!parentVal) { return childVal }
  5394. var ret = Object.create(null);
  5395. extend(ret, parentVal);
  5396. if (childVal) { extend(ret, childVal); }
  5397. return ret
  5398. };
  5399. strats.provide = mergeDataOrFn;
  5400. /**
  5401. * Default strategy.
  5402. */
  5403. var defaultStrat = function (parentVal, childVal) {
  5404. return childVal === undefined
  5405. ? parentVal
  5406. : childVal
  5407. };
  5408. /**
  5409. * Validate component names
  5410. */
  5411. function checkComponents (options) {
  5412. for (var key in options.components) {
  5413. validateComponentName(key);
  5414. }
  5415. }
  5416. function validateComponentName (name) {
  5417. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  5418. warn(
  5419. 'Invalid component name: "' + name + '". Component names ' +
  5420. 'should conform to valid custom element name in html5 specification.'
  5421. );
  5422. }
  5423. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5424. warn(
  5425. 'Do not use built-in or reserved HTML elements as component ' +
  5426. 'id: ' + name
  5427. );
  5428. }
  5429. }
  5430. /**
  5431. * Ensure all props option syntax are normalized into the
  5432. * Object-based format.
  5433. */
  5434. function normalizeProps (options, vm) {
  5435. var props = options.props;
  5436. if (!props) { return }
  5437. var res = {};
  5438. var i, val, name;
  5439. if (Array.isArray(props)) {
  5440. i = props.length;
  5441. while (i--) {
  5442. val = props[i];
  5443. if (typeof val === 'string') {
  5444. name = camelize(val);
  5445. res[name] = { type: null };
  5446. } else if (true) {
  5447. warn('props must be strings when using array syntax.');
  5448. }
  5449. }
  5450. } else if (isPlainObject(props)) {
  5451. for (var key in props) {
  5452. val = props[key];
  5453. name = camelize(key);
  5454. res[name] = isPlainObject(val)
  5455. ? val
  5456. : { type: val };
  5457. }
  5458. } else if (true) {
  5459. warn(
  5460. "Invalid value for option \"props\": expected an Array or an Object, " +
  5461. "but got " + (toRawType(props)) + ".",
  5462. vm
  5463. );
  5464. }
  5465. options.props = res;
  5466. }
  5467. /**
  5468. * Normalize all injections into Object-based format
  5469. */
  5470. function normalizeInject (options, vm) {
  5471. var inject = options.inject;
  5472. if (!inject) { return }
  5473. var normalized = options.inject = {};
  5474. if (Array.isArray(inject)) {
  5475. for (var i = 0; i < inject.length; i++) {
  5476. normalized[inject[i]] = { from: inject[i] };
  5477. }
  5478. } else if (isPlainObject(inject)) {
  5479. for (var key in inject) {
  5480. var val = inject[key];
  5481. normalized[key] = isPlainObject(val)
  5482. ? extend({ from: key }, val)
  5483. : { from: val };
  5484. }
  5485. } else if (true) {
  5486. warn(
  5487. "Invalid value for option \"inject\": expected an Array or an Object, " +
  5488. "but got " + (toRawType(inject)) + ".",
  5489. vm
  5490. );
  5491. }
  5492. }
  5493. /**
  5494. * Normalize raw function directives into object format.
  5495. */
  5496. function normalizeDirectives (options) {
  5497. var dirs = options.directives;
  5498. if (dirs) {
  5499. for (var key in dirs) {
  5500. var def$$1 = dirs[key];
  5501. if (typeof def$$1 === 'function') {
  5502. dirs[key] = { bind: def$$1, update: def$$1 };
  5503. }
  5504. }
  5505. }
  5506. }
  5507. function assertObjectType (name, value, vm) {
  5508. if (!isPlainObject(value)) {
  5509. warn(
  5510. "Invalid value for option \"" + name + "\": expected an Object, " +
  5511. "but got " + (toRawType(value)) + ".",
  5512. vm
  5513. );
  5514. }
  5515. }
  5516. /**
  5517. * Merge two option objects into a new one.
  5518. * Core utility used in both instantiation and inheritance.
  5519. */
  5520. function mergeOptions (
  5521. parent,
  5522. child,
  5523. vm
  5524. ) {
  5525. if (true) {
  5526. checkComponents(child);
  5527. }
  5528. if (typeof child === 'function') {
  5529. child = child.options;
  5530. }
  5531. normalizeProps(child, vm);
  5532. normalizeInject(child, vm);
  5533. normalizeDirectives(child);
  5534. // Apply extends and mixins on the child options,
  5535. // but only if it is a raw options object that isn't
  5536. // the result of another mergeOptions call.
  5537. // Only merged options has the _base property.
  5538. if (!child._base) {
  5539. if (child.extends) {
  5540. parent = mergeOptions(parent, child.extends, vm);
  5541. }
  5542. if (child.mixins) {
  5543. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5544. parent = mergeOptions(parent, child.mixins[i], vm);
  5545. }
  5546. }
  5547. }
  5548. var options = {};
  5549. var key;
  5550. for (key in parent) {
  5551. mergeField(key);
  5552. }
  5553. for (key in child) {
  5554. if (!hasOwn(parent, key)) {
  5555. mergeField(key);
  5556. }
  5557. }
  5558. function mergeField (key) {
  5559. var strat = strats[key] || defaultStrat;
  5560. options[key] = strat(parent[key], child[key], vm, key);
  5561. }
  5562. return options
  5563. }
  5564. /**
  5565. * Resolve an asset.
  5566. * This function is used because child instances need access
  5567. * to assets defined in its ancestor chain.
  5568. */
  5569. function resolveAsset (
  5570. options,
  5571. type,
  5572. id,
  5573. warnMissing
  5574. ) {
  5575. /* istanbul ignore if */
  5576. if (typeof id !== 'string') {
  5577. return
  5578. }
  5579. var assets = options[type];
  5580. // check local registration variations first
  5581. if (hasOwn(assets, id)) { return assets[id] }
  5582. var camelizedId = camelize(id);
  5583. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  5584. var PascalCaseId = capitalize(camelizedId);
  5585. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  5586. // fallback to prototype chain
  5587. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5588. if ( true && warnMissing && !res) {
  5589. warn(
  5590. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  5591. options
  5592. );
  5593. }
  5594. return res
  5595. }
  5596. /* */
  5597. function validateProp (
  5598. key,
  5599. propOptions,
  5600. propsData,
  5601. vm
  5602. ) {
  5603. var prop = propOptions[key];
  5604. var absent = !hasOwn(propsData, key);
  5605. var value = propsData[key];
  5606. // boolean casting
  5607. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5608. if (booleanIndex > -1) {
  5609. if (absent && !hasOwn(prop, 'default')) {
  5610. value = false;
  5611. } else if (value === '' || value === hyphenate(key)) {
  5612. // only cast empty string / same name to boolean if
  5613. // boolean has higher priority
  5614. var stringIndex = getTypeIndex(String, prop.type);
  5615. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5616. value = true;
  5617. }
  5618. }
  5619. }
  5620. // check default value
  5621. if (value === undefined) {
  5622. value = getPropDefaultValue(vm, prop, key);
  5623. // since the default value is a fresh copy,
  5624. // make sure to observe it.
  5625. var prevShouldObserve = shouldObserve;
  5626. toggleObserving(true);
  5627. observe(value);
  5628. toggleObserving(prevShouldObserve);
  5629. }
  5630. if (
  5631. true
  5632. ) {
  5633. assertProp(prop, key, value, vm, absent);
  5634. }
  5635. return value
  5636. }
  5637. /**
  5638. * Get the default value of a prop.
  5639. */
  5640. function getPropDefaultValue (vm, prop, key) {
  5641. // no default, return undefined
  5642. if (!hasOwn(prop, 'default')) {
  5643. return undefined
  5644. }
  5645. var def = prop.default;
  5646. // warn against non-factory defaults for Object & Array
  5647. if ( true && isObject(def)) {
  5648. warn(
  5649. 'Invalid default value for prop "' + key + '": ' +
  5650. 'Props with type Object/Array must use a factory function ' +
  5651. 'to return the default value.',
  5652. vm
  5653. );
  5654. }
  5655. // the raw prop value was also undefined from previous render,
  5656. // return previous default value to avoid unnecessary watcher trigger
  5657. if (vm && vm.$options.propsData &&
  5658. vm.$options.propsData[key] === undefined &&
  5659. vm._props[key] !== undefined
  5660. ) {
  5661. return vm._props[key]
  5662. }
  5663. // call factory function for non-Function types
  5664. // a value is Function if its prototype is function even across different execution context
  5665. return typeof def === 'function' && getType(prop.type) !== 'Function'
  5666. ? def.call(vm)
  5667. : def
  5668. }
  5669. /**
  5670. * Assert whether a prop is valid.
  5671. */
  5672. function assertProp (
  5673. prop,
  5674. name,
  5675. value,
  5676. vm,
  5677. absent
  5678. ) {
  5679. if (prop.required && absent) {
  5680. warn(
  5681. 'Missing required prop: "' + name + '"',
  5682. vm
  5683. );
  5684. return
  5685. }
  5686. if (value == null && !prop.required) {
  5687. return
  5688. }
  5689. var type = prop.type;
  5690. var valid = !type || type === true;
  5691. var expectedTypes = [];
  5692. if (type) {
  5693. if (!Array.isArray(type)) {
  5694. type = [type];
  5695. }
  5696. for (var i = 0; i < type.length && !valid; i++) {
  5697. var assertedType = assertType(value, type[i]);
  5698. expectedTypes.push(assertedType.expectedType || '');
  5699. valid = assertedType.valid;
  5700. }
  5701. }
  5702. if (!valid) {
  5703. warn(
  5704. getInvalidTypeMessage(name, value, expectedTypes),
  5705. vm
  5706. );
  5707. return
  5708. }
  5709. var validator = prop.validator;
  5710. if (validator) {
  5711. if (!validator(value)) {
  5712. warn(
  5713. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  5714. vm
  5715. );
  5716. }
  5717. }
  5718. }
  5719. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  5720. function assertType (value, type) {
  5721. var valid;
  5722. var expectedType = getType(type);
  5723. if (simpleCheckRE.test(expectedType)) {
  5724. var t = typeof value;
  5725. valid = t === expectedType.toLowerCase();
  5726. // for primitive wrapper objects
  5727. if (!valid && t === 'object') {
  5728. valid = value instanceof type;
  5729. }
  5730. } else if (expectedType === 'Object') {
  5731. valid = isPlainObject(value);
  5732. } else if (expectedType === 'Array') {
  5733. valid = Array.isArray(value);
  5734. } else {
  5735. valid = value instanceof type;
  5736. }
  5737. return {
  5738. valid: valid,
  5739. expectedType: expectedType
  5740. }
  5741. }
  5742. /**
  5743. * Use function string name to check built-in types,
  5744. * because a simple equality check will fail when running
  5745. * across different vms / iframes.
  5746. */
  5747. function getType (fn) {
  5748. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  5749. return match ? match[1] : ''
  5750. }
  5751. function isSameType (a, b) {
  5752. return getType(a) === getType(b)
  5753. }
  5754. function getTypeIndex (type, expectedTypes) {
  5755. if (!Array.isArray(expectedTypes)) {
  5756. return isSameType(expectedTypes, type) ? 0 : -1
  5757. }
  5758. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5759. if (isSameType(expectedTypes[i], type)) {
  5760. return i
  5761. }
  5762. }
  5763. return -1
  5764. }
  5765. function getInvalidTypeMessage (name, value, expectedTypes) {
  5766. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  5767. " Expected " + (expectedTypes.map(capitalize).join(', '));
  5768. var expectedType = expectedTypes[0];
  5769. var receivedType = toRawType(value);
  5770. var expectedValue = styleValue(value, expectedType);
  5771. var receivedValue = styleValue(value, receivedType);
  5772. // check if we need to specify expected value
  5773. if (expectedTypes.length === 1 &&
  5774. isExplicable(expectedType) &&
  5775. !isBoolean(expectedType, receivedType)) {
  5776. message += " with value " + expectedValue;
  5777. }
  5778. message += ", got " + receivedType + " ";
  5779. // check if we need to specify received value
  5780. if (isExplicable(receivedType)) {
  5781. message += "with value " + receivedValue + ".";
  5782. }
  5783. return message
  5784. }
  5785. function styleValue (value, type) {
  5786. if (type === 'String') {
  5787. return ("\"" + value + "\"")
  5788. } else if (type === 'Number') {
  5789. return ("" + (Number(value)))
  5790. } else {
  5791. return ("" + value)
  5792. }
  5793. }
  5794. function isExplicable (value) {
  5795. var explicitTypes = ['string', 'number', 'boolean'];
  5796. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  5797. }
  5798. function isBoolean () {
  5799. var args = [], len = arguments.length;
  5800. while ( len-- ) args[ len ] = arguments[ len ];
  5801. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  5802. }
  5803. /* */
  5804. function handleError (err, vm, info) {
  5805. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  5806. // See: https://github.com/vuejs/vuex/issues/1505
  5807. pushTarget();
  5808. try {
  5809. if (vm) {
  5810. var cur = vm;
  5811. while ((cur = cur.$parent)) {
  5812. var hooks = cur.$options.errorCaptured;
  5813. if (hooks) {
  5814. for (var i = 0; i < hooks.length; i++) {
  5815. try {
  5816. var capture = hooks[i].call(cur, err, vm, info) === false;
  5817. if (capture) { return }
  5818. } catch (e) {
  5819. globalHandleError(e, cur, 'errorCaptured hook');
  5820. }
  5821. }
  5822. }
  5823. }
  5824. }
  5825. globalHandleError(err, vm, info);
  5826. } finally {
  5827. popTarget();
  5828. }
  5829. }
  5830. function invokeWithErrorHandling (
  5831. handler,
  5832. context,
  5833. args,
  5834. vm,
  5835. info
  5836. ) {
  5837. var res;
  5838. try {
  5839. res = args ? handler.apply(context, args) : handler.call(context);
  5840. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5841. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5842. // issue #9511
  5843. // avoid catch triggering multiple times when nested calls
  5844. res._handled = true;
  5845. }
  5846. } catch (e) {
  5847. handleError(e, vm, info);
  5848. }
  5849. return res
  5850. }
  5851. function globalHandleError (err, vm, info) {
  5852. if (config.errorHandler) {
  5853. try {
  5854. return config.errorHandler.call(null, err, vm, info)
  5855. } catch (e) {
  5856. // if the user intentionally throws the original error in the handler,
  5857. // do not log it twice
  5858. if (e !== err) {
  5859. logError(e, null, 'config.errorHandler');
  5860. }
  5861. }
  5862. }
  5863. logError(err, vm, info);
  5864. }
  5865. function logError (err, vm, info) {
  5866. if (true) {
  5867. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5868. }
  5869. /* istanbul ignore else */
  5870. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5871. console.error(err);
  5872. } else {
  5873. throw err
  5874. }
  5875. }
  5876. /* */
  5877. var callbacks = [];
  5878. var pending = false;
  5879. function flushCallbacks () {
  5880. pending = false;
  5881. var copies = callbacks.slice(0);
  5882. callbacks.length = 0;
  5883. for (var i = 0; i < copies.length; i++) {
  5884. copies[i]();
  5885. }
  5886. }
  5887. // Here we have async deferring wrappers using microtasks.
  5888. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5889. // However, it has subtle problems when state is changed right before repaint
  5890. // (e.g. #6813, out-in transitions).
  5891. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5892. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5893. // So we now use microtasks everywhere, again.
  5894. // A major drawback of this tradeoff is that there are some scenarios
  5895. // where microtasks have too high a priority and fire in between supposedly
  5896. // sequential events (e.g. #4521, #6690, which have workarounds)
  5897. // or even between bubbling of the same event (#6566).
  5898. var timerFunc;
  5899. // The nextTick behavior leverages the microtask queue, which can be accessed
  5900. // via either native Promise.then or MutationObserver.
  5901. // MutationObserver has wider support, however it is seriously bugged in
  5902. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5903. // completely stops working after triggering a few times... so, if native
  5904. // Promise is available, we will use it:
  5905. /* istanbul ignore next, $flow-disable-line */
  5906. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5907. var p = Promise.resolve();
  5908. timerFunc = function () {
  5909. p.then(flushCallbacks);
  5910. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5911. // it can get stuck in a weird state where callbacks are pushed into the
  5912. // microtask queue but the queue isn't being flushed, until the browser
  5913. // needs to do some other work, e.g. handle a timer. Therefore we can
  5914. // "force" the microtask queue to be flushed by adding an empty timer.
  5915. if (isIOS) { setTimeout(noop); }
  5916. };
  5917. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5918. isNative(MutationObserver) ||
  5919. // PhantomJS and iOS 7.x
  5920. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5921. )) {
  5922. // Use MutationObserver where native Promise is not available,
  5923. // e.g. PhantomJS, iOS7, Android 4.4
  5924. // (#6466 MutationObserver is unreliable in IE11)
  5925. var counter = 1;
  5926. var observer = new MutationObserver(flushCallbacks);
  5927. var textNode = document.createTextNode(String(counter));
  5928. observer.observe(textNode, {
  5929. characterData: true
  5930. });
  5931. timerFunc = function () {
  5932. counter = (counter + 1) % 2;
  5933. textNode.data = String(counter);
  5934. };
  5935. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5936. // Fallback to setImmediate.
  5937. // Technically it leverages the (macro) task queue,
  5938. // but it is still a better choice than setTimeout.
  5939. timerFunc = function () {
  5940. setImmediate(flushCallbacks);
  5941. };
  5942. } else {
  5943. // Fallback to setTimeout.
  5944. timerFunc = function () {
  5945. setTimeout(flushCallbacks, 0);
  5946. };
  5947. }
  5948. function nextTick (cb, ctx) {
  5949. var _resolve;
  5950. callbacks.push(function () {
  5951. if (cb) {
  5952. try {
  5953. cb.call(ctx);
  5954. } catch (e) {
  5955. handleError(e, ctx, 'nextTick');
  5956. }
  5957. } else if (_resolve) {
  5958. _resolve(ctx);
  5959. }
  5960. });
  5961. if (!pending) {
  5962. pending = true;
  5963. timerFunc();
  5964. }
  5965. // $flow-disable-line
  5966. if (!cb && typeof Promise !== 'undefined') {
  5967. return new Promise(function (resolve) {
  5968. _resolve = resolve;
  5969. })
  5970. }
  5971. }
  5972. /* */
  5973. /* not type checking this file because flow doesn't play well with Proxy */
  5974. var initProxy;
  5975. if (true) {
  5976. var allowedGlobals = makeMap(
  5977. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5978. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5979. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5980. 'require' // for Webpack/Browserify
  5981. );
  5982. var warnNonPresent = function (target, key) {
  5983. warn(
  5984. "Property or method \"" + key + "\" is not defined on the instance but " +
  5985. 'referenced during render. Make sure that this property is reactive, ' +
  5986. 'either in the data option, or for class-based components, by ' +
  5987. 'initializing the property. ' +
  5988. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5989. target
  5990. );
  5991. };
  5992. var warnReservedPrefix = function (target, key) {
  5993. warn(
  5994. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5995. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5996. 'prevent conflicts with Vue internals. ' +
  5997. 'See: https://vuejs.org/v2/api/#data',
  5998. target
  5999. );
  6000. };
  6001. var hasProxy =
  6002. typeof Proxy !== 'undefined' && isNative(Proxy);
  6003. if (hasProxy) {
  6004. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  6005. config.keyCodes = new Proxy(config.keyCodes, {
  6006. set: function set (target, key, value) {
  6007. if (isBuiltInModifier(key)) {
  6008. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  6009. return false
  6010. } else {
  6011. target[key] = value;
  6012. return true
  6013. }
  6014. }
  6015. });
  6016. }
  6017. var hasHandler = {
  6018. has: function has (target, key) {
  6019. var has = key in target;
  6020. var isAllowed = allowedGlobals(key) ||
  6021. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  6022. if (!has && !isAllowed) {
  6023. if (key in target.$data) { warnReservedPrefix(target, key); }
  6024. else { warnNonPresent(target, key); }
  6025. }
  6026. return has || !isAllowed
  6027. }
  6028. };
  6029. var getHandler = {
  6030. get: function get (target, key) {
  6031. if (typeof key === 'string' && !(key in target)) {
  6032. if (key in target.$data) { warnReservedPrefix(target, key); }
  6033. else { warnNonPresent(target, key); }
  6034. }
  6035. return target[key]
  6036. }
  6037. };
  6038. initProxy = function initProxy (vm) {
  6039. if (hasProxy) {
  6040. // determine which proxy handler to use
  6041. var options = vm.$options;
  6042. var handlers = options.render && options.render._withStripped
  6043. ? getHandler
  6044. : hasHandler;
  6045. vm._renderProxy = new Proxy(vm, handlers);
  6046. } else {
  6047. vm._renderProxy = vm;
  6048. }
  6049. };
  6050. }
  6051. /* */
  6052. var seenObjects = new _Set();
  6053. /**
  6054. * Recursively traverse an object to evoke all converted
  6055. * getters, so that every nested property inside the object
  6056. * is collected as a "deep" dependency.
  6057. */
  6058. function traverse (val) {
  6059. _traverse(val, seenObjects);
  6060. seenObjects.clear();
  6061. }
  6062. function _traverse (val, seen) {
  6063. var i, keys;
  6064. var isA = Array.isArray(val);
  6065. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  6066. return
  6067. }
  6068. if (val.__ob__) {
  6069. var depId = val.__ob__.dep.id;
  6070. if (seen.has(depId)) {
  6071. return
  6072. }
  6073. seen.add(depId);
  6074. }
  6075. if (isA) {
  6076. i = val.length;
  6077. while (i--) { _traverse(val[i], seen); }
  6078. } else {
  6079. keys = Object.keys(val);
  6080. i = keys.length;
  6081. while (i--) { _traverse(val[keys[i]], seen); }
  6082. }
  6083. }
  6084. var mark;
  6085. var measure;
  6086. if (true) {
  6087. var perf = inBrowser && window.performance;
  6088. /* istanbul ignore if */
  6089. if (
  6090. perf &&
  6091. perf.mark &&
  6092. perf.measure &&
  6093. perf.clearMarks &&
  6094. perf.clearMeasures
  6095. ) {
  6096. mark = function (tag) { return perf.mark(tag); };
  6097. measure = function (name, startTag, endTag) {
  6098. perf.measure(name, startTag, endTag);
  6099. perf.clearMarks(startTag);
  6100. perf.clearMarks(endTag);
  6101. // perf.clearMeasures(name)
  6102. };
  6103. }
  6104. }
  6105. /* */
  6106. var normalizeEvent = cached(function (name) {
  6107. var passive = name.charAt(0) === '&';
  6108. name = passive ? name.slice(1) : name;
  6109. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  6110. name = once$$1 ? name.slice(1) : name;
  6111. var capture = name.charAt(0) === '!';
  6112. name = capture ? name.slice(1) : name;
  6113. return {
  6114. name: name,
  6115. once: once$$1,
  6116. capture: capture,
  6117. passive: passive
  6118. }
  6119. });
  6120. function createFnInvoker (fns, vm) {
  6121. function invoker () {
  6122. var arguments$1 = arguments;
  6123. var fns = invoker.fns;
  6124. if (Array.isArray(fns)) {
  6125. var cloned = fns.slice();
  6126. for (var i = 0; i < cloned.length; i++) {
  6127. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  6128. }
  6129. } else {
  6130. // return handler return value for single handlers
  6131. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  6132. }
  6133. }
  6134. invoker.fns = fns;
  6135. return invoker
  6136. }
  6137. function updateListeners (
  6138. on,
  6139. oldOn,
  6140. add,
  6141. remove$$1,
  6142. createOnceHandler,
  6143. vm
  6144. ) {
  6145. var name, def$$1, cur, old, event;
  6146. for (name in on) {
  6147. def$$1 = cur = on[name];
  6148. old = oldOn[name];
  6149. event = normalizeEvent(name);
  6150. if (isUndef(cur)) {
  6151. true && warn(
  6152. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  6153. vm
  6154. );
  6155. } else if (isUndef(old)) {
  6156. if (isUndef(cur.fns)) {
  6157. cur = on[name] = createFnInvoker(cur, vm);
  6158. }
  6159. if (isTrue(event.once)) {
  6160. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  6161. }
  6162. add(event.name, cur, event.capture, event.passive, event.params);
  6163. } else if (cur !== old) {
  6164. old.fns = cur;
  6165. on[name] = old;
  6166. }
  6167. }
  6168. for (name in oldOn) {
  6169. if (isUndef(on[name])) {
  6170. event = normalizeEvent(name);
  6171. remove$$1(event.name, oldOn[name], event.capture);
  6172. }
  6173. }
  6174. }
  6175. /* */
  6176. /* */
  6177. // fixed by xxxxxx (mp properties)
  6178. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  6179. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  6180. if (isUndef(propOptions)) {
  6181. return res
  6182. }
  6183. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  6184. var attrs = data.attrs;
  6185. var props = data.props;
  6186. if (isDef(attrs) || isDef(props)) {
  6187. for (var key in propOptions) {
  6188. var altKey = hyphenate(key);
  6189. var result = checkProp(res, props, key, altKey, true) ||
  6190. checkProp(res, attrs, key, altKey, false);
  6191. // externalClass
  6192. if (
  6193. result &&
  6194. res[key] &&
  6195. externalClasses.indexOf(altKey) !== -1 &&
  6196. context[camelize(res[key])]
  6197. ) {
  6198. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  6199. res[key] = context[camelize(res[key])];
  6200. }
  6201. }
  6202. }
  6203. return res
  6204. }
  6205. function extractPropsFromVNodeData (
  6206. data,
  6207. Ctor,
  6208. tag,
  6209. context// fixed by xxxxxx
  6210. ) {
  6211. // we are only extracting raw values here.
  6212. // validation and default values are handled in the child
  6213. // component itself.
  6214. var propOptions = Ctor.options.props;
  6215. if (isUndef(propOptions)) {
  6216. // fixed by xxxxxx
  6217. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  6218. }
  6219. var res = {};
  6220. var attrs = data.attrs;
  6221. var props = data.props;
  6222. if (isDef(attrs) || isDef(props)) {
  6223. for (var key in propOptions) {
  6224. var altKey = hyphenate(key);
  6225. if (true) {
  6226. var keyInLowerCase = key.toLowerCase();
  6227. if (
  6228. key !== keyInLowerCase &&
  6229. attrs && hasOwn(attrs, keyInLowerCase)
  6230. ) {
  6231. tip(
  6232. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  6233. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  6234. " \"" + key + "\". " +
  6235. "Note that HTML attributes are case-insensitive and camelCased " +
  6236. "props need to use their kebab-case equivalents when using in-DOM " +
  6237. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  6238. );
  6239. }
  6240. }
  6241. checkProp(res, props, key, altKey, true) ||
  6242. checkProp(res, attrs, key, altKey, false);
  6243. }
  6244. }
  6245. // fixed by xxxxxx
  6246. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  6247. }
  6248. function checkProp (
  6249. res,
  6250. hash,
  6251. key,
  6252. altKey,
  6253. preserve
  6254. ) {
  6255. if (isDef(hash)) {
  6256. if (hasOwn(hash, key)) {
  6257. res[key] = hash[key];
  6258. if (!preserve) {
  6259. delete hash[key];
  6260. }
  6261. return true
  6262. } else if (hasOwn(hash, altKey)) {
  6263. res[key] = hash[altKey];
  6264. if (!preserve) {
  6265. delete hash[altKey];
  6266. }
  6267. return true
  6268. }
  6269. }
  6270. return false
  6271. }
  6272. /* */
  6273. // The template compiler attempts to minimize the need for normalization by
  6274. // statically analyzing the template at compile time.
  6275. //
  6276. // For plain HTML markup, normalization can be completely skipped because the
  6277. // generated render function is guaranteed to return Array<VNode>. There are
  6278. // two cases where extra normalization is needed:
  6279. // 1. When the children contains components - because a functional component
  6280. // may return an Array instead of a single root. In this case, just a simple
  6281. // normalization is needed - if any child is an Array, we flatten the whole
  6282. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  6283. // because functional components already normalize their own children.
  6284. function simpleNormalizeChildren (children) {
  6285. for (var i = 0; i < children.length; i++) {
  6286. if (Array.isArray(children[i])) {
  6287. return Array.prototype.concat.apply([], children)
  6288. }
  6289. }
  6290. return children
  6291. }
  6292. // 2. When the children contains constructs that always generated nested Arrays,
  6293. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  6294. // with hand-written render functions / JSX. In such cases a full normalization
  6295. // is needed to cater to all possible types of children values.
  6296. function normalizeChildren (children) {
  6297. return isPrimitive(children)
  6298. ? [createTextVNode(children)]
  6299. : Array.isArray(children)
  6300. ? normalizeArrayChildren(children)
  6301. : undefined
  6302. }
  6303. function isTextNode (node) {
  6304. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  6305. }
  6306. function normalizeArrayChildren (children, nestedIndex) {
  6307. var res = [];
  6308. var i, c, lastIndex, last;
  6309. for (i = 0; i < children.length; i++) {
  6310. c = children[i];
  6311. if (isUndef(c) || typeof c === 'boolean') { continue }
  6312. lastIndex = res.length - 1;
  6313. last = res[lastIndex];
  6314. // nested
  6315. if (Array.isArray(c)) {
  6316. if (c.length > 0) {
  6317. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  6318. // merge adjacent text nodes
  6319. if (isTextNode(c[0]) && isTextNode(last)) {
  6320. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  6321. c.shift();
  6322. }
  6323. res.push.apply(res, c);
  6324. }
  6325. } else if (isPrimitive(c)) {
  6326. if (isTextNode(last)) {
  6327. // merge adjacent text nodes
  6328. // this is necessary for SSR hydration because text nodes are
  6329. // essentially merged when rendered to HTML strings
  6330. res[lastIndex] = createTextVNode(last.text + c);
  6331. } else if (c !== '') {
  6332. // convert primitive to vnode
  6333. res.push(createTextVNode(c));
  6334. }
  6335. } else {
  6336. if (isTextNode(c) && isTextNode(last)) {
  6337. // merge adjacent text nodes
  6338. res[lastIndex] = createTextVNode(last.text + c.text);
  6339. } else {
  6340. // default key for nested array children (likely generated by v-for)
  6341. if (isTrue(children._isVList) &&
  6342. isDef(c.tag) &&
  6343. isUndef(c.key) &&
  6344. isDef(nestedIndex)) {
  6345. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  6346. }
  6347. res.push(c);
  6348. }
  6349. }
  6350. }
  6351. return res
  6352. }
  6353. /* */
  6354. function initProvide (vm) {
  6355. var provide = vm.$options.provide;
  6356. if (provide) {
  6357. vm._provided = typeof provide === 'function'
  6358. ? provide.call(vm)
  6359. : provide;
  6360. }
  6361. }
  6362. function initInjections (vm) {
  6363. var result = resolveInject(vm.$options.inject, vm);
  6364. if (result) {
  6365. toggleObserving(false);
  6366. Object.keys(result).forEach(function (key) {
  6367. /* istanbul ignore else */
  6368. if (true) {
  6369. defineReactive$$1(vm, key, result[key], function () {
  6370. warn(
  6371. "Avoid mutating an injected value directly since the changes will be " +
  6372. "overwritten whenever the provided component re-renders. " +
  6373. "injection being mutated: \"" + key + "\"",
  6374. vm
  6375. );
  6376. });
  6377. } else {}
  6378. });
  6379. toggleObserving(true);
  6380. }
  6381. }
  6382. function resolveInject (inject, vm) {
  6383. if (inject) {
  6384. // inject is :any because flow is not smart enough to figure out cached
  6385. var result = Object.create(null);
  6386. var keys = hasSymbol
  6387. ? Reflect.ownKeys(inject)
  6388. : Object.keys(inject);
  6389. for (var i = 0; i < keys.length; i++) {
  6390. var key = keys[i];
  6391. // #6574 in case the inject object is observed...
  6392. if (key === '__ob__') { continue }
  6393. var provideKey = inject[key].from;
  6394. var source = vm;
  6395. while (source) {
  6396. if (source._provided && hasOwn(source._provided, provideKey)) {
  6397. result[key] = source._provided[provideKey];
  6398. break
  6399. }
  6400. source = source.$parent;
  6401. }
  6402. if (!source) {
  6403. if ('default' in inject[key]) {
  6404. var provideDefault = inject[key].default;
  6405. result[key] = typeof provideDefault === 'function'
  6406. ? provideDefault.call(vm)
  6407. : provideDefault;
  6408. } else if (true) {
  6409. warn(("Injection \"" + key + "\" not found"), vm);
  6410. }
  6411. }
  6412. }
  6413. return result
  6414. }
  6415. }
  6416. /* */
  6417. /**
  6418. * Runtime helper for resolving raw children VNodes into a slot object.
  6419. */
  6420. function resolveSlots (
  6421. children,
  6422. context
  6423. ) {
  6424. if (!children || !children.length) {
  6425. return {}
  6426. }
  6427. var slots = {};
  6428. for (var i = 0, l = children.length; i < l; i++) {
  6429. var child = children[i];
  6430. var data = child.data;
  6431. // remove slot attribute if the node is resolved as a Vue slot node
  6432. if (data && data.attrs && data.attrs.slot) {
  6433. delete data.attrs.slot;
  6434. }
  6435. // named slots should only be respected if the vnode was rendered in the
  6436. // same context.
  6437. if ((child.context === context || child.fnContext === context) &&
  6438. data && data.slot != null
  6439. ) {
  6440. var name = data.slot;
  6441. var slot = (slots[name] || (slots[name] = []));
  6442. if (child.tag === 'template') {
  6443. slot.push.apply(slot, child.children || []);
  6444. } else {
  6445. slot.push(child);
  6446. }
  6447. } else {
  6448. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  6449. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  6450. (slots['page'] || (slots['page'] = [])).push(child);
  6451. }else{
  6452. (slots.default || (slots.default = [])).push(child);
  6453. }
  6454. }
  6455. }
  6456. // ignore slots that contains only whitespace
  6457. for (var name$1 in slots) {
  6458. if (slots[name$1].every(isWhitespace)) {
  6459. delete slots[name$1];
  6460. }
  6461. }
  6462. return slots
  6463. }
  6464. function isWhitespace (node) {
  6465. return (node.isComment && !node.asyncFactory) || node.text === ' '
  6466. }
  6467. /* */
  6468. function normalizeScopedSlots (
  6469. slots,
  6470. normalSlots,
  6471. prevSlots
  6472. ) {
  6473. var res;
  6474. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  6475. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  6476. var key = slots && slots.$key;
  6477. if (!slots) {
  6478. res = {};
  6479. } else if (slots._normalized) {
  6480. // fast path 1: child component re-render only, parent did not change
  6481. return slots._normalized
  6482. } else if (
  6483. isStable &&
  6484. prevSlots &&
  6485. prevSlots !== emptyObject &&
  6486. key === prevSlots.$key &&
  6487. !hasNormalSlots &&
  6488. !prevSlots.$hasNormal
  6489. ) {
  6490. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  6491. // only need to normalize once
  6492. return prevSlots
  6493. } else {
  6494. res = {};
  6495. for (var key$1 in slots) {
  6496. if (slots[key$1] && key$1[0] !== '$') {
  6497. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  6498. }
  6499. }
  6500. }
  6501. // expose normal slots on scopedSlots
  6502. for (var key$2 in normalSlots) {
  6503. if (!(key$2 in res)) {
  6504. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  6505. }
  6506. }
  6507. // avoriaz seems to mock a non-extensible $scopedSlots object
  6508. // and when that is passed down this would cause an error
  6509. if (slots && Object.isExtensible(slots)) {
  6510. (slots)._normalized = res;
  6511. }
  6512. def(res, '$stable', isStable);
  6513. def(res, '$key', key);
  6514. def(res, '$hasNormal', hasNormalSlots);
  6515. return res
  6516. }
  6517. function normalizeScopedSlot(normalSlots, key, fn) {
  6518. var normalized = function () {
  6519. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  6520. res = res && typeof res === 'object' && !Array.isArray(res)
  6521. ? [res] // single vnode
  6522. : normalizeChildren(res);
  6523. return res && (
  6524. res.length === 0 ||
  6525. (res.length === 1 && res[0].isComment) // #9658
  6526. ) ? undefined
  6527. : res
  6528. };
  6529. // this is a slot using the new v-slot syntax without scope. although it is
  6530. // compiled as a scoped slot, render fn users would expect it to be present
  6531. // on this.$slots because the usage is semantically a normal slot.
  6532. if (fn.proxy) {
  6533. Object.defineProperty(normalSlots, key, {
  6534. get: normalized,
  6535. enumerable: true,
  6536. configurable: true
  6537. });
  6538. }
  6539. return normalized
  6540. }
  6541. function proxyNormalSlot(slots, key) {
  6542. return function () { return slots[key]; }
  6543. }
  6544. /* */
  6545. /**
  6546. * Runtime helper for rendering v-for lists.
  6547. */
  6548. function renderList (
  6549. val,
  6550. render
  6551. ) {
  6552. var ret, i, l, keys, key;
  6553. if (Array.isArray(val) || typeof val === 'string') {
  6554. ret = new Array(val.length);
  6555. for (i = 0, l = val.length; i < l; i++) {
  6556. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  6557. }
  6558. } else if (typeof val === 'number') {
  6559. ret = new Array(val);
  6560. for (i = 0; i < val; i++) {
  6561. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  6562. }
  6563. } else if (isObject(val)) {
  6564. if (hasSymbol && val[Symbol.iterator]) {
  6565. ret = [];
  6566. var iterator = val[Symbol.iterator]();
  6567. var result = iterator.next();
  6568. while (!result.done) {
  6569. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  6570. result = iterator.next();
  6571. }
  6572. } else {
  6573. keys = Object.keys(val);
  6574. ret = new Array(keys.length);
  6575. for (i = 0, l = keys.length; i < l; i++) {
  6576. key = keys[i];
  6577. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  6578. }
  6579. }
  6580. }
  6581. if (!isDef(ret)) {
  6582. ret = [];
  6583. }
  6584. (ret)._isVList = true;
  6585. return ret
  6586. }
  6587. /* */
  6588. /**
  6589. * Runtime helper for rendering <slot>
  6590. */
  6591. function renderSlot (
  6592. name,
  6593. fallback,
  6594. props,
  6595. bindObject
  6596. ) {
  6597. var scopedSlotFn = this.$scopedSlots[name];
  6598. var nodes;
  6599. if (scopedSlotFn) { // scoped slot
  6600. props = props || {};
  6601. if (bindObject) {
  6602. if ( true && !isObject(bindObject)) {
  6603. warn(
  6604. 'slot v-bind without argument expects an Object',
  6605. this
  6606. );
  6607. }
  6608. props = extend(extend({}, bindObject), props);
  6609. }
  6610. // fixed by xxxxxx app-plus scopedSlot
  6611. nodes = scopedSlotFn(props, this, props._i) || fallback;
  6612. } else {
  6613. nodes = this.$slots[name] || fallback;
  6614. }
  6615. var target = props && props.slot;
  6616. if (target) {
  6617. return this.$createElement('template', { slot: target }, nodes)
  6618. } else {
  6619. return nodes
  6620. }
  6621. }
  6622. /* */
  6623. /**
  6624. * Runtime helper for resolving filters
  6625. */
  6626. function resolveFilter (id) {
  6627. return resolveAsset(this.$options, 'filters', id, true) || identity
  6628. }
  6629. /* */
  6630. function isKeyNotMatch (expect, actual) {
  6631. if (Array.isArray(expect)) {
  6632. return expect.indexOf(actual) === -1
  6633. } else {
  6634. return expect !== actual
  6635. }
  6636. }
  6637. /**
  6638. * Runtime helper for checking keyCodes from config.
  6639. * exposed as Vue.prototype._k
  6640. * passing in eventKeyName as last argument separately for backwards compat
  6641. */
  6642. function checkKeyCodes (
  6643. eventKeyCode,
  6644. key,
  6645. builtInKeyCode,
  6646. eventKeyName,
  6647. builtInKeyName
  6648. ) {
  6649. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  6650. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  6651. return isKeyNotMatch(builtInKeyName, eventKeyName)
  6652. } else if (mappedKeyCode) {
  6653. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  6654. } else if (eventKeyName) {
  6655. return hyphenate(eventKeyName) !== key
  6656. }
  6657. }
  6658. /* */
  6659. /**
  6660. * Runtime helper for merging v-bind="object" into a VNode's data.
  6661. */
  6662. function bindObjectProps (
  6663. data,
  6664. tag,
  6665. value,
  6666. asProp,
  6667. isSync
  6668. ) {
  6669. if (value) {
  6670. if (!isObject(value)) {
  6671. true && warn(
  6672. 'v-bind without argument expects an Object or Array value',
  6673. this
  6674. );
  6675. } else {
  6676. if (Array.isArray(value)) {
  6677. value = toObject(value);
  6678. }
  6679. var hash;
  6680. var loop = function ( key ) {
  6681. if (
  6682. key === 'class' ||
  6683. key === 'style' ||
  6684. isReservedAttribute(key)
  6685. ) {
  6686. hash = data;
  6687. } else {
  6688. var type = data.attrs && data.attrs.type;
  6689. hash = asProp || config.mustUseProp(tag, type, key)
  6690. ? data.domProps || (data.domProps = {})
  6691. : data.attrs || (data.attrs = {});
  6692. }
  6693. var camelizedKey = camelize(key);
  6694. var hyphenatedKey = hyphenate(key);
  6695. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  6696. hash[key] = value[key];
  6697. if (isSync) {
  6698. var on = data.on || (data.on = {});
  6699. on[("update:" + key)] = function ($event) {
  6700. value[key] = $event;
  6701. };
  6702. }
  6703. }
  6704. };
  6705. for (var key in value) loop( key );
  6706. }
  6707. }
  6708. return data
  6709. }
  6710. /* */
  6711. /**
  6712. * Runtime helper for rendering static trees.
  6713. */
  6714. function renderStatic (
  6715. index,
  6716. isInFor
  6717. ) {
  6718. var cached = this._staticTrees || (this._staticTrees = []);
  6719. var tree = cached[index];
  6720. // if has already-rendered static tree and not inside v-for,
  6721. // we can reuse the same tree.
  6722. if (tree && !isInFor) {
  6723. return tree
  6724. }
  6725. // otherwise, render a fresh tree.
  6726. tree = cached[index] = this.$options.staticRenderFns[index].call(
  6727. this._renderProxy,
  6728. null,
  6729. this // for render fns generated for functional component templates
  6730. );
  6731. markStatic(tree, ("__static__" + index), false);
  6732. return tree
  6733. }
  6734. /**
  6735. * Runtime helper for v-once.
  6736. * Effectively it means marking the node as static with a unique key.
  6737. */
  6738. function markOnce (
  6739. tree,
  6740. index,
  6741. key
  6742. ) {
  6743. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  6744. return tree
  6745. }
  6746. function markStatic (
  6747. tree,
  6748. key,
  6749. isOnce
  6750. ) {
  6751. if (Array.isArray(tree)) {
  6752. for (var i = 0; i < tree.length; i++) {
  6753. if (tree[i] && typeof tree[i] !== 'string') {
  6754. markStaticNode(tree[i], (key + "_" + i), isOnce);
  6755. }
  6756. }
  6757. } else {
  6758. markStaticNode(tree, key, isOnce);
  6759. }
  6760. }
  6761. function markStaticNode (node, key, isOnce) {
  6762. node.isStatic = true;
  6763. node.key = key;
  6764. node.isOnce = isOnce;
  6765. }
  6766. /* */
  6767. function bindObjectListeners (data, value) {
  6768. if (value) {
  6769. if (!isPlainObject(value)) {
  6770. true && warn(
  6771. 'v-on without argument expects an Object value',
  6772. this
  6773. );
  6774. } else {
  6775. var on = data.on = data.on ? extend({}, data.on) : {};
  6776. for (var key in value) {
  6777. var existing = on[key];
  6778. var ours = value[key];
  6779. on[key] = existing ? [].concat(existing, ours) : ours;
  6780. }
  6781. }
  6782. }
  6783. return data
  6784. }
  6785. /* */
  6786. function resolveScopedSlots (
  6787. fns, // see flow/vnode
  6788. res,
  6789. // the following are added in 2.6
  6790. hasDynamicKeys,
  6791. contentHashKey
  6792. ) {
  6793. res = res || { $stable: !hasDynamicKeys };
  6794. for (var i = 0; i < fns.length; i++) {
  6795. var slot = fns[i];
  6796. if (Array.isArray(slot)) {
  6797. resolveScopedSlots(slot, res, hasDynamicKeys);
  6798. } else if (slot) {
  6799. // marker for reverse proxying v-slot without scope on this.$slots
  6800. if (slot.proxy) {
  6801. slot.fn.proxy = true;
  6802. }
  6803. res[slot.key] = slot.fn;
  6804. }
  6805. }
  6806. if (contentHashKey) {
  6807. (res).$key = contentHashKey;
  6808. }
  6809. return res
  6810. }
  6811. /* */
  6812. function bindDynamicKeys (baseObj, values) {
  6813. for (var i = 0; i < values.length; i += 2) {
  6814. var key = values[i];
  6815. if (typeof key === 'string' && key) {
  6816. baseObj[values[i]] = values[i + 1];
  6817. } else if ( true && key !== '' && key !== null) {
  6818. // null is a special value for explicitly removing a binding
  6819. warn(
  6820. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  6821. this
  6822. );
  6823. }
  6824. }
  6825. return baseObj
  6826. }
  6827. // helper to dynamically append modifier runtime markers to event names.
  6828. // ensure only append when value is already string, otherwise it will be cast
  6829. // to string and cause the type check to miss.
  6830. function prependModifier (value, symbol) {
  6831. return typeof value === 'string' ? symbol + value : value
  6832. }
  6833. /* */
  6834. function installRenderHelpers (target) {
  6835. target._o = markOnce;
  6836. target._n = toNumber;
  6837. target._s = toString;
  6838. target._l = renderList;
  6839. target._t = renderSlot;
  6840. target._q = looseEqual;
  6841. target._i = looseIndexOf;
  6842. target._m = renderStatic;
  6843. target._f = resolveFilter;
  6844. target._k = checkKeyCodes;
  6845. target._b = bindObjectProps;
  6846. target._v = createTextVNode;
  6847. target._e = createEmptyVNode;
  6848. target._u = resolveScopedSlots;
  6849. target._g = bindObjectListeners;
  6850. target._d = bindDynamicKeys;
  6851. target._p = prependModifier;
  6852. }
  6853. /* */
  6854. function FunctionalRenderContext (
  6855. data,
  6856. props,
  6857. children,
  6858. parent,
  6859. Ctor
  6860. ) {
  6861. var this$1 = this;
  6862. var options = Ctor.options;
  6863. // ensure the createElement function in functional components
  6864. // gets a unique context - this is necessary for correct named slot check
  6865. var contextVm;
  6866. if (hasOwn(parent, '_uid')) {
  6867. contextVm = Object.create(parent);
  6868. // $flow-disable-line
  6869. contextVm._original = parent;
  6870. } else {
  6871. // the context vm passed in is a functional context as well.
  6872. // in this case we want to make sure we are able to get a hold to the
  6873. // real context instance.
  6874. contextVm = parent;
  6875. // $flow-disable-line
  6876. parent = parent._original;
  6877. }
  6878. var isCompiled = isTrue(options._compiled);
  6879. var needNormalization = !isCompiled;
  6880. this.data = data;
  6881. this.props = props;
  6882. this.children = children;
  6883. this.parent = parent;
  6884. this.listeners = data.on || emptyObject;
  6885. this.injections = resolveInject(options.inject, parent);
  6886. this.slots = function () {
  6887. if (!this$1.$slots) {
  6888. normalizeScopedSlots(
  6889. data.scopedSlots,
  6890. this$1.$slots = resolveSlots(children, parent)
  6891. );
  6892. }
  6893. return this$1.$slots
  6894. };
  6895. Object.defineProperty(this, 'scopedSlots', ({
  6896. enumerable: true,
  6897. get: function get () {
  6898. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6899. }
  6900. }));
  6901. // support for compiled functional template
  6902. if (isCompiled) {
  6903. // exposing $options for renderStatic()
  6904. this.$options = options;
  6905. // pre-resolve slots for renderSlot()
  6906. this.$slots = this.slots();
  6907. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6908. }
  6909. if (options._scopeId) {
  6910. this._c = function (a, b, c, d) {
  6911. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6912. if (vnode && !Array.isArray(vnode)) {
  6913. vnode.fnScopeId = options._scopeId;
  6914. vnode.fnContext = parent;
  6915. }
  6916. return vnode
  6917. };
  6918. } else {
  6919. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6920. }
  6921. }
  6922. installRenderHelpers(FunctionalRenderContext.prototype);
  6923. function createFunctionalComponent (
  6924. Ctor,
  6925. propsData,
  6926. data,
  6927. contextVm,
  6928. children
  6929. ) {
  6930. var options = Ctor.options;
  6931. var props = {};
  6932. var propOptions = options.props;
  6933. if (isDef(propOptions)) {
  6934. for (var key in propOptions) {
  6935. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6936. }
  6937. } else {
  6938. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6939. if (isDef(data.props)) { mergeProps(props, data.props); }
  6940. }
  6941. var renderContext = new FunctionalRenderContext(
  6942. data,
  6943. props,
  6944. children,
  6945. contextVm,
  6946. Ctor
  6947. );
  6948. var vnode = options.render.call(null, renderContext._c, renderContext);
  6949. if (vnode instanceof VNode) {
  6950. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6951. } else if (Array.isArray(vnode)) {
  6952. var vnodes = normalizeChildren(vnode) || [];
  6953. var res = new Array(vnodes.length);
  6954. for (var i = 0; i < vnodes.length; i++) {
  6955. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6956. }
  6957. return res
  6958. }
  6959. }
  6960. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6961. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6962. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6963. // that should not be matched to match.
  6964. var clone = cloneVNode(vnode);
  6965. clone.fnContext = contextVm;
  6966. clone.fnOptions = options;
  6967. if (true) {
  6968. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6969. }
  6970. if (data.slot) {
  6971. (clone.data || (clone.data = {})).slot = data.slot;
  6972. }
  6973. return clone
  6974. }
  6975. function mergeProps (to, from) {
  6976. for (var key in from) {
  6977. to[camelize(key)] = from[key];
  6978. }
  6979. }
  6980. /* */
  6981. /* */
  6982. /* */
  6983. /* */
  6984. // inline hooks to be invoked on component VNodes during patch
  6985. var componentVNodeHooks = {
  6986. init: function init (vnode, hydrating) {
  6987. if (
  6988. vnode.componentInstance &&
  6989. !vnode.componentInstance._isDestroyed &&
  6990. vnode.data.keepAlive
  6991. ) {
  6992. // kept-alive components, treat as a patch
  6993. var mountedNode = vnode; // work around flow
  6994. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6995. } else {
  6996. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6997. vnode,
  6998. activeInstance
  6999. );
  7000. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  7001. }
  7002. },
  7003. prepatch: function prepatch (oldVnode, vnode) {
  7004. var options = vnode.componentOptions;
  7005. var child = vnode.componentInstance = oldVnode.componentInstance;
  7006. updateChildComponent(
  7007. child,
  7008. options.propsData, // updated props
  7009. options.listeners, // updated listeners
  7010. vnode, // new parent vnode
  7011. options.children // new children
  7012. );
  7013. },
  7014. insert: function insert (vnode) {
  7015. var context = vnode.context;
  7016. var componentInstance = vnode.componentInstance;
  7017. if (!componentInstance._isMounted) {
  7018. callHook(componentInstance, 'onServiceCreated');
  7019. callHook(componentInstance, 'onServiceAttached');
  7020. componentInstance._isMounted = true;
  7021. callHook(componentInstance, 'mounted');
  7022. }
  7023. if (vnode.data.keepAlive) {
  7024. if (context._isMounted) {
  7025. // vue-router#1212
  7026. // During updates, a kept-alive component's child components may
  7027. // change, so directly walking the tree here may call activated hooks
  7028. // on incorrect children. Instead we push them into a queue which will
  7029. // be processed after the whole patch process ended.
  7030. queueActivatedComponent(componentInstance);
  7031. } else {
  7032. activateChildComponent(componentInstance, true /* direct */);
  7033. }
  7034. }
  7035. },
  7036. destroy: function destroy (vnode) {
  7037. var componentInstance = vnode.componentInstance;
  7038. if (!componentInstance._isDestroyed) {
  7039. if (!vnode.data.keepAlive) {
  7040. componentInstance.$destroy();
  7041. } else {
  7042. deactivateChildComponent(componentInstance, true /* direct */);
  7043. }
  7044. }
  7045. }
  7046. };
  7047. var hooksToMerge = Object.keys(componentVNodeHooks);
  7048. function createComponent (
  7049. Ctor,
  7050. data,
  7051. context,
  7052. children,
  7053. tag
  7054. ) {
  7055. if (isUndef(Ctor)) {
  7056. return
  7057. }
  7058. var baseCtor = context.$options._base;
  7059. // plain options object: turn it into a constructor
  7060. if (isObject(Ctor)) {
  7061. Ctor = baseCtor.extend(Ctor);
  7062. }
  7063. // if at this stage it's not a constructor or an async component factory,
  7064. // reject.
  7065. if (typeof Ctor !== 'function') {
  7066. if (true) {
  7067. warn(("Invalid Component definition: " + (String(Ctor))), context);
  7068. }
  7069. return
  7070. }
  7071. // async component
  7072. var asyncFactory;
  7073. if (isUndef(Ctor.cid)) {
  7074. asyncFactory = Ctor;
  7075. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  7076. if (Ctor === undefined) {
  7077. // return a placeholder node for async component, which is rendered
  7078. // as a comment node but preserves all the raw information for the node.
  7079. // the information will be used for async server-rendering and hydration.
  7080. return createAsyncPlaceholder(
  7081. asyncFactory,
  7082. data,
  7083. context,
  7084. children,
  7085. tag
  7086. )
  7087. }
  7088. }
  7089. data = data || {};
  7090. // resolve constructor options in case global mixins are applied after
  7091. // component constructor creation
  7092. resolveConstructorOptions(Ctor);
  7093. // transform component v-model data into props & events
  7094. if (isDef(data.model)) {
  7095. transformModel(Ctor.options, data);
  7096. }
  7097. // extract props
  7098. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  7099. // functional component
  7100. if (isTrue(Ctor.options.functional)) {
  7101. return createFunctionalComponent(Ctor, propsData, data, context, children)
  7102. }
  7103. // extract listeners, since these needs to be treated as
  7104. // child component listeners instead of DOM listeners
  7105. var listeners = data.on;
  7106. // replace with listeners with .native modifier
  7107. // so it gets processed during parent component patch.
  7108. data.on = data.nativeOn;
  7109. if (isTrue(Ctor.options.abstract)) {
  7110. // abstract components do not keep anything
  7111. // other than props & listeners & slot
  7112. // work around flow
  7113. var slot = data.slot;
  7114. data = {};
  7115. if (slot) {
  7116. data.slot = slot;
  7117. }
  7118. }
  7119. // install component management hooks onto the placeholder node
  7120. installComponentHooks(data);
  7121. // return a placeholder vnode
  7122. var name = Ctor.options.name || tag;
  7123. var vnode = new VNode(
  7124. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  7125. data, undefined, undefined, undefined, context,
  7126. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  7127. asyncFactory
  7128. );
  7129. return vnode
  7130. }
  7131. function createComponentInstanceForVnode (
  7132. vnode, // we know it's MountedComponentVNode but flow doesn't
  7133. parent // activeInstance in lifecycle state
  7134. ) {
  7135. var options = {
  7136. _isComponent: true,
  7137. _parentVnode: vnode,
  7138. parent: parent
  7139. };
  7140. // check inline-template render functions
  7141. var inlineTemplate = vnode.data.inlineTemplate;
  7142. if (isDef(inlineTemplate)) {
  7143. options.render = inlineTemplate.render;
  7144. options.staticRenderFns = inlineTemplate.staticRenderFns;
  7145. }
  7146. return new vnode.componentOptions.Ctor(options)
  7147. }
  7148. function installComponentHooks (data) {
  7149. var hooks = data.hook || (data.hook = {});
  7150. for (var i = 0; i < hooksToMerge.length; i++) {
  7151. var key = hooksToMerge[i];
  7152. var existing = hooks[key];
  7153. var toMerge = componentVNodeHooks[key];
  7154. if (existing !== toMerge && !(existing && existing._merged)) {
  7155. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  7156. }
  7157. }
  7158. }
  7159. function mergeHook$1 (f1, f2) {
  7160. var merged = function (a, b) {
  7161. // flow complains about extra args which is why we use any
  7162. f1(a, b);
  7163. f2(a, b);
  7164. };
  7165. merged._merged = true;
  7166. return merged
  7167. }
  7168. // transform component v-model info (value and callback) into
  7169. // prop and event handler respectively.
  7170. function transformModel (options, data) {
  7171. var prop = (options.model && options.model.prop) || 'value';
  7172. var event = (options.model && options.model.event) || 'input'
  7173. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  7174. var on = data.on || (data.on = {});
  7175. var existing = on[event];
  7176. var callback = data.model.callback;
  7177. if (isDef(existing)) {
  7178. if (
  7179. Array.isArray(existing)
  7180. ? existing.indexOf(callback) === -1
  7181. : existing !== callback
  7182. ) {
  7183. on[event] = [callback].concat(existing);
  7184. }
  7185. } else {
  7186. on[event] = callback;
  7187. }
  7188. }
  7189. /* */
  7190. var SIMPLE_NORMALIZE = 1;
  7191. var ALWAYS_NORMALIZE = 2;
  7192. // wrapper function for providing a more flexible interface
  7193. // without getting yelled at by flow
  7194. function createElement (
  7195. context,
  7196. tag,
  7197. data,
  7198. children,
  7199. normalizationType,
  7200. alwaysNormalize
  7201. ) {
  7202. if (Array.isArray(data) || isPrimitive(data)) {
  7203. normalizationType = children;
  7204. children = data;
  7205. data = undefined;
  7206. }
  7207. if (isTrue(alwaysNormalize)) {
  7208. normalizationType = ALWAYS_NORMALIZE;
  7209. }
  7210. return _createElement(context, tag, data, children, normalizationType)
  7211. }
  7212. function _createElement (
  7213. context,
  7214. tag,
  7215. data,
  7216. children,
  7217. normalizationType
  7218. ) {
  7219. if (isDef(data) && isDef((data).__ob__)) {
  7220. true && warn(
  7221. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  7222. 'Always create fresh vnode data objects in each render!',
  7223. context
  7224. );
  7225. return createEmptyVNode()
  7226. }
  7227. // object syntax in v-bind
  7228. if (isDef(data) && isDef(data.is)) {
  7229. tag = data.is;
  7230. }
  7231. if (!tag) {
  7232. // in case of component :is set to falsy value
  7233. return createEmptyVNode()
  7234. }
  7235. // warn against non-primitive key
  7236. if ( true &&
  7237. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  7238. ) {
  7239. {
  7240. warn(
  7241. 'Avoid using non-primitive value as key, ' +
  7242. 'use string/number value instead.',
  7243. context
  7244. );
  7245. }
  7246. }
  7247. // support single function children as default scoped slot
  7248. if (Array.isArray(children) &&
  7249. typeof children[0] === 'function'
  7250. ) {
  7251. data = data || {};
  7252. data.scopedSlots = { default: children[0] };
  7253. children.length = 0;
  7254. }
  7255. if (normalizationType === ALWAYS_NORMALIZE) {
  7256. children = normalizeChildren(children);
  7257. } else if (normalizationType === SIMPLE_NORMALIZE) {
  7258. children = simpleNormalizeChildren(children);
  7259. }
  7260. var vnode, ns;
  7261. if (typeof tag === 'string') {
  7262. var Ctor;
  7263. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  7264. if (config.isReservedTag(tag)) {
  7265. // platform built-in elements
  7266. if ( true && isDef(data) && isDef(data.nativeOn)) {
  7267. warn(
  7268. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  7269. context
  7270. );
  7271. }
  7272. vnode = new VNode(
  7273. config.parsePlatformTagName(tag), data, children,
  7274. undefined, undefined, context
  7275. );
  7276. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  7277. // component
  7278. vnode = createComponent(Ctor, data, context, children, tag);
  7279. } else {
  7280. // unknown or unlisted namespaced elements
  7281. // check at runtime because it may get assigned a namespace when its
  7282. // parent normalizes children
  7283. vnode = new VNode(
  7284. tag, data, children,
  7285. undefined, undefined, context
  7286. );
  7287. }
  7288. } else {
  7289. // direct component options / constructor
  7290. vnode = createComponent(tag, data, context, children);
  7291. }
  7292. if (Array.isArray(vnode)) {
  7293. return vnode
  7294. } else if (isDef(vnode)) {
  7295. if (isDef(ns)) { applyNS(vnode, ns); }
  7296. if (isDef(data)) { registerDeepBindings(data); }
  7297. return vnode
  7298. } else {
  7299. return createEmptyVNode()
  7300. }
  7301. }
  7302. function applyNS (vnode, ns, force) {
  7303. vnode.ns = ns;
  7304. if (vnode.tag === 'foreignObject') {
  7305. // use default namespace inside foreignObject
  7306. ns = undefined;
  7307. force = true;
  7308. }
  7309. if (isDef(vnode.children)) {
  7310. for (var i = 0, l = vnode.children.length; i < l; i++) {
  7311. var child = vnode.children[i];
  7312. if (isDef(child.tag) && (
  7313. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  7314. applyNS(child, ns, force);
  7315. }
  7316. }
  7317. }
  7318. }
  7319. // ref #5318
  7320. // necessary to ensure parent re-render when deep bindings like :style and
  7321. // :class are used on slot nodes
  7322. function registerDeepBindings (data) {
  7323. if (isObject(data.style)) {
  7324. traverse(data.style);
  7325. }
  7326. if (isObject(data.class)) {
  7327. traverse(data.class);
  7328. }
  7329. }
  7330. /* */
  7331. function initRender (vm) {
  7332. vm._vnode = null; // the root of the child tree
  7333. vm._staticTrees = null; // v-once cached trees
  7334. var options = vm.$options;
  7335. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  7336. var renderContext = parentVnode && parentVnode.context;
  7337. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  7338. vm.$scopedSlots = emptyObject;
  7339. // bind the createElement fn to this instance
  7340. // so that we get proper render context inside it.
  7341. // args order: tag, data, children, normalizationType, alwaysNormalize
  7342. // internal version is used by render functions compiled from templates
  7343. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  7344. // normalization is always applied for the public version, used in
  7345. // user-written render functions.
  7346. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  7347. // $attrs & $listeners are exposed for easier HOC creation.
  7348. // they need to be reactive so that HOCs using them are always updated
  7349. var parentData = parentVnode && parentVnode.data;
  7350. /* istanbul ignore else */
  7351. if (true) {
  7352. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  7353. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  7354. }, true);
  7355. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  7356. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  7357. }, true);
  7358. } else {}
  7359. }
  7360. var currentRenderingInstance = null;
  7361. function renderMixin (Vue) {
  7362. // install runtime convenience helpers
  7363. installRenderHelpers(Vue.prototype);
  7364. Vue.prototype.$nextTick = function (fn) {
  7365. return nextTick(fn, this)
  7366. };
  7367. Vue.prototype._render = function () {
  7368. var vm = this;
  7369. var ref = vm.$options;
  7370. var render = ref.render;
  7371. var _parentVnode = ref._parentVnode;
  7372. if (_parentVnode) {
  7373. vm.$scopedSlots = normalizeScopedSlots(
  7374. _parentVnode.data.scopedSlots,
  7375. vm.$slots,
  7376. vm.$scopedSlots
  7377. );
  7378. }
  7379. // set parent vnode. this allows render functions to have access
  7380. // to the data on the placeholder node.
  7381. vm.$vnode = _parentVnode;
  7382. // render self
  7383. var vnode;
  7384. try {
  7385. // There's no need to maintain a stack because all render fns are called
  7386. // separately from one another. Nested component's render fns are called
  7387. // when parent component is patched.
  7388. currentRenderingInstance = vm;
  7389. vnode = render.call(vm._renderProxy, vm.$createElement);
  7390. } catch (e) {
  7391. handleError(e, vm, "render");
  7392. // return error render result,
  7393. // or previous vnode to prevent render error causing blank component
  7394. /* istanbul ignore else */
  7395. if ( true && vm.$options.renderError) {
  7396. try {
  7397. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  7398. } catch (e) {
  7399. handleError(e, vm, "renderError");
  7400. vnode = vm._vnode;
  7401. }
  7402. } else {
  7403. vnode = vm._vnode;
  7404. }
  7405. } finally {
  7406. currentRenderingInstance = null;
  7407. }
  7408. // if the returned array contains only a single node, allow it
  7409. if (Array.isArray(vnode) && vnode.length === 1) {
  7410. vnode = vnode[0];
  7411. }
  7412. // return empty vnode in case the render function errored out
  7413. if (!(vnode instanceof VNode)) {
  7414. if ( true && Array.isArray(vnode)) {
  7415. warn(
  7416. 'Multiple root nodes returned from render function. Render function ' +
  7417. 'should return a single root node.',
  7418. vm
  7419. );
  7420. }
  7421. vnode = createEmptyVNode();
  7422. }
  7423. // set parent
  7424. vnode.parent = _parentVnode;
  7425. return vnode
  7426. };
  7427. }
  7428. /* */
  7429. function ensureCtor (comp, base) {
  7430. if (
  7431. comp.__esModule ||
  7432. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  7433. ) {
  7434. comp = comp.default;
  7435. }
  7436. return isObject(comp)
  7437. ? base.extend(comp)
  7438. : comp
  7439. }
  7440. function createAsyncPlaceholder (
  7441. factory,
  7442. data,
  7443. context,
  7444. children,
  7445. tag
  7446. ) {
  7447. var node = createEmptyVNode();
  7448. node.asyncFactory = factory;
  7449. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  7450. return node
  7451. }
  7452. function resolveAsyncComponent (
  7453. factory,
  7454. baseCtor
  7455. ) {
  7456. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  7457. return factory.errorComp
  7458. }
  7459. if (isDef(factory.resolved)) {
  7460. return factory.resolved
  7461. }
  7462. var owner = currentRenderingInstance;
  7463. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  7464. // already pending
  7465. factory.owners.push(owner);
  7466. }
  7467. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  7468. return factory.loadingComp
  7469. }
  7470. if (owner && !isDef(factory.owners)) {
  7471. var owners = factory.owners = [owner];
  7472. var sync = true;
  7473. var timerLoading = null;
  7474. var timerTimeout = null
  7475. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  7476. var forceRender = function (renderCompleted) {
  7477. for (var i = 0, l = owners.length; i < l; i++) {
  7478. (owners[i]).$forceUpdate();
  7479. }
  7480. if (renderCompleted) {
  7481. owners.length = 0;
  7482. if (timerLoading !== null) {
  7483. clearTimeout(timerLoading);
  7484. timerLoading = null;
  7485. }
  7486. if (timerTimeout !== null) {
  7487. clearTimeout(timerTimeout);
  7488. timerTimeout = null;
  7489. }
  7490. }
  7491. };
  7492. var resolve = once(function (res) {
  7493. // cache resolved
  7494. factory.resolved = ensureCtor(res, baseCtor);
  7495. // invoke callbacks only if this is not a synchronous resolve
  7496. // (async resolves are shimmed as synchronous during SSR)
  7497. if (!sync) {
  7498. forceRender(true);
  7499. } else {
  7500. owners.length = 0;
  7501. }
  7502. });
  7503. var reject = once(function (reason) {
  7504. true && warn(
  7505. "Failed to resolve async component: " + (String(factory)) +
  7506. (reason ? ("\nReason: " + reason) : '')
  7507. );
  7508. if (isDef(factory.errorComp)) {
  7509. factory.error = true;
  7510. forceRender(true);
  7511. }
  7512. });
  7513. var res = factory(resolve, reject);
  7514. if (isObject(res)) {
  7515. if (isPromise(res)) {
  7516. // () => Promise
  7517. if (isUndef(factory.resolved)) {
  7518. res.then(resolve, reject);
  7519. }
  7520. } else if (isPromise(res.component)) {
  7521. res.component.then(resolve, reject);
  7522. if (isDef(res.error)) {
  7523. factory.errorComp = ensureCtor(res.error, baseCtor);
  7524. }
  7525. if (isDef(res.loading)) {
  7526. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  7527. if (res.delay === 0) {
  7528. factory.loading = true;
  7529. } else {
  7530. timerLoading = setTimeout(function () {
  7531. timerLoading = null;
  7532. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  7533. factory.loading = true;
  7534. forceRender(false);
  7535. }
  7536. }, res.delay || 200);
  7537. }
  7538. }
  7539. if (isDef(res.timeout)) {
  7540. timerTimeout = setTimeout(function () {
  7541. timerTimeout = null;
  7542. if (isUndef(factory.resolved)) {
  7543. reject(
  7544. true
  7545. ? ("timeout (" + (res.timeout) + "ms)")
  7546. : undefined
  7547. );
  7548. }
  7549. }, res.timeout);
  7550. }
  7551. }
  7552. }
  7553. sync = false;
  7554. // return in case resolved synchronously
  7555. return factory.loading
  7556. ? factory.loadingComp
  7557. : factory.resolved
  7558. }
  7559. }
  7560. /* */
  7561. function isAsyncPlaceholder (node) {
  7562. return node.isComment && node.asyncFactory
  7563. }
  7564. /* */
  7565. function getFirstComponentChild (children) {
  7566. if (Array.isArray(children)) {
  7567. for (var i = 0; i < children.length; i++) {
  7568. var c = children[i];
  7569. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  7570. return c
  7571. }
  7572. }
  7573. }
  7574. }
  7575. /* */
  7576. /* */
  7577. function initEvents (vm) {
  7578. vm._events = Object.create(null);
  7579. vm._hasHookEvent = false;
  7580. // init parent attached events
  7581. var listeners = vm.$options._parentListeners;
  7582. if (listeners) {
  7583. updateComponentListeners(vm, listeners);
  7584. }
  7585. }
  7586. var target;
  7587. function add (event, fn) {
  7588. target.$on(event, fn);
  7589. }
  7590. function remove$1 (event, fn) {
  7591. target.$off(event, fn);
  7592. }
  7593. function createOnceHandler (event, fn) {
  7594. var _target = target;
  7595. return function onceHandler () {
  7596. var res = fn.apply(null, arguments);
  7597. if (res !== null) {
  7598. _target.$off(event, onceHandler);
  7599. }
  7600. }
  7601. }
  7602. function updateComponentListeners (
  7603. vm,
  7604. listeners,
  7605. oldListeners
  7606. ) {
  7607. target = vm;
  7608. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  7609. target = undefined;
  7610. }
  7611. function eventsMixin (Vue) {
  7612. var hookRE = /^hook:/;
  7613. Vue.prototype.$on = function (event, fn) {
  7614. var vm = this;
  7615. if (Array.isArray(event)) {
  7616. for (var i = 0, l = event.length; i < l; i++) {
  7617. vm.$on(event[i], fn);
  7618. }
  7619. } else {
  7620. (vm._events[event] || (vm._events[event] = [])).push(fn);
  7621. // optimize hook:event cost by using a boolean flag marked at registration
  7622. // instead of a hash lookup
  7623. if (hookRE.test(event)) {
  7624. vm._hasHookEvent = true;
  7625. }
  7626. }
  7627. return vm
  7628. };
  7629. Vue.prototype.$once = function (event, fn) {
  7630. var vm = this;
  7631. function on () {
  7632. vm.$off(event, on);
  7633. fn.apply(vm, arguments);
  7634. }
  7635. on.fn = fn;
  7636. vm.$on(event, on);
  7637. return vm
  7638. };
  7639. Vue.prototype.$off = function (event, fn) {
  7640. var vm = this;
  7641. // all
  7642. if (!arguments.length) {
  7643. vm._events = Object.create(null);
  7644. return vm
  7645. }
  7646. // array of events
  7647. if (Array.isArray(event)) {
  7648. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  7649. vm.$off(event[i$1], fn);
  7650. }
  7651. return vm
  7652. }
  7653. // specific event
  7654. var cbs = vm._events[event];
  7655. if (!cbs) {
  7656. return vm
  7657. }
  7658. if (!fn) {
  7659. vm._events[event] = null;
  7660. return vm
  7661. }
  7662. // specific handler
  7663. var cb;
  7664. var i = cbs.length;
  7665. while (i--) {
  7666. cb = cbs[i];
  7667. if (cb === fn || cb.fn === fn) {
  7668. cbs.splice(i, 1);
  7669. break
  7670. }
  7671. }
  7672. return vm
  7673. };
  7674. Vue.prototype.$emit = function (event) {
  7675. var vm = this;
  7676. if (true) {
  7677. var lowerCaseEvent = event.toLowerCase();
  7678. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  7679. tip(
  7680. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  7681. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  7682. "Note that HTML attributes are case-insensitive and you cannot use " +
  7683. "v-on to listen to camelCase events when using in-DOM templates. " +
  7684. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  7685. );
  7686. }
  7687. }
  7688. var cbs = vm._events[event];
  7689. if (cbs) {
  7690. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  7691. var args = toArray(arguments, 1);
  7692. var info = "event handler for \"" + event + "\"";
  7693. for (var i = 0, l = cbs.length; i < l; i++) {
  7694. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  7695. }
  7696. }
  7697. return vm
  7698. };
  7699. }
  7700. /* */
  7701. var activeInstance = null;
  7702. var isUpdatingChildComponent = false;
  7703. function setActiveInstance(vm) {
  7704. var prevActiveInstance = activeInstance;
  7705. activeInstance = vm;
  7706. return function () {
  7707. activeInstance = prevActiveInstance;
  7708. }
  7709. }
  7710. function initLifecycle (vm) {
  7711. var options = vm.$options;
  7712. // locate first non-abstract parent
  7713. var parent = options.parent;
  7714. if (parent && !options.abstract) {
  7715. while (parent.$options.abstract && parent.$parent) {
  7716. parent = parent.$parent;
  7717. }
  7718. parent.$children.push(vm);
  7719. }
  7720. vm.$parent = parent;
  7721. vm.$root = parent ? parent.$root : vm;
  7722. vm.$children = [];
  7723. vm.$refs = {};
  7724. vm._watcher = null;
  7725. vm._inactive = null;
  7726. vm._directInactive = false;
  7727. vm._isMounted = false;
  7728. vm._isDestroyed = false;
  7729. vm._isBeingDestroyed = false;
  7730. }
  7731. function lifecycleMixin (Vue) {
  7732. Vue.prototype._update = function (vnode, hydrating) {
  7733. var vm = this;
  7734. var prevEl = vm.$el;
  7735. var prevVnode = vm._vnode;
  7736. var restoreActiveInstance = setActiveInstance(vm);
  7737. vm._vnode = vnode;
  7738. // Vue.prototype.__patch__ is injected in entry points
  7739. // based on the rendering backend used.
  7740. if (!prevVnode) {
  7741. // initial render
  7742. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  7743. } else {
  7744. // updates
  7745. vm.$el = vm.__patch__(prevVnode, vnode);
  7746. }
  7747. restoreActiveInstance();
  7748. // update __vue__ reference
  7749. if (prevEl) {
  7750. prevEl.__vue__ = null;
  7751. }
  7752. if (vm.$el) {
  7753. vm.$el.__vue__ = vm;
  7754. }
  7755. // if parent is an HOC, update its $el as well
  7756. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  7757. vm.$parent.$el = vm.$el;
  7758. }
  7759. // updated hook is called by the scheduler to ensure that children are
  7760. // updated in a parent's updated hook.
  7761. };
  7762. Vue.prototype.$forceUpdate = function () {
  7763. var vm = this;
  7764. if (vm._watcher) {
  7765. vm._watcher.update();
  7766. }
  7767. };
  7768. Vue.prototype.$destroy = function () {
  7769. var vm = this;
  7770. if (vm._isBeingDestroyed) {
  7771. return
  7772. }
  7773. callHook(vm, 'beforeDestroy');
  7774. vm._isBeingDestroyed = true;
  7775. // remove self from parent
  7776. var parent = vm.$parent;
  7777. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  7778. remove(parent.$children, vm);
  7779. }
  7780. // teardown watchers
  7781. if (vm._watcher) {
  7782. vm._watcher.teardown();
  7783. }
  7784. var i = vm._watchers.length;
  7785. while (i--) {
  7786. vm._watchers[i].teardown();
  7787. }
  7788. // remove reference from data ob
  7789. // frozen object may not have observer.
  7790. if (vm._data.__ob__) {
  7791. vm._data.__ob__.vmCount--;
  7792. }
  7793. // call the last hook...
  7794. vm._isDestroyed = true;
  7795. // invoke destroy hooks on current rendered tree
  7796. vm.__patch__(vm._vnode, null);
  7797. // fire destroyed hook
  7798. callHook(vm, 'destroyed');
  7799. // turn off all instance listeners.
  7800. vm.$off();
  7801. // remove __vue__ reference
  7802. if (vm.$el) {
  7803. vm.$el.__vue__ = null;
  7804. }
  7805. // release circular reference (#6759)
  7806. if (vm.$vnode) {
  7807. vm.$vnode.parent = null;
  7808. }
  7809. };
  7810. }
  7811. function updateChildComponent (
  7812. vm,
  7813. propsData,
  7814. listeners,
  7815. parentVnode,
  7816. renderChildren
  7817. ) {
  7818. if (true) {
  7819. isUpdatingChildComponent = true;
  7820. }
  7821. // determine whether component has slot children
  7822. // we need to do this before overwriting $options._renderChildren.
  7823. // check if there are dynamic scopedSlots (hand-written or compiled but with
  7824. // dynamic slot names). Static scoped slots compiled from template has the
  7825. // "$stable" marker.
  7826. var newScopedSlots = parentVnode.data.scopedSlots;
  7827. var oldScopedSlots = vm.$scopedSlots;
  7828. var hasDynamicScopedSlot = !!(
  7829. (newScopedSlots && !newScopedSlots.$stable) ||
  7830. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  7831. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  7832. );
  7833. // Any static slot children from the parent may have changed during parent's
  7834. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  7835. // update is necessary to ensure correctness.
  7836. var needsForceUpdate = !!(
  7837. renderChildren || // has new static slots
  7838. vm.$options._renderChildren || // has old static slots
  7839. hasDynamicScopedSlot
  7840. );
  7841. vm.$options._parentVnode = parentVnode;
  7842. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7843. if (vm._vnode) { // update child tree's parent
  7844. vm._vnode.parent = parentVnode;
  7845. }
  7846. vm.$options._renderChildren = renderChildren;
  7847. // update $attrs and $listeners hash
  7848. // these are also reactive so they may trigger child update if the child
  7849. // used them during render
  7850. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7851. vm.$listeners = listeners || emptyObject;
  7852. // update props
  7853. if (propsData && vm.$options.props) {
  7854. toggleObserving(false);
  7855. var props = vm._props;
  7856. var propKeys = vm.$options._propKeys || [];
  7857. for (var i = 0; i < propKeys.length; i++) {
  7858. var key = propKeys[i];
  7859. var propOptions = vm.$options.props; // wtf flow?
  7860. props[key] = validateProp(key, propOptions, propsData, vm);
  7861. }
  7862. toggleObserving(true);
  7863. // keep a copy of raw propsData
  7864. vm.$options.propsData = propsData;
  7865. }
  7866. // fixed by xxxxxx update properties(mp runtime)
  7867. vm._$updateProperties && vm._$updateProperties(vm);
  7868. // update listeners
  7869. listeners = listeners || emptyObject;
  7870. var oldListeners = vm.$options._parentListeners;
  7871. vm.$options._parentListeners = listeners;
  7872. updateComponentListeners(vm, listeners, oldListeners);
  7873. // resolve slots + force update if has children
  7874. if (needsForceUpdate) {
  7875. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7876. vm.$forceUpdate();
  7877. }
  7878. if (true) {
  7879. isUpdatingChildComponent = false;
  7880. }
  7881. }
  7882. function isInInactiveTree (vm) {
  7883. while (vm && (vm = vm.$parent)) {
  7884. if (vm._inactive) { return true }
  7885. }
  7886. return false
  7887. }
  7888. function activateChildComponent (vm, direct) {
  7889. if (direct) {
  7890. vm._directInactive = false;
  7891. if (isInInactiveTree(vm)) {
  7892. return
  7893. }
  7894. } else if (vm._directInactive) {
  7895. return
  7896. }
  7897. if (vm._inactive || vm._inactive === null) {
  7898. vm._inactive = false;
  7899. for (var i = 0; i < vm.$children.length; i++) {
  7900. activateChildComponent(vm.$children[i]);
  7901. }
  7902. callHook(vm, 'activated');
  7903. }
  7904. }
  7905. function deactivateChildComponent (vm, direct) {
  7906. if (direct) {
  7907. vm._directInactive = true;
  7908. if (isInInactiveTree(vm)) {
  7909. return
  7910. }
  7911. }
  7912. if (!vm._inactive) {
  7913. vm._inactive = true;
  7914. for (var i = 0; i < vm.$children.length; i++) {
  7915. deactivateChildComponent(vm.$children[i]);
  7916. }
  7917. callHook(vm, 'deactivated');
  7918. }
  7919. }
  7920. function callHook (vm, hook) {
  7921. // #7573 disable dep collection when invoking lifecycle hooks
  7922. pushTarget();
  7923. var handlers = vm.$options[hook];
  7924. var info = hook + " hook";
  7925. if (handlers) {
  7926. for (var i = 0, j = handlers.length; i < j; i++) {
  7927. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7928. }
  7929. }
  7930. if (vm._hasHookEvent) {
  7931. vm.$emit('hook:' + hook);
  7932. }
  7933. popTarget();
  7934. }
  7935. /* */
  7936. var MAX_UPDATE_COUNT = 100;
  7937. var queue = [];
  7938. var activatedChildren = [];
  7939. var has = {};
  7940. var circular = {};
  7941. var waiting = false;
  7942. var flushing = false;
  7943. var index = 0;
  7944. /**
  7945. * Reset the scheduler's state.
  7946. */
  7947. function resetSchedulerState () {
  7948. index = queue.length = activatedChildren.length = 0;
  7949. has = {};
  7950. if (true) {
  7951. circular = {};
  7952. }
  7953. waiting = flushing = false;
  7954. }
  7955. // Async edge case #6566 requires saving the timestamp when event listeners are
  7956. // attached. However, calling performance.now() has a perf overhead especially
  7957. // if the page has thousands of event listeners. Instead, we take a timestamp
  7958. // every time the scheduler flushes and use that for all event listeners
  7959. // attached during that flush.
  7960. var currentFlushTimestamp = 0;
  7961. // Async edge case fix requires storing an event listener's attach timestamp.
  7962. var getNow = Date.now;
  7963. // Determine what event timestamp the browser is using. Annoyingly, the
  7964. // timestamp can either be hi-res (relative to page load) or low-res
  7965. // (relative to UNIX epoch), so in order to compare time we have to use the
  7966. // same timestamp type when saving the flush timestamp.
  7967. // All IE versions use low-res event timestamps, and have problematic clock
  7968. // implementations (#9632)
  7969. if (inBrowser && !isIE) {
  7970. var performance = window.performance;
  7971. if (
  7972. performance &&
  7973. typeof performance.now === 'function' &&
  7974. getNow() > document.createEvent('Event').timeStamp
  7975. ) {
  7976. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7977. // smaller than it, it means the event is using a hi-res timestamp,
  7978. // and we need to use the hi-res version for event listener timestamps as
  7979. // well.
  7980. getNow = function () { return performance.now(); };
  7981. }
  7982. }
  7983. /**
  7984. * Flush both queues and run the watchers.
  7985. */
  7986. function flushSchedulerQueue () {
  7987. currentFlushTimestamp = getNow();
  7988. flushing = true;
  7989. var watcher, id;
  7990. // Sort queue before flush.
  7991. // This ensures that:
  7992. // 1. Components are updated from parent to child. (because parent is always
  7993. // created before the child)
  7994. // 2. A component's user watchers are run before its render watcher (because
  7995. // user watchers are created before the render watcher)
  7996. // 3. If a component is destroyed during a parent component's watcher run,
  7997. // its watchers can be skipped.
  7998. queue.sort(function (a, b) { return a.id - b.id; });
  7999. // do not cache length because more watchers might be pushed
  8000. // as we run existing watchers
  8001. for (index = 0; index < queue.length; index++) {
  8002. watcher = queue[index];
  8003. if (watcher.before) {
  8004. watcher.before();
  8005. }
  8006. id = watcher.id;
  8007. has[id] = null;
  8008. watcher.run();
  8009. // in dev build, check and stop circular updates.
  8010. if ( true && has[id] != null) {
  8011. circular[id] = (circular[id] || 0) + 1;
  8012. if (circular[id] > MAX_UPDATE_COUNT) {
  8013. warn(
  8014. 'You may have an infinite update loop ' + (
  8015. watcher.user
  8016. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  8017. : "in a component render function."
  8018. ),
  8019. watcher.vm
  8020. );
  8021. break
  8022. }
  8023. }
  8024. }
  8025. // keep copies of post queues before resetting state
  8026. var activatedQueue = activatedChildren.slice();
  8027. var updatedQueue = queue.slice();
  8028. resetSchedulerState();
  8029. // call component updated and activated hooks
  8030. callActivatedHooks(activatedQueue);
  8031. callUpdatedHooks(updatedQueue);
  8032. // devtool hook
  8033. /* istanbul ignore if */
  8034. if (devtools && config.devtools) {
  8035. devtools.emit('flush');
  8036. }
  8037. }
  8038. function callUpdatedHooks (queue) {
  8039. var i = queue.length;
  8040. while (i--) {
  8041. var watcher = queue[i];
  8042. var vm = watcher.vm;
  8043. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  8044. callHook(vm, 'updated');
  8045. }
  8046. }
  8047. }
  8048. /**
  8049. * Queue a kept-alive component that was activated during patch.
  8050. * The queue will be processed after the entire tree has been patched.
  8051. */
  8052. function queueActivatedComponent (vm) {
  8053. // setting _inactive to false here so that a render function can
  8054. // rely on checking whether it's in an inactive tree (e.g. router-view)
  8055. vm._inactive = false;
  8056. activatedChildren.push(vm);
  8057. }
  8058. function callActivatedHooks (queue) {
  8059. for (var i = 0; i < queue.length; i++) {
  8060. queue[i]._inactive = true;
  8061. activateChildComponent(queue[i], true /* true */);
  8062. }
  8063. }
  8064. /**
  8065. * Push a watcher into the watcher queue.
  8066. * Jobs with duplicate IDs will be skipped unless it's
  8067. * pushed when the queue is being flushed.
  8068. */
  8069. function queueWatcher (watcher) {
  8070. var id = watcher.id;
  8071. if (has[id] == null) {
  8072. has[id] = true;
  8073. if (!flushing) {
  8074. queue.push(watcher);
  8075. } else {
  8076. // if already flushing, splice the watcher based on its id
  8077. // if already past its id, it will be run next immediately.
  8078. var i = queue.length - 1;
  8079. while (i > index && queue[i].id > watcher.id) {
  8080. i--;
  8081. }
  8082. queue.splice(i + 1, 0, watcher);
  8083. }
  8084. // queue the flush
  8085. if (!waiting) {
  8086. waiting = true;
  8087. if ( true && !config.async) {
  8088. flushSchedulerQueue();
  8089. return
  8090. }
  8091. nextTick(flushSchedulerQueue);
  8092. }
  8093. }
  8094. }
  8095. /* */
  8096. var uid$2 = 0;
  8097. /**
  8098. * A watcher parses an expression, collects dependencies,
  8099. * and fires callback when the expression value changes.
  8100. * This is used for both the $watch() api and directives.
  8101. */
  8102. var Watcher = function Watcher (
  8103. vm,
  8104. expOrFn,
  8105. cb,
  8106. options,
  8107. isRenderWatcher
  8108. ) {
  8109. this.vm = vm;
  8110. if (isRenderWatcher) {
  8111. vm._watcher = this;
  8112. }
  8113. vm._watchers.push(this);
  8114. // options
  8115. if (options) {
  8116. this.deep = !!options.deep;
  8117. this.user = !!options.user;
  8118. this.lazy = !!options.lazy;
  8119. this.sync = !!options.sync;
  8120. this.before = options.before;
  8121. } else {
  8122. this.deep = this.user = this.lazy = this.sync = false;
  8123. }
  8124. this.cb = cb;
  8125. this.id = ++uid$2; // uid for batching
  8126. this.active = true;
  8127. this.dirty = this.lazy; // for lazy watchers
  8128. this.deps = [];
  8129. this.newDeps = [];
  8130. this.depIds = new _Set();
  8131. this.newDepIds = new _Set();
  8132. this.expression = true
  8133. ? expOrFn.toString()
  8134. : undefined;
  8135. // parse expression for getter
  8136. if (typeof expOrFn === 'function') {
  8137. this.getter = expOrFn;
  8138. } else {
  8139. this.getter = parsePath(expOrFn);
  8140. if (!this.getter) {
  8141. this.getter = noop;
  8142. true && warn(
  8143. "Failed watching path: \"" + expOrFn + "\" " +
  8144. 'Watcher only accepts simple dot-delimited paths. ' +
  8145. 'For full control, use a function instead.',
  8146. vm
  8147. );
  8148. }
  8149. }
  8150. this.value = this.lazy
  8151. ? undefined
  8152. : this.get();
  8153. };
  8154. /**
  8155. * Evaluate the getter, and re-collect dependencies.
  8156. */
  8157. Watcher.prototype.get = function get () {
  8158. pushTarget(this);
  8159. var value;
  8160. var vm = this.vm;
  8161. try {
  8162. value = this.getter.call(vm, vm);
  8163. } catch (e) {
  8164. if (this.user) {
  8165. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  8166. } else {
  8167. throw e
  8168. }
  8169. } finally {
  8170. // "touch" every property so they are all tracked as
  8171. // dependencies for deep watching
  8172. if (this.deep) {
  8173. traverse(value);
  8174. }
  8175. popTarget();
  8176. this.cleanupDeps();
  8177. }
  8178. return value
  8179. };
  8180. /**
  8181. * Add a dependency to this directive.
  8182. */
  8183. Watcher.prototype.addDep = function addDep (dep) {
  8184. var id = dep.id;
  8185. if (!this.newDepIds.has(id)) {
  8186. this.newDepIds.add(id);
  8187. this.newDeps.push(dep);
  8188. if (!this.depIds.has(id)) {
  8189. dep.addSub(this);
  8190. }
  8191. }
  8192. };
  8193. /**
  8194. * Clean up for dependency collection.
  8195. */
  8196. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8197. var i = this.deps.length;
  8198. while (i--) {
  8199. var dep = this.deps[i];
  8200. if (!this.newDepIds.has(dep.id)) {
  8201. dep.removeSub(this);
  8202. }
  8203. }
  8204. var tmp = this.depIds;
  8205. this.depIds = this.newDepIds;
  8206. this.newDepIds = tmp;
  8207. this.newDepIds.clear();
  8208. tmp = this.deps;
  8209. this.deps = this.newDeps;
  8210. this.newDeps = tmp;
  8211. this.newDeps.length = 0;
  8212. };
  8213. /**
  8214. * Subscriber interface.
  8215. * Will be called when a dependency changes.
  8216. */
  8217. Watcher.prototype.update = function update () {
  8218. /* istanbul ignore else */
  8219. if (this.lazy) {
  8220. this.dirty = true;
  8221. } else if (this.sync) {
  8222. this.run();
  8223. } else {
  8224. queueWatcher(this);
  8225. }
  8226. };
  8227. /**
  8228. * Scheduler job interface.
  8229. * Will be called by the scheduler.
  8230. */
  8231. Watcher.prototype.run = function run () {
  8232. if (this.active) {
  8233. var value = this.get();
  8234. if (
  8235. value !== this.value ||
  8236. // Deep watchers and watchers on Object/Arrays should fire even
  8237. // when the value is the same, because the value may
  8238. // have mutated.
  8239. isObject(value) ||
  8240. this.deep
  8241. ) {
  8242. // set new value
  8243. var oldValue = this.value;
  8244. this.value = value;
  8245. if (this.user) {
  8246. try {
  8247. this.cb.call(this.vm, value, oldValue);
  8248. } catch (e) {
  8249. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  8250. }
  8251. } else {
  8252. this.cb.call(this.vm, value, oldValue);
  8253. }
  8254. }
  8255. }
  8256. };
  8257. /**
  8258. * Evaluate the value of the watcher.
  8259. * This only gets called for lazy watchers.
  8260. */
  8261. Watcher.prototype.evaluate = function evaluate () {
  8262. this.value = this.get();
  8263. this.dirty = false;
  8264. };
  8265. /**
  8266. * Depend on all deps collected by this watcher.
  8267. */
  8268. Watcher.prototype.depend = function depend () {
  8269. var i = this.deps.length;
  8270. while (i--) {
  8271. this.deps[i].depend();
  8272. }
  8273. };
  8274. /**
  8275. * Remove self from all dependencies' subscriber list.
  8276. */
  8277. Watcher.prototype.teardown = function teardown () {
  8278. if (this.active) {
  8279. // remove self from vm's watcher list
  8280. // this is a somewhat expensive operation so we skip it
  8281. // if the vm is being destroyed.
  8282. if (!this.vm._isBeingDestroyed) {
  8283. remove(this.vm._watchers, this);
  8284. }
  8285. var i = this.deps.length;
  8286. while (i--) {
  8287. this.deps[i].removeSub(this);
  8288. }
  8289. this.active = false;
  8290. }
  8291. };
  8292. /* */
  8293. var sharedPropertyDefinition = {
  8294. enumerable: true,
  8295. configurable: true,
  8296. get: noop,
  8297. set: noop
  8298. };
  8299. function proxy (target, sourceKey, key) {
  8300. sharedPropertyDefinition.get = function proxyGetter () {
  8301. return this[sourceKey][key]
  8302. };
  8303. sharedPropertyDefinition.set = function proxySetter (val) {
  8304. this[sourceKey][key] = val;
  8305. };
  8306. Object.defineProperty(target, key, sharedPropertyDefinition);
  8307. }
  8308. function initState (vm) {
  8309. vm._watchers = [];
  8310. var opts = vm.$options;
  8311. if (opts.props) { initProps(vm, opts.props); }
  8312. if (opts.methods) { initMethods(vm, opts.methods); }
  8313. if (opts.data) {
  8314. initData(vm);
  8315. } else {
  8316. observe(vm._data = {}, true /* asRootData */);
  8317. }
  8318. if (opts.computed) { initComputed(vm, opts.computed); }
  8319. if (opts.watch && opts.watch !== nativeWatch) {
  8320. initWatch(vm, opts.watch);
  8321. }
  8322. }
  8323. function initProps (vm, propsOptions) {
  8324. var propsData = vm.$options.propsData || {};
  8325. var props = vm._props = {};
  8326. // cache prop keys so that future props updates can iterate using Array
  8327. // instead of dynamic object key enumeration.
  8328. var keys = vm.$options._propKeys = [];
  8329. var isRoot = !vm.$parent;
  8330. // root instance props should be converted
  8331. if (!isRoot) {
  8332. toggleObserving(false);
  8333. }
  8334. var loop = function ( key ) {
  8335. keys.push(key);
  8336. var value = validateProp(key, propsOptions, propsData, vm);
  8337. /* istanbul ignore else */
  8338. if (true) {
  8339. var hyphenatedKey = hyphenate(key);
  8340. if (isReservedAttribute(hyphenatedKey) ||
  8341. config.isReservedAttr(hyphenatedKey)) {
  8342. warn(
  8343. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  8344. vm
  8345. );
  8346. }
  8347. defineReactive$$1(props, key, value, function () {
  8348. if (!isRoot && !isUpdatingChildComponent) {
  8349. {
  8350. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  8351. return
  8352. }
  8353. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  8354. if(
  8355. key === 'value' &&
  8356. Array.isArray(vm.$options.behaviors) &&
  8357. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8358. ){
  8359. return
  8360. }
  8361. if(vm._getFormData){
  8362. return
  8363. }
  8364. var $parent = vm.$parent;
  8365. while($parent){
  8366. if($parent.__next_tick_pending){
  8367. return
  8368. }
  8369. $parent = $parent.$parent;
  8370. }
  8371. }
  8372. warn(
  8373. "Avoid mutating a prop directly since the value will be " +
  8374. "overwritten whenever the parent component re-renders. " +
  8375. "Instead, use a data or computed property based on the prop's " +
  8376. "value. Prop being mutated: \"" + key + "\"",
  8377. vm
  8378. );
  8379. }
  8380. });
  8381. } else {}
  8382. // static props are already proxied on the component's prototype
  8383. // during Vue.extend(). We only need to proxy props defined at
  8384. // instantiation here.
  8385. if (!(key in vm)) {
  8386. proxy(vm, "_props", key);
  8387. }
  8388. };
  8389. for (var key in propsOptions) loop( key );
  8390. toggleObserving(true);
  8391. }
  8392. function initData (vm) {
  8393. var data = vm.$options.data;
  8394. data = vm._data = typeof data === 'function'
  8395. ? getData(data, vm)
  8396. : data || {};
  8397. if (!isPlainObject(data)) {
  8398. data = {};
  8399. true && warn(
  8400. 'data functions should return an object:\n' +
  8401. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  8402. vm
  8403. );
  8404. }
  8405. // proxy data on instance
  8406. var keys = Object.keys(data);
  8407. var props = vm.$options.props;
  8408. var methods = vm.$options.methods;
  8409. var i = keys.length;
  8410. while (i--) {
  8411. var key = keys[i];
  8412. if (true) {
  8413. if (methods && hasOwn(methods, key)) {
  8414. warn(
  8415. ("Method \"" + key + "\" has already been defined as a data property."),
  8416. vm
  8417. );
  8418. }
  8419. }
  8420. if (props && hasOwn(props, key)) {
  8421. true && warn(
  8422. "The data property \"" + key + "\" is already declared as a prop. " +
  8423. "Use prop default value instead.",
  8424. vm
  8425. );
  8426. } else if (!isReserved(key)) {
  8427. proxy(vm, "_data", key);
  8428. }
  8429. }
  8430. // observe data
  8431. observe(data, true /* asRootData */);
  8432. }
  8433. function getData (data, vm) {
  8434. // #7573 disable dep collection when invoking data getters
  8435. pushTarget();
  8436. try {
  8437. return data.call(vm, vm)
  8438. } catch (e) {
  8439. handleError(e, vm, "data()");
  8440. return {}
  8441. } finally {
  8442. popTarget();
  8443. }
  8444. }
  8445. var computedWatcherOptions = { lazy: true };
  8446. function initComputed (vm, computed) {
  8447. // $flow-disable-line
  8448. var watchers = vm._computedWatchers = Object.create(null);
  8449. // computed properties are just getters during SSR
  8450. var isSSR = isServerRendering();
  8451. for (var key in computed) {
  8452. var userDef = computed[key];
  8453. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  8454. if ( true && getter == null) {
  8455. warn(
  8456. ("Getter is missing for computed property \"" + key + "\"."),
  8457. vm
  8458. );
  8459. }
  8460. if (!isSSR) {
  8461. // create internal watcher for the computed property.
  8462. watchers[key] = new Watcher(
  8463. vm,
  8464. getter || noop,
  8465. noop,
  8466. computedWatcherOptions
  8467. );
  8468. }
  8469. // component-defined computed properties are already defined on the
  8470. // component prototype. We only need to define computed properties defined
  8471. // at instantiation here.
  8472. if (!(key in vm)) {
  8473. defineComputed(vm, key, userDef);
  8474. } else if (true) {
  8475. if (key in vm.$data) {
  8476. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  8477. } else if (vm.$options.props && key in vm.$options.props) {
  8478. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  8479. }
  8480. }
  8481. }
  8482. }
  8483. function defineComputed (
  8484. target,
  8485. key,
  8486. userDef
  8487. ) {
  8488. var shouldCache = !isServerRendering();
  8489. if (typeof userDef === 'function') {
  8490. sharedPropertyDefinition.get = shouldCache
  8491. ? createComputedGetter(key)
  8492. : createGetterInvoker(userDef);
  8493. sharedPropertyDefinition.set = noop;
  8494. } else {
  8495. sharedPropertyDefinition.get = userDef.get
  8496. ? shouldCache && userDef.cache !== false
  8497. ? createComputedGetter(key)
  8498. : createGetterInvoker(userDef.get)
  8499. : noop;
  8500. sharedPropertyDefinition.set = userDef.set || noop;
  8501. }
  8502. if ( true &&
  8503. sharedPropertyDefinition.set === noop) {
  8504. sharedPropertyDefinition.set = function () {
  8505. warn(
  8506. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  8507. this
  8508. );
  8509. };
  8510. }
  8511. Object.defineProperty(target, key, sharedPropertyDefinition);
  8512. }
  8513. function createComputedGetter (key) {
  8514. return function computedGetter () {
  8515. var watcher = this._computedWatchers && this._computedWatchers[key];
  8516. if (watcher) {
  8517. if (watcher.dirty) {
  8518. watcher.evaluate();
  8519. }
  8520. if (Dep.SharedObject.target) {// fixed by xxxxxx
  8521. watcher.depend();
  8522. }
  8523. return watcher.value
  8524. }
  8525. }
  8526. }
  8527. function createGetterInvoker(fn) {
  8528. return function computedGetter () {
  8529. return fn.call(this, this)
  8530. }
  8531. }
  8532. function initMethods (vm, methods) {
  8533. var props = vm.$options.props;
  8534. for (var key in methods) {
  8535. if (true) {
  8536. if (typeof methods[key] !== 'function') {
  8537. warn(
  8538. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  8539. "Did you reference the function correctly?",
  8540. vm
  8541. );
  8542. }
  8543. if (props && hasOwn(props, key)) {
  8544. warn(
  8545. ("Method \"" + key + "\" has already been defined as a prop."),
  8546. vm
  8547. );
  8548. }
  8549. if ((key in vm) && isReserved(key)) {
  8550. warn(
  8551. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  8552. "Avoid defining component methods that start with _ or $."
  8553. );
  8554. }
  8555. }
  8556. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  8557. }
  8558. }
  8559. function initWatch (vm, watch) {
  8560. for (var key in watch) {
  8561. var handler = watch[key];
  8562. if (Array.isArray(handler)) {
  8563. for (var i = 0; i < handler.length; i++) {
  8564. createWatcher(vm, key, handler[i]);
  8565. }
  8566. } else {
  8567. createWatcher(vm, key, handler);
  8568. }
  8569. }
  8570. }
  8571. function createWatcher (
  8572. vm,
  8573. expOrFn,
  8574. handler,
  8575. options
  8576. ) {
  8577. if (isPlainObject(handler)) {
  8578. options = handler;
  8579. handler = handler.handler;
  8580. }
  8581. if (typeof handler === 'string') {
  8582. handler = vm[handler];
  8583. }
  8584. return vm.$watch(expOrFn, handler, options)
  8585. }
  8586. function stateMixin (Vue) {
  8587. // flow somehow has problems with directly declared definition object
  8588. // when using Object.defineProperty, so we have to procedurally build up
  8589. // the object here.
  8590. var dataDef = {};
  8591. dataDef.get = function () { return this._data };
  8592. var propsDef = {};
  8593. propsDef.get = function () { return this._props };
  8594. if (true) {
  8595. dataDef.set = function () {
  8596. warn(
  8597. 'Avoid replacing instance root $data. ' +
  8598. 'Use nested data properties instead.',
  8599. this
  8600. );
  8601. };
  8602. propsDef.set = function () {
  8603. warn("$props is readonly.", this);
  8604. };
  8605. }
  8606. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8607. Object.defineProperty(Vue.prototype, '$props', propsDef);
  8608. Vue.prototype.$set = set;
  8609. Vue.prototype.$delete = del;
  8610. Vue.prototype.$watch = function (
  8611. expOrFn,
  8612. cb,
  8613. options
  8614. ) {
  8615. var vm = this;
  8616. if (isPlainObject(cb)) {
  8617. return createWatcher(vm, expOrFn, cb, options)
  8618. }
  8619. options = options || {};
  8620. options.user = true;
  8621. var watcher = new Watcher(vm, expOrFn, cb, options);
  8622. if (options.immediate) {
  8623. try {
  8624. cb.call(vm, watcher.value);
  8625. } catch (error) {
  8626. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  8627. }
  8628. }
  8629. return function unwatchFn () {
  8630. watcher.teardown();
  8631. }
  8632. };
  8633. }
  8634. /* */
  8635. var uid$3 = 0;
  8636. function initMixin (Vue) {
  8637. Vue.prototype._init = function (options) {
  8638. var vm = this;
  8639. // a uid
  8640. vm._uid = uid$3++;
  8641. var startTag, endTag;
  8642. /* istanbul ignore if */
  8643. if ( true && config.performance && mark) {
  8644. startTag = "vue-perf-start:" + (vm._uid);
  8645. endTag = "vue-perf-end:" + (vm._uid);
  8646. mark(startTag);
  8647. }
  8648. // a flag to avoid this being observed
  8649. vm._isVue = true;
  8650. // merge options
  8651. if (options && options._isComponent) {
  8652. // optimize internal component instantiation
  8653. // since dynamic options merging is pretty slow, and none of the
  8654. // internal component options needs special treatment.
  8655. initInternalComponent(vm, options);
  8656. } else {
  8657. vm.$options = mergeOptions(
  8658. resolveConstructorOptions(vm.constructor),
  8659. options || {},
  8660. vm
  8661. );
  8662. }
  8663. /* istanbul ignore else */
  8664. if (true) {
  8665. initProxy(vm);
  8666. } else {}
  8667. // expose real self
  8668. vm._self = vm;
  8669. initLifecycle(vm);
  8670. initEvents(vm);
  8671. initRender(vm);
  8672. callHook(vm, 'beforeCreate');
  8673. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  8674. initState(vm);
  8675. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  8676. !vm._$fallback && callHook(vm, 'created');
  8677. /* istanbul ignore if */
  8678. if ( true && config.performance && mark) {
  8679. vm._name = formatComponentName(vm, false);
  8680. mark(endTag);
  8681. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  8682. }
  8683. if (vm.$options.el) {
  8684. vm.$mount(vm.$options.el);
  8685. }
  8686. };
  8687. }
  8688. function initInternalComponent (vm, options) {
  8689. var opts = vm.$options = Object.create(vm.constructor.options);
  8690. // doing this because it's faster than dynamic enumeration.
  8691. var parentVnode = options._parentVnode;
  8692. opts.parent = options.parent;
  8693. opts._parentVnode = parentVnode;
  8694. var vnodeComponentOptions = parentVnode.componentOptions;
  8695. opts.propsData = vnodeComponentOptions.propsData;
  8696. opts._parentListeners = vnodeComponentOptions.listeners;
  8697. opts._renderChildren = vnodeComponentOptions.children;
  8698. opts._componentTag = vnodeComponentOptions.tag;
  8699. if (options.render) {
  8700. opts.render = options.render;
  8701. opts.staticRenderFns = options.staticRenderFns;
  8702. }
  8703. }
  8704. function resolveConstructorOptions (Ctor) {
  8705. var options = Ctor.options;
  8706. if (Ctor.super) {
  8707. var superOptions = resolveConstructorOptions(Ctor.super);
  8708. var cachedSuperOptions = Ctor.superOptions;
  8709. if (superOptions !== cachedSuperOptions) {
  8710. // super option changed,
  8711. // need to resolve new options.
  8712. Ctor.superOptions = superOptions;
  8713. // check if there are any late-modified/attached options (#4976)
  8714. var modifiedOptions = resolveModifiedOptions(Ctor);
  8715. // update base extend options
  8716. if (modifiedOptions) {
  8717. extend(Ctor.extendOptions, modifiedOptions);
  8718. }
  8719. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  8720. if (options.name) {
  8721. options.components[options.name] = Ctor;
  8722. }
  8723. }
  8724. }
  8725. return options
  8726. }
  8727. function resolveModifiedOptions (Ctor) {
  8728. var modified;
  8729. var latest = Ctor.options;
  8730. var sealed = Ctor.sealedOptions;
  8731. for (var key in latest) {
  8732. if (latest[key] !== sealed[key]) {
  8733. if (!modified) { modified = {}; }
  8734. modified[key] = latest[key];
  8735. }
  8736. }
  8737. return modified
  8738. }
  8739. function Vue (options) {
  8740. if ( true &&
  8741. !(this instanceof Vue)
  8742. ) {
  8743. warn('Vue is a constructor and should be called with the `new` keyword');
  8744. }
  8745. this._init(options);
  8746. }
  8747. initMixin(Vue);
  8748. stateMixin(Vue);
  8749. eventsMixin(Vue);
  8750. lifecycleMixin(Vue);
  8751. renderMixin(Vue);
  8752. /* */
  8753. function initUse (Vue) {
  8754. Vue.use = function (plugin) {
  8755. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  8756. if (installedPlugins.indexOf(plugin) > -1) {
  8757. return this
  8758. }
  8759. // additional parameters
  8760. var args = toArray(arguments, 1);
  8761. args.unshift(this);
  8762. if (typeof plugin.install === 'function') {
  8763. plugin.install.apply(plugin, args);
  8764. } else if (typeof plugin === 'function') {
  8765. plugin.apply(null, args);
  8766. }
  8767. installedPlugins.push(plugin);
  8768. return this
  8769. };
  8770. }
  8771. /* */
  8772. function initMixin$1 (Vue) {
  8773. Vue.mixin = function (mixin) {
  8774. this.options = mergeOptions(this.options, mixin);
  8775. return this
  8776. };
  8777. }
  8778. /* */
  8779. function initExtend (Vue) {
  8780. /**
  8781. * Each instance constructor, including Vue, has a unique
  8782. * cid. This enables us to create wrapped "child
  8783. * constructors" for prototypal inheritance and cache them.
  8784. */
  8785. Vue.cid = 0;
  8786. var cid = 1;
  8787. /**
  8788. * Class inheritance
  8789. */
  8790. Vue.extend = function (extendOptions) {
  8791. extendOptions = extendOptions || {};
  8792. var Super = this;
  8793. var SuperId = Super.cid;
  8794. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  8795. if (cachedCtors[SuperId]) {
  8796. return cachedCtors[SuperId]
  8797. }
  8798. var name = extendOptions.name || Super.options.name;
  8799. if ( true && name) {
  8800. validateComponentName(name);
  8801. }
  8802. var Sub = function VueComponent (options) {
  8803. this._init(options);
  8804. };
  8805. Sub.prototype = Object.create(Super.prototype);
  8806. Sub.prototype.constructor = Sub;
  8807. Sub.cid = cid++;
  8808. Sub.options = mergeOptions(
  8809. Super.options,
  8810. extendOptions
  8811. );
  8812. Sub['super'] = Super;
  8813. // For props and computed properties, we define the proxy getters on
  8814. // the Vue instances at extension time, on the extended prototype. This
  8815. // avoids Object.defineProperty calls for each instance created.
  8816. if (Sub.options.props) {
  8817. initProps$1(Sub);
  8818. }
  8819. if (Sub.options.computed) {
  8820. initComputed$1(Sub);
  8821. }
  8822. // allow further extension/mixin/plugin usage
  8823. Sub.extend = Super.extend;
  8824. Sub.mixin = Super.mixin;
  8825. Sub.use = Super.use;
  8826. // create asset registers, so extended classes
  8827. // can have their private assets too.
  8828. ASSET_TYPES.forEach(function (type) {
  8829. Sub[type] = Super[type];
  8830. });
  8831. // enable recursive self-lookup
  8832. if (name) {
  8833. Sub.options.components[name] = Sub;
  8834. }
  8835. // keep a reference to the super options at extension time.
  8836. // later at instantiation we can check if Super's options have
  8837. // been updated.
  8838. Sub.superOptions = Super.options;
  8839. Sub.extendOptions = extendOptions;
  8840. Sub.sealedOptions = extend({}, Sub.options);
  8841. // cache constructor
  8842. cachedCtors[SuperId] = Sub;
  8843. return Sub
  8844. };
  8845. }
  8846. function initProps$1 (Comp) {
  8847. var props = Comp.options.props;
  8848. for (var key in props) {
  8849. proxy(Comp.prototype, "_props", key);
  8850. }
  8851. }
  8852. function initComputed$1 (Comp) {
  8853. var computed = Comp.options.computed;
  8854. for (var key in computed) {
  8855. defineComputed(Comp.prototype, key, computed[key]);
  8856. }
  8857. }
  8858. /* */
  8859. function initAssetRegisters (Vue) {
  8860. /**
  8861. * Create asset registration methods.
  8862. */
  8863. ASSET_TYPES.forEach(function (type) {
  8864. Vue[type] = function (
  8865. id,
  8866. definition
  8867. ) {
  8868. if (!definition) {
  8869. return this.options[type + 's'][id]
  8870. } else {
  8871. /* istanbul ignore if */
  8872. if ( true && type === 'component') {
  8873. validateComponentName(id);
  8874. }
  8875. if (type === 'component' && isPlainObject(definition)) {
  8876. definition.name = definition.name || id;
  8877. definition = this.options._base.extend(definition);
  8878. }
  8879. if (type === 'directive' && typeof definition === 'function') {
  8880. definition = { bind: definition, update: definition };
  8881. }
  8882. this.options[type + 's'][id] = definition;
  8883. return definition
  8884. }
  8885. };
  8886. });
  8887. }
  8888. /* */
  8889. function getComponentName (opts) {
  8890. return opts && (opts.Ctor.options.name || opts.tag)
  8891. }
  8892. function matches (pattern, name) {
  8893. if (Array.isArray(pattern)) {
  8894. return pattern.indexOf(name) > -1
  8895. } else if (typeof pattern === 'string') {
  8896. return pattern.split(',').indexOf(name) > -1
  8897. } else if (isRegExp(pattern)) {
  8898. return pattern.test(name)
  8899. }
  8900. /* istanbul ignore next */
  8901. return false
  8902. }
  8903. function pruneCache (keepAliveInstance, filter) {
  8904. var cache = keepAliveInstance.cache;
  8905. var keys = keepAliveInstance.keys;
  8906. var _vnode = keepAliveInstance._vnode;
  8907. for (var key in cache) {
  8908. var cachedNode = cache[key];
  8909. if (cachedNode) {
  8910. var name = getComponentName(cachedNode.componentOptions);
  8911. if (name && !filter(name)) {
  8912. pruneCacheEntry(cache, key, keys, _vnode);
  8913. }
  8914. }
  8915. }
  8916. }
  8917. function pruneCacheEntry (
  8918. cache,
  8919. key,
  8920. keys,
  8921. current
  8922. ) {
  8923. var cached$$1 = cache[key];
  8924. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8925. cached$$1.componentInstance.$destroy();
  8926. }
  8927. cache[key] = null;
  8928. remove(keys, key);
  8929. }
  8930. var patternTypes = [String, RegExp, Array];
  8931. var KeepAlive = {
  8932. name: 'keep-alive',
  8933. abstract: true,
  8934. props: {
  8935. include: patternTypes,
  8936. exclude: patternTypes,
  8937. max: [String, Number]
  8938. },
  8939. created: function created () {
  8940. this.cache = Object.create(null);
  8941. this.keys = [];
  8942. },
  8943. destroyed: function destroyed () {
  8944. for (var key in this.cache) {
  8945. pruneCacheEntry(this.cache, key, this.keys);
  8946. }
  8947. },
  8948. mounted: function mounted () {
  8949. var this$1 = this;
  8950. this.$watch('include', function (val) {
  8951. pruneCache(this$1, function (name) { return matches(val, name); });
  8952. });
  8953. this.$watch('exclude', function (val) {
  8954. pruneCache(this$1, function (name) { return !matches(val, name); });
  8955. });
  8956. },
  8957. render: function render () {
  8958. var slot = this.$slots.default;
  8959. var vnode = getFirstComponentChild(slot);
  8960. var componentOptions = vnode && vnode.componentOptions;
  8961. if (componentOptions) {
  8962. // check pattern
  8963. var name = getComponentName(componentOptions);
  8964. var ref = this;
  8965. var include = ref.include;
  8966. var exclude = ref.exclude;
  8967. if (
  8968. // not included
  8969. (include && (!name || !matches(include, name))) ||
  8970. // excluded
  8971. (exclude && name && matches(exclude, name))
  8972. ) {
  8973. return vnode
  8974. }
  8975. var ref$1 = this;
  8976. var cache = ref$1.cache;
  8977. var keys = ref$1.keys;
  8978. var key = vnode.key == null
  8979. // same constructor may get registered as different local components
  8980. // so cid alone is not enough (#3269)
  8981. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8982. : vnode.key;
  8983. if (cache[key]) {
  8984. vnode.componentInstance = cache[key].componentInstance;
  8985. // make current key freshest
  8986. remove(keys, key);
  8987. keys.push(key);
  8988. } else {
  8989. cache[key] = vnode;
  8990. keys.push(key);
  8991. // prune oldest entry
  8992. if (this.max && keys.length > parseInt(this.max)) {
  8993. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8994. }
  8995. }
  8996. vnode.data.keepAlive = true;
  8997. }
  8998. return vnode || (slot && slot[0])
  8999. }
  9000. };
  9001. var builtInComponents = {
  9002. KeepAlive: KeepAlive
  9003. };
  9004. /* */
  9005. function initGlobalAPI (Vue) {
  9006. // config
  9007. var configDef = {};
  9008. configDef.get = function () { return config; };
  9009. if (true) {
  9010. configDef.set = function () {
  9011. warn(
  9012. 'Do not replace the Vue.config object, set individual fields instead.'
  9013. );
  9014. };
  9015. }
  9016. Object.defineProperty(Vue, 'config', configDef);
  9017. // exposed util methods.
  9018. // NOTE: these are not considered part of the public API - avoid relying on
  9019. // them unless you are aware of the risk.
  9020. Vue.util = {
  9021. warn: warn,
  9022. extend: extend,
  9023. mergeOptions: mergeOptions,
  9024. defineReactive: defineReactive$$1
  9025. };
  9026. Vue.set = set;
  9027. Vue.delete = del;
  9028. Vue.nextTick = nextTick;
  9029. // 2.6 explicit observable API
  9030. Vue.observable = function (obj) {
  9031. observe(obj);
  9032. return obj
  9033. };
  9034. Vue.options = Object.create(null);
  9035. ASSET_TYPES.forEach(function (type) {
  9036. Vue.options[type + 's'] = Object.create(null);
  9037. });
  9038. // this is used to identify the "base" constructor to extend all plain-object
  9039. // components with in Weex's multi-instance scenarios.
  9040. Vue.options._base = Vue;
  9041. extend(Vue.options.components, builtInComponents);
  9042. initUse(Vue);
  9043. initMixin$1(Vue);
  9044. initExtend(Vue);
  9045. initAssetRegisters(Vue);
  9046. }
  9047. initGlobalAPI(Vue);
  9048. Object.defineProperty(Vue.prototype, '$isServer', {
  9049. get: isServerRendering
  9050. });
  9051. Object.defineProperty(Vue.prototype, '$ssrContext', {
  9052. get: function get () {
  9053. /* istanbul ignore next */
  9054. return this.$vnode && this.$vnode.ssrContext
  9055. }
  9056. });
  9057. // expose FunctionalRenderContext for ssr runtime helper installation
  9058. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  9059. value: FunctionalRenderContext
  9060. });
  9061. Vue.version = '2.6.11';
  9062. /**
  9063. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  9064. */
  9065. var ARRAYTYPE = '[object Array]';
  9066. var OBJECTTYPE = '[object Object]';
  9067. var NULLTYPE = '[object Null]';
  9068. var UNDEFINEDTYPE = '[object Undefined]';
  9069. // const FUNCTIONTYPE = '[object Function]'
  9070. function diff(current, pre) {
  9071. var result = {};
  9072. syncKeys(current, pre);
  9073. _diff(current, pre, '', result);
  9074. return result
  9075. }
  9076. function syncKeys(current, pre) {
  9077. if (current === pre) { return }
  9078. var rootCurrentType = type(current);
  9079. var rootPreType = type(pre);
  9080. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  9081. if(Object.keys(current).length >= Object.keys(pre).length){
  9082. for (var key in pre) {
  9083. var currentValue = current[key];
  9084. if (currentValue === undefined) {
  9085. current[key] = null;
  9086. } else {
  9087. syncKeys(currentValue, pre[key]);
  9088. }
  9089. }
  9090. }
  9091. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  9092. if (current.length >= pre.length) {
  9093. pre.forEach(function (item, index) {
  9094. syncKeys(current[index], item);
  9095. });
  9096. }
  9097. }
  9098. }
  9099. function nullOrUndefined(currentType, preType) {
  9100. if(
  9101. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  9102. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  9103. ) {
  9104. return false
  9105. }
  9106. return true
  9107. }
  9108. function _diff(current, pre, path, result) {
  9109. if (current === pre) { return }
  9110. var rootCurrentType = type(current);
  9111. var rootPreType = type(pre);
  9112. if (rootCurrentType == OBJECTTYPE) {
  9113. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  9114. setResult(result, path, current);
  9115. } else {
  9116. var loop = function ( key ) {
  9117. var currentValue = current[key];
  9118. var preValue = pre[key];
  9119. var currentType = type(currentValue);
  9120. var preType = type(preValue);
  9121. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  9122. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  9123. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9124. }
  9125. } else if (currentType == ARRAYTYPE) {
  9126. if (preType != ARRAYTYPE) {
  9127. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9128. } else {
  9129. if (currentValue.length < preValue.length) {
  9130. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9131. } else {
  9132. currentValue.forEach(function (item, index) {
  9133. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  9134. });
  9135. }
  9136. }
  9137. } else if (currentType == OBJECTTYPE) {
  9138. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  9139. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9140. } else {
  9141. for (var subKey in currentValue) {
  9142. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  9143. }
  9144. }
  9145. }
  9146. };
  9147. for (var key in current) loop( key );
  9148. }
  9149. } else if (rootCurrentType == ARRAYTYPE) {
  9150. if (rootPreType != ARRAYTYPE) {
  9151. setResult(result, path, current);
  9152. } else {
  9153. if (current.length < pre.length) {
  9154. setResult(result, path, current);
  9155. } else {
  9156. current.forEach(function (item, index) {
  9157. _diff(item, pre[index], path + '[' + index + ']', result);
  9158. });
  9159. }
  9160. }
  9161. } else {
  9162. setResult(result, path, current);
  9163. }
  9164. }
  9165. function setResult(result, k, v) {
  9166. // if (type(v) != FUNCTIONTYPE) {
  9167. result[k] = v;
  9168. // }
  9169. }
  9170. function type(obj) {
  9171. return Object.prototype.toString.call(obj)
  9172. }
  9173. /* */
  9174. function flushCallbacks$1(vm) {
  9175. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  9176. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9177. var mpInstance = vm.$scope;
  9178. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9179. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  9180. }
  9181. var copies = vm.__next_tick_callbacks.slice(0);
  9182. vm.__next_tick_callbacks.length = 0;
  9183. for (var i = 0; i < copies.length; i++) {
  9184. copies[i]();
  9185. }
  9186. }
  9187. }
  9188. function hasRenderWatcher(vm) {
  9189. return queue.find(function (watcher) { return vm._watcher === watcher; })
  9190. }
  9191. function nextTick$1(vm, cb) {
  9192. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  9193. //2.nextTick 之前存在 render watcher
  9194. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  9195. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  9196. var mpInstance = vm.$scope;
  9197. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9198. ']:nextVueTick');
  9199. }
  9200. return nextTick(cb, vm)
  9201. }else{
  9202. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  9203. var mpInstance$1 = vm.$scope;
  9204. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  9205. ']:nextMPTick');
  9206. }
  9207. }
  9208. var _resolve;
  9209. if (!vm.__next_tick_callbacks) {
  9210. vm.__next_tick_callbacks = [];
  9211. }
  9212. vm.__next_tick_callbacks.push(function () {
  9213. if (cb) {
  9214. try {
  9215. cb.call(vm);
  9216. } catch (e) {
  9217. handleError(e, vm, 'nextTick');
  9218. }
  9219. } else if (_resolve) {
  9220. _resolve(vm);
  9221. }
  9222. });
  9223. // $flow-disable-line
  9224. if (!cb && typeof Promise !== 'undefined') {
  9225. return new Promise(function (resolve) {
  9226. _resolve = resolve;
  9227. })
  9228. }
  9229. }
  9230. /* */
  9231. function clearInstance(key, value) {
  9232. // 简易去除 Vue 和小程序组件实例
  9233. if (value) {
  9234. if (value._isVue || value.__v_isMPComponent) {
  9235. return {}
  9236. }
  9237. }
  9238. return value
  9239. }
  9240. function cloneWithData(vm) {
  9241. // 确保当前 vm 所有数据被同步
  9242. var ret = Object.create(null);
  9243. var dataKeys = [].concat(
  9244. Object.keys(vm._data || {}),
  9245. Object.keys(vm._computedWatchers || {}));
  9246. dataKeys.reduce(function(ret, key) {
  9247. ret[key] = vm[key];
  9248. return ret
  9249. }, ret);
  9250. // vue-composition-api
  9251. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  9252. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  9253. if (rawBindings) {
  9254. Object.keys(rawBindings).forEach(function (key) {
  9255. ret[key] = vm[key];
  9256. });
  9257. }
  9258. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  9259. Object.assign(ret, vm.$mp.data || {});
  9260. if (
  9261. Array.isArray(vm.$options.behaviors) &&
  9262. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  9263. ) { //form-field
  9264. ret['name'] = vm.name;
  9265. ret['value'] = vm.value;
  9266. }
  9267. return JSON.parse(JSON.stringify(ret, clearInstance))
  9268. }
  9269. var patch = function(oldVnode, vnode) {
  9270. var this$1 = this;
  9271. if (vnode === null) { //destroy
  9272. return
  9273. }
  9274. if (this.mpType === 'page' || this.mpType === 'component') {
  9275. var mpInstance = this.$scope;
  9276. var data = Object.create(null);
  9277. try {
  9278. data = cloneWithData(this);
  9279. } catch (err) {
  9280. console.error(err);
  9281. }
  9282. data.__webviewId__ = mpInstance.data.__webviewId__;
  9283. var mpData = Object.create(null);
  9284. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  9285. mpData[key] = mpInstance.data[key];
  9286. });
  9287. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  9288. if (Object.keys(diffData).length) {
  9289. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9290. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  9291. ']差量更新',
  9292. JSON.stringify(diffData));
  9293. }
  9294. this.__next_tick_pending = true;
  9295. mpInstance.setData(diffData, function () {
  9296. this$1.__next_tick_pending = false;
  9297. flushCallbacks$1(this$1);
  9298. });
  9299. } else {
  9300. flushCallbacks$1(this);
  9301. }
  9302. }
  9303. };
  9304. /* */
  9305. function createEmptyRender() {
  9306. }
  9307. function mountComponent$1(
  9308. vm,
  9309. el,
  9310. hydrating
  9311. ) {
  9312. if (!vm.mpType) {//main.js 中的 new Vue
  9313. return vm
  9314. }
  9315. if (vm.mpType === 'app') {
  9316. vm.$options.render = createEmptyRender;
  9317. }
  9318. if (!vm.$options.render) {
  9319. vm.$options.render = createEmptyRender;
  9320. if (true) {
  9321. /* istanbul ignore if */
  9322. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  9323. vm.$options.el || el) {
  9324. warn(
  9325. 'You are using the runtime-only build of Vue where the template ' +
  9326. 'compiler is not available. Either pre-compile the templates into ' +
  9327. 'render functions, or use the compiler-included build.',
  9328. vm
  9329. );
  9330. } else {
  9331. warn(
  9332. 'Failed to mount component: template or render function not defined.',
  9333. vm
  9334. );
  9335. }
  9336. }
  9337. }
  9338. !vm._$fallback && callHook(vm, 'beforeMount');
  9339. var updateComponent = function () {
  9340. vm._update(vm._render(), hydrating);
  9341. };
  9342. // we set this to vm._watcher inside the watcher's constructor
  9343. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  9344. // component's mounted hook), which relies on vm._watcher being already defined
  9345. new Watcher(vm, updateComponent, noop, {
  9346. before: function before() {
  9347. if (vm._isMounted && !vm._isDestroyed) {
  9348. callHook(vm, 'beforeUpdate');
  9349. }
  9350. }
  9351. }, true /* isRenderWatcher */);
  9352. hydrating = false;
  9353. return vm
  9354. }
  9355. /* */
  9356. function renderClass (
  9357. staticClass,
  9358. dynamicClass
  9359. ) {
  9360. if (isDef(staticClass) || isDef(dynamicClass)) {
  9361. return concat(staticClass, stringifyClass(dynamicClass))
  9362. }
  9363. /* istanbul ignore next */
  9364. return ''
  9365. }
  9366. function concat (a, b) {
  9367. return a ? b ? (a + ' ' + b) : a : (b || '')
  9368. }
  9369. function stringifyClass (value) {
  9370. if (Array.isArray(value)) {
  9371. return stringifyArray(value)
  9372. }
  9373. if (isObject(value)) {
  9374. return stringifyObject(value)
  9375. }
  9376. if (typeof value === 'string') {
  9377. return value
  9378. }
  9379. /* istanbul ignore next */
  9380. return ''
  9381. }
  9382. function stringifyArray (value) {
  9383. var res = '';
  9384. var stringified;
  9385. for (var i = 0, l = value.length; i < l; i++) {
  9386. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  9387. if (res) { res += ' '; }
  9388. res += stringified;
  9389. }
  9390. }
  9391. return res
  9392. }
  9393. function stringifyObject (value) {
  9394. var res = '';
  9395. for (var key in value) {
  9396. if (value[key]) {
  9397. if (res) { res += ' '; }
  9398. res += key;
  9399. }
  9400. }
  9401. return res
  9402. }
  9403. /* */
  9404. var parseStyleText = cached(function (cssText) {
  9405. var res = {};
  9406. var listDelimiter = /;(?![^(]*\))/g;
  9407. var propertyDelimiter = /:(.+)/;
  9408. cssText.split(listDelimiter).forEach(function (item) {
  9409. if (item) {
  9410. var tmp = item.split(propertyDelimiter);
  9411. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  9412. }
  9413. });
  9414. return res
  9415. });
  9416. // normalize possible array / string values into Object
  9417. function normalizeStyleBinding (bindingStyle) {
  9418. if (Array.isArray(bindingStyle)) {
  9419. return toObject(bindingStyle)
  9420. }
  9421. if (typeof bindingStyle === 'string') {
  9422. return parseStyleText(bindingStyle)
  9423. }
  9424. return bindingStyle
  9425. }
  9426. /* */
  9427. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  9428. function getTarget(obj, path) {
  9429. var parts = path.split('.');
  9430. var key = parts[0];
  9431. if (key.indexOf('__$n') === 0) { //number index
  9432. key = parseInt(key.replace('__$n', ''));
  9433. }
  9434. if (parts.length === 1) {
  9435. return obj[key]
  9436. }
  9437. return getTarget(obj[key], parts.slice(1).join('.'))
  9438. }
  9439. function internalMixin(Vue) {
  9440. Vue.config.errorHandler = function(err, vm, info) {
  9441. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9442. console.error(err);
  9443. /* eslint-disable no-undef */
  9444. var app = typeof getApp === 'function' && getApp();
  9445. if (app && app.onError) {
  9446. app.onError(err);
  9447. }
  9448. };
  9449. var oldEmit = Vue.prototype.$emit;
  9450. Vue.prototype.$emit = function(event) {
  9451. if (this.$scope && event) {
  9452. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  9453. if (triggerEvent) {
  9454. try {
  9455. triggerEvent.call(this.$scope, event, {
  9456. __args__: toArray(arguments, 1)
  9457. });
  9458. } catch (error) {
  9459. }
  9460. }
  9461. }
  9462. return oldEmit.apply(this, arguments)
  9463. };
  9464. Vue.prototype.$nextTick = function(fn) {
  9465. return nextTick$1(this, fn)
  9466. };
  9467. MP_METHODS.forEach(function (method) {
  9468. Vue.prototype[method] = function(args) {
  9469. if (this.$scope && this.$scope[method]) {
  9470. return this.$scope[method](args)
  9471. }
  9472. // mp-alipay
  9473. if (typeof my === 'undefined') {
  9474. return
  9475. }
  9476. if (method === 'createSelectorQuery') {
  9477. /* eslint-disable no-undef */
  9478. return my.createSelectorQuery(args)
  9479. } else if (method === 'createIntersectionObserver') {
  9480. /* eslint-disable no-undef */
  9481. return my.createIntersectionObserver(args)
  9482. }
  9483. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  9484. };
  9485. });
  9486. Vue.prototype.__init_provide = initProvide;
  9487. Vue.prototype.__init_injections = initInjections;
  9488. Vue.prototype.__call_hook = function(hook, args) {
  9489. var vm = this;
  9490. // #7573 disable dep collection when invoking lifecycle hooks
  9491. pushTarget();
  9492. var handlers = vm.$options[hook];
  9493. var info = hook + " hook";
  9494. var ret;
  9495. if (handlers) {
  9496. for (var i = 0, j = handlers.length; i < j; i++) {
  9497. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  9498. }
  9499. }
  9500. if (vm._hasHookEvent) {
  9501. vm.$emit('hook:' + hook, args);
  9502. }
  9503. popTarget();
  9504. return ret
  9505. };
  9506. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  9507. if (Array.isArray(modifiers)) {
  9508. if (modifiers.indexOf('trim') !== -1) {
  9509. value = value.trim();
  9510. }
  9511. if (modifiers.indexOf('number') !== -1) {
  9512. value = this._n(value);
  9513. }
  9514. }
  9515. if (!target) {
  9516. target = this;
  9517. }
  9518. // 解决动态属性添加
  9519. Vue.set(target, key, value);
  9520. };
  9521. Vue.prototype.__set_sync = function(target, key, value) {
  9522. if (!target) {
  9523. target = this;
  9524. }
  9525. // 解决动态属性添加
  9526. Vue.set(target, key, value);
  9527. };
  9528. Vue.prototype.__get_orig = function(item) {
  9529. if (isPlainObject(item)) {
  9530. return item['$orig'] || item
  9531. }
  9532. return item
  9533. };
  9534. Vue.prototype.__get_value = function(dataPath, target) {
  9535. return getTarget(target || this, dataPath)
  9536. };
  9537. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  9538. return renderClass(staticClass, dynamicClass)
  9539. };
  9540. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  9541. if (!dynamicStyle && !staticStyle) {
  9542. return ''
  9543. }
  9544. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  9545. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  9546. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  9547. };
  9548. Vue.prototype.__map = function(val, iteratee) {
  9549. //TODO 暂不考虑 string
  9550. var ret, i, l, keys, key;
  9551. if (Array.isArray(val)) {
  9552. ret = new Array(val.length);
  9553. for (i = 0, l = val.length; i < l; i++) {
  9554. ret[i] = iteratee(val[i], i);
  9555. }
  9556. return ret
  9557. } else if (isObject(val)) {
  9558. keys = Object.keys(val);
  9559. ret = Object.create(null);
  9560. for (i = 0, l = keys.length; i < l; i++) {
  9561. key = keys[i];
  9562. ret[key] = iteratee(val[key], key, i);
  9563. }
  9564. return ret
  9565. } else if (typeof val === 'number') {
  9566. ret = new Array(val);
  9567. for (i = 0, l = val; i < l; i++) {
  9568. // 第一个参数暂时仍和小程序一致
  9569. ret[i] = iteratee(i, i);
  9570. }
  9571. return ret
  9572. }
  9573. return []
  9574. };
  9575. }
  9576. /* */
  9577. var LIFECYCLE_HOOKS$1 = [
  9578. //App
  9579. 'onLaunch',
  9580. 'onShow',
  9581. 'onHide',
  9582. 'onUniNViewMessage',
  9583. 'onPageNotFound',
  9584. 'onThemeChange',
  9585. 'onError',
  9586. 'onUnhandledRejection',
  9587. //Page
  9588. 'onInit',
  9589. 'onLoad',
  9590. // 'onShow',
  9591. 'onReady',
  9592. // 'onHide',
  9593. 'onUnload',
  9594. 'onPullDownRefresh',
  9595. 'onReachBottom',
  9596. 'onTabItemTap',
  9597. 'onAddToFavorites',
  9598. 'onShareTimeline',
  9599. 'onShareAppMessage',
  9600. 'onResize',
  9601. 'onPageScroll',
  9602. 'onNavigationBarButtonTap',
  9603. 'onBackPress',
  9604. 'onNavigationBarSearchInputChanged',
  9605. 'onNavigationBarSearchInputConfirmed',
  9606. 'onNavigationBarSearchInputClicked',
  9607. 'onUploadDouyinVideo',
  9608. 'onNFCReadMessage',
  9609. //Component
  9610. // 'onReady', // 兼容旧版本,应该移除该事件
  9611. 'onPageShow',
  9612. 'onPageHide',
  9613. 'onPageResize'
  9614. ];
  9615. function lifecycleMixin$1(Vue) {
  9616. //fixed vue-class-component
  9617. var oldExtend = Vue.extend;
  9618. Vue.extend = function(extendOptions) {
  9619. extendOptions = extendOptions || {};
  9620. var methods = extendOptions.methods;
  9621. if (methods) {
  9622. Object.keys(methods).forEach(function (methodName) {
  9623. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  9624. extendOptions[methodName] = methods[methodName];
  9625. delete methods[methodName];
  9626. }
  9627. });
  9628. }
  9629. return oldExtend.call(this, extendOptions)
  9630. };
  9631. var strategies = Vue.config.optionMergeStrategies;
  9632. var mergeHook = strategies.created;
  9633. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  9634. strategies[hook] = mergeHook;
  9635. });
  9636. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  9637. }
  9638. /* */
  9639. // install platform patch function
  9640. Vue.prototype.__patch__ = patch;
  9641. // public mount method
  9642. Vue.prototype.$mount = function(
  9643. el ,
  9644. hydrating
  9645. ) {
  9646. return mountComponent$1(this, el, hydrating)
  9647. };
  9648. lifecycleMixin$1(Vue);
  9649. internalMixin(Vue);
  9650. /* */
  9651. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  9652. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  9653. /***/ }),
  9654. /***/ 26:
  9655. /*!*************************************************************!*\
  9656. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json ***!
  9657. \*************************************************************/
  9658. /*! no static exports found */
  9659. /***/ (function(module, exports) {
  9660. /***/ }),
  9661. /***/ 3:
  9662. /*!***********************************!*\
  9663. !*** (webpack)/buildin/global.js ***!
  9664. \***********************************/
  9665. /*! no static exports found */
  9666. /***/ (function(module, exports) {
  9667. var g;
  9668. // This works in non-strict mode
  9669. g = (function() {
  9670. return this;
  9671. })();
  9672. try {
  9673. // This works if eval is allowed (see CSP)
  9674. g = g || new Function("return this")();
  9675. } catch (e) {
  9676. // This works if the window reference is available
  9677. if (typeof window === "object") g = window;
  9678. }
  9679. // g can still be undefined, but nothing to do about it...
  9680. // We return undefined, instead of nothing here, so it's
  9681. // easier to handle this case. if(!global) { ...}
  9682. module.exports = g;
  9683. /***/ }),
  9684. /***/ 30:
  9685. /*!*******************************************************************!*\
  9686. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/api.js ***!
  9687. \*******************************************************************/
  9688. /*! no static exports found */
  9689. /***/ (function(module, exports, __webpack_require__) {
  9690. "use strict";
  9691. /* WEBPACK VAR INJECTION */(function(uni) {
  9692. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9693. Object.defineProperty(exports, "__esModule", {
  9694. value: true
  9695. });
  9696. exports.default = void 0;
  9697. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  9698. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  9699. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  9700. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  9701. var _config = _interopRequireDefault(__webpack_require__(/*! ./config */ 35));
  9702. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  9703. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  9704. var api = {};
  9705. // 网络请求封装
  9706. var Request = function Request(opts) {
  9707. var originalComplete = opts.complete;
  9708. return new Promise(function (resolve, reject) {
  9709. uni.request(Object.assign({}, opts, {
  9710. complete: function complete(res) {
  9711. var hasSuccess = Boolean(res.errMsg == 'request:ok' && res.statusCode >= 200 && res.statusCode < 300);
  9712. hasSuccess ? resolve(res.data) : reject(res);
  9713. if (originalComplete && typeof originalComplete == 'function') originalComplete(res);
  9714. }
  9715. }));
  9716. });
  9717. };
  9718. // 路径拼接
  9719. var pathJoin = function pathJoin() {
  9720. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9721. args[_key] = arguments[_key];
  9722. }
  9723. return args.join('/').replace(/(?<!:)(\/{2,})/g, '/');
  9724. };
  9725. // 显示LOADING
  9726. var showLoading = function showLoading() {
  9727. uni.showLoading({
  9728. title: '',
  9729. mask: true
  9730. });
  9731. };
  9732. // 关闭LOADING
  9733. var hideLoading = function hideLoading() {
  9734. uni.hideLoading();
  9735. };
  9736. // 获取用户TOKEN
  9737. var getUserToken = function getUserToken() {
  9738. return uni.getStorageSync(_config.default.keyname.userToken);
  9739. };
  9740. /**
  9741. * 基础请求
  9742. * @param {String} method 请求类型
  9743. * @param {String} url 请求地址
  9744. * @param {Object} data 请求数据
  9745. * @param {Object} opts 配置参数
  9746. */
  9747. api.base = function (method, url, data, opts) {
  9748. return new Promise( /*#__PURE__*/function () {
  9749. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  9750. var options;
  9751. return _regenerator.default.wrap(function _callee3$(_context3) {
  9752. while (1) {
  9753. switch (_context3.prev = _context3.next) {
  9754. case 0:
  9755. options = Object.assign({
  9756. // 请求地址
  9757. url: pathJoin(_config.default.url.request, url),
  9758. // 请求数据
  9759. data: data || {},
  9760. // 请求类型
  9761. method: method || 'post',
  9762. // 数据类型
  9763. dataType: 'json',
  9764. // 自动显示LOADING
  9765. loading: true,
  9766. // 启用错误自动拦截
  9767. error: true,
  9768. // 请求头设定
  9769. header: {
  9770. 'content-type': 'application/json',
  9771. 'token': getUserToken()
  9772. },
  9773. // 设置显示LOADING的方法
  9774. showLoading: showLoading,
  9775. // 设置关闭LOADING的方法
  9776. hideLoading: hideLoading
  9777. }, opts || {});
  9778. if (options.loading && typeof options.showLoading == 'function') {
  9779. options.showLoading();
  9780. }
  9781. Request(options).then( /*#__PURE__*/function () {
  9782. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(res) {
  9783. var db;
  9784. return _regenerator.default.wrap(function _callee$(_context) {
  9785. while (1) {
  9786. switch (_context.prev = _context.next) {
  9787. case 0:
  9788. if (options.loading && typeof options.hideLoading == 'function') {
  9789. options.hideLoading();
  9790. }
  9791. _context.t0 = res.code;
  9792. _context.next = _context.t0 === 0 ? 4 : _context.t0 === 201 ? 6 : 26;
  9793. break;
  9794. case 4:
  9795. resolve(res);
  9796. return _context.abrupt("break", 28);
  9797. case 6:
  9798. _context.prev = 6;
  9799. _context.next = 9;
  9800. return api.login();
  9801. case 9:
  9802. _context.next = 14;
  9803. break;
  9804. case 11:
  9805. _context.prev = 11;
  9806. _context.t1 = _context["catch"](6);
  9807. reject(_context.t1);
  9808. case 14:
  9809. options.header.token = getUserToken();
  9810. _context.prev = 15;
  9811. _context.next = 18;
  9812. return Request(options);
  9813. case 18:
  9814. db = _context.sent;
  9815. resolve(db);
  9816. _context.next = 25;
  9817. break;
  9818. case 22:
  9819. _context.prev = 22;
  9820. _context.t2 = _context["catch"](15);
  9821. reject(_context.t2);
  9822. case 25:
  9823. return _context.abrupt("break", 28);
  9824. case 26:
  9825. if (options.error) {
  9826. _app.default.popup.alert(res.msg || "".concat(url, "\r\n\u672A\u77E5\u9519\u8BEF"), '数据请求');
  9827. } else {
  9828. reject(res);
  9829. }
  9830. return _context.abrupt("break", 28);
  9831. case 28:
  9832. case "end":
  9833. return _context.stop();
  9834. }
  9835. }
  9836. }, _callee, null, [[6, 11], [15, 22]]);
  9837. }));
  9838. return function (_x3) {
  9839. return _ref2.apply(this, arguments);
  9840. };
  9841. }()).catch( /*#__PURE__*/function () {
  9842. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
  9843. return _regenerator.default.wrap(function _callee2$(_context2) {
  9844. while (1) {
  9845. switch (_context2.prev = _context2.next) {
  9846. case 0:
  9847. /*失败处理,此处为非200状态码引起的错误*/
  9848. options.hideLoading();
  9849. _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat(err.errMsg), '数据请求');
  9850. case 2:
  9851. case "end":
  9852. return _context2.stop();
  9853. }
  9854. }
  9855. }, _callee2);
  9856. }));
  9857. return function (_x4) {
  9858. return _ref3.apply(this, arguments);
  9859. };
  9860. }());
  9861. case 3:
  9862. case "end":
  9863. return _context3.stop();
  9864. }
  9865. }
  9866. }, _callee3);
  9867. }));
  9868. return function (_x, _x2) {
  9869. return _ref.apply(this, arguments);
  9870. };
  9871. }());
  9872. };
  9873. /**
  9874. * POST请求
  9875. * @param {String} url 请求地址
  9876. * @param {Object} data 请求数据
  9877. * @param {Object} opts 配置参数
  9878. */
  9879. api.post = function (url, data, opts) {
  9880. return api.base('post', url, data, Object.assign({}, opts));
  9881. };
  9882. /**
  9883. * GET请求
  9884. * @param {String} url 请求地址
  9885. * @param {Object} data 请求数据
  9886. * @param {Object} opts 配置参数
  9887. */
  9888. api.get = function (url, data, opts) {
  9889. return api.base('get', url, data, Object.assign({}, opts));
  9890. };
  9891. /**
  9892. * 获取静态数据
  9893. * @param {String} url 静态文件地址
  9894. * @param {Object} data 参数数据
  9895. * @param {Object} opts 配置参数
  9896. */
  9897. api.static = function (url, data, opts) {
  9898. return new Promise( /*#__PURE__*/function () {
  9899. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  9900. var _opts;
  9901. return _regenerator.default.wrap(function _callee4$(_context4) {
  9902. while (1) {
  9903. switch (_context4.prev = _context4.next) {
  9904. case 0:
  9905. // 设置选项
  9906. _opts = Object.assign({
  9907. url: /^http/.test(url) ? url : API_BASE + (url || ''),
  9908. data: Object.assign({
  9909. cache: Date.now()
  9910. }, data)
  9911. }, opts || {});
  9912. uni.request(_objectSpread(_objectSpread({}, _opts), {}, {
  9913. success: function success(res) {
  9914. resolve(res.data);
  9915. }
  9916. }));
  9917. case 2:
  9918. case "end":
  9919. return _context4.stop();
  9920. }
  9921. }
  9922. }, _callee4);
  9923. }));
  9924. return function (_x5, _x6) {
  9925. return _ref4.apply(this, arguments);
  9926. };
  9927. }());
  9928. };
  9929. /**
  9930. * 文件上传
  9931. * @param {String} file 文件临时路径
  9932. * @param {Object} opts 上传参数
  9933. */
  9934. api.upload = function (file, opts) {
  9935. return new Promise(function (resolve, reject) {
  9936. var options = Object.assign({
  9937. // 请求地址
  9938. url: pathJoin(_config.default.url.upload, (opts === null || opts === void 0 ? void 0 : opts.url) || ''),
  9939. // 请求数据
  9940. filePath: file,
  9941. // 自动显示LOADING
  9942. loading: true,
  9943. // 启用错误自动拦截
  9944. error: true,
  9945. // 请求头设定
  9946. header: {
  9947. 'token': uni.getStorageSync(_config.default.keyname.userToken)
  9948. },
  9949. // 设置显示LOADING的方法
  9950. showLoading: showLoading,
  9951. // 设置关闭LOADING的方法
  9952. hideLoading: hideLoading
  9953. }, opts || {});
  9954. });
  9955. };
  9956. /**
  9957. * 获取登录code
  9958. */
  9959. api.userCode = function () {
  9960. return new Promise(function (resolve, reject) {
  9961. uni.login({
  9962. provider: 'weixin',
  9963. success: function success(res) {
  9964. return resolve(res.code);
  9965. },
  9966. fail: function fail(err) {
  9967. return reject(err);
  9968. }
  9969. });
  9970. });
  9971. };
  9972. /**
  9973. * 自动登录
  9974. * @param {Object} data 登录数据(非必填)
  9975. */
  9976. api.login = function (data) {
  9977. return new Promise( /*#__PURE__*/function () {
  9978. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  9979. var code;
  9980. return _regenerator.default.wrap(function _callee6$(_context6) {
  9981. while (1) {
  9982. switch (_context6.prev = _context6.next) {
  9983. case 0:
  9984. _context6.next = 2;
  9985. return api.userCode();
  9986. case 2:
  9987. code = _context6.sent;
  9988. api.post(_config.default.api.login, _objectSpread(_objectSpread({}, data || {}), {}, {
  9989. code: code
  9990. })).then( /*#__PURE__*/function () {
  9991. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(res) {
  9992. return _regenerator.default.wrap(function _callee5$(_context5) {
  9993. while (1) {
  9994. switch (_context5.prev = _context5.next) {
  9995. case 0:
  9996. uni.setStorageSync(_config.default.keyname.userToken, res === null || res === void 0 ? void 0 : res.token);
  9997. uni.setStorageSync(_config.default.keyname.userInfo, res === null || res === void 0 ? void 0 : res.userInfo);
  9998. resolve(res.token);
  9999. case 3:
  10000. case "end":
  10001. return _context5.stop();
  10002. }
  10003. }
  10004. }, _callee5);
  10005. }));
  10006. return function (_x9) {
  10007. return _ref6.apply(this, arguments);
  10008. };
  10009. }()).catch(function (err) {
  10010. return reject(err);
  10011. });
  10012. case 4:
  10013. case "end":
  10014. return _context6.stop();
  10015. }
  10016. }
  10017. }, _callee6);
  10018. }));
  10019. return function (_x7, _x8) {
  10020. return _ref5.apply(this, arguments);
  10021. };
  10022. }());
  10023. };
  10024. var _default = api;
  10025. exports.default = _default;
  10026. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10027. /***/ }),
  10028. /***/ 31:
  10029. /*!************************************************************************************************!*\
  10030. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  10031. \************************************************************************************************/
  10032. /*! no static exports found */
  10033. /***/ (function(module, exports, __webpack_require__) {
  10034. // TODO(Babel 8): Remove this file.
  10035. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 32)();
  10036. module.exports = runtime;
  10037. /***/ }),
  10038. /***/ 32:
  10039. /*!*******************************************************************!*\
  10040. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  10041. \*******************************************************************/
  10042. /*! no static exports found */
  10043. /***/ (function(module, exports, __webpack_require__) {
  10044. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  10045. function _regeneratorRuntime() {
  10046. "use strict";
  10047. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  10048. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  10049. return e;
  10050. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10051. var t,
  10052. e = {},
  10053. r = Object.prototype,
  10054. n = r.hasOwnProperty,
  10055. o = Object.defineProperty || function (t, e, r) {
  10056. t[e] = r.value;
  10057. },
  10058. i = "function" == typeof Symbol ? Symbol : {},
  10059. a = i.iterator || "@@iterator",
  10060. c = i.asyncIterator || "@@asyncIterator",
  10061. u = i.toStringTag || "@@toStringTag";
  10062. function define(t, e, r) {
  10063. return Object.defineProperty(t, e, {
  10064. value: r,
  10065. enumerable: !0,
  10066. configurable: !0,
  10067. writable: !0
  10068. }), t[e];
  10069. }
  10070. try {
  10071. define({}, "");
  10072. } catch (t) {
  10073. define = function define(t, e, r) {
  10074. return t[e] = r;
  10075. };
  10076. }
  10077. function wrap(t, e, r, n) {
  10078. var i = e && e.prototype instanceof Generator ? e : Generator,
  10079. a = Object.create(i.prototype),
  10080. c = new Context(n || []);
  10081. return o(a, "_invoke", {
  10082. value: makeInvokeMethod(t, r, c)
  10083. }), a;
  10084. }
  10085. function tryCatch(t, e, r) {
  10086. try {
  10087. return {
  10088. type: "normal",
  10089. arg: t.call(e, r)
  10090. };
  10091. } catch (t) {
  10092. return {
  10093. type: "throw",
  10094. arg: t
  10095. };
  10096. }
  10097. }
  10098. e.wrap = wrap;
  10099. var h = "suspendedStart",
  10100. l = "suspendedYield",
  10101. f = "executing",
  10102. s = "completed",
  10103. y = {};
  10104. function Generator() {}
  10105. function GeneratorFunction() {}
  10106. function GeneratorFunctionPrototype() {}
  10107. var p = {};
  10108. define(p, a, function () {
  10109. return this;
  10110. });
  10111. var d = Object.getPrototypeOf,
  10112. v = d && d(d(values([])));
  10113. v && v !== r && n.call(v, a) && (p = v);
  10114. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  10115. function defineIteratorMethods(t) {
  10116. ["next", "throw", "return"].forEach(function (e) {
  10117. define(t, e, function (t) {
  10118. return this._invoke(e, t);
  10119. });
  10120. });
  10121. }
  10122. function AsyncIterator(t, e) {
  10123. function invoke(r, o, i, a) {
  10124. var c = tryCatch(t[r], t, o);
  10125. if ("throw" !== c.type) {
  10126. var u = c.arg,
  10127. h = u.value;
  10128. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  10129. invoke("next", t, i, a);
  10130. }, function (t) {
  10131. invoke("throw", t, i, a);
  10132. }) : e.resolve(h).then(function (t) {
  10133. u.value = t, i(u);
  10134. }, function (t) {
  10135. return invoke("throw", t, i, a);
  10136. });
  10137. }
  10138. a(c.arg);
  10139. }
  10140. var r;
  10141. o(this, "_invoke", {
  10142. value: function value(t, n) {
  10143. function callInvokeWithMethodAndArg() {
  10144. return new e(function (e, r) {
  10145. invoke(t, n, e, r);
  10146. });
  10147. }
  10148. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  10149. }
  10150. });
  10151. }
  10152. function makeInvokeMethod(e, r, n) {
  10153. var o = h;
  10154. return function (i, a) {
  10155. if (o === f) throw Error("Generator is already running");
  10156. if (o === s) {
  10157. if ("throw" === i) throw a;
  10158. return {
  10159. value: t,
  10160. done: !0
  10161. };
  10162. }
  10163. for (n.method = i, n.arg = a;;) {
  10164. var c = n.delegate;
  10165. if (c) {
  10166. var u = maybeInvokeDelegate(c, n);
  10167. if (u) {
  10168. if (u === y) continue;
  10169. return u;
  10170. }
  10171. }
  10172. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  10173. if (o === h) throw o = s, n.arg;
  10174. n.dispatchException(n.arg);
  10175. } else "return" === n.method && n.abrupt("return", n.arg);
  10176. o = f;
  10177. var p = tryCatch(e, r, n);
  10178. if ("normal" === p.type) {
  10179. if (o = n.done ? s : l, p.arg === y) continue;
  10180. return {
  10181. value: p.arg,
  10182. done: n.done
  10183. };
  10184. }
  10185. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  10186. }
  10187. };
  10188. }
  10189. function maybeInvokeDelegate(e, r) {
  10190. var n = r.method,
  10191. o = e.iterator[n];
  10192. if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  10193. var i = tryCatch(o, e.iterator, r.arg);
  10194. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  10195. var a = i.arg;
  10196. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  10197. }
  10198. function pushTryEntry(t) {
  10199. var e = {
  10200. tryLoc: t[0]
  10201. };
  10202. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  10203. }
  10204. function resetTryEntry(t) {
  10205. var e = t.completion || {};
  10206. e.type = "normal", delete e.arg, t.completion = e;
  10207. }
  10208. function Context(t) {
  10209. this.tryEntries = [{
  10210. tryLoc: "root"
  10211. }], t.forEach(pushTryEntry, this), this.reset(!0);
  10212. }
  10213. function values(e) {
  10214. if (e || "" === e) {
  10215. var r = e[a];
  10216. if (r) return r.call(e);
  10217. if ("function" == typeof e.next) return e;
  10218. if (!isNaN(e.length)) {
  10219. var o = -1,
  10220. i = function next() {
  10221. for (; ++o < e.length;) {
  10222. if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  10223. }
  10224. return next.value = t, next.done = !0, next;
  10225. };
  10226. return i.next = i;
  10227. }
  10228. }
  10229. throw new TypeError(_typeof(e) + " is not iterable");
  10230. }
  10231. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  10232. value: GeneratorFunctionPrototype,
  10233. configurable: !0
  10234. }), o(GeneratorFunctionPrototype, "constructor", {
  10235. value: GeneratorFunction,
  10236. configurable: !0
  10237. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  10238. var e = "function" == typeof t && t.constructor;
  10239. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  10240. }, e.mark = function (t) {
  10241. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  10242. }, e.awrap = function (t) {
  10243. return {
  10244. __await: t
  10245. };
  10246. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  10247. return this;
  10248. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  10249. void 0 === i && (i = Promise);
  10250. var a = new AsyncIterator(wrap(t, r, n, o), i);
  10251. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  10252. return t.done ? t.value : a.next();
  10253. });
  10254. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  10255. return this;
  10256. }), define(g, "toString", function () {
  10257. return "[object Generator]";
  10258. }), e.keys = function (t) {
  10259. var e = Object(t),
  10260. r = [];
  10261. for (var n in e) {
  10262. r.push(n);
  10263. }
  10264. return r.reverse(), function next() {
  10265. for (; r.length;) {
  10266. var t = r.pop();
  10267. if (t in e) return next.value = t, next.done = !1, next;
  10268. }
  10269. return next.done = !0, next;
  10270. };
  10271. }, e.values = values, Context.prototype = {
  10272. constructor: Context,
  10273. reset: function reset(e) {
  10274. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) {
  10275. "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  10276. }
  10277. },
  10278. stop: function stop() {
  10279. this.done = !0;
  10280. var t = this.tryEntries[0].completion;
  10281. if ("throw" === t.type) throw t.arg;
  10282. return this.rval;
  10283. },
  10284. dispatchException: function dispatchException(e) {
  10285. if (this.done) throw e;
  10286. var r = this;
  10287. function handle(n, o) {
  10288. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  10289. }
  10290. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  10291. var i = this.tryEntries[o],
  10292. a = i.completion;
  10293. if ("root" === i.tryLoc) return handle("end");
  10294. if (i.tryLoc <= this.prev) {
  10295. var c = n.call(i, "catchLoc"),
  10296. u = n.call(i, "finallyLoc");
  10297. if (c && u) {
  10298. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  10299. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  10300. } else if (c) {
  10301. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  10302. } else {
  10303. if (!u) throw Error("try statement without catch or finally");
  10304. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  10305. }
  10306. }
  10307. }
  10308. },
  10309. abrupt: function abrupt(t, e) {
  10310. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  10311. var o = this.tryEntries[r];
  10312. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  10313. var i = o;
  10314. break;
  10315. }
  10316. }
  10317. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  10318. var a = i ? i.completion : {};
  10319. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  10320. },
  10321. complete: function complete(t, e) {
  10322. if ("throw" === t.type) throw t.arg;
  10323. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  10324. },
  10325. finish: function finish(t) {
  10326. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  10327. var r = this.tryEntries[e];
  10328. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  10329. }
  10330. },
  10331. "catch": function _catch(t) {
  10332. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  10333. var r = this.tryEntries[e];
  10334. if (r.tryLoc === t) {
  10335. var n = r.completion;
  10336. if ("throw" === n.type) {
  10337. var o = n.arg;
  10338. resetTryEntry(r);
  10339. }
  10340. return o;
  10341. }
  10342. }
  10343. throw Error("illegal catch attempt");
  10344. },
  10345. delegateYield: function delegateYield(e, r, n) {
  10346. return this.delegate = {
  10347. iterator: values(e),
  10348. resultName: r,
  10349. nextLoc: n
  10350. }, "next" === this.method && (this.arg = t), y;
  10351. }
  10352. }, e;
  10353. }
  10354. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10355. /***/ }),
  10356. /***/ 33:
  10357. /*!*****************************************************************!*\
  10358. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  10359. \*****************************************************************/
  10360. /*! no static exports found */
  10361. /***/ (function(module, exports) {
  10362. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  10363. try {
  10364. var info = gen[key](arg);
  10365. var value = info.value;
  10366. } catch (error) {
  10367. reject(error);
  10368. return;
  10369. }
  10370. if (info.done) {
  10371. resolve(value);
  10372. } else {
  10373. Promise.resolve(value).then(_next, _throw);
  10374. }
  10375. }
  10376. function _asyncToGenerator(fn) {
  10377. return function () {
  10378. var self = this,
  10379. args = arguments;
  10380. return new Promise(function (resolve, reject) {
  10381. var gen = fn.apply(self, args);
  10382. function _next(value) {
  10383. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  10384. }
  10385. function _throw(err) {
  10386. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  10387. }
  10388. _next(undefined);
  10389. });
  10390. };
  10391. }
  10392. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10393. /***/ }),
  10394. /***/ 34:
  10395. /*!*******************************************************************!*\
  10396. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/app.js ***!
  10397. \*******************************************************************/
  10398. /*! no static exports found */
  10399. /***/ (function(module, exports, __webpack_require__) {
  10400. /* WEBPACK VAR INJECTION */(function(uni, wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  10401. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  10402. var app = {};
  10403. app.sys = /*#__PURE__*/function () {
  10404. "use strict";
  10405. function appSystem() {
  10406. _classCallCheck(this, appSystem);
  10407. }
  10408. _createClass(appSystem, null, [{
  10409. key: "envVersion",
  10410. value:
  10411. /**
  10412. * 环境版本判定回调
  10413. * @param {Object.Function} callbacks 回调执行方法
  10414. */
  10415. function envVersion(callbacks) {
  10416. var _uni$getAccountInfoSy, _uni$getAccountInfoSy2;
  10417. if (!uni.getAccountInfoSync) return;
  10418. var current = (_uni$getAccountInfoSy = uni.getAccountInfoSync()) === null || _uni$getAccountInfoSy === void 0 ? void 0 : (_uni$getAccountInfoSy2 = _uni$getAccountInfoSy.miniProgram) === null || _uni$getAccountInfoSy2 === void 0 ? void 0 : _uni$getAccountInfoSy2.envVersion;
  10419. var fn = callbacks[current];
  10420. if (fn && typeof fn == 'function') fn();
  10421. }
  10422. }]);
  10423. return appSystem;
  10424. }();
  10425. app.url = /*#__PURE__*/function () {
  10426. "use strict";
  10427. function appUrl() {
  10428. _classCallCheck(this, appUrl);
  10429. }
  10430. _createClass(appUrl, null, [{
  10431. key: "goto",
  10432. value:
  10433. /**
  10434. * 跳转到地址
  10435. * @param {String} url path字符串
  10436. * @param {Boolean} mode 跳转模式; false时关闭当前窗口跳转 | null时关闭所有窗口跳转 | 默认为打开新窗口跳转(最多支持10层,页面栈超过10层后默认为false模式);
  10437. */
  10438. function goto(url, mode) {
  10439. return new Promise(function (resolve, reject) {
  10440. var fail = function fail(err) {
  10441. return uni.switchTab({
  10442. url: url,
  10443. success: success
  10444. });
  10445. };
  10446. var success = function success() {
  10447. return resolve();
  10448. };
  10449. if (mode === false) return uni.redirectTo({
  10450. url: url,
  10451. fail: fail
  10452. });
  10453. if (mode === null) return uni.reLaunch({
  10454. url: url,
  10455. fail: fail
  10456. });
  10457. if (getCurrentPages().length < 10) {
  10458. uni.navigateTo({
  10459. url: url,
  10460. fail: fail,
  10461. success: success
  10462. });
  10463. } else {
  10464. uni.redirectTo({
  10465. url: url,
  10466. fail: fail,
  10467. success: success
  10468. });
  10469. }
  10470. });
  10471. }
  10472. /**
  10473. * 返回页面
  10474. * @param {int} delta 返回级数
  10475. */
  10476. }, {
  10477. key: "back",
  10478. value: function back(delta) {
  10479. return uni.navigateBack({
  10480. delta: delta || 1
  10481. });
  10482. }
  10483. /**
  10484. * 刷新页面,会触发onLoad和onShow等钩子
  10485. */
  10486. }, {
  10487. key: "refresh",
  10488. value: function refresh() {
  10489. var pages = getCurrentPages();
  10490. var current = pages[pages.length - 1];
  10491. var url = current.$page.fullPath;
  10492. app.urlGoto(url, false);
  10493. }
  10494. /**
  10495. * 打开新窗口并传递数据
  10496. * @param {String} url path字符串
  10497. * @param {any} data 传递数据
  10498. */
  10499. }, {
  10500. key: "open",
  10501. value: function open(url, data) {
  10502. var pages = getCurrentPages();
  10503. var current = pages[pages.length - 1].$page.fullPath;
  10504. uni.navigateTo({
  10505. url: url,
  10506. success: function success(res) {
  10507. res.eventChannel.emit("OPEN-DATA[".concat(current, "]"), data);
  10508. }
  10509. });
  10510. }
  10511. /**
  10512. * 获取open方法发送到数据
  10513. * @param {Component} component 组件对象
  10514. */
  10515. }, {
  10516. key: "load",
  10517. value: function load(component) {
  10518. return new Promise(function (resolve, reject) {
  10519. var _pages, _pages$$page;
  10520. if (component == undefined) return console.error("app.url.load(this);");
  10521. var pages = getCurrentPages();
  10522. var current = (_pages = pages[pages.length - 2]) === null || _pages === void 0 ? void 0 : (_pages$$page = _pages.$page) === null || _pages$$page === void 0 ? void 0 : _pages$$page.fullPath;
  10523. var caller = component === null || component === void 0 ? void 0 : component.getOpenerEventChannel;
  10524. var channel = caller && caller.call(component);
  10525. if (channel && channel.on) channel.on("OPEN-DATA[".concat(current, "]"), function (data) {
  10526. return resolve(data);
  10527. });
  10528. });
  10529. }
  10530. /**
  10531. * 打开其他小程序
  10532. * @param {String} appid 小程序APPID
  10533. * @param {String} path 要打开的程序路径
  10534. * @param {Object} data 要传递给小程序狗子的参数
  10535. */
  10536. }, {
  10537. key: "applet",
  10538. value: function applet(appid, path, data) {
  10539. return new Promise(function (resolve, reject) {
  10540. uni.navigateToMiniProgram({
  10541. appId: appid,
  10542. path: path,
  10543. extraData: data || {},
  10544. success: function success(res) {
  10545. return resolve(res);
  10546. }
  10547. });
  10548. });
  10549. }
  10550. }]);
  10551. return appUrl;
  10552. }();
  10553. app.storage = /*#__PURE__*/function () {
  10554. "use strict";
  10555. function appStorage() {
  10556. _classCallCheck(this, appStorage);
  10557. }
  10558. _createClass(appStorage, null, [{
  10559. key: "set",
  10560. value:
  10561. /**
  10562. * 设置本地缓存数据
  10563. * @param {String} key 数据键名
  10564. * @param {any} data 存储数据,支持对象
  10565. */
  10566. function set(key, data) {
  10567. try {
  10568. uni.setStorageSync(key, data);
  10569. } catch (err) {
  10570. console.error('app.setStorageSync error: ', err);
  10571. }
  10572. }
  10573. /**
  10574. * 获取本地缓存数据
  10575. * @param {String} key 数据键名
  10576. */
  10577. }, {
  10578. key: "get",
  10579. value: function get(key) {
  10580. return uni.getStorageSync(key);
  10581. }
  10582. /**
  10583. * 清除键缓存数据
  10584. * @param {Object} key 数据键名
  10585. */
  10586. }, {
  10587. key: "remove",
  10588. value: function remove(key) {
  10589. uni.removeStorageSync(key);
  10590. }
  10591. /**
  10592. * 清理所有缓存数据
  10593. */
  10594. }, {
  10595. key: "clear",
  10596. value: function clear() {
  10597. uni.clearStorageSync();
  10598. }
  10599. }]);
  10600. return appStorage;
  10601. }();
  10602. app.math = /*#__PURE__*/function () {
  10603. "use strict";
  10604. function appMath() {
  10605. _classCallCheck(this, appMath);
  10606. }
  10607. _createClass(appMath, null, [{
  10608. key: "add",
  10609. value:
  10610. /**
  10611. * 浮点精确相加
  10612. * @param {Number} arg1 参数1
  10613. * @param {Number} arg2 参数2
  10614. */
  10615. function add(arg1, arg2) {
  10616. var r1, r2, m;
  10617. try {
  10618. r1 = arg1.toString().split(".")[1].length;
  10619. } catch (e) {
  10620. r1 = 0;
  10621. }
  10622. try {
  10623. r2 = arg2.toString().split(".")[1].length;
  10624. } catch (e) {
  10625. r2 = 0;
  10626. }
  10627. m = Math.pow(10, Math.max(r1, r2));
  10628. return (arg1 * m + arg2 * m) / m;
  10629. }
  10630. /**
  10631. * 浮点精确相减
  10632. * @param {Number} arg1 参数1
  10633. * @param {Number} arg2 参数2
  10634. */
  10635. }, {
  10636. key: "sub",
  10637. value: function sub(arg1, arg2) {
  10638. var r1, r2, m, n;
  10639. try {
  10640. r1 = arg1.toString().split(".")[1].length;
  10641. } catch (e) {
  10642. r1 = 0;
  10643. }
  10644. try {
  10645. r2 = arg2.toString().split(".")[1].length;
  10646. } catch (e) {
  10647. r2 = 0;
  10648. }
  10649. m = Math.pow(10, Math.max(r1, r2));
  10650. n = (r1 = r2) ? r1 : r2;
  10651. return ((arg1 * m - arg2 * m) / m).toFixed(n);
  10652. }
  10653. /**
  10654. * 浮点精确相乘
  10655. * @param {Number} arg1 参数1
  10656. * @param {Number} arg2 参数2
  10657. */
  10658. }, {
  10659. key: "mul",
  10660. value: function mul(arg1, arg2) {
  10661. var m = 0,
  10662. s1 = arg1.toString(),
  10663. s2 = arg2.toString();
  10664. try {
  10665. m += s1.split(".")[1].length;
  10666. } catch (e) {}
  10667. try {
  10668. m += s2.split(".")[1].length;
  10669. } catch (e) {}
  10670. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
  10671. }
  10672. /**
  10673. * 浮点精确相除
  10674. * @param {Number} arg1 参数1
  10675. * @param {Number} arg2 参数2
  10676. */
  10677. }, {
  10678. key: "div",
  10679. value: function div(arg1, arg2) {
  10680. var t1 = 0,
  10681. t2 = 0,
  10682. r1,
  10683. r2;
  10684. try {
  10685. t1 = arg1.toString().split(".")[1].length;
  10686. } catch (e) {}
  10687. ;
  10688. try {
  10689. t2 = arg2.toString().split(".")[1].length;
  10690. } catch (e) {}
  10691. ;
  10692. r1 = Number(arg1.toString().replace(".", ""));
  10693. r2 = Number(arg2.toString().replace(".", ""));
  10694. return r1 / r2 * Math.pow(10, t2 - t1);
  10695. }
  10696. }]);
  10697. return appMath;
  10698. }();
  10699. app.date = /*#__PURE__*/function () {
  10700. "use strict";
  10701. function appDate() {
  10702. _classCallCheck(this, appDate);
  10703. }
  10704. _createClass(appDate, null, [{
  10705. key: "format",
  10706. value:
  10707. /**
  10708. * 日期格式化
  10709. * @param {String} fmt 格式规则
  10710. * @param {String | Date} date 需要格式化的日期
  10711. */
  10712. function format(fmt, date) {
  10713. if (!fmt) fmt = 'yyyy-MM-dd hh:mm:sss';
  10714. if (typeof date === 'string') date = new Date(date.replaceAll('-', '/'));
  10715. if (!date) date = new Date();
  10716. var o = {
  10717. "M+": date.getMonth() + 1,
  10718. //月份
  10719. "d+": date.getDate(),
  10720. //日
  10721. "h+": date.getHours(),
  10722. //小时
  10723. "m+": date.getMinutes(),
  10724. //分
  10725. "s+": date.getSeconds(),
  10726. //秒
  10727. "q+": Math.floor((date.getMonth() + 3) / 3),
  10728. //季度
  10729. "S": date.getMilliseconds() //毫秒
  10730. };
  10731. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  10732. for (var k in o) {
  10733. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  10734. }
  10735. return fmt;
  10736. }
  10737. }]);
  10738. return appDate;
  10739. }();
  10740. app.popup = /*#__PURE__*/function () {
  10741. "use strict";
  10742. function appPopup() {
  10743. _classCallCheck(this, appPopup);
  10744. }
  10745. _createClass(appPopup, null, [{
  10746. key: "confirm",
  10747. value:
  10748. /**
  10749. * 对话框
  10750. * @param {String} content 弹窗内容
  10751. * @param {String} title 弹窗标题
  10752. * @param {Object} opts 参数
  10753. */
  10754. function confirm(content, title, opts) {
  10755. return new Promise(function (resolve, reject) {
  10756. if (!title && title == null) title = '温馨提示';
  10757. opts = Object.assign({
  10758. title: title,
  10759. content: content,
  10760. success: function success(res) {
  10761. return resolve(res.confirm == true);
  10762. },
  10763. fail: function fail(err) {
  10764. return reject(err);
  10765. }
  10766. }, opts);
  10767. uni.showModal(opts);
  10768. });
  10769. }
  10770. /**
  10771. * 提示框
  10772. * @param {String} content 弹窗内容
  10773. * @param {String} title 弹窗标题
  10774. */
  10775. }, {
  10776. key: "alert",
  10777. value: function alert(content, title) {
  10778. return appPopup.confirm(content, title || null, {
  10779. showCancel: false
  10780. });
  10781. }
  10782. }, {
  10783. key: "toast",
  10784. value:
  10785. /**
  10786. * 轻提示
  10787. * @param {String} content 提示内容
  10788. * @param {Object} opts 参数
  10789. */
  10790. function toast(content, opts) {
  10791. uni.showToast(Object.assign({
  10792. title: content,
  10793. position: 'bottom',
  10794. duration: 2000,
  10795. icon: 'none'
  10796. }, opts));
  10797. }
  10798. /**
  10799. * 加载条
  10800. * @param {Boolean} visible 显示
  10801. * @param {Object} opts 参数
  10802. */
  10803. }, {
  10804. key: "loading",
  10805. value: function loading(visible, opts) {
  10806. if (visible) {
  10807. uni.showLoading(Object.assign({
  10808. title: '载入中',
  10809. mask: true
  10810. }, opts));
  10811. var timeout = (opts === null || opts === void 0 ? void 0 : opts.timeout) || 45 * 1000;
  10812. setTimeout(function () {
  10813. return appPopup.loading(false);
  10814. }, timeout);
  10815. } else {
  10816. uni.hideLoading();
  10817. }
  10818. }
  10819. /**
  10820. * 操作菜单
  10821. * @param {Array} data 列表数据
  10822. * @param {String} key 指定显示字段
  10823. * @param {Object} opts 参数
  10824. */
  10825. }, {
  10826. key: "sheet",
  10827. value: function sheet(data, key, opts) {
  10828. return new Promise(function (resolve, reject) {
  10829. uni.showActionSheet(Object.assign({
  10830. title: '',
  10831. itemList: data.map(function (item) {
  10832. return key ? item[key] || String(item) : String(item);
  10833. }),
  10834. success: function success(res) {
  10835. return resolve({
  10836. index: res.tapIndex,
  10837. data: data[res.tapIndex]
  10838. });
  10839. }
  10840. }, opts));
  10841. });
  10842. }
  10843. }]);
  10844. return appPopup;
  10845. }();
  10846. app.map = /*#__PURE__*/function () {
  10847. "use strict";
  10848. function appMap() {
  10849. _classCallCheck(this, appMap);
  10850. }
  10851. _createClass(appMap, null, [{
  10852. key: "get",
  10853. value:
  10854. /**
  10855. * 获取当前位置坐标
  10856. * @param {Boolean} high 是否调用高精度接口
  10857. * @param {Object} opts 参数
  10858. */
  10859. function get(high, opts) {
  10860. return new Promise(function (resolve, reject) {
  10861. var OPTS = Object.assign({
  10862. success: function success(res) {
  10863. console.log(res);
  10864. },
  10865. fail: function fail(err) {
  10866. console.log(err);
  10867. }
  10868. }, opts);
  10869. high ? uni.getLocation(OPTS) : uni.getFuzzyLocation(OPTS);
  10870. });
  10871. }
  10872. }]);
  10873. return appMap;
  10874. }();
  10875. app.act = /*#__PURE__*/function () {
  10876. "use strict";
  10877. function appAct() {
  10878. _classCallCheck(this, appAct);
  10879. }
  10880. _createClass(appAct, null, [{
  10881. key: "callPhone",
  10882. value:
  10883. /**
  10884. * 拨打电话
  10885. * @param {String} phone
  10886. */
  10887. function callPhone(phone) {
  10888. uni.makePhoneCall({
  10889. phoneNumber: phone
  10890. });
  10891. }
  10892. /**
  10893. * 调用扫描
  10894. * @param {Object} opts 参数配置,详细查看 https://uniapp.dcloud.net.cn/api/system/barcode.html
  10895. */
  10896. }, {
  10897. key: "scan",
  10898. value: function scan(opts) {
  10899. return new Promise(function (resolve, reject) {
  10900. uni.scanCode(Object.assign({}, {
  10901. success: function success(res) {
  10902. return resolve(res);
  10903. }
  10904. // fail: err=>reject(err),
  10905. }, opts));
  10906. });
  10907. }
  10908. /**
  10909. * 获取节点信息
  10910. * @param {Component} component 组件
  10911. * @param {String} selector 类似于 CSS 的选择器
  10912. * @param {Boolean} multi 是否多节点
  10913. */
  10914. }, {
  10915. key: "selectorQuery",
  10916. value: function selectorQuery(component, selector, multi) {
  10917. return new Promise(function (resolve, reject) {
  10918. var query = uni.createSelectorQuery().in(component)[multi ? 'selectAll' : 'select'](selector);
  10919. query.boundingClientRect(function (data) {
  10920. if (data) resolve(data);
  10921. }).exec();
  10922. });
  10923. }
  10924. /**
  10925. * 复制文本到剪贴板
  10926. * @param {String} str 需要复制的文本
  10927. */
  10928. }, {
  10929. key: "copy",
  10930. value: function copy(str) {
  10931. return new Promise(function (resolve, reject) {
  10932. uni.setClipboardData({
  10933. data: 'hello',
  10934. success: resolve(),
  10935. fail: function fail(err) {
  10936. return reject(err);
  10937. }
  10938. });
  10939. });
  10940. }
  10941. /**
  10942. * 客服服务
  10943. * @param {Object} id
  10944. * @param {Object} url
  10945. */
  10946. }, {
  10947. key: "customerService",
  10948. value: function customerService(id, url) {
  10949. return new Promise(function (resolve, reject) {
  10950. wx.openCustomerServiceChat({
  10951. extInfo: {
  10952. url: url
  10953. },
  10954. corpId: id,
  10955. success: function success(res) {
  10956. return resolve(res);
  10957. },
  10958. fail: function fail(err) {
  10959. return reject(err);
  10960. }
  10961. });
  10962. });
  10963. }
  10964. }]);
  10965. return appAct;
  10966. }();
  10967. module.exports = app;
  10968. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  10969. /***/ }),
  10970. /***/ 35:
  10971. /*!**********************************************************************!*\
  10972. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/config.js ***!
  10973. \**********************************************************************/
  10974. /*! no static exports found */
  10975. /***/ (function(module, exports, __webpack_require__) {
  10976. "use strict";
  10977. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10978. Object.defineProperty(exports, "__esModule", {
  10979. value: true
  10980. });
  10981. exports.default = void 0;
  10982. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  10983. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  10984. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 36));
  10985. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  10986. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  10987. var config = {};
  10988. // 地址类
  10989. config.url = {
  10990. // API请求基础URL
  10991. request: 'https://charge.hub.zswlgz.com/',
  10992. // request : 'http://172.16.0.88:8081/',
  10993. // request : 'http://120.78.228.211:8866/',
  10994. // 上传地址
  10995. upload: 'http://127.0.0.1:3000/upload/',
  10996. // 下载地址
  10997. download: 'http://oss.aabb.com/download/',
  10998. // 静态文件服务
  10999. static: 'http://oss.aabb.com/',
  11000. //配置文件地址
  11001. configUrl: 'http://bx.eomp.cn/adp/'
  11002. };
  11003. // 接口类
  11004. config.api = {
  11005. login: '/userApi/login'
  11006. };
  11007. // 键名类
  11008. config.keyname = {
  11009. userInfo: 'USER_INFO',
  11010. userToken: 'USER_TOKEN',
  11011. logs: 'LOGS_DATA'
  11012. };
  11013. // 事件名
  11014. config.eventName = {
  11015. setResult: 'SET-HOME-RESULT'
  11016. };
  11017. // 客服
  11018. config.customerService = {
  11019. id: 'wwfb3777bf94dcfaf1',
  11020. url: 'https://work.weixin.qq.com/kfid/kfc4feac060f5c1bc7e'
  11021. };
  11022. // pages.json 页面配置文件
  11023. config.pages = _pages.default.pages.map(function (i) {
  11024. i.style = _objectSpread(_objectSpread({}, _pages.default.globalStyle), i.style);
  11025. return i;
  11026. });
  11027. // 不同版本执行器
  11028. _app.default.sys.envVersion({
  11029. // 正式版
  11030. release: function release() {},
  11031. // 体验版
  11032. trial: function trial() {},
  11033. // 开发版
  11034. develop: function develop() {}
  11035. });
  11036. var _default = config;
  11037. exports.default = _default;
  11038. /***/ }),
  11039. /***/ 36:
  11040. /*!******************************************************************************************!*\
  11041. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json?{"type":"origin-pages-json"} ***!
  11042. \******************************************************************************************/
  11043. /*! no static exports found */
  11044. /***/ (function(module, exports, __webpack_require__) {
  11045. "use strict";
  11046. Object.defineProperty(exports, "__esModule", {
  11047. value: true
  11048. });
  11049. exports.default = void 0;
  11050. var _default = {
  11051. "pages": [{
  11052. "path": "pages/index/index",
  11053. "style": {
  11054. "navigationBarTitleText": "首页"
  11055. }
  11056. }, {
  11057. "path": "pages/map/map",
  11058. "style": {
  11059. "navigationBarTitleText": "地图模式"
  11060. }
  11061. }, {
  11062. "path": "pages/my/my",
  11063. "style": {
  11064. "navigationBarTitleText": "个人中心"
  11065. }
  11066. }, {
  11067. "path": "pages/site/site",
  11068. "style": {
  11069. "navigationBarTitleText": "站点详情"
  11070. }
  11071. }, {
  11072. "path": "pages/site-more/site-more",
  11073. "style": {
  11074. "navigationBarTitleText": "电站价格"
  11075. }
  11076. }, {
  11077. "path": "pages/charging/charging",
  11078. "style": {
  11079. "navigationBarTitleText": "正在充电"
  11080. }
  11081. }, {
  11082. "path": "pages/order-detail/order-detail",
  11083. "style": {
  11084. "navigationBarTitleText": "订单详情"
  11085. }
  11086. }, {
  11087. "path": "pages/terminal/terminal",
  11088. "style": {
  11089. "navigationBarTitleText": "充电终端"
  11090. }
  11091. }, {
  11092. "path": "pages/coupon-buy/coupon-buy",
  11093. "style": {
  11094. "navigationBarTitleText": "购券中心"
  11095. }
  11096. }, {
  11097. "path": "pages/login/login",
  11098. "style": {
  11099. "navigationBarTitleText": "用户登录"
  11100. }
  11101. }, {
  11102. "path": "pages/recharge-log/recharge-log",
  11103. "style": {
  11104. "navigationBarTitleText": "购券记录"
  11105. }
  11106. }, {
  11107. "path": "pages/feedback/feedback",
  11108. "style": {
  11109. "navigationBarTitleText": ""
  11110. }
  11111. }, {
  11112. "path": "pages/order/order",
  11113. "style": {
  11114. "navigationBarTitleText": "充电订单"
  11115. }
  11116. }, {
  11117. "path": "pages/search/search",
  11118. "style": {
  11119. "navigationBarTitleText": "站点搜索"
  11120. }
  11121. }, {
  11122. "path": "pages/Invite-staff/Invite-staff",
  11123. "style": {
  11124. "navigationBarTitleText": "邀请员工"
  11125. }
  11126. }, {
  11127. "path": "pages/web/web",
  11128. "style": {
  11129. "navigationBarTitleText": "",
  11130. "navigationStyle": "default",
  11131. "navigationBarBackgroundColor": "#fff",
  11132. "backgroundColor": "#fff"
  11133. }
  11134. }, {
  11135. "path": "pages/feedback-reply/feedback-reply",
  11136. "style": {
  11137. "navigationBarTitleText": "反馈答复"
  11138. }
  11139. }],
  11140. "globalStyle": {
  11141. "navigationBarTextStyle": "black",
  11142. "navigationBarTitleText": "中数电动",
  11143. "navigationBarBackgroundColor": "#C7FFFD",
  11144. "backgroundColor": "#C7FFFD",
  11145. "navigationStyle": "custom"
  11146. },
  11147. "uniIdRouter": {}
  11148. };
  11149. exports.default = _default;
  11150. /***/ }),
  11151. /***/ 39:
  11152. /*!**********************************************************************************************************!*\
  11153. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  11154. \**********************************************************************************************************/
  11155. /*! exports provided: default */
  11156. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11157. "use strict";
  11158. __webpack_require__.r(__webpack_exports__);
  11159. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  11160. /* globals __VUE_SSR_CONTEXT__ */
  11161. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  11162. // This module is a runtime utility for cleaner component module output and will
  11163. // be included in the final webpack user bundle.
  11164. function normalizeComponent (
  11165. scriptExports,
  11166. render,
  11167. staticRenderFns,
  11168. functionalTemplate,
  11169. injectStyles,
  11170. scopeId,
  11171. moduleIdentifier, /* server only */
  11172. shadowMode, /* vue-cli only */
  11173. components, // fixed by xxxxxx auto components
  11174. renderjs // fixed by xxxxxx renderjs
  11175. ) {
  11176. // Vue.extend constructor export interop
  11177. var options = typeof scriptExports === 'function'
  11178. ? scriptExports.options
  11179. : scriptExports
  11180. // fixed by xxxxxx auto components
  11181. if (components) {
  11182. if (!options.components) {
  11183. options.components = {}
  11184. }
  11185. var hasOwn = Object.prototype.hasOwnProperty
  11186. for (var name in components) {
  11187. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  11188. options.components[name] = components[name]
  11189. }
  11190. }
  11191. }
  11192. // fixed by xxxxxx renderjs
  11193. if (renderjs) {
  11194. if(typeof renderjs.beforeCreate === 'function'){
  11195. renderjs.beforeCreate = [renderjs.beforeCreate]
  11196. }
  11197. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  11198. this[renderjs.__module] = this
  11199. });
  11200. (options.mixins || (options.mixins = [])).push(renderjs)
  11201. }
  11202. // render functions
  11203. if (render) {
  11204. options.render = render
  11205. options.staticRenderFns = staticRenderFns
  11206. options._compiled = true
  11207. }
  11208. // functional template
  11209. if (functionalTemplate) {
  11210. options.functional = true
  11211. }
  11212. // scopedId
  11213. if (scopeId) {
  11214. options._scopeId = 'data-v-' + scopeId
  11215. }
  11216. var hook
  11217. if (moduleIdentifier) { // server build
  11218. hook = function (context) {
  11219. // 2.3 injection
  11220. context =
  11221. context || // cached call
  11222. (this.$vnode && this.$vnode.ssrContext) || // stateful
  11223. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  11224. // 2.2 with runInNewContext: true
  11225. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  11226. context = __VUE_SSR_CONTEXT__
  11227. }
  11228. // inject component styles
  11229. if (injectStyles) {
  11230. injectStyles.call(this, context)
  11231. }
  11232. // register component module identifier for async chunk inferrence
  11233. if (context && context._registeredComponents) {
  11234. context._registeredComponents.add(moduleIdentifier)
  11235. }
  11236. }
  11237. // used by ssr in case component is cached and beforeCreate
  11238. // never gets called
  11239. options._ssrRegister = hook
  11240. } else if (injectStyles) {
  11241. hook = shadowMode
  11242. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  11243. : injectStyles
  11244. }
  11245. if (hook) {
  11246. if (options.functional) {
  11247. // for template-only hot-reload because in that case the render fn doesn't
  11248. // go through the normalizer
  11249. options._injectStyles = hook
  11250. // register for functioal component in vue file
  11251. var originalRender = options.render
  11252. options.render = function renderWithStyleInjection (h, context) {
  11253. hook.call(context)
  11254. return originalRender(h, context)
  11255. }
  11256. } else {
  11257. // inject component registration as beforeCreate hook
  11258. var existing = options.beforeCreate
  11259. options.beforeCreate = existing
  11260. ? [].concat(existing, hook)
  11261. : [hook]
  11262. }
  11263. }
  11264. return {
  11265. exports: scriptExports,
  11266. options: options
  11267. }
  11268. }
  11269. /***/ }),
  11270. /***/ 4:
  11271. /*!**********************************************************************!*\
  11272. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  11273. \**********************************************************************/
  11274. /*! no static exports found */
  11275. /***/ (function(module, exports) {
  11276. function _interopRequireDefault(obj) {
  11277. return obj && obj.__esModule ? obj : {
  11278. "default": obj
  11279. };
  11280. }
  11281. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11282. /***/ }),
  11283. /***/ 40:
  11284. /*!***************************************************************************!*\
  11285. !*** E:/zswl/code/charge_miniapp/charge_miniapp/uni.promisify.adaptor.js ***!
  11286. \***************************************************************************/
  11287. /*! no static exports found */
  11288. /***/ (function(module, exports, __webpack_require__) {
  11289. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  11290. uni.addInterceptor({
  11291. returnValue: function returnValue(res) {
  11292. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  11293. return res;
  11294. }
  11295. return new Promise(function (resolve, reject) {
  11296. res.then(function (res) {
  11297. return res[0] ? reject(res[0]) : resolve(res[1]);
  11298. });
  11299. });
  11300. }
  11301. });
  11302. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11303. /***/ }),
  11304. /***/ 41:
  11305. /*!*********************************************************************!*\
  11306. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/index.js ***!
  11307. \*********************************************************************/
  11308. /*! no static exports found */
  11309. /***/ (function(module, exports, __webpack_require__) {
  11310. "use strict";
  11311. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11312. Object.defineProperty(exports, "__esModule", {
  11313. value: true
  11314. });
  11315. Object.defineProperty(exports, "$Api", {
  11316. enumerable: true,
  11317. get: function get() {
  11318. return _api.default;
  11319. }
  11320. });
  11321. Object.defineProperty(exports, "$App", {
  11322. enumerable: true,
  11323. get: function get() {
  11324. return _app.default;
  11325. }
  11326. });
  11327. Object.defineProperty(exports, "$Config", {
  11328. enumerable: true,
  11329. get: function get() {
  11330. return _config.default;
  11331. }
  11332. });
  11333. Object.defineProperty(exports, "$Qrcode", {
  11334. enumerable: true,
  11335. get: function get() {
  11336. return _wxqrcode.default;
  11337. }
  11338. });
  11339. var _app = _interopRequireDefault(__webpack_require__(/*! ./app.js */ 34));
  11340. var _api = _interopRequireDefault(__webpack_require__(/*! ./api.js */ 30));
  11341. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 35));
  11342. var _wxqrcode = _interopRequireDefault(__webpack_require__(/*! ./wxqrcode.js */ 42));
  11343. /***/ }),
  11344. /***/ 42:
  11345. /*!************************************************************************!*\
  11346. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/wxqrcode.js ***!
  11347. \************************************************************************/
  11348. /*! no static exports found */
  11349. /***/ (function(module, exports) {
  11350. //---------------------------------------------------------------------
  11351. //
  11352. // QR Code Generator for JavaScript
  11353. //
  11354. // Copyright (c) 2009 Kazuhiko Arase
  11355. //
  11356. // URL: http://www.d-project.com/
  11357. //
  11358. // Licensed under the MIT license:
  11359. // http://www.opensource.org/licenses/mit-license.php
  11360. //
  11361. // The word 'QR Code' is registered trademark of
  11362. // DENSO WAVE INCORPORATED
  11363. // http://www.denso-wave.com/qrcode/faqpatent-e.html
  11364. //
  11365. //---------------------------------------------------------------------
  11366. //---------------------------------------------------------------------
  11367. // qrcode
  11368. //代码第1588行为补充代码
  11369. //修改人:chenxing
  11370. //2017-02-27 16:21:32
  11371. //---------------------------------------------------------------------
  11372. /**
  11373. * qrcode
  11374. * @param typeNumber 1 to 40
  11375. * @param errorCorrectLevel 'L','M','Q','H'
  11376. */
  11377. var qrcode = function qrcode(typeNumber, errorCorrectLevel) {
  11378. var PAD0 = 0xEC;
  11379. var PAD1 = 0x11;
  11380. var _typeNumber = typeNumber;
  11381. var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
  11382. var _modules = null;
  11383. var _moduleCount = 0;
  11384. var _dataCache = null;
  11385. var _dataList = new Array();
  11386. var _this = {};
  11387. var makeImpl = function makeImpl(test, maskPattern) {
  11388. _moduleCount = _typeNumber * 4 + 17;
  11389. _modules = function (moduleCount) {
  11390. var modules = new Array(moduleCount);
  11391. for (var row = 0; row < moduleCount; row += 1) {
  11392. modules[row] = new Array(moduleCount);
  11393. for (var col = 0; col < moduleCount; col += 1) {
  11394. modules[row][col] = null;
  11395. }
  11396. }
  11397. return modules;
  11398. }(_moduleCount);
  11399. setupPositionProbePattern(0, 0);
  11400. setupPositionProbePattern(_moduleCount - 7, 0);
  11401. setupPositionProbePattern(0, _moduleCount - 7);
  11402. setupPositionAdjustPattern();
  11403. setupTimingPattern();
  11404. setupTypeInfo(test, maskPattern);
  11405. if (_typeNumber >= 7) {
  11406. setupTypeNumber(test);
  11407. }
  11408. if (_dataCache == null) {
  11409. _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
  11410. }
  11411. mapData(_dataCache, maskPattern);
  11412. };
  11413. var setupPositionProbePattern = function setupPositionProbePattern(row, col) {
  11414. for (var r = -1; r <= 7; r += 1) {
  11415. if (row + r <= -1 || _moduleCount <= row + r) continue;
  11416. for (var c = -1; c <= 7; c += 1) {
  11417. if (col + c <= -1 || _moduleCount <= col + c) continue;
  11418. if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
  11419. _modules[row + r][col + c] = true;
  11420. } else {
  11421. _modules[row + r][col + c] = false;
  11422. }
  11423. }
  11424. }
  11425. };
  11426. var getBestMaskPattern = function getBestMaskPattern() {
  11427. var minLostPoint = 0;
  11428. var pattern = 0;
  11429. for (var i = 0; i < 8; i += 1) {
  11430. makeImpl(true, i);
  11431. var lostPoint = QRUtil.getLostPoint(_this);
  11432. if (i == 0 || minLostPoint > lostPoint) {
  11433. minLostPoint = lostPoint;
  11434. pattern = i;
  11435. }
  11436. }
  11437. return pattern;
  11438. };
  11439. var setupTimingPattern = function setupTimingPattern() {
  11440. for (var r = 8; r < _moduleCount - 8; r += 1) {
  11441. if (_modules[r][6] != null) {
  11442. continue;
  11443. }
  11444. _modules[r][6] = r % 2 == 0;
  11445. }
  11446. for (var c = 8; c < _moduleCount - 8; c += 1) {
  11447. if (_modules[6][c] != null) {
  11448. continue;
  11449. }
  11450. _modules[6][c] = c % 2 == 0;
  11451. }
  11452. };
  11453. var setupPositionAdjustPattern = function setupPositionAdjustPattern() {
  11454. var pos = QRUtil.getPatternPosition(_typeNumber);
  11455. for (var i = 0; i < pos.length; i += 1) {
  11456. for (var j = 0; j < pos.length; j += 1) {
  11457. var row = pos[i];
  11458. var col = pos[j];
  11459. if (_modules[row][col] != null) {
  11460. continue;
  11461. }
  11462. for (var r = -2; r <= 2; r += 1) {
  11463. for (var c = -2; c <= 2; c += 1) {
  11464. if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
  11465. _modules[row + r][col + c] = true;
  11466. } else {
  11467. _modules[row + r][col + c] = false;
  11468. }
  11469. }
  11470. }
  11471. }
  11472. }
  11473. };
  11474. var setupTypeNumber = function setupTypeNumber(test) {
  11475. var bits = QRUtil.getBCHTypeNumber(_typeNumber);
  11476. for (var i = 0; i < 18; i += 1) {
  11477. var mod = !test && (bits >> i & 1) == 1;
  11478. _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
  11479. }
  11480. for (var i = 0; i < 18; i += 1) {
  11481. var mod = !test && (bits >> i & 1) == 1;
  11482. _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
  11483. }
  11484. };
  11485. var setupTypeInfo = function setupTypeInfo(test, maskPattern) {
  11486. var data = _errorCorrectLevel << 3 | maskPattern;
  11487. var bits = QRUtil.getBCHTypeInfo(data);
  11488. // vertical
  11489. for (var i = 0; i < 15; i += 1) {
  11490. var mod = !test && (bits >> i & 1) == 1;
  11491. if (i < 6) {
  11492. _modules[i][8] = mod;
  11493. } else if (i < 8) {
  11494. _modules[i + 1][8] = mod;
  11495. } else {
  11496. _modules[_moduleCount - 15 + i][8] = mod;
  11497. }
  11498. }
  11499. // horizontal
  11500. for (var i = 0; i < 15; i += 1) {
  11501. var mod = !test && (bits >> i & 1) == 1;
  11502. if (i < 8) {
  11503. _modules[8][_moduleCount - i - 1] = mod;
  11504. } else if (i < 9) {
  11505. _modules[8][15 - i - 1 + 1] = mod;
  11506. } else {
  11507. _modules[8][15 - i - 1] = mod;
  11508. }
  11509. }
  11510. // fixed module
  11511. _modules[_moduleCount - 8][8] = !test;
  11512. };
  11513. var mapData = function mapData(data, maskPattern) {
  11514. var inc = -1;
  11515. var row = _moduleCount - 1;
  11516. var bitIndex = 7;
  11517. var byteIndex = 0;
  11518. var maskFunc = QRUtil.getMaskFunction(maskPattern);
  11519. for (var col = _moduleCount - 1; col > 0; col -= 2) {
  11520. if (col == 6) col -= 1;
  11521. while (true) {
  11522. for (var c = 0; c < 2; c += 1) {
  11523. if (_modules[row][col - c] == null) {
  11524. var dark = false;
  11525. if (byteIndex < data.length) {
  11526. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  11527. }
  11528. var mask = maskFunc(row, col - c);
  11529. if (mask) {
  11530. dark = !dark;
  11531. }
  11532. _modules[row][col - c] = dark;
  11533. bitIndex -= 1;
  11534. if (bitIndex == -1) {
  11535. byteIndex += 1;
  11536. bitIndex = 7;
  11537. }
  11538. }
  11539. }
  11540. row += inc;
  11541. if (row < 0 || _moduleCount <= row) {
  11542. row -= inc;
  11543. inc = -inc;
  11544. break;
  11545. }
  11546. }
  11547. }
  11548. };
  11549. var createBytes = function createBytes(buffer, rsBlocks) {
  11550. var offset = 0;
  11551. var maxDcCount = 0;
  11552. var maxEcCount = 0;
  11553. var dcdata = new Array(rsBlocks.length);
  11554. var ecdata = new Array(rsBlocks.length);
  11555. for (var r = 0; r < rsBlocks.length; r += 1) {
  11556. var dcCount = rsBlocks[r].dataCount;
  11557. var ecCount = rsBlocks[r].totalCount - dcCount;
  11558. maxDcCount = Math.max(maxDcCount, dcCount);
  11559. maxEcCount = Math.max(maxEcCount, ecCount);
  11560. dcdata[r] = new Array(dcCount);
  11561. for (var i = 0; i < dcdata[r].length; i += 1) {
  11562. dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
  11563. }
  11564. offset += dcCount;
  11565. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
  11566. var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
  11567. var modPoly = rawPoly.mod(rsPoly);
  11568. ecdata[r] = new Array(rsPoly.getLength() - 1);
  11569. for (var i = 0; i < ecdata[r].length; i += 1) {
  11570. var modIndex = i + modPoly.getLength() - ecdata[r].length;
  11571. ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
  11572. }
  11573. }
  11574. var totalCodeCount = 0;
  11575. for (var i = 0; i < rsBlocks.length; i += 1) {
  11576. totalCodeCount += rsBlocks[i].totalCount;
  11577. }
  11578. var data = new Array(totalCodeCount);
  11579. var index = 0;
  11580. for (var i = 0; i < maxDcCount; i += 1) {
  11581. for (var r = 0; r < rsBlocks.length; r += 1) {
  11582. if (i < dcdata[r].length) {
  11583. data[index] = dcdata[r][i];
  11584. index += 1;
  11585. }
  11586. }
  11587. }
  11588. for (var i = 0; i < maxEcCount; i += 1) {
  11589. for (var r = 0; r < rsBlocks.length; r += 1) {
  11590. if (i < ecdata[r].length) {
  11591. data[index] = ecdata[r][i];
  11592. index += 1;
  11593. }
  11594. }
  11595. }
  11596. return data;
  11597. };
  11598. var createData = function createData(typeNumber, errorCorrectLevel, dataList) {
  11599. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
  11600. var buffer = qrBitBuffer();
  11601. for (var i = 0; i < dataList.length; i += 1) {
  11602. var data = dataList[i];
  11603. buffer.put(data.getMode(), 4);
  11604. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber));
  11605. data.write(buffer);
  11606. }
  11607. // calc num max data.
  11608. var totalDataCount = 0;
  11609. for (var i = 0; i < rsBlocks.length; i += 1) {
  11610. totalDataCount += rsBlocks[i].dataCount;
  11611. }
  11612. if (buffer.getLengthInBits() > totalDataCount * 8) {
  11613. throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')');
  11614. }
  11615. // end code
  11616. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  11617. buffer.put(0, 4);
  11618. }
  11619. // padding
  11620. while (buffer.getLengthInBits() % 8 != 0) {
  11621. buffer.putBit(false);
  11622. }
  11623. // padding
  11624. while (true) {
  11625. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  11626. break;
  11627. }
  11628. buffer.put(PAD0, 8);
  11629. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  11630. break;
  11631. }
  11632. buffer.put(PAD1, 8);
  11633. }
  11634. return createBytes(buffer, rsBlocks);
  11635. };
  11636. _this.addData = function (data) {
  11637. var newData = qr8BitByte(data);
  11638. _dataList.push(newData);
  11639. _dataCache = null;
  11640. };
  11641. _this.isDark = function (row, col) {
  11642. if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
  11643. throw new Error(row + ',' + col);
  11644. }
  11645. return _modules[row][col];
  11646. };
  11647. _this.getModuleCount = function () {
  11648. return _moduleCount;
  11649. };
  11650. _this.make = function () {
  11651. makeImpl(false, getBestMaskPattern());
  11652. };
  11653. _this.createTableTag = function (cellSize, margin) {
  11654. cellSize = cellSize || 2;
  11655. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  11656. var qrHtml = '';
  11657. qrHtml += '<table style="';
  11658. qrHtml += ' border-width: 0px; border-style: none;';
  11659. qrHtml += ' border-collapse: collapse;';
  11660. qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
  11661. qrHtml += '">';
  11662. qrHtml += '<tbody>';
  11663. for (var r = 0; r < _this.getModuleCount(); r += 1) {
  11664. qrHtml += '<tr>';
  11665. for (var c = 0; c < _this.getModuleCount(); c += 1) {
  11666. qrHtml += '<td style="';
  11667. qrHtml += ' border-width: 0px; border-style: none;';
  11668. qrHtml += ' border-collapse: collapse;';
  11669. qrHtml += ' padding: 0px; margin: 0px;';
  11670. qrHtml += ' width: ' + cellSize + 'px;';
  11671. qrHtml += ' height: ' + cellSize + 'px;';
  11672. qrHtml += ' background-color: ';
  11673. qrHtml += _this.isDark(r, c) ? '#000000' : '#ffffff';
  11674. qrHtml += ';';
  11675. qrHtml += '"/>';
  11676. }
  11677. qrHtml += '</tr>';
  11678. }
  11679. qrHtml += '</tbody>';
  11680. qrHtml += '</table>';
  11681. return qrHtml;
  11682. };
  11683. _this.createImgTag = function (cellSize, margin, size) {
  11684. cellSize = cellSize || 2;
  11685. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  11686. var min = margin;
  11687. var max = _this.getModuleCount() * cellSize + margin;
  11688. return createImgTag(size, size, function (x, y) {
  11689. if (min <= x && x < max && min <= y && y < max) {
  11690. var c = Math.floor((x - min) / cellSize);
  11691. var r = Math.floor((y - min) / cellSize);
  11692. return _this.isDark(r, c) ? 0 : 1;
  11693. } else {
  11694. return 1;
  11695. }
  11696. });
  11697. };
  11698. return _this;
  11699. };
  11700. //---------------------------------------------------------------------
  11701. // qrcode.stringToBytes
  11702. //---------------------------------------------------------------------
  11703. qrcode.stringToBytes = function (s) {
  11704. var bytes = new Array();
  11705. for (var i = 0; i < s.length; i += 1) {
  11706. var c = s.charCodeAt(i);
  11707. bytes.push(c & 0xff);
  11708. }
  11709. return bytes;
  11710. };
  11711. //---------------------------------------------------------------------
  11712. // qrcode.createStringToBytes
  11713. //---------------------------------------------------------------------
  11714. /**
  11715. * @param unicodeData base64 string of byte array.
  11716. * [16bit Unicode],[16bit Bytes], ...
  11717. * @param numChars
  11718. */
  11719. qrcode.createStringToBytes = function (unicodeData, numChars) {
  11720. // create conversion map.
  11721. var unicodeMap = function () {
  11722. var bin = base64DecodeInputStream(unicodeData);
  11723. var read = function read() {
  11724. var b = bin.read();
  11725. if (b == -1) throw new Error();
  11726. return b;
  11727. };
  11728. var count = 0;
  11729. var unicodeMap = {};
  11730. while (true) {
  11731. var b0 = bin.read();
  11732. if (b0 == -1) break;
  11733. var b1 = read();
  11734. var b2 = read();
  11735. var b3 = read();
  11736. var k = String.fromCharCode(b0 << 8 | b1);
  11737. var v = b2 << 8 | b3;
  11738. unicodeMap[k] = v;
  11739. count += 1;
  11740. }
  11741. if (count != numChars) {
  11742. throw new Error(count + ' != ' + numChars);
  11743. }
  11744. return unicodeMap;
  11745. }();
  11746. var unknownChar = '?'.charCodeAt(0);
  11747. return function (s) {
  11748. var bytes = new Array();
  11749. for (var i = 0; i < s.length; i += 1) {
  11750. var c = s.charCodeAt(i);
  11751. if (c < 128) {
  11752. bytes.push(c);
  11753. } else {
  11754. var b = unicodeMap[s.charAt(i)];
  11755. if (typeof b == 'number') {
  11756. if ((b & 0xff) == b) {
  11757. // 1byte
  11758. bytes.push(b);
  11759. } else {
  11760. // 2bytes
  11761. bytes.push(b >>> 8);
  11762. bytes.push(b & 0xff);
  11763. }
  11764. } else {
  11765. bytes.push(unknownChar);
  11766. }
  11767. }
  11768. }
  11769. return bytes;
  11770. };
  11771. };
  11772. //---------------------------------------------------------------------
  11773. // QRMode
  11774. //---------------------------------------------------------------------
  11775. var QRMode = {
  11776. MODE_NUMBER: 1 << 0,
  11777. MODE_ALPHA_NUM: 1 << 1,
  11778. MODE_8BIT_BYTE: 1 << 2,
  11779. MODE_KANJI: 1 << 3
  11780. };
  11781. //---------------------------------------------------------------------
  11782. // QRErrorCorrectLevel
  11783. //---------------------------------------------------------------------
  11784. var QRErrorCorrectLevel = {
  11785. L: 1,
  11786. M: 0,
  11787. Q: 3,
  11788. H: 2
  11789. };
  11790. //---------------------------------------------------------------------
  11791. // QRMaskPattern
  11792. //---------------------------------------------------------------------
  11793. var QRMaskPattern = {
  11794. PATTERN000: 0,
  11795. PATTERN001: 1,
  11796. PATTERN010: 2,
  11797. PATTERN011: 3,
  11798. PATTERN100: 4,
  11799. PATTERN101: 5,
  11800. PATTERN110: 6,
  11801. PATTERN111: 7
  11802. };
  11803. //---------------------------------------------------------------------
  11804. // QRUtil
  11805. //---------------------------------------------------------------------
  11806. var QRUtil = function () {
  11807. var PATTERN_POSITION_TABLE = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]];
  11808. var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
  11809. var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
  11810. var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
  11811. var _this = {};
  11812. var getBCHDigit = function getBCHDigit(data) {
  11813. var digit = 0;
  11814. while (data != 0) {
  11815. digit += 1;
  11816. data >>>= 1;
  11817. }
  11818. return digit;
  11819. };
  11820. _this.getBCHTypeInfo = function (data) {
  11821. var d = data << 10;
  11822. while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
  11823. d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
  11824. }
  11825. return (data << 10 | d) ^ G15_MASK;
  11826. };
  11827. _this.getBCHTypeNumber = function (data) {
  11828. var d = data << 12;
  11829. while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
  11830. d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
  11831. }
  11832. return data << 12 | d;
  11833. };
  11834. _this.getPatternPosition = function (typeNumber) {
  11835. return PATTERN_POSITION_TABLE[typeNumber - 1];
  11836. };
  11837. _this.getMaskFunction = function (maskPattern) {
  11838. switch (maskPattern) {
  11839. case QRMaskPattern.PATTERN000:
  11840. return function (i, j) {
  11841. return (i + j) % 2 == 0;
  11842. };
  11843. case QRMaskPattern.PATTERN001:
  11844. return function (i, j) {
  11845. return i % 2 == 0;
  11846. };
  11847. case QRMaskPattern.PATTERN010:
  11848. return function (i, j) {
  11849. return j % 3 == 0;
  11850. };
  11851. case QRMaskPattern.PATTERN011:
  11852. return function (i, j) {
  11853. return (i + j) % 3 == 0;
  11854. };
  11855. case QRMaskPattern.PATTERN100:
  11856. return function (i, j) {
  11857. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  11858. };
  11859. case QRMaskPattern.PATTERN101:
  11860. return function (i, j) {
  11861. return i * j % 2 + i * j % 3 == 0;
  11862. };
  11863. case QRMaskPattern.PATTERN110:
  11864. return function (i, j) {
  11865. return (i * j % 2 + i * j % 3) % 2 == 0;
  11866. };
  11867. case QRMaskPattern.PATTERN111:
  11868. return function (i, j) {
  11869. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  11870. };
  11871. default:
  11872. throw new Error('bad maskPattern:' + maskPattern);
  11873. }
  11874. };
  11875. _this.getErrorCorrectPolynomial = function (errorCorrectLength) {
  11876. var a = qrPolynomial([1], 0);
  11877. for (var i = 0; i < errorCorrectLength; i += 1) {
  11878. a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
  11879. }
  11880. return a;
  11881. };
  11882. _this.getLengthInBits = function (mode, type) {
  11883. if (1 <= type && type < 10) {
  11884. // 1 - 9
  11885. switch (mode) {
  11886. case QRMode.MODE_NUMBER:
  11887. return 10;
  11888. case QRMode.MODE_ALPHA_NUM:
  11889. return 9;
  11890. case QRMode.MODE_8BIT_BYTE:
  11891. return 8;
  11892. case QRMode.MODE_KANJI:
  11893. return 8;
  11894. default:
  11895. throw new Error('mode:' + mode);
  11896. }
  11897. } else if (type < 27) {
  11898. // 10 - 26
  11899. switch (mode) {
  11900. case QRMode.MODE_NUMBER:
  11901. return 12;
  11902. case QRMode.MODE_ALPHA_NUM:
  11903. return 11;
  11904. case QRMode.MODE_8BIT_BYTE:
  11905. return 16;
  11906. case QRMode.MODE_KANJI:
  11907. return 10;
  11908. default:
  11909. throw new Error('mode:' + mode);
  11910. }
  11911. } else if (type < 41) {
  11912. // 27 - 40
  11913. switch (mode) {
  11914. case QRMode.MODE_NUMBER:
  11915. return 14;
  11916. case QRMode.MODE_ALPHA_NUM:
  11917. return 13;
  11918. case QRMode.MODE_8BIT_BYTE:
  11919. return 16;
  11920. case QRMode.MODE_KANJI:
  11921. return 12;
  11922. default:
  11923. throw new Error('mode:' + mode);
  11924. }
  11925. } else {
  11926. throw new Error('type:' + type);
  11927. }
  11928. };
  11929. _this.getLostPoint = function (qrcode) {
  11930. var moduleCount = qrcode.getModuleCount();
  11931. var lostPoint = 0;
  11932. // LEVEL1
  11933. for (var row = 0; row < moduleCount; row += 1) {
  11934. for (var col = 0; col < moduleCount; col += 1) {
  11935. var sameCount = 0;
  11936. var dark = qrcode.isDark(row, col);
  11937. for (var r = -1; r <= 1; r += 1) {
  11938. if (row + r < 0 || moduleCount <= row + r) {
  11939. continue;
  11940. }
  11941. for (var c = -1; c <= 1; c += 1) {
  11942. if (col + c < 0 || moduleCount <= col + c) {
  11943. continue;
  11944. }
  11945. if (r == 0 && c == 0) {
  11946. continue;
  11947. }
  11948. if (dark == qrcode.isDark(row + r, col + c)) {
  11949. sameCount += 1;
  11950. }
  11951. }
  11952. }
  11953. if (sameCount > 5) {
  11954. lostPoint += 3 + sameCount - 5;
  11955. }
  11956. }
  11957. }
  11958. ;
  11959. // LEVEL2
  11960. for (var row = 0; row < moduleCount - 1; row += 1) {
  11961. for (var col = 0; col < moduleCount - 1; col += 1) {
  11962. var count = 0;
  11963. if (qrcode.isDark(row, col)) count += 1;
  11964. if (qrcode.isDark(row + 1, col)) count += 1;
  11965. if (qrcode.isDark(row, col + 1)) count += 1;
  11966. if (qrcode.isDark(row + 1, col + 1)) count += 1;
  11967. if (count == 0 || count == 4) {
  11968. lostPoint += 3;
  11969. }
  11970. }
  11971. }
  11972. // LEVEL3
  11973. for (var row = 0; row < moduleCount; row += 1) {
  11974. for (var col = 0; col < moduleCount - 6; col += 1) {
  11975. if (qrcode.isDark(row, col) && !qrcode.isDark(row, col + 1) && qrcode.isDark(row, col + 2) && qrcode.isDark(row, col + 3) && qrcode.isDark(row, col + 4) && !qrcode.isDark(row, col + 5) && qrcode.isDark(row, col + 6)) {
  11976. lostPoint += 40;
  11977. }
  11978. }
  11979. }
  11980. for (var col = 0; col < moduleCount; col += 1) {
  11981. for (var row = 0; row < moduleCount - 6; row += 1) {
  11982. if (qrcode.isDark(row, col) && !qrcode.isDark(row + 1, col) && qrcode.isDark(row + 2, col) && qrcode.isDark(row + 3, col) && qrcode.isDark(row + 4, col) && !qrcode.isDark(row + 5, col) && qrcode.isDark(row + 6, col)) {
  11983. lostPoint += 40;
  11984. }
  11985. }
  11986. }
  11987. // LEVEL4
  11988. var darkCount = 0;
  11989. for (var col = 0; col < moduleCount; col += 1) {
  11990. for (var row = 0; row < moduleCount; row += 1) {
  11991. if (qrcode.isDark(row, col)) {
  11992. darkCount += 1;
  11993. }
  11994. }
  11995. }
  11996. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  11997. lostPoint += ratio * 10;
  11998. return lostPoint;
  11999. };
  12000. return _this;
  12001. }();
  12002. //---------------------------------------------------------------------
  12003. // QRMath
  12004. //---------------------------------------------------------------------
  12005. var QRMath = function () {
  12006. var EXP_TABLE = new Array(256);
  12007. var LOG_TABLE = new Array(256);
  12008. // initialize tables
  12009. for (var i = 0; i < 8; i += 1) {
  12010. EXP_TABLE[i] = 1 << i;
  12011. }
  12012. for (var i = 8; i < 256; i += 1) {
  12013. EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
  12014. }
  12015. for (var i = 0; i < 255; i += 1) {
  12016. LOG_TABLE[EXP_TABLE[i]] = i;
  12017. }
  12018. var _this = {};
  12019. _this.glog = function (n) {
  12020. if (n < 1) {
  12021. throw new Error('glog(' + n + ')');
  12022. }
  12023. return LOG_TABLE[n];
  12024. };
  12025. _this.gexp = function (n) {
  12026. while (n < 0) {
  12027. n += 255;
  12028. }
  12029. while (n >= 256) {
  12030. n -= 255;
  12031. }
  12032. return EXP_TABLE[n];
  12033. };
  12034. return _this;
  12035. }();
  12036. //---------------------------------------------------------------------
  12037. // qrPolynomial
  12038. //---------------------------------------------------------------------
  12039. function qrPolynomial(num, shift) {
  12040. if (typeof num.length == 'undefined') {
  12041. throw new Error(num.length + '/' + shift);
  12042. }
  12043. var _num = function () {
  12044. var offset = 0;
  12045. while (offset < num.length && num[offset] == 0) {
  12046. offset += 1;
  12047. }
  12048. var _num = new Array(num.length - offset + shift);
  12049. for (var i = 0; i < num.length - offset; i += 1) {
  12050. _num[i] = num[i + offset];
  12051. }
  12052. return _num;
  12053. }();
  12054. var _this = {};
  12055. _this.getAt = function (index) {
  12056. return _num[index];
  12057. };
  12058. _this.getLength = function () {
  12059. return _num.length;
  12060. };
  12061. _this.multiply = function (e) {
  12062. var num = new Array(_this.getLength() + e.getLength() - 1);
  12063. for (var i = 0; i < _this.getLength(); i += 1) {
  12064. for (var j = 0; j < e.getLength(); j += 1) {
  12065. num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
  12066. }
  12067. }
  12068. return qrPolynomial(num, 0);
  12069. };
  12070. _this.mod = function (e) {
  12071. if (_this.getLength() - e.getLength() < 0) {
  12072. return _this;
  12073. }
  12074. var ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
  12075. var num = new Array(_this.getLength());
  12076. for (var i = 0; i < _this.getLength(); i += 1) {
  12077. num[i] = _this.getAt(i);
  12078. }
  12079. for (var i = 0; i < e.getLength(); i += 1) {
  12080. num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
  12081. }
  12082. // recursive call
  12083. return qrPolynomial(num, 0).mod(e);
  12084. };
  12085. return _this;
  12086. }
  12087. ;
  12088. //---------------------------------------------------------------------
  12089. // QRRSBlock
  12090. //---------------------------------------------------------------------
  12091. var QRRSBlock = function () {
  12092. // [1: [L, M, Q, H], ..]
  12093. var RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
  12094. var qrRSBlock = function qrRSBlock(totalCount, dataCount) {
  12095. var _this = {};
  12096. _this.totalCount = totalCount;
  12097. _this.dataCount = dataCount;
  12098. return _this;
  12099. };
  12100. var _this = {};
  12101. var getRsBlockTable = function getRsBlockTable(typeNumber, errorCorrectLevel) {
  12102. switch (errorCorrectLevel) {
  12103. case QRErrorCorrectLevel.L:
  12104. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
  12105. case QRErrorCorrectLevel.M:
  12106. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  12107. case QRErrorCorrectLevel.Q:
  12108. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  12109. case QRErrorCorrectLevel.H:
  12110. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  12111. default:
  12112. return undefined;
  12113. }
  12114. };
  12115. _this.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  12116. var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
  12117. if (typeof rsBlock == 'undefined') {
  12118. throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel);
  12119. }
  12120. var length = rsBlock.length / 3;
  12121. var list = new Array();
  12122. for (var i = 0; i < length; i += 1) {
  12123. var count = rsBlock[i * 3 + 0];
  12124. var totalCount = rsBlock[i * 3 + 1];
  12125. var dataCount = rsBlock[i * 3 + 2];
  12126. for (var j = 0; j < count; j += 1) {
  12127. list.push(qrRSBlock(totalCount, dataCount));
  12128. }
  12129. }
  12130. return list;
  12131. };
  12132. return _this;
  12133. }();
  12134. //---------------------------------------------------------------------
  12135. // qrBitBuffer
  12136. //---------------------------------------------------------------------
  12137. var qrBitBuffer = function qrBitBuffer() {
  12138. var _buffer = new Array();
  12139. var _length = 0;
  12140. var _this = {};
  12141. _this.getBuffer = function () {
  12142. return _buffer;
  12143. };
  12144. _this.getAt = function (index) {
  12145. var bufIndex = Math.floor(index / 8);
  12146. return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  12147. };
  12148. _this.put = function (num, length) {
  12149. for (var i = 0; i < length; i += 1) {
  12150. _this.putBit((num >>> length - i - 1 & 1) == 1);
  12151. }
  12152. };
  12153. _this.getLengthInBits = function () {
  12154. return _length;
  12155. };
  12156. _this.putBit = function (bit) {
  12157. var bufIndex = Math.floor(_length / 8);
  12158. if (_buffer.length <= bufIndex) {
  12159. _buffer.push(0);
  12160. }
  12161. if (bit) {
  12162. _buffer[bufIndex] |= 0x80 >>> _length % 8;
  12163. }
  12164. _length += 1;
  12165. };
  12166. return _this;
  12167. };
  12168. //---------------------------------------------------------------------
  12169. // qr8BitByte
  12170. //---------------------------------------------------------------------
  12171. var qr8BitByte = function qr8BitByte(data) {
  12172. var _mode = QRMode.MODE_8BIT_BYTE;
  12173. var _data = data;
  12174. var _parsedData = [];
  12175. var _this = {};
  12176. // Added to support UTF-8 Characters
  12177. for (var i = 0, l = _data.length; i < l; i++) {
  12178. var byteArray = [];
  12179. var code = _data.charCodeAt(i);
  12180. if (code > 0x10000) {
  12181. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  12182. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  12183. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  12184. byteArray[3] = 0x80 | code & 0x3F;
  12185. } else if (code > 0x800) {
  12186. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  12187. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  12188. byteArray[2] = 0x80 | code & 0x3F;
  12189. } else if (code > 0x80) {
  12190. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  12191. byteArray[1] = 0x80 | code & 0x3F;
  12192. } else {
  12193. byteArray[0] = code;
  12194. }
  12195. // Fix Unicode corruption bug
  12196. _parsedData.push(byteArray);
  12197. }
  12198. _parsedData = Array.prototype.concat.apply([], _parsedData);
  12199. if (_parsedData.length != _data.length) {
  12200. _parsedData.unshift(191);
  12201. _parsedData.unshift(187);
  12202. _parsedData.unshift(239);
  12203. }
  12204. var _bytes = _parsedData;
  12205. _this.getMode = function () {
  12206. return _mode;
  12207. };
  12208. _this.getLength = function (buffer) {
  12209. return _bytes.length;
  12210. };
  12211. _this.write = function (buffer) {
  12212. for (var i = 0; i < _bytes.length; i += 1) {
  12213. buffer.put(_bytes[i], 8);
  12214. }
  12215. };
  12216. return _this;
  12217. };
  12218. //=====================================================================
  12219. // GIF Support etc.
  12220. //
  12221. //---------------------------------------------------------------------
  12222. // byteArrayOutputStream
  12223. //---------------------------------------------------------------------
  12224. var byteArrayOutputStream = function byteArrayOutputStream() {
  12225. var _bytes = new Array();
  12226. var _this = {};
  12227. _this.writeByte = function (b) {
  12228. _bytes.push(b & 0xff);
  12229. };
  12230. _this.writeShort = function (i) {
  12231. _this.writeByte(i);
  12232. _this.writeByte(i >>> 8);
  12233. };
  12234. _this.writeBytes = function (b, off, len) {
  12235. off = off || 0;
  12236. len = len || b.length;
  12237. for (var i = 0; i < len; i += 1) {
  12238. _this.writeByte(b[i + off]);
  12239. }
  12240. };
  12241. _this.writeString = function (s) {
  12242. for (var i = 0; i < s.length; i += 1) {
  12243. _this.writeByte(s.charCodeAt(i));
  12244. }
  12245. };
  12246. _this.toByteArray = function () {
  12247. return _bytes;
  12248. };
  12249. _this.toString = function () {
  12250. var s = '';
  12251. s += '[';
  12252. for (var i = 0; i < _bytes.length; i += 1) {
  12253. if (i > 0) {
  12254. s += ',';
  12255. }
  12256. s += _bytes[i];
  12257. }
  12258. s += ']';
  12259. return s;
  12260. };
  12261. return _this;
  12262. };
  12263. //---------------------------------------------------------------------
  12264. // base64EncodeOutputStream
  12265. //---------------------------------------------------------------------
  12266. var base64EncodeOutputStream = function base64EncodeOutputStream() {
  12267. var _buffer = 0;
  12268. var _buflen = 0;
  12269. var _length = 0;
  12270. var _base64 = '';
  12271. var _this = {};
  12272. var writeEncoded = function writeEncoded(b) {
  12273. _base64 += String.fromCharCode(encode(b & 0x3f));
  12274. };
  12275. var encode = function encode(n) {
  12276. if (n < 0) {
  12277. // error.
  12278. } else if (n < 26) {
  12279. return 0x41 + n;
  12280. } else if (n < 52) {
  12281. return 0x61 + (n - 26);
  12282. } else if (n < 62) {
  12283. return 0x30 + (n - 52);
  12284. } else if (n == 62) {
  12285. return 0x2b;
  12286. } else if (n == 63) {
  12287. return 0x2f;
  12288. }
  12289. throw new Error('n:' + n);
  12290. };
  12291. _this.writeByte = function (n) {
  12292. _buffer = _buffer << 8 | n & 0xff;
  12293. _buflen += 8;
  12294. _length += 1;
  12295. while (_buflen >= 6) {
  12296. writeEncoded(_buffer >>> _buflen - 6);
  12297. _buflen -= 6;
  12298. }
  12299. };
  12300. _this.flush = function () {
  12301. if (_buflen > 0) {
  12302. writeEncoded(_buffer << 6 - _buflen);
  12303. _buffer = 0;
  12304. _buflen = 0;
  12305. }
  12306. if (_length % 3 != 0) {
  12307. // padding
  12308. var padlen = 3 - _length % 3;
  12309. for (var i = 0; i < padlen; i += 1) {
  12310. _base64 += '=';
  12311. }
  12312. }
  12313. };
  12314. _this.toString = function () {
  12315. return _base64;
  12316. };
  12317. return _this;
  12318. };
  12319. //---------------------------------------------------------------------
  12320. // base64DecodeInputStream
  12321. //---------------------------------------------------------------------
  12322. var base64DecodeInputStream = function base64DecodeInputStream(str) {
  12323. var _str = str;
  12324. var _pos = 0;
  12325. var _buffer = 0;
  12326. var _buflen = 0;
  12327. var _this = {};
  12328. _this.read = function () {
  12329. while (_buflen < 8) {
  12330. if (_pos >= _str.length) {
  12331. if (_buflen == 0) {
  12332. return -1;
  12333. }
  12334. throw new Error('unexpected end of file./' + _buflen);
  12335. }
  12336. var c = _str.charAt(_pos);
  12337. _pos += 1;
  12338. if (c == '=') {
  12339. _buflen = 0;
  12340. return -1;
  12341. } else if (c.match(/^\s$/)) {
  12342. // ignore if whitespace.
  12343. continue;
  12344. }
  12345. _buffer = _buffer << 6 | decode(c.charCodeAt(0));
  12346. _buflen += 6;
  12347. }
  12348. var n = _buffer >>> _buflen - 8 & 0xff;
  12349. _buflen -= 8;
  12350. return n;
  12351. };
  12352. var decode = function decode(c) {
  12353. if (0x41 <= c && c <= 0x5a) {
  12354. return c - 0x41;
  12355. } else if (0x61 <= c && c <= 0x7a) {
  12356. return c - 0x61 + 26;
  12357. } else if (0x30 <= c && c <= 0x39) {
  12358. return c - 0x30 + 52;
  12359. } else if (c == 0x2b) {
  12360. return 62;
  12361. } else if (c == 0x2f) {
  12362. return 63;
  12363. } else {
  12364. throw new Error('c:' + c);
  12365. }
  12366. };
  12367. return _this;
  12368. };
  12369. //---------------------------------------------------------------------
  12370. // gifImage (B/W)
  12371. //---------------------------------------------------------------------
  12372. var gifImage = function gifImage(width, height) {
  12373. var _width = width;
  12374. var _height = height;
  12375. var _data = new Array(width * height);
  12376. var _this = {};
  12377. _this.setPixel = function (x, y, pixel) {
  12378. _data[y * _width + x] = pixel;
  12379. };
  12380. _this.write = function (out) {
  12381. //---------------------------------
  12382. // GIF Signature
  12383. out.writeString('GIF87a');
  12384. //---------------------------------
  12385. // Screen Descriptor
  12386. out.writeShort(_width);
  12387. out.writeShort(_height);
  12388. out.writeByte(0x80); // 2bit
  12389. out.writeByte(0);
  12390. out.writeByte(0);
  12391. //---------------------------------
  12392. // Global Color Map
  12393. // black
  12394. out.writeByte(0x00);
  12395. out.writeByte(0x00);
  12396. out.writeByte(0x00);
  12397. // white
  12398. out.writeByte(0xff);
  12399. out.writeByte(0xff);
  12400. out.writeByte(0xff);
  12401. //---------------------------------
  12402. // Image Descriptor
  12403. out.writeString(',');
  12404. out.writeShort(0);
  12405. out.writeShort(0);
  12406. out.writeShort(_width);
  12407. out.writeShort(_height);
  12408. out.writeByte(0);
  12409. //---------------------------------
  12410. // Local Color Map
  12411. //---------------------------------
  12412. // Raster Data
  12413. var lzwMinCodeSize = 2;
  12414. var raster = getLZWRaster(lzwMinCodeSize);
  12415. out.writeByte(lzwMinCodeSize);
  12416. var offset = 0;
  12417. while (raster.length - offset > 255) {
  12418. out.writeByte(255);
  12419. out.writeBytes(raster, offset, 255);
  12420. offset += 255;
  12421. }
  12422. out.writeByte(raster.length - offset);
  12423. out.writeBytes(raster, offset, raster.length - offset);
  12424. out.writeByte(0x00);
  12425. //---------------------------------
  12426. // GIF Terminator
  12427. out.writeString(';');
  12428. };
  12429. var bitOutputStream = function bitOutputStream(out) {
  12430. var _out = out;
  12431. var _bitLength = 0;
  12432. var _bitBuffer = 0;
  12433. var _this = {};
  12434. _this.write = function (data, length) {
  12435. if (data >>> length != 0) {
  12436. throw new Error('length over');
  12437. }
  12438. while (_bitLength + length >= 8) {
  12439. _out.writeByte(0xff & (data << _bitLength | _bitBuffer));
  12440. length -= 8 - _bitLength;
  12441. data >>>= 8 - _bitLength;
  12442. _bitBuffer = 0;
  12443. _bitLength = 0;
  12444. }
  12445. _bitBuffer = data << _bitLength | _bitBuffer;
  12446. _bitLength = _bitLength + length;
  12447. };
  12448. _this.flush = function () {
  12449. if (_bitLength > 0) {
  12450. _out.writeByte(_bitBuffer);
  12451. }
  12452. };
  12453. return _this;
  12454. };
  12455. var getLZWRaster = function getLZWRaster(lzwMinCodeSize) {
  12456. var clearCode = 1 << lzwMinCodeSize;
  12457. var endCode = (1 << lzwMinCodeSize) + 1;
  12458. var bitLength = lzwMinCodeSize + 1;
  12459. // Setup LZWTable
  12460. var table = lzwTable();
  12461. for (var i = 0; i < clearCode; i += 1) {
  12462. table.add(String.fromCharCode(i));
  12463. }
  12464. table.add(String.fromCharCode(clearCode));
  12465. table.add(String.fromCharCode(endCode));
  12466. var byteOut = byteArrayOutputStream();
  12467. var bitOut = bitOutputStream(byteOut);
  12468. // clear code
  12469. bitOut.write(clearCode, bitLength);
  12470. var dataIndex = 0;
  12471. var s = String.fromCharCode(_data[dataIndex]);
  12472. dataIndex += 1;
  12473. while (dataIndex < _data.length) {
  12474. var c = String.fromCharCode(_data[dataIndex]);
  12475. dataIndex += 1;
  12476. if (table.contains(s + c)) {
  12477. s = s + c;
  12478. } else {
  12479. bitOut.write(table.indexOf(s), bitLength);
  12480. if (table.size() < 0xfff) {
  12481. if (table.size() == 1 << bitLength) {
  12482. bitLength += 1;
  12483. }
  12484. table.add(s + c);
  12485. }
  12486. s = c;
  12487. }
  12488. }
  12489. bitOut.write(table.indexOf(s), bitLength);
  12490. // end code
  12491. bitOut.write(endCode, bitLength);
  12492. bitOut.flush();
  12493. return byteOut.toByteArray();
  12494. };
  12495. var lzwTable = function lzwTable() {
  12496. var _map = {};
  12497. var _size = 0;
  12498. var _this = {};
  12499. _this.add = function (key) {
  12500. if (_this.contains(key)) {
  12501. throw new Error('dup key:' + key);
  12502. }
  12503. _map[key] = _size;
  12504. _size += 1;
  12505. };
  12506. _this.size = function () {
  12507. return _size;
  12508. };
  12509. _this.indexOf = function (key) {
  12510. return _map[key];
  12511. };
  12512. _this.contains = function (key) {
  12513. return typeof _map[key] != 'undefined';
  12514. };
  12515. return _this;
  12516. };
  12517. return _this;
  12518. };
  12519. var createImgTag = function createImgTag(width, height, getPixel, alt) {
  12520. var gif = gifImage(width, height);
  12521. for (var y = 0; y < height; y += 1) {
  12522. for (var x = 0; x < width; x += 1) {
  12523. gif.setPixel(x, y, getPixel(x, y));
  12524. }
  12525. }
  12526. var b = byteArrayOutputStream();
  12527. gif.write(b);
  12528. var base64 = base64EncodeOutputStream();
  12529. var bytes = b.toByteArray();
  12530. for (var i = 0; i < bytes.length; i += 1) {
  12531. base64.writeByte(bytes[i]);
  12532. }
  12533. base64.flush();
  12534. var img = '';
  12535. img += 'data:image/gif;base64,';
  12536. img += base64;
  12537. return img;
  12538. };
  12539. //---------------------------------------------------------------------
  12540. // returns qrcode function.
  12541. var createQrCodeImg = function createQrCodeImg(text, options) {
  12542. options = options || {};
  12543. var typeNumber = options.typeNumber || 4;
  12544. var errorCorrectLevel = options.errorCorrectLevel || 'M';
  12545. var size = options.size || 500;
  12546. var qr;
  12547. try {
  12548. qr = qrcode(typeNumber, errorCorrectLevel || 'M');
  12549. qr.addData(text);
  12550. qr.make();
  12551. } catch (e) {
  12552. if (typeNumber >= 40) {
  12553. throw new Error('Text too long to encode');
  12554. } else {
  12555. return createQrCodeImg(text, {
  12556. size: size,
  12557. errorCorrectLevel: errorCorrectLevel,
  12558. typeNumber: typeNumber + 1
  12559. });
  12560. }
  12561. }
  12562. // calc cellsize and margin
  12563. var cellsize = parseInt(size / qr.getModuleCount());
  12564. var margin = parseInt((size - qr.getModuleCount() * cellsize) / 2);
  12565. return qr.createImgTag(cellsize, margin, size);
  12566. };
  12567. module.exports = {
  12568. create: createQrCodeImg
  12569. };
  12570. /***/ }),
  12571. /***/ 49:
  12572. /*!***********************************************************************!*\
  12573. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/bmap-wx.js ***!
  12574. \***********************************************************************/
  12575. /*! no static exports found */
  12576. /***/ (function(module, exports, __webpack_require__) {
  12577. /* WEBPACK VAR INJECTION */(function(wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  12578. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  12579. /**
  12580. * @file 微信小程序JSAPI
  12581. * @author 崔健 cuijian03@baidu.com 2017.01.10
  12582. * @update 邓淑芳 623996689@qq.com 2019.07.03
  12583. */
  12584. /**
  12585. * 百度地图微信小程序API类
  12586. *
  12587. * @class
  12588. */
  12589. var BMapWX = /*#__PURE__*/function () {
  12590. "use strict";
  12591. /**
  12592. * 百度地图微信小程序API类
  12593. *
  12594. * @constructor
  12595. */
  12596. function BMapWX(param) {
  12597. _classCallCheck(this, BMapWX);
  12598. this.ak = param["ak"];
  12599. }
  12600. /**
  12601. * 使用微信接口进行定位
  12602. *
  12603. * @param {string} type 坐标类型
  12604. * @param {Function} success 成功执行
  12605. * @param {Function} fail 失败执行
  12606. * @param {Function} complete 完成后执行
  12607. */
  12608. _createClass(BMapWX, [{
  12609. key: "getWXLocation",
  12610. value: function getWXLocation(type, success, fail, complete) {
  12611. type = type || 'gcj02', success = success || function () {};
  12612. fail = fail || function () {};
  12613. complete = complete || function () {};
  12614. wx.getLocation({
  12615. type: type,
  12616. success: success,
  12617. fail: fail,
  12618. complete: complete
  12619. });
  12620. }
  12621. /**
  12622. * POI周边检索
  12623. *
  12624. * @param {Object} param 检索配置
  12625. * 参数对象结构可以参考
  12626. * http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi
  12627. */
  12628. }, {
  12629. key: "search",
  12630. value: function search(param) {
  12631. var that = this;
  12632. param = param || {};
  12633. var searchparam = {
  12634. query: param["query"] || '生活服务$美食&酒店',
  12635. scope: param["scope"] || 1,
  12636. filter: param["filter"] || '',
  12637. coord_type: param["coord_type"] || 2,
  12638. page_size: param["page_size"] || 10,
  12639. page_num: param["page_num"] || 0,
  12640. output: param["output"] || 'json',
  12641. ak: that.ak,
  12642. sn: param["sn"] || '',
  12643. timestamp: param["timestamp"] || '',
  12644. radius: param["radius"] || 2000,
  12645. ret_coordtype: 'gcj02ll'
  12646. };
  12647. var otherparam = {
  12648. iconPath: param["iconPath"],
  12649. iconTapPath: param["iconTapPath"],
  12650. width: param["width"],
  12651. height: param["height"],
  12652. alpha: param["alpha"] || 1,
  12653. success: param["success"] || function () {},
  12654. fail: param["fail"] || function () {}
  12655. };
  12656. var type = 'gcj02';
  12657. var locationsuccess = function locationsuccess(result) {
  12658. searchparam["location"] = result["latitude"] + ',' + result["longitude"];
  12659. wx.request({
  12660. url: 'https://api.map.baidu.com/place/v2/search',
  12661. data: searchparam,
  12662. header: {
  12663. "content-type": "application/json"
  12664. },
  12665. method: 'GET',
  12666. success: function success(data) {
  12667. var res = data["data"];
  12668. if (res["status"] === 0) {
  12669. var poiArr = res["results"];
  12670. // outputRes 包含两个对象,
  12671. // originalData为百度接口返回的原始数据
  12672. // wxMarkerData为小程序规范的marker格式
  12673. var outputRes = {};
  12674. outputRes["originalData"] = res;
  12675. outputRes["wxMarkerData"] = [];
  12676. for (var i = 0; i < poiArr.length; i++) {
  12677. outputRes["wxMarkerData"][i] = {
  12678. id: i,
  12679. latitude: poiArr[i]["location"]["lat"],
  12680. longitude: poiArr[i]["location"]["lng"],
  12681. title: poiArr[i]["name"],
  12682. iconPath: otherparam["iconPath"],
  12683. iconTapPath: otherparam["iconTapPath"],
  12684. address: poiArr[i]["address"],
  12685. telephone: poiArr[i]["telephone"],
  12686. alpha: otherparam["alpha"],
  12687. width: otherparam["width"],
  12688. height: otherparam["height"]
  12689. };
  12690. }
  12691. otherparam.success(outputRes);
  12692. } else {
  12693. otherparam.fail({
  12694. errMsg: res["message"],
  12695. statusCode: res["status"]
  12696. });
  12697. }
  12698. },
  12699. fail: function fail(data) {
  12700. otherparam.fail(data);
  12701. }
  12702. });
  12703. };
  12704. var locationfail = function locationfail(result) {
  12705. otherparam.fail(result);
  12706. };
  12707. var locationcomplete = function locationcomplete(result) {};
  12708. if (!param["location"]) {
  12709. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12710. } else {
  12711. var longitude = param.location.split(',')[1];
  12712. var latitude = param.location.split(',')[0];
  12713. var errMsg = 'input location';
  12714. var res = {
  12715. errMsg: errMsg,
  12716. latitude: latitude,
  12717. longitude: longitude
  12718. };
  12719. locationsuccess(res);
  12720. }
  12721. }
  12722. /**
  12723. * sug模糊检索
  12724. *
  12725. * @param {Object} param 检索配置
  12726. * 参数对象结构可以参考
  12727. * http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api
  12728. */
  12729. }, {
  12730. key: "suggestion",
  12731. value: function suggestion(param) {
  12732. var that = this;
  12733. param = param || {};
  12734. var suggestionparam = {
  12735. query: param["query"] || '',
  12736. region: param["region"] || '全国',
  12737. city_limit: param["city_limit"] || false,
  12738. output: param["output"] || 'json',
  12739. ak: that.ak,
  12740. sn: param["sn"] || '',
  12741. timestamp: param["timestamp"] || '',
  12742. ret_coordtype: 'gcj02ll'
  12743. };
  12744. var otherparam = {
  12745. success: param["success"] || function () {},
  12746. fail: param["fail"] || function () {}
  12747. };
  12748. wx.request({
  12749. url: 'https://api.map.baidu.com/place/v2/suggestion',
  12750. data: suggestionparam,
  12751. header: {
  12752. "content-type": "application/json"
  12753. },
  12754. method: 'GET',
  12755. success: function success(data) {
  12756. var res = data["data"];
  12757. if (res["status"] === 0) {
  12758. otherparam.success(res);
  12759. } else {
  12760. otherparam.fail({
  12761. errMsg: res["message"],
  12762. statusCode: res["status"]
  12763. });
  12764. }
  12765. },
  12766. fail: function fail(data) {
  12767. otherparam.fail(data);
  12768. }
  12769. });
  12770. }
  12771. /**
  12772. * rgc检索(逆地理编码:经纬度->地点描述)
  12773. *
  12774. * @param {Object} param 检索配置
  12775. * 参数对象结构可以参考
  12776. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad
  12777. *
  12778. */
  12779. }, {
  12780. key: "regeocoding",
  12781. value: function regeocoding(param) {
  12782. var that = this;
  12783. param = param || {};
  12784. var regeocodingparam = {
  12785. coordtype: param["coordtype"] || 'gcj02ll',
  12786. ret_coordtype: 'gcj02ll',
  12787. radius: param["radius"] || 1000,
  12788. ak: that.ak,
  12789. sn: param["sn"] || '',
  12790. output: param["output"] || 'json',
  12791. callback: param["callback"] || function () {},
  12792. extensions_poi: param["extensions_poi"] || 1,
  12793. extensions_road: param["extensions_road"] || false,
  12794. extensions_town: param["extensions_town"] || false,
  12795. language: param["language"] || 'zh-CN',
  12796. language_auto: param["language_auto"] || 0
  12797. };
  12798. var otherparam = {
  12799. iconPath: param["iconPath"],
  12800. iconTapPath: param["iconTapPath"],
  12801. width: param["width"],
  12802. height: param["height"],
  12803. alpha: param["alpha"] || 1,
  12804. success: param["success"] || function () {},
  12805. fail: param["fail"] || function () {}
  12806. };
  12807. var type = 'gcj02';
  12808. var locationsuccess = function locationsuccess(result) {
  12809. regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"];
  12810. wx.request({
  12811. url: 'https://api.map.baidu.com/reverse_geocoding/v3',
  12812. data: regeocodingparam,
  12813. header: {
  12814. "content-type": "application/json"
  12815. },
  12816. method: 'GET',
  12817. success: function success(data) {
  12818. var res = data["data"];
  12819. if (res["status"] === 0) {
  12820. var poiObj = res["result"];
  12821. // outputRes 包含两个对象:
  12822. // originalData为百度接口返回的原始数据
  12823. // wxMarkerData为小程序规范的marker格式
  12824. var outputRes = {};
  12825. outputRes["originalData"] = res;
  12826. outputRes["wxMarkerData"] = [];
  12827. outputRes["wxMarkerData"][0] = {
  12828. id: 0,
  12829. latitude: result["latitude"],
  12830. longitude: result["longitude"],
  12831. address: poiObj["formatted_address"],
  12832. iconPath: otherparam["iconPath"],
  12833. iconTapPath: otherparam["iconTapPath"],
  12834. desc: poiObj["sematic_description"],
  12835. business: poiObj["business"],
  12836. alpha: otherparam["alpha"],
  12837. width: otherparam["width"],
  12838. height: otherparam["height"]
  12839. };
  12840. otherparam.success(outputRes);
  12841. } else {
  12842. otherparam.fail({
  12843. errMsg: res["message"],
  12844. statusCode: res["status"]
  12845. });
  12846. }
  12847. },
  12848. fail: function fail(data) {
  12849. otherparam.fail(data);
  12850. }
  12851. });
  12852. };
  12853. var locationfail = function locationfail(result) {
  12854. otherparam.fail(result);
  12855. };
  12856. var locationcomplete = function locationcomplete(result) {};
  12857. if (!param["location"]) {
  12858. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12859. } else {
  12860. var longitude = param.location.split(',')[1];
  12861. var latitude = param.location.split(',')[0];
  12862. var errMsg = 'input location';
  12863. var res = {
  12864. errMsg: errMsg,
  12865. latitude: latitude,
  12866. longitude: longitude
  12867. };
  12868. locationsuccess(res);
  12869. }
  12870. }
  12871. /**
  12872. * gc检索(地理编码:地点->经纬度)
  12873. *
  12874. * @param {Object} param 检索配置
  12875. * 参数对象结构可以参考
  12876. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding
  12877. *
  12878. */
  12879. }, {
  12880. key: "geocoding",
  12881. value: function geocoding(param) {
  12882. var that = this;
  12883. param = param || {};
  12884. var geocodingparam = {
  12885. address: param["address"] || '',
  12886. city: param["city"] || '',
  12887. ret_coordtype: param["coordtype"] || 'gcj02ll',
  12888. ak: that.ak,
  12889. sn: param["sn"] || '',
  12890. output: param["output"] || 'json',
  12891. callback: param["callback"] || function () {}
  12892. };
  12893. var otherparam = {
  12894. iconPath: param["iconPath"],
  12895. iconTapPath: param["iconTapPath"],
  12896. width: param["width"],
  12897. height: param["height"],
  12898. alpha: param["alpha"] || 1,
  12899. success: param["success"] || function () {},
  12900. fail: param["fail"] || function () {}
  12901. };
  12902. if (param["address"]) {
  12903. wx.request({
  12904. url: 'https://api.map.baidu.com/geocoding/v3',
  12905. data: geocodingparam,
  12906. header: {
  12907. "content-type": "application/json"
  12908. },
  12909. method: 'GET',
  12910. success: function success(data) {
  12911. var res = data["data"];
  12912. if (res["status"] === 0) {
  12913. var poiObj = res["result"];
  12914. // outputRes 包含两个对象:
  12915. // originalData为百度接口返回的原始数据
  12916. // wxMarkerData为小程序规范的marker格式
  12917. var outputRes = res;
  12918. outputRes["originalData"] = res;
  12919. outputRes["wxMarkerData"] = [];
  12920. outputRes["wxMarkerData"][0] = {
  12921. id: 0,
  12922. latitude: poiObj["location"]["lat"],
  12923. longitude: poiObj["location"]["lng"],
  12924. iconPath: otherparam["iconPath"],
  12925. iconTapPath: otherparam["iconTapPath"],
  12926. alpha: otherparam["alpha"],
  12927. width: otherparam["width"],
  12928. height: otherparam["height"]
  12929. };
  12930. otherparam.success(outputRes);
  12931. } else {
  12932. otherparam.fail({
  12933. errMsg: res["message"],
  12934. statusCode: res["status"]
  12935. });
  12936. }
  12937. },
  12938. fail: function fail(data) {
  12939. otherparam.fail(data);
  12940. }
  12941. });
  12942. } else {
  12943. var errMsg = 'input address!';
  12944. var res = {
  12945. errMsg: errMsg
  12946. };
  12947. otherparam.fail(res);
  12948. }
  12949. }
  12950. /**
  12951. * 天气检索
  12952. *
  12953. * @param {Object} param 检索配置
  12954. */
  12955. }, {
  12956. key: "weather",
  12957. value: function weather(param) {
  12958. var that = this;
  12959. param = param || {};
  12960. var weatherparam = {
  12961. coord_type: param["coord_type"] || 'gcj02',
  12962. output: param["output"] || 'json',
  12963. ak: that.ak,
  12964. sn: param["sn"] || '',
  12965. timestamp: param["timestamp"] || ''
  12966. };
  12967. var otherparam = {
  12968. success: param["success"] || function () {},
  12969. fail: param["fail"] || function () {}
  12970. };
  12971. var type = 'gcj02';
  12972. var locationsuccess = function locationsuccess(result) {
  12973. weatherparam["location"] = result["longitude"] + ',' + result["latitude"];
  12974. wx.request({
  12975. url: 'https://api.map.baidu.com/telematics/v3/weather',
  12976. data: weatherparam,
  12977. header: {
  12978. "content-type": "application/json"
  12979. },
  12980. method: 'GET',
  12981. success: function success(data) {
  12982. var res = data["data"];
  12983. if (res["error"] === 0 && res["status"] === 'success') {
  12984. var weatherArr = res["results"];
  12985. // outputRes 包含两个对象,
  12986. // originalData为百度接口返回的原始数据
  12987. // wxMarkerData为小程序规范的marker格式
  12988. var outputRes = {};
  12989. outputRes["originalData"] = res;
  12990. outputRes["currentWeather"] = [];
  12991. outputRes["currentWeather"][0] = {
  12992. currentCity: weatherArr[0]["currentCity"],
  12993. pm25: weatherArr[0]["pm25"],
  12994. date: weatherArr[0]["weather_data"][0]["date"],
  12995. temperature: weatherArr[0]["weather_data"][0]["temperature"],
  12996. weatherDesc: weatherArr[0]["weather_data"][0]["weather"],
  12997. wind: weatherArr[0]["weather_data"][0]["wind"]
  12998. };
  12999. otherparam.success(outputRes);
  13000. } else {
  13001. otherparam.fail({
  13002. errMsg: res["message"],
  13003. statusCode: res["status"]
  13004. });
  13005. }
  13006. },
  13007. fail: function fail(data) {
  13008. otherparam.fail(data);
  13009. }
  13010. });
  13011. };
  13012. var locationfail = function locationfail(result) {
  13013. otherparam.fail(result);
  13014. };
  13015. var locationcomplete = function locationcomplete(result) {};
  13016. if (!param["location"]) {
  13017. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  13018. } else {
  13019. var longitude = param.location.split(',')[0];
  13020. var latitude = param.location.split(',')[1];
  13021. var errMsg = 'input location';
  13022. var res = {
  13023. errMsg: errMsg,
  13024. latitude: latitude,
  13025. longitude: longitude
  13026. };
  13027. locationsuccess(res);
  13028. }
  13029. }
  13030. }]);
  13031. return BMapWX;
  13032. }();
  13033. module.exports.BMapWX = BMapWX;
  13034. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  13035. /***/ }),
  13036. /***/ 5:
  13037. /*!**************************************************************!*\
  13038. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  13039. \**************************************************************/
  13040. /*! no static exports found */
  13041. /***/ (function(module, exports, __webpack_require__) {
  13042. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  13043. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  13044. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  13045. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  13046. function _slicedToArray(arr, i) {
  13047. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  13048. }
  13049. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13050. /***/ }),
  13051. /***/ 6:
  13052. /*!***************************************************************!*\
  13053. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  13054. \***************************************************************/
  13055. /*! no static exports found */
  13056. /***/ (function(module, exports) {
  13057. function _arrayWithHoles(arr) {
  13058. if (Array.isArray(arr)) return arr;
  13059. }
  13060. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13061. /***/ }),
  13062. /***/ 7:
  13063. /*!*********************************************************************!*\
  13064. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  13065. \*********************************************************************/
  13066. /*! no static exports found */
  13067. /***/ (function(module, exports) {
  13068. function _iterableToArrayLimit(r, l) {
  13069. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  13070. if (null != t) {
  13071. var e,
  13072. n,
  13073. i,
  13074. u,
  13075. a = [],
  13076. f = !0,
  13077. o = !1;
  13078. try {
  13079. if (i = (t = t.call(r)).next, 0 === l) {
  13080. if (Object(t) !== t) return;
  13081. f = !1;
  13082. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
  13083. ;
  13084. }
  13085. } catch (r) {
  13086. o = !0, n = r;
  13087. } finally {
  13088. try {
  13089. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  13090. } finally {
  13091. if (o) throw n;
  13092. }
  13093. }
  13094. return a;
  13095. }
  13096. }
  13097. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13098. /***/ }),
  13099. /***/ 8:
  13100. /*!***************************************************************************!*\
  13101. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  13102. \***************************************************************************/
  13103. /*! no static exports found */
  13104. /***/ (function(module, exports, __webpack_require__) {
  13105. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  13106. function _unsupportedIterableToArray(o, minLen) {
  13107. if (!o) return;
  13108. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  13109. var n = Object.prototype.toString.call(o).slice(8, -1);
  13110. if (n === "Object" && o.constructor) n = o.constructor.name;
  13111. if (n === "Map" || n === "Set") return Array.from(o);
  13112. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  13113. }
  13114. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13115. /***/ }),
  13116. /***/ 9:
  13117. /*!*****************************************************************!*\
  13118. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  13119. \*****************************************************************/
  13120. /*! no static exports found */
  13121. /***/ (function(module, exports) {
  13122. function _arrayLikeToArray(arr, len) {
  13123. if (len == null || len > arr.length) len = arr.length;
  13124. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  13125. arr2[i] = arr[i];
  13126. }
  13127. return arr2;
  13128. }
  13129. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13130. /***/ })
  13131. }]);
  13132. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map