vendor.js 302 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584
  1. "use strict";
  2. /**
  3. * @vue/shared v3.4.21
  4. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  5. * @license MIT
  6. **/
  7. function makeMap(str, expectsLowerCase) {
  8. const set2 = new Set(str.split(","));
  9. return expectsLowerCase ? (val) => set2.has(val.toLowerCase()) : (val) => set2.has(val);
  10. }
  11. const EMPTY_OBJ = Object.freeze({});
  12. const EMPTY_ARR = Object.freeze([]);
  13. const NOOP = () => {
  14. };
  15. const NO = () => false;
  16. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  17. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  18. const isModelListener = (key) => key.startsWith("onUpdate:");
  19. const extend$2 = Object.assign;
  20. const remove = (arr, el) => {
  21. const i = arr.indexOf(el);
  22. if (i > -1) {
  23. arr.splice(i, 1);
  24. }
  25. };
  26. const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  27. const hasOwn = (val, key) => hasOwnProperty$2.call(val, key);
  28. const isArray$2 = Array.isArray;
  29. const isMap = (val) => toTypeString(val) === "[object Map]";
  30. const isSet = (val) => toTypeString(val) === "[object Set]";
  31. const isFunction$2 = (val) => typeof val === "function";
  32. const isString$2 = (val) => typeof val === "string";
  33. const isSymbol = (val) => typeof val === "symbol";
  34. const isObject$2 = (val) => val !== null && typeof val === "object";
  35. const isPromise = (val) => {
  36. return (isObject$2(val) || isFunction$2(val)) && isFunction$2(val.then) && isFunction$2(val.catch);
  37. };
  38. const objectToString = Object.prototype.toString;
  39. const toTypeString = (value) => objectToString.call(value);
  40. const toRawType = (value) => {
  41. return toTypeString(value).slice(8, -1);
  42. };
  43. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  44. const isIntegerKey = (key) => isString$2(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  45. const isReservedProp = /* @__PURE__ */ makeMap(
  46. // the leading comma is intentional so empty string "" is also included
  47. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  48. );
  49. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  50. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  51. );
  52. const cacheStringFunction = (fn) => {
  53. const cache = /* @__PURE__ */ Object.create(null);
  54. return (str) => {
  55. const hit = cache[str];
  56. return hit || (cache[str] = fn(str));
  57. };
  58. };
  59. const camelizeRE = /-(\w)/g;
  60. const camelize = cacheStringFunction((str) => {
  61. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  62. });
  63. const hyphenateRE = /\B([A-Z])/g;
  64. const hyphenate = cacheStringFunction(
  65. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  66. );
  67. const capitalize = cacheStringFunction((str) => {
  68. return str.charAt(0).toUpperCase() + str.slice(1);
  69. });
  70. const toHandlerKey = cacheStringFunction((str) => {
  71. const s = str ? `on${capitalize(str)}` : ``;
  72. return s;
  73. });
  74. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  75. const invokeArrayFns$1 = (fns, arg) => {
  76. for (let i = 0; i < fns.length; i++) {
  77. fns[i](arg);
  78. }
  79. };
  80. const def = (obj, key, value) => {
  81. Object.defineProperty(obj, key, {
  82. configurable: true,
  83. enumerable: false,
  84. value
  85. });
  86. };
  87. const looseToNumber = (val) => {
  88. const n = parseFloat(val);
  89. return isNaN(n) ? val : n;
  90. };
  91. const toDisplayString = (val) => {
  92. return isString$2(val) ? val : val == null ? "" : isArray$2(val) || isObject$2(val) && (val.toString === objectToString || !isFunction$2(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  93. };
  94. const replacer = (_key, val) => {
  95. if (val && val.__v_isRef) {
  96. return replacer(_key, val.value);
  97. } else if (isMap(val)) {
  98. return {
  99. [`Map(${val.size})`]: [...val.entries()].reduce(
  100. (entries, [key, val2], i) => {
  101. entries[stringifySymbol(key, i) + " =>"] = val2;
  102. return entries;
  103. },
  104. {}
  105. )
  106. };
  107. } else if (isSet(val)) {
  108. return {
  109. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  110. };
  111. } else if (isSymbol(val)) {
  112. return stringifySymbol(val);
  113. } else if (isObject$2(val) && !isArray$2(val) && !isPlainObject$1(val)) {
  114. return String(val);
  115. }
  116. return val;
  117. };
  118. const stringifySymbol = (v, i = "") => {
  119. var _a;
  120. return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
  121. };
  122. const LOCALE_ZH_HANS = "zh-Hans";
  123. const LOCALE_ZH_HANT = "zh-Hant";
  124. const LOCALE_EN = "en";
  125. const LOCALE_FR = "fr";
  126. const LOCALE_ES = "es";
  127. function include(str, parts) {
  128. return !!parts.find((part) => str.indexOf(part) !== -1);
  129. }
  130. function startsWith(str, parts) {
  131. return parts.find((part) => str.indexOf(part) === 0);
  132. }
  133. function normalizeLocale(locale, messages) {
  134. if (!locale) {
  135. return;
  136. }
  137. locale = locale.trim().replace(/_/g, "-");
  138. if (messages && messages[locale]) {
  139. return locale;
  140. }
  141. locale = locale.toLowerCase();
  142. if (locale === "chinese") {
  143. return LOCALE_ZH_HANS;
  144. }
  145. if (locale.indexOf("zh") === 0) {
  146. if (locale.indexOf("-hans") > -1) {
  147. return LOCALE_ZH_HANS;
  148. }
  149. if (locale.indexOf("-hant") > -1) {
  150. return LOCALE_ZH_HANT;
  151. }
  152. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  153. return LOCALE_ZH_HANT;
  154. }
  155. return LOCALE_ZH_HANS;
  156. }
  157. let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  158. if (messages && Object.keys(messages).length > 0) {
  159. locales = Object.keys(messages);
  160. }
  161. const lang = startsWith(locale, locales);
  162. if (lang) {
  163. return lang;
  164. }
  165. }
  166. const SLOT_DEFAULT_NAME = "d";
  167. const ON_SHOW = "onShow";
  168. const ON_HIDE = "onHide";
  169. const ON_LAUNCH = "onLaunch";
  170. const ON_ERROR = "onError";
  171. const ON_THEME_CHANGE = "onThemeChange";
  172. const ON_PAGE_NOT_FOUND = "onPageNotFound";
  173. const ON_UNHANDLE_REJECTION = "onUnhandledRejection";
  174. const ON_EXIT = "onExit";
  175. const ON_LOAD = "onLoad";
  176. const ON_READY = "onReady";
  177. const ON_UNLOAD = "onUnload";
  178. const ON_INIT = "onInit";
  179. const ON_SAVE_EXIT_STATE = "onSaveExitState";
  180. const ON_RESIZE = "onResize";
  181. const ON_BACK_PRESS = "onBackPress";
  182. const ON_PAGE_SCROLL = "onPageScroll";
  183. const ON_TAB_ITEM_TAP = "onTabItemTap";
  184. const ON_REACH_BOTTOM = "onReachBottom";
  185. const ON_PULL_DOWN_REFRESH = "onPullDownRefresh";
  186. const ON_SHARE_TIMELINE = "onShareTimeline";
  187. const ON_SHARE_CHAT = "onShareChat";
  188. const ON_ADD_TO_FAVORITES = "onAddToFavorites";
  189. const ON_SHARE_APP_MESSAGE = "onShareAppMessage";
  190. const ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";
  191. const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = "onNavigationBarSearchInputClicked";
  192. const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = "onNavigationBarSearchInputChanged";
  193. const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = "onNavigationBarSearchInputConfirmed";
  194. const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = "onNavigationBarSearchInputFocusChanged";
  195. const VIRTUAL_HOST_STYLE = "virtualHostStyle";
  196. const VIRTUAL_HOST_CLASS = "virtualHostClass";
  197. const VIRTUAL_HOST_HIDDEN = "virtualHostHidden";
  198. const VIRTUAL_HOST_ID = "virtualHostId";
  199. function hasLeadingSlash(str) {
  200. return str.indexOf("/") === 0;
  201. }
  202. function addLeadingSlash(str) {
  203. return hasLeadingSlash(str) ? str : "/" + str;
  204. }
  205. const invokeArrayFns = (fns, arg) => {
  206. let ret;
  207. for (let i = 0; i < fns.length; i++) {
  208. ret = fns[i](arg);
  209. }
  210. return ret;
  211. };
  212. function once(fn, ctx = null) {
  213. let res;
  214. return (...args) => {
  215. if (fn) {
  216. res = fn.apply(ctx, args);
  217. fn = null;
  218. }
  219. return res;
  220. };
  221. }
  222. function getValueByDataPath(obj, path) {
  223. if (!isString$2(path)) {
  224. return;
  225. }
  226. path = path.replace(/\[(\d+)\]/g, ".$1");
  227. const parts = path.split(".");
  228. let key = parts[0];
  229. if (!obj) {
  230. obj = {};
  231. }
  232. if (parts.length === 1) {
  233. return obj[key];
  234. }
  235. return getValueByDataPath(obj[key], parts.slice(1).join("."));
  236. }
  237. function sortObject(obj) {
  238. let sortObj = {};
  239. if (isPlainObject$1(obj)) {
  240. Object.keys(obj).sort().forEach((key) => {
  241. const _key = key;
  242. sortObj[_key] = obj[_key];
  243. });
  244. }
  245. return !Object.keys(sortObj) ? obj : sortObj;
  246. }
  247. const customizeRE = /:/g;
  248. function customizeEvent(str) {
  249. return camelize(str.replace(customizeRE, "-"));
  250. }
  251. const encode$3 = encodeURIComponent;
  252. function stringifyQuery(obj, encodeStr = encode$3) {
  253. const res = obj ? Object.keys(obj).map((key) => {
  254. let val = obj[key];
  255. if (typeof val === void 0 || val === null) {
  256. val = "";
  257. } else if (isPlainObject$1(val)) {
  258. val = JSON.stringify(val);
  259. }
  260. return encodeStr(key) + "=" + encodeStr(val);
  261. }).filter((x) => x.length > 0).join("&") : null;
  262. return res ? `?${res}` : "";
  263. }
  264. const PAGE_HOOKS = [
  265. ON_INIT,
  266. ON_LOAD,
  267. ON_SHOW,
  268. ON_HIDE,
  269. ON_UNLOAD,
  270. ON_BACK_PRESS,
  271. ON_PAGE_SCROLL,
  272. ON_TAB_ITEM_TAP,
  273. ON_REACH_BOTTOM,
  274. ON_PULL_DOWN_REFRESH,
  275. ON_SHARE_TIMELINE,
  276. ON_SHARE_APP_MESSAGE,
  277. ON_SHARE_CHAT,
  278. ON_ADD_TO_FAVORITES,
  279. ON_SAVE_EXIT_STATE,
  280. ON_NAVIGATION_BAR_BUTTON_TAP,
  281. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  282. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  283. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  284. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  285. ];
  286. function isRootHook(name) {
  287. return PAGE_HOOKS.indexOf(name) > -1;
  288. }
  289. const UniLifecycleHooks = [
  290. ON_SHOW,
  291. ON_HIDE,
  292. ON_LAUNCH,
  293. ON_ERROR,
  294. ON_THEME_CHANGE,
  295. ON_PAGE_NOT_FOUND,
  296. ON_UNHANDLE_REJECTION,
  297. ON_EXIT,
  298. ON_INIT,
  299. ON_LOAD,
  300. ON_READY,
  301. ON_UNLOAD,
  302. ON_RESIZE,
  303. ON_BACK_PRESS,
  304. ON_PAGE_SCROLL,
  305. ON_TAB_ITEM_TAP,
  306. ON_REACH_BOTTOM,
  307. ON_PULL_DOWN_REFRESH,
  308. ON_SHARE_TIMELINE,
  309. ON_ADD_TO_FAVORITES,
  310. ON_SHARE_APP_MESSAGE,
  311. ON_SHARE_CHAT,
  312. ON_SAVE_EXIT_STATE,
  313. ON_NAVIGATION_BAR_BUTTON_TAP,
  314. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  315. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  316. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  317. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  318. ];
  319. const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */ (() => {
  320. return {
  321. onPageScroll: 1,
  322. onShareAppMessage: 1 << 1,
  323. onShareTimeline: 1 << 2
  324. };
  325. })();
  326. function isUniLifecycleHook(name, value, checkType = true) {
  327. if (checkType && !isFunction$2(value)) {
  328. return false;
  329. }
  330. if (UniLifecycleHooks.indexOf(name) > -1) {
  331. return true;
  332. } else if (name.indexOf("on") === 0) {
  333. return true;
  334. }
  335. return false;
  336. }
  337. let vueApp;
  338. const createVueAppHooks = [];
  339. function onCreateVueApp(hook) {
  340. if (vueApp) {
  341. return hook(vueApp);
  342. }
  343. createVueAppHooks.push(hook);
  344. }
  345. function invokeCreateVueAppHook(app) {
  346. vueApp = app;
  347. createVueAppHooks.forEach((hook) => hook(app));
  348. }
  349. const invokeCreateErrorHandler = once((app, createErrorHandler2) => {
  350. return createErrorHandler2(app);
  351. });
  352. const E = function() {
  353. };
  354. E.prototype = {
  355. _id: 1,
  356. on: function(name, callback, ctx) {
  357. var e = this.e || (this.e = {});
  358. (e[name] || (e[name] = [])).push({
  359. fn: callback,
  360. ctx,
  361. _id: this._id
  362. });
  363. return this._id++;
  364. },
  365. once: function(name, callback, ctx) {
  366. var self2 = this;
  367. function listener() {
  368. self2.off(name, listener);
  369. callback.apply(ctx, arguments);
  370. }
  371. listener._ = callback;
  372. return this.on(name, listener, ctx);
  373. },
  374. emit: function(name) {
  375. var data = [].slice.call(arguments, 1);
  376. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  377. var i = 0;
  378. var len = evtArr.length;
  379. for (i; i < len; i++) {
  380. evtArr[i].fn.apply(evtArr[i].ctx, data);
  381. }
  382. return this;
  383. },
  384. off: function(name, event) {
  385. var e = this.e || (this.e = {});
  386. var evts = e[name];
  387. var liveEvents = [];
  388. if (evts && event) {
  389. for (var i = evts.length - 1; i >= 0; i--) {
  390. if (evts[i].fn === event || evts[i].fn._ === event || evts[i]._id === event) {
  391. evts.splice(i, 1);
  392. break;
  393. }
  394. }
  395. liveEvents = evts;
  396. }
  397. liveEvents.length ? e[name] = liveEvents : delete e[name];
  398. return this;
  399. }
  400. };
  401. var E$1 = E;
  402. /**
  403. * @dcloudio/uni-mp-vue v3.4.21
  404. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  405. * @license MIT
  406. **/
  407. function warn$2(msg, ...args) {
  408. console.warn(`[Vue warn] ${msg}`, ...args);
  409. }
  410. let activeEffectScope;
  411. class EffectScope {
  412. constructor(detached = false) {
  413. this.detached = detached;
  414. this._active = true;
  415. this.effects = [];
  416. this.cleanups = [];
  417. this.parent = activeEffectScope;
  418. if (!detached && activeEffectScope) {
  419. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  420. this
  421. ) - 1;
  422. }
  423. }
  424. get active() {
  425. return this._active;
  426. }
  427. run(fn) {
  428. if (this._active) {
  429. const currentEffectScope = activeEffectScope;
  430. try {
  431. activeEffectScope = this;
  432. return fn();
  433. } finally {
  434. activeEffectScope = currentEffectScope;
  435. }
  436. } else {
  437. warn$2(`cannot run an inactive effect scope.`);
  438. }
  439. }
  440. /**
  441. * This should only be called on non-detached scopes
  442. * @internal
  443. */
  444. on() {
  445. activeEffectScope = this;
  446. }
  447. /**
  448. * This should only be called on non-detached scopes
  449. * @internal
  450. */
  451. off() {
  452. activeEffectScope = this.parent;
  453. }
  454. stop(fromParent) {
  455. if (this._active) {
  456. let i, l;
  457. for (i = 0, l = this.effects.length; i < l; i++) {
  458. this.effects[i].stop();
  459. }
  460. for (i = 0, l = this.cleanups.length; i < l; i++) {
  461. this.cleanups[i]();
  462. }
  463. if (this.scopes) {
  464. for (i = 0, l = this.scopes.length; i < l; i++) {
  465. this.scopes[i].stop(true);
  466. }
  467. }
  468. if (!this.detached && this.parent && !fromParent) {
  469. const last = this.parent.scopes.pop();
  470. if (last && last !== this) {
  471. this.parent.scopes[this.index] = last;
  472. last.index = this.index;
  473. }
  474. }
  475. this.parent = void 0;
  476. this._active = false;
  477. }
  478. }
  479. }
  480. function recordEffectScope(effect2, scope = activeEffectScope) {
  481. if (scope && scope.active) {
  482. scope.effects.push(effect2);
  483. }
  484. }
  485. function getCurrentScope() {
  486. return activeEffectScope;
  487. }
  488. let activeEffect;
  489. class ReactiveEffect {
  490. constructor(fn, trigger2, scheduler, scope) {
  491. this.fn = fn;
  492. this.trigger = trigger2;
  493. this.scheduler = scheduler;
  494. this.active = true;
  495. this.deps = [];
  496. this._dirtyLevel = 4;
  497. this._trackId = 0;
  498. this._runnings = 0;
  499. this._shouldSchedule = false;
  500. this._depsLength = 0;
  501. recordEffectScope(this, scope);
  502. }
  503. get dirty() {
  504. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  505. this._dirtyLevel = 1;
  506. pauseTracking();
  507. for (let i = 0; i < this._depsLength; i++) {
  508. const dep = this.deps[i];
  509. if (dep.computed) {
  510. triggerComputed(dep.computed);
  511. if (this._dirtyLevel >= 4) {
  512. break;
  513. }
  514. }
  515. }
  516. if (this._dirtyLevel === 1) {
  517. this._dirtyLevel = 0;
  518. }
  519. resetTracking();
  520. }
  521. return this._dirtyLevel >= 4;
  522. }
  523. set dirty(v) {
  524. this._dirtyLevel = v ? 4 : 0;
  525. }
  526. run() {
  527. this._dirtyLevel = 0;
  528. if (!this.active) {
  529. return this.fn();
  530. }
  531. let lastShouldTrack = shouldTrack;
  532. let lastEffect = activeEffect;
  533. try {
  534. shouldTrack = true;
  535. activeEffect = this;
  536. this._runnings++;
  537. preCleanupEffect(this);
  538. return this.fn();
  539. } finally {
  540. postCleanupEffect(this);
  541. this._runnings--;
  542. activeEffect = lastEffect;
  543. shouldTrack = lastShouldTrack;
  544. }
  545. }
  546. stop() {
  547. var _a;
  548. if (this.active) {
  549. preCleanupEffect(this);
  550. postCleanupEffect(this);
  551. (_a = this.onStop) == null ? void 0 : _a.call(this);
  552. this.active = false;
  553. }
  554. }
  555. }
  556. function triggerComputed(computed2) {
  557. return computed2.value;
  558. }
  559. function preCleanupEffect(effect2) {
  560. effect2._trackId++;
  561. effect2._depsLength = 0;
  562. }
  563. function postCleanupEffect(effect2) {
  564. if (effect2.deps.length > effect2._depsLength) {
  565. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  566. cleanupDepEffect(effect2.deps[i], effect2);
  567. }
  568. effect2.deps.length = effect2._depsLength;
  569. }
  570. }
  571. function cleanupDepEffect(dep, effect2) {
  572. const trackId = dep.get(effect2);
  573. if (trackId !== void 0 && effect2._trackId !== trackId) {
  574. dep.delete(effect2);
  575. if (dep.size === 0) {
  576. dep.cleanup();
  577. }
  578. }
  579. }
  580. let shouldTrack = true;
  581. let pauseScheduleStack = 0;
  582. const trackStack = [];
  583. function pauseTracking() {
  584. trackStack.push(shouldTrack);
  585. shouldTrack = false;
  586. }
  587. function resetTracking() {
  588. const last = trackStack.pop();
  589. shouldTrack = last === void 0 ? true : last;
  590. }
  591. function pauseScheduling() {
  592. pauseScheduleStack++;
  593. }
  594. function resetScheduling() {
  595. pauseScheduleStack--;
  596. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  597. queueEffectSchedulers.shift()();
  598. }
  599. }
  600. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  601. var _a;
  602. if (dep.get(effect2) !== effect2._trackId) {
  603. dep.set(effect2, effect2._trackId);
  604. const oldDep = effect2.deps[effect2._depsLength];
  605. if (oldDep !== dep) {
  606. if (oldDep) {
  607. cleanupDepEffect(oldDep, effect2);
  608. }
  609. effect2.deps[effect2._depsLength++] = dep;
  610. } else {
  611. effect2._depsLength++;
  612. }
  613. {
  614. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend$2({ effect: effect2 }, debuggerEventExtraInfo));
  615. }
  616. }
  617. }
  618. const queueEffectSchedulers = [];
  619. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  620. var _a;
  621. pauseScheduling();
  622. for (const effect2 of dep.keys()) {
  623. let tracking;
  624. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  625. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  626. effect2._dirtyLevel = dirtyLevel;
  627. }
  628. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  629. {
  630. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend$2({ effect: effect2 }, debuggerEventExtraInfo));
  631. }
  632. effect2.trigger();
  633. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  634. effect2._shouldSchedule = false;
  635. if (effect2.scheduler) {
  636. queueEffectSchedulers.push(effect2.scheduler);
  637. }
  638. }
  639. }
  640. }
  641. resetScheduling();
  642. }
  643. const createDep = (cleanup, computed2) => {
  644. const dep = /* @__PURE__ */ new Map();
  645. dep.cleanup = cleanup;
  646. dep.computed = computed2;
  647. return dep;
  648. };
  649. const targetMap = /* @__PURE__ */ new WeakMap();
  650. const ITERATE_KEY = Symbol("iterate");
  651. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  652. function track(target, type, key) {
  653. if (shouldTrack && activeEffect) {
  654. let depsMap = targetMap.get(target);
  655. if (!depsMap) {
  656. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  657. }
  658. let dep = depsMap.get(key);
  659. if (!dep) {
  660. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  661. }
  662. trackEffect(
  663. activeEffect,
  664. dep,
  665. {
  666. target,
  667. type,
  668. key
  669. }
  670. );
  671. }
  672. }
  673. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  674. const depsMap = targetMap.get(target);
  675. if (!depsMap) {
  676. return;
  677. }
  678. let deps = [];
  679. if (type === "clear") {
  680. deps = [...depsMap.values()];
  681. } else if (key === "length" && isArray$2(target)) {
  682. const newLength = Number(newValue);
  683. depsMap.forEach((dep, key2) => {
  684. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  685. deps.push(dep);
  686. }
  687. });
  688. } else {
  689. if (key !== void 0) {
  690. deps.push(depsMap.get(key));
  691. }
  692. switch (type) {
  693. case "add":
  694. if (!isArray$2(target)) {
  695. deps.push(depsMap.get(ITERATE_KEY));
  696. if (isMap(target)) {
  697. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  698. }
  699. } else if (isIntegerKey(key)) {
  700. deps.push(depsMap.get("length"));
  701. }
  702. break;
  703. case "delete":
  704. if (!isArray$2(target)) {
  705. deps.push(depsMap.get(ITERATE_KEY));
  706. if (isMap(target)) {
  707. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  708. }
  709. }
  710. break;
  711. case "set":
  712. if (isMap(target)) {
  713. deps.push(depsMap.get(ITERATE_KEY));
  714. }
  715. break;
  716. }
  717. }
  718. pauseScheduling();
  719. for (const dep of deps) {
  720. if (dep) {
  721. triggerEffects(
  722. dep,
  723. 4,
  724. {
  725. target,
  726. type,
  727. key,
  728. newValue,
  729. oldValue,
  730. oldTarget
  731. }
  732. );
  733. }
  734. }
  735. resetScheduling();
  736. }
  737. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  738. const builtInSymbols = new Set(
  739. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  740. );
  741. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  742. function createArrayInstrumentations() {
  743. const instrumentations = {};
  744. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  745. instrumentations[key] = function(...args) {
  746. const arr = toRaw(this);
  747. for (let i = 0, l = this.length; i < l; i++) {
  748. track(arr, "get", i + "");
  749. }
  750. const res = arr[key](...args);
  751. if (res === -1 || res === false) {
  752. return arr[key](...args.map(toRaw));
  753. } else {
  754. return res;
  755. }
  756. };
  757. });
  758. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  759. instrumentations[key] = function(...args) {
  760. pauseTracking();
  761. pauseScheduling();
  762. const res = toRaw(this)[key].apply(this, args);
  763. resetScheduling();
  764. resetTracking();
  765. return res;
  766. };
  767. });
  768. return instrumentations;
  769. }
  770. function hasOwnProperty$1(key) {
  771. const obj = toRaw(this);
  772. track(obj, "has", key);
  773. return obj.hasOwnProperty(key);
  774. }
  775. class BaseReactiveHandler {
  776. constructor(_isReadonly = false, _isShallow = false) {
  777. this._isReadonly = _isReadonly;
  778. this._isShallow = _isShallow;
  779. }
  780. get(target, key, receiver) {
  781. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  782. if (key === "__v_isReactive") {
  783. return !isReadonly2;
  784. } else if (key === "__v_isReadonly") {
  785. return isReadonly2;
  786. } else if (key === "__v_isShallow") {
  787. return isShallow2;
  788. } else if (key === "__v_raw") {
  789. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  790. // this means the reciever is a user proxy of the reactive proxy
  791. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  792. return target;
  793. }
  794. return;
  795. }
  796. const targetIsArray = isArray$2(target);
  797. if (!isReadonly2) {
  798. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  799. return Reflect.get(arrayInstrumentations, key, receiver);
  800. }
  801. if (key === "hasOwnProperty") {
  802. return hasOwnProperty$1;
  803. }
  804. }
  805. const res = Reflect.get(target, key, receiver);
  806. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  807. return res;
  808. }
  809. if (!isReadonly2) {
  810. track(target, "get", key);
  811. }
  812. if (isShallow2) {
  813. return res;
  814. }
  815. if (isRef(res)) {
  816. return targetIsArray && isIntegerKey(key) ? res : res.value;
  817. }
  818. if (isObject$2(res)) {
  819. return isReadonly2 ? readonly(res) : reactive(res);
  820. }
  821. return res;
  822. }
  823. }
  824. class MutableReactiveHandler extends BaseReactiveHandler {
  825. constructor(isShallow2 = false) {
  826. super(false, isShallow2);
  827. }
  828. set(target, key, value, receiver) {
  829. let oldValue = target[key];
  830. if (!this._isShallow) {
  831. const isOldValueReadonly = isReadonly(oldValue);
  832. if (!isShallow(value) && !isReadonly(value)) {
  833. oldValue = toRaw(oldValue);
  834. value = toRaw(value);
  835. }
  836. if (!isArray$2(target) && isRef(oldValue) && !isRef(value)) {
  837. if (isOldValueReadonly) {
  838. return false;
  839. } else {
  840. oldValue.value = value;
  841. return true;
  842. }
  843. }
  844. }
  845. const hadKey = isArray$2(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  846. const result = Reflect.set(target, key, value, receiver);
  847. if (target === toRaw(receiver)) {
  848. if (!hadKey) {
  849. trigger(target, "add", key, value);
  850. } else if (hasChanged(value, oldValue)) {
  851. trigger(target, "set", key, value, oldValue);
  852. }
  853. }
  854. return result;
  855. }
  856. deleteProperty(target, key) {
  857. const hadKey = hasOwn(target, key);
  858. const oldValue = target[key];
  859. const result = Reflect.deleteProperty(target, key);
  860. if (result && hadKey) {
  861. trigger(target, "delete", key, void 0, oldValue);
  862. }
  863. return result;
  864. }
  865. has(target, key) {
  866. const result = Reflect.has(target, key);
  867. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  868. track(target, "has", key);
  869. }
  870. return result;
  871. }
  872. ownKeys(target) {
  873. track(
  874. target,
  875. "iterate",
  876. isArray$2(target) ? "length" : ITERATE_KEY
  877. );
  878. return Reflect.ownKeys(target);
  879. }
  880. }
  881. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  882. constructor(isShallow2 = false) {
  883. super(true, isShallow2);
  884. }
  885. set(target, key) {
  886. {
  887. warn$2(
  888. `Set operation on key "${String(key)}" failed: target is readonly.`,
  889. target
  890. );
  891. }
  892. return true;
  893. }
  894. deleteProperty(target, key) {
  895. {
  896. warn$2(
  897. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  898. target
  899. );
  900. }
  901. return true;
  902. }
  903. }
  904. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  905. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  906. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  907. true
  908. );
  909. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  910. const toShallow = (value) => value;
  911. const getProto = (v) => Reflect.getPrototypeOf(v);
  912. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  913. target = target["__v_raw"];
  914. const rawTarget = toRaw(target);
  915. const rawKey = toRaw(key);
  916. if (!isReadonly2) {
  917. if (hasChanged(key, rawKey)) {
  918. track(rawTarget, "get", key);
  919. }
  920. track(rawTarget, "get", rawKey);
  921. }
  922. const { has: has2 } = getProto(rawTarget);
  923. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  924. if (has2.call(rawTarget, key)) {
  925. return wrap(target.get(key));
  926. } else if (has2.call(rawTarget, rawKey)) {
  927. return wrap(target.get(rawKey));
  928. } else if (target !== rawTarget) {
  929. target.get(key);
  930. }
  931. }
  932. function has$1(key, isReadonly2 = false) {
  933. const target = this["__v_raw"];
  934. const rawTarget = toRaw(target);
  935. const rawKey = toRaw(key);
  936. if (!isReadonly2) {
  937. if (hasChanged(key, rawKey)) {
  938. track(rawTarget, "has", key);
  939. }
  940. track(rawTarget, "has", rawKey);
  941. }
  942. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  943. }
  944. function size(target, isReadonly2 = false) {
  945. target = target["__v_raw"];
  946. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  947. return Reflect.get(target, "size", target);
  948. }
  949. function add(value) {
  950. value = toRaw(value);
  951. const target = toRaw(this);
  952. const proto = getProto(target);
  953. const hadKey = proto.has.call(target, value);
  954. if (!hadKey) {
  955. target.add(value);
  956. trigger(target, "add", value, value);
  957. }
  958. return this;
  959. }
  960. function set$1(key, value) {
  961. value = toRaw(value);
  962. const target = toRaw(this);
  963. const { has: has2, get: get2 } = getProto(target);
  964. let hadKey = has2.call(target, key);
  965. if (!hadKey) {
  966. key = toRaw(key);
  967. hadKey = has2.call(target, key);
  968. } else {
  969. checkIdentityKeys(target, has2, key);
  970. }
  971. const oldValue = get2.call(target, key);
  972. target.set(key, value);
  973. if (!hadKey) {
  974. trigger(target, "add", key, value);
  975. } else if (hasChanged(value, oldValue)) {
  976. trigger(target, "set", key, value, oldValue);
  977. }
  978. return this;
  979. }
  980. function deleteEntry(key) {
  981. const target = toRaw(this);
  982. const { has: has2, get: get2 } = getProto(target);
  983. let hadKey = has2.call(target, key);
  984. if (!hadKey) {
  985. key = toRaw(key);
  986. hadKey = has2.call(target, key);
  987. } else {
  988. checkIdentityKeys(target, has2, key);
  989. }
  990. const oldValue = get2 ? get2.call(target, key) : void 0;
  991. const result = target.delete(key);
  992. if (hadKey) {
  993. trigger(target, "delete", key, void 0, oldValue);
  994. }
  995. return result;
  996. }
  997. function clear() {
  998. const target = toRaw(this);
  999. const hadItems = target.size !== 0;
  1000. const oldTarget = isMap(target) ? new Map(target) : new Set(target);
  1001. const result = target.clear();
  1002. if (hadItems) {
  1003. trigger(target, "clear", void 0, void 0, oldTarget);
  1004. }
  1005. return result;
  1006. }
  1007. function createForEach(isReadonly2, isShallow2) {
  1008. return function forEach2(callback, thisArg) {
  1009. const observed = this;
  1010. const target = observed["__v_raw"];
  1011. const rawTarget = toRaw(target);
  1012. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1013. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  1014. return target.forEach((value, key) => {
  1015. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1016. });
  1017. };
  1018. }
  1019. function createIterableMethod(method, isReadonly2, isShallow2) {
  1020. return function(...args) {
  1021. const target = this["__v_raw"];
  1022. const rawTarget = toRaw(target);
  1023. const targetIsMap = isMap(rawTarget);
  1024. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1025. const isKeyOnly = method === "keys" && targetIsMap;
  1026. const innerIterator = target[method](...args);
  1027. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1028. !isReadonly2 && track(
  1029. rawTarget,
  1030. "iterate",
  1031. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1032. );
  1033. return {
  1034. // iterator protocol
  1035. next() {
  1036. const { value, done } = innerIterator.next();
  1037. return done ? { value, done } : {
  1038. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1039. done
  1040. };
  1041. },
  1042. // iterable protocol
  1043. [Symbol.iterator]() {
  1044. return this;
  1045. }
  1046. };
  1047. };
  1048. }
  1049. function createReadonlyMethod(type) {
  1050. return function(...args) {
  1051. {
  1052. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1053. warn$2(
  1054. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1055. toRaw(this)
  1056. );
  1057. }
  1058. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1059. };
  1060. }
  1061. function createInstrumentations() {
  1062. const mutableInstrumentations2 = {
  1063. get(key) {
  1064. return get(this, key);
  1065. },
  1066. get size() {
  1067. return size(this);
  1068. },
  1069. has: has$1,
  1070. add,
  1071. set: set$1,
  1072. delete: deleteEntry,
  1073. clear,
  1074. forEach: createForEach(false, false)
  1075. };
  1076. const shallowInstrumentations2 = {
  1077. get(key) {
  1078. return get(this, key, false, true);
  1079. },
  1080. get size() {
  1081. return size(this);
  1082. },
  1083. has: has$1,
  1084. add,
  1085. set: set$1,
  1086. delete: deleteEntry,
  1087. clear,
  1088. forEach: createForEach(false, true)
  1089. };
  1090. const readonlyInstrumentations2 = {
  1091. get(key) {
  1092. return get(this, key, true);
  1093. },
  1094. get size() {
  1095. return size(this, true);
  1096. },
  1097. has(key) {
  1098. return has$1.call(this, key, true);
  1099. },
  1100. add: createReadonlyMethod("add"),
  1101. set: createReadonlyMethod("set"),
  1102. delete: createReadonlyMethod("delete"),
  1103. clear: createReadonlyMethod("clear"),
  1104. forEach: createForEach(true, false)
  1105. };
  1106. const shallowReadonlyInstrumentations2 = {
  1107. get(key) {
  1108. return get(this, key, true, true);
  1109. },
  1110. get size() {
  1111. return size(this, true);
  1112. },
  1113. has(key) {
  1114. return has$1.call(this, key, true);
  1115. },
  1116. add: createReadonlyMethod("add"),
  1117. set: createReadonlyMethod("set"),
  1118. delete: createReadonlyMethod("delete"),
  1119. clear: createReadonlyMethod("clear"),
  1120. forEach: createForEach(true, true)
  1121. };
  1122. const iteratorMethods = [
  1123. "keys",
  1124. "values",
  1125. "entries",
  1126. Symbol.iterator
  1127. ];
  1128. iteratorMethods.forEach((method) => {
  1129. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1130. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1131. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1132. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1133. method,
  1134. true,
  1135. true
  1136. );
  1137. });
  1138. return [
  1139. mutableInstrumentations2,
  1140. readonlyInstrumentations2,
  1141. shallowInstrumentations2,
  1142. shallowReadonlyInstrumentations2
  1143. ];
  1144. }
  1145. const [
  1146. mutableInstrumentations,
  1147. readonlyInstrumentations,
  1148. shallowInstrumentations,
  1149. shallowReadonlyInstrumentations
  1150. ] = /* @__PURE__ */ createInstrumentations();
  1151. function createInstrumentationGetter(isReadonly2, shallow) {
  1152. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1153. return (target, key, receiver) => {
  1154. if (key === "__v_isReactive") {
  1155. return !isReadonly2;
  1156. } else if (key === "__v_isReadonly") {
  1157. return isReadonly2;
  1158. } else if (key === "__v_raw") {
  1159. return target;
  1160. }
  1161. return Reflect.get(
  1162. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1163. key,
  1164. receiver
  1165. );
  1166. };
  1167. }
  1168. const mutableCollectionHandlers = {
  1169. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1170. };
  1171. const shallowCollectionHandlers = {
  1172. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1173. };
  1174. const readonlyCollectionHandlers = {
  1175. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1176. };
  1177. const shallowReadonlyCollectionHandlers = {
  1178. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1179. };
  1180. function checkIdentityKeys(target, has2, key) {
  1181. const rawKey = toRaw(key);
  1182. if (rawKey !== key && has2.call(target, rawKey)) {
  1183. const type = toRawType(target);
  1184. warn$2(
  1185. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1186. );
  1187. }
  1188. }
  1189. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1190. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1191. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1192. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1193. function targetTypeMap(rawType) {
  1194. switch (rawType) {
  1195. case "Object":
  1196. case "Array":
  1197. return 1;
  1198. case "Map":
  1199. case "Set":
  1200. case "WeakMap":
  1201. case "WeakSet":
  1202. return 2;
  1203. default:
  1204. return 0;
  1205. }
  1206. }
  1207. function getTargetType(value) {
  1208. return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
  1209. }
  1210. function reactive(target) {
  1211. if (isReadonly(target)) {
  1212. return target;
  1213. }
  1214. return createReactiveObject(
  1215. target,
  1216. false,
  1217. mutableHandlers,
  1218. mutableCollectionHandlers,
  1219. reactiveMap
  1220. );
  1221. }
  1222. function shallowReactive(target) {
  1223. return createReactiveObject(
  1224. target,
  1225. false,
  1226. shallowReactiveHandlers,
  1227. shallowCollectionHandlers,
  1228. shallowReactiveMap
  1229. );
  1230. }
  1231. function readonly(target) {
  1232. return createReactiveObject(
  1233. target,
  1234. true,
  1235. readonlyHandlers,
  1236. readonlyCollectionHandlers,
  1237. readonlyMap
  1238. );
  1239. }
  1240. function shallowReadonly(target) {
  1241. return createReactiveObject(
  1242. target,
  1243. true,
  1244. shallowReadonlyHandlers,
  1245. shallowReadonlyCollectionHandlers,
  1246. shallowReadonlyMap
  1247. );
  1248. }
  1249. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1250. if (!isObject$2(target)) {
  1251. {
  1252. warn$2(`value cannot be made reactive: ${String(target)}`);
  1253. }
  1254. return target;
  1255. }
  1256. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1257. return target;
  1258. }
  1259. const existingProxy = proxyMap.get(target);
  1260. if (existingProxy) {
  1261. return existingProxy;
  1262. }
  1263. const targetType = getTargetType(target);
  1264. if (targetType === 0) {
  1265. return target;
  1266. }
  1267. const proxy = new Proxy(
  1268. target,
  1269. targetType === 2 ? collectionHandlers : baseHandlers
  1270. );
  1271. proxyMap.set(target, proxy);
  1272. return proxy;
  1273. }
  1274. function isReactive(value) {
  1275. if (isReadonly(value)) {
  1276. return isReactive(value["__v_raw"]);
  1277. }
  1278. return !!(value && value["__v_isReactive"]);
  1279. }
  1280. function isReadonly(value) {
  1281. return !!(value && value["__v_isReadonly"]);
  1282. }
  1283. function isShallow(value) {
  1284. return !!(value && value["__v_isShallow"]);
  1285. }
  1286. function isProxy(value) {
  1287. return isReactive(value) || isReadonly(value);
  1288. }
  1289. function toRaw(observed) {
  1290. const raw = observed && observed["__v_raw"];
  1291. return raw ? toRaw(raw) : observed;
  1292. }
  1293. function markRaw(value) {
  1294. if (Object.isExtensible(value)) {
  1295. def(value, "__v_skip", true);
  1296. }
  1297. return value;
  1298. }
  1299. const toReactive = (value) => isObject$2(value) ? reactive(value) : value;
  1300. const toReadonly = (value) => isObject$2(value) ? readonly(value) : value;
  1301. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1302. class ComputedRefImpl {
  1303. constructor(getter, _setter, isReadonly2, isSSR) {
  1304. this.getter = getter;
  1305. this._setter = _setter;
  1306. this.dep = void 0;
  1307. this.__v_isRef = true;
  1308. this["__v_isReadonly"] = false;
  1309. this.effect = new ReactiveEffect(
  1310. () => getter(this._value),
  1311. () => triggerRefValue(
  1312. this,
  1313. this.effect._dirtyLevel === 2 ? 2 : 3
  1314. )
  1315. );
  1316. this.effect.computed = this;
  1317. this.effect.active = this._cacheable = !isSSR;
  1318. this["__v_isReadonly"] = isReadonly2;
  1319. }
  1320. get value() {
  1321. const self2 = toRaw(this);
  1322. if ((!self2._cacheable || self2.effect.dirty) && hasChanged(self2._value, self2._value = self2.effect.run())) {
  1323. triggerRefValue(self2, 4);
  1324. }
  1325. trackRefValue(self2);
  1326. if (self2.effect._dirtyLevel >= 2) {
  1327. if (this._warnRecursive) {
  1328. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1329. getter: `, this.getter);
  1330. }
  1331. triggerRefValue(self2, 2);
  1332. }
  1333. return self2._value;
  1334. }
  1335. set value(newValue) {
  1336. this._setter(newValue);
  1337. }
  1338. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1339. get _dirty() {
  1340. return this.effect.dirty;
  1341. }
  1342. set _dirty(v) {
  1343. this.effect.dirty = v;
  1344. }
  1345. // #endregion
  1346. }
  1347. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1348. let getter;
  1349. let setter;
  1350. const onlyGetter = isFunction$2(getterOrOptions);
  1351. if (onlyGetter) {
  1352. getter = getterOrOptions;
  1353. setter = () => {
  1354. warn$2("Write operation failed: computed value is readonly");
  1355. };
  1356. } else {
  1357. getter = getterOrOptions.get;
  1358. setter = getterOrOptions.set;
  1359. }
  1360. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1361. if (debugOptions && !isSSR) {
  1362. cRef.effect.onTrack = debugOptions.onTrack;
  1363. cRef.effect.onTrigger = debugOptions.onTrigger;
  1364. }
  1365. return cRef;
  1366. }
  1367. function trackRefValue(ref2) {
  1368. var _a;
  1369. if (shouldTrack && activeEffect) {
  1370. ref2 = toRaw(ref2);
  1371. trackEffect(
  1372. activeEffect,
  1373. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1374. () => ref2.dep = void 0,
  1375. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1376. ),
  1377. {
  1378. target: ref2,
  1379. type: "get",
  1380. key: "value"
  1381. }
  1382. );
  1383. }
  1384. }
  1385. function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
  1386. ref2 = toRaw(ref2);
  1387. const dep = ref2.dep;
  1388. if (dep) {
  1389. triggerEffects(
  1390. dep,
  1391. dirtyLevel,
  1392. {
  1393. target: ref2,
  1394. type: "set",
  1395. key: "value",
  1396. newValue: newVal
  1397. }
  1398. );
  1399. }
  1400. }
  1401. function isRef(r2) {
  1402. return !!(r2 && r2.__v_isRef === true);
  1403. }
  1404. function ref(value) {
  1405. return createRef(value, false);
  1406. }
  1407. function createRef(rawValue, shallow) {
  1408. if (isRef(rawValue)) {
  1409. return rawValue;
  1410. }
  1411. return new RefImpl(rawValue, shallow);
  1412. }
  1413. class RefImpl {
  1414. constructor(value, __v_isShallow) {
  1415. this.__v_isShallow = __v_isShallow;
  1416. this.dep = void 0;
  1417. this.__v_isRef = true;
  1418. this._rawValue = __v_isShallow ? value : toRaw(value);
  1419. this._value = __v_isShallow ? value : toReactive(value);
  1420. }
  1421. get value() {
  1422. trackRefValue(this);
  1423. return this._value;
  1424. }
  1425. set value(newVal) {
  1426. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1427. newVal = useDirectValue ? newVal : toRaw(newVal);
  1428. if (hasChanged(newVal, this._rawValue)) {
  1429. this._rawValue = newVal;
  1430. this._value = useDirectValue ? newVal : toReactive(newVal);
  1431. triggerRefValue(this, 4, newVal);
  1432. }
  1433. }
  1434. }
  1435. function unref(ref2) {
  1436. return isRef(ref2) ? ref2.value : ref2;
  1437. }
  1438. const shallowUnwrapHandlers = {
  1439. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1440. set: (target, key, value, receiver) => {
  1441. const oldValue = target[key];
  1442. if (isRef(oldValue) && !isRef(value)) {
  1443. oldValue.value = value;
  1444. return true;
  1445. } else {
  1446. return Reflect.set(target, key, value, receiver);
  1447. }
  1448. }
  1449. };
  1450. function proxyRefs(objectWithRefs) {
  1451. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1452. }
  1453. const stack = [];
  1454. function pushWarningContext(vnode) {
  1455. stack.push(vnode);
  1456. }
  1457. function popWarningContext() {
  1458. stack.pop();
  1459. }
  1460. function warn$1(msg, ...args) {
  1461. pauseTracking();
  1462. const instance = stack.length ? stack[stack.length - 1].component : null;
  1463. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1464. const trace = getComponentTrace();
  1465. if (appWarnHandler) {
  1466. callWithErrorHandling(
  1467. appWarnHandler,
  1468. instance,
  1469. 11,
  1470. [
  1471. msg + args.map((a) => {
  1472. var _a, _b;
  1473. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1474. }).join(""),
  1475. instance && instance.proxy,
  1476. trace.map(
  1477. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1478. ).join("\n"),
  1479. trace
  1480. ]
  1481. );
  1482. } else {
  1483. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1484. if (trace.length && // avoid spamming console during tests
  1485. true) {
  1486. warnArgs.push(`
  1487. `, ...formatTrace(trace));
  1488. }
  1489. console.warn(...warnArgs);
  1490. }
  1491. resetTracking();
  1492. }
  1493. function getComponentTrace() {
  1494. let currentVNode = stack[stack.length - 1];
  1495. if (!currentVNode) {
  1496. return [];
  1497. }
  1498. const normalizedStack = [];
  1499. while (currentVNode) {
  1500. const last = normalizedStack[0];
  1501. if (last && last.vnode === currentVNode) {
  1502. last.recurseCount++;
  1503. } else {
  1504. normalizedStack.push({
  1505. vnode: currentVNode,
  1506. recurseCount: 0
  1507. });
  1508. }
  1509. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1510. currentVNode = parentInstance && parentInstance.vnode;
  1511. }
  1512. return normalizedStack;
  1513. }
  1514. function formatTrace(trace) {
  1515. const logs = [];
  1516. trace.forEach((entry, i) => {
  1517. logs.push(...i === 0 ? [] : [`
  1518. `], ...formatTraceEntry(entry));
  1519. });
  1520. return logs;
  1521. }
  1522. function formatTraceEntry({ vnode, recurseCount }) {
  1523. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1524. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1525. const open = ` at <${formatComponentName(
  1526. vnode.component,
  1527. vnode.type,
  1528. isRoot
  1529. )}`;
  1530. const close = `>` + postfix;
  1531. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1532. }
  1533. function formatProps(props) {
  1534. const res = [];
  1535. const keys = Object.keys(props);
  1536. keys.slice(0, 3).forEach((key) => {
  1537. res.push(...formatProp(key, props[key]));
  1538. });
  1539. if (keys.length > 3) {
  1540. res.push(` ...`);
  1541. }
  1542. return res;
  1543. }
  1544. function formatProp(key, value, raw) {
  1545. if (isString$2(value)) {
  1546. value = JSON.stringify(value);
  1547. return raw ? value : [`${key}=${value}`];
  1548. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1549. return raw ? value : [`${key}=${value}`];
  1550. } else if (isRef(value)) {
  1551. value = formatProp(key, toRaw(value.value), true);
  1552. return raw ? value : [`${key}=Ref<`, value, `>`];
  1553. } else if (isFunction$2(value)) {
  1554. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1555. } else {
  1556. value = toRaw(value);
  1557. return raw ? value : [`${key}=`, value];
  1558. }
  1559. }
  1560. const ErrorTypeStrings = {
  1561. ["sp"]: "serverPrefetch hook",
  1562. ["bc"]: "beforeCreate hook",
  1563. ["c"]: "created hook",
  1564. ["bm"]: "beforeMount hook",
  1565. ["m"]: "mounted hook",
  1566. ["bu"]: "beforeUpdate hook",
  1567. ["u"]: "updated",
  1568. ["bum"]: "beforeUnmount hook",
  1569. ["um"]: "unmounted hook",
  1570. ["a"]: "activated hook",
  1571. ["da"]: "deactivated hook",
  1572. ["ec"]: "errorCaptured hook",
  1573. ["rtc"]: "renderTracked hook",
  1574. ["rtg"]: "renderTriggered hook",
  1575. [0]: "setup function",
  1576. [1]: "render function",
  1577. [2]: "watcher getter",
  1578. [3]: "watcher callback",
  1579. [4]: "watcher cleanup function",
  1580. [5]: "native event handler",
  1581. [6]: "component event handler",
  1582. [7]: "vnode hook",
  1583. [8]: "directive hook",
  1584. [9]: "transition hook",
  1585. [10]: "app errorHandler",
  1586. [11]: "app warnHandler",
  1587. [12]: "ref function",
  1588. [13]: "async component loader",
  1589. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  1590. };
  1591. function callWithErrorHandling(fn, instance, type, args) {
  1592. try {
  1593. return args ? fn(...args) : fn();
  1594. } catch (err) {
  1595. handleError(err, instance, type);
  1596. }
  1597. }
  1598. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1599. if (isFunction$2(fn)) {
  1600. const res = callWithErrorHandling(fn, instance, type, args);
  1601. if (res && isPromise(res)) {
  1602. res.catch((err) => {
  1603. handleError(err, instance, type);
  1604. });
  1605. }
  1606. return res;
  1607. }
  1608. const values = [];
  1609. for (let i = 0; i < fn.length; i++) {
  1610. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1611. }
  1612. return values;
  1613. }
  1614. function handleError(err, instance, type, throwInDev = true) {
  1615. const contextVNode = instance ? instance.vnode : null;
  1616. if (instance) {
  1617. let cur = instance.parent;
  1618. const exposedInstance = instance.proxy;
  1619. const errorInfo = ErrorTypeStrings[type] || type;
  1620. while (cur) {
  1621. const errorCapturedHooks = cur.ec;
  1622. if (errorCapturedHooks) {
  1623. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1624. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1625. return;
  1626. }
  1627. }
  1628. }
  1629. cur = cur.parent;
  1630. }
  1631. const appErrorHandler = instance.appContext.config.errorHandler;
  1632. if (appErrorHandler) {
  1633. callWithErrorHandling(
  1634. appErrorHandler,
  1635. null,
  1636. 10,
  1637. [err, exposedInstance, errorInfo]
  1638. );
  1639. return;
  1640. }
  1641. }
  1642. logError(err, type, contextVNode, throwInDev);
  1643. }
  1644. function logError(err, type, contextVNode, throwInDev = true) {
  1645. {
  1646. const info = ErrorTypeStrings[type] || type;
  1647. if (contextVNode) {
  1648. pushWarningContext(contextVNode);
  1649. }
  1650. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1651. if (contextVNode) {
  1652. popWarningContext();
  1653. }
  1654. if (throwInDev) {
  1655. console.error(err);
  1656. } else {
  1657. console.error(err);
  1658. }
  1659. }
  1660. }
  1661. let isFlushing = false;
  1662. let isFlushPending = false;
  1663. const queue$1 = [];
  1664. let flushIndex = 0;
  1665. const pendingPostFlushCbs = [];
  1666. let activePostFlushCbs = null;
  1667. let postFlushIndex = 0;
  1668. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1669. let currentFlushPromise = null;
  1670. const RECURSION_LIMIT = 100;
  1671. function nextTick$1(fn) {
  1672. const p2 = currentFlushPromise || resolvedPromise;
  1673. return fn ? p2.then(this ? fn.bind(this) : fn) : p2;
  1674. }
  1675. function findInsertionIndex(id) {
  1676. let start = flushIndex + 1;
  1677. let end = queue$1.length;
  1678. while (start < end) {
  1679. const middle = start + end >>> 1;
  1680. const middleJob = queue$1[middle];
  1681. const middleJobId = getId(middleJob);
  1682. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1683. start = middle + 1;
  1684. } else {
  1685. end = middle;
  1686. }
  1687. }
  1688. return start;
  1689. }
  1690. function queueJob(job) {
  1691. if (!queue$1.length || !queue$1.includes(
  1692. job,
  1693. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1694. )) {
  1695. if (job.id == null) {
  1696. queue$1.push(job);
  1697. } else {
  1698. queue$1.splice(findInsertionIndex(job.id), 0, job);
  1699. }
  1700. queueFlush();
  1701. }
  1702. }
  1703. function queueFlush() {
  1704. if (!isFlushing && !isFlushPending) {
  1705. isFlushPending = true;
  1706. currentFlushPromise = resolvedPromise.then(flushJobs);
  1707. }
  1708. }
  1709. function hasQueueJob(job) {
  1710. return queue$1.indexOf(job) > -1;
  1711. }
  1712. function invalidateJob(job) {
  1713. const i = queue$1.indexOf(job);
  1714. if (i > flushIndex) {
  1715. queue$1.splice(i, 1);
  1716. }
  1717. }
  1718. function queuePostFlushCb(cb) {
  1719. if (!isArray$2(cb)) {
  1720. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1721. cb,
  1722. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1723. )) {
  1724. pendingPostFlushCbs.push(cb);
  1725. }
  1726. } else {
  1727. pendingPostFlushCbs.push(...cb);
  1728. }
  1729. queueFlush();
  1730. }
  1731. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1732. {
  1733. seen = seen || /* @__PURE__ */ new Map();
  1734. }
  1735. for (; i < queue$1.length; i++) {
  1736. const cb = queue$1[i];
  1737. if (cb && cb.pre) {
  1738. if (checkRecursiveUpdates(seen, cb)) {
  1739. continue;
  1740. }
  1741. queue$1.splice(i, 1);
  1742. i--;
  1743. cb();
  1744. }
  1745. }
  1746. }
  1747. function flushPostFlushCbs(seen) {
  1748. if (pendingPostFlushCbs.length) {
  1749. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1750. (a, b) => getId(a) - getId(b)
  1751. );
  1752. pendingPostFlushCbs.length = 0;
  1753. if (activePostFlushCbs) {
  1754. activePostFlushCbs.push(...deduped);
  1755. return;
  1756. }
  1757. activePostFlushCbs = deduped;
  1758. {
  1759. seen = seen || /* @__PURE__ */ new Map();
  1760. }
  1761. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1762. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1763. continue;
  1764. }
  1765. activePostFlushCbs[postFlushIndex]();
  1766. }
  1767. activePostFlushCbs = null;
  1768. postFlushIndex = 0;
  1769. }
  1770. }
  1771. const getId = (job) => job.id == null ? Infinity : job.id;
  1772. const comparator = (a, b) => {
  1773. const diff2 = getId(a) - getId(b);
  1774. if (diff2 === 0) {
  1775. if (a.pre && !b.pre)
  1776. return -1;
  1777. if (b.pre && !a.pre)
  1778. return 1;
  1779. }
  1780. return diff2;
  1781. };
  1782. function flushJobs(seen) {
  1783. isFlushPending = false;
  1784. isFlushing = true;
  1785. {
  1786. seen = seen || /* @__PURE__ */ new Map();
  1787. }
  1788. queue$1.sort(comparator);
  1789. const check = (job) => checkRecursiveUpdates(seen, job);
  1790. try {
  1791. for (flushIndex = 0; flushIndex < queue$1.length; flushIndex++) {
  1792. const job = queue$1[flushIndex];
  1793. if (job && job.active !== false) {
  1794. if (check(job)) {
  1795. continue;
  1796. }
  1797. callWithErrorHandling(job, null, 14);
  1798. }
  1799. }
  1800. } finally {
  1801. flushIndex = 0;
  1802. queue$1.length = 0;
  1803. flushPostFlushCbs(seen);
  1804. isFlushing = false;
  1805. currentFlushPromise = null;
  1806. if (queue$1.length || pendingPostFlushCbs.length) {
  1807. flushJobs(seen);
  1808. }
  1809. }
  1810. }
  1811. function checkRecursiveUpdates(seen, fn) {
  1812. if (!seen.has(fn)) {
  1813. seen.set(fn, 1);
  1814. } else {
  1815. const count = seen.get(fn);
  1816. if (count > RECURSION_LIMIT) {
  1817. const instance = fn.ownerInstance;
  1818. const componentName = instance && getComponentName(instance.type);
  1819. handleError(
  1820. `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
  1821. null,
  1822. 10
  1823. );
  1824. return true;
  1825. } else {
  1826. seen.set(fn, count + 1);
  1827. }
  1828. }
  1829. }
  1830. let devtools;
  1831. let buffer = [];
  1832. let devtoolsNotInstalled = false;
  1833. function emit$1(event, ...args) {
  1834. if (devtools) {
  1835. devtools.emit(event, ...args);
  1836. } else if (!devtoolsNotInstalled) {
  1837. buffer.push({ event, args });
  1838. }
  1839. }
  1840. function setDevtoolsHook(hook, target) {
  1841. var _a, _b;
  1842. devtools = hook;
  1843. if (devtools) {
  1844. devtools.enabled = true;
  1845. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  1846. buffer = [];
  1847. } else if (
  1848. // handle late devtools injection - only do this if we are in an actual
  1849. // browser environment to avoid the timer handle stalling test runner exit
  1850. // (#4815)
  1851. typeof window !== "undefined" && // some envs mock window but not fully
  1852. window.HTMLElement && // also exclude jsdom
  1853. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1854. ) {
  1855. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1856. replay.push((newHook) => {
  1857. setDevtoolsHook(newHook, target);
  1858. });
  1859. setTimeout(() => {
  1860. if (!devtools) {
  1861. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1862. devtoolsNotInstalled = true;
  1863. buffer = [];
  1864. }
  1865. }, 3e3);
  1866. } else {
  1867. devtoolsNotInstalled = true;
  1868. buffer = [];
  1869. }
  1870. }
  1871. function devtoolsInitApp(app, version2) {
  1872. emit$1("app:init", app, version2, {
  1873. Fragment,
  1874. Text,
  1875. Comment,
  1876. Static
  1877. });
  1878. }
  1879. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  1880. "component:added"
  1881. /* COMPONENT_ADDED */
  1882. );
  1883. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(
  1884. "component:updated"
  1885. /* COMPONENT_UPDATED */
  1886. );
  1887. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  1888. "component:removed"
  1889. /* COMPONENT_REMOVED */
  1890. );
  1891. const devtoolsComponentRemoved = (component) => {
  1892. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  1893. !devtools.cleanupBuffer(component)) {
  1894. _devtoolsComponentRemoved(component);
  1895. }
  1896. };
  1897. /*! #__NO_SIDE_EFFECTS__ */
  1898. // @__NO_SIDE_EFFECTS__
  1899. function createDevtoolsComponentHook(hook) {
  1900. return (component) => {
  1901. emit$1(
  1902. hook,
  1903. component.appContext.app,
  1904. component.uid,
  1905. // fixed by xxxxxx
  1906. // 为 0 是 App,无 parent 是 Page 指向 App
  1907. component.uid === 0 ? void 0 : component.parent ? component.parent.uid : 0,
  1908. component
  1909. );
  1910. };
  1911. }
  1912. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1913. "perf:start"
  1914. /* PERFORMANCE_START */
  1915. );
  1916. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1917. "perf:end"
  1918. /* PERFORMANCE_END */
  1919. );
  1920. function createDevtoolsPerformanceHook(hook) {
  1921. return (component, type, time) => {
  1922. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  1923. };
  1924. }
  1925. function devtoolsComponentEmit(component, event, params) {
  1926. emit$1(
  1927. "component:emit",
  1928. component.appContext.app,
  1929. component,
  1930. event,
  1931. params
  1932. );
  1933. }
  1934. function emit(instance, event, ...rawArgs) {
  1935. if (instance.isUnmounted)
  1936. return;
  1937. const props = instance.vnode.props || EMPTY_OBJ;
  1938. {
  1939. const {
  1940. emitsOptions,
  1941. propsOptions: [propsOptions]
  1942. } = instance;
  1943. if (emitsOptions) {
  1944. if (!(event in emitsOptions) && true) {
  1945. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  1946. warn$1(
  1947. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  1948. );
  1949. }
  1950. } else {
  1951. const validator2 = emitsOptions[event];
  1952. if (isFunction$2(validator2)) {
  1953. const isValid = validator2(...rawArgs);
  1954. if (!isValid) {
  1955. warn$1(
  1956. `Invalid event arguments: event validation failed for event "${event}".`
  1957. );
  1958. }
  1959. }
  1960. }
  1961. }
  1962. }
  1963. let args = rawArgs;
  1964. const isModelListener2 = event.startsWith("update:");
  1965. const modelArg = isModelListener2 && event.slice(7);
  1966. if (modelArg && modelArg in props) {
  1967. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  1968. const { number, trim: trim2 } = props[modifiersKey] || EMPTY_OBJ;
  1969. if (trim2) {
  1970. args = rawArgs.map((a) => isString$2(a) ? a.trim() : a);
  1971. }
  1972. if (number) {
  1973. args = rawArgs.map(looseToNumber);
  1974. }
  1975. }
  1976. {
  1977. devtoolsComponentEmit(instance, event, args);
  1978. }
  1979. {
  1980. const lowerCaseEvent = event.toLowerCase();
  1981. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  1982. warn$1(
  1983. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  1984. instance,
  1985. instance.type
  1986. )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
  1987. event
  1988. )}" instead of "${event}".`
  1989. );
  1990. }
  1991. }
  1992. let handlerName;
  1993. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  1994. props[handlerName = toHandlerKey(camelize(event))];
  1995. if (!handler && isModelListener2) {
  1996. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  1997. }
  1998. if (handler) {
  1999. callWithAsyncErrorHandling(
  2000. handler,
  2001. instance,
  2002. 6,
  2003. args
  2004. );
  2005. }
  2006. const onceHandler = props[handlerName + `Once`];
  2007. if (onceHandler) {
  2008. if (!instance.emitted) {
  2009. instance.emitted = {};
  2010. } else if (instance.emitted[handlerName]) {
  2011. return;
  2012. }
  2013. instance.emitted[handlerName] = true;
  2014. callWithAsyncErrorHandling(
  2015. onceHandler,
  2016. instance,
  2017. 6,
  2018. args
  2019. );
  2020. }
  2021. }
  2022. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2023. const cache = appContext.emitsCache;
  2024. const cached = cache.get(comp);
  2025. if (cached !== void 0) {
  2026. return cached;
  2027. }
  2028. const raw = comp.emits;
  2029. let normalized = {};
  2030. let hasExtends = false;
  2031. if (!isFunction$2(comp)) {
  2032. const extendEmits = (raw2) => {
  2033. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2034. if (normalizedFromExtend) {
  2035. hasExtends = true;
  2036. extend$2(normalized, normalizedFromExtend);
  2037. }
  2038. };
  2039. if (!asMixin && appContext.mixins.length) {
  2040. appContext.mixins.forEach(extendEmits);
  2041. }
  2042. if (comp.extends) {
  2043. extendEmits(comp.extends);
  2044. }
  2045. if (comp.mixins) {
  2046. comp.mixins.forEach(extendEmits);
  2047. }
  2048. }
  2049. if (!raw && !hasExtends) {
  2050. if (isObject$2(comp)) {
  2051. cache.set(comp, null);
  2052. }
  2053. return null;
  2054. }
  2055. if (isArray$2(raw)) {
  2056. raw.forEach((key) => normalized[key] = null);
  2057. } else {
  2058. extend$2(normalized, raw);
  2059. }
  2060. if (isObject$2(comp)) {
  2061. cache.set(comp, normalized);
  2062. }
  2063. return normalized;
  2064. }
  2065. function isEmitListener(options, key) {
  2066. if (!options || !isOn(key)) {
  2067. return false;
  2068. }
  2069. key = key.slice(2).replace(/Once$/, "");
  2070. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2071. }
  2072. let currentRenderingInstance = null;
  2073. function setCurrentRenderingInstance(instance) {
  2074. const prev = currentRenderingInstance;
  2075. currentRenderingInstance = instance;
  2076. instance && instance.type.__scopeId || null;
  2077. return prev;
  2078. }
  2079. const INITIAL_WATCHER_VALUE = {};
  2080. function watch(source, cb, options) {
  2081. if (!isFunction$2(cb)) {
  2082. warn$1(
  2083. `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
  2084. );
  2085. }
  2086. return doWatch(source, cb, options);
  2087. }
  2088. function doWatch(source, cb, {
  2089. immediate,
  2090. deep,
  2091. flush,
  2092. once: once2,
  2093. onTrack,
  2094. onTrigger
  2095. } = EMPTY_OBJ) {
  2096. if (cb && once2) {
  2097. const _cb = cb;
  2098. cb = (...args) => {
  2099. _cb(...args);
  2100. unwatch();
  2101. };
  2102. }
  2103. if (deep !== void 0 && typeof deep === "number") {
  2104. warn$1(
  2105. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  2106. );
  2107. }
  2108. if (!cb) {
  2109. if (immediate !== void 0) {
  2110. warn$1(
  2111. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  2112. );
  2113. }
  2114. if (deep !== void 0) {
  2115. warn$1(
  2116. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  2117. );
  2118. }
  2119. if (once2 !== void 0) {
  2120. warn$1(
  2121. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  2122. );
  2123. }
  2124. }
  2125. const warnInvalidSource = (s2) => {
  2126. warn$1(
  2127. `Invalid watch source: `,
  2128. s2,
  2129. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2130. );
  2131. };
  2132. const instance = currentInstance;
  2133. const reactiveGetter = (source2) => deep === true ? source2 : (
  2134. // for deep: false, only traverse root-level properties
  2135. traverse(source2, deep === false ? 1 : void 0)
  2136. );
  2137. let getter;
  2138. let forceTrigger = false;
  2139. let isMultiSource = false;
  2140. if (isRef(source)) {
  2141. getter = () => source.value;
  2142. forceTrigger = isShallow(source);
  2143. } else if (isReactive(source)) {
  2144. getter = () => reactiveGetter(source);
  2145. forceTrigger = true;
  2146. } else if (isArray$2(source)) {
  2147. isMultiSource = true;
  2148. forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2));
  2149. getter = () => source.map((s2) => {
  2150. if (isRef(s2)) {
  2151. return s2.value;
  2152. } else if (isReactive(s2)) {
  2153. return reactiveGetter(s2);
  2154. } else if (isFunction$2(s2)) {
  2155. return callWithErrorHandling(s2, instance, 2);
  2156. } else {
  2157. warnInvalidSource(s2);
  2158. }
  2159. });
  2160. } else if (isFunction$2(source)) {
  2161. if (cb) {
  2162. getter = () => callWithErrorHandling(source, instance, 2);
  2163. } else {
  2164. getter = () => {
  2165. if (cleanup) {
  2166. cleanup();
  2167. }
  2168. return callWithAsyncErrorHandling(
  2169. source,
  2170. instance,
  2171. 3,
  2172. [onCleanup]
  2173. );
  2174. };
  2175. }
  2176. } else {
  2177. getter = NOOP;
  2178. warnInvalidSource(source);
  2179. }
  2180. if (cb && deep) {
  2181. const baseGetter = getter;
  2182. getter = () => traverse(baseGetter());
  2183. }
  2184. let cleanup;
  2185. let onCleanup = (fn) => {
  2186. cleanup = effect2.onStop = () => {
  2187. callWithErrorHandling(fn, instance, 4);
  2188. cleanup = effect2.onStop = void 0;
  2189. };
  2190. };
  2191. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2192. const job = () => {
  2193. if (!effect2.active || !effect2.dirty) {
  2194. return;
  2195. }
  2196. if (cb) {
  2197. const newValue = effect2.run();
  2198. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  2199. if (cleanup) {
  2200. cleanup();
  2201. }
  2202. callWithAsyncErrorHandling(cb, instance, 3, [
  2203. newValue,
  2204. // pass undefined as the old value when it's changed for the first time
  2205. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2206. onCleanup
  2207. ]);
  2208. oldValue = newValue;
  2209. }
  2210. } else {
  2211. effect2.run();
  2212. }
  2213. };
  2214. job.allowRecurse = !!cb;
  2215. let scheduler;
  2216. if (flush === "sync") {
  2217. scheduler = job;
  2218. } else if (flush === "post") {
  2219. scheduler = () => queuePostRenderEffect$1(job, instance && instance.suspense);
  2220. } else {
  2221. job.pre = true;
  2222. if (instance)
  2223. job.id = instance.uid;
  2224. scheduler = () => queueJob(job);
  2225. }
  2226. const effect2 = new ReactiveEffect(getter, NOOP, scheduler);
  2227. const scope = getCurrentScope();
  2228. const unwatch = () => {
  2229. effect2.stop();
  2230. if (scope) {
  2231. remove(scope.effects, effect2);
  2232. }
  2233. };
  2234. {
  2235. effect2.onTrack = onTrack;
  2236. effect2.onTrigger = onTrigger;
  2237. }
  2238. if (cb) {
  2239. if (immediate) {
  2240. job();
  2241. } else {
  2242. oldValue = effect2.run();
  2243. }
  2244. } else if (flush === "post") {
  2245. queuePostRenderEffect$1(
  2246. effect2.run.bind(effect2),
  2247. instance && instance.suspense
  2248. );
  2249. } else {
  2250. effect2.run();
  2251. }
  2252. return unwatch;
  2253. }
  2254. function instanceWatch(source, value, options) {
  2255. const publicThis = this.proxy;
  2256. const getter = isString$2(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  2257. let cb;
  2258. if (isFunction$2(value)) {
  2259. cb = value;
  2260. } else {
  2261. cb = value.handler;
  2262. options = value;
  2263. }
  2264. const reset = setCurrentInstance(this);
  2265. const res = doWatch(getter, cb.bind(publicThis), options);
  2266. reset();
  2267. return res;
  2268. }
  2269. function createPathGetter(ctx, path) {
  2270. const segments = path.split(".");
  2271. return () => {
  2272. let cur = ctx;
  2273. for (let i = 0; i < segments.length && cur; i++) {
  2274. cur = cur[segments[i]];
  2275. }
  2276. return cur;
  2277. };
  2278. }
  2279. function traverse(value, depth, currentDepth = 0, seen) {
  2280. if (!isObject$2(value) || value["__v_skip"]) {
  2281. return value;
  2282. }
  2283. if (depth && depth > 0) {
  2284. if (currentDepth >= depth) {
  2285. return value;
  2286. }
  2287. currentDepth++;
  2288. }
  2289. seen = seen || /* @__PURE__ */ new Set();
  2290. if (seen.has(value)) {
  2291. return value;
  2292. }
  2293. seen.add(value);
  2294. if (isRef(value)) {
  2295. traverse(value.value, depth, currentDepth, seen);
  2296. } else if (isArray$2(value)) {
  2297. for (let i = 0; i < value.length; i++) {
  2298. traverse(value[i], depth, currentDepth, seen);
  2299. }
  2300. } else if (isSet(value) || isMap(value)) {
  2301. value.forEach((v) => {
  2302. traverse(v, depth, currentDepth, seen);
  2303. });
  2304. } else if (isPlainObject$1(value)) {
  2305. for (const key in value) {
  2306. traverse(value[key], depth, currentDepth, seen);
  2307. }
  2308. }
  2309. return value;
  2310. }
  2311. function validateDirectiveName(name) {
  2312. if (isBuiltInDirective(name)) {
  2313. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2314. }
  2315. }
  2316. function createAppContext() {
  2317. return {
  2318. app: null,
  2319. config: {
  2320. isNativeTag: NO,
  2321. performance: false,
  2322. globalProperties: {},
  2323. optionMergeStrategies: {},
  2324. errorHandler: void 0,
  2325. warnHandler: void 0,
  2326. compilerOptions: {}
  2327. },
  2328. mixins: [],
  2329. components: {},
  2330. directives: {},
  2331. provides: /* @__PURE__ */ Object.create(null),
  2332. optionsCache: /* @__PURE__ */ new WeakMap(),
  2333. propsCache: /* @__PURE__ */ new WeakMap(),
  2334. emitsCache: /* @__PURE__ */ new WeakMap()
  2335. };
  2336. }
  2337. let uid$1 = 0;
  2338. function createAppAPI(render, hydrate) {
  2339. return function createApp2(rootComponent, rootProps = null) {
  2340. if (!isFunction$2(rootComponent)) {
  2341. rootComponent = extend$2({}, rootComponent);
  2342. }
  2343. if (rootProps != null && !isObject$2(rootProps)) {
  2344. warn$1(`root props passed to app.mount() must be an object.`);
  2345. rootProps = null;
  2346. }
  2347. const context = createAppContext();
  2348. const installedPlugins = /* @__PURE__ */ new WeakSet();
  2349. const app = context.app = {
  2350. _uid: uid$1++,
  2351. _component: rootComponent,
  2352. _props: rootProps,
  2353. _container: null,
  2354. _context: context,
  2355. _instance: null,
  2356. version,
  2357. get config() {
  2358. return context.config;
  2359. },
  2360. set config(v) {
  2361. {
  2362. warn$1(
  2363. `app.config cannot be replaced. Modify individual options instead.`
  2364. );
  2365. }
  2366. },
  2367. use(plugin2, ...options) {
  2368. if (installedPlugins.has(plugin2)) {
  2369. warn$1(`Plugin has already been applied to target app.`);
  2370. } else if (plugin2 && isFunction$2(plugin2.install)) {
  2371. installedPlugins.add(plugin2);
  2372. plugin2.install(app, ...options);
  2373. } else if (isFunction$2(plugin2)) {
  2374. installedPlugins.add(plugin2);
  2375. plugin2(app, ...options);
  2376. } else {
  2377. warn$1(
  2378. `A plugin must either be a function or an object with an "install" function.`
  2379. );
  2380. }
  2381. return app;
  2382. },
  2383. mixin(mixin) {
  2384. {
  2385. if (!context.mixins.includes(mixin)) {
  2386. context.mixins.push(mixin);
  2387. } else {
  2388. warn$1(
  2389. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  2390. );
  2391. }
  2392. }
  2393. return app;
  2394. },
  2395. component(name, component) {
  2396. {
  2397. validateComponentName(name, context.config);
  2398. }
  2399. if (!component) {
  2400. return context.components[name];
  2401. }
  2402. if (context.components[name]) {
  2403. warn$1(`Component "${name}" has already been registered in target app.`);
  2404. }
  2405. context.components[name] = component;
  2406. return app;
  2407. },
  2408. directive(name, directive) {
  2409. {
  2410. validateDirectiveName(name);
  2411. }
  2412. if (!directive) {
  2413. return context.directives[name];
  2414. }
  2415. if (context.directives[name]) {
  2416. warn$1(`Directive "${name}" has already been registered in target app.`);
  2417. }
  2418. context.directives[name] = directive;
  2419. return app;
  2420. },
  2421. // fixed by xxxxxx
  2422. mount() {
  2423. },
  2424. // fixed by xxxxxx
  2425. unmount() {
  2426. },
  2427. provide(key, value) {
  2428. if (key in context.provides) {
  2429. warn$1(
  2430. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  2431. );
  2432. }
  2433. context.provides[key] = value;
  2434. return app;
  2435. },
  2436. runWithContext(fn) {
  2437. const lastApp = currentApp;
  2438. currentApp = app;
  2439. try {
  2440. return fn();
  2441. } finally {
  2442. currentApp = lastApp;
  2443. }
  2444. }
  2445. };
  2446. return app;
  2447. };
  2448. }
  2449. let currentApp = null;
  2450. function provide(key, value) {
  2451. if (!currentInstance) {
  2452. {
  2453. warn$1(`provide() can only be used inside setup().`);
  2454. }
  2455. } else {
  2456. let provides = currentInstance.provides;
  2457. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2458. if (parentProvides === provides) {
  2459. provides = currentInstance.provides = Object.create(parentProvides);
  2460. }
  2461. provides[key] = value;
  2462. if (currentInstance.type.mpType === "app") {
  2463. currentInstance.appContext.app.provide(key, value);
  2464. }
  2465. }
  2466. }
  2467. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  2468. const instance = currentInstance || currentRenderingInstance;
  2469. if (instance || currentApp) {
  2470. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  2471. if (provides && key in provides) {
  2472. return provides[key];
  2473. } else if (arguments.length > 1) {
  2474. return treatDefaultAsFactory && isFunction$2(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  2475. } else {
  2476. warn$1(`injection "${String(key)}" not found.`);
  2477. }
  2478. } else {
  2479. warn$1(`inject() can only be used inside setup() or functional components.`);
  2480. }
  2481. }
  2482. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2483. function onActivated(hook, target) {
  2484. registerKeepAliveHook(hook, "a", target);
  2485. }
  2486. function onDeactivated(hook, target) {
  2487. registerKeepAliveHook(hook, "da", target);
  2488. }
  2489. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2490. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2491. let current = target;
  2492. while (current) {
  2493. if (current.isDeactivated) {
  2494. return;
  2495. }
  2496. current = current.parent;
  2497. }
  2498. return hook();
  2499. });
  2500. injectHook(type, wrappedHook, target);
  2501. if (target) {
  2502. let current = target.parent;
  2503. while (current && current.parent) {
  2504. if (isKeepAlive(current.parent.vnode)) {
  2505. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2506. }
  2507. current = current.parent;
  2508. }
  2509. }
  2510. }
  2511. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2512. const injected = injectHook(
  2513. type,
  2514. hook,
  2515. keepAliveRoot,
  2516. true
  2517. /* prepend */
  2518. );
  2519. onUnmounted(() => {
  2520. remove(keepAliveRoot[type], injected);
  2521. }, target);
  2522. }
  2523. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2524. if (target) {
  2525. if (isRootHook(type)) {
  2526. target = target.root;
  2527. }
  2528. const hooks = target[type] || (target[type] = []);
  2529. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2530. if (target.isUnmounted) {
  2531. return;
  2532. }
  2533. pauseTracking();
  2534. const reset = setCurrentInstance(target);
  2535. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2536. reset();
  2537. resetTracking();
  2538. return res;
  2539. });
  2540. if (prepend) {
  2541. hooks.unshift(wrappedHook);
  2542. } else {
  2543. hooks.push(wrappedHook);
  2544. }
  2545. return wrappedHook;
  2546. } else {
  2547. const apiName = toHandlerKey(
  2548. (ErrorTypeStrings[type] || type.replace(/^on/, "")).replace(/ hook$/, "")
  2549. );
  2550. warn$1(
  2551. `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().`
  2552. );
  2553. }
  2554. }
  2555. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2556. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2557. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2558. );
  2559. const onBeforeMount = createHook("bm");
  2560. const onMounted = createHook("m");
  2561. const onBeforeUpdate = createHook("bu");
  2562. const onUpdated = createHook("u");
  2563. const onBeforeUnmount = createHook("bum");
  2564. const onUnmounted = createHook("um");
  2565. const onServerPrefetch = createHook("sp");
  2566. const onRenderTriggered = createHook(
  2567. "rtg"
  2568. );
  2569. const onRenderTracked = createHook(
  2570. "rtc"
  2571. );
  2572. function onErrorCaptured(hook, target = currentInstance) {
  2573. injectHook("ec", hook, target);
  2574. }
  2575. const getPublicInstance = (i) => {
  2576. if (!i)
  2577. return null;
  2578. if (isStatefulComponent(i))
  2579. return getExposeProxy(i) || i.proxy;
  2580. return getPublicInstance(i.parent);
  2581. };
  2582. const publicPropertiesMap = (
  2583. // Move PURE marker to new line to workaround compiler discarding it
  2584. // due to type annotation
  2585. /* @__PURE__ */ extend$2(/* @__PURE__ */ Object.create(null), {
  2586. $: (i) => i,
  2587. // fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的
  2588. // $el: i => i.vnode.el,
  2589. $el: (i) => i.__$el || (i.__$el = {}),
  2590. $data: (i) => i.data,
  2591. $props: (i) => shallowReadonly(i.props),
  2592. $attrs: (i) => shallowReadonly(i.attrs),
  2593. $slots: (i) => shallowReadonly(i.slots),
  2594. $refs: (i) => shallowReadonly(i.refs),
  2595. $parent: (i) => getPublicInstance(i.parent),
  2596. $root: (i) => getPublicInstance(i.root),
  2597. $emit: (i) => i.emit,
  2598. $options: (i) => resolveMergedOptions(i),
  2599. $forceUpdate: (i) => i.f || (i.f = () => {
  2600. i.effect.dirty = true;
  2601. queueJob(i.update);
  2602. }),
  2603. // $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx
  2604. $watch: (i) => instanceWatch.bind(i)
  2605. })
  2606. );
  2607. const isReservedPrefix = (key) => key === "_" || key === "$";
  2608. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  2609. const PublicInstanceProxyHandlers = {
  2610. get({ _: instance }, key) {
  2611. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2612. if (key === "__isVue") {
  2613. return true;
  2614. }
  2615. let normalizedProps;
  2616. if (key[0] !== "$") {
  2617. const n2 = accessCache[key];
  2618. if (n2 !== void 0) {
  2619. switch (n2) {
  2620. case 1:
  2621. return setupState[key];
  2622. case 2:
  2623. return data[key];
  2624. case 4:
  2625. return ctx[key];
  2626. case 3:
  2627. return props[key];
  2628. }
  2629. } else if (hasSetupBinding(setupState, key)) {
  2630. accessCache[key] = 1;
  2631. return setupState[key];
  2632. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2633. accessCache[key] = 2;
  2634. return data[key];
  2635. } else if (
  2636. // only cache other properties when instance has declared (thus stable)
  2637. // props
  2638. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  2639. ) {
  2640. accessCache[key] = 3;
  2641. return props[key];
  2642. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2643. accessCache[key] = 4;
  2644. return ctx[key];
  2645. } else if (shouldCacheAccess) {
  2646. accessCache[key] = 0;
  2647. }
  2648. }
  2649. const publicGetter = publicPropertiesMap[key];
  2650. let cssModule, globalProperties;
  2651. if (publicGetter) {
  2652. if (key === "$attrs") {
  2653. track(instance, "get", key);
  2654. } else if (key === "$slots") {
  2655. track(instance, "get", key);
  2656. }
  2657. return publicGetter(instance);
  2658. } else if (
  2659. // css module (injected by vue-loader)
  2660. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2661. ) {
  2662. return cssModule;
  2663. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2664. accessCache[key] = 4;
  2665. return ctx[key];
  2666. } else if (
  2667. // global properties
  2668. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  2669. ) {
  2670. {
  2671. return globalProperties[key];
  2672. }
  2673. } else if (currentRenderingInstance && (!isString$2(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  2674. // to infinite warning loop
  2675. key.indexOf("__v") !== 0)) {
  2676. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  2677. warn$1(
  2678. `Property ${JSON.stringify(
  2679. key
  2680. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  2681. );
  2682. } else if (instance === currentRenderingInstance) {
  2683. warn$1(
  2684. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  2685. );
  2686. }
  2687. }
  2688. },
  2689. set({ _: instance }, key, value) {
  2690. const { data, setupState, ctx } = instance;
  2691. if (hasSetupBinding(setupState, key)) {
  2692. setupState[key] = value;
  2693. return true;
  2694. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  2695. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  2696. return false;
  2697. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2698. data[key] = value;
  2699. return true;
  2700. } else if (hasOwn(instance.props, key)) {
  2701. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  2702. return false;
  2703. }
  2704. if (key[0] === "$" && key.slice(1) in instance) {
  2705. warn$1(
  2706. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  2707. );
  2708. return false;
  2709. } else {
  2710. if (key in instance.appContext.config.globalProperties) {
  2711. Object.defineProperty(ctx, key, {
  2712. enumerable: true,
  2713. configurable: true,
  2714. value
  2715. });
  2716. } else {
  2717. ctx[key] = value;
  2718. }
  2719. }
  2720. return true;
  2721. },
  2722. has({
  2723. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2724. }, key) {
  2725. let normalizedProps;
  2726. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  2727. },
  2728. defineProperty(target, key, descriptor) {
  2729. if (descriptor.get != null) {
  2730. target._.accessCache[key] = 0;
  2731. } else if (hasOwn(descriptor, "value")) {
  2732. this.set(target, key, descriptor.value, null);
  2733. }
  2734. return Reflect.defineProperty(target, key, descriptor);
  2735. }
  2736. };
  2737. {
  2738. PublicInstanceProxyHandlers.ownKeys = (target) => {
  2739. warn$1(
  2740. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  2741. );
  2742. return Reflect.ownKeys(target);
  2743. };
  2744. }
  2745. function createDevRenderContext(instance) {
  2746. const target = {};
  2747. Object.defineProperty(target, `_`, {
  2748. configurable: true,
  2749. enumerable: false,
  2750. get: () => instance
  2751. });
  2752. Object.keys(publicPropertiesMap).forEach((key) => {
  2753. Object.defineProperty(target, key, {
  2754. configurable: true,
  2755. enumerable: false,
  2756. get: () => publicPropertiesMap[key](instance),
  2757. // intercepted by the proxy so no need for implementation,
  2758. // but needed to prevent set errors
  2759. set: NOOP
  2760. });
  2761. });
  2762. return target;
  2763. }
  2764. function exposePropsOnRenderContext(instance) {
  2765. const {
  2766. ctx,
  2767. propsOptions: [propsOptions]
  2768. } = instance;
  2769. if (propsOptions) {
  2770. Object.keys(propsOptions).forEach((key) => {
  2771. Object.defineProperty(ctx, key, {
  2772. enumerable: true,
  2773. configurable: true,
  2774. get: () => instance.props[key],
  2775. set: NOOP
  2776. });
  2777. });
  2778. }
  2779. }
  2780. function exposeSetupStateOnRenderContext(instance) {
  2781. const { ctx, setupState } = instance;
  2782. Object.keys(toRaw(setupState)).forEach((key) => {
  2783. if (!setupState.__isScriptSetup) {
  2784. if (isReservedPrefix(key[0])) {
  2785. warn$1(
  2786. `setup() return property ${JSON.stringify(
  2787. key
  2788. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  2789. );
  2790. return;
  2791. }
  2792. Object.defineProperty(ctx, key, {
  2793. enumerable: true,
  2794. configurable: true,
  2795. get: () => setupState[key],
  2796. set: NOOP
  2797. });
  2798. }
  2799. });
  2800. }
  2801. function normalizePropsOrEmits(props) {
  2802. return isArray$2(props) ? props.reduce(
  2803. (normalized, p2) => (normalized[p2] = null, normalized),
  2804. {}
  2805. ) : props;
  2806. }
  2807. function createDuplicateChecker() {
  2808. const cache = /* @__PURE__ */ Object.create(null);
  2809. return (type, key) => {
  2810. if (cache[key]) {
  2811. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  2812. } else {
  2813. cache[key] = type;
  2814. }
  2815. };
  2816. }
  2817. let shouldCacheAccess = true;
  2818. function applyOptions$1(instance) {
  2819. const options = resolveMergedOptions(instance);
  2820. const publicThis = instance.proxy;
  2821. const ctx = instance.ctx;
  2822. shouldCacheAccess = false;
  2823. if (options.beforeCreate) {
  2824. callHook$1(options.beforeCreate, instance, "bc");
  2825. }
  2826. const {
  2827. // state
  2828. data: dataOptions,
  2829. computed: computedOptions,
  2830. methods,
  2831. watch: watchOptions,
  2832. provide: provideOptions,
  2833. inject: injectOptions,
  2834. // lifecycle
  2835. created,
  2836. beforeMount,
  2837. mounted,
  2838. beforeUpdate,
  2839. updated,
  2840. activated,
  2841. deactivated,
  2842. beforeDestroy,
  2843. beforeUnmount,
  2844. destroyed,
  2845. unmounted,
  2846. render,
  2847. renderTracked,
  2848. renderTriggered,
  2849. errorCaptured,
  2850. serverPrefetch,
  2851. // public API
  2852. expose,
  2853. inheritAttrs,
  2854. // assets
  2855. components,
  2856. directives,
  2857. filters
  2858. } = options;
  2859. const checkDuplicateProperties = createDuplicateChecker();
  2860. {
  2861. const [propsOptions] = instance.propsOptions;
  2862. if (propsOptions) {
  2863. for (const key in propsOptions) {
  2864. checkDuplicateProperties("Props", key);
  2865. }
  2866. }
  2867. }
  2868. function initInjections() {
  2869. if (injectOptions) {
  2870. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  2871. }
  2872. }
  2873. {
  2874. initInjections();
  2875. }
  2876. if (methods) {
  2877. for (const key in methods) {
  2878. const methodHandler = methods[key];
  2879. if (isFunction$2(methodHandler)) {
  2880. {
  2881. Object.defineProperty(ctx, key, {
  2882. value: methodHandler.bind(publicThis),
  2883. configurable: true,
  2884. enumerable: true,
  2885. writable: true
  2886. });
  2887. }
  2888. {
  2889. checkDuplicateProperties("Methods", key);
  2890. }
  2891. } else {
  2892. warn$1(
  2893. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  2894. );
  2895. }
  2896. }
  2897. }
  2898. if (dataOptions) {
  2899. if (!isFunction$2(dataOptions)) {
  2900. warn$1(
  2901. `The data option must be a function. Plain object usage is no longer supported.`
  2902. );
  2903. }
  2904. const data = dataOptions.call(publicThis, publicThis);
  2905. if (isPromise(data)) {
  2906. warn$1(
  2907. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  2908. );
  2909. }
  2910. if (!isObject$2(data)) {
  2911. warn$1(`data() should return an object.`);
  2912. } else {
  2913. instance.data = reactive(data);
  2914. {
  2915. for (const key in data) {
  2916. checkDuplicateProperties("Data", key);
  2917. if (!isReservedPrefix(key[0])) {
  2918. Object.defineProperty(ctx, key, {
  2919. configurable: true,
  2920. enumerable: true,
  2921. get: () => data[key],
  2922. set: NOOP
  2923. });
  2924. }
  2925. }
  2926. }
  2927. }
  2928. }
  2929. shouldCacheAccess = true;
  2930. if (computedOptions) {
  2931. for (const key in computedOptions) {
  2932. const opt = computedOptions[key];
  2933. const get2 = isFunction$2(opt) ? opt.bind(publicThis, publicThis) : isFunction$2(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  2934. if (get2 === NOOP) {
  2935. warn$1(`Computed property "${key}" has no getter.`);
  2936. }
  2937. const set2 = !isFunction$2(opt) && isFunction$2(opt.set) ? opt.set.bind(publicThis) : () => {
  2938. warn$1(
  2939. `Write operation failed: computed property "${key}" is readonly.`
  2940. );
  2941. };
  2942. const c2 = computed({
  2943. get: get2,
  2944. set: set2
  2945. });
  2946. Object.defineProperty(ctx, key, {
  2947. enumerable: true,
  2948. configurable: true,
  2949. get: () => c2.value,
  2950. set: (v) => c2.value = v
  2951. });
  2952. {
  2953. checkDuplicateProperties("Computed", key);
  2954. }
  2955. }
  2956. }
  2957. if (watchOptions) {
  2958. for (const key in watchOptions) {
  2959. createWatcher(watchOptions[key], ctx, publicThis, key);
  2960. }
  2961. }
  2962. function initProvides() {
  2963. if (provideOptions) {
  2964. const provides = isFunction$2(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  2965. Reflect.ownKeys(provides).forEach((key) => {
  2966. provide(key, provides[key]);
  2967. });
  2968. }
  2969. }
  2970. {
  2971. initProvides();
  2972. }
  2973. {
  2974. if (created) {
  2975. callHook$1(created, instance, "c");
  2976. }
  2977. }
  2978. function registerLifecycleHook(register, hook) {
  2979. if (isArray$2(hook)) {
  2980. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  2981. } else if (hook) {
  2982. register(hook.bind(publicThis));
  2983. }
  2984. }
  2985. registerLifecycleHook(onBeforeMount, beforeMount);
  2986. registerLifecycleHook(onMounted, mounted);
  2987. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  2988. registerLifecycleHook(onUpdated, updated);
  2989. registerLifecycleHook(onActivated, activated);
  2990. registerLifecycleHook(onDeactivated, deactivated);
  2991. registerLifecycleHook(onErrorCaptured, errorCaptured);
  2992. registerLifecycleHook(onRenderTracked, renderTracked);
  2993. registerLifecycleHook(onRenderTriggered, renderTriggered);
  2994. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  2995. registerLifecycleHook(onUnmounted, unmounted);
  2996. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  2997. if (isArray$2(expose)) {
  2998. if (expose.length) {
  2999. const exposed = instance.exposed || (instance.exposed = {});
  3000. expose.forEach((key) => {
  3001. Object.defineProperty(exposed, key, {
  3002. get: () => publicThis[key],
  3003. set: (val) => publicThis[key] = val
  3004. });
  3005. });
  3006. } else if (!instance.exposed) {
  3007. instance.exposed = {};
  3008. }
  3009. }
  3010. if (render && instance.render === NOOP) {
  3011. instance.render = render;
  3012. }
  3013. if (inheritAttrs != null) {
  3014. instance.inheritAttrs = inheritAttrs;
  3015. }
  3016. if (components)
  3017. instance.components = components;
  3018. if (directives)
  3019. instance.directives = directives;
  3020. if (instance.ctx.$onApplyOptions) {
  3021. instance.ctx.$onApplyOptions(options, instance, publicThis);
  3022. }
  3023. }
  3024. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3025. if (isArray$2(injectOptions)) {
  3026. injectOptions = normalizeInject(injectOptions);
  3027. }
  3028. for (const key in injectOptions) {
  3029. const opt = injectOptions[key];
  3030. let injected;
  3031. if (isObject$2(opt)) {
  3032. if ("default" in opt) {
  3033. injected = inject(
  3034. opt.from || key,
  3035. opt.default,
  3036. true
  3037. );
  3038. } else {
  3039. injected = inject(opt.from || key);
  3040. }
  3041. } else {
  3042. injected = inject(opt);
  3043. }
  3044. if (isRef(injected)) {
  3045. Object.defineProperty(ctx, key, {
  3046. enumerable: true,
  3047. configurable: true,
  3048. get: () => injected.value,
  3049. set: (v) => injected.value = v
  3050. });
  3051. } else {
  3052. ctx[key] = injected;
  3053. }
  3054. {
  3055. checkDuplicateProperties("Inject", key);
  3056. }
  3057. }
  3058. }
  3059. function callHook$1(hook, instance, type) {
  3060. callWithAsyncErrorHandling(
  3061. isArray$2(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
  3062. instance,
  3063. type
  3064. );
  3065. }
  3066. function createWatcher(raw, ctx, publicThis, key) {
  3067. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3068. if (isString$2(raw)) {
  3069. const handler = ctx[raw];
  3070. if (isFunction$2(handler)) {
  3071. watch(getter, handler);
  3072. } else {
  3073. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3074. }
  3075. } else if (isFunction$2(raw)) {
  3076. watch(getter, raw.bind(publicThis));
  3077. } else if (isObject$2(raw)) {
  3078. if (isArray$2(raw)) {
  3079. raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key));
  3080. } else {
  3081. const handler = isFunction$2(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3082. if (isFunction$2(handler)) {
  3083. watch(getter, handler, raw);
  3084. } else {
  3085. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3086. }
  3087. }
  3088. } else {
  3089. warn$1(`Invalid watch option: "${key}"`, raw);
  3090. }
  3091. }
  3092. function resolveMergedOptions(instance) {
  3093. const base = instance.type;
  3094. const { mixins, extends: extendsOptions } = base;
  3095. const {
  3096. mixins: globalMixins,
  3097. optionsCache: cache,
  3098. config: { optionMergeStrategies }
  3099. } = instance.appContext;
  3100. const cached = cache.get(base);
  3101. let resolved;
  3102. if (cached) {
  3103. resolved = cached;
  3104. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3105. {
  3106. resolved = base;
  3107. }
  3108. } else {
  3109. resolved = {};
  3110. if (globalMixins.length) {
  3111. globalMixins.forEach(
  3112. (m2) => mergeOptions(resolved, m2, optionMergeStrategies, true)
  3113. );
  3114. }
  3115. mergeOptions(resolved, base, optionMergeStrategies);
  3116. }
  3117. if (isObject$2(base)) {
  3118. cache.set(base, resolved);
  3119. }
  3120. return resolved;
  3121. }
  3122. function mergeOptions(to, from, strats, asMixin = false) {
  3123. const { mixins, extends: extendsOptions } = from;
  3124. if (extendsOptions) {
  3125. mergeOptions(to, extendsOptions, strats, true);
  3126. }
  3127. if (mixins) {
  3128. mixins.forEach(
  3129. (m2) => mergeOptions(to, m2, strats, true)
  3130. );
  3131. }
  3132. for (const key in from) {
  3133. if (asMixin && key === "expose") {
  3134. warn$1(
  3135. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3136. );
  3137. } else {
  3138. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3139. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3140. }
  3141. }
  3142. return to;
  3143. }
  3144. const internalOptionMergeStrats = {
  3145. data: mergeDataFn,
  3146. props: mergeEmitsOrPropsOptions,
  3147. emits: mergeEmitsOrPropsOptions,
  3148. // objects
  3149. methods: mergeObjectOptions,
  3150. computed: mergeObjectOptions,
  3151. // lifecycle
  3152. beforeCreate: mergeAsArray$1,
  3153. created: mergeAsArray$1,
  3154. beforeMount: mergeAsArray$1,
  3155. mounted: mergeAsArray$1,
  3156. beforeUpdate: mergeAsArray$1,
  3157. updated: mergeAsArray$1,
  3158. beforeDestroy: mergeAsArray$1,
  3159. beforeUnmount: mergeAsArray$1,
  3160. destroyed: mergeAsArray$1,
  3161. unmounted: mergeAsArray$1,
  3162. activated: mergeAsArray$1,
  3163. deactivated: mergeAsArray$1,
  3164. errorCaptured: mergeAsArray$1,
  3165. serverPrefetch: mergeAsArray$1,
  3166. // assets
  3167. components: mergeObjectOptions,
  3168. directives: mergeObjectOptions,
  3169. // watch
  3170. watch: mergeWatchOptions,
  3171. // provide / inject
  3172. provide: mergeDataFn,
  3173. inject: mergeInject
  3174. };
  3175. function mergeDataFn(to, from) {
  3176. if (!from) {
  3177. return to;
  3178. }
  3179. if (!to) {
  3180. return from;
  3181. }
  3182. return function mergedDataFn() {
  3183. return extend$2(
  3184. isFunction$2(to) ? to.call(this, this) : to,
  3185. isFunction$2(from) ? from.call(this, this) : from
  3186. );
  3187. };
  3188. }
  3189. function mergeInject(to, from) {
  3190. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  3191. }
  3192. function normalizeInject(raw) {
  3193. if (isArray$2(raw)) {
  3194. const res = {};
  3195. for (let i = 0; i < raw.length; i++) {
  3196. res[raw[i]] = raw[i];
  3197. }
  3198. return res;
  3199. }
  3200. return raw;
  3201. }
  3202. function mergeAsArray$1(to, from) {
  3203. return to ? [...new Set([].concat(to, from))] : from;
  3204. }
  3205. function mergeObjectOptions(to, from) {
  3206. return to ? extend$2(/* @__PURE__ */ Object.create(null), to, from) : from;
  3207. }
  3208. function mergeEmitsOrPropsOptions(to, from) {
  3209. if (to) {
  3210. if (isArray$2(to) && isArray$2(from)) {
  3211. return [.../* @__PURE__ */ new Set([...to, ...from])];
  3212. }
  3213. return extend$2(
  3214. /* @__PURE__ */ Object.create(null),
  3215. normalizePropsOrEmits(to),
  3216. normalizePropsOrEmits(from != null ? from : {})
  3217. );
  3218. } else {
  3219. return from;
  3220. }
  3221. }
  3222. function mergeWatchOptions(to, from) {
  3223. if (!to)
  3224. return from;
  3225. if (!from)
  3226. return to;
  3227. const merged = extend$2(/* @__PURE__ */ Object.create(null), to);
  3228. for (const key in from) {
  3229. merged[key] = mergeAsArray$1(to[key], from[key]);
  3230. }
  3231. return merged;
  3232. }
  3233. function initProps$1(instance, rawProps, isStateful, isSSR = false) {
  3234. const props = {};
  3235. const attrs = {};
  3236. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  3237. setFullProps(instance, rawProps, props, attrs);
  3238. for (const key in instance.propsOptions[0]) {
  3239. if (!(key in props)) {
  3240. props[key] = void 0;
  3241. }
  3242. }
  3243. {
  3244. validateProps(rawProps || {}, props, instance);
  3245. }
  3246. if (isStateful) {
  3247. instance.props = isSSR ? props : shallowReactive(props);
  3248. } else {
  3249. if (!instance.type.props) {
  3250. instance.props = attrs;
  3251. } else {
  3252. instance.props = props;
  3253. }
  3254. }
  3255. instance.attrs = attrs;
  3256. }
  3257. function isInHmrContext(instance) {
  3258. }
  3259. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3260. const {
  3261. props,
  3262. attrs,
  3263. vnode: { patchFlag }
  3264. } = instance;
  3265. const rawCurrentProps = toRaw(props);
  3266. const [options] = instance.propsOptions;
  3267. let hasAttrsChanged = false;
  3268. if (
  3269. // always force full diff in dev
  3270. // - #1942 if hmr is enabled with sfc component
  3271. // - vite#872 non-sfc component used by sfc component
  3272. !isInHmrContext() && (optimized || patchFlag > 0) && !(patchFlag & 16)
  3273. ) {
  3274. if (patchFlag & 8) {
  3275. const propsToUpdate = instance.vnode.dynamicProps;
  3276. for (let i = 0; i < propsToUpdate.length; i++) {
  3277. let key = propsToUpdate[i];
  3278. if (isEmitListener(instance.emitsOptions, key)) {
  3279. continue;
  3280. }
  3281. const value = rawProps[key];
  3282. if (options) {
  3283. if (hasOwn(attrs, key)) {
  3284. if (value !== attrs[key]) {
  3285. attrs[key] = value;
  3286. hasAttrsChanged = true;
  3287. }
  3288. } else {
  3289. const camelizedKey = camelize(key);
  3290. props[camelizedKey] = resolvePropValue$1(
  3291. options,
  3292. rawCurrentProps,
  3293. camelizedKey,
  3294. value,
  3295. instance,
  3296. false
  3297. );
  3298. }
  3299. } else {
  3300. if (value !== attrs[key]) {
  3301. attrs[key] = value;
  3302. hasAttrsChanged = true;
  3303. }
  3304. }
  3305. }
  3306. }
  3307. } else {
  3308. if (setFullProps(instance, rawProps, props, attrs)) {
  3309. hasAttrsChanged = true;
  3310. }
  3311. let kebabKey;
  3312. for (const key in rawCurrentProps) {
  3313. if (!rawProps || // for camelCase
  3314. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3315. // and converted to camelCase (#955)
  3316. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  3317. if (options) {
  3318. if (rawPrevProps && // for camelCase
  3319. (rawPrevProps[key] !== void 0 || // for kebab-case
  3320. rawPrevProps[kebabKey] !== void 0)) {
  3321. props[key] = resolvePropValue$1(
  3322. options,
  3323. rawCurrentProps,
  3324. key,
  3325. void 0,
  3326. instance,
  3327. true
  3328. );
  3329. }
  3330. } else {
  3331. delete props[key];
  3332. }
  3333. }
  3334. }
  3335. if (attrs !== rawCurrentProps) {
  3336. for (const key in attrs) {
  3337. if (!rawProps || !hasOwn(rawProps, key) && true) {
  3338. delete attrs[key];
  3339. hasAttrsChanged = true;
  3340. }
  3341. }
  3342. }
  3343. }
  3344. if (hasAttrsChanged) {
  3345. trigger(instance, "set", "$attrs");
  3346. }
  3347. {
  3348. validateProps(rawProps || {}, props, instance);
  3349. }
  3350. }
  3351. function setFullProps(instance, rawProps, props, attrs) {
  3352. const [options, needCastKeys] = instance.propsOptions;
  3353. let hasAttrsChanged = false;
  3354. let rawCastValues;
  3355. if (rawProps) {
  3356. for (let key in rawProps) {
  3357. if (isReservedProp(key)) {
  3358. continue;
  3359. }
  3360. const value = rawProps[key];
  3361. let camelKey;
  3362. if (options && hasOwn(options, camelKey = camelize(key))) {
  3363. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  3364. props[camelKey] = value;
  3365. } else {
  3366. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  3367. }
  3368. } else if (!isEmitListener(instance.emitsOptions, key)) {
  3369. if (!(key in attrs) || value !== attrs[key]) {
  3370. attrs[key] = value;
  3371. hasAttrsChanged = true;
  3372. }
  3373. }
  3374. }
  3375. }
  3376. if (needCastKeys) {
  3377. const rawCurrentProps = toRaw(props);
  3378. const castValues = rawCastValues || EMPTY_OBJ;
  3379. for (let i = 0; i < needCastKeys.length; i++) {
  3380. const key = needCastKeys[i];
  3381. props[key] = resolvePropValue$1(
  3382. options,
  3383. rawCurrentProps,
  3384. key,
  3385. castValues[key],
  3386. instance,
  3387. !hasOwn(castValues, key)
  3388. );
  3389. }
  3390. }
  3391. return hasAttrsChanged;
  3392. }
  3393. function resolvePropValue$1(options, props, key, value, instance, isAbsent) {
  3394. const opt = options[key];
  3395. if (opt != null) {
  3396. const hasDefault = hasOwn(opt, "default");
  3397. if (hasDefault && value === void 0) {
  3398. const defaultValue = opt.default;
  3399. if (opt.type !== Function && !opt.skipFactory && isFunction$2(defaultValue)) {
  3400. const { propsDefaults } = instance;
  3401. if (key in propsDefaults) {
  3402. value = propsDefaults[key];
  3403. } else {
  3404. const reset = setCurrentInstance(instance);
  3405. value = propsDefaults[key] = defaultValue.call(
  3406. null,
  3407. props
  3408. );
  3409. reset();
  3410. }
  3411. } else {
  3412. value = defaultValue;
  3413. }
  3414. }
  3415. if (opt[
  3416. 0
  3417. /* shouldCast */
  3418. ]) {
  3419. if (isAbsent && !hasDefault) {
  3420. value = false;
  3421. } else if (opt[
  3422. 1
  3423. /* shouldCastTrue */
  3424. ] && (value === "" || value === hyphenate(key))) {
  3425. value = true;
  3426. }
  3427. }
  3428. }
  3429. return value;
  3430. }
  3431. function normalizePropsOptions(comp, appContext, asMixin = false) {
  3432. const cache = appContext.propsCache;
  3433. const cached = cache.get(comp);
  3434. if (cached) {
  3435. return cached;
  3436. }
  3437. const raw = comp.props;
  3438. const normalized = {};
  3439. const needCastKeys = [];
  3440. let hasExtends = false;
  3441. if (!isFunction$2(comp)) {
  3442. const extendProps = (raw2) => {
  3443. hasExtends = true;
  3444. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  3445. extend$2(normalized, props);
  3446. if (keys)
  3447. needCastKeys.push(...keys);
  3448. };
  3449. if (!asMixin && appContext.mixins.length) {
  3450. appContext.mixins.forEach(extendProps);
  3451. }
  3452. if (comp.extends) {
  3453. extendProps(comp.extends);
  3454. }
  3455. if (comp.mixins) {
  3456. comp.mixins.forEach(extendProps);
  3457. }
  3458. }
  3459. if (!raw && !hasExtends) {
  3460. if (isObject$2(comp)) {
  3461. cache.set(comp, EMPTY_ARR);
  3462. }
  3463. return EMPTY_ARR;
  3464. }
  3465. if (isArray$2(raw)) {
  3466. for (let i = 0; i < raw.length; i++) {
  3467. if (!isString$2(raw[i])) {
  3468. warn$1(`props must be strings when using array syntax.`, raw[i]);
  3469. }
  3470. const normalizedKey = camelize(raw[i]);
  3471. if (validatePropName(normalizedKey)) {
  3472. normalized[normalizedKey] = EMPTY_OBJ;
  3473. }
  3474. }
  3475. } else if (raw) {
  3476. if (!isObject$2(raw)) {
  3477. warn$1(`invalid props options`, raw);
  3478. }
  3479. for (const key in raw) {
  3480. const normalizedKey = camelize(key);
  3481. if (validatePropName(normalizedKey)) {
  3482. const opt = raw[key];
  3483. const prop = normalized[normalizedKey] = isArray$2(opt) || isFunction$2(opt) ? { type: opt } : extend$2({}, opt);
  3484. if (prop) {
  3485. const booleanIndex = getTypeIndex(Boolean, prop.type);
  3486. const stringIndex = getTypeIndex(String, prop.type);
  3487. prop[
  3488. 0
  3489. /* shouldCast */
  3490. ] = booleanIndex > -1;
  3491. prop[
  3492. 1
  3493. /* shouldCastTrue */
  3494. ] = stringIndex < 0 || booleanIndex < stringIndex;
  3495. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  3496. needCastKeys.push(normalizedKey);
  3497. }
  3498. }
  3499. }
  3500. }
  3501. }
  3502. const res = [normalized, needCastKeys];
  3503. if (isObject$2(comp)) {
  3504. cache.set(comp, res);
  3505. }
  3506. return res;
  3507. }
  3508. function validatePropName(key) {
  3509. if (key[0] !== "$" && !isReservedProp(key)) {
  3510. return true;
  3511. } else {
  3512. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  3513. }
  3514. return false;
  3515. }
  3516. function getType$1(ctor) {
  3517. if (ctor === null) {
  3518. return "null";
  3519. }
  3520. if (typeof ctor === "function") {
  3521. return ctor.name || "";
  3522. } else if (typeof ctor === "object") {
  3523. const name = ctor.constructor && ctor.constructor.name;
  3524. return name || "";
  3525. }
  3526. return "";
  3527. }
  3528. function isSameType(a, b) {
  3529. return getType$1(a) === getType$1(b);
  3530. }
  3531. function getTypeIndex(type, expectedTypes) {
  3532. if (isArray$2(expectedTypes)) {
  3533. return expectedTypes.findIndex((t2) => isSameType(t2, type));
  3534. } else if (isFunction$2(expectedTypes)) {
  3535. return isSameType(expectedTypes, type) ? 0 : -1;
  3536. }
  3537. return -1;
  3538. }
  3539. function validateProps(rawProps, props, instance) {
  3540. const resolvedValues = toRaw(props);
  3541. const options = instance.propsOptions[0];
  3542. for (const key in options) {
  3543. let opt = options[key];
  3544. if (opt == null)
  3545. continue;
  3546. validateProp$1(
  3547. key,
  3548. resolvedValues[key],
  3549. opt,
  3550. shallowReadonly(resolvedValues),
  3551. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  3552. );
  3553. }
  3554. }
  3555. function validateProp$1(name, value, prop, props, isAbsent) {
  3556. const { type, required, validator: validator2, skipCheck } = prop;
  3557. if (required && isAbsent) {
  3558. warn$1('Missing required prop: "' + name + '"');
  3559. return;
  3560. }
  3561. if (value == null && !required) {
  3562. return;
  3563. }
  3564. if (type != null && type !== true && !skipCheck) {
  3565. let isValid = false;
  3566. const types = isArray$2(type) ? type : [type];
  3567. const expectedTypes = [];
  3568. for (let i = 0; i < types.length && !isValid; i++) {
  3569. const { valid, expectedType } = assertType$1(value, types[i]);
  3570. expectedTypes.push(expectedType || "");
  3571. isValid = valid;
  3572. }
  3573. if (!isValid) {
  3574. warn$1(getInvalidTypeMessage$1(name, value, expectedTypes));
  3575. return;
  3576. }
  3577. }
  3578. if (validator2 && !validator2(value, props)) {
  3579. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  3580. }
  3581. }
  3582. const isSimpleType$1 = /* @__PURE__ */ makeMap(
  3583. "String,Number,Boolean,Function,Symbol,BigInt"
  3584. );
  3585. function assertType$1(value, type) {
  3586. let valid;
  3587. const expectedType = getType$1(type);
  3588. if (isSimpleType$1(expectedType)) {
  3589. const t2 = typeof value;
  3590. valid = t2 === expectedType.toLowerCase();
  3591. if (!valid && t2 === "object") {
  3592. valid = value instanceof type;
  3593. }
  3594. } else if (expectedType === "Object") {
  3595. valid = isObject$2(value);
  3596. } else if (expectedType === "Array") {
  3597. valid = isArray$2(value);
  3598. } else if (expectedType === "null") {
  3599. valid = value === null;
  3600. } else {
  3601. valid = value instanceof type;
  3602. }
  3603. return {
  3604. valid,
  3605. expectedType
  3606. };
  3607. }
  3608. function getInvalidTypeMessage$1(name, value, expectedTypes) {
  3609. if (expectedTypes.length === 0) {
  3610. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  3611. }
  3612. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  3613. const expectedType = expectedTypes[0];
  3614. const receivedType = toRawType(value);
  3615. const expectedValue = styleValue$1(value, expectedType);
  3616. const receivedValue = styleValue$1(value, receivedType);
  3617. if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$2(expectedType, receivedType)) {
  3618. message += ` with value ${expectedValue}`;
  3619. }
  3620. message += `, got ${receivedType} `;
  3621. if (isExplicable$1(receivedType)) {
  3622. message += `with value ${receivedValue}.`;
  3623. }
  3624. return message;
  3625. }
  3626. function styleValue$1(value, type) {
  3627. if (type === "String") {
  3628. return `"${value}"`;
  3629. } else if (type === "Number") {
  3630. return `${Number(value)}`;
  3631. } else {
  3632. return `${value}`;
  3633. }
  3634. }
  3635. function isExplicable$1(type) {
  3636. const explicitTypes = ["string", "number", "boolean"];
  3637. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  3638. }
  3639. function isBoolean$2(...args) {
  3640. return args.some((elem) => elem.toLowerCase() === "boolean");
  3641. }
  3642. let supported;
  3643. let perf;
  3644. function startMeasure(instance, type) {
  3645. if (instance.appContext.config.performance && isSupported()) {
  3646. perf.mark(`vue-${type}-${instance.uid}`);
  3647. }
  3648. {
  3649. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  3650. }
  3651. }
  3652. function endMeasure(instance, type) {
  3653. if (instance.appContext.config.performance && isSupported()) {
  3654. const startTag = `vue-${type}-${instance.uid}`;
  3655. const endTag = startTag + `:end`;
  3656. perf.mark(endTag);
  3657. perf.measure(
  3658. `<${formatComponentName(instance, instance.type)}> ${type}`,
  3659. startTag,
  3660. endTag
  3661. );
  3662. perf.clearMarks(startTag);
  3663. perf.clearMarks(endTag);
  3664. }
  3665. {
  3666. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  3667. }
  3668. }
  3669. function isSupported() {
  3670. if (supported !== void 0) {
  3671. return supported;
  3672. }
  3673. if (typeof window !== "undefined" && window.performance) {
  3674. supported = true;
  3675. perf = window.performance;
  3676. } else {
  3677. supported = false;
  3678. }
  3679. return supported;
  3680. }
  3681. const queuePostRenderEffect$1 = queuePostFlushCb;
  3682. const Fragment = Symbol.for("v-fgt");
  3683. const Text = Symbol.for("v-txt");
  3684. const Comment = Symbol.for("v-cmt");
  3685. const Static = Symbol.for("v-stc");
  3686. function isVNode(value) {
  3687. return value ? value.__v_isVNode === true : false;
  3688. }
  3689. const InternalObjectKey = `__vInternal`;
  3690. function guardReactiveProps(props) {
  3691. if (!props)
  3692. return null;
  3693. return isProxy(props) || InternalObjectKey in props ? extend$2({}, props) : props;
  3694. }
  3695. const emptyAppContext = createAppContext();
  3696. let uid = 0;
  3697. function createComponentInstance(vnode, parent, suspense) {
  3698. const type = vnode.type;
  3699. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  3700. const instance = {
  3701. uid: uid++,
  3702. vnode,
  3703. type,
  3704. parent,
  3705. appContext,
  3706. root: null,
  3707. // to be immediately set
  3708. next: null,
  3709. subTree: null,
  3710. // will be set synchronously right after creation
  3711. effect: null,
  3712. update: null,
  3713. // will be set synchronously right after creation
  3714. scope: new EffectScope(
  3715. true
  3716. /* detached */
  3717. ),
  3718. render: null,
  3719. proxy: null,
  3720. exposed: null,
  3721. exposeProxy: null,
  3722. withProxy: null,
  3723. provides: parent ? parent.provides : Object.create(appContext.provides),
  3724. accessCache: null,
  3725. renderCache: [],
  3726. // local resolved assets
  3727. components: null,
  3728. directives: null,
  3729. // resolved props and emits options
  3730. propsOptions: normalizePropsOptions(type, appContext),
  3731. emitsOptions: normalizeEmitsOptions(type, appContext),
  3732. // emit
  3733. emit: null,
  3734. // to be set immediately
  3735. emitted: null,
  3736. // props default value
  3737. propsDefaults: EMPTY_OBJ,
  3738. // inheritAttrs
  3739. inheritAttrs: type.inheritAttrs,
  3740. // state
  3741. ctx: EMPTY_OBJ,
  3742. data: EMPTY_OBJ,
  3743. props: EMPTY_OBJ,
  3744. attrs: EMPTY_OBJ,
  3745. slots: EMPTY_OBJ,
  3746. refs: EMPTY_OBJ,
  3747. setupState: EMPTY_OBJ,
  3748. setupContext: null,
  3749. attrsProxy: null,
  3750. slotsProxy: null,
  3751. // suspense related
  3752. suspense,
  3753. suspenseId: suspense ? suspense.pendingId : 0,
  3754. asyncDep: null,
  3755. asyncResolved: false,
  3756. // lifecycle hooks
  3757. // not using enums here because it results in computed properties
  3758. isMounted: false,
  3759. isUnmounted: false,
  3760. isDeactivated: false,
  3761. bc: null,
  3762. c: null,
  3763. bm: null,
  3764. m: null,
  3765. bu: null,
  3766. u: null,
  3767. um: null,
  3768. bum: null,
  3769. da: null,
  3770. a: null,
  3771. rtg: null,
  3772. rtc: null,
  3773. ec: null,
  3774. sp: null,
  3775. // fixed by xxxxxx 用于存储uni-app的元素缓存
  3776. $uniElements: /* @__PURE__ */ new Map(),
  3777. $templateUniElementRefs: [],
  3778. $templateUniElementStyles: {},
  3779. $eS: {},
  3780. $eA: {}
  3781. };
  3782. {
  3783. instance.ctx = createDevRenderContext(instance);
  3784. }
  3785. instance.root = parent ? parent.root : instance;
  3786. instance.emit = emit.bind(null, instance);
  3787. if (vnode.ce) {
  3788. vnode.ce(instance);
  3789. }
  3790. return instance;
  3791. }
  3792. let currentInstance = null;
  3793. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  3794. let internalSetCurrentInstance;
  3795. let setInSSRSetupState;
  3796. {
  3797. internalSetCurrentInstance = (i) => {
  3798. currentInstance = i;
  3799. };
  3800. setInSSRSetupState = (v) => {
  3801. isInSSRComponentSetup = v;
  3802. };
  3803. }
  3804. const setCurrentInstance = (instance) => {
  3805. const prev = currentInstance;
  3806. internalSetCurrentInstance(instance);
  3807. instance.scope.on();
  3808. return () => {
  3809. instance.scope.off();
  3810. internalSetCurrentInstance(prev);
  3811. };
  3812. };
  3813. const unsetCurrentInstance = () => {
  3814. currentInstance && currentInstance.scope.off();
  3815. internalSetCurrentInstance(null);
  3816. };
  3817. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  3818. function validateComponentName(name, { isNativeTag }) {
  3819. if (isBuiltInTag(name) || isNativeTag(name)) {
  3820. warn$1(
  3821. "Do not use built-in or reserved HTML elements as component id: " + name
  3822. );
  3823. }
  3824. }
  3825. function isStatefulComponent(instance) {
  3826. return instance.vnode.shapeFlag & 4;
  3827. }
  3828. let isInSSRComponentSetup = false;
  3829. function setupComponent(instance, isSSR = false) {
  3830. isSSR && setInSSRSetupState(isSSR);
  3831. const {
  3832. props
  3833. /*, children*/
  3834. } = instance.vnode;
  3835. const isStateful = isStatefulComponent(instance);
  3836. initProps$1(instance, props, isStateful, isSSR);
  3837. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  3838. isSSR && setInSSRSetupState(false);
  3839. return setupResult;
  3840. }
  3841. function setupStatefulComponent(instance, isSSR) {
  3842. const Component2 = instance.type;
  3843. {
  3844. if (Component2.name) {
  3845. validateComponentName(Component2.name, instance.appContext.config);
  3846. }
  3847. if (Component2.components) {
  3848. const names = Object.keys(Component2.components);
  3849. for (let i = 0; i < names.length; i++) {
  3850. validateComponentName(names[i], instance.appContext.config);
  3851. }
  3852. }
  3853. if (Component2.directives) {
  3854. const names = Object.keys(Component2.directives);
  3855. for (let i = 0; i < names.length; i++) {
  3856. validateDirectiveName(names[i]);
  3857. }
  3858. }
  3859. if (Component2.compilerOptions && isRuntimeOnly()) {
  3860. warn$1(
  3861. `"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
  3862. );
  3863. }
  3864. }
  3865. instance.accessCache = /* @__PURE__ */ Object.create(null);
  3866. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  3867. {
  3868. exposePropsOnRenderContext(instance);
  3869. }
  3870. const { setup } = Component2;
  3871. if (setup) {
  3872. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  3873. const reset = setCurrentInstance(instance);
  3874. pauseTracking();
  3875. const setupResult = callWithErrorHandling(
  3876. setup,
  3877. instance,
  3878. 0,
  3879. [
  3880. shallowReadonly(instance.props),
  3881. setupContext
  3882. ]
  3883. );
  3884. resetTracking();
  3885. reset();
  3886. if (isPromise(setupResult)) {
  3887. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  3888. {
  3889. warn$1(
  3890. `setup() returned a Promise, but the version of Vue you are using does not support it yet.`
  3891. );
  3892. }
  3893. } else {
  3894. handleSetupResult(instance, setupResult, isSSR);
  3895. }
  3896. } else {
  3897. finishComponentSetup(instance, isSSR);
  3898. }
  3899. }
  3900. function handleSetupResult(instance, setupResult, isSSR) {
  3901. if (isFunction$2(setupResult)) {
  3902. {
  3903. instance.render = setupResult;
  3904. }
  3905. } else if (isObject$2(setupResult)) {
  3906. if (isVNode(setupResult)) {
  3907. warn$1(
  3908. `setup() should not return VNodes directly - return a render function instead.`
  3909. );
  3910. }
  3911. {
  3912. instance.devtoolsRawSetupState = setupResult;
  3913. }
  3914. instance.setupState = proxyRefs(setupResult);
  3915. {
  3916. exposeSetupStateOnRenderContext(instance);
  3917. }
  3918. } else if (setupResult !== void 0) {
  3919. warn$1(
  3920. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  3921. );
  3922. }
  3923. finishComponentSetup(instance, isSSR);
  3924. }
  3925. let compile;
  3926. const isRuntimeOnly = () => !compile;
  3927. function finishComponentSetup(instance, isSSR, skipOptions) {
  3928. const Component2 = instance.type;
  3929. if (!instance.render) {
  3930. instance.render = Component2.render || NOOP;
  3931. }
  3932. {
  3933. const reset = setCurrentInstance(instance);
  3934. pauseTracking();
  3935. try {
  3936. applyOptions$1(instance);
  3937. } finally {
  3938. resetTracking();
  3939. reset();
  3940. }
  3941. }
  3942. if (!Component2.render && instance.render === NOOP && !isSSR) {
  3943. if (Component2.template) {
  3944. warn$1(
  3945. `Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".`
  3946. );
  3947. } else {
  3948. warn$1(`Component is missing template or render function.`);
  3949. }
  3950. }
  3951. }
  3952. function getAttrsProxy(instance) {
  3953. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  3954. instance.attrs,
  3955. {
  3956. get(target, key) {
  3957. track(instance, "get", "$attrs");
  3958. return target[key];
  3959. },
  3960. set() {
  3961. warn$1(`setupContext.attrs is readonly.`);
  3962. return false;
  3963. },
  3964. deleteProperty() {
  3965. warn$1(`setupContext.attrs is readonly.`);
  3966. return false;
  3967. }
  3968. }
  3969. ));
  3970. }
  3971. function getSlotsProxy(instance) {
  3972. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  3973. get(target, key) {
  3974. track(instance, "get", "$slots");
  3975. return target[key];
  3976. }
  3977. }));
  3978. }
  3979. function createSetupContext(instance) {
  3980. const expose = (exposed) => {
  3981. {
  3982. if (instance.exposed) {
  3983. warn$1(`expose() should be called only once per setup().`);
  3984. }
  3985. if (exposed != null) {
  3986. let exposedType = typeof exposed;
  3987. if (exposedType === "object") {
  3988. if (isArray$2(exposed)) {
  3989. exposedType = "array";
  3990. } else if (isRef(exposed)) {
  3991. exposedType = "ref";
  3992. }
  3993. }
  3994. if (exposedType !== "object") {
  3995. warn$1(
  3996. `expose() should be passed a plain object, received ${exposedType}.`
  3997. );
  3998. }
  3999. }
  4000. }
  4001. instance.exposed = exposed || {};
  4002. };
  4003. {
  4004. return Object.freeze({
  4005. get attrs() {
  4006. return getAttrsProxy(instance);
  4007. },
  4008. get slots() {
  4009. return getSlotsProxy(instance);
  4010. },
  4011. get emit() {
  4012. return (event, ...args) => instance.emit(event, ...args);
  4013. },
  4014. expose
  4015. });
  4016. }
  4017. }
  4018. function getExposeProxy(instance) {
  4019. if (instance.exposed) {
  4020. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  4021. get(target, key) {
  4022. if (key in target) {
  4023. return target[key];
  4024. }
  4025. return instance.proxy[key];
  4026. },
  4027. has(target, key) {
  4028. return key in target || key in publicPropertiesMap;
  4029. }
  4030. }));
  4031. }
  4032. }
  4033. const classifyRE = /(?:^|[-_])(\w)/g;
  4034. const classify = (str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, "");
  4035. function getComponentName(Component2, includeInferred = true) {
  4036. return isFunction$2(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
  4037. }
  4038. function formatComponentName(instance, Component2, isRoot = false) {
  4039. let name = getComponentName(Component2);
  4040. if (!name && Component2.__file) {
  4041. const match = Component2.__file.match(/([^/\\]+)\.\w+$/);
  4042. if (match) {
  4043. name = match[1];
  4044. }
  4045. }
  4046. if (!name && instance && instance.parent) {
  4047. const inferFromRegistry = (registry) => {
  4048. for (const key in registry) {
  4049. if (registry[key] === Component2) {
  4050. return key;
  4051. }
  4052. }
  4053. };
  4054. name = inferFromRegistry(
  4055. instance.components || instance.parent.type.components
  4056. ) || inferFromRegistry(instance.appContext.components);
  4057. }
  4058. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  4059. }
  4060. const computed = (getterOrOptions, debugOptions) => {
  4061. const c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  4062. {
  4063. const i = getCurrentInstance();
  4064. if (i && i.appContext.config.warnRecursiveComputed) {
  4065. c2._warnRecursive = true;
  4066. }
  4067. }
  4068. return c2;
  4069. };
  4070. const version = "3.4.21";
  4071. const warn = warn$1;
  4072. function unwrapper(target) {
  4073. return unref(target);
  4074. }
  4075. const ARRAYTYPE = "[object Array]";
  4076. const OBJECTTYPE = "[object Object]";
  4077. function diff(current, pre) {
  4078. const result = {};
  4079. syncKeys(current, pre);
  4080. _diff(current, pre, "", result);
  4081. return result;
  4082. }
  4083. function syncKeys(current, pre) {
  4084. current = unwrapper(current);
  4085. if (current === pre)
  4086. return;
  4087. const rootCurrentType = toTypeString(current);
  4088. const rootPreType = toTypeString(pre);
  4089. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  4090. for (let key in pre) {
  4091. const currentValue = current[key];
  4092. if (currentValue === void 0) {
  4093. current[key] = null;
  4094. } else {
  4095. syncKeys(currentValue, pre[key]);
  4096. }
  4097. }
  4098. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  4099. if (current.length >= pre.length) {
  4100. pre.forEach((item, index2) => {
  4101. syncKeys(current[index2], item);
  4102. });
  4103. }
  4104. }
  4105. }
  4106. function _diff(current, pre, path, result) {
  4107. current = unwrapper(current);
  4108. if (current === pre)
  4109. return;
  4110. const rootCurrentType = toTypeString(current);
  4111. const rootPreType = toTypeString(pre);
  4112. if (rootCurrentType == OBJECTTYPE) {
  4113. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  4114. setResult(result, path, current);
  4115. } else {
  4116. for (let key in current) {
  4117. const currentValue = unwrapper(current[key]);
  4118. const preValue = pre[key];
  4119. const currentType = toTypeString(currentValue);
  4120. const preType = toTypeString(preValue);
  4121. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  4122. if (currentValue != preValue) {
  4123. setResult(
  4124. result,
  4125. (path == "" ? "" : path + ".") + key,
  4126. currentValue
  4127. );
  4128. }
  4129. } else if (currentType == ARRAYTYPE) {
  4130. if (preType != ARRAYTYPE) {
  4131. setResult(
  4132. result,
  4133. (path == "" ? "" : path + ".") + key,
  4134. currentValue
  4135. );
  4136. } else {
  4137. if (currentValue.length < preValue.length) {
  4138. setResult(
  4139. result,
  4140. (path == "" ? "" : path + ".") + key,
  4141. currentValue
  4142. );
  4143. } else {
  4144. currentValue.forEach((item, index2) => {
  4145. _diff(
  4146. item,
  4147. preValue[index2],
  4148. (path == "" ? "" : path + ".") + key + "[" + index2 + "]",
  4149. result
  4150. );
  4151. });
  4152. }
  4153. }
  4154. } else if (currentType == OBJECTTYPE) {
  4155. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  4156. setResult(
  4157. result,
  4158. (path == "" ? "" : path + ".") + key,
  4159. currentValue
  4160. );
  4161. } else {
  4162. for (let subKey in currentValue) {
  4163. _diff(
  4164. currentValue[subKey],
  4165. preValue[subKey],
  4166. (path == "" ? "" : path + ".") + key + "." + subKey,
  4167. result
  4168. );
  4169. }
  4170. }
  4171. }
  4172. }
  4173. }
  4174. } else if (rootCurrentType == ARRAYTYPE) {
  4175. if (rootPreType != ARRAYTYPE) {
  4176. setResult(result, path, current);
  4177. } else {
  4178. if (current.length < pre.length) {
  4179. setResult(result, path, current);
  4180. } else {
  4181. current.forEach((item, index2) => {
  4182. _diff(item, pre[index2], path + "[" + index2 + "]", result);
  4183. });
  4184. }
  4185. }
  4186. } else {
  4187. setResult(result, path, current);
  4188. }
  4189. }
  4190. function setResult(result, k, v) {
  4191. result[k] = v;
  4192. }
  4193. function hasComponentEffect(instance) {
  4194. return queue$1.includes(instance.update);
  4195. }
  4196. function flushCallbacks(instance) {
  4197. const ctx = instance.ctx;
  4198. const callbacks = ctx.__next_tick_callbacks;
  4199. if (callbacks && callbacks.length) {
  4200. const copies = callbacks.slice(0);
  4201. callbacks.length = 0;
  4202. for (let i = 0; i < copies.length; i++) {
  4203. copies[i]();
  4204. }
  4205. }
  4206. }
  4207. function nextTick(instance, fn) {
  4208. const ctx = instance.ctx;
  4209. if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
  4210. return nextTick$1(fn && fn.bind(instance.proxy));
  4211. }
  4212. let _resolve;
  4213. if (!ctx.__next_tick_callbacks) {
  4214. ctx.__next_tick_callbacks = [];
  4215. }
  4216. ctx.__next_tick_callbacks.push(() => {
  4217. if (fn) {
  4218. callWithErrorHandling(
  4219. fn.bind(instance.proxy),
  4220. instance,
  4221. 14
  4222. );
  4223. } else if (_resolve) {
  4224. _resolve(instance.proxy);
  4225. }
  4226. });
  4227. return new Promise((resolve2) => {
  4228. _resolve = resolve2;
  4229. });
  4230. }
  4231. function clone(src, seen) {
  4232. src = unwrapper(src);
  4233. const type = typeof src;
  4234. if (type === "object" && src !== null) {
  4235. let copy = seen.get(src);
  4236. if (typeof copy !== "undefined") {
  4237. return copy;
  4238. }
  4239. if (isArray$2(src)) {
  4240. const len = src.length;
  4241. copy = new Array(len);
  4242. seen.set(src, copy);
  4243. for (let i = 0; i < len; i++) {
  4244. copy[i] = clone(src[i], seen);
  4245. }
  4246. } else {
  4247. copy = {};
  4248. seen.set(src, copy);
  4249. for (const name in src) {
  4250. if (hasOwn(src, name)) {
  4251. copy[name] = clone(src[name], seen);
  4252. }
  4253. }
  4254. }
  4255. return copy;
  4256. }
  4257. if (type !== "symbol") {
  4258. return src;
  4259. }
  4260. }
  4261. function deepCopy(src) {
  4262. return clone(src, typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : /* @__PURE__ */ new Map());
  4263. }
  4264. function getMPInstanceData(instance, keys) {
  4265. const data = instance.data;
  4266. const ret = /* @__PURE__ */ Object.create(null);
  4267. keys.forEach((key) => {
  4268. ret[key] = data[key];
  4269. });
  4270. return ret;
  4271. }
  4272. function patch(instance, data, oldData) {
  4273. if (!data) {
  4274. return;
  4275. }
  4276. data = deepCopy(data);
  4277. data.$eS = instance.$eS || {};
  4278. data.$eA = instance.$eA || {};
  4279. const ctx = instance.ctx;
  4280. const mpType = ctx.mpType;
  4281. if (mpType === "page" || mpType === "component") {
  4282. data.r0 = 1;
  4283. const mpInstance = ctx.$scope;
  4284. const keys = Object.keys(data);
  4285. const diffData = diff(data, oldData || getMPInstanceData(mpInstance, keys));
  4286. if (Object.keys(diffData).length) {
  4287. ctx.__next_tick_pending = true;
  4288. mpInstance.setData(diffData, () => {
  4289. ctx.__next_tick_pending = false;
  4290. flushCallbacks(instance);
  4291. });
  4292. flushPreFlushCbs();
  4293. } else {
  4294. flushCallbacks(instance);
  4295. }
  4296. }
  4297. }
  4298. function initAppConfig(appConfig) {
  4299. appConfig.globalProperties.$nextTick = function $nextTick(fn) {
  4300. return nextTick(this.$, fn);
  4301. };
  4302. }
  4303. function onApplyOptions(options, instance, publicThis) {
  4304. instance.appContext.config.globalProperties.$applyOptions(
  4305. options,
  4306. instance,
  4307. publicThis
  4308. );
  4309. const computedOptions = options.computed;
  4310. if (computedOptions) {
  4311. const keys = Object.keys(computedOptions);
  4312. if (keys.length) {
  4313. const ctx = instance.ctx;
  4314. if (!ctx.$computedKeys) {
  4315. ctx.$computedKeys = [];
  4316. }
  4317. ctx.$computedKeys.push(...keys);
  4318. }
  4319. }
  4320. delete instance.ctx.$onApplyOptions;
  4321. }
  4322. function setRef$1(instance, isUnmount = false) {
  4323. const {
  4324. setupState,
  4325. $templateRefs,
  4326. $templateUniElementRefs,
  4327. ctx: { $scope, $mpPlatform }
  4328. } = instance;
  4329. if ($mpPlatform === "mp-alipay") {
  4330. return;
  4331. }
  4332. if (!$scope || !$templateRefs && !$templateUniElementRefs) {
  4333. return;
  4334. }
  4335. if (isUnmount) {
  4336. $templateRefs && $templateRefs.forEach(
  4337. (templateRef) => setTemplateRef(templateRef, null, setupState)
  4338. );
  4339. $templateUniElementRefs && $templateUniElementRefs.forEach(
  4340. (templateRef) => setTemplateRef(templateRef, null, setupState)
  4341. );
  4342. return;
  4343. }
  4344. const check = $mpPlatform === "mp-baidu" || $mpPlatform === "mp-toutiao";
  4345. const doSetByRefs = (refs) => {
  4346. if (refs.length === 0) {
  4347. return [];
  4348. }
  4349. const mpComponents = (
  4350. // 字节小程序 selectAllComponents 可能返回 null
  4351. // https://github.com/dcloudio/uni-app/issues/3954
  4352. ($scope.selectAllComponents(".r") || []).concat(
  4353. $scope.selectAllComponents(".r-i-f") || []
  4354. )
  4355. );
  4356. return refs.filter((templateRef) => {
  4357. const refValue = findComponentPublicInstance(mpComponents, templateRef.i);
  4358. if (check && refValue === null) {
  4359. return true;
  4360. }
  4361. setTemplateRef(templateRef, refValue, setupState);
  4362. return false;
  4363. });
  4364. };
  4365. const doSet = () => {
  4366. if ($templateRefs) {
  4367. const refs = doSetByRefs($templateRefs);
  4368. if (refs.length && instance.proxy && instance.proxy.$scope) {
  4369. instance.proxy.$scope.setData({ r1: 1 }, () => {
  4370. doSetByRefs(refs);
  4371. });
  4372. }
  4373. }
  4374. };
  4375. if ($templateUniElementRefs && $templateUniElementRefs.length) {
  4376. nextTick(instance, () => {
  4377. $templateUniElementRefs.forEach((templateRef) => {
  4378. if (isArray$2(templateRef.v)) {
  4379. templateRef.v.forEach((v) => {
  4380. setTemplateRef(templateRef, v, setupState);
  4381. });
  4382. } else {
  4383. setTemplateRef(templateRef, templateRef.v, setupState);
  4384. }
  4385. });
  4386. });
  4387. }
  4388. if ($scope._$setRef) {
  4389. $scope._$setRef(doSet);
  4390. } else {
  4391. nextTick(instance, doSet);
  4392. }
  4393. }
  4394. function toSkip(value) {
  4395. if (isObject$2(value)) {
  4396. markRaw(value);
  4397. }
  4398. return value;
  4399. }
  4400. function findComponentPublicInstance(mpComponents, id) {
  4401. const mpInstance = mpComponents.find(
  4402. (com) => com && (com.properties || com.props).uI === id
  4403. );
  4404. if (mpInstance) {
  4405. const vm = mpInstance.$vm;
  4406. if (vm) {
  4407. return getExposeProxy(vm.$) || vm;
  4408. }
  4409. return toSkip(mpInstance);
  4410. }
  4411. return null;
  4412. }
  4413. function setTemplateRef({ r: r2, f: f2 }, refValue, setupState) {
  4414. if (isFunction$2(r2)) {
  4415. r2(refValue, {});
  4416. } else {
  4417. const _isString = isString$2(r2);
  4418. const _isRef = isRef(r2);
  4419. if (_isString || _isRef) {
  4420. if (f2) {
  4421. if (!_isRef) {
  4422. return;
  4423. }
  4424. if (!isArray$2(r2.value)) {
  4425. r2.value = [];
  4426. }
  4427. const existing = r2.value;
  4428. if (existing.indexOf(refValue) === -1) {
  4429. existing.push(refValue);
  4430. if (!refValue) {
  4431. return;
  4432. }
  4433. if (refValue.$) {
  4434. onBeforeUnmount(() => remove(existing, refValue), refValue.$);
  4435. }
  4436. }
  4437. } else if (_isString) {
  4438. if (hasOwn(setupState, r2)) {
  4439. setupState[r2] = refValue;
  4440. }
  4441. } else if (isRef(r2)) {
  4442. r2.value = refValue;
  4443. } else {
  4444. warnRef(r2);
  4445. }
  4446. } else {
  4447. warnRef(r2);
  4448. }
  4449. }
  4450. }
  4451. function warnRef(ref2) {
  4452. warn("Invalid template ref type:", ref2, `(${typeof ref2})`);
  4453. }
  4454. const queuePostRenderEffect = queuePostFlushCb;
  4455. function mountComponent(initialVNode, options) {
  4456. const instance = initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null);
  4457. {
  4458. instance.ctx.$onApplyOptions = onApplyOptions;
  4459. instance.ctx.$children = [];
  4460. }
  4461. if (options.mpType === "app") {
  4462. instance.render = NOOP;
  4463. }
  4464. if (options.onBeforeSetup) {
  4465. options.onBeforeSetup(instance, options);
  4466. }
  4467. {
  4468. pushWarningContext(initialVNode);
  4469. startMeasure(instance, `mount`);
  4470. }
  4471. {
  4472. startMeasure(instance, `init`);
  4473. }
  4474. setupComponent(instance);
  4475. {
  4476. endMeasure(instance, `init`);
  4477. }
  4478. {
  4479. if (options.parentComponent && instance.proxy) {
  4480. options.parentComponent.ctx.$children.push(getExposeProxy(instance) || instance.proxy);
  4481. }
  4482. }
  4483. setupRenderEffect(instance);
  4484. {
  4485. popWarningContext();
  4486. endMeasure(instance, `mount`);
  4487. }
  4488. return instance.proxy;
  4489. }
  4490. const getFunctionalFallthrough = (attrs) => {
  4491. let res;
  4492. for (const key in attrs) {
  4493. if (key === "class" || key === "style" || isOn(key)) {
  4494. (res || (res = {}))[key] = attrs[key];
  4495. }
  4496. }
  4497. return res;
  4498. };
  4499. function renderComponentRoot(instance) {
  4500. const {
  4501. type: Component2,
  4502. vnode,
  4503. proxy,
  4504. withProxy,
  4505. props,
  4506. propsOptions: [propsOptions],
  4507. slots,
  4508. attrs,
  4509. emit: emit2,
  4510. render,
  4511. renderCache,
  4512. data,
  4513. setupState,
  4514. ctx,
  4515. uid: uid2,
  4516. appContext: {
  4517. app: {
  4518. config: {
  4519. globalProperties: { pruneComponentPropsCache: pruneComponentPropsCache2 }
  4520. }
  4521. }
  4522. },
  4523. inheritAttrs
  4524. } = instance;
  4525. instance.$uniElementIds = /* @__PURE__ */ new Map();
  4526. instance.$templateRefs = [];
  4527. instance.$templateUniElementRefs = [];
  4528. instance.$templateUniElementStyles = {};
  4529. instance.$ei = 0;
  4530. pruneComponentPropsCache2(uid2);
  4531. instance.__counter = instance.__counter === 0 ? 1 : 0;
  4532. let result;
  4533. const prev = setCurrentRenderingInstance(instance);
  4534. try {
  4535. if (vnode.shapeFlag & 4) {
  4536. fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
  4537. const proxyToUse = withProxy || proxy;
  4538. result = render.call(
  4539. proxyToUse,
  4540. proxyToUse,
  4541. renderCache,
  4542. props,
  4543. setupState,
  4544. data,
  4545. ctx
  4546. );
  4547. } else {
  4548. fallthroughAttrs(
  4549. inheritAttrs,
  4550. props,
  4551. propsOptions,
  4552. Component2.props ? attrs : getFunctionalFallthrough(attrs)
  4553. );
  4554. const render2 = Component2;
  4555. result = render2.length > 1 ? render2(props, { attrs, slots, emit: emit2 }) : render2(
  4556. props,
  4557. null
  4558. /* we know it doesn't need it */
  4559. );
  4560. }
  4561. } catch (err) {
  4562. handleError(err, instance, 1);
  4563. result = false;
  4564. }
  4565. setRef$1(instance);
  4566. setCurrentRenderingInstance(prev);
  4567. return result;
  4568. }
  4569. function fallthroughAttrs(inheritAttrs, props, propsOptions, fallthroughAttrs2) {
  4570. if (props && fallthroughAttrs2 && inheritAttrs !== false) {
  4571. const keys = Object.keys(fallthroughAttrs2).filter(
  4572. (key) => key !== "class" && key !== "style"
  4573. );
  4574. if (!keys.length) {
  4575. return;
  4576. }
  4577. if (propsOptions && keys.some(isModelListener)) {
  4578. keys.forEach((key) => {
  4579. if (!isModelListener(key) || !(key.slice(9) in propsOptions)) {
  4580. props[key] = fallthroughAttrs2[key];
  4581. }
  4582. });
  4583. } else {
  4584. keys.forEach((key) => props[key] = fallthroughAttrs2[key]);
  4585. }
  4586. }
  4587. }
  4588. const updateComponentPreRender = (instance) => {
  4589. pauseTracking();
  4590. flushPreFlushCbs();
  4591. resetTracking();
  4592. };
  4593. function componentUpdateScopedSlotsFn() {
  4594. const scopedSlotsData = this.$scopedSlotsData;
  4595. if (!scopedSlotsData || scopedSlotsData.length === 0) {
  4596. return;
  4597. }
  4598. const mpInstance = this.ctx.$scope;
  4599. const oldData = mpInstance.data;
  4600. const diffData = /* @__PURE__ */ Object.create(null);
  4601. scopedSlotsData.forEach(({ path, index: index2, data }) => {
  4602. const oldScopedSlotData = getValueByDataPath(oldData, path);
  4603. const diffPath = isString$2(index2) ? `${path}.${index2}` : `${path}[${index2}]`;
  4604. if (typeof oldScopedSlotData === "undefined" || typeof oldScopedSlotData[index2] === "undefined") {
  4605. diffData[diffPath] = data;
  4606. } else {
  4607. const diffScopedSlotData = diff(
  4608. data,
  4609. oldScopedSlotData[index2]
  4610. );
  4611. Object.keys(diffScopedSlotData).forEach((name) => {
  4612. diffData[diffPath + "." + name] = diffScopedSlotData[name];
  4613. });
  4614. }
  4615. });
  4616. scopedSlotsData.length = 0;
  4617. if (Object.keys(diffData).length) {
  4618. mpInstance.setData(diffData);
  4619. }
  4620. }
  4621. function toggleRecurse({ effect: effect2, update }, allowed) {
  4622. effect2.allowRecurse = update.allowRecurse = allowed;
  4623. }
  4624. function setupRenderEffect(instance) {
  4625. const updateScopedSlots = componentUpdateScopedSlotsFn.bind(
  4626. instance
  4627. );
  4628. instance.$updateScopedSlots = () => nextTick$1(() => queueJob(updateScopedSlots));
  4629. const componentUpdateFn = () => {
  4630. if (!instance.isMounted) {
  4631. onBeforeUnmount(() => {
  4632. setRef$1(instance, true);
  4633. }, instance);
  4634. {
  4635. startMeasure(instance, `patch`);
  4636. }
  4637. patch(instance, renderComponentRoot(instance));
  4638. {
  4639. endMeasure(instance, `patch`);
  4640. }
  4641. {
  4642. devtoolsComponentAdded(instance);
  4643. }
  4644. } else {
  4645. const { next, bu, u } = instance;
  4646. {
  4647. pushWarningContext(next || instance.vnode);
  4648. }
  4649. toggleRecurse(instance, false);
  4650. updateComponentPreRender();
  4651. if (bu) {
  4652. invokeArrayFns$1(bu);
  4653. }
  4654. toggleRecurse(instance, true);
  4655. {
  4656. startMeasure(instance, `patch`);
  4657. }
  4658. patch(instance, renderComponentRoot(instance));
  4659. {
  4660. endMeasure(instance, `patch`);
  4661. }
  4662. if (u) {
  4663. queuePostRenderEffect(u);
  4664. }
  4665. {
  4666. devtoolsComponentUpdated(instance);
  4667. }
  4668. {
  4669. popWarningContext();
  4670. }
  4671. }
  4672. };
  4673. const effect2 = instance.effect = new ReactiveEffect(
  4674. componentUpdateFn,
  4675. NOOP,
  4676. () => queueJob(update),
  4677. instance.scope
  4678. // track it in component's effect scope
  4679. );
  4680. const update = instance.update = () => {
  4681. if (effect2.dirty) {
  4682. effect2.run();
  4683. }
  4684. };
  4685. update.id = instance.uid;
  4686. toggleRecurse(instance, true);
  4687. {
  4688. effect2.onTrack = instance.rtc ? (e2) => invokeArrayFns$1(instance.rtc, e2) : void 0;
  4689. effect2.onTrigger = instance.rtg ? (e2) => invokeArrayFns$1(instance.rtg, e2) : void 0;
  4690. update.ownerInstance = instance;
  4691. }
  4692. {
  4693. update();
  4694. }
  4695. }
  4696. function unmountComponent(instance) {
  4697. const { bum, scope, update, um } = instance;
  4698. if (bum) {
  4699. invokeArrayFns$1(bum);
  4700. }
  4701. {
  4702. const parentInstance = instance.parent;
  4703. if (parentInstance) {
  4704. const $children = parentInstance.ctx.$children;
  4705. const target = getExposeProxy(instance) || instance.proxy;
  4706. const index2 = $children.indexOf(target);
  4707. if (index2 > -1) {
  4708. $children.splice(index2, 1);
  4709. }
  4710. }
  4711. }
  4712. scope.stop();
  4713. if (update) {
  4714. update.active = false;
  4715. }
  4716. if (um) {
  4717. queuePostRenderEffect(um);
  4718. }
  4719. queuePostRenderEffect(() => {
  4720. instance.isUnmounted = true;
  4721. });
  4722. {
  4723. devtoolsComponentRemoved(instance);
  4724. }
  4725. }
  4726. const oldCreateApp = createAppAPI();
  4727. function getTarget() {
  4728. if (typeof window !== "undefined") {
  4729. return window;
  4730. }
  4731. if (typeof globalThis !== "undefined") {
  4732. return globalThis;
  4733. }
  4734. if (typeof global !== "undefined") {
  4735. return global;
  4736. }
  4737. if (typeof my !== "undefined") {
  4738. return my;
  4739. }
  4740. }
  4741. function createVueApp(rootComponent, rootProps = null) {
  4742. const target = getTarget();
  4743. target.__VUE__ = true;
  4744. {
  4745. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  4746. }
  4747. const app = oldCreateApp(rootComponent, rootProps);
  4748. const appContext = app._context;
  4749. initAppConfig(appContext.config);
  4750. const createVNode2 = (initialVNode) => {
  4751. initialVNode.appContext = appContext;
  4752. initialVNode.shapeFlag = 6;
  4753. return initialVNode;
  4754. };
  4755. const createComponent2 = function createComponent22(initialVNode, options) {
  4756. return mountComponent(createVNode2(initialVNode), options);
  4757. };
  4758. const destroyComponent = function destroyComponent2(component) {
  4759. return component && unmountComponent(component.$);
  4760. };
  4761. app.mount = function mount() {
  4762. rootComponent.render = NOOP;
  4763. const instance = mountComponent(
  4764. createVNode2({ type: rootComponent }),
  4765. {
  4766. mpType: "app",
  4767. mpInstance: null,
  4768. parentComponent: null,
  4769. slots: [],
  4770. props: null
  4771. }
  4772. );
  4773. app._instance = instance.$;
  4774. {
  4775. devtoolsInitApp(app, version);
  4776. }
  4777. instance.$app = app;
  4778. instance.$createComponent = createComponent2;
  4779. instance.$destroyComponent = destroyComponent;
  4780. appContext.$appInstance = instance;
  4781. return instance;
  4782. };
  4783. app.unmount = function unmount() {
  4784. warn(`Cannot unmount an app.`);
  4785. };
  4786. return app;
  4787. }
  4788. function injectLifecycleHook(name, hook, publicThis, instance) {
  4789. if (isFunction$2(hook)) {
  4790. injectHook(name, hook.bind(publicThis), instance);
  4791. }
  4792. }
  4793. function initHooks$1(options, instance, publicThis) {
  4794. const mpType = options.mpType || publicThis.$mpType;
  4795. if (!mpType || mpType === "component") {
  4796. return;
  4797. }
  4798. Object.keys(options).forEach((name) => {
  4799. if (isUniLifecycleHook(name, options[name], false)) {
  4800. const hooks = options[name];
  4801. if (isArray$2(hooks)) {
  4802. hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
  4803. } else {
  4804. injectLifecycleHook(name, hooks, publicThis, instance);
  4805. }
  4806. }
  4807. });
  4808. }
  4809. function applyOptions$2(options, instance, publicThis) {
  4810. initHooks$1(options, instance, publicThis);
  4811. }
  4812. function set(target, key, val) {
  4813. return target[key] = val;
  4814. }
  4815. function $callMethod(method, ...args) {
  4816. const fn = this[method];
  4817. if (fn) {
  4818. return fn(...args);
  4819. }
  4820. console.error(`method ${method} not found`);
  4821. return null;
  4822. }
  4823. function createErrorHandler(app) {
  4824. const userErrorHandler = app.config.errorHandler;
  4825. return function errorHandler(err, instance, info) {
  4826. if (userErrorHandler) {
  4827. userErrorHandler(err, instance, info);
  4828. }
  4829. const appInstance = app._instance;
  4830. if (!appInstance || !appInstance.proxy) {
  4831. throw err;
  4832. }
  4833. if (appInstance[ON_ERROR]) {
  4834. {
  4835. appInstance.proxy.$callHook(ON_ERROR, err);
  4836. }
  4837. } else {
  4838. logError(err, info, instance ? instance.$.vnode : null, false);
  4839. }
  4840. };
  4841. }
  4842. function mergeAsArray(to, from) {
  4843. return to ? [...new Set([].concat(to, from))] : from;
  4844. }
  4845. function initOptionMergeStrategies(optionMergeStrategies) {
  4846. UniLifecycleHooks.forEach((name) => {
  4847. optionMergeStrategies[name] = mergeAsArray;
  4848. });
  4849. }
  4850. let realAtob;
  4851. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  4852. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  4853. if (typeof atob !== "function") {
  4854. realAtob = function(str) {
  4855. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  4856. if (!b64re.test(str)) {
  4857. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  4858. }
  4859. str += "==".slice(2 - (str.length & 3));
  4860. var bitmap;
  4861. var result = "";
  4862. var r1;
  4863. var r2;
  4864. var i = 0;
  4865. for (; i < str.length; ) {
  4866. 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++)));
  4867. 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);
  4868. }
  4869. return result;
  4870. };
  4871. } else {
  4872. realAtob = atob;
  4873. }
  4874. function b64DecodeUnicode(str) {
  4875. return decodeURIComponent(realAtob(str).split("").map(function(c2) {
  4876. return "%" + ("00" + c2.charCodeAt(0).toString(16)).slice(-2);
  4877. }).join(""));
  4878. }
  4879. function getCurrentUserInfo() {
  4880. const token = index.getStorageSync("uni_id_token") || "";
  4881. const tokenArr = token.split(".");
  4882. if (!token || tokenArr.length !== 3) {
  4883. return {
  4884. uid: null,
  4885. role: [],
  4886. permission: [],
  4887. tokenExpired: 0
  4888. };
  4889. }
  4890. let userInfo;
  4891. try {
  4892. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  4893. } catch (error) {
  4894. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  4895. }
  4896. userInfo.tokenExpired = userInfo.exp * 1e3;
  4897. delete userInfo.exp;
  4898. delete userInfo.iat;
  4899. return userInfo;
  4900. }
  4901. function uniIdMixin(globalProperties) {
  4902. globalProperties.uniIDHasRole = function(roleId) {
  4903. const { role } = getCurrentUserInfo();
  4904. return role.indexOf(roleId) > -1;
  4905. };
  4906. globalProperties.uniIDHasPermission = function(permissionId) {
  4907. const { permission } = getCurrentUserInfo();
  4908. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  4909. };
  4910. globalProperties.uniIDTokenValid = function() {
  4911. const { tokenExpired } = getCurrentUserInfo();
  4912. return tokenExpired > Date.now();
  4913. };
  4914. }
  4915. function initApp(app) {
  4916. const appConfig = app.config;
  4917. appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
  4918. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  4919. const globalProperties = appConfig.globalProperties;
  4920. {
  4921. uniIdMixin(globalProperties);
  4922. }
  4923. {
  4924. globalProperties.$set = set;
  4925. globalProperties.$applyOptions = applyOptions$2;
  4926. globalProperties.$callMethod = $callMethod;
  4927. }
  4928. {
  4929. index.invokeCreateVueAppHook(app);
  4930. }
  4931. }
  4932. const propsCaches = /* @__PURE__ */ Object.create(null);
  4933. function renderProps(props) {
  4934. const { uid: uid2, __counter } = getCurrentInstance();
  4935. const propsId = (propsCaches[uid2] || (propsCaches[uid2] = [])).push(guardReactiveProps(props)) - 1;
  4936. return uid2 + "," + propsId + "," + __counter;
  4937. }
  4938. function pruneComponentPropsCache(uid2) {
  4939. delete propsCaches[uid2];
  4940. }
  4941. function findComponentPropsData(up) {
  4942. if (!up) {
  4943. return;
  4944. }
  4945. const [uid2, propsId] = up.split(",");
  4946. if (!propsCaches[uid2]) {
  4947. return;
  4948. }
  4949. return propsCaches[uid2][parseInt(propsId)];
  4950. }
  4951. var plugin = {
  4952. install(app) {
  4953. initApp(app);
  4954. app.config.globalProperties.pruneComponentPropsCache = pruneComponentPropsCache;
  4955. const oldMount = app.mount;
  4956. app.mount = function mount(rootContainer) {
  4957. const instance = oldMount.call(app, rootContainer);
  4958. const createApp2 = getCreateApp();
  4959. if (createApp2) {
  4960. createApp2(instance);
  4961. } else {
  4962. if (typeof createMiniProgramApp !== "undefined") {
  4963. createMiniProgramApp(instance);
  4964. }
  4965. }
  4966. return instance;
  4967. };
  4968. }
  4969. };
  4970. function getCreateApp() {
  4971. const method = "createApp";
  4972. if (typeof global !== "undefined" && typeof global[method] !== "undefined") {
  4973. return global[method];
  4974. } else if (typeof my !== "undefined") {
  4975. return my[method];
  4976. }
  4977. }
  4978. const t = (val) => toDisplayString(val);
  4979. const p = (props) => renderProps(props);
  4980. function createApp$1(rootComponent, rootProps = null) {
  4981. rootComponent && (rootComponent.mpType = "app");
  4982. return createVueApp(rootComponent, rootProps).use(plugin);
  4983. }
  4984. const createSSRApp = createApp$1;
  4985. function getLocaleLanguage$1() {
  4986. var _a;
  4987. let localeLanguage = "";
  4988. {
  4989. const appBaseInfo = ((_a = wx.getAppBaseInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
  4990. const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  4991. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  4992. }
  4993. return localeLanguage;
  4994. }
  4995. function validateProtocolFail(name, msg) {
  4996. console.warn(`${name}: ${msg}`);
  4997. }
  4998. function validateProtocol(name, data, protocol, onFail) {
  4999. if (!onFail) {
  5000. onFail = validateProtocolFail;
  5001. }
  5002. for (const key in protocol) {
  5003. const errMsg = validateProp(key, data[key], protocol[key], !hasOwn(data, key));
  5004. if (isString$2(errMsg)) {
  5005. onFail(name, errMsg);
  5006. }
  5007. }
  5008. }
  5009. function validateProtocols(name, args, protocol, onFail) {
  5010. if (!protocol) {
  5011. return;
  5012. }
  5013. if (!isArray$2(protocol)) {
  5014. return validateProtocol(name, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail);
  5015. }
  5016. const len = protocol.length;
  5017. const argsLen = args.length;
  5018. for (let i = 0; i < len; i++) {
  5019. const opts = protocol[i];
  5020. const data = /* @__PURE__ */ Object.create(null);
  5021. if (argsLen > i) {
  5022. data[opts.name] = args[i];
  5023. }
  5024. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  5025. }
  5026. }
  5027. function validateProp(name, value, prop, isAbsent) {
  5028. if (!isPlainObject$1(prop)) {
  5029. prop = { type: prop };
  5030. }
  5031. const { type, required, validator: validator2 } = prop;
  5032. if (required && isAbsent) {
  5033. return 'Missing required args: "' + name + '"';
  5034. }
  5035. if (value == null && !required) {
  5036. return;
  5037. }
  5038. if (type != null) {
  5039. let isValid = false;
  5040. const types = isArray$2(type) ? type : [type];
  5041. const expectedTypes = [];
  5042. for (let i = 0; i < types.length && !isValid; i++) {
  5043. const { valid, expectedType } = assertType(value, types[i]);
  5044. expectedTypes.push(expectedType || "");
  5045. isValid = valid;
  5046. }
  5047. if (!isValid) {
  5048. return getInvalidTypeMessage(name, value, expectedTypes);
  5049. }
  5050. }
  5051. if (validator2) {
  5052. return validator2(value);
  5053. }
  5054. }
  5055. const isSimpleType = /* @__PURE__ */ makeMap("String,Number,Boolean,Function,Symbol");
  5056. function assertType(value, type) {
  5057. let valid;
  5058. const expectedType = getType(type);
  5059. if (isSimpleType(expectedType)) {
  5060. const t2 = typeof value;
  5061. valid = t2 === expectedType.toLowerCase();
  5062. if (!valid && t2 === "object") {
  5063. valid = value instanceof type;
  5064. }
  5065. } else if (expectedType === "Object") {
  5066. valid = isObject$2(value);
  5067. } else if (expectedType === "Array") {
  5068. valid = isArray$2(value);
  5069. } else {
  5070. {
  5071. valid = value instanceof type;
  5072. }
  5073. }
  5074. return {
  5075. valid,
  5076. expectedType
  5077. };
  5078. }
  5079. function getInvalidTypeMessage(name, value, expectedTypes) {
  5080. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`;
  5081. const expectedType = expectedTypes[0];
  5082. const receivedType = toRawType(value);
  5083. const expectedValue = styleValue(value, expectedType);
  5084. const receivedValue = styleValue(value, receivedType);
  5085. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean$1(expectedType, receivedType)) {
  5086. message += ` with value ${expectedValue}`;
  5087. }
  5088. message += `, got ${receivedType} `;
  5089. if (isExplicable(receivedType)) {
  5090. message += `with value ${receivedValue}.`;
  5091. }
  5092. return message;
  5093. }
  5094. function getType(ctor) {
  5095. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  5096. return match ? match[1] : "";
  5097. }
  5098. function styleValue(value, type) {
  5099. if (type === "String") {
  5100. return `"${value}"`;
  5101. } else if (type === "Number") {
  5102. return `${Number(value)}`;
  5103. } else {
  5104. return `${value}`;
  5105. }
  5106. }
  5107. function isExplicable(type) {
  5108. const explicitTypes = ["string", "number", "boolean"];
  5109. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5110. }
  5111. function isBoolean$1(...args) {
  5112. return args.some((elem) => elem.toLowerCase() === "boolean");
  5113. }
  5114. function tryCatch(fn) {
  5115. return function() {
  5116. try {
  5117. return fn.apply(fn, arguments);
  5118. } catch (e) {
  5119. console.error(e);
  5120. }
  5121. };
  5122. }
  5123. let invokeCallbackId = 1;
  5124. const invokeCallbacks = {};
  5125. function addInvokeCallback(id, name, callback, keepAlive = false) {
  5126. invokeCallbacks[id] = {
  5127. name,
  5128. keepAlive,
  5129. callback
  5130. };
  5131. return id;
  5132. }
  5133. function invokeCallback(id, res, extras) {
  5134. if (typeof id === "number") {
  5135. const opts = invokeCallbacks[id];
  5136. if (opts) {
  5137. if (!opts.keepAlive) {
  5138. delete invokeCallbacks[id];
  5139. }
  5140. return opts.callback(res, extras);
  5141. }
  5142. }
  5143. return res;
  5144. }
  5145. const API_SUCCESS = "success";
  5146. const API_FAIL = "fail";
  5147. const API_COMPLETE = "complete";
  5148. function getApiCallbacks(args) {
  5149. const apiCallbacks = {};
  5150. for (const name in args) {
  5151. const fn = args[name];
  5152. if (isFunction$2(fn)) {
  5153. apiCallbacks[name] = tryCatch(fn);
  5154. delete args[name];
  5155. }
  5156. }
  5157. return apiCallbacks;
  5158. }
  5159. function normalizeErrMsg(errMsg, name) {
  5160. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  5161. return name + ":ok";
  5162. }
  5163. return name + errMsg.substring(errMsg.indexOf(":fail"));
  5164. }
  5165. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  5166. if (!isPlainObject$1(args)) {
  5167. args = {};
  5168. }
  5169. const { success, fail, complete } = getApiCallbacks(args);
  5170. const hasSuccess = isFunction$2(success);
  5171. const hasFail = isFunction$2(fail);
  5172. const hasComplete = isFunction$2(complete);
  5173. const callbackId = invokeCallbackId++;
  5174. addInvokeCallback(callbackId, name, (res) => {
  5175. res = res || {};
  5176. res.errMsg = normalizeErrMsg(res.errMsg, name);
  5177. isFunction$2(beforeAll) && beforeAll(res);
  5178. if (res.errMsg === name + ":ok") {
  5179. isFunction$2(beforeSuccess) && beforeSuccess(res, args);
  5180. hasSuccess && success(res);
  5181. } else {
  5182. hasFail && fail(res);
  5183. }
  5184. hasComplete && complete(res);
  5185. });
  5186. return callbackId;
  5187. }
  5188. const HOOK_SUCCESS = "success";
  5189. const HOOK_FAIL = "fail";
  5190. const HOOK_COMPLETE = "complete";
  5191. const globalInterceptors = {};
  5192. const scopedInterceptors = {};
  5193. function wrapperHook(hook, params) {
  5194. return function(data) {
  5195. return hook(data, params) || data;
  5196. };
  5197. }
  5198. function queue(hooks, data, params) {
  5199. let promise = false;
  5200. for (let i = 0; i < hooks.length; i++) {
  5201. const hook = hooks[i];
  5202. if (promise) {
  5203. promise = Promise.resolve(wrapperHook(hook, params));
  5204. } else {
  5205. const res = hook(data, params);
  5206. if (isPromise(res)) {
  5207. promise = Promise.resolve(res);
  5208. }
  5209. if (res === false) {
  5210. return {
  5211. then() {
  5212. },
  5213. catch() {
  5214. }
  5215. };
  5216. }
  5217. }
  5218. }
  5219. return promise || {
  5220. then(callback) {
  5221. return callback(data);
  5222. },
  5223. catch() {
  5224. }
  5225. };
  5226. }
  5227. function wrapperOptions(interceptors2, options = {}) {
  5228. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  5229. const hooks = interceptors2[name];
  5230. if (!isArray$2(hooks)) {
  5231. return;
  5232. }
  5233. const oldCallback = options[name];
  5234. options[name] = function callbackInterceptor(res) {
  5235. queue(hooks, res, options).then((res2) => {
  5236. return isFunction$2(oldCallback) && oldCallback(res2) || res2;
  5237. });
  5238. };
  5239. });
  5240. return options;
  5241. }
  5242. function wrapperReturnValue(method, returnValue) {
  5243. const returnValueHooks = [];
  5244. if (isArray$2(globalInterceptors.returnValue)) {
  5245. returnValueHooks.push(...globalInterceptors.returnValue);
  5246. }
  5247. const interceptor = scopedInterceptors[method];
  5248. if (interceptor && isArray$2(interceptor.returnValue)) {
  5249. returnValueHooks.push(...interceptor.returnValue);
  5250. }
  5251. returnValueHooks.forEach((hook) => {
  5252. returnValue = hook(returnValue) || returnValue;
  5253. });
  5254. return returnValue;
  5255. }
  5256. function getApiInterceptorHooks(method) {
  5257. const interceptor = /* @__PURE__ */ Object.create(null);
  5258. Object.keys(globalInterceptors).forEach((hook) => {
  5259. if (hook !== "returnValue") {
  5260. interceptor[hook] = globalInterceptors[hook].slice();
  5261. }
  5262. });
  5263. const scopedInterceptor = scopedInterceptors[method];
  5264. if (scopedInterceptor) {
  5265. Object.keys(scopedInterceptor).forEach((hook) => {
  5266. if (hook !== "returnValue") {
  5267. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  5268. }
  5269. });
  5270. }
  5271. return interceptor;
  5272. }
  5273. function invokeApi(method, api, options, params) {
  5274. const interceptor = getApiInterceptorHooks(method);
  5275. if (interceptor && Object.keys(interceptor).length) {
  5276. if (isArray$2(interceptor.invoke)) {
  5277. const res = queue(interceptor.invoke, options);
  5278. return res.then((options2) => {
  5279. return api(wrapperOptions(getApiInterceptorHooks(method), options2), ...params);
  5280. });
  5281. } else {
  5282. return api(wrapperOptions(interceptor, options), ...params);
  5283. }
  5284. }
  5285. return api(options, ...params);
  5286. }
  5287. function hasCallback(args) {
  5288. if (isPlainObject$1(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction$2(args[cb]))) {
  5289. return true;
  5290. }
  5291. return false;
  5292. }
  5293. function handlePromise(promise) {
  5294. return promise;
  5295. }
  5296. function promisify$1(name, fn) {
  5297. return (args = {}, ...rest) => {
  5298. if (hasCallback(args)) {
  5299. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  5300. }
  5301. return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
  5302. invokeApi(name, fn, extend$2(args, { success: resolve, fail: reject }), rest);
  5303. })));
  5304. };
  5305. }
  5306. function formatApiArgs(args, options) {
  5307. args[0];
  5308. {
  5309. return;
  5310. }
  5311. }
  5312. function invokeSuccess(id, name, res) {
  5313. const result = {
  5314. errMsg: name + ":ok"
  5315. };
  5316. return invokeCallback(id, extend$2(res || {}, result));
  5317. }
  5318. function invokeFail(id, name, errMsg, errRes = {}) {
  5319. const errMsgPrefix = name + ":fail";
  5320. let apiErrMsg = "";
  5321. if (!errMsg) {
  5322. apiErrMsg = errMsgPrefix;
  5323. } else if (errMsg.indexOf(errMsgPrefix) === 0) {
  5324. apiErrMsg = errMsg;
  5325. } else {
  5326. apiErrMsg = errMsgPrefix + " " + errMsg;
  5327. }
  5328. {
  5329. delete errRes.errCode;
  5330. }
  5331. let res = extend$2({ errMsg: apiErrMsg }, errRes);
  5332. return invokeCallback(id, res);
  5333. }
  5334. function beforeInvokeApi(name, args, protocol, options) {
  5335. {
  5336. validateProtocols(name, args, protocol);
  5337. }
  5338. const errMsg = formatApiArgs(args);
  5339. if (errMsg) {
  5340. return errMsg;
  5341. }
  5342. }
  5343. function parseErrMsg(errMsg) {
  5344. if (!errMsg || isString$2(errMsg)) {
  5345. return errMsg;
  5346. }
  5347. if (errMsg.stack) {
  5348. if (typeof globalThis === "undefined" || !globalThis.harmonyChannel) {
  5349. console.error(errMsg.message + "\n" + errMsg.stack);
  5350. }
  5351. return errMsg.message;
  5352. }
  5353. return errMsg;
  5354. }
  5355. function wrapperTaskApi(name, fn, protocol, options) {
  5356. return (args) => {
  5357. const id = createAsyncApiCallback(name, args, options);
  5358. const errMsg = beforeInvokeApi(name, [args], protocol);
  5359. if (errMsg) {
  5360. return invokeFail(id, name, errMsg);
  5361. }
  5362. return fn(args, {
  5363. resolve: (res) => invokeSuccess(id, name, res),
  5364. reject: (errMsg2, errRes) => invokeFail(id, name, parseErrMsg(errMsg2), errRes)
  5365. });
  5366. };
  5367. }
  5368. function wrapperSyncApi(name, fn, protocol, options) {
  5369. return (...args) => {
  5370. const errMsg = beforeInvokeApi(name, args, protocol);
  5371. if (errMsg) {
  5372. throw new Error(errMsg);
  5373. }
  5374. return fn.apply(null, args);
  5375. };
  5376. }
  5377. function wrapperAsyncApi(name, fn, protocol, options) {
  5378. return wrapperTaskApi(name, fn, protocol, options);
  5379. }
  5380. function defineSyncApi(name, fn, protocol, options) {
  5381. return wrapperSyncApi(name, fn, protocol);
  5382. }
  5383. function defineAsyncApi(name, fn, protocol, options) {
  5384. return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options));
  5385. }
  5386. const API_UPX2PX = "upx2px";
  5387. const Upx2pxProtocol = [
  5388. {
  5389. name: "upx",
  5390. type: [Number, String],
  5391. required: true
  5392. }
  5393. ];
  5394. const EPS = 1e-4;
  5395. const BASE_DEVICE_WIDTH = 750;
  5396. let isIOS = false;
  5397. let deviceWidth = 0;
  5398. let deviceDPR = 0;
  5399. function checkDeviceWidth() {
  5400. var _a, _b;
  5401. let windowWidth, pixelRatio, platform2;
  5402. {
  5403. const windowInfo = ((_a = wx.getWindowInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
  5404. const deviceInfo = ((_b = wx.getDeviceInfo) === null || _b === void 0 ? void 0 : _b.call(wx)) || wx.getSystemInfoSync();
  5405. windowWidth = windowInfo.windowWidth;
  5406. pixelRatio = windowInfo.pixelRatio;
  5407. platform2 = deviceInfo.platform;
  5408. }
  5409. deviceWidth = windowWidth;
  5410. deviceDPR = pixelRatio;
  5411. isIOS = platform2 === "ios";
  5412. }
  5413. const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
  5414. if (deviceWidth === 0) {
  5415. checkDeviceWidth();
  5416. }
  5417. number = Number(number);
  5418. if (number === 0) {
  5419. return 0;
  5420. }
  5421. let width = newDeviceWidth || deviceWidth;
  5422. let result = number / BASE_DEVICE_WIDTH * width;
  5423. if (result < 0) {
  5424. result = -result;
  5425. }
  5426. result = Math.floor(result + EPS);
  5427. if (result === 0) {
  5428. if (deviceDPR === 1 || !isIOS) {
  5429. result = 1;
  5430. } else {
  5431. result = 0.5;
  5432. }
  5433. }
  5434. return number < 0 ? -result : result;
  5435. }, Upx2pxProtocol);
  5436. function __f__(type, filename, ...args) {
  5437. if (filename) {
  5438. args.push(filename);
  5439. }
  5440. console[type].apply(console, args);
  5441. }
  5442. const API_ADD_INTERCEPTOR = "addInterceptor";
  5443. const API_REMOVE_INTERCEPTOR = "removeInterceptor";
  5444. const AddInterceptorProtocol = [
  5445. {
  5446. name: "method",
  5447. type: [String, Object],
  5448. required: true
  5449. }
  5450. ];
  5451. const RemoveInterceptorProtocol = AddInterceptorProtocol;
  5452. function mergeInterceptorHook(interceptors2, interceptor) {
  5453. Object.keys(interceptor).forEach((hook) => {
  5454. if (isFunction$2(interceptor[hook])) {
  5455. interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]);
  5456. }
  5457. });
  5458. }
  5459. function removeInterceptorHook(interceptors2, interceptor) {
  5460. if (!interceptors2 || !interceptor) {
  5461. return;
  5462. }
  5463. Object.keys(interceptor).forEach((name) => {
  5464. const hooks = interceptors2[name];
  5465. const hook = interceptor[name];
  5466. if (isArray$2(hooks) && isFunction$2(hook)) {
  5467. remove(hooks, hook);
  5468. }
  5469. });
  5470. }
  5471. function mergeHook(parentVal, childVal) {
  5472. const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray$2(childVal) ? childVal : [childVal] : parentVal;
  5473. return res ? dedupeHooks(res) : res;
  5474. }
  5475. function dedupeHooks(hooks) {
  5476. const res = [];
  5477. for (let i = 0; i < hooks.length; i++) {
  5478. if (res.indexOf(hooks[i]) === -1) {
  5479. res.push(hooks[i]);
  5480. }
  5481. }
  5482. return res;
  5483. }
  5484. const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
  5485. if (isString$2(method) && isPlainObject$1(interceptor)) {
  5486. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
  5487. } else if (isPlainObject$1(method)) {
  5488. mergeInterceptorHook(globalInterceptors, method);
  5489. }
  5490. }, AddInterceptorProtocol);
  5491. const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
  5492. if (isString$2(method)) {
  5493. if (isPlainObject$1(interceptor)) {
  5494. removeInterceptorHook(scopedInterceptors[method], interceptor);
  5495. } else {
  5496. delete scopedInterceptors[method];
  5497. }
  5498. } else if (isPlainObject$1(method)) {
  5499. removeInterceptorHook(globalInterceptors, method);
  5500. }
  5501. }, RemoveInterceptorProtocol);
  5502. const interceptors = {};
  5503. const API_ON = "$on";
  5504. const OnProtocol = [
  5505. {
  5506. name: "event",
  5507. type: String,
  5508. required: true
  5509. },
  5510. {
  5511. name: "callback",
  5512. type: Function,
  5513. required: true
  5514. }
  5515. ];
  5516. const API_ONCE = "$once";
  5517. const OnceProtocol = OnProtocol;
  5518. const API_OFF = "$off";
  5519. const OffProtocol = [
  5520. {
  5521. name: "event",
  5522. type: [String, Array]
  5523. },
  5524. {
  5525. name: "callback",
  5526. type: [Function, Number]
  5527. }
  5528. ];
  5529. const API_EMIT = "$emit";
  5530. const EmitProtocol = [
  5531. {
  5532. name: "event",
  5533. type: String,
  5534. required: true
  5535. }
  5536. ];
  5537. class EventBus {
  5538. constructor() {
  5539. this.$emitter = new E$1();
  5540. }
  5541. on(name, callback) {
  5542. return this.$emitter.on(name, callback);
  5543. }
  5544. once(name, callback) {
  5545. return this.$emitter.once(name, callback);
  5546. }
  5547. off(name, callback) {
  5548. if (!name) {
  5549. this.$emitter.e = {};
  5550. return;
  5551. }
  5552. this.$emitter.off(name, callback);
  5553. }
  5554. emit(name, ...args) {
  5555. this.$emitter.emit(name, ...args);
  5556. }
  5557. }
  5558. const eventBus = new EventBus();
  5559. const $on = defineSyncApi(API_ON, (name, callback) => {
  5560. eventBus.on(name, callback);
  5561. return () => eventBus.off(name, callback);
  5562. }, OnProtocol);
  5563. const $once = defineSyncApi(API_ONCE, (name, callback) => {
  5564. eventBus.once(name, callback);
  5565. return () => eventBus.off(name, callback);
  5566. }, OnceProtocol);
  5567. const $off = defineSyncApi(API_OFF, (name, callback) => {
  5568. if (!isArray$2(name))
  5569. name = name ? [name] : [];
  5570. name.forEach((n) => {
  5571. eventBus.off(n, callback);
  5572. });
  5573. }, OffProtocol);
  5574. const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
  5575. eventBus.emit(name, ...args);
  5576. }, EmitProtocol);
  5577. let cid;
  5578. let cidErrMsg;
  5579. let enabled;
  5580. function normalizePushMessage(message) {
  5581. try {
  5582. return JSON.parse(message);
  5583. } catch (e) {
  5584. }
  5585. return message;
  5586. }
  5587. function invokePushCallback(args) {
  5588. if (args.type === "enabled") {
  5589. enabled = true;
  5590. } else if (args.type === "clientId") {
  5591. cid = args.cid;
  5592. cidErrMsg = args.errMsg;
  5593. invokeGetPushCidCallbacks(cid, args.errMsg);
  5594. } else if (args.type === "pushMsg") {
  5595. const message = {
  5596. type: "receive",
  5597. data: normalizePushMessage(args.message)
  5598. };
  5599. for (let i = 0; i < onPushMessageCallbacks.length; i++) {
  5600. const callback = onPushMessageCallbacks[i];
  5601. callback(message);
  5602. if (message.stopped) {
  5603. break;
  5604. }
  5605. }
  5606. } else if (args.type === "click") {
  5607. onPushMessageCallbacks.forEach((callback) => {
  5608. callback({
  5609. type: "click",
  5610. data: normalizePushMessage(args.message)
  5611. });
  5612. });
  5613. }
  5614. }
  5615. const getPushCidCallbacks = [];
  5616. function invokeGetPushCidCallbacks(cid2, errMsg) {
  5617. getPushCidCallbacks.forEach((callback) => {
  5618. callback(cid2, errMsg);
  5619. });
  5620. getPushCidCallbacks.length = 0;
  5621. }
  5622. const API_GET_PUSH_CLIENT_ID = "getPushClientId";
  5623. const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
  5624. Promise.resolve().then(() => {
  5625. if (typeof enabled === "undefined") {
  5626. enabled = false;
  5627. cid = "";
  5628. cidErrMsg = "uniPush is not enabled";
  5629. }
  5630. getPushCidCallbacks.push((cid2, errMsg) => {
  5631. if (cid2) {
  5632. resolve({ cid: cid2 });
  5633. } else {
  5634. reject(errMsg);
  5635. }
  5636. });
  5637. if (typeof cid !== "undefined") {
  5638. invokeGetPushCidCallbacks(cid, cidErrMsg);
  5639. }
  5640. });
  5641. });
  5642. const onPushMessageCallbacks = [];
  5643. const onPushMessage = (fn) => {
  5644. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  5645. onPushMessageCallbacks.push(fn);
  5646. }
  5647. };
  5648. const offPushMessage = (fn) => {
  5649. if (!fn) {
  5650. onPushMessageCallbacks.length = 0;
  5651. } else {
  5652. const index2 = onPushMessageCallbacks.indexOf(fn);
  5653. if (index2 > -1) {
  5654. onPushMessageCallbacks.splice(index2, 1);
  5655. }
  5656. }
  5657. };
  5658. const SYNC_API_RE = /^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/;
  5659. const CONTEXT_API_RE = /^create|Manager$/;
  5660. const CONTEXT_API_RE_EXC = ["createBLEConnection"];
  5661. const TASK_APIS = ["request", "downloadFile", "uploadFile", "connectSocket"];
  5662. const ASYNC_API = ["createBLEConnection"];
  5663. const CALLBACK_API_RE = /^on|^off/;
  5664. function isContextApi(name) {
  5665. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  5666. }
  5667. function isSyncApi(name) {
  5668. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  5669. }
  5670. function isCallbackApi(name) {
  5671. return CALLBACK_API_RE.test(name) && name !== "onPush";
  5672. }
  5673. function isTaskApi(name) {
  5674. return TASK_APIS.indexOf(name) !== -1;
  5675. }
  5676. function shouldPromise(name) {
  5677. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  5678. return false;
  5679. }
  5680. return true;
  5681. }
  5682. if (!Promise.prototype.finally) {
  5683. Promise.prototype.finally = function(onfinally) {
  5684. const promise = this.constructor;
  5685. return this.then((value) => promise.resolve(onfinally && onfinally()).then(() => value), (reason) => promise.resolve(onfinally && onfinally()).then(() => {
  5686. throw reason;
  5687. }));
  5688. };
  5689. }
  5690. function promisify(name, api) {
  5691. if (!shouldPromise(name)) {
  5692. return api;
  5693. }
  5694. if (!isFunction$2(api)) {
  5695. return api;
  5696. }
  5697. return function promiseApi(options = {}, ...rest) {
  5698. if (isFunction$2(options.success) || isFunction$2(options.fail) || isFunction$2(options.complete)) {
  5699. return wrapperReturnValue(name, invokeApi(name, api, options, rest));
  5700. }
  5701. return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
  5702. invokeApi(name, api, extend$2({}, options, {
  5703. success: resolve,
  5704. fail: reject
  5705. }), rest);
  5706. })));
  5707. };
  5708. }
  5709. const CALLBACKS = ["success", "fail", "cancel", "complete"];
  5710. function initWrapper(protocols2) {
  5711. function processCallback(methodName, method, returnValue) {
  5712. return function(res) {
  5713. return method(processReturnValue(methodName, res, returnValue));
  5714. };
  5715. }
  5716. function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) {
  5717. if (isPlainObject$1(fromArgs)) {
  5718. const toArgs = keepFromArgs === true ? fromArgs : {};
  5719. if (isFunction$2(argsOption)) {
  5720. argsOption = argsOption(fromArgs, toArgs) || {};
  5721. }
  5722. for (const key in fromArgs) {
  5723. if (hasOwn(argsOption, key)) {
  5724. let keyOption = argsOption[key];
  5725. if (isFunction$2(keyOption)) {
  5726. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  5727. }
  5728. if (!keyOption) {
  5729. console.warn(`微信小程序 ${methodName} 暂不支持 ${key}`);
  5730. } else if (isString$2(keyOption)) {
  5731. toArgs[keyOption] = fromArgs[key];
  5732. } else if (isPlainObject$1(keyOption)) {
  5733. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  5734. }
  5735. } else if (CALLBACKS.indexOf(key) !== -1) {
  5736. const callback = fromArgs[key];
  5737. if (isFunction$2(callback)) {
  5738. toArgs[key] = processCallback(methodName, callback, returnValue);
  5739. }
  5740. } else {
  5741. if (!keepFromArgs && !hasOwn(toArgs, key)) {
  5742. toArgs[key] = fromArgs[key];
  5743. }
  5744. }
  5745. }
  5746. return toArgs;
  5747. } else if (isFunction$2(fromArgs)) {
  5748. if (isFunction$2(argsOption)) {
  5749. argsOption(fromArgs, {});
  5750. }
  5751. fromArgs = processCallback(methodName, fromArgs, returnValue);
  5752. }
  5753. return fromArgs;
  5754. }
  5755. function processReturnValue(methodName, res, returnValue, keepReturnValue = false) {
  5756. if (isFunction$2(protocols2.returnValue)) {
  5757. res = protocols2.returnValue(methodName, res);
  5758. }
  5759. const realKeepReturnValue = keepReturnValue || false;
  5760. return processArgs(methodName, res, returnValue, {}, realKeepReturnValue);
  5761. }
  5762. return function wrapper(methodName, method) {
  5763. const hasProtocol = hasOwn(protocols2, methodName);
  5764. if (!hasProtocol && typeof wx[methodName] !== "function") {
  5765. return method;
  5766. }
  5767. const needWrapper = hasProtocol || isFunction$2(protocols2.returnValue) || isContextApi(methodName) || isTaskApi(methodName);
  5768. const hasMethod = hasProtocol || isFunction$2(method);
  5769. if (!hasProtocol && !method) {
  5770. return function() {
  5771. console.error(`微信小程序 暂不支持${methodName}`);
  5772. };
  5773. }
  5774. if (!needWrapper || !hasMethod) {
  5775. return method;
  5776. }
  5777. const protocol = protocols2[methodName];
  5778. return function(arg1, arg2) {
  5779. let options = protocol || {};
  5780. if (isFunction$2(protocol)) {
  5781. options = protocol(arg1);
  5782. }
  5783. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  5784. const args = [arg1];
  5785. if (typeof arg2 !== "undefined") {
  5786. args.push(arg2);
  5787. }
  5788. const returnValue = wx[options.name || methodName].apply(wx, args);
  5789. if (isContextApi(methodName) || isTaskApi(methodName)) {
  5790. if (returnValue && !returnValue.__v_skip) {
  5791. returnValue.__v_skip = true;
  5792. }
  5793. }
  5794. if (isSyncApi(methodName)) {
  5795. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  5796. }
  5797. return returnValue;
  5798. };
  5799. };
  5800. }
  5801. const getLocale = () => {
  5802. const app = isFunction$2(getApp) && getApp({ allowDefault: true });
  5803. if (app && app.$vm) {
  5804. return app.$vm.$locale;
  5805. }
  5806. return getLocaleLanguage$1();
  5807. };
  5808. const setLocale = (locale) => {
  5809. const app = isFunction$2(getApp) && getApp();
  5810. if (!app) {
  5811. return false;
  5812. }
  5813. const oldLocale = app.$vm.$locale;
  5814. if (oldLocale !== locale) {
  5815. app.$vm.$locale = locale;
  5816. onLocaleChangeCallbacks.forEach((fn) => fn({ locale }));
  5817. return true;
  5818. }
  5819. return false;
  5820. };
  5821. const onLocaleChangeCallbacks = [];
  5822. const onLocaleChange = (fn) => {
  5823. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  5824. onLocaleChangeCallbacks.push(fn);
  5825. }
  5826. };
  5827. if (typeof global !== "undefined") {
  5828. global.getLocale = getLocale;
  5829. }
  5830. const UUID_KEY = "__DC_STAT_UUID";
  5831. let deviceId;
  5832. function useDeviceId(global2 = wx) {
  5833. return function addDeviceId(_, toRes) {
  5834. deviceId = deviceId || global2.getStorageSync(UUID_KEY);
  5835. if (!deviceId) {
  5836. deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
  5837. wx.setStorage({
  5838. key: UUID_KEY,
  5839. data: deviceId
  5840. });
  5841. }
  5842. toRes.deviceId = deviceId;
  5843. };
  5844. }
  5845. function addSafeAreaInsets(fromRes, toRes) {
  5846. if (fromRes.safeArea) {
  5847. const safeArea = fromRes.safeArea;
  5848. toRes.safeAreaInsets = {
  5849. top: safeArea.top,
  5850. left: safeArea.left,
  5851. right: fromRes.windowWidth - safeArea.right,
  5852. bottom: fromRes.screenHeight - safeArea.bottom
  5853. };
  5854. }
  5855. }
  5856. function getOSInfo(system, platform2) {
  5857. let osName = "";
  5858. let osVersion = "";
  5859. if (platform2 && false) {
  5860. osName = platform2;
  5861. osVersion = system;
  5862. } else {
  5863. osName = system.split(" ")[0] || platform2;
  5864. osVersion = system.split(" ")[1] || "";
  5865. }
  5866. osName = osName.toLocaleLowerCase();
  5867. switch (osName) {
  5868. case "harmony":
  5869. case "ohos":
  5870. case "openharmony":
  5871. osName = "harmonyos";
  5872. break;
  5873. case "iphone os":
  5874. osName = "ios";
  5875. break;
  5876. case "mac":
  5877. case "darwin":
  5878. osName = "macos";
  5879. break;
  5880. case "windows_nt":
  5881. osName = "windows";
  5882. break;
  5883. }
  5884. return {
  5885. osName,
  5886. osVersion
  5887. };
  5888. }
  5889. function populateParameters(fromRes, toRes) {
  5890. const { brand = "", model = "", system = "", language = "", theme, version: version2, platform: platform2, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation } = fromRes;
  5891. const { osName, osVersion } = getOSInfo(system, platform2);
  5892. let hostVersion = version2;
  5893. let deviceType = getGetDeviceType(fromRes, model);
  5894. let deviceBrand = getDeviceBrand(brand);
  5895. let _hostName = getHostName(fromRes);
  5896. let _deviceOrientation = deviceOrientation;
  5897. let _devicePixelRatio = pixelRatio;
  5898. let _SDKVersion = SDKVersion;
  5899. const hostLanguage = (language || "").replace(/_/g, "-");
  5900. const parameters = {
  5901. appId: "",
  5902. appName: "project2",
  5903. appVersion: "1.0.0",
  5904. appVersionCode: "100",
  5905. appLanguage: getAppLanguage(hostLanguage),
  5906. uniCompileVersion: "4.66",
  5907. uniCompilerVersion: "4.66",
  5908. uniRuntimeVersion: "4.66",
  5909. uniPlatform: "mp-weixin",
  5910. deviceBrand,
  5911. deviceModel: model,
  5912. deviceType,
  5913. devicePixelRatio: _devicePixelRatio,
  5914. deviceOrientation: _deviceOrientation,
  5915. osName,
  5916. osVersion,
  5917. hostTheme: theme,
  5918. hostVersion,
  5919. hostLanguage,
  5920. hostName: _hostName,
  5921. hostSDKVersion: _SDKVersion,
  5922. hostFontSizeSetting: fontSizeSetting,
  5923. windowTop: 0,
  5924. windowBottom: 0,
  5925. // TODO
  5926. osLanguage: void 0,
  5927. osTheme: void 0,
  5928. ua: void 0,
  5929. hostPackageName: void 0,
  5930. browserName: void 0,
  5931. browserVersion: void 0,
  5932. isUniAppX: false
  5933. };
  5934. extend$2(toRes, parameters);
  5935. }
  5936. function getGetDeviceType(fromRes, model) {
  5937. let deviceType = fromRes.deviceType || "phone";
  5938. {
  5939. const deviceTypeMaps = {
  5940. ipad: "pad",
  5941. windows: "pc",
  5942. mac: "pc"
  5943. };
  5944. const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  5945. const _model = model.toLocaleLowerCase();
  5946. for (let index2 = 0; index2 < deviceTypeMapsKeys.length; index2++) {
  5947. const _m = deviceTypeMapsKeys[index2];
  5948. if (_model.indexOf(_m) !== -1) {
  5949. deviceType = deviceTypeMaps[_m];
  5950. break;
  5951. }
  5952. }
  5953. }
  5954. return deviceType;
  5955. }
  5956. function getDeviceBrand(brand) {
  5957. let deviceBrand = brand;
  5958. if (deviceBrand) {
  5959. deviceBrand = deviceBrand.toLocaleLowerCase();
  5960. }
  5961. return deviceBrand;
  5962. }
  5963. function getAppLanguage(defaultLanguage) {
  5964. return getLocale ? getLocale() : defaultLanguage;
  5965. }
  5966. function getHostName(fromRes) {
  5967. const _platform = "WeChat";
  5968. let _hostName = fromRes.hostName || _platform;
  5969. {
  5970. if (fromRes.environment) {
  5971. _hostName = fromRes.environment;
  5972. } else if (fromRes.host && fromRes.host.env) {
  5973. _hostName = fromRes.host.env;
  5974. }
  5975. }
  5976. return _hostName;
  5977. }
  5978. const getSystemInfo = {
  5979. returnValue: (fromRes, toRes) => {
  5980. addSafeAreaInsets(fromRes, toRes);
  5981. useDeviceId()(fromRes, toRes);
  5982. populateParameters(fromRes, toRes);
  5983. }
  5984. };
  5985. const getSystemInfoSync = getSystemInfo;
  5986. const redirectTo = {};
  5987. const previewImage = {
  5988. args(fromArgs, toArgs) {
  5989. let currentIndex = parseInt(fromArgs.current);
  5990. if (isNaN(currentIndex)) {
  5991. return;
  5992. }
  5993. const urls = fromArgs.urls;
  5994. if (!isArray$2(urls)) {
  5995. return;
  5996. }
  5997. const len = urls.length;
  5998. if (!len) {
  5999. return;
  6000. }
  6001. if (currentIndex < 0) {
  6002. currentIndex = 0;
  6003. } else if (currentIndex >= len) {
  6004. currentIndex = len - 1;
  6005. }
  6006. if (currentIndex > 0) {
  6007. toArgs.current = urls[currentIndex];
  6008. toArgs.urls = urls.filter((item, index2) => index2 < currentIndex ? item !== urls[currentIndex] : true);
  6009. } else {
  6010. toArgs.current = urls[0];
  6011. }
  6012. return {
  6013. indicator: false,
  6014. loop: false
  6015. };
  6016. }
  6017. };
  6018. const showActionSheet = {
  6019. args(fromArgs, toArgs) {
  6020. toArgs.alertText = fromArgs.title;
  6021. }
  6022. };
  6023. const getDeviceInfo = {
  6024. returnValue: (fromRes, toRes) => {
  6025. const { brand, model, system = "", platform: platform2 = "" } = fromRes;
  6026. let deviceType = getGetDeviceType(fromRes, model);
  6027. let deviceBrand = getDeviceBrand(brand);
  6028. useDeviceId()(fromRes, toRes);
  6029. const { osName, osVersion } = getOSInfo(system, platform2);
  6030. toRes = sortObject(extend$2(toRes, {
  6031. deviceType,
  6032. deviceBrand,
  6033. deviceModel: model,
  6034. osName,
  6035. osVersion
  6036. }));
  6037. }
  6038. };
  6039. const getAppBaseInfo = {
  6040. returnValue: (fromRes, toRes) => {
  6041. const { version: version2, language, SDKVersion, theme } = fromRes;
  6042. let _hostName = getHostName(fromRes);
  6043. let hostLanguage = (language || "").replace(/_/g, "-");
  6044. const parameters = {
  6045. hostVersion: version2,
  6046. hostLanguage,
  6047. hostName: _hostName,
  6048. hostSDKVersion: SDKVersion,
  6049. hostTheme: theme,
  6050. appId: "",
  6051. appName: "project2",
  6052. appVersion: "1.0.0",
  6053. appVersionCode: "100",
  6054. appLanguage: getAppLanguage(hostLanguage),
  6055. isUniAppX: false,
  6056. uniPlatform: "mp-weixin",
  6057. uniCompileVersion: "4.66",
  6058. uniCompilerVersion: "4.66",
  6059. uniRuntimeVersion: "4.66"
  6060. };
  6061. extend$2(toRes, parameters);
  6062. }
  6063. };
  6064. const getWindowInfo = {
  6065. returnValue: (fromRes, toRes) => {
  6066. addSafeAreaInsets(fromRes, toRes);
  6067. toRes = sortObject(extend$2(toRes, {
  6068. windowTop: 0,
  6069. windowBottom: 0
  6070. }));
  6071. }
  6072. };
  6073. const getAppAuthorizeSetting = {
  6074. returnValue: function(fromRes, toRes) {
  6075. const { locationReducedAccuracy } = fromRes;
  6076. toRes.locationAccuracy = "unsupported";
  6077. if (locationReducedAccuracy === true) {
  6078. toRes.locationAccuracy = "reduced";
  6079. } else if (locationReducedAccuracy === false) {
  6080. toRes.locationAccuracy = "full";
  6081. }
  6082. }
  6083. };
  6084. const onError = {
  6085. args(fromArgs) {
  6086. const app = getApp({ allowDefault: true }) || {};
  6087. if (!app.$vm) {
  6088. if (!wx.$onErrorHandlers) {
  6089. wx.$onErrorHandlers = [];
  6090. }
  6091. wx.$onErrorHandlers.push(fromArgs);
  6092. } else {
  6093. injectHook(ON_ERROR, fromArgs, app.$vm.$);
  6094. }
  6095. }
  6096. };
  6097. const offError = {
  6098. args(fromArgs) {
  6099. const app = getApp({ allowDefault: true }) || {};
  6100. if (!app.$vm) {
  6101. if (!wx.$onErrorHandlers) {
  6102. return;
  6103. }
  6104. const index2 = wx.$onErrorHandlers.findIndex((fn) => fn === fromArgs);
  6105. if (index2 !== -1) {
  6106. wx.$onErrorHandlers.splice(index2, 1);
  6107. }
  6108. } else if (fromArgs.__weh) {
  6109. const onErrors = app.$vm.$[ON_ERROR];
  6110. if (onErrors) {
  6111. const index2 = onErrors.indexOf(fromArgs.__weh);
  6112. if (index2 > -1) {
  6113. onErrors.splice(index2, 1);
  6114. }
  6115. }
  6116. }
  6117. }
  6118. };
  6119. const onSocketOpen = {
  6120. args() {
  6121. if (wx.__uni_console__) {
  6122. if (wx.__uni_console_warned__) {
  6123. return;
  6124. }
  6125. wx.__uni_console_warned__ = true;
  6126. console.warn(`开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)`);
  6127. }
  6128. }
  6129. };
  6130. const onSocketMessage = onSocketOpen;
  6131. const baseApis = {
  6132. $on,
  6133. $off,
  6134. $once,
  6135. $emit,
  6136. upx2px,
  6137. rpx2px: upx2px,
  6138. interceptors,
  6139. addInterceptor,
  6140. removeInterceptor,
  6141. onCreateVueApp,
  6142. invokeCreateVueAppHook,
  6143. getLocale,
  6144. setLocale,
  6145. onLocaleChange,
  6146. getPushClientId,
  6147. onPushMessage,
  6148. offPushMessage,
  6149. invokePushCallback,
  6150. __f__
  6151. };
  6152. function initUni(api, protocols2, platform2 = wx) {
  6153. const wrapper = initWrapper(protocols2);
  6154. const UniProxyHandlers = {
  6155. get(target, key) {
  6156. if (hasOwn(target, key)) {
  6157. return target[key];
  6158. }
  6159. if (hasOwn(api, key)) {
  6160. return promisify(key, api[key]);
  6161. }
  6162. if (hasOwn(baseApis, key)) {
  6163. return promisify(key, baseApis[key]);
  6164. }
  6165. return promisify(key, wrapper(key, platform2[key]));
  6166. }
  6167. };
  6168. return new Proxy({}, UniProxyHandlers);
  6169. }
  6170. function initGetProvider(providers) {
  6171. return function getProvider2({ service, success, fail, complete }) {
  6172. let res;
  6173. if (providers[service]) {
  6174. res = {
  6175. errMsg: "getProvider:ok",
  6176. service,
  6177. provider: providers[service]
  6178. };
  6179. isFunction$2(success) && success(res);
  6180. } else {
  6181. res = {
  6182. errMsg: "getProvider:fail:服务[" + service + "]不存在"
  6183. };
  6184. isFunction$2(fail) && fail(res);
  6185. }
  6186. isFunction$2(complete) && complete(res);
  6187. };
  6188. }
  6189. const objectKeys = [
  6190. "qy",
  6191. "env",
  6192. "error",
  6193. "version",
  6194. "lanDebug",
  6195. "cloud",
  6196. "serviceMarket",
  6197. "router",
  6198. "worklet",
  6199. "__webpack_require_UNI_MP_PLUGIN__"
  6200. ];
  6201. const singlePageDisableKey = ["lanDebug", "router", "worklet"];
  6202. const launchOption = wx.getLaunchOptionsSync ? wx.getLaunchOptionsSync() : null;
  6203. function isWxKey(key) {
  6204. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  6205. return false;
  6206. }
  6207. return objectKeys.indexOf(key) > -1 || typeof wx[key] === "function";
  6208. }
  6209. function initWx() {
  6210. const newWx = {};
  6211. for (const key in wx) {
  6212. if (isWxKey(key)) {
  6213. newWx[key] = wx[key];
  6214. }
  6215. }
  6216. if (typeof globalThis !== "undefined" && typeof requireMiniProgram === "undefined") {
  6217. globalThis.wx = newWx;
  6218. }
  6219. return newWx;
  6220. }
  6221. const mocks$1 = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  6222. const getProvider = initGetProvider({
  6223. oauth: ["weixin"],
  6224. share: ["weixin"],
  6225. payment: ["wxpay"],
  6226. push: ["weixin"]
  6227. });
  6228. function initComponentMocks(component) {
  6229. const res = /* @__PURE__ */ Object.create(null);
  6230. mocks$1.forEach((name) => {
  6231. res[name] = component[name];
  6232. });
  6233. return res;
  6234. }
  6235. function createSelectorQuery() {
  6236. const query = wx$2.createSelectorQuery();
  6237. const oldIn = query.in;
  6238. query.in = function newIn(component) {
  6239. if (component.$scope) {
  6240. return oldIn.call(this, component.$scope);
  6241. }
  6242. return oldIn.call(this, initComponentMocks(component));
  6243. };
  6244. return query;
  6245. }
  6246. const wx$2 = initWx();
  6247. if (!wx$2.canIUse("getAppBaseInfo")) {
  6248. wx$2.getAppBaseInfo = wx$2.getSystemInfoSync;
  6249. }
  6250. if (!wx$2.canIUse("getWindowInfo")) {
  6251. wx$2.getWindowInfo = wx$2.getSystemInfoSync;
  6252. }
  6253. if (!wx$2.canIUse("getDeviceInfo")) {
  6254. wx$2.getDeviceInfo = wx$2.getSystemInfoSync;
  6255. }
  6256. let baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();
  6257. if (!baseInfo) {
  6258. baseInfo = wx$2.getSystemInfoSync();
  6259. }
  6260. const host = baseInfo ? baseInfo.host : null;
  6261. const shareVideoMessage = host && host.env === "SAAASDK" ? wx$2.miniapp.shareVideoMessage : wx$2.shareVideoMessage;
  6262. var shims = /* @__PURE__ */ Object.freeze({
  6263. __proto__: null,
  6264. createSelectorQuery,
  6265. getProvider,
  6266. shareVideoMessage
  6267. });
  6268. const compressImage = {
  6269. args(fromArgs, toArgs) {
  6270. if (fromArgs.compressedHeight && !toArgs.compressHeight) {
  6271. toArgs.compressHeight = fromArgs.compressedHeight;
  6272. }
  6273. if (fromArgs.compressedWidth && !toArgs.compressWidth) {
  6274. toArgs.compressWidth = fromArgs.compressedWidth;
  6275. }
  6276. }
  6277. };
  6278. var protocols = /* @__PURE__ */ Object.freeze({
  6279. __proto__: null,
  6280. compressImage,
  6281. getAppAuthorizeSetting,
  6282. getAppBaseInfo,
  6283. getDeviceInfo,
  6284. getSystemInfo,
  6285. getSystemInfoSync,
  6286. getWindowInfo,
  6287. offError,
  6288. onError,
  6289. onSocketMessage,
  6290. onSocketOpen,
  6291. previewImage,
  6292. redirectTo,
  6293. showActionSheet
  6294. });
  6295. const wx$1 = initWx();
  6296. var index = initUni(shims, protocols, wx$1);
  6297. function initRuntimeSocket(hosts, port, id) {
  6298. if (hosts == "" || port == "" || id == "")
  6299. return Promise.resolve(null);
  6300. return hosts.split(",").reduce((promise, host2) => {
  6301. return promise.then((socket) => {
  6302. if (socket != null)
  6303. return Promise.resolve(socket);
  6304. return tryConnectSocket(host2, port, id);
  6305. });
  6306. }, Promise.resolve(null));
  6307. }
  6308. const SOCKET_TIMEOUT = 500;
  6309. function tryConnectSocket(host2, port, id) {
  6310. return new Promise((resolve, reject) => {
  6311. const socket = index.connectSocket({
  6312. url: `ws://${host2}:${port}/${id}`,
  6313. multiple: true,
  6314. // 支付宝小程序 是否开启多实例
  6315. fail() {
  6316. resolve(null);
  6317. }
  6318. });
  6319. const timer = setTimeout(() => {
  6320. socket.close({
  6321. code: 1006,
  6322. reason: "connect timeout"
  6323. });
  6324. resolve(null);
  6325. }, SOCKET_TIMEOUT);
  6326. socket.onOpen((e) => {
  6327. clearTimeout(timer);
  6328. resolve(socket);
  6329. });
  6330. socket.onClose((e) => {
  6331. clearTimeout(timer);
  6332. resolve(null);
  6333. });
  6334. socket.onError((e) => {
  6335. clearTimeout(timer);
  6336. resolve(null);
  6337. });
  6338. });
  6339. }
  6340. const CONSOLE_TYPES = ["log", "warn", "error", "info", "debug"];
  6341. const originalConsole = /* @__PURE__ */ CONSOLE_TYPES.reduce((methods, type) => {
  6342. methods[type] = console[type].bind(console);
  6343. return methods;
  6344. }, {});
  6345. let sendError = null;
  6346. const errorQueue = /* @__PURE__ */ new Set();
  6347. const errorExtra = {};
  6348. function sendErrorMessages(errors) {
  6349. if (sendError == null) {
  6350. errors.forEach((error) => {
  6351. errorQueue.add(error);
  6352. });
  6353. return;
  6354. }
  6355. const data = errors.map((err) => {
  6356. if (typeof err === "string") {
  6357. return err;
  6358. }
  6359. const isPromiseRejection = err && "promise" in err && "reason" in err;
  6360. const prefix = isPromiseRejection ? "UnhandledPromiseRejection: " : "";
  6361. if (isPromiseRejection) {
  6362. err = err.reason;
  6363. }
  6364. if (err instanceof Error && err.stack) {
  6365. if (err.message && !err.stack.includes(err.message)) {
  6366. return `${prefix}${err.message}
  6367. ${err.stack}`;
  6368. }
  6369. return `${prefix}${err.stack}`;
  6370. }
  6371. if (typeof err === "object" && err !== null) {
  6372. try {
  6373. return prefix + JSON.stringify(err);
  6374. } catch (err2) {
  6375. return prefix + String(err2);
  6376. }
  6377. }
  6378. return prefix + String(err);
  6379. }).filter(Boolean);
  6380. if (data.length > 0) {
  6381. sendError(JSON.stringify(Object.assign({
  6382. type: "error",
  6383. data
  6384. }, errorExtra)));
  6385. }
  6386. }
  6387. function setSendError(value, extra = {}) {
  6388. sendError = value;
  6389. Object.assign(errorExtra, extra);
  6390. if (value != null && errorQueue.size > 0) {
  6391. const errors = Array.from(errorQueue);
  6392. errorQueue.clear();
  6393. sendErrorMessages(errors);
  6394. }
  6395. }
  6396. function initOnError() {
  6397. function onError2(error) {
  6398. try {
  6399. if (typeof PromiseRejectionEvent !== "undefined" && error instanceof PromiseRejectionEvent && error.reason instanceof Error && error.reason.message && error.reason.message.includes(`Cannot create property 'errMsg' on string 'taskId`)) {
  6400. return;
  6401. }
  6402. if (true) {
  6403. originalConsole.error(error);
  6404. }
  6405. sendErrorMessages([error]);
  6406. } catch (err) {
  6407. originalConsole.error(err);
  6408. }
  6409. }
  6410. if (typeof index.onError === "function") {
  6411. index.onError(onError2);
  6412. }
  6413. if (typeof index.onUnhandledRejection === "function") {
  6414. index.onUnhandledRejection(onError2);
  6415. }
  6416. return function offError2() {
  6417. if (typeof index.offError === "function") {
  6418. index.offError(onError2);
  6419. }
  6420. if (typeof index.offUnhandledRejection === "function") {
  6421. index.offUnhandledRejection(onError2);
  6422. }
  6423. };
  6424. }
  6425. function formatMessage(type, args) {
  6426. try {
  6427. return {
  6428. type,
  6429. args: formatArgs(args)
  6430. };
  6431. } catch (e) {
  6432. }
  6433. return {
  6434. type,
  6435. args: []
  6436. };
  6437. }
  6438. function formatArgs(args) {
  6439. return args.map((arg) => formatArg(arg));
  6440. }
  6441. function formatArg(arg, depth = 0) {
  6442. if (depth >= 7) {
  6443. return {
  6444. type: "object",
  6445. value: "[Maximum depth reached]"
  6446. };
  6447. }
  6448. const type = typeof arg;
  6449. switch (type) {
  6450. case "string":
  6451. return formatString(arg);
  6452. case "number":
  6453. return formatNumber(arg);
  6454. case "boolean":
  6455. return formatBoolean(arg);
  6456. case "object":
  6457. try {
  6458. return formatObject(arg, depth);
  6459. } catch (e) {
  6460. return {
  6461. type: "object",
  6462. value: {
  6463. properties: []
  6464. }
  6465. };
  6466. }
  6467. case "undefined":
  6468. return formatUndefined();
  6469. case "function":
  6470. return formatFunction(arg);
  6471. case "symbol": {
  6472. return formatSymbol(arg);
  6473. }
  6474. case "bigint":
  6475. return formatBigInt(arg);
  6476. }
  6477. }
  6478. function formatFunction(value) {
  6479. return {
  6480. type: "function",
  6481. value: `function ${value.name}() {}`
  6482. };
  6483. }
  6484. function formatUndefined() {
  6485. return {
  6486. type: "undefined"
  6487. };
  6488. }
  6489. function formatBoolean(value) {
  6490. return {
  6491. type: "boolean",
  6492. value: String(value)
  6493. };
  6494. }
  6495. function formatNumber(value) {
  6496. return {
  6497. type: "number",
  6498. value: String(value)
  6499. };
  6500. }
  6501. function formatBigInt(value) {
  6502. return {
  6503. type: "bigint",
  6504. value: String(value)
  6505. };
  6506. }
  6507. function formatString(value) {
  6508. return {
  6509. type: "string",
  6510. value
  6511. };
  6512. }
  6513. function formatSymbol(value) {
  6514. return {
  6515. type: "symbol",
  6516. value: value.description
  6517. };
  6518. }
  6519. function formatObject(value, depth) {
  6520. if (value === null) {
  6521. return {
  6522. type: "null"
  6523. };
  6524. }
  6525. {
  6526. if (isComponentPublicInstance(value)) {
  6527. return formatComponentPublicInstance(value, depth);
  6528. }
  6529. if (isComponentInternalInstance(value)) {
  6530. return formatComponentInternalInstance(value, depth);
  6531. }
  6532. if (isUniElement(value)) {
  6533. return formatUniElement(value, depth);
  6534. }
  6535. if (isCSSStyleDeclaration(value)) {
  6536. return formatCSSStyleDeclaration(value, depth);
  6537. }
  6538. }
  6539. if (Array.isArray(value)) {
  6540. return {
  6541. type: "object",
  6542. subType: "array",
  6543. value: {
  6544. properties: value.map((v, i) => formatArrayElement(v, i, depth + 1))
  6545. }
  6546. };
  6547. }
  6548. if (value instanceof Set) {
  6549. return {
  6550. type: "object",
  6551. subType: "set",
  6552. className: "Set",
  6553. description: `Set(${value.size})`,
  6554. value: {
  6555. entries: Array.from(value).map((v) => formatSetEntry(v, depth + 1))
  6556. }
  6557. };
  6558. }
  6559. if (value instanceof Map) {
  6560. return {
  6561. type: "object",
  6562. subType: "map",
  6563. className: "Map",
  6564. description: `Map(${value.size})`,
  6565. value: {
  6566. entries: Array.from(value.entries()).map((v) => formatMapEntry(v, depth + 1))
  6567. }
  6568. };
  6569. }
  6570. if (value instanceof Promise) {
  6571. return {
  6572. type: "object",
  6573. subType: "promise",
  6574. value: {
  6575. properties: []
  6576. }
  6577. };
  6578. }
  6579. if (value instanceof RegExp) {
  6580. return {
  6581. type: "object",
  6582. subType: "regexp",
  6583. value: String(value),
  6584. className: "Regexp"
  6585. };
  6586. }
  6587. if (value instanceof Date) {
  6588. return {
  6589. type: "object",
  6590. subType: "date",
  6591. value: String(value),
  6592. className: "Date"
  6593. };
  6594. }
  6595. if (value instanceof Error) {
  6596. return {
  6597. type: "object",
  6598. subType: "error",
  6599. value: value.message || String(value),
  6600. className: value.name || "Error"
  6601. };
  6602. }
  6603. let className = void 0;
  6604. {
  6605. const constructor = value.constructor;
  6606. if (constructor) {
  6607. if (constructor.get$UTSMetadata$) {
  6608. className = constructor.get$UTSMetadata$().name;
  6609. }
  6610. }
  6611. }
  6612. let entries = Object.entries(value);
  6613. if (isHarmonyBuilderParams(value)) {
  6614. entries = entries.filter(([key]) => key !== "modifier" && key !== "nodeContent");
  6615. }
  6616. return {
  6617. type: "object",
  6618. className,
  6619. value: {
  6620. properties: entries.map((entry) => formatObjectProperty(entry[0], entry[1], depth + 1))
  6621. }
  6622. };
  6623. }
  6624. function isHarmonyBuilderParams(value) {
  6625. return value.modifier && value.modifier._attribute && value.nodeContent;
  6626. }
  6627. function isComponentPublicInstance(value) {
  6628. return value.$ && isComponentInternalInstance(value.$);
  6629. }
  6630. function isComponentInternalInstance(value) {
  6631. return value.type && value.uid != null && value.appContext;
  6632. }
  6633. function formatComponentPublicInstance(value, depth) {
  6634. return {
  6635. type: "object",
  6636. className: "ComponentPublicInstance",
  6637. value: {
  6638. properties: Object.entries(value.$.type).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6639. }
  6640. };
  6641. }
  6642. function formatComponentInternalInstance(value, depth) {
  6643. return {
  6644. type: "object",
  6645. className: "ComponentInternalInstance",
  6646. value: {
  6647. properties: Object.entries(value.type).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6648. }
  6649. };
  6650. }
  6651. function isUniElement(value) {
  6652. return value.style && value.tagName != null && value.nodeName != null;
  6653. }
  6654. function formatUniElement(value, depth) {
  6655. return {
  6656. type: "object",
  6657. // 非 x 没有 UniElement 的概念
  6658. // className: 'UniElement',
  6659. value: {
  6660. properties: Object.entries(value).filter(([name]) => [
  6661. "id",
  6662. "tagName",
  6663. "nodeName",
  6664. "dataset",
  6665. "offsetTop",
  6666. "offsetLeft",
  6667. "style"
  6668. ].includes(name)).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6669. }
  6670. };
  6671. }
  6672. function isCSSStyleDeclaration(value) {
  6673. return typeof value.getPropertyValue === "function" && typeof value.setProperty === "function" && value.$styles;
  6674. }
  6675. function formatCSSStyleDeclaration(style, depth) {
  6676. return {
  6677. type: "object",
  6678. value: {
  6679. properties: Object.entries(style.$styles).map(([name, value]) => formatObjectProperty(name, value, depth + 1))
  6680. }
  6681. };
  6682. }
  6683. function formatObjectProperty(name, value, depth) {
  6684. const result = formatArg(value, depth);
  6685. result.name = name;
  6686. return result;
  6687. }
  6688. function formatArrayElement(value, index2, depth) {
  6689. const result = formatArg(value, depth);
  6690. result.name = `${index2}`;
  6691. return result;
  6692. }
  6693. function formatSetEntry(value, depth) {
  6694. return {
  6695. value: formatArg(value, depth)
  6696. };
  6697. }
  6698. function formatMapEntry(value, depth) {
  6699. return {
  6700. key: formatArg(value[0], depth),
  6701. value: formatArg(value[1], depth)
  6702. };
  6703. }
  6704. let sendConsole = null;
  6705. const messageQueue = [];
  6706. const messageExtra = {};
  6707. const EXCEPTION_BEGIN_MARK = "---BEGIN:EXCEPTION---";
  6708. const EXCEPTION_END_MARK = "---END:EXCEPTION---";
  6709. function sendConsoleMessages(messages) {
  6710. if (sendConsole == null) {
  6711. messageQueue.push(...messages);
  6712. return;
  6713. }
  6714. sendConsole(JSON.stringify(Object.assign({
  6715. type: "console",
  6716. data: messages
  6717. }, messageExtra)));
  6718. }
  6719. function setSendConsole(value, extra = {}) {
  6720. sendConsole = value;
  6721. Object.assign(messageExtra, extra);
  6722. if (value != null && messageQueue.length > 0) {
  6723. const messages = messageQueue.slice();
  6724. messageQueue.length = 0;
  6725. sendConsoleMessages(messages);
  6726. }
  6727. }
  6728. const atFileRegex = /^\s*at\s+[\w/./-]+:\d+$/;
  6729. function rewriteConsole() {
  6730. function wrapConsole(type) {
  6731. return function(...args) {
  6732. const originalArgs = [...args];
  6733. if (originalArgs.length) {
  6734. const maybeAtFile = originalArgs[originalArgs.length - 1];
  6735. if (typeof maybeAtFile === "string" && atFileRegex.test(maybeAtFile)) {
  6736. originalArgs.pop();
  6737. }
  6738. }
  6739. {
  6740. originalConsole[type](...originalArgs);
  6741. }
  6742. if (type === "error" && args.length === 1) {
  6743. const arg = args[0];
  6744. if (typeof arg === "string" && arg.startsWith(EXCEPTION_BEGIN_MARK)) {
  6745. const startIndex = EXCEPTION_BEGIN_MARK.length;
  6746. const endIndex = arg.length - EXCEPTION_END_MARK.length;
  6747. sendErrorMessages([arg.slice(startIndex, endIndex)]);
  6748. return;
  6749. } else if (arg instanceof Error) {
  6750. sendErrorMessages([arg]);
  6751. return;
  6752. }
  6753. }
  6754. sendConsoleMessages([formatMessage(type, args)]);
  6755. };
  6756. }
  6757. if (isConsoleWritable()) {
  6758. CONSOLE_TYPES.forEach((type) => {
  6759. console[type] = wrapConsole(type);
  6760. });
  6761. return function restoreConsole() {
  6762. CONSOLE_TYPES.forEach((type) => {
  6763. console[type] = originalConsole[type];
  6764. });
  6765. };
  6766. } else {
  6767. {
  6768. if (typeof index !== "undefined" && index.__f__) {
  6769. const oldLog = index.__f__;
  6770. if (oldLog) {
  6771. index.__f__ = function(...args) {
  6772. const [type, filename, ...rest] = args;
  6773. oldLog(type, "", ...rest);
  6774. sendConsoleMessages([formatMessage(type, [...rest, filename])]);
  6775. };
  6776. return function restoreConsole() {
  6777. index.__f__ = oldLog;
  6778. };
  6779. }
  6780. }
  6781. }
  6782. }
  6783. return function restoreConsole() {
  6784. };
  6785. }
  6786. function isConsoleWritable() {
  6787. const value = console.log;
  6788. const sym = Symbol();
  6789. try {
  6790. console.log = sym;
  6791. } catch (ex) {
  6792. return false;
  6793. }
  6794. const isWritable = console.log === sym;
  6795. console.log = value;
  6796. return isWritable;
  6797. }
  6798. function initRuntimeSocketService() {
  6799. const hosts = "127.0.0.1,172.20.10.2";
  6800. const port = "8090";
  6801. const id = "mp-weixin_gClqBU";
  6802. const lazy = typeof swan !== "undefined";
  6803. let restoreError = lazy ? () => {
  6804. } : initOnError();
  6805. let restoreConsole = lazy ? () => {
  6806. } : rewriteConsole();
  6807. return Promise.resolve().then(() => {
  6808. if (lazy) {
  6809. restoreError = initOnError();
  6810. restoreConsole = rewriteConsole();
  6811. }
  6812. return initRuntimeSocket(hosts, port, id).then((socket) => {
  6813. if (!socket) {
  6814. restoreError();
  6815. restoreConsole();
  6816. originalConsole.error(wrapError("开发模式下日志通道建立 socket 连接失败。"));
  6817. {
  6818. originalConsole.error(wrapError("小程序平台,请勾选不校验合法域名配置。"));
  6819. }
  6820. originalConsole.error(wrapError("如果是运行到真机,请确认手机与电脑处于同一网络。"));
  6821. return false;
  6822. }
  6823. {
  6824. initMiniProgramGlobalFlag();
  6825. }
  6826. socket.onClose(() => {
  6827. {
  6828. originalConsole.error(wrapError("开发模式下日志通道 socket 连接关闭,请在 HBuilderX 中重新运行。"));
  6829. }
  6830. restoreError();
  6831. restoreConsole();
  6832. });
  6833. setSendConsole((data) => {
  6834. socket.send({
  6835. data
  6836. });
  6837. });
  6838. setSendError((data) => {
  6839. socket.send({
  6840. data
  6841. });
  6842. });
  6843. return true;
  6844. });
  6845. });
  6846. }
  6847. const ERROR_CHAR = "‌";
  6848. function wrapError(error) {
  6849. return `${ERROR_CHAR}${error}${ERROR_CHAR}`;
  6850. }
  6851. function initMiniProgramGlobalFlag() {
  6852. if (typeof wx$1 !== "undefined") {
  6853. wx$1.__uni_console__ = true;
  6854. } else if (typeof my !== "undefined") {
  6855. my.__uni_console__ = true;
  6856. } else if (typeof tt !== "undefined") {
  6857. tt.__uni_console__ = true;
  6858. } else if (typeof swan !== "undefined") {
  6859. swan.__uni_console__ = true;
  6860. } else if (typeof qq !== "undefined") {
  6861. qq.__uni_console__ = true;
  6862. } else if (typeof ks !== "undefined") {
  6863. ks.__uni_console__ = true;
  6864. } else if (typeof jd !== "undefined") {
  6865. jd.__uni_console__ = true;
  6866. } else if (typeof xhs !== "undefined") {
  6867. xhs.__uni_console__ = true;
  6868. } else if (typeof has !== "undefined") {
  6869. has.__uni_console__ = true;
  6870. } else if (typeof qa !== "undefined") {
  6871. qa.__uni_console__ = true;
  6872. }
  6873. }
  6874. initRuntimeSocketService();
  6875. const _export_sfc = (sfc, props) => {
  6876. const target = sfc.__vccOpts || sfc;
  6877. for (const [key, val] of props) {
  6878. target[key] = val;
  6879. }
  6880. return target;
  6881. };
  6882. function initVueIds(vueIds, mpInstance) {
  6883. if (!vueIds) {
  6884. return;
  6885. }
  6886. const ids = vueIds.split(",");
  6887. const len = ids.length;
  6888. if (len === 1) {
  6889. mpInstance._$vueId = ids[0];
  6890. } else if (len === 2) {
  6891. mpInstance._$vueId = ids[0];
  6892. mpInstance._$vuePid = ids[1];
  6893. }
  6894. }
  6895. const EXTRAS = ["externalClasses"];
  6896. function initExtraOptions(miniProgramComponentOptions, vueOptions) {
  6897. EXTRAS.forEach((name) => {
  6898. if (hasOwn(vueOptions, name)) {
  6899. miniProgramComponentOptions[name] = vueOptions[name];
  6900. }
  6901. });
  6902. }
  6903. const WORKLET_RE = /_(.*)_worklet_factory_/;
  6904. function initWorkletMethods(mpMethods, vueMethods) {
  6905. if (vueMethods) {
  6906. Object.keys(vueMethods).forEach((name) => {
  6907. const matches = name.match(WORKLET_RE);
  6908. if (matches) {
  6909. const workletName = matches[1];
  6910. mpMethods[name] = vueMethods[name];
  6911. mpMethods[workletName] = vueMethods[workletName];
  6912. }
  6913. });
  6914. }
  6915. }
  6916. function initWxsCallMethods(methods, wxsCallMethods) {
  6917. if (!isArray$2(wxsCallMethods)) {
  6918. return;
  6919. }
  6920. wxsCallMethods.forEach((callMethod) => {
  6921. methods[callMethod] = function(args) {
  6922. return this.$vm[callMethod](args);
  6923. };
  6924. });
  6925. }
  6926. function selectAllComponents(mpInstance, selector, $refs) {
  6927. const components = mpInstance.selectAllComponents(selector);
  6928. components.forEach((component) => {
  6929. const ref2 = component.properties.uR;
  6930. $refs[ref2] = component.$vm || component;
  6931. });
  6932. }
  6933. function initRefs(instance, mpInstance) {
  6934. Object.defineProperty(instance, "refs", {
  6935. get() {
  6936. const $refs = {};
  6937. selectAllComponents(mpInstance, ".r", $refs);
  6938. const forComponents = mpInstance.selectAllComponents(".r-i-f");
  6939. forComponents.forEach((component) => {
  6940. const ref2 = component.properties.uR;
  6941. if (!ref2) {
  6942. return;
  6943. }
  6944. if (!$refs[ref2]) {
  6945. $refs[ref2] = [];
  6946. }
  6947. $refs[ref2].push(component.$vm || component);
  6948. });
  6949. return $refs;
  6950. }
  6951. });
  6952. }
  6953. function findVmByVueId(instance, vuePid) {
  6954. const $children = instance.$children;
  6955. for (let i = $children.length - 1; i >= 0; i--) {
  6956. const childVm = $children[i];
  6957. if (childVm.$scope._$vueId === vuePid) {
  6958. return childVm;
  6959. }
  6960. }
  6961. let parentVm;
  6962. for (let i = $children.length - 1; i >= 0; i--) {
  6963. parentVm = findVmByVueId($children[i], vuePid);
  6964. if (parentVm) {
  6965. return parentVm;
  6966. }
  6967. }
  6968. }
  6969. function getLocaleLanguage() {
  6970. var _a;
  6971. let localeLanguage = "";
  6972. {
  6973. const appBaseInfo = ((_a = wx.getAppBaseInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
  6974. const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  6975. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  6976. }
  6977. return localeLanguage;
  6978. }
  6979. const MP_METHODS = [
  6980. "createSelectorQuery",
  6981. "createIntersectionObserver",
  6982. "selectAllComponents",
  6983. "selectComponent"
  6984. ];
  6985. function createEmitFn(oldEmit, ctx) {
  6986. return function emit2(event, ...args) {
  6987. const scope = ctx.$scope;
  6988. if (scope && event) {
  6989. const detail = { __args__: args };
  6990. {
  6991. scope.triggerEvent(event, detail);
  6992. }
  6993. }
  6994. return oldEmit.apply(this, [event, ...args]);
  6995. };
  6996. }
  6997. function initBaseInstance(instance, options) {
  6998. const ctx = instance.ctx;
  6999. ctx.mpType = options.mpType;
  7000. ctx.$mpType = options.mpType;
  7001. ctx.$mpPlatform = "mp-weixin";
  7002. ctx.$scope = options.mpInstance;
  7003. {
  7004. Object.defineProperties(ctx, {
  7005. // only id
  7006. [VIRTUAL_HOST_ID]: {
  7007. get() {
  7008. const id = this.$scope.data[VIRTUAL_HOST_ID];
  7009. return id === void 0 ? "" : id;
  7010. }
  7011. }
  7012. });
  7013. }
  7014. ctx.$mp = {};
  7015. {
  7016. ctx._self = {};
  7017. }
  7018. instance.slots = {};
  7019. if (isArray$2(options.slots) && options.slots.length) {
  7020. options.slots.forEach((name) => {
  7021. instance.slots[name] = true;
  7022. });
  7023. if (instance.slots[SLOT_DEFAULT_NAME]) {
  7024. instance.slots.default = true;
  7025. }
  7026. }
  7027. ctx.getOpenerEventChannel = function() {
  7028. {
  7029. return options.mpInstance.getOpenerEventChannel();
  7030. }
  7031. };
  7032. ctx.$hasHook = hasHook;
  7033. ctx.$callHook = callHook;
  7034. instance.emit = createEmitFn(instance.emit, ctx);
  7035. }
  7036. function initComponentInstance(instance, options) {
  7037. initBaseInstance(instance, options);
  7038. const ctx = instance.ctx;
  7039. MP_METHODS.forEach((method) => {
  7040. ctx[method] = function(...args) {
  7041. const mpInstance = ctx.$scope;
  7042. if (mpInstance && mpInstance[method]) {
  7043. return mpInstance[method].apply(mpInstance, args);
  7044. }
  7045. };
  7046. });
  7047. }
  7048. function initMocks(instance, mpInstance, mocks2) {
  7049. const ctx = instance.ctx;
  7050. mocks2.forEach((mock) => {
  7051. if (hasOwn(mpInstance, mock)) {
  7052. instance[mock] = ctx[mock] = mpInstance[mock];
  7053. }
  7054. });
  7055. }
  7056. function hasHook(name) {
  7057. const hooks = this.$[name];
  7058. if (hooks && hooks.length) {
  7059. return true;
  7060. }
  7061. return false;
  7062. }
  7063. function callHook(name, args) {
  7064. if (name === "mounted") {
  7065. callHook.call(this, "bm");
  7066. this.$.isMounted = true;
  7067. name = "m";
  7068. }
  7069. const hooks = this.$[name];
  7070. return hooks && invokeArrayFns(hooks, args);
  7071. }
  7072. const PAGE_INIT_HOOKS = [
  7073. ON_LOAD,
  7074. ON_SHOW,
  7075. ON_HIDE,
  7076. ON_UNLOAD,
  7077. ON_RESIZE,
  7078. ON_TAB_ITEM_TAP,
  7079. ON_REACH_BOTTOM,
  7080. ON_PULL_DOWN_REFRESH,
  7081. ON_ADD_TO_FAVORITES
  7082. // 'onReady', // lifetimes.ready
  7083. // 'onPageScroll', // 影响性能,开发者手动注册
  7084. // 'onShareTimeline', // 右上角菜单,开发者手动注册
  7085. // 'onShareAppMessage' // 右上角菜单,开发者手动注册
  7086. ];
  7087. function findHooks(vueOptions, hooks = /* @__PURE__ */ new Set()) {
  7088. if (vueOptions) {
  7089. Object.keys(vueOptions).forEach((name) => {
  7090. if (isUniLifecycleHook(name, vueOptions[name])) {
  7091. hooks.add(name);
  7092. }
  7093. });
  7094. {
  7095. const { extends: extendsOptions, mixins } = vueOptions;
  7096. if (mixins) {
  7097. mixins.forEach((mixin) => findHooks(mixin, hooks));
  7098. }
  7099. if (extendsOptions) {
  7100. findHooks(extendsOptions, hooks);
  7101. }
  7102. }
  7103. }
  7104. return hooks;
  7105. }
  7106. function initHook(mpOptions, hook, excludes) {
  7107. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  7108. mpOptions[hook] = function(args) {
  7109. return this.$vm && this.$vm.$callHook(hook, args);
  7110. };
  7111. }
  7112. }
  7113. const EXCLUDE_HOOKS = [ON_READY];
  7114. function initHooks(mpOptions, hooks, excludes = EXCLUDE_HOOKS) {
  7115. hooks.forEach((hook) => initHook(mpOptions, hook, excludes));
  7116. }
  7117. function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
  7118. findHooks(vueOptions).forEach((hook) => initHook(mpOptions, hook, excludes));
  7119. }
  7120. function initRuntimeHooks(mpOptions, runtimeHooks) {
  7121. if (!runtimeHooks) {
  7122. return;
  7123. }
  7124. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7125. hooks.forEach((hook) => {
  7126. if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
  7127. initHook(mpOptions, hook, []);
  7128. }
  7129. });
  7130. }
  7131. const findMixinRuntimeHooks = /* @__PURE__ */ once(() => {
  7132. const runtimeHooks = [];
  7133. const app = isFunction$2(getApp) && getApp({ allowDefault: true });
  7134. if (app && app.$vm && app.$vm.$) {
  7135. const mixins = app.$vm.$.appContext.mixins;
  7136. if (isArray$2(mixins)) {
  7137. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7138. mixins.forEach((mixin) => {
  7139. hooks.forEach((hook) => {
  7140. if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
  7141. runtimeHooks.push(hook);
  7142. }
  7143. });
  7144. });
  7145. }
  7146. }
  7147. return runtimeHooks;
  7148. });
  7149. function initMixinRuntimeHooks(mpOptions) {
  7150. initHooks(mpOptions, findMixinRuntimeHooks());
  7151. }
  7152. const HOOKS = [
  7153. ON_SHOW,
  7154. ON_HIDE,
  7155. ON_ERROR,
  7156. ON_THEME_CHANGE,
  7157. ON_PAGE_NOT_FOUND,
  7158. ON_UNHANDLE_REJECTION
  7159. ];
  7160. function parseApp(instance, parseAppOptions) {
  7161. const internalInstance = instance.$;
  7162. const appOptions = {
  7163. globalData: instance.$options && instance.$options.globalData || {},
  7164. $vm: instance,
  7165. // mp-alipay 组件 data 初始化比 onLaunch 早,提前挂载
  7166. onLaunch(options) {
  7167. this.$vm = instance;
  7168. const ctx = internalInstance.ctx;
  7169. if (this.$vm && ctx.$scope && ctx.$callHook) {
  7170. return;
  7171. }
  7172. initBaseInstance(internalInstance, {
  7173. mpType: "app",
  7174. mpInstance: this,
  7175. slots: []
  7176. });
  7177. ctx.globalData = this.globalData;
  7178. instance.$callHook(ON_LAUNCH, options);
  7179. }
  7180. };
  7181. const onErrorHandlers = wx.$onErrorHandlers;
  7182. if (onErrorHandlers) {
  7183. onErrorHandlers.forEach((fn) => {
  7184. injectHook(ON_ERROR, fn, internalInstance);
  7185. });
  7186. onErrorHandlers.length = 0;
  7187. }
  7188. initLocale(instance);
  7189. const vueOptions = instance.$.type;
  7190. initHooks(appOptions, HOOKS);
  7191. initUnknownHooks(appOptions, vueOptions);
  7192. {
  7193. const methods = vueOptions.methods;
  7194. methods && extend$2(appOptions, methods);
  7195. }
  7196. return appOptions;
  7197. }
  7198. function initCreateApp(parseAppOptions) {
  7199. return function createApp2(vm) {
  7200. return App(parseApp(vm));
  7201. };
  7202. }
  7203. function initCreateSubpackageApp(parseAppOptions) {
  7204. return function createApp2(vm) {
  7205. const appOptions = parseApp(vm);
  7206. const app = isFunction$2(getApp) && getApp({
  7207. allowDefault: true
  7208. });
  7209. if (!app)
  7210. return;
  7211. vm.$.ctx.$scope = app;
  7212. const globalData = app.globalData;
  7213. if (globalData) {
  7214. Object.keys(appOptions.globalData).forEach((name) => {
  7215. if (!hasOwn(globalData, name)) {
  7216. globalData[name] = appOptions.globalData[name];
  7217. }
  7218. });
  7219. }
  7220. Object.keys(appOptions).forEach((name) => {
  7221. if (!hasOwn(app, name)) {
  7222. app[name] = appOptions[name];
  7223. }
  7224. });
  7225. initAppLifecycle(appOptions, vm);
  7226. };
  7227. }
  7228. function initAppLifecycle(appOptions, vm) {
  7229. if (isFunction$2(appOptions.onLaunch)) {
  7230. const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  7231. appOptions.onLaunch(args);
  7232. }
  7233. if (isFunction$2(appOptions.onShow) && wx.onAppShow) {
  7234. wx.onAppShow((args) => {
  7235. vm.$callHook("onShow", args);
  7236. });
  7237. }
  7238. if (isFunction$2(appOptions.onHide) && wx.onAppHide) {
  7239. wx.onAppHide((args) => {
  7240. vm.$callHook("onHide", args);
  7241. });
  7242. }
  7243. }
  7244. function initLocale(appVm) {
  7245. const locale = ref(getLocaleLanguage());
  7246. Object.defineProperty(appVm, "$locale", {
  7247. get() {
  7248. return locale.value;
  7249. },
  7250. set(v) {
  7251. locale.value = v;
  7252. }
  7253. });
  7254. }
  7255. const builtInProps = [
  7256. // 百度小程序,快手小程序自定义组件不支持绑定动态事件,动态dataset,故通过props传递事件信息
  7257. // event-opts
  7258. "eO",
  7259. // 组件 ref
  7260. "uR",
  7261. // 组件 ref-in-for
  7262. "uRIF",
  7263. // 组件 id
  7264. "uI",
  7265. // 组件类型 m: 小程序组件
  7266. "uT",
  7267. // 组件 props
  7268. "uP",
  7269. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  7270. "uS"
  7271. ];
  7272. function initDefaultProps(options, isBehavior = false) {
  7273. const properties = {};
  7274. if (!isBehavior) {
  7275. let observerSlots = function(newVal) {
  7276. const $slots = /* @__PURE__ */ Object.create(null);
  7277. newVal && newVal.forEach((slotName) => {
  7278. $slots[slotName] = true;
  7279. });
  7280. this.setData({
  7281. $slots
  7282. });
  7283. };
  7284. builtInProps.forEach((name) => {
  7285. properties[name] = {
  7286. type: null,
  7287. value: ""
  7288. };
  7289. });
  7290. properties.uS = {
  7291. type: null,
  7292. value: []
  7293. };
  7294. {
  7295. properties.uS.observer = observerSlots;
  7296. }
  7297. }
  7298. if (options.behaviors) {
  7299. if (options.behaviors.includes("wx://form-field")) {
  7300. if (!options.properties || !options.properties.name) {
  7301. properties.name = {
  7302. type: null,
  7303. value: ""
  7304. };
  7305. }
  7306. if (!options.properties || !options.properties.value) {
  7307. properties.value = {
  7308. type: null,
  7309. value: ""
  7310. };
  7311. }
  7312. }
  7313. }
  7314. return properties;
  7315. }
  7316. function initVirtualHostProps(options) {
  7317. const properties = {};
  7318. {
  7319. if (options && options.virtualHost) {
  7320. properties[VIRTUAL_HOST_STYLE] = {
  7321. type: null,
  7322. value: ""
  7323. };
  7324. properties[VIRTUAL_HOST_CLASS] = {
  7325. type: null,
  7326. value: ""
  7327. };
  7328. properties[VIRTUAL_HOST_HIDDEN] = {
  7329. type: null,
  7330. value: ""
  7331. };
  7332. properties[VIRTUAL_HOST_ID] = {
  7333. type: null,
  7334. value: ""
  7335. };
  7336. }
  7337. }
  7338. return properties;
  7339. }
  7340. function initProps(mpComponentOptions) {
  7341. if (!mpComponentOptions.properties) {
  7342. mpComponentOptions.properties = {};
  7343. }
  7344. extend$2(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
  7345. }
  7346. const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  7347. function parsePropType(type, defaultValue) {
  7348. if (isArray$2(type) && type.length === 1) {
  7349. return type[0];
  7350. }
  7351. return type;
  7352. }
  7353. function normalizePropType(type, defaultValue) {
  7354. const res = parsePropType(type);
  7355. return PROP_TYPES.indexOf(res) !== -1 ? res : null;
  7356. }
  7357. function initPageProps({ properties }, rawProps) {
  7358. if (isArray$2(rawProps)) {
  7359. rawProps.forEach((key) => {
  7360. properties[key] = {
  7361. type: String,
  7362. value: ""
  7363. };
  7364. });
  7365. } else if (isPlainObject$1(rawProps)) {
  7366. Object.keys(rawProps).forEach((key) => {
  7367. const opts = rawProps[key];
  7368. if (isPlainObject$1(opts)) {
  7369. let value = opts.default;
  7370. if (isFunction$2(value)) {
  7371. value = value();
  7372. }
  7373. const type = opts.type;
  7374. opts.type = normalizePropType(type);
  7375. properties[key] = {
  7376. type: opts.type,
  7377. value
  7378. };
  7379. } else {
  7380. properties[key] = {
  7381. type: normalizePropType(opts)
  7382. };
  7383. }
  7384. });
  7385. }
  7386. }
  7387. function findPropsData(properties, isPage2) {
  7388. return (isPage2 ? findPagePropsData(properties) : findComponentPropsData(resolvePropValue(properties.uP))) || {};
  7389. }
  7390. function findPagePropsData(properties) {
  7391. const propsData = {};
  7392. if (isPlainObject$1(properties)) {
  7393. Object.keys(properties).forEach((name) => {
  7394. if (builtInProps.indexOf(name) === -1) {
  7395. propsData[name] = resolvePropValue(properties[name]);
  7396. }
  7397. });
  7398. }
  7399. return propsData;
  7400. }
  7401. function initFormField(vm) {
  7402. const vueOptions = vm.$options;
  7403. if (isArray$2(vueOptions.behaviors) && vueOptions.behaviors.includes("uni://form-field")) {
  7404. vm.$watch("modelValue", () => {
  7405. vm.$scope && vm.$scope.setData({
  7406. name: vm.name,
  7407. value: vm.modelValue
  7408. });
  7409. }, {
  7410. immediate: true
  7411. });
  7412. }
  7413. }
  7414. function resolvePropValue(prop) {
  7415. return prop;
  7416. }
  7417. function initData(_) {
  7418. return {};
  7419. }
  7420. function initPropsObserver(componentOptions) {
  7421. const observe = function observe2() {
  7422. const up = this.properties.uP;
  7423. if (!up) {
  7424. return;
  7425. }
  7426. if (this.$vm) {
  7427. updateComponentProps(resolvePropValue(up), this.$vm.$);
  7428. } else if (resolvePropValue(this.properties.uT) === "m") {
  7429. updateMiniProgramComponentProperties(resolvePropValue(up), this);
  7430. }
  7431. };
  7432. {
  7433. if (!componentOptions.observers) {
  7434. componentOptions.observers = {};
  7435. }
  7436. componentOptions.observers.uP = observe;
  7437. }
  7438. }
  7439. function updateMiniProgramComponentProperties(up, mpInstance) {
  7440. const prevProps = mpInstance.properties;
  7441. const nextProps = findComponentPropsData(up) || {};
  7442. if (hasPropsChanged(prevProps, nextProps, false)) {
  7443. mpInstance.setData(nextProps);
  7444. }
  7445. }
  7446. function updateComponentProps(up, instance) {
  7447. const prevProps = toRaw(instance.props);
  7448. const nextProps = findComponentPropsData(up) || {};
  7449. if (hasPropsChanged(prevProps, nextProps)) {
  7450. updateProps(instance, nextProps, prevProps, false);
  7451. if (hasQueueJob(instance.update)) {
  7452. invalidateJob(instance.update);
  7453. }
  7454. {
  7455. instance.update();
  7456. }
  7457. }
  7458. }
  7459. function hasPropsChanged(prevProps, nextProps, checkLen = true) {
  7460. const nextKeys = Object.keys(nextProps);
  7461. if (checkLen && nextKeys.length !== Object.keys(prevProps).length) {
  7462. return true;
  7463. }
  7464. for (let i = 0; i < nextKeys.length; i++) {
  7465. const key = nextKeys[i];
  7466. if (nextProps[key] !== prevProps[key]) {
  7467. return true;
  7468. }
  7469. }
  7470. return false;
  7471. }
  7472. function initBehaviors(vueOptions) {
  7473. const vueBehaviors = vueOptions.behaviors;
  7474. let vueProps = vueOptions.props;
  7475. if (!vueProps) {
  7476. vueOptions.props = vueProps = [];
  7477. }
  7478. const behaviors = [];
  7479. if (isArray$2(vueBehaviors)) {
  7480. vueBehaviors.forEach((behavior) => {
  7481. behaviors.push(behavior.replace("uni://", "wx://"));
  7482. if (behavior === "uni://form-field") {
  7483. if (isArray$2(vueProps)) {
  7484. vueProps.push("name");
  7485. vueProps.push("modelValue");
  7486. } else {
  7487. vueProps.name = {
  7488. type: String,
  7489. default: ""
  7490. };
  7491. vueProps.modelValue = {
  7492. type: [String, Number, Boolean, Array, Object, Date],
  7493. default: ""
  7494. };
  7495. }
  7496. }
  7497. });
  7498. }
  7499. return behaviors;
  7500. }
  7501. function applyOptions(componentOptions, vueOptions) {
  7502. componentOptions.data = initData();
  7503. componentOptions.behaviors = initBehaviors(vueOptions);
  7504. }
  7505. function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, isPageInProject, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
  7506. vueOptions = vueOptions.default || vueOptions;
  7507. const options = {
  7508. multipleSlots: true,
  7509. // styleIsolation: 'apply-shared',
  7510. addGlobalClass: true,
  7511. pureDataPattern: /^uP$/
  7512. };
  7513. if (isArray$2(vueOptions.mixins)) {
  7514. vueOptions.mixins.forEach((item) => {
  7515. if (isObject$2(item.options)) {
  7516. extend$2(options, item.options);
  7517. }
  7518. });
  7519. }
  7520. if (vueOptions.options) {
  7521. extend$2(options, vueOptions.options);
  7522. }
  7523. const mpComponentOptions = {
  7524. options,
  7525. lifetimes: initLifetimes2({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }),
  7526. pageLifetimes: {
  7527. show() {
  7528. this.$vm && this.$vm.$callHook("onPageShow");
  7529. },
  7530. hide() {
  7531. this.$vm && this.$vm.$callHook("onPageHide");
  7532. },
  7533. resize(size2) {
  7534. this.$vm && this.$vm.$callHook("onPageResize", size2);
  7535. }
  7536. },
  7537. methods: {
  7538. __l: handleLink2
  7539. }
  7540. };
  7541. {
  7542. applyOptions(mpComponentOptions, vueOptions);
  7543. }
  7544. initProps(mpComponentOptions);
  7545. initPropsObserver(mpComponentOptions);
  7546. initExtraOptions(mpComponentOptions, vueOptions);
  7547. initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
  7548. {
  7549. initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
  7550. }
  7551. if (parse) {
  7552. parse(mpComponentOptions, { handleLink: handleLink2 });
  7553. }
  7554. return mpComponentOptions;
  7555. }
  7556. function initCreateComponent(parseOptions2) {
  7557. return function createComponent2(vueComponentOptions) {
  7558. return Component(parseComponent(vueComponentOptions, parseOptions2));
  7559. };
  7560. }
  7561. let $createComponentFn;
  7562. let $destroyComponentFn;
  7563. function getAppVm() {
  7564. return getApp().$vm;
  7565. }
  7566. function $createComponent(initialVNode, options) {
  7567. if (!$createComponentFn) {
  7568. $createComponentFn = getAppVm().$createComponent;
  7569. }
  7570. const proxy = $createComponentFn(initialVNode, options);
  7571. return getExposeProxy(proxy.$) || proxy;
  7572. }
  7573. function $destroyComponent(instance) {
  7574. if (!$destroyComponentFn) {
  7575. $destroyComponentFn = getAppVm().$destroyComponent;
  7576. }
  7577. return $destroyComponentFn(instance);
  7578. }
  7579. function parsePage(vueOptions, parseOptions2) {
  7580. const { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
  7581. const miniProgramPageOptions = parseComponent(vueOptions, {
  7582. mocks: mocks2,
  7583. isPage: isPage2,
  7584. isPageInProject: true,
  7585. initRelation: initRelation2,
  7586. handleLink: handleLink2,
  7587. initLifetimes: initLifetimes2
  7588. });
  7589. initPageProps(miniProgramPageOptions, (vueOptions.default || vueOptions).props);
  7590. const methods = miniProgramPageOptions.methods;
  7591. methods.onLoad = function(query) {
  7592. {
  7593. this.options = query;
  7594. }
  7595. this.$page = {
  7596. fullPath: addLeadingSlash(this.route + stringifyQuery(query))
  7597. };
  7598. return this.$vm && this.$vm.$callHook(ON_LOAD, query);
  7599. };
  7600. initHooks(methods, PAGE_INIT_HOOKS);
  7601. {
  7602. initUnknownHooks(methods, vueOptions);
  7603. }
  7604. initRuntimeHooks(methods, vueOptions.__runtimeHooks);
  7605. initMixinRuntimeHooks(methods);
  7606. parse && parse(miniProgramPageOptions, { handleLink: handleLink2 });
  7607. return miniProgramPageOptions;
  7608. }
  7609. function initCreatePage(parseOptions2) {
  7610. return function createPage2(vuePageOptions) {
  7611. return Component(parsePage(vuePageOptions, parseOptions2));
  7612. };
  7613. }
  7614. function initCreatePluginApp(parseAppOptions) {
  7615. return function createApp2(vm) {
  7616. initAppLifecycle(parseApp(vm), vm);
  7617. };
  7618. }
  7619. const MPPage = Page;
  7620. const MPComponent = Component;
  7621. function initTriggerEvent(mpInstance) {
  7622. const oldTriggerEvent = mpInstance.triggerEvent;
  7623. const newTriggerEvent = function(event, ...args) {
  7624. return oldTriggerEvent.apply(mpInstance, [
  7625. customizeEvent(event),
  7626. ...args
  7627. ]);
  7628. };
  7629. try {
  7630. mpInstance.triggerEvent = newTriggerEvent;
  7631. } catch (error) {
  7632. mpInstance._triggerEvent = newTriggerEvent;
  7633. }
  7634. }
  7635. function initMiniProgramHook(name, options, isComponent) {
  7636. const oldHook = options[name];
  7637. if (!oldHook) {
  7638. options[name] = function() {
  7639. initTriggerEvent(this);
  7640. };
  7641. } else {
  7642. options[name] = function(...args) {
  7643. initTriggerEvent(this);
  7644. return oldHook.apply(this, args);
  7645. };
  7646. }
  7647. }
  7648. Page = function(options) {
  7649. initMiniProgramHook(ON_LOAD, options);
  7650. return MPPage(options);
  7651. };
  7652. Component = function(options) {
  7653. initMiniProgramHook("created", options);
  7654. const isVueComponent = options.properties && options.properties.uP;
  7655. if (!isVueComponent) {
  7656. initProps(options);
  7657. initPropsObserver(options);
  7658. }
  7659. return MPComponent(options);
  7660. };
  7661. function initLifetimes({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }) {
  7662. return {
  7663. attached() {
  7664. let properties = this.properties;
  7665. initVueIds(properties.uI, this);
  7666. const relationOptions = {
  7667. vuePid: this._$vuePid
  7668. };
  7669. initRelation2(this, relationOptions);
  7670. const mpInstance = this;
  7671. const isMiniProgramPage = isPage2(mpInstance);
  7672. let propsData = properties;
  7673. this.$vm = $createComponent({
  7674. type: vueOptions,
  7675. props: findPropsData(propsData, isMiniProgramPage)
  7676. }, {
  7677. mpType: isMiniProgramPage ? "page" : "component",
  7678. mpInstance,
  7679. slots: properties.uS || {},
  7680. // vueSlots
  7681. parentComponent: relationOptions.parent && relationOptions.parent.$,
  7682. onBeforeSetup(instance, options) {
  7683. initRefs(instance, mpInstance);
  7684. initMocks(instance, mpInstance, mocks2);
  7685. initComponentInstance(instance, options);
  7686. }
  7687. });
  7688. if (!isMiniProgramPage) {
  7689. initFormField(this.$vm);
  7690. }
  7691. },
  7692. ready() {
  7693. if (this.$vm) {
  7694. {
  7695. this.$vm.$callHook("mounted");
  7696. this.$vm.$callHook(ON_READY);
  7697. }
  7698. }
  7699. },
  7700. detached() {
  7701. if (this.$vm) {
  7702. pruneComponentPropsCache(this.$vm.$.uid);
  7703. $destroyComponent(this.$vm);
  7704. }
  7705. }
  7706. };
  7707. }
  7708. const mocks = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  7709. function isPage(mpInstance) {
  7710. return !!mpInstance.route;
  7711. }
  7712. function initRelation(mpInstance, detail) {
  7713. mpInstance.triggerEvent("__l", detail);
  7714. }
  7715. function handleLink(event) {
  7716. const detail = event.detail || event.value;
  7717. const vuePid = detail.vuePid;
  7718. let parentVm;
  7719. if (vuePid) {
  7720. parentVm = findVmByVueId(this.$vm, vuePid);
  7721. }
  7722. if (!parentVm) {
  7723. parentVm = this.$vm;
  7724. }
  7725. detail.parent = parentVm;
  7726. }
  7727. var parseOptions = /* @__PURE__ */ Object.freeze({
  7728. __proto__: null,
  7729. handleLink,
  7730. initLifetimes,
  7731. initRelation,
  7732. isPage,
  7733. mocks
  7734. });
  7735. const createApp = initCreateApp();
  7736. const createPage = initCreatePage(parseOptions);
  7737. const createComponent = initCreateComponent(parseOptions);
  7738. const createPluginApp = initCreatePluginApp();
  7739. const createSubpackageApp = initCreateSubpackageApp();
  7740. {
  7741. wx.createApp = global.createApp = createApp;
  7742. wx.createPage = createPage;
  7743. wx.createComponent = createComponent;
  7744. wx.createPluginApp = global.createPluginApp = createPluginApp;
  7745. wx.createSubpackageApp = global.createSubpackageApp = createSubpackageApp;
  7746. }
  7747. function bind$2(fn, thisArg) {
  7748. return function wrap() {
  7749. return fn.apply(thisArg, arguments);
  7750. };
  7751. }
  7752. const { toString: toString$1 } = Object.prototype;
  7753. const { getPrototypeOf } = Object;
  7754. const { iterator, toStringTag } = Symbol;
  7755. const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
  7756. const str = toString$1.call(thing);
  7757. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  7758. })(/* @__PURE__ */ Object.create(null));
  7759. const kindOfTest = (type) => {
  7760. type = type.toLowerCase();
  7761. return (thing) => kindOf(thing) === type;
  7762. };
  7763. const typeOfTest = (type) => (thing) => typeof thing === type;
  7764. const { isArray: isArray$1 } = Array;
  7765. const isUndefined$1 = typeOfTest("undefined");
  7766. function isBuffer$1(val) {
  7767. return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  7768. }
  7769. const isArrayBuffer$1 = kindOfTest("ArrayBuffer");
  7770. function isArrayBufferView$1(val) {
  7771. let result;
  7772. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  7773. result = ArrayBuffer.isView(val);
  7774. } else {
  7775. result = val && val.buffer && isArrayBuffer$1(val.buffer);
  7776. }
  7777. return result;
  7778. }
  7779. const isString$1 = typeOfTest("string");
  7780. const isFunction$1 = typeOfTest("function");
  7781. const isNumber$1 = typeOfTest("number");
  7782. const isObject$1 = (thing) => thing !== null && typeof thing === "object";
  7783. const isBoolean = (thing) => thing === true || thing === false;
  7784. const isPlainObject = (val) => {
  7785. if (kindOf(val) !== "object") {
  7786. return false;
  7787. }
  7788. const prototype2 = getPrototypeOf(val);
  7789. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
  7790. };
  7791. const isDate$1 = kindOfTest("Date");
  7792. const isFile$1 = kindOfTest("File");
  7793. const isBlob$1 = kindOfTest("Blob");
  7794. const isFileList = kindOfTest("FileList");
  7795. const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
  7796. const isFormData$1 = (thing) => {
  7797. let kind;
  7798. return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  7799. kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
  7800. };
  7801. const isURLSearchParams$1 = kindOfTest("URLSearchParams");
  7802. const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
  7803. const trim$1 = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  7804. function forEach$1(obj, fn, { allOwnKeys = false } = {}) {
  7805. if (obj === null || typeof obj === "undefined") {
  7806. return;
  7807. }
  7808. let i;
  7809. let l;
  7810. if (typeof obj !== "object") {
  7811. obj = [obj];
  7812. }
  7813. if (isArray$1(obj)) {
  7814. for (i = 0, l = obj.length; i < l; i++) {
  7815. fn.call(null, obj[i], i, obj);
  7816. }
  7817. } else {
  7818. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  7819. const len = keys.length;
  7820. let key;
  7821. for (i = 0; i < len; i++) {
  7822. key = keys[i];
  7823. fn.call(null, obj[key], key, obj);
  7824. }
  7825. }
  7826. }
  7827. function findKey(obj, key) {
  7828. key = key.toLowerCase();
  7829. const keys = Object.keys(obj);
  7830. let i = keys.length;
  7831. let _key;
  7832. while (i-- > 0) {
  7833. _key = keys[i];
  7834. if (key === _key.toLowerCase()) {
  7835. return _key;
  7836. }
  7837. }
  7838. return null;
  7839. }
  7840. const _global = (() => {
  7841. if (typeof globalThis !== "undefined")
  7842. return globalThis;
  7843. return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
  7844. })();
  7845. const isContextDefined = (context) => !isUndefined$1(context) && context !== _global;
  7846. function merge$1() {
  7847. const { caseless } = isContextDefined(this) && this || {};
  7848. const result = {};
  7849. const assignValue = (val, key) => {
  7850. const targetKey = caseless && findKey(result, key) || key;
  7851. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  7852. result[targetKey] = merge$1(result[targetKey], val);
  7853. } else if (isPlainObject(val)) {
  7854. result[targetKey] = merge$1({}, val);
  7855. } else if (isArray$1(val)) {
  7856. result[targetKey] = val.slice();
  7857. } else {
  7858. result[targetKey] = val;
  7859. }
  7860. };
  7861. for (let i = 0, l = arguments.length; i < l; i++) {
  7862. arguments[i] && forEach$1(arguments[i], assignValue);
  7863. }
  7864. return result;
  7865. }
  7866. const extend$1 = (a, b, thisArg, { allOwnKeys } = {}) => {
  7867. forEach$1(b, (val, key) => {
  7868. if (thisArg && isFunction$1(val)) {
  7869. a[key] = bind$2(val, thisArg);
  7870. } else {
  7871. a[key] = val;
  7872. }
  7873. }, { allOwnKeys });
  7874. return a;
  7875. };
  7876. const stripBOM = (content) => {
  7877. if (content.charCodeAt(0) === 65279) {
  7878. content = content.slice(1);
  7879. }
  7880. return content;
  7881. };
  7882. const inherits = (constructor, superConstructor, props, descriptors2) => {
  7883. constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  7884. constructor.prototype.constructor = constructor;
  7885. Object.defineProperty(constructor, "super", {
  7886. value: superConstructor.prototype
  7887. });
  7888. props && Object.assign(constructor.prototype, props);
  7889. };
  7890. const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
  7891. let props;
  7892. let i;
  7893. let prop;
  7894. const merged = {};
  7895. destObj = destObj || {};
  7896. if (sourceObj == null)
  7897. return destObj;
  7898. do {
  7899. props = Object.getOwnPropertyNames(sourceObj);
  7900. i = props.length;
  7901. while (i-- > 0) {
  7902. prop = props[i];
  7903. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  7904. destObj[prop] = sourceObj[prop];
  7905. merged[prop] = true;
  7906. }
  7907. }
  7908. sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
  7909. } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
  7910. return destObj;
  7911. };
  7912. const endsWith = (str, searchString, position) => {
  7913. str = String(str);
  7914. if (position === void 0 || position > str.length) {
  7915. position = str.length;
  7916. }
  7917. position -= searchString.length;
  7918. const lastIndex = str.indexOf(searchString, position);
  7919. return lastIndex !== -1 && lastIndex === position;
  7920. };
  7921. const toArray = (thing) => {
  7922. if (!thing)
  7923. return null;
  7924. if (isArray$1(thing))
  7925. return thing;
  7926. let i = thing.length;
  7927. if (!isNumber$1(i))
  7928. return null;
  7929. const arr = new Array(i);
  7930. while (i-- > 0) {
  7931. arr[i] = thing[i];
  7932. }
  7933. return arr;
  7934. };
  7935. const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
  7936. return (thing) => {
  7937. return TypedArray && thing instanceof TypedArray;
  7938. };
  7939. })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
  7940. const forEachEntry = (obj, fn) => {
  7941. const generator = obj && obj[iterator];
  7942. const _iterator = generator.call(obj);
  7943. let result;
  7944. while ((result = _iterator.next()) && !result.done) {
  7945. const pair = result.value;
  7946. fn.call(obj, pair[0], pair[1]);
  7947. }
  7948. };
  7949. const matchAll = (regExp, str) => {
  7950. let matches;
  7951. const arr = [];
  7952. while ((matches = regExp.exec(str)) !== null) {
  7953. arr.push(matches);
  7954. }
  7955. return arr;
  7956. };
  7957. const isHTMLForm = kindOfTest("HTMLFormElement");
  7958. const toCamelCase = (str) => {
  7959. return str.toLowerCase().replace(
  7960. /[-_\s]([a-z\d])(\w*)/g,
  7961. function replacer2(m, p1, p2) {
  7962. return p1.toUpperCase() + p2;
  7963. }
  7964. );
  7965. };
  7966. const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
  7967. const isRegExp = kindOfTest("RegExp");
  7968. const reduceDescriptors = (obj, reducer) => {
  7969. const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  7970. const reducedDescriptors = {};
  7971. forEach$1(descriptors2, (descriptor, name) => {
  7972. let ret;
  7973. if ((ret = reducer(descriptor, name, obj)) !== false) {
  7974. reducedDescriptors[name] = ret || descriptor;
  7975. }
  7976. });
  7977. Object.defineProperties(obj, reducedDescriptors);
  7978. };
  7979. const freezeMethods = (obj) => {
  7980. reduceDescriptors(obj, (descriptor, name) => {
  7981. if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
  7982. return false;
  7983. }
  7984. const value = obj[name];
  7985. if (!isFunction$1(value))
  7986. return;
  7987. descriptor.enumerable = false;
  7988. if ("writable" in descriptor) {
  7989. descriptor.writable = false;
  7990. return;
  7991. }
  7992. if (!descriptor.set) {
  7993. descriptor.set = () => {
  7994. throw Error("Can not rewrite read-only method '" + name + "'");
  7995. };
  7996. }
  7997. });
  7998. };
  7999. const toObjectSet = (arrayOrString, delimiter) => {
  8000. const obj = {};
  8001. const define = (arr) => {
  8002. arr.forEach((value) => {
  8003. obj[value] = true;
  8004. });
  8005. };
  8006. isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  8007. return obj;
  8008. };
  8009. const noop = () => {
  8010. };
  8011. const toFiniteNumber = (value, defaultValue) => {
  8012. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  8013. };
  8014. function isSpecCompliantForm(thing) {
  8015. return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
  8016. }
  8017. const toJSONObject = (obj) => {
  8018. const stack2 = new Array(10);
  8019. const visit = (source, i) => {
  8020. if (isObject$1(source)) {
  8021. if (stack2.indexOf(source) >= 0) {
  8022. return;
  8023. }
  8024. if (!("toJSON" in source)) {
  8025. stack2[i] = source;
  8026. const target = isArray$1(source) ? [] : {};
  8027. forEach$1(source, (value, key) => {
  8028. const reducedValue = visit(value, i + 1);
  8029. !isUndefined$1(reducedValue) && (target[key] = reducedValue);
  8030. });
  8031. stack2[i] = void 0;
  8032. return target;
  8033. }
  8034. }
  8035. return source;
  8036. };
  8037. return visit(obj, 0);
  8038. };
  8039. const isAsyncFn = kindOfTest("AsyncFunction");
  8040. const isThenable = (thing) => thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
  8041. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  8042. if (setImmediateSupported) {
  8043. return setImmediate;
  8044. }
  8045. return postMessageSupported ? ((token, callbacks) => {
  8046. _global.addEventListener("message", ({ source, data }) => {
  8047. if (source === _global && data === token) {
  8048. callbacks.length && callbacks.shift()();
  8049. }
  8050. }, false);
  8051. return (cb) => {
  8052. callbacks.push(cb);
  8053. _global.postMessage(token, "*");
  8054. };
  8055. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  8056. })(
  8057. typeof setImmediate === "function",
  8058. isFunction$1(_global.postMessage)
  8059. );
  8060. const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
  8061. const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
  8062. const utils$4 = {
  8063. isArray: isArray$1,
  8064. isArrayBuffer: isArrayBuffer$1,
  8065. isBuffer: isBuffer$1,
  8066. isFormData: isFormData$1,
  8067. isArrayBufferView: isArrayBufferView$1,
  8068. isString: isString$1,
  8069. isNumber: isNumber$1,
  8070. isBoolean,
  8071. isObject: isObject$1,
  8072. isPlainObject,
  8073. isReadableStream,
  8074. isRequest,
  8075. isResponse,
  8076. isHeaders,
  8077. isUndefined: isUndefined$1,
  8078. isDate: isDate$1,
  8079. isFile: isFile$1,
  8080. isBlob: isBlob$1,
  8081. isRegExp,
  8082. isFunction: isFunction$1,
  8083. isStream: isStream$1,
  8084. isURLSearchParams: isURLSearchParams$1,
  8085. isTypedArray,
  8086. isFileList,
  8087. forEach: forEach$1,
  8088. merge: merge$1,
  8089. extend: extend$1,
  8090. trim: trim$1,
  8091. stripBOM,
  8092. inherits,
  8093. toFlatObject,
  8094. kindOf,
  8095. kindOfTest,
  8096. endsWith,
  8097. toArray,
  8098. forEachEntry,
  8099. matchAll,
  8100. isHTMLForm,
  8101. hasOwnProperty,
  8102. hasOwnProp: hasOwnProperty,
  8103. // an alias to avoid ESLint no-prototype-builtins detection
  8104. reduceDescriptors,
  8105. freezeMethods,
  8106. toObjectSet,
  8107. toCamelCase,
  8108. noop,
  8109. toFiniteNumber,
  8110. findKey,
  8111. global: _global,
  8112. isContextDefined,
  8113. isSpecCompliantForm,
  8114. toJSONObject,
  8115. isAsyncFn,
  8116. isThenable,
  8117. setImmediate: _setImmediate,
  8118. asap,
  8119. isIterable
  8120. };
  8121. function AxiosError(message, code, config, request, response) {
  8122. Error.call(this);
  8123. if (Error.captureStackTrace) {
  8124. Error.captureStackTrace(this, this.constructor);
  8125. } else {
  8126. this.stack = new Error().stack;
  8127. }
  8128. this.message = message;
  8129. this.name = "AxiosError";
  8130. code && (this.code = code);
  8131. config && (this.config = config);
  8132. request && (this.request = request);
  8133. if (response) {
  8134. this.response = response;
  8135. this.status = response.status ? response.status : null;
  8136. }
  8137. }
  8138. utils$4.inherits(AxiosError, Error, {
  8139. toJSON: function toJSON() {
  8140. return {
  8141. // Standard
  8142. message: this.message,
  8143. name: this.name,
  8144. // Microsoft
  8145. description: this.description,
  8146. number: this.number,
  8147. // Mozilla
  8148. fileName: this.fileName,
  8149. lineNumber: this.lineNumber,
  8150. columnNumber: this.columnNumber,
  8151. stack: this.stack,
  8152. // Axios
  8153. config: utils$4.toJSONObject(this.config),
  8154. code: this.code,
  8155. status: this.status
  8156. };
  8157. }
  8158. });
  8159. const prototype$1 = AxiosError.prototype;
  8160. const descriptors = {};
  8161. [
  8162. "ERR_BAD_OPTION_VALUE",
  8163. "ERR_BAD_OPTION",
  8164. "ECONNABORTED",
  8165. "ETIMEDOUT",
  8166. "ERR_NETWORK",
  8167. "ERR_FR_TOO_MANY_REDIRECTS",
  8168. "ERR_DEPRECATED",
  8169. "ERR_BAD_RESPONSE",
  8170. "ERR_BAD_REQUEST",
  8171. "ERR_CANCELED",
  8172. "ERR_NOT_SUPPORT",
  8173. "ERR_INVALID_URL"
  8174. // eslint-disable-next-line func-names
  8175. ].forEach((code) => {
  8176. descriptors[code] = { value: code };
  8177. });
  8178. Object.defineProperties(AxiosError, descriptors);
  8179. Object.defineProperty(prototype$1, "isAxiosError", { value: true });
  8180. AxiosError.from = (error, code, config, request, response, customProps) => {
  8181. const axiosError = Object.create(prototype$1);
  8182. utils$4.toFlatObject(error, axiosError, function filter2(obj) {
  8183. return obj !== Error.prototype;
  8184. }, (prop) => {
  8185. return prop !== "isAxiosError";
  8186. });
  8187. AxiosError.call(axiosError, error.message, code, config, request, response);
  8188. axiosError.cause = error;
  8189. axiosError.name = error.name;
  8190. customProps && Object.assign(axiosError, customProps);
  8191. return axiosError;
  8192. };
  8193. const httpAdapter = null;
  8194. function isVisitable(thing) {
  8195. return utils$4.isPlainObject(thing) || utils$4.isArray(thing);
  8196. }
  8197. function removeBrackets(key) {
  8198. return utils$4.endsWith(key, "[]") ? key.slice(0, -2) : key;
  8199. }
  8200. function renderKey(path, key, dots) {
  8201. if (!path)
  8202. return key;
  8203. return path.concat(key).map(function each(token, i) {
  8204. token = removeBrackets(token);
  8205. return !dots && i ? "[" + token + "]" : token;
  8206. }).join(dots ? "." : "");
  8207. }
  8208. function isFlatArray(arr) {
  8209. return utils$4.isArray(arr) && !arr.some(isVisitable);
  8210. }
  8211. const predicates = utils$4.toFlatObject(utils$4, {}, null, function filter(prop) {
  8212. return /^is[A-Z]/.test(prop);
  8213. });
  8214. function toFormData(obj, formData, options) {
  8215. if (!utils$4.isObject(obj)) {
  8216. throw new TypeError("target must be an object");
  8217. }
  8218. formData = formData || new FormData();
  8219. options = utils$4.toFlatObject(options, {
  8220. metaTokens: true,
  8221. dots: false,
  8222. indexes: false
  8223. }, false, function defined(option, source) {
  8224. return !utils$4.isUndefined(source[option]);
  8225. });
  8226. const metaTokens = options.metaTokens;
  8227. const visitor = options.visitor || defaultVisitor;
  8228. const dots = options.dots;
  8229. const indexes = options.indexes;
  8230. const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  8231. const useBlob = _Blob && utils$4.isSpecCompliantForm(formData);
  8232. if (!utils$4.isFunction(visitor)) {
  8233. throw new TypeError("visitor must be a function");
  8234. }
  8235. function convertValue(value) {
  8236. if (value === null)
  8237. return "";
  8238. if (utils$4.isDate(value)) {
  8239. return value.toISOString();
  8240. }
  8241. if (utils$4.isBoolean(value)) {
  8242. return value.toString();
  8243. }
  8244. if (!useBlob && utils$4.isBlob(value)) {
  8245. throw new AxiosError("Blob is not supported. Use a Buffer instead.");
  8246. }
  8247. if (utils$4.isArrayBuffer(value) || utils$4.isTypedArray(value)) {
  8248. return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
  8249. }
  8250. return value;
  8251. }
  8252. function defaultVisitor(value, key, path) {
  8253. let arr = value;
  8254. if (value && !path && typeof value === "object") {
  8255. if (utils$4.endsWith(key, "{}")) {
  8256. key = metaTokens ? key : key.slice(0, -2);
  8257. value = JSON.stringify(value);
  8258. } else if (utils$4.isArray(value) && isFlatArray(value) || (utils$4.isFileList(value) || utils$4.endsWith(key, "[]")) && (arr = utils$4.toArray(value))) {
  8259. key = removeBrackets(key);
  8260. arr.forEach(function each(el, index2) {
  8261. !(utils$4.isUndefined(el) || el === null) && formData.append(
  8262. // eslint-disable-next-line no-nested-ternary
  8263. indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
  8264. convertValue(el)
  8265. );
  8266. });
  8267. return false;
  8268. }
  8269. }
  8270. if (isVisitable(value)) {
  8271. return true;
  8272. }
  8273. formData.append(renderKey(path, key, dots), convertValue(value));
  8274. return false;
  8275. }
  8276. const stack2 = [];
  8277. const exposedHelpers = Object.assign(predicates, {
  8278. defaultVisitor,
  8279. convertValue,
  8280. isVisitable
  8281. });
  8282. function build(value, path) {
  8283. if (utils$4.isUndefined(value))
  8284. return;
  8285. if (stack2.indexOf(value) !== -1) {
  8286. throw Error("Circular reference detected in " + path.join("."));
  8287. }
  8288. stack2.push(value);
  8289. utils$4.forEach(value, function each(el, key) {
  8290. const result = !(utils$4.isUndefined(el) || el === null) && visitor.call(
  8291. formData,
  8292. el,
  8293. utils$4.isString(key) ? key.trim() : key,
  8294. path,
  8295. exposedHelpers
  8296. );
  8297. if (result === true) {
  8298. build(el, path ? path.concat(key) : [key]);
  8299. }
  8300. });
  8301. stack2.pop();
  8302. }
  8303. if (!utils$4.isObject(obj)) {
  8304. throw new TypeError("data must be an object");
  8305. }
  8306. build(obj);
  8307. return formData;
  8308. }
  8309. function encode$2(str) {
  8310. const charMap = {
  8311. "!": "%21",
  8312. "'": "%27",
  8313. "(": "%28",
  8314. ")": "%29",
  8315. "~": "%7E",
  8316. "%20": "+",
  8317. "%00": "\0"
  8318. };
  8319. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer2(match) {
  8320. return charMap[match];
  8321. });
  8322. }
  8323. function AxiosURLSearchParams(params, options) {
  8324. this._pairs = [];
  8325. params && toFormData(params, this, options);
  8326. }
  8327. const prototype = AxiosURLSearchParams.prototype;
  8328. prototype.append = function append(name, value) {
  8329. this._pairs.push([name, value]);
  8330. };
  8331. prototype.toString = function toString(encoder2) {
  8332. const _encode = encoder2 ? function(value) {
  8333. return encoder2.call(this, value, encode$2);
  8334. } : encode$2;
  8335. return this._pairs.map(function each(pair) {
  8336. return _encode(pair[0]) + "=" + _encode(pair[1]);
  8337. }, "").join("&");
  8338. };
  8339. function encode$1(val) {
  8340. return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  8341. }
  8342. function buildURL$2(url, params, options) {
  8343. if (!params) {
  8344. return url;
  8345. }
  8346. const _encode = options && options.encode || encode$1;
  8347. if (utils$4.isFunction(options)) {
  8348. options = {
  8349. serialize: options
  8350. };
  8351. }
  8352. const serializeFn = options && options.serialize;
  8353. let serializedParams;
  8354. if (serializeFn) {
  8355. serializedParams = serializeFn(params, options);
  8356. } else {
  8357. serializedParams = utils$4.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  8358. }
  8359. if (serializedParams) {
  8360. const hashmarkIndex = url.indexOf("#");
  8361. if (hashmarkIndex !== -1) {
  8362. url = url.slice(0, hashmarkIndex);
  8363. }
  8364. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  8365. }
  8366. return url;
  8367. }
  8368. class InterceptorManager {
  8369. constructor() {
  8370. this.handlers = [];
  8371. }
  8372. /**
  8373. * Add a new interceptor to the stack
  8374. *
  8375. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  8376. * @param {Function} rejected The function to handle `reject` for a `Promise`
  8377. *
  8378. * @return {Number} An ID used to remove interceptor later
  8379. */
  8380. use(fulfilled, rejected, options) {
  8381. this.handlers.push({
  8382. fulfilled,
  8383. rejected,
  8384. synchronous: options ? options.synchronous : false,
  8385. runWhen: options ? options.runWhen : null
  8386. });
  8387. return this.handlers.length - 1;
  8388. }
  8389. /**
  8390. * Remove an interceptor from the stack
  8391. *
  8392. * @param {Number} id The ID that was returned by `use`
  8393. *
  8394. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  8395. */
  8396. eject(id) {
  8397. if (this.handlers[id]) {
  8398. this.handlers[id] = null;
  8399. }
  8400. }
  8401. /**
  8402. * Clear all interceptors from the stack
  8403. *
  8404. * @returns {void}
  8405. */
  8406. clear() {
  8407. if (this.handlers) {
  8408. this.handlers = [];
  8409. }
  8410. }
  8411. /**
  8412. * Iterate over all the registered interceptors
  8413. *
  8414. * This method is particularly useful for skipping over any
  8415. * interceptors that may have become `null` calling `eject`.
  8416. *
  8417. * @param {Function} fn The function to call for each interceptor
  8418. *
  8419. * @returns {void}
  8420. */
  8421. forEach(fn) {
  8422. utils$4.forEach(this.handlers, function forEachHandler(h) {
  8423. if (h !== null) {
  8424. fn(h);
  8425. }
  8426. });
  8427. }
  8428. }
  8429. const transitionalDefaults = {
  8430. silentJSONParsing: true,
  8431. forcedJSONParsing: true,
  8432. clarifyTimeoutError: false
  8433. };
  8434. const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
  8435. const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
  8436. const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
  8437. const platform$1 = {
  8438. isBrowser: true,
  8439. classes: {
  8440. URLSearchParams: URLSearchParams$1,
  8441. FormData: FormData$1,
  8442. Blob: Blob$1
  8443. },
  8444. protocols: ["http", "https", "file", "blob", "url", "data"]
  8445. };
  8446. const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
  8447. const _navigator = typeof navigator === "object" && navigator || void 0;
  8448. const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
  8449. const hasStandardBrowserWebWorkerEnv = (() => {
  8450. return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  8451. self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
  8452. })();
  8453. const origin = hasBrowserEnv && window.location.href || "http://localhost";
  8454. const utils$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  8455. __proto__: null,
  8456. hasBrowserEnv,
  8457. hasStandardBrowserEnv,
  8458. hasStandardBrowserWebWorkerEnv,
  8459. navigator: _navigator,
  8460. origin
  8461. }, Symbol.toStringTag, { value: "Module" }));
  8462. const platform = {
  8463. ...utils$3,
  8464. ...platform$1
  8465. };
  8466. function toURLEncodedForm(data, options) {
  8467. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  8468. visitor: function(value, key, path, helpers) {
  8469. if (platform.isNode && utils$4.isBuffer(value)) {
  8470. this.append(key, value.toString("base64"));
  8471. return false;
  8472. }
  8473. return helpers.defaultVisitor.apply(this, arguments);
  8474. }
  8475. }, options));
  8476. }
  8477. function parsePropPath(name) {
  8478. return utils$4.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
  8479. return match[0] === "[]" ? "" : match[1] || match[0];
  8480. });
  8481. }
  8482. function arrayToObject(arr) {
  8483. const obj = {};
  8484. const keys = Object.keys(arr);
  8485. let i;
  8486. const len = keys.length;
  8487. let key;
  8488. for (i = 0; i < len; i++) {
  8489. key = keys[i];
  8490. obj[key] = arr[key];
  8491. }
  8492. return obj;
  8493. }
  8494. function formDataToJSON(formData) {
  8495. function buildPath(path, value, target, index2) {
  8496. let name = path[index2++];
  8497. if (name === "__proto__")
  8498. return true;
  8499. const isNumericKey = Number.isFinite(+name);
  8500. const isLast = index2 >= path.length;
  8501. name = !name && utils$4.isArray(target) ? target.length : name;
  8502. if (isLast) {
  8503. if (utils$4.hasOwnProp(target, name)) {
  8504. target[name] = [target[name], value];
  8505. } else {
  8506. target[name] = value;
  8507. }
  8508. return !isNumericKey;
  8509. }
  8510. if (!target[name] || !utils$4.isObject(target[name])) {
  8511. target[name] = [];
  8512. }
  8513. const result = buildPath(path, value, target[name], index2);
  8514. if (result && utils$4.isArray(target[name])) {
  8515. target[name] = arrayToObject(target[name]);
  8516. }
  8517. return !isNumericKey;
  8518. }
  8519. if (utils$4.isFormData(formData) && utils$4.isFunction(formData.entries)) {
  8520. const obj = {};
  8521. utils$4.forEachEntry(formData, (name, value) => {
  8522. buildPath(parsePropPath(name), value, obj, 0);
  8523. });
  8524. return obj;
  8525. }
  8526. return null;
  8527. }
  8528. function stringifySafely(rawValue, parser, encoder2) {
  8529. if (utils$4.isString(rawValue)) {
  8530. try {
  8531. (parser || JSON.parse)(rawValue);
  8532. return utils$4.trim(rawValue);
  8533. } catch (e) {
  8534. if (e.name !== "SyntaxError") {
  8535. throw e;
  8536. }
  8537. }
  8538. }
  8539. return (encoder2 || JSON.stringify)(rawValue);
  8540. }
  8541. const defaults = {
  8542. transitional: transitionalDefaults,
  8543. adapter: ["xhr", "http", "fetch"],
  8544. transformRequest: [function transformRequest(data, headers) {
  8545. const contentType = headers.getContentType() || "";
  8546. const hasJSONContentType = contentType.indexOf("application/json") > -1;
  8547. const isObjectPayload = utils$4.isObject(data);
  8548. if (isObjectPayload && utils$4.isHTMLForm(data)) {
  8549. data = new FormData(data);
  8550. }
  8551. const isFormData2 = utils$4.isFormData(data);
  8552. if (isFormData2) {
  8553. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  8554. }
  8555. if (utils$4.isArrayBuffer(data) || utils$4.isBuffer(data) || utils$4.isStream(data) || utils$4.isFile(data) || utils$4.isBlob(data) || utils$4.isReadableStream(data)) {
  8556. return data;
  8557. }
  8558. if (utils$4.isArrayBufferView(data)) {
  8559. return data.buffer;
  8560. }
  8561. if (utils$4.isURLSearchParams(data)) {
  8562. headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
  8563. return data.toString();
  8564. }
  8565. let isFileList2;
  8566. if (isObjectPayload) {
  8567. if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
  8568. return toURLEncodedForm(data, this.formSerializer).toString();
  8569. }
  8570. if ((isFileList2 = utils$4.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
  8571. const _FormData = this.env && this.env.FormData;
  8572. return toFormData(
  8573. isFileList2 ? { "files[]": data } : data,
  8574. _FormData && new _FormData(),
  8575. this.formSerializer
  8576. );
  8577. }
  8578. }
  8579. if (isObjectPayload || hasJSONContentType) {
  8580. headers.setContentType("application/json", false);
  8581. return stringifySafely(data);
  8582. }
  8583. return data;
  8584. }],
  8585. transformResponse: [function transformResponse(data) {
  8586. const transitional2 = this.transitional || defaults.transitional;
  8587. const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
  8588. const JSONRequested = this.responseType === "json";
  8589. if (utils$4.isResponse(data) || utils$4.isReadableStream(data)) {
  8590. return data;
  8591. }
  8592. if (data && utils$4.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  8593. const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
  8594. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  8595. try {
  8596. return JSON.parse(data);
  8597. } catch (e) {
  8598. if (strictJSONParsing) {
  8599. if (e.name === "SyntaxError") {
  8600. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  8601. }
  8602. throw e;
  8603. }
  8604. }
  8605. }
  8606. return data;
  8607. }],
  8608. /**
  8609. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  8610. * timeout is not created.
  8611. */
  8612. timeout: 0,
  8613. xsrfCookieName: "XSRF-TOKEN",
  8614. xsrfHeaderName: "X-XSRF-TOKEN",
  8615. maxContentLength: -1,
  8616. maxBodyLength: -1,
  8617. env: {
  8618. FormData: platform.classes.FormData,
  8619. Blob: platform.classes.Blob
  8620. },
  8621. validateStatus: function validateStatus(status) {
  8622. return status >= 200 && status < 300;
  8623. },
  8624. headers: {
  8625. common: {
  8626. "Accept": "application/json, text/plain, */*",
  8627. "Content-Type": void 0
  8628. }
  8629. }
  8630. };
  8631. utils$4.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
  8632. defaults.headers[method] = {};
  8633. });
  8634. const defaults$1 = defaults;
  8635. const ignoreDuplicateOf = utils$4.toObjectSet([
  8636. "age",
  8637. "authorization",
  8638. "content-length",
  8639. "content-type",
  8640. "etag",
  8641. "expires",
  8642. "from",
  8643. "host",
  8644. "if-modified-since",
  8645. "if-unmodified-since",
  8646. "last-modified",
  8647. "location",
  8648. "max-forwards",
  8649. "proxy-authorization",
  8650. "referer",
  8651. "retry-after",
  8652. "user-agent"
  8653. ]);
  8654. const parseHeaders = (rawHeaders) => {
  8655. const parsed = {};
  8656. let key;
  8657. let val;
  8658. let i;
  8659. rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
  8660. i = line.indexOf(":");
  8661. key = line.substring(0, i).trim().toLowerCase();
  8662. val = line.substring(i + 1).trim();
  8663. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  8664. return;
  8665. }
  8666. if (key === "set-cookie") {
  8667. if (parsed[key]) {
  8668. parsed[key].push(val);
  8669. } else {
  8670. parsed[key] = [val];
  8671. }
  8672. } else {
  8673. parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
  8674. }
  8675. });
  8676. return parsed;
  8677. };
  8678. const $internals = Symbol("internals");
  8679. function normalizeHeader(header) {
  8680. return header && String(header).trim().toLowerCase();
  8681. }
  8682. function normalizeValue(value) {
  8683. if (value === false || value == null) {
  8684. return value;
  8685. }
  8686. return utils$4.isArray(value) ? value.map(normalizeValue) : String(value);
  8687. }
  8688. function parseTokens(str) {
  8689. const tokens = /* @__PURE__ */ Object.create(null);
  8690. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  8691. let match;
  8692. while (match = tokensRE.exec(str)) {
  8693. tokens[match[1]] = match[2];
  8694. }
  8695. return tokens;
  8696. }
  8697. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  8698. function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
  8699. if (utils$4.isFunction(filter2)) {
  8700. return filter2.call(this, value, header);
  8701. }
  8702. if (isHeaderNameFilter) {
  8703. value = header;
  8704. }
  8705. if (!utils$4.isString(value))
  8706. return;
  8707. if (utils$4.isString(filter2)) {
  8708. return value.indexOf(filter2) !== -1;
  8709. }
  8710. if (utils$4.isRegExp(filter2)) {
  8711. return filter2.test(value);
  8712. }
  8713. }
  8714. function formatHeader(header) {
  8715. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  8716. return char.toUpperCase() + str;
  8717. });
  8718. }
  8719. function buildAccessors(obj, header) {
  8720. const accessorName = utils$4.toCamelCase(" " + header);
  8721. ["get", "set", "has"].forEach((methodName) => {
  8722. Object.defineProperty(obj, methodName + accessorName, {
  8723. value: function(arg1, arg2, arg3) {
  8724. return this[methodName].call(this, header, arg1, arg2, arg3);
  8725. },
  8726. configurable: true
  8727. });
  8728. });
  8729. }
  8730. class AxiosHeaders {
  8731. constructor(headers) {
  8732. headers && this.set(headers);
  8733. }
  8734. set(header, valueOrRewrite, rewrite) {
  8735. const self2 = this;
  8736. function setHeader(_value, _header, _rewrite) {
  8737. const lHeader = normalizeHeader(_header);
  8738. if (!lHeader) {
  8739. throw new Error("header name must be a non-empty string");
  8740. }
  8741. const key = utils$4.findKey(self2, lHeader);
  8742. if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
  8743. self2[key || _header] = normalizeValue(_value);
  8744. }
  8745. }
  8746. const setHeaders = (headers, _rewrite) => utils$4.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  8747. if (utils$4.isPlainObject(header) || header instanceof this.constructor) {
  8748. setHeaders(header, valueOrRewrite);
  8749. } else if (utils$4.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  8750. setHeaders(parseHeaders(header), valueOrRewrite);
  8751. } else if (utils$4.isObject(header) && utils$4.isIterable(header)) {
  8752. let obj = {}, dest, key;
  8753. for (const entry of header) {
  8754. if (!utils$4.isArray(entry)) {
  8755. throw TypeError("Object iterator must return a key-value pair");
  8756. }
  8757. obj[key = entry[0]] = (dest = obj[key]) ? utils$4.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
  8758. }
  8759. setHeaders(obj, valueOrRewrite);
  8760. } else {
  8761. header != null && setHeader(valueOrRewrite, header, rewrite);
  8762. }
  8763. return this;
  8764. }
  8765. get(header, parser) {
  8766. header = normalizeHeader(header);
  8767. if (header) {
  8768. const key = utils$4.findKey(this, header);
  8769. if (key) {
  8770. const value = this[key];
  8771. if (!parser) {
  8772. return value;
  8773. }
  8774. if (parser === true) {
  8775. return parseTokens(value);
  8776. }
  8777. if (utils$4.isFunction(parser)) {
  8778. return parser.call(this, value, key);
  8779. }
  8780. if (utils$4.isRegExp(parser)) {
  8781. return parser.exec(value);
  8782. }
  8783. throw new TypeError("parser must be boolean|regexp|function");
  8784. }
  8785. }
  8786. }
  8787. has(header, matcher) {
  8788. header = normalizeHeader(header);
  8789. if (header) {
  8790. const key = utils$4.findKey(this, header);
  8791. return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  8792. }
  8793. return false;
  8794. }
  8795. delete(header, matcher) {
  8796. const self2 = this;
  8797. let deleted = false;
  8798. function deleteHeader(_header) {
  8799. _header = normalizeHeader(_header);
  8800. if (_header) {
  8801. const key = utils$4.findKey(self2, _header);
  8802. if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
  8803. delete self2[key];
  8804. deleted = true;
  8805. }
  8806. }
  8807. }
  8808. if (utils$4.isArray(header)) {
  8809. header.forEach(deleteHeader);
  8810. } else {
  8811. deleteHeader(header);
  8812. }
  8813. return deleted;
  8814. }
  8815. clear(matcher) {
  8816. const keys = Object.keys(this);
  8817. let i = keys.length;
  8818. let deleted = false;
  8819. while (i--) {
  8820. const key = keys[i];
  8821. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  8822. delete this[key];
  8823. deleted = true;
  8824. }
  8825. }
  8826. return deleted;
  8827. }
  8828. normalize(format) {
  8829. const self2 = this;
  8830. const headers = {};
  8831. utils$4.forEach(this, (value, header) => {
  8832. const key = utils$4.findKey(headers, header);
  8833. if (key) {
  8834. self2[key] = normalizeValue(value);
  8835. delete self2[header];
  8836. return;
  8837. }
  8838. const normalized = format ? formatHeader(header) : String(header).trim();
  8839. if (normalized !== header) {
  8840. delete self2[header];
  8841. }
  8842. self2[normalized] = normalizeValue(value);
  8843. headers[normalized] = true;
  8844. });
  8845. return this;
  8846. }
  8847. concat(...targets) {
  8848. return this.constructor.concat(this, ...targets);
  8849. }
  8850. toJSON(asStrings) {
  8851. const obj = /* @__PURE__ */ Object.create(null);
  8852. utils$4.forEach(this, (value, header) => {
  8853. value != null && value !== false && (obj[header] = asStrings && utils$4.isArray(value) ? value.join(", ") : value);
  8854. });
  8855. return obj;
  8856. }
  8857. [Symbol.iterator]() {
  8858. return Object.entries(this.toJSON())[Symbol.iterator]();
  8859. }
  8860. toString() {
  8861. return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
  8862. }
  8863. getSetCookie() {
  8864. return this.get("set-cookie") || [];
  8865. }
  8866. get [Symbol.toStringTag]() {
  8867. return "AxiosHeaders";
  8868. }
  8869. static from(thing) {
  8870. return thing instanceof this ? thing : new this(thing);
  8871. }
  8872. static concat(first, ...targets) {
  8873. const computed2 = new this(first);
  8874. targets.forEach((target) => computed2.set(target));
  8875. return computed2;
  8876. }
  8877. static accessor(header) {
  8878. const internals = this[$internals] = this[$internals] = {
  8879. accessors: {}
  8880. };
  8881. const accessors = internals.accessors;
  8882. const prototype2 = this.prototype;
  8883. function defineAccessor(_header) {
  8884. const lHeader = normalizeHeader(_header);
  8885. if (!accessors[lHeader]) {
  8886. buildAccessors(prototype2, _header);
  8887. accessors[lHeader] = true;
  8888. }
  8889. }
  8890. utils$4.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  8891. return this;
  8892. }
  8893. }
  8894. AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
  8895. utils$4.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
  8896. let mapped = key[0].toUpperCase() + key.slice(1);
  8897. return {
  8898. get: () => value,
  8899. set(headerValue) {
  8900. this[mapped] = headerValue;
  8901. }
  8902. };
  8903. });
  8904. utils$4.freezeMethods(AxiosHeaders);
  8905. const AxiosHeaders$1 = AxiosHeaders;
  8906. function transformData(fns, response) {
  8907. const config = this || defaults$1;
  8908. const context = response || config;
  8909. const headers = AxiosHeaders$1.from(context.headers);
  8910. let data = context.data;
  8911. utils$4.forEach(fns, function transform(fn) {
  8912. data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
  8913. });
  8914. headers.normalize();
  8915. return data;
  8916. }
  8917. function isCancel(value) {
  8918. return !!(value && value.__CANCEL__);
  8919. }
  8920. function CanceledError(message, config, request) {
  8921. AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
  8922. this.name = "CanceledError";
  8923. }
  8924. utils$4.inherits(CanceledError, AxiosError, {
  8925. __CANCEL__: true
  8926. });
  8927. function settle$2(resolve, reject, response) {
  8928. const validateStatus2 = response.config.validateStatus;
  8929. if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
  8930. resolve(response);
  8931. } else {
  8932. reject(new AxiosError(
  8933. "Request failed with status code " + response.status,
  8934. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  8935. response.config,
  8936. response.request,
  8937. response
  8938. ));
  8939. }
  8940. }
  8941. function parseProtocol(url) {
  8942. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  8943. return match && match[1] || "";
  8944. }
  8945. function speedometer(samplesCount, min) {
  8946. samplesCount = samplesCount || 10;
  8947. const bytes = new Array(samplesCount);
  8948. const timestamps = new Array(samplesCount);
  8949. let head = 0;
  8950. let tail = 0;
  8951. let firstSampleTS;
  8952. min = min !== void 0 ? min : 1e3;
  8953. return function push(chunkLength) {
  8954. const now = Date.now();
  8955. const startedAt = timestamps[tail];
  8956. if (!firstSampleTS) {
  8957. firstSampleTS = now;
  8958. }
  8959. bytes[head] = chunkLength;
  8960. timestamps[head] = now;
  8961. let i = tail;
  8962. let bytesCount = 0;
  8963. while (i !== head) {
  8964. bytesCount += bytes[i++];
  8965. i = i % samplesCount;
  8966. }
  8967. head = (head + 1) % samplesCount;
  8968. if (head === tail) {
  8969. tail = (tail + 1) % samplesCount;
  8970. }
  8971. if (now - firstSampleTS < min) {
  8972. return;
  8973. }
  8974. const passed = startedAt && now - startedAt;
  8975. return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  8976. };
  8977. }
  8978. function throttle(fn, freq) {
  8979. let timestamp = 0;
  8980. let threshold = 1e3 / freq;
  8981. let lastArgs;
  8982. let timer;
  8983. const invoke = (args, now = Date.now()) => {
  8984. timestamp = now;
  8985. lastArgs = null;
  8986. if (timer) {
  8987. clearTimeout(timer);
  8988. timer = null;
  8989. }
  8990. fn.apply(null, args);
  8991. };
  8992. const throttled = (...args) => {
  8993. const now = Date.now();
  8994. const passed = now - timestamp;
  8995. if (passed >= threshold) {
  8996. invoke(args, now);
  8997. } else {
  8998. lastArgs = args;
  8999. if (!timer) {
  9000. timer = setTimeout(() => {
  9001. timer = null;
  9002. invoke(lastArgs);
  9003. }, threshold - passed);
  9004. }
  9005. }
  9006. };
  9007. const flush = () => lastArgs && invoke(lastArgs);
  9008. return [throttled, flush];
  9009. }
  9010. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  9011. let bytesNotified = 0;
  9012. const _speedometer = speedometer(50, 250);
  9013. return throttle((e) => {
  9014. const loaded = e.loaded;
  9015. const total = e.lengthComputable ? e.total : void 0;
  9016. const progressBytes = loaded - bytesNotified;
  9017. const rate = _speedometer(progressBytes);
  9018. const inRange = loaded <= total;
  9019. bytesNotified = loaded;
  9020. const data = {
  9021. loaded,
  9022. total,
  9023. progress: total ? loaded / total : void 0,
  9024. bytes: progressBytes,
  9025. rate: rate ? rate : void 0,
  9026. estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
  9027. event: e,
  9028. lengthComputable: total != null,
  9029. [isDownloadStream ? "download" : "upload"]: true
  9030. };
  9031. listener(data);
  9032. }, freq);
  9033. };
  9034. const progressEventDecorator = (total, throttled) => {
  9035. const lengthComputable = total != null;
  9036. return [(loaded) => throttled[0]({
  9037. lengthComputable,
  9038. total,
  9039. loaded
  9040. }), throttled[1]];
  9041. };
  9042. const asyncDecorator = (fn) => (...args) => utils$4.asap(() => fn(...args));
  9043. const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
  9044. url = new URL(url, platform.origin);
  9045. return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
  9046. })(
  9047. new URL(platform.origin),
  9048. platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
  9049. ) : () => true;
  9050. const cookies = platform.hasStandardBrowserEnv ? (
  9051. // Standard browser envs support document.cookie
  9052. {
  9053. write(name, value, expires, path, domain, secure) {
  9054. const cookie = [name + "=" + encodeURIComponent(value)];
  9055. utils$4.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
  9056. utils$4.isString(path) && cookie.push("path=" + path);
  9057. utils$4.isString(domain) && cookie.push("domain=" + domain);
  9058. secure === true && cookie.push("secure");
  9059. document.cookie = cookie.join("; ");
  9060. },
  9061. read(name) {
  9062. const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
  9063. return match ? decodeURIComponent(match[3]) : null;
  9064. },
  9065. remove(name) {
  9066. this.write(name, "", Date.now() - 864e5);
  9067. }
  9068. }
  9069. ) : (
  9070. // Non-standard browser env (web workers, react-native) lack needed support.
  9071. {
  9072. write() {
  9073. },
  9074. read() {
  9075. return null;
  9076. },
  9077. remove() {
  9078. }
  9079. }
  9080. );
  9081. function isAbsoluteURL$2(url) {
  9082. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  9083. }
  9084. function combineURLs$2(baseURL, relativeURL) {
  9085. return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  9086. }
  9087. function buildFullPath$2(baseURL, requestedURL, allowAbsoluteUrls) {
  9088. let isRelativeUrl = !isAbsoluteURL$2(requestedURL);
  9089. if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
  9090. return combineURLs$2(baseURL, requestedURL);
  9091. }
  9092. return requestedURL;
  9093. }
  9094. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
  9095. function mergeConfig(config1, config2) {
  9096. config2 = config2 || {};
  9097. const config = {};
  9098. function getMergedValue(target, source, prop, caseless) {
  9099. if (utils$4.isPlainObject(target) && utils$4.isPlainObject(source)) {
  9100. return utils$4.merge.call({ caseless }, target, source);
  9101. } else if (utils$4.isPlainObject(source)) {
  9102. return utils$4.merge({}, source);
  9103. } else if (utils$4.isArray(source)) {
  9104. return source.slice();
  9105. }
  9106. return source;
  9107. }
  9108. function mergeDeepProperties(a, b, prop, caseless) {
  9109. if (!utils$4.isUndefined(b)) {
  9110. return getMergedValue(a, b, prop, caseless);
  9111. } else if (!utils$4.isUndefined(a)) {
  9112. return getMergedValue(void 0, a, prop, caseless);
  9113. }
  9114. }
  9115. function valueFromConfig2(a, b) {
  9116. if (!utils$4.isUndefined(b)) {
  9117. return getMergedValue(void 0, b);
  9118. }
  9119. }
  9120. function defaultToConfig2(a, b) {
  9121. if (!utils$4.isUndefined(b)) {
  9122. return getMergedValue(void 0, b);
  9123. } else if (!utils$4.isUndefined(a)) {
  9124. return getMergedValue(void 0, a);
  9125. }
  9126. }
  9127. function mergeDirectKeys(a, b, prop) {
  9128. if (prop in config2) {
  9129. return getMergedValue(a, b);
  9130. } else if (prop in config1) {
  9131. return getMergedValue(void 0, a);
  9132. }
  9133. }
  9134. const mergeMap = {
  9135. url: valueFromConfig2,
  9136. method: valueFromConfig2,
  9137. data: valueFromConfig2,
  9138. baseURL: defaultToConfig2,
  9139. transformRequest: defaultToConfig2,
  9140. transformResponse: defaultToConfig2,
  9141. paramsSerializer: defaultToConfig2,
  9142. timeout: defaultToConfig2,
  9143. timeoutMessage: defaultToConfig2,
  9144. withCredentials: defaultToConfig2,
  9145. withXSRFToken: defaultToConfig2,
  9146. adapter: defaultToConfig2,
  9147. responseType: defaultToConfig2,
  9148. xsrfCookieName: defaultToConfig2,
  9149. xsrfHeaderName: defaultToConfig2,
  9150. onUploadProgress: defaultToConfig2,
  9151. onDownloadProgress: defaultToConfig2,
  9152. decompress: defaultToConfig2,
  9153. maxContentLength: defaultToConfig2,
  9154. maxBodyLength: defaultToConfig2,
  9155. beforeRedirect: defaultToConfig2,
  9156. transport: defaultToConfig2,
  9157. httpAgent: defaultToConfig2,
  9158. httpsAgent: defaultToConfig2,
  9159. cancelToken: defaultToConfig2,
  9160. socketPath: defaultToConfig2,
  9161. responseEncoding: defaultToConfig2,
  9162. validateStatus: mergeDirectKeys,
  9163. headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
  9164. };
  9165. utils$4.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  9166. const merge2 = mergeMap[prop] || mergeDeepProperties;
  9167. const configValue = merge2(config1[prop], config2[prop], prop);
  9168. utils$4.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
  9169. });
  9170. return config;
  9171. }
  9172. const resolveConfig = (config) => {
  9173. const newConfig = mergeConfig({}, config);
  9174. let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  9175. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  9176. newConfig.url = buildURL$2(buildFullPath$2(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
  9177. if (auth) {
  9178. headers.set(
  9179. "Authorization",
  9180. "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
  9181. );
  9182. }
  9183. let contentType;
  9184. if (utils$4.isFormData(data)) {
  9185. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  9186. headers.setContentType(void 0);
  9187. } else if ((contentType = headers.getContentType()) !== false) {
  9188. const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
  9189. headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
  9190. }
  9191. }
  9192. if (platform.hasStandardBrowserEnv) {
  9193. withXSRFToken && utils$4.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  9194. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  9195. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  9196. if (xsrfValue) {
  9197. headers.set(xsrfHeaderName, xsrfValue);
  9198. }
  9199. }
  9200. }
  9201. return newConfig;
  9202. };
  9203. const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
  9204. const xhrAdapter = isXHRAdapterSupported && function(config) {
  9205. return new Promise(function dispatchXhrRequest(resolve, reject) {
  9206. const _config = resolveConfig(config);
  9207. let requestData = _config.data;
  9208. const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  9209. let { responseType, onUploadProgress, onDownloadProgress } = _config;
  9210. let onCanceled;
  9211. let uploadThrottled, downloadThrottled;
  9212. let flushUpload, flushDownload;
  9213. function done() {
  9214. flushUpload && flushUpload();
  9215. flushDownload && flushDownload();
  9216. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  9217. _config.signal && _config.signal.removeEventListener("abort", onCanceled);
  9218. }
  9219. let request = new XMLHttpRequest();
  9220. request.open(_config.method.toUpperCase(), _config.url, true);
  9221. request.timeout = _config.timeout;
  9222. function onloadend() {
  9223. if (!request) {
  9224. return;
  9225. }
  9226. const responseHeaders = AxiosHeaders$1.from(
  9227. "getAllResponseHeaders" in request && request.getAllResponseHeaders()
  9228. );
  9229. const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
  9230. const response = {
  9231. data: responseData,
  9232. status: request.status,
  9233. statusText: request.statusText,
  9234. headers: responseHeaders,
  9235. config,
  9236. request
  9237. };
  9238. settle$2(function _resolve(value) {
  9239. resolve(value);
  9240. done();
  9241. }, function _reject(err) {
  9242. reject(err);
  9243. done();
  9244. }, response);
  9245. request = null;
  9246. }
  9247. if ("onloadend" in request) {
  9248. request.onloadend = onloadend;
  9249. } else {
  9250. request.onreadystatechange = function handleLoad() {
  9251. if (!request || request.readyState !== 4) {
  9252. return;
  9253. }
  9254. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
  9255. return;
  9256. }
  9257. setTimeout(onloadend);
  9258. };
  9259. }
  9260. request.onabort = function handleAbort() {
  9261. if (!request) {
  9262. return;
  9263. }
  9264. reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
  9265. request = null;
  9266. };
  9267. request.onerror = function handleError2() {
  9268. reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
  9269. request = null;
  9270. };
  9271. request.ontimeout = function handleTimeout() {
  9272. let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
  9273. const transitional2 = _config.transitional || transitionalDefaults;
  9274. if (_config.timeoutErrorMessage) {
  9275. timeoutErrorMessage = _config.timeoutErrorMessage;
  9276. }
  9277. reject(new AxiosError(
  9278. timeoutErrorMessage,
  9279. transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  9280. config,
  9281. request
  9282. ));
  9283. request = null;
  9284. };
  9285. requestData === void 0 && requestHeaders.setContentType(null);
  9286. if ("setRequestHeader" in request) {
  9287. utils$4.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  9288. request.setRequestHeader(key, val);
  9289. });
  9290. }
  9291. if (!utils$4.isUndefined(_config.withCredentials)) {
  9292. request.withCredentials = !!_config.withCredentials;
  9293. }
  9294. if (responseType && responseType !== "json") {
  9295. request.responseType = _config.responseType;
  9296. }
  9297. if (onDownloadProgress) {
  9298. [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
  9299. request.addEventListener("progress", downloadThrottled);
  9300. }
  9301. if (onUploadProgress && request.upload) {
  9302. [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
  9303. request.upload.addEventListener("progress", uploadThrottled);
  9304. request.upload.addEventListener("loadend", flushUpload);
  9305. }
  9306. if (_config.cancelToken || _config.signal) {
  9307. onCanceled = (cancel) => {
  9308. if (!request) {
  9309. return;
  9310. }
  9311. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  9312. request.abort();
  9313. request = null;
  9314. };
  9315. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  9316. if (_config.signal) {
  9317. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
  9318. }
  9319. }
  9320. const protocol = parseProtocol(_config.url);
  9321. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  9322. reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
  9323. return;
  9324. }
  9325. request.send(requestData || null);
  9326. });
  9327. };
  9328. const composeSignals = (signals, timeout) => {
  9329. const { length } = signals = signals ? signals.filter(Boolean) : [];
  9330. if (timeout || length) {
  9331. let controller = new AbortController();
  9332. let aborted;
  9333. const onabort = function(reason) {
  9334. if (!aborted) {
  9335. aborted = true;
  9336. unsubscribe();
  9337. const err = reason instanceof Error ? reason : this.reason;
  9338. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  9339. }
  9340. };
  9341. let timer = timeout && setTimeout(() => {
  9342. timer = null;
  9343. onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
  9344. }, timeout);
  9345. const unsubscribe = () => {
  9346. if (signals) {
  9347. timer && clearTimeout(timer);
  9348. timer = null;
  9349. signals.forEach((signal2) => {
  9350. signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
  9351. });
  9352. signals = null;
  9353. }
  9354. };
  9355. signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
  9356. const { signal } = controller;
  9357. signal.unsubscribe = () => utils$4.asap(unsubscribe);
  9358. return signal;
  9359. }
  9360. };
  9361. const composeSignals$1 = composeSignals;
  9362. const streamChunk = function* (chunk, chunkSize) {
  9363. let len = chunk.byteLength;
  9364. if (!chunkSize || len < chunkSize) {
  9365. yield chunk;
  9366. return;
  9367. }
  9368. let pos = 0;
  9369. let end;
  9370. while (pos < len) {
  9371. end = pos + chunkSize;
  9372. yield chunk.slice(pos, end);
  9373. pos = end;
  9374. }
  9375. };
  9376. const readBytes = async function* (iterable, chunkSize) {
  9377. for await (const chunk of readStream(iterable)) {
  9378. yield* streamChunk(chunk, chunkSize);
  9379. }
  9380. };
  9381. const readStream = async function* (stream) {
  9382. if (stream[Symbol.asyncIterator]) {
  9383. yield* stream;
  9384. return;
  9385. }
  9386. const reader = stream.getReader();
  9387. try {
  9388. for (; ; ) {
  9389. const { done, value } = await reader.read();
  9390. if (done) {
  9391. break;
  9392. }
  9393. yield value;
  9394. }
  9395. } finally {
  9396. await reader.cancel();
  9397. }
  9398. };
  9399. const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  9400. const iterator2 = readBytes(stream, chunkSize);
  9401. let bytes = 0;
  9402. let done;
  9403. let _onFinish = (e) => {
  9404. if (!done) {
  9405. done = true;
  9406. onFinish && onFinish(e);
  9407. }
  9408. };
  9409. return new ReadableStream({
  9410. async pull(controller) {
  9411. try {
  9412. const { done: done2, value } = await iterator2.next();
  9413. if (done2) {
  9414. _onFinish();
  9415. controller.close();
  9416. return;
  9417. }
  9418. let len = value.byteLength;
  9419. if (onProgress) {
  9420. let loadedBytes = bytes += len;
  9421. onProgress(loadedBytes);
  9422. }
  9423. controller.enqueue(new Uint8Array(value));
  9424. } catch (err) {
  9425. _onFinish(err);
  9426. throw err;
  9427. }
  9428. },
  9429. cancel(reason) {
  9430. _onFinish(reason);
  9431. return iterator2.return();
  9432. }
  9433. }, {
  9434. highWaterMark: 2
  9435. });
  9436. };
  9437. const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
  9438. const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
  9439. const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder2) => (str) => encoder2.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
  9440. const test = (fn, ...args) => {
  9441. try {
  9442. return !!fn(...args);
  9443. } catch (e) {
  9444. return false;
  9445. }
  9446. };
  9447. const supportsRequestStream = isReadableStreamSupported && test(() => {
  9448. let duplexAccessed = false;
  9449. const hasContentType = new Request(platform.origin, {
  9450. body: new ReadableStream(),
  9451. method: "POST",
  9452. get duplex() {
  9453. duplexAccessed = true;
  9454. return "half";
  9455. }
  9456. }).headers.has("Content-Type");
  9457. return duplexAccessed && !hasContentType;
  9458. });
  9459. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  9460. const supportsResponseStream = isReadableStreamSupported && test(() => utils$4.isReadableStream(new Response("").body));
  9461. const resolvers = {
  9462. stream: supportsResponseStream && ((res) => res.body)
  9463. };
  9464. isFetchSupported && ((res) => {
  9465. ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
  9466. !resolvers[type] && (resolvers[type] = utils$4.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
  9467. throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
  9468. });
  9469. });
  9470. })(new Response());
  9471. const getBodyLength = async (body) => {
  9472. if (body == null) {
  9473. return 0;
  9474. }
  9475. if (utils$4.isBlob(body)) {
  9476. return body.size;
  9477. }
  9478. if (utils$4.isSpecCompliantForm(body)) {
  9479. const _request = new Request(platform.origin, {
  9480. method: "POST",
  9481. body
  9482. });
  9483. return (await _request.arrayBuffer()).byteLength;
  9484. }
  9485. if (utils$4.isArrayBufferView(body) || utils$4.isArrayBuffer(body)) {
  9486. return body.byteLength;
  9487. }
  9488. if (utils$4.isURLSearchParams(body)) {
  9489. body = body + "";
  9490. }
  9491. if (utils$4.isString(body)) {
  9492. return (await encodeText(body)).byteLength;
  9493. }
  9494. };
  9495. const resolveBodyLength = async (headers, body) => {
  9496. const length = utils$4.toFiniteNumber(headers.getContentLength());
  9497. return length == null ? getBodyLength(body) : length;
  9498. };
  9499. const fetchAdapter = isFetchSupported && (async (config) => {
  9500. let {
  9501. url,
  9502. method,
  9503. data,
  9504. signal,
  9505. cancelToken,
  9506. timeout,
  9507. onDownloadProgress,
  9508. onUploadProgress,
  9509. responseType,
  9510. headers,
  9511. withCredentials = "same-origin",
  9512. fetchOptions
  9513. } = resolveConfig(config);
  9514. responseType = responseType ? (responseType + "").toLowerCase() : "text";
  9515. let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  9516. let request;
  9517. const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
  9518. composedSignal.unsubscribe();
  9519. });
  9520. let requestContentLength;
  9521. try {
  9522. if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
  9523. let _request = new Request(url, {
  9524. method: "POST",
  9525. body: data,
  9526. duplex: "half"
  9527. });
  9528. let contentTypeHeader;
  9529. if (utils$4.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
  9530. headers.setContentType(contentTypeHeader);
  9531. }
  9532. if (_request.body) {
  9533. const [onProgress, flush] = progressEventDecorator(
  9534. requestContentLength,
  9535. progressEventReducer(asyncDecorator(onUploadProgress))
  9536. );
  9537. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  9538. }
  9539. }
  9540. if (!utils$4.isString(withCredentials)) {
  9541. withCredentials = withCredentials ? "include" : "omit";
  9542. }
  9543. const isCredentialsSupported = "credentials" in Request.prototype;
  9544. request = new Request(url, {
  9545. ...fetchOptions,
  9546. signal: composedSignal,
  9547. method: method.toUpperCase(),
  9548. headers: headers.normalize().toJSON(),
  9549. body: data,
  9550. duplex: "half",
  9551. credentials: isCredentialsSupported ? withCredentials : void 0
  9552. });
  9553. let response = await fetch(request, fetchOptions);
  9554. const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
  9555. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  9556. const options = {};
  9557. ["status", "statusText", "headers"].forEach((prop) => {
  9558. options[prop] = response[prop];
  9559. });
  9560. const responseContentLength = utils$4.toFiniteNumber(response.headers.get("content-length"));
  9561. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  9562. responseContentLength,
  9563. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  9564. ) || [];
  9565. response = new Response(
  9566. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  9567. flush && flush();
  9568. unsubscribe && unsubscribe();
  9569. }),
  9570. options
  9571. );
  9572. }
  9573. responseType = responseType || "text";
  9574. let responseData = await resolvers[utils$4.findKey(resolvers, responseType) || "text"](response, config);
  9575. !isStreamResponse && unsubscribe && unsubscribe();
  9576. return await new Promise((resolve, reject) => {
  9577. settle$2(resolve, reject, {
  9578. data: responseData,
  9579. headers: AxiosHeaders$1.from(response.headers),
  9580. status: response.status,
  9581. statusText: response.statusText,
  9582. config,
  9583. request
  9584. });
  9585. });
  9586. } catch (err) {
  9587. unsubscribe && unsubscribe();
  9588. if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
  9589. throw Object.assign(
  9590. new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
  9591. {
  9592. cause: err.cause || err
  9593. }
  9594. );
  9595. }
  9596. throw AxiosError.from(err, err && err.code, config, request);
  9597. }
  9598. });
  9599. const knownAdapters = {
  9600. http: httpAdapter,
  9601. xhr: xhrAdapter,
  9602. fetch: fetchAdapter
  9603. };
  9604. utils$4.forEach(knownAdapters, (fn, value) => {
  9605. if (fn) {
  9606. try {
  9607. Object.defineProperty(fn, "name", { value });
  9608. } catch (e) {
  9609. }
  9610. Object.defineProperty(fn, "adapterName", { value });
  9611. }
  9612. });
  9613. const renderReason = (reason) => `- ${reason}`;
  9614. const isResolvedHandle = (adapter) => utils$4.isFunction(adapter) || adapter === null || adapter === false;
  9615. const adapters = {
  9616. getAdapter: (adapters2) => {
  9617. adapters2 = utils$4.isArray(adapters2) ? adapters2 : [adapters2];
  9618. const { length } = adapters2;
  9619. let nameOrAdapter;
  9620. let adapter;
  9621. const rejectedReasons = {};
  9622. for (let i = 0; i < length; i++) {
  9623. nameOrAdapter = adapters2[i];
  9624. let id;
  9625. adapter = nameOrAdapter;
  9626. if (!isResolvedHandle(nameOrAdapter)) {
  9627. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  9628. if (adapter === void 0) {
  9629. throw new AxiosError(`Unknown adapter '${id}'`);
  9630. }
  9631. }
  9632. if (adapter) {
  9633. break;
  9634. }
  9635. rejectedReasons[id || "#" + i] = adapter;
  9636. }
  9637. if (!adapter) {
  9638. const reasons = Object.entries(rejectedReasons).map(
  9639. ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
  9640. );
  9641. let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
  9642. throw new AxiosError(
  9643. `There is no suitable adapter to dispatch the request ` + s,
  9644. "ERR_NOT_SUPPORT"
  9645. );
  9646. }
  9647. return adapter;
  9648. },
  9649. adapters: knownAdapters
  9650. };
  9651. function throwIfCancellationRequested(config) {
  9652. if (config.cancelToken) {
  9653. config.cancelToken.throwIfRequested();
  9654. }
  9655. if (config.signal && config.signal.aborted) {
  9656. throw new CanceledError(null, config);
  9657. }
  9658. }
  9659. function dispatchRequest(config) {
  9660. throwIfCancellationRequested(config);
  9661. config.headers = AxiosHeaders$1.from(config.headers);
  9662. config.data = transformData.call(
  9663. config,
  9664. config.transformRequest
  9665. );
  9666. if (["post", "put", "patch"].indexOf(config.method) !== -1) {
  9667. config.headers.setContentType("application/x-www-form-urlencoded", false);
  9668. }
  9669. const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  9670. return adapter(config).then(function onAdapterResolution(response) {
  9671. throwIfCancellationRequested(config);
  9672. response.data = transformData.call(
  9673. config,
  9674. config.transformResponse,
  9675. response
  9676. );
  9677. response.headers = AxiosHeaders$1.from(response.headers);
  9678. return response;
  9679. }, function onAdapterRejection(reason) {
  9680. if (!isCancel(reason)) {
  9681. throwIfCancellationRequested(config);
  9682. if (reason && reason.response) {
  9683. reason.response.data = transformData.call(
  9684. config,
  9685. config.transformResponse,
  9686. reason.response
  9687. );
  9688. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  9689. }
  9690. }
  9691. return Promise.reject(reason);
  9692. });
  9693. }
  9694. const VERSION = "1.10.0";
  9695. const validators$1 = {};
  9696. ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
  9697. validators$1[type] = function validator2(thing) {
  9698. return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
  9699. };
  9700. });
  9701. const deprecatedWarnings = {};
  9702. validators$1.transitional = function transitional(validator2, version2, message) {
  9703. function formatMessage2(opt, desc) {
  9704. return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  9705. }
  9706. return (value, opt, opts) => {
  9707. if (validator2 === false) {
  9708. throw new AxiosError(
  9709. formatMessage2(opt, " has been removed" + (version2 ? " in " + version2 : "")),
  9710. AxiosError.ERR_DEPRECATED
  9711. );
  9712. }
  9713. if (version2 && !deprecatedWarnings[opt]) {
  9714. deprecatedWarnings[opt] = true;
  9715. index.__f__(
  9716. "warn",
  9717. "at node_modules/axios/lib/helpers/validator.js:43",
  9718. formatMessage2(
  9719. opt,
  9720. " has been deprecated since v" + version2 + " and will be removed in the near future"
  9721. )
  9722. );
  9723. }
  9724. return validator2 ? validator2(value, opt, opts) : true;
  9725. };
  9726. };
  9727. validators$1.spelling = function spelling(correctSpelling) {
  9728. return (value, opt) => {
  9729. index.__f__("warn", "at node_modules/axios/lib/helpers/validator.js:58", `${opt} is likely a misspelling of ${correctSpelling}`);
  9730. return true;
  9731. };
  9732. };
  9733. function assertOptions(options, schema, allowUnknown) {
  9734. if (typeof options !== "object") {
  9735. throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
  9736. }
  9737. const keys = Object.keys(options);
  9738. let i = keys.length;
  9739. while (i-- > 0) {
  9740. const opt = keys[i];
  9741. const validator2 = schema[opt];
  9742. if (validator2) {
  9743. const value = options[opt];
  9744. const result = value === void 0 || validator2(value, opt, options);
  9745. if (result !== true) {
  9746. throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
  9747. }
  9748. continue;
  9749. }
  9750. if (allowUnknown !== true) {
  9751. throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
  9752. }
  9753. }
  9754. }
  9755. const validator = {
  9756. assertOptions,
  9757. validators: validators$1
  9758. };
  9759. const validators = validator.validators;
  9760. class Axios {
  9761. constructor(instanceConfig) {
  9762. this.defaults = instanceConfig || {};
  9763. this.interceptors = {
  9764. request: new InterceptorManager(),
  9765. response: new InterceptorManager()
  9766. };
  9767. }
  9768. /**
  9769. * Dispatch a request
  9770. *
  9771. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  9772. * @param {?Object} config
  9773. *
  9774. * @returns {Promise} The Promise to be fulfilled
  9775. */
  9776. async request(configOrUrl, config) {
  9777. try {
  9778. return await this._request(configOrUrl, config);
  9779. } catch (err) {
  9780. if (err instanceof Error) {
  9781. let dummy = {};
  9782. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  9783. const stack2 = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
  9784. try {
  9785. if (!err.stack) {
  9786. err.stack = stack2;
  9787. } else if (stack2 && !String(err.stack).endsWith(stack2.replace(/^.+\n.+\n/, ""))) {
  9788. err.stack += "\n" + stack2;
  9789. }
  9790. } catch (e) {
  9791. }
  9792. }
  9793. throw err;
  9794. }
  9795. }
  9796. _request(configOrUrl, config) {
  9797. if (typeof configOrUrl === "string") {
  9798. config = config || {};
  9799. config.url = configOrUrl;
  9800. } else {
  9801. config = configOrUrl || {};
  9802. }
  9803. config = mergeConfig(this.defaults, config);
  9804. const { transitional: transitional2, paramsSerializer, headers } = config;
  9805. if (transitional2 !== void 0) {
  9806. validator.assertOptions(transitional2, {
  9807. silentJSONParsing: validators.transitional(validators.boolean),
  9808. forcedJSONParsing: validators.transitional(validators.boolean),
  9809. clarifyTimeoutError: validators.transitional(validators.boolean)
  9810. }, false);
  9811. }
  9812. if (paramsSerializer != null) {
  9813. if (utils$4.isFunction(paramsSerializer)) {
  9814. config.paramsSerializer = {
  9815. serialize: paramsSerializer
  9816. };
  9817. } else {
  9818. validator.assertOptions(paramsSerializer, {
  9819. encode: validators.function,
  9820. serialize: validators.function
  9821. }, true);
  9822. }
  9823. }
  9824. if (config.allowAbsoluteUrls !== void 0)
  9825. ;
  9826. else if (this.defaults.allowAbsoluteUrls !== void 0) {
  9827. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  9828. } else {
  9829. config.allowAbsoluteUrls = true;
  9830. }
  9831. validator.assertOptions(config, {
  9832. baseUrl: validators.spelling("baseURL"),
  9833. withXsrfToken: validators.spelling("withXSRFToken")
  9834. }, true);
  9835. config.method = (config.method || this.defaults.method || "get").toLowerCase();
  9836. let contextHeaders = headers && utils$4.merge(
  9837. headers.common,
  9838. headers[config.method]
  9839. );
  9840. headers && utils$4.forEach(
  9841. ["delete", "get", "head", "post", "put", "patch", "common"],
  9842. (method) => {
  9843. delete headers[method];
  9844. }
  9845. );
  9846. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  9847. const requestInterceptorChain = [];
  9848. let synchronousRequestInterceptors = true;
  9849. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  9850. if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
  9851. return;
  9852. }
  9853. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  9854. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  9855. });
  9856. const responseInterceptorChain = [];
  9857. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  9858. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  9859. });
  9860. let promise;
  9861. let i = 0;
  9862. let len;
  9863. if (!synchronousRequestInterceptors) {
  9864. const chain = [dispatchRequest.bind(this), void 0];
  9865. chain.unshift.apply(chain, requestInterceptorChain);
  9866. chain.push.apply(chain, responseInterceptorChain);
  9867. len = chain.length;
  9868. promise = Promise.resolve(config);
  9869. while (i < len) {
  9870. promise = promise.then(chain[i++], chain[i++]);
  9871. }
  9872. return promise;
  9873. }
  9874. len = requestInterceptorChain.length;
  9875. let newConfig = config;
  9876. i = 0;
  9877. while (i < len) {
  9878. const onFulfilled = requestInterceptorChain[i++];
  9879. const onRejected = requestInterceptorChain[i++];
  9880. try {
  9881. newConfig = onFulfilled(newConfig);
  9882. } catch (error) {
  9883. onRejected.call(this, error);
  9884. break;
  9885. }
  9886. }
  9887. try {
  9888. promise = dispatchRequest.call(this, newConfig);
  9889. } catch (error) {
  9890. return Promise.reject(error);
  9891. }
  9892. i = 0;
  9893. len = responseInterceptorChain.length;
  9894. while (i < len) {
  9895. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  9896. }
  9897. return promise;
  9898. }
  9899. getUri(config) {
  9900. config = mergeConfig(this.defaults, config);
  9901. const fullPath = buildFullPath$2(config.baseURL, config.url, config.allowAbsoluteUrls);
  9902. return buildURL$2(fullPath, config.params, config.paramsSerializer);
  9903. }
  9904. }
  9905. utils$4.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
  9906. Axios.prototype[method] = function(url, config) {
  9907. return this.request(mergeConfig(config || {}, {
  9908. method,
  9909. url,
  9910. data: (config || {}).data
  9911. }));
  9912. };
  9913. });
  9914. utils$4.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
  9915. function generateHTTPMethod(isForm) {
  9916. return function httpMethod(url, data, config) {
  9917. return this.request(mergeConfig(config || {}, {
  9918. method,
  9919. headers: isForm ? {
  9920. "Content-Type": "multipart/form-data"
  9921. } : {},
  9922. url,
  9923. data
  9924. }));
  9925. };
  9926. }
  9927. Axios.prototype[method] = generateHTTPMethod();
  9928. Axios.prototype[method + "Form"] = generateHTTPMethod(true);
  9929. });
  9930. const Axios$1 = Axios;
  9931. class CancelToken {
  9932. constructor(executor) {
  9933. if (typeof executor !== "function") {
  9934. throw new TypeError("executor must be a function.");
  9935. }
  9936. let resolvePromise;
  9937. this.promise = new Promise(function promiseExecutor(resolve) {
  9938. resolvePromise = resolve;
  9939. });
  9940. const token = this;
  9941. this.promise.then((cancel) => {
  9942. if (!token._listeners)
  9943. return;
  9944. let i = token._listeners.length;
  9945. while (i-- > 0) {
  9946. token._listeners[i](cancel);
  9947. }
  9948. token._listeners = null;
  9949. });
  9950. this.promise.then = (onfulfilled) => {
  9951. let _resolve;
  9952. const promise = new Promise((resolve) => {
  9953. token.subscribe(resolve);
  9954. _resolve = resolve;
  9955. }).then(onfulfilled);
  9956. promise.cancel = function reject() {
  9957. token.unsubscribe(_resolve);
  9958. };
  9959. return promise;
  9960. };
  9961. executor(function cancel(message, config, request) {
  9962. if (token.reason) {
  9963. return;
  9964. }
  9965. token.reason = new CanceledError(message, config, request);
  9966. resolvePromise(token.reason);
  9967. });
  9968. }
  9969. /**
  9970. * Throws a `CanceledError` if cancellation has been requested.
  9971. */
  9972. throwIfRequested() {
  9973. if (this.reason) {
  9974. throw this.reason;
  9975. }
  9976. }
  9977. /**
  9978. * Subscribe to the cancel signal
  9979. */
  9980. subscribe(listener) {
  9981. if (this.reason) {
  9982. listener(this.reason);
  9983. return;
  9984. }
  9985. if (this._listeners) {
  9986. this._listeners.push(listener);
  9987. } else {
  9988. this._listeners = [listener];
  9989. }
  9990. }
  9991. /**
  9992. * Unsubscribe from the cancel signal
  9993. */
  9994. unsubscribe(listener) {
  9995. if (!this._listeners) {
  9996. return;
  9997. }
  9998. const index2 = this._listeners.indexOf(listener);
  9999. if (index2 !== -1) {
  10000. this._listeners.splice(index2, 1);
  10001. }
  10002. }
  10003. toAbortSignal() {
  10004. const controller = new AbortController();
  10005. const abort = (err) => {
  10006. controller.abort(err);
  10007. };
  10008. this.subscribe(abort);
  10009. controller.signal.unsubscribe = () => this.unsubscribe(abort);
  10010. return controller.signal;
  10011. }
  10012. /**
  10013. * Returns an object that contains a new `CancelToken` and a function that, when called,
  10014. * cancels the `CancelToken`.
  10015. */
  10016. static source() {
  10017. let cancel;
  10018. const token = new CancelToken(function executor(c) {
  10019. cancel = c;
  10020. });
  10021. return {
  10022. token,
  10023. cancel
  10024. };
  10025. }
  10026. }
  10027. const CancelToken$1 = CancelToken;
  10028. function spread(callback) {
  10029. return function wrap(arr) {
  10030. return callback.apply(null, arr);
  10031. };
  10032. }
  10033. function isAxiosError(payload) {
  10034. return utils$4.isObject(payload) && payload.isAxiosError === true;
  10035. }
  10036. const HttpStatusCode = {
  10037. Continue: 100,
  10038. SwitchingProtocols: 101,
  10039. Processing: 102,
  10040. EarlyHints: 103,
  10041. Ok: 200,
  10042. Created: 201,
  10043. Accepted: 202,
  10044. NonAuthoritativeInformation: 203,
  10045. NoContent: 204,
  10046. ResetContent: 205,
  10047. PartialContent: 206,
  10048. MultiStatus: 207,
  10049. AlreadyReported: 208,
  10050. ImUsed: 226,
  10051. MultipleChoices: 300,
  10052. MovedPermanently: 301,
  10053. Found: 302,
  10054. SeeOther: 303,
  10055. NotModified: 304,
  10056. UseProxy: 305,
  10057. Unused: 306,
  10058. TemporaryRedirect: 307,
  10059. PermanentRedirect: 308,
  10060. BadRequest: 400,
  10061. Unauthorized: 401,
  10062. PaymentRequired: 402,
  10063. Forbidden: 403,
  10064. NotFound: 404,
  10065. MethodNotAllowed: 405,
  10066. NotAcceptable: 406,
  10067. ProxyAuthenticationRequired: 407,
  10068. RequestTimeout: 408,
  10069. Conflict: 409,
  10070. Gone: 410,
  10071. LengthRequired: 411,
  10072. PreconditionFailed: 412,
  10073. PayloadTooLarge: 413,
  10074. UriTooLong: 414,
  10075. UnsupportedMediaType: 415,
  10076. RangeNotSatisfiable: 416,
  10077. ExpectationFailed: 417,
  10078. ImATeapot: 418,
  10079. MisdirectedRequest: 421,
  10080. UnprocessableEntity: 422,
  10081. Locked: 423,
  10082. FailedDependency: 424,
  10083. TooEarly: 425,
  10084. UpgradeRequired: 426,
  10085. PreconditionRequired: 428,
  10086. TooManyRequests: 429,
  10087. RequestHeaderFieldsTooLarge: 431,
  10088. UnavailableForLegalReasons: 451,
  10089. InternalServerError: 500,
  10090. NotImplemented: 501,
  10091. BadGateway: 502,
  10092. ServiceUnavailable: 503,
  10093. GatewayTimeout: 504,
  10094. HttpVersionNotSupported: 505,
  10095. VariantAlsoNegotiates: 506,
  10096. InsufficientStorage: 507,
  10097. LoopDetected: 508,
  10098. NotExtended: 510,
  10099. NetworkAuthenticationRequired: 511
  10100. };
  10101. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  10102. HttpStatusCode[value] = key;
  10103. });
  10104. const HttpStatusCode$1 = HttpStatusCode;
  10105. function createInstance(defaultConfig) {
  10106. const context = new Axios$1(defaultConfig);
  10107. const instance = bind$2(Axios$1.prototype.request, context);
  10108. utils$4.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
  10109. utils$4.extend(instance, context, null, { allOwnKeys: true });
  10110. instance.create = function create(instanceConfig) {
  10111. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  10112. };
  10113. return instance;
  10114. }
  10115. const axios = createInstance(defaults$1);
  10116. axios.Axios = Axios$1;
  10117. axios.CanceledError = CanceledError;
  10118. axios.CancelToken = CancelToken$1;
  10119. axios.isCancel = isCancel;
  10120. axios.VERSION = VERSION;
  10121. axios.toFormData = toFormData;
  10122. axios.AxiosError = AxiosError;
  10123. axios.Cancel = axios.CanceledError;
  10124. axios.all = function all(promises) {
  10125. return Promise.all(promises);
  10126. };
  10127. axios.spread = spread;
  10128. axios.isAxiosError = isAxiosError;
  10129. axios.mergeConfig = mergeConfig;
  10130. axios.AxiosHeaders = AxiosHeaders$1;
  10131. axios.formToJSON = (thing) => formDataToJSON(utils$4.isHTMLForm(thing) ? new FormData(thing) : thing);
  10132. axios.getAdapter = adapters.getAdapter;
  10133. axios.HttpStatusCode = HttpStatusCode$1;
  10134. axios.default = axios;
  10135. function getDefaultExportFromCjs(x) {
  10136. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  10137. }
  10138. var bind$1 = function bind(fn, thisArg) {
  10139. return function wrap() {
  10140. var args = new Array(arguments.length);
  10141. for (var i = 0; i < args.length; i++) {
  10142. args[i] = arguments[i];
  10143. }
  10144. return fn.apply(thisArg, args);
  10145. };
  10146. };
  10147. var bind2 = bind$1;
  10148. var toString2 = Object.prototype.toString;
  10149. function isArray(val) {
  10150. return toString2.call(val) === "[object Array]";
  10151. }
  10152. function isUndefined(val) {
  10153. return typeof val === "undefined";
  10154. }
  10155. function isBuffer(val) {
  10156. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
  10157. }
  10158. function isArrayBuffer(val) {
  10159. return toString2.call(val) === "[object ArrayBuffer]";
  10160. }
  10161. function isFormData(val) {
  10162. return typeof FormData !== "undefined" && val instanceof FormData;
  10163. }
  10164. function isArrayBufferView(val) {
  10165. var result;
  10166. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  10167. result = ArrayBuffer.isView(val);
  10168. } else {
  10169. result = val && val.buffer && val.buffer instanceof ArrayBuffer;
  10170. }
  10171. return result;
  10172. }
  10173. function isString(val) {
  10174. return typeof val === "string";
  10175. }
  10176. function isNumber(val) {
  10177. return typeof val === "number";
  10178. }
  10179. function isObject(val) {
  10180. return val !== null && typeof val === "object";
  10181. }
  10182. function isDate(val) {
  10183. return toString2.call(val) === "[object Date]";
  10184. }
  10185. function isFile(val) {
  10186. return toString2.call(val) === "[object File]";
  10187. }
  10188. function isBlob(val) {
  10189. return toString2.call(val) === "[object Blob]";
  10190. }
  10191. function isFunction(val) {
  10192. return toString2.call(val) === "[object Function]";
  10193. }
  10194. function isStream(val) {
  10195. return isObject(val) && isFunction(val.pipe);
  10196. }
  10197. function isURLSearchParams(val) {
  10198. return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
  10199. }
  10200. function trim(str) {
  10201. return str.replace(/^\s*/, "").replace(/\s*$/, "");
  10202. }
  10203. function isStandardBrowserEnv() {
  10204. if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
  10205. return false;
  10206. }
  10207. return typeof window !== "undefined" && typeof document !== "undefined";
  10208. }
  10209. function forEach(obj, fn) {
  10210. if (obj === null || typeof obj === "undefined") {
  10211. return;
  10212. }
  10213. if (typeof obj !== "object") {
  10214. obj = [obj];
  10215. }
  10216. if (isArray(obj)) {
  10217. for (var i = 0, l = obj.length; i < l; i++) {
  10218. fn.call(null, obj[i], i, obj);
  10219. }
  10220. } else {
  10221. for (var key in obj) {
  10222. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  10223. fn.call(null, obj[key], key, obj);
  10224. }
  10225. }
  10226. }
  10227. }
  10228. function merge() {
  10229. var result = {};
  10230. function assignValue(val, key) {
  10231. if (typeof result[key] === "object" && typeof val === "object") {
  10232. result[key] = merge(result[key], val);
  10233. } else {
  10234. result[key] = val;
  10235. }
  10236. }
  10237. for (var i = 0, l = arguments.length; i < l; i++) {
  10238. forEach(arguments[i], assignValue);
  10239. }
  10240. return result;
  10241. }
  10242. function deepMerge() {
  10243. var result = {};
  10244. function assignValue(val, key) {
  10245. if (typeof result[key] === "object" && typeof val === "object") {
  10246. result[key] = deepMerge(result[key], val);
  10247. } else if (typeof val === "object") {
  10248. result[key] = deepMerge({}, val);
  10249. } else {
  10250. result[key] = val;
  10251. }
  10252. }
  10253. for (var i = 0, l = arguments.length; i < l; i++) {
  10254. forEach(arguments[i], assignValue);
  10255. }
  10256. return result;
  10257. }
  10258. function extend(a, b, thisArg) {
  10259. forEach(b, function assignValue(val, key) {
  10260. if (thisArg && typeof val === "function") {
  10261. a[key] = bind2(val, thisArg);
  10262. } else {
  10263. a[key] = val;
  10264. }
  10265. });
  10266. return a;
  10267. }
  10268. var utils$1 = {
  10269. isArray,
  10270. isArrayBuffer,
  10271. isBuffer,
  10272. isFormData,
  10273. isArrayBufferView,
  10274. isString,
  10275. isNumber,
  10276. isObject,
  10277. isUndefined,
  10278. isDate,
  10279. isFile,
  10280. isBlob,
  10281. isFunction,
  10282. isStream,
  10283. isURLSearchParams,
  10284. isStandardBrowserEnv,
  10285. forEach,
  10286. merge,
  10287. deepMerge,
  10288. extend,
  10289. trim
  10290. };
  10291. const utils$2 = /* @__PURE__ */ getDefaultExportFromCjs(utils$1);
  10292. var enhanceError$1 = function enhanceError(error, config, code, request, response) {
  10293. error.config = config;
  10294. if (code) {
  10295. error.code = code;
  10296. }
  10297. error.request = request;
  10298. error.response = response;
  10299. error.isAxiosError = true;
  10300. error.toJSON = function() {
  10301. return {
  10302. // Standard
  10303. message: this.message,
  10304. name: this.name,
  10305. // Microsoft
  10306. description: this.description,
  10307. number: this.number,
  10308. // Mozilla
  10309. fileName: this.fileName,
  10310. lineNumber: this.lineNumber,
  10311. columnNumber: this.columnNumber,
  10312. stack: this.stack,
  10313. // Axios
  10314. config: this.config,
  10315. code: this.code
  10316. };
  10317. };
  10318. return error;
  10319. };
  10320. var enhanceError2 = enhanceError$1;
  10321. var createError$1 = function createError(message, config, code, request, response) {
  10322. var error = new Error(message);
  10323. return enhanceError2(error, config, code, request, response);
  10324. };
  10325. const createError$2 = /* @__PURE__ */ getDefaultExportFromCjs(createError$1);
  10326. var createError2 = createError$1;
  10327. var settle = function settle2(resolve, reject, response) {
  10328. var validateStatus2 = response.config.validateStatus;
  10329. if (!validateStatus2 || validateStatus2(response.status)) {
  10330. resolve(response);
  10331. } else {
  10332. reject(createError2(
  10333. "Request failed with status code " + response.status,
  10334. response.config,
  10335. null,
  10336. response.request,
  10337. response
  10338. ));
  10339. }
  10340. };
  10341. const settle$1 = /* @__PURE__ */ getDefaultExportFromCjs(settle);
  10342. var utils = utils$1;
  10343. function encode(val) {
  10344. return encodeURIComponent(val).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  10345. }
  10346. var buildURL = function buildURL2(url, params, paramsSerializer) {
  10347. if (!params) {
  10348. return url;
  10349. }
  10350. var serializedParams;
  10351. if (paramsSerializer) {
  10352. serializedParams = paramsSerializer(params);
  10353. } else if (utils.isURLSearchParams(params)) {
  10354. serializedParams = params.toString();
  10355. } else {
  10356. var parts = [];
  10357. utils.forEach(params, function serialize(val, key) {
  10358. if (val === null || typeof val === "undefined") {
  10359. return;
  10360. }
  10361. if (utils.isArray(val)) {
  10362. key = key + "[]";
  10363. } else {
  10364. val = [val];
  10365. }
  10366. utils.forEach(val, function parseValue(v) {
  10367. if (utils.isDate(v)) {
  10368. v = v.toISOString();
  10369. } else if (utils.isObject(v)) {
  10370. v = JSON.stringify(v);
  10371. }
  10372. parts.push(encode(key) + "=" + encode(v));
  10373. });
  10374. });
  10375. serializedParams = parts.join("&");
  10376. }
  10377. if (serializedParams) {
  10378. var hashmarkIndex = url.indexOf("#");
  10379. if (hashmarkIndex !== -1) {
  10380. url = url.slice(0, hashmarkIndex);
  10381. }
  10382. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  10383. }
  10384. return url;
  10385. };
  10386. const buildURL$1 = /* @__PURE__ */ getDefaultExportFromCjs(buildURL);
  10387. var isAbsoluteURL$1 = function isAbsoluteURL(url) {
  10388. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  10389. };
  10390. var combineURLs$1 = function combineURLs(baseURL, relativeURL) {
  10391. return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  10392. };
  10393. var isAbsoluteURL2 = isAbsoluteURL$1;
  10394. var combineURLs2 = combineURLs$1;
  10395. var buildFullPath = function buildFullPath2(baseURL, requestedURL) {
  10396. if (baseURL && !isAbsoluteURL2(requestedURL)) {
  10397. return combineURLs2(baseURL, requestedURL);
  10398. }
  10399. return requestedURL;
  10400. };
  10401. const buildFullPath$1 = /* @__PURE__ */ getDefaultExportFromCjs(buildFullPath);
  10402. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  10403. function encoder(input) {
  10404. var str = String(input);
  10405. var block;
  10406. var charCode;
  10407. var idx = 0;
  10408. var map = chars;
  10409. var output = "";
  10410. for (
  10411. ;
  10412. // if the next str index does not exist:
  10413. // change the mapping table to "="
  10414. // check if d has no fractional digits
  10415. str.charAt(idx | 0) || (map = "=", idx % 1);
  10416. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  10417. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  10418. ) {
  10419. charCode = str.charCodeAt(idx += 3 / 4);
  10420. if (charCode > 255) {
  10421. throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
  10422. }
  10423. block = block << 8 | charCode;
  10424. }
  10425. return output;
  10426. }
  10427. var platFormName = "wechat";
  10428. function getRequest() {
  10429. switch (true) {
  10430. case typeof wx$1 === "object":
  10431. platFormName = "wechat";
  10432. return wx$1.request.bind(wx$1);
  10433. case typeof swan === "object":
  10434. platFormName = "baidu";
  10435. return swan.request.bind(swan);
  10436. case typeof dd === "object":
  10437. platFormName = "dd";
  10438. return dd.httpRequest.bind(dd);
  10439. case typeof my === "object":
  10440. platFormName = "alipay";
  10441. return (my.request || my.httpRequest).bind(my);
  10442. default:
  10443. return wx$1.request.bind(wx$1);
  10444. }
  10445. }
  10446. function transformResponse2(mpResponse, config, mpRequestOption) {
  10447. var headers = mpResponse.header || mpResponse.headers;
  10448. var status = mpResponse.statusCode || mpResponse.status;
  10449. var statusText = "";
  10450. if (status === 200) {
  10451. statusText = "OK";
  10452. } else if (status === 400) {
  10453. statusText = "Bad Request";
  10454. }
  10455. var response = {
  10456. data: mpResponse.data,
  10457. status,
  10458. statusText,
  10459. headers,
  10460. config,
  10461. request: mpRequestOption
  10462. };
  10463. return response;
  10464. }
  10465. function transformError(error, reject, config) {
  10466. switch (platFormName) {
  10467. case "wechat":
  10468. if (error.errMsg.indexOf("request:fail abort") !== -1) {
  10469. reject(createError$2("Request aborted", config, "ECONNABORTED", ""));
  10470. } else if (error.errMsg.indexOf("timeout") !== -1) {
  10471. reject(createError$2("timeout of " + config.timeout + "ms exceeded", config, "ECONNABORTED", ""));
  10472. } else {
  10473. reject(createError$2("Network Error", config, null, ""));
  10474. }
  10475. break;
  10476. case "dd":
  10477. case "alipay":
  10478. if ([14, 19].includes(error.error)) {
  10479. reject(createError$2("Request aborted", config, "ECONNABORTED", "", error));
  10480. } else if ([13].includes(error.error)) {
  10481. reject(createError$2("timeout of " + config.timeout + "ms exceeded", config, "ECONNABORTED", "", error));
  10482. } else {
  10483. reject(createError$2("Network Error", config, null, "", error));
  10484. }
  10485. break;
  10486. case "baidu":
  10487. reject(createError$2("Network Error", config, null, ""));
  10488. break;
  10489. }
  10490. }
  10491. function transformConfig(config) {
  10492. var _a;
  10493. if ([
  10494. "alipay",
  10495. "dd"
  10496. /* 钉钉 */
  10497. ].includes(platFormName)) {
  10498. config.headers = config.header;
  10499. delete config.header;
  10500. if ("dd" === platFormName && config.method !== "GET" && ((_a = config.headers) === null || _a === void 0 ? void 0 : _a["Content-Type"]) === "application/json" && Object.prototype.toString.call(config.data) === "[object Object]") {
  10501. config.data = JSON.stringify(config.data);
  10502. }
  10503. }
  10504. return config;
  10505. }
  10506. var isJSONstr = function(str) {
  10507. try {
  10508. return typeof str === "string" && str.length && (str = JSON.parse(str)) && Object.prototype.toString.call(str) === "[object Object]";
  10509. } catch (error) {
  10510. return false;
  10511. }
  10512. };
  10513. function mpAdapter(config, _a) {
  10514. var _b = (_a === void 0 ? {} : _a).transformRequestOption, transformRequestOption = _b === void 0 ? function(requestOption) {
  10515. return requestOption;
  10516. } : _b;
  10517. var request = getRequest();
  10518. return new Promise(function(resolve, reject) {
  10519. var requestTask;
  10520. var requestData = config.data;
  10521. var requestHeaders = config.headers;
  10522. var requestMethod = config.method && config.method.toUpperCase() || "GET";
  10523. var mpRequestOption = {
  10524. method: requestMethod,
  10525. url: buildURL$1(buildFullPath$1(config.baseURL, config.url), config.params, config.paramsSerializer),
  10526. timeout: config.timeout,
  10527. // Listen for success
  10528. success: function(mpResponse) {
  10529. var response = transformResponse2(mpResponse, config, mpRequestOption);
  10530. settle$1(resolve, reject, response);
  10531. },
  10532. // Handle request Exception
  10533. fail: function(error) {
  10534. transformError(error, reject, config);
  10535. },
  10536. complete: function() {
  10537. requestTask = void 0;
  10538. }
  10539. };
  10540. if (config.auth) {
  10541. var _a2 = [config.auth.username || "", config.auth.password || ""], username = _a2[0], password = _a2[1];
  10542. requestHeaders.Authorization = "Basic " + encoder(username + ":" + password);
  10543. }
  10544. utils$2.forEach(requestHeaders, function setRequestHeader(val, key) {
  10545. var _header = key.toLowerCase();
  10546. if (typeof requestData === "undefined" && _header === "content-type" || _header === "referer") {
  10547. delete requestHeaders[key];
  10548. }
  10549. });
  10550. mpRequestOption.header = requestHeaders;
  10551. if (config.responseType) {
  10552. mpRequestOption.responseType = config.responseType;
  10553. }
  10554. if (config.cancelToken) {
  10555. config.cancelToken.promise.then(function onCanceled(cancel) {
  10556. if (!requestTask) {
  10557. return;
  10558. }
  10559. requestTask.abort();
  10560. reject(cancel);
  10561. requestTask = void 0;
  10562. });
  10563. }
  10564. if (isJSONstr(requestData)) {
  10565. requestData = JSON.parse(requestData);
  10566. }
  10567. if (requestData !== void 0) {
  10568. mpRequestOption.data = requestData;
  10569. }
  10570. requestTask = request(transformRequestOption(transformConfig(mpRequestOption)));
  10571. });
  10572. }
  10573. exports._export_sfc = _export_sfc;
  10574. exports.axios = axios;
  10575. exports.createSSRApp = createSSRApp;
  10576. exports.index = index;
  10577. exports.mpAdapter = mpAdapter;
  10578. exports.onMounted = onMounted;
  10579. exports.p = p;
  10580. exports.ref = ref;
  10581. exports.t = t;
  10582. exports.unref = unref;
  10583. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map