vendor.js 250 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902
  1. "use strict";
  2. const _export_sfc = (sfc, props) => {
  3. const target = sfc.__vccOpts || sfc;
  4. for (const [key, val] of props) {
  5. target[key] = val;
  6. }
  7. return target;
  8. };
  9. /**
  10. * @vue/shared v3.4.21
  11. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  12. * @license MIT
  13. **/
  14. function makeMap(str, expectsLowerCase) {
  15. const set2 = new Set(str.split(","));
  16. return expectsLowerCase ? (val) => set2.has(val.toLowerCase()) : (val) => set2.has(val);
  17. }
  18. const EMPTY_OBJ = Object.freeze({});
  19. const EMPTY_ARR = Object.freeze([]);
  20. const NOOP = () => {
  21. };
  22. const NO = () => false;
  23. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  24. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  25. const isModelListener = (key) => key.startsWith("onUpdate:");
  26. const extend = Object.assign;
  27. const remove = (arr, el) => {
  28. const i = arr.indexOf(el);
  29. if (i > -1) {
  30. arr.splice(i, 1);
  31. }
  32. };
  33. const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  34. const hasOwn$1 = (val, key) => hasOwnProperty$2.call(val, key);
  35. const isArray = Array.isArray;
  36. const isMap = (val) => toTypeString(val) === "[object Map]";
  37. const isSet = (val) => toTypeString(val) === "[object Set]";
  38. const isFunction = (val) => typeof val === "function";
  39. const isString = (val) => typeof val === "string";
  40. const isSymbol = (val) => typeof val === "symbol";
  41. const isObject$1 = (val) => val !== null && typeof val === "object";
  42. const isPromise = (val) => {
  43. return (isObject$1(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  44. };
  45. const objectToString = Object.prototype.toString;
  46. const toTypeString = (value) => objectToString.call(value);
  47. const toRawType = (value) => {
  48. return toTypeString(value).slice(8, -1);
  49. };
  50. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  51. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  52. const isReservedProp = /* @__PURE__ */ makeMap(
  53. // the leading comma is intentional so empty string "" is also included
  54. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  55. );
  56. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  57. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  58. );
  59. const cacheStringFunction = (fn) => {
  60. const cache = /* @__PURE__ */ Object.create(null);
  61. return (str) => {
  62. const hit = cache[str];
  63. return hit || (cache[str] = fn(str));
  64. };
  65. };
  66. const camelizeRE = /-(\w)/g;
  67. const camelize = cacheStringFunction((str) => {
  68. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  69. });
  70. const hyphenateRE = /\B([A-Z])/g;
  71. const hyphenate = cacheStringFunction(
  72. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  73. );
  74. const capitalize = cacheStringFunction((str) => {
  75. return str.charAt(0).toUpperCase() + str.slice(1);
  76. });
  77. const toHandlerKey = cacheStringFunction((str) => {
  78. const s2 = str ? `on${capitalize(str)}` : ``;
  79. return s2;
  80. });
  81. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  82. const invokeArrayFns$1 = (fns, arg) => {
  83. for (let i = 0; i < fns.length; i++) {
  84. fns[i](arg);
  85. }
  86. };
  87. const def = (obj, key, value) => {
  88. Object.defineProperty(obj, key, {
  89. configurable: true,
  90. enumerable: false,
  91. value
  92. });
  93. };
  94. const looseToNumber = (val) => {
  95. const n2 = parseFloat(val);
  96. return isNaN(n2) ? val : n2;
  97. };
  98. let _globalThis;
  99. const getGlobalThis = () => {
  100. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  101. };
  102. function normalizeStyle(value) {
  103. if (isArray(value)) {
  104. const res = {};
  105. for (let i = 0; i < value.length; i++) {
  106. const item = value[i];
  107. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  108. if (normalized) {
  109. for (const key in normalized) {
  110. res[key] = normalized[key];
  111. }
  112. }
  113. }
  114. return res;
  115. } else if (isString(value) || isObject$1(value)) {
  116. return value;
  117. }
  118. }
  119. const listDelimiterRE = /;(?![^(]*\))/g;
  120. const propertyDelimiterRE = /:([^]+)/;
  121. const styleCommentRE = /\/\*[^]*?\*\//g;
  122. function parseStringStyle(cssText) {
  123. const ret = {};
  124. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  125. if (item) {
  126. const tmp = item.split(propertyDelimiterRE);
  127. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  128. }
  129. });
  130. return ret;
  131. }
  132. function normalizeClass(value) {
  133. let res = "";
  134. if (isString(value)) {
  135. res = value;
  136. } else if (isArray(value)) {
  137. for (let i = 0; i < value.length; i++) {
  138. const normalized = normalizeClass(value[i]);
  139. if (normalized) {
  140. res += normalized + " ";
  141. }
  142. }
  143. } else if (isObject$1(value)) {
  144. for (const name in value) {
  145. if (value[name]) {
  146. res += name + " ";
  147. }
  148. }
  149. }
  150. return res.trim();
  151. }
  152. const toDisplayString = (val) => {
  153. return isString(val) ? val : val == null ? "" : isArray(val) || isObject$1(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  154. };
  155. const replacer = (_key, val) => {
  156. if (val && val.__v_isRef) {
  157. return replacer(_key, val.value);
  158. } else if (isMap(val)) {
  159. return {
  160. [`Map(${val.size})`]: [...val.entries()].reduce(
  161. (entries, [key, val2], i) => {
  162. entries[stringifySymbol(key, i) + " =>"] = val2;
  163. return entries;
  164. },
  165. {}
  166. )
  167. };
  168. } else if (isSet(val)) {
  169. return {
  170. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  171. };
  172. } else if (isSymbol(val)) {
  173. return stringifySymbol(val);
  174. } else if (isObject$1(val) && !isArray(val) && !isPlainObject$1(val)) {
  175. return String(val);
  176. }
  177. return val;
  178. };
  179. const stringifySymbol = (v, i = "") => {
  180. var _a;
  181. return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
  182. };
  183. const SLOT_DEFAULT_NAME = "d";
  184. const ON_SHOW = "onShow";
  185. const ON_HIDE = "onHide";
  186. const ON_LAUNCH = "onLaunch";
  187. const ON_ERROR = "onError";
  188. const ON_THEME_CHANGE = "onThemeChange";
  189. const ON_PAGE_NOT_FOUND = "onPageNotFound";
  190. const ON_UNHANDLE_REJECTION = "onUnhandledRejection";
  191. const ON_EXIT = "onExit";
  192. const ON_LOAD = "onLoad";
  193. const ON_READY = "onReady";
  194. const ON_UNLOAD = "onUnload";
  195. const ON_INIT = "onInit";
  196. const ON_SAVE_EXIT_STATE = "onSaveExitState";
  197. const ON_RESIZE = "onResize";
  198. const ON_BACK_PRESS = "onBackPress";
  199. const ON_PAGE_SCROLL = "onPageScroll";
  200. const ON_TAB_ITEM_TAP = "onTabItemTap";
  201. const ON_REACH_BOTTOM = "onReachBottom";
  202. const ON_PULL_DOWN_REFRESH = "onPullDownRefresh";
  203. const ON_SHARE_TIMELINE = "onShareTimeline";
  204. const ON_ADD_TO_FAVORITES = "onAddToFavorites";
  205. const ON_SHARE_APP_MESSAGE = "onShareAppMessage";
  206. const ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";
  207. const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = "onNavigationBarSearchInputClicked";
  208. const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = "onNavigationBarSearchInputChanged";
  209. const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = "onNavigationBarSearchInputConfirmed";
  210. const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = "onNavigationBarSearchInputFocusChanged";
  211. const customizeRE = /:/g;
  212. function customizeEvent(str) {
  213. return camelize(str.replace(customizeRE, "-"));
  214. }
  215. function hasLeadingSlash(str) {
  216. return str.indexOf("/") === 0;
  217. }
  218. function addLeadingSlash(str) {
  219. return hasLeadingSlash(str) ? str : "/" + str;
  220. }
  221. const invokeArrayFns = (fns, arg) => {
  222. let ret;
  223. for (let i = 0; i < fns.length; i++) {
  224. ret = fns[i](arg);
  225. }
  226. return ret;
  227. };
  228. function once(fn, ctx = null) {
  229. let res;
  230. return (...args) => {
  231. if (fn) {
  232. res = fn.apply(ctx, args);
  233. fn = null;
  234. }
  235. return res;
  236. };
  237. }
  238. function getValueByDataPath(obj, path) {
  239. if (!isString(path)) {
  240. return;
  241. }
  242. path = path.replace(/\[(\d+)\]/g, ".$1");
  243. const parts = path.split(".");
  244. let key = parts[0];
  245. if (!obj) {
  246. obj = {};
  247. }
  248. if (parts.length === 1) {
  249. return obj[key];
  250. }
  251. return getValueByDataPath(obj[key], parts.slice(1).join("."));
  252. }
  253. function sortObject(obj) {
  254. let sortObj = {};
  255. if (isPlainObject$1(obj)) {
  256. Object.keys(obj).sort().forEach((key) => {
  257. const _key = key;
  258. sortObj[_key] = obj[_key];
  259. });
  260. }
  261. return !Object.keys(sortObj) ? obj : sortObj;
  262. }
  263. const encode = encodeURIComponent;
  264. function stringifyQuery(obj, encodeStr = encode) {
  265. const res = obj ? Object.keys(obj).map((key) => {
  266. let val = obj[key];
  267. if (typeof val === void 0 || val === null) {
  268. val = "";
  269. } else if (isPlainObject$1(val)) {
  270. val = JSON.stringify(val);
  271. }
  272. return encodeStr(key) + "=" + encodeStr(val);
  273. }).filter((x) => x.length > 0).join("&") : null;
  274. return res ? `?${res}` : "";
  275. }
  276. const PAGE_HOOKS = [
  277. ON_INIT,
  278. ON_LOAD,
  279. ON_SHOW,
  280. ON_HIDE,
  281. ON_UNLOAD,
  282. ON_BACK_PRESS,
  283. ON_PAGE_SCROLL,
  284. ON_TAB_ITEM_TAP,
  285. ON_REACH_BOTTOM,
  286. ON_PULL_DOWN_REFRESH,
  287. ON_SHARE_TIMELINE,
  288. ON_SHARE_APP_MESSAGE,
  289. ON_ADD_TO_FAVORITES,
  290. ON_SAVE_EXIT_STATE,
  291. ON_NAVIGATION_BAR_BUTTON_TAP,
  292. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  293. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  294. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  295. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  296. ];
  297. function isRootHook(name) {
  298. return PAGE_HOOKS.indexOf(name) > -1;
  299. }
  300. const UniLifecycleHooks = [
  301. ON_SHOW,
  302. ON_HIDE,
  303. ON_LAUNCH,
  304. ON_ERROR,
  305. ON_THEME_CHANGE,
  306. ON_PAGE_NOT_FOUND,
  307. ON_UNHANDLE_REJECTION,
  308. ON_EXIT,
  309. ON_INIT,
  310. ON_LOAD,
  311. ON_READY,
  312. ON_UNLOAD,
  313. ON_RESIZE,
  314. ON_BACK_PRESS,
  315. ON_PAGE_SCROLL,
  316. ON_TAB_ITEM_TAP,
  317. ON_REACH_BOTTOM,
  318. ON_PULL_DOWN_REFRESH,
  319. ON_SHARE_TIMELINE,
  320. ON_ADD_TO_FAVORITES,
  321. ON_SHARE_APP_MESSAGE,
  322. ON_SAVE_EXIT_STATE,
  323. ON_NAVIGATION_BAR_BUTTON_TAP,
  324. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  325. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  326. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  327. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  328. ];
  329. const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */ (() => {
  330. return {
  331. onPageScroll: 1,
  332. onShareAppMessage: 1 << 1,
  333. onShareTimeline: 1 << 2
  334. };
  335. })();
  336. function isUniLifecycleHook(name, value, checkType = true) {
  337. if (checkType && !isFunction(value)) {
  338. return false;
  339. }
  340. if (UniLifecycleHooks.indexOf(name) > -1) {
  341. return true;
  342. } else if (name.indexOf("on") === 0) {
  343. return true;
  344. }
  345. return false;
  346. }
  347. let vueApp;
  348. const createVueAppHooks = [];
  349. function onCreateVueApp(hook) {
  350. if (vueApp) {
  351. return hook(vueApp);
  352. }
  353. createVueAppHooks.push(hook);
  354. }
  355. function invokeCreateVueAppHook(app) {
  356. vueApp = app;
  357. createVueAppHooks.forEach((hook) => hook(app));
  358. }
  359. const invokeCreateErrorHandler = once((app, createErrorHandler2) => {
  360. if (isFunction(app._component.onError)) {
  361. return createErrorHandler2(app);
  362. }
  363. });
  364. const E = function() {
  365. };
  366. E.prototype = {
  367. on: function(name, callback, ctx) {
  368. var e2 = this.e || (this.e = {});
  369. (e2[name] || (e2[name] = [])).push({
  370. fn: callback,
  371. ctx
  372. });
  373. return this;
  374. },
  375. once: function(name, callback, ctx) {
  376. var self2 = this;
  377. function listener() {
  378. self2.off(name, listener);
  379. callback.apply(ctx, arguments);
  380. }
  381. listener._ = callback;
  382. return this.on(name, listener, ctx);
  383. },
  384. emit: function(name) {
  385. var data = [].slice.call(arguments, 1);
  386. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  387. var i = 0;
  388. var len = evtArr.length;
  389. for (i; i < len; i++) {
  390. evtArr[i].fn.apply(evtArr[i].ctx, data);
  391. }
  392. return this;
  393. },
  394. off: function(name, callback) {
  395. var e2 = this.e || (this.e = {});
  396. var evts = e2[name];
  397. var liveEvents = [];
  398. if (evts && callback) {
  399. for (var i = evts.length - 1; i >= 0; i--) {
  400. if (evts[i].fn === callback || evts[i].fn._ === callback) {
  401. evts.splice(i, 1);
  402. break;
  403. }
  404. }
  405. liveEvents = evts;
  406. }
  407. liveEvents.length ? e2[name] = liveEvents : delete e2[name];
  408. return this;
  409. }
  410. };
  411. var E$1 = E;
  412. const isObject = (val) => val !== null && typeof val === "object";
  413. const defaultDelimiters = ["{", "}"];
  414. class BaseFormatter {
  415. constructor() {
  416. this._caches = /* @__PURE__ */ Object.create(null);
  417. }
  418. interpolate(message, values, delimiters = defaultDelimiters) {
  419. if (!values) {
  420. return [message];
  421. }
  422. let tokens = this._caches[message];
  423. if (!tokens) {
  424. tokens = parse(message, delimiters);
  425. this._caches[message] = tokens;
  426. }
  427. return compile$1(tokens, values);
  428. }
  429. }
  430. const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  431. const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  432. function parse(format, [startDelimiter, endDelimiter]) {
  433. const tokens = [];
  434. let position = 0;
  435. let text = "";
  436. while (position < format.length) {
  437. let char = format[position++];
  438. if (char === startDelimiter) {
  439. if (text) {
  440. tokens.push({ type: "text", value: text });
  441. }
  442. text = "";
  443. let sub = "";
  444. char = format[position++];
  445. while (char !== void 0 && char !== endDelimiter) {
  446. sub += char;
  447. char = format[position++];
  448. }
  449. const isClosed = char === endDelimiter;
  450. const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
  451. tokens.push({ value: sub, type });
  452. } else {
  453. text += char;
  454. }
  455. }
  456. text && tokens.push({ type: "text", value: text });
  457. return tokens;
  458. }
  459. function compile$1(tokens, values) {
  460. const compiled = [];
  461. let index2 = 0;
  462. const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
  463. if (mode === "unknown") {
  464. return compiled;
  465. }
  466. while (index2 < tokens.length) {
  467. const token = tokens[index2];
  468. switch (token.type) {
  469. case "text":
  470. compiled.push(token.value);
  471. break;
  472. case "list":
  473. compiled.push(values[parseInt(token.value, 10)]);
  474. break;
  475. case "named":
  476. if (mode === "named") {
  477. compiled.push(values[token.value]);
  478. } else {
  479. {
  480. console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
  481. }
  482. }
  483. break;
  484. case "unknown":
  485. {
  486. console.warn(`Detect 'unknown' type of token!`);
  487. }
  488. break;
  489. }
  490. index2++;
  491. }
  492. return compiled;
  493. }
  494. const LOCALE_ZH_HANS = "zh-Hans";
  495. const LOCALE_ZH_HANT = "zh-Hant";
  496. const LOCALE_EN = "en";
  497. const LOCALE_FR = "fr";
  498. const LOCALE_ES = "es";
  499. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  500. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  501. const defaultFormatter = new BaseFormatter();
  502. function include(str, parts) {
  503. return !!parts.find((part) => str.indexOf(part) !== -1);
  504. }
  505. function startsWith(str, parts) {
  506. return parts.find((part) => str.indexOf(part) === 0);
  507. }
  508. function normalizeLocale(locale, messages) {
  509. if (!locale) {
  510. return;
  511. }
  512. locale = locale.trim().replace(/_/g, "-");
  513. if (messages && messages[locale]) {
  514. return locale;
  515. }
  516. locale = locale.toLowerCase();
  517. if (locale === "chinese") {
  518. return LOCALE_ZH_HANS;
  519. }
  520. if (locale.indexOf("zh") === 0) {
  521. if (locale.indexOf("-hans") > -1) {
  522. return LOCALE_ZH_HANS;
  523. }
  524. if (locale.indexOf("-hant") > -1) {
  525. return LOCALE_ZH_HANT;
  526. }
  527. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  528. return LOCALE_ZH_HANT;
  529. }
  530. return LOCALE_ZH_HANS;
  531. }
  532. let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  533. if (messages && Object.keys(messages).length > 0) {
  534. locales = Object.keys(messages);
  535. }
  536. const lang = startsWith(locale, locales);
  537. if (lang) {
  538. return lang;
  539. }
  540. }
  541. class I18n {
  542. constructor({ locale, fallbackLocale, messages, watcher, formater: formater2 }) {
  543. this.locale = LOCALE_EN;
  544. this.fallbackLocale = LOCALE_EN;
  545. this.message = {};
  546. this.messages = {};
  547. this.watchers = [];
  548. if (fallbackLocale) {
  549. this.fallbackLocale = fallbackLocale;
  550. }
  551. this.formater = formater2 || defaultFormatter;
  552. this.messages = messages || {};
  553. this.setLocale(locale || LOCALE_EN);
  554. if (watcher) {
  555. this.watchLocale(watcher);
  556. }
  557. }
  558. setLocale(locale) {
  559. const oldLocale = this.locale;
  560. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  561. if (!this.messages[this.locale]) {
  562. this.messages[this.locale] = {};
  563. }
  564. this.message = this.messages[this.locale];
  565. if (oldLocale !== this.locale) {
  566. this.watchers.forEach((watcher) => {
  567. watcher(this.locale, oldLocale);
  568. });
  569. }
  570. }
  571. getLocale() {
  572. return this.locale;
  573. }
  574. watchLocale(fn) {
  575. const index2 = this.watchers.push(fn) - 1;
  576. return () => {
  577. this.watchers.splice(index2, 1);
  578. };
  579. }
  580. add(locale, message, override = true) {
  581. const curMessages = this.messages[locale];
  582. if (curMessages) {
  583. if (override) {
  584. Object.assign(curMessages, message);
  585. } else {
  586. Object.keys(message).forEach((key) => {
  587. if (!hasOwn(curMessages, key)) {
  588. curMessages[key] = message[key];
  589. }
  590. });
  591. }
  592. } else {
  593. this.messages[locale] = message;
  594. }
  595. }
  596. f(message, values, delimiters) {
  597. return this.formater.interpolate(message, values, delimiters).join("");
  598. }
  599. t(key, locale, values) {
  600. let message = this.message;
  601. if (typeof locale === "string") {
  602. locale = normalizeLocale(locale, this.messages);
  603. locale && (message = this.messages[locale]);
  604. } else {
  605. values = locale;
  606. }
  607. if (!hasOwn(message, key)) {
  608. console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
  609. return key;
  610. }
  611. return this.formater.interpolate(message[key], values).join("");
  612. }
  613. }
  614. function watchAppLocale(appVm, i18n) {
  615. if (appVm.$watchLocale) {
  616. appVm.$watchLocale((newLocale) => {
  617. i18n.setLocale(newLocale);
  618. });
  619. } else {
  620. appVm.$watch(() => appVm.$locale, (newLocale) => {
  621. i18n.setLocale(newLocale);
  622. });
  623. }
  624. }
  625. function getDefaultLocale() {
  626. if (typeof index !== "undefined" && index.getLocale) {
  627. return index.getLocale();
  628. }
  629. if (typeof global !== "undefined" && global.getLocale) {
  630. return global.getLocale();
  631. }
  632. return LOCALE_EN;
  633. }
  634. function initVueI18n(locale, messages = {}, fallbackLocale, watcher) {
  635. if (typeof locale !== "string") {
  636. const options = [
  637. messages,
  638. locale
  639. ];
  640. locale = options[0];
  641. messages = options[1];
  642. }
  643. if (typeof locale !== "string") {
  644. locale = getDefaultLocale();
  645. }
  646. if (typeof fallbackLocale !== "string") {
  647. fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
  648. }
  649. const i18n = new I18n({
  650. locale,
  651. fallbackLocale,
  652. messages,
  653. watcher
  654. });
  655. let t2 = (key, values) => {
  656. if (typeof getApp !== "function") {
  657. t2 = function(key2, values2) {
  658. return i18n.t(key2, values2);
  659. };
  660. } else {
  661. let isWatchedAppLocale = false;
  662. t2 = function(key2, values2) {
  663. const appVm = getApp().$vm;
  664. if (appVm) {
  665. appVm.$locale;
  666. if (!isWatchedAppLocale) {
  667. isWatchedAppLocale = true;
  668. watchAppLocale(appVm, i18n);
  669. }
  670. }
  671. return i18n.t(key2, values2);
  672. };
  673. }
  674. return t2(key, values);
  675. };
  676. return {
  677. i18n,
  678. f(message, values, delimiters) {
  679. return i18n.f(message, values, delimiters);
  680. },
  681. t(key, values) {
  682. return t2(key, values);
  683. },
  684. add(locale2, message, override = true) {
  685. return i18n.add(locale2, message, override);
  686. },
  687. watch(fn) {
  688. return i18n.watchLocale(fn);
  689. },
  690. getLocale() {
  691. return i18n.getLocale();
  692. },
  693. setLocale(newLocale) {
  694. return i18n.setLocale(newLocale);
  695. }
  696. };
  697. }
  698. function getBaseSystemInfo() {
  699. return wx.getSystemInfoSync();
  700. }
  701. function validateProtocolFail(name, msg) {
  702. console.warn(`${name}: ${msg}`);
  703. }
  704. function validateProtocol(name, data, protocol, onFail) {
  705. if (!onFail) {
  706. onFail = validateProtocolFail;
  707. }
  708. for (const key in protocol) {
  709. const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn$1(data, key));
  710. if (isString(errMsg)) {
  711. onFail(name, errMsg);
  712. }
  713. }
  714. }
  715. function validateProtocols(name, args, protocol, onFail) {
  716. if (!protocol) {
  717. return;
  718. }
  719. if (!isArray(protocol)) {
  720. return validateProtocol(name, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail);
  721. }
  722. const len = protocol.length;
  723. const argsLen = args.length;
  724. for (let i = 0; i < len; i++) {
  725. const opts = protocol[i];
  726. const data = /* @__PURE__ */ Object.create(null);
  727. if (argsLen > i) {
  728. data[opts.name] = args[i];
  729. }
  730. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  731. }
  732. }
  733. function validateProp$1(name, value, prop, isAbsent) {
  734. if (!isPlainObject$1(prop)) {
  735. prop = { type: prop };
  736. }
  737. const { type, required, validator } = prop;
  738. if (required && isAbsent) {
  739. return 'Missing required args: "' + name + '"';
  740. }
  741. if (value == null && !required) {
  742. return;
  743. }
  744. if (type != null) {
  745. let isValid = false;
  746. const types = isArray(type) ? type : [type];
  747. const expectedTypes = [];
  748. for (let i = 0; i < types.length && !isValid; i++) {
  749. const { valid, expectedType } = assertType$1(value, types[i]);
  750. expectedTypes.push(expectedType || "");
  751. isValid = valid;
  752. }
  753. if (!isValid) {
  754. return getInvalidTypeMessage$1(name, value, expectedTypes);
  755. }
  756. }
  757. if (validator) {
  758. return validator(value);
  759. }
  760. }
  761. const isSimpleType$1 = /* @__PURE__ */ makeMap("String,Number,Boolean,Function,Symbol");
  762. function assertType$1(value, type) {
  763. let valid;
  764. const expectedType = getType$1(type);
  765. if (isSimpleType$1(expectedType)) {
  766. const t2 = typeof value;
  767. valid = t2 === expectedType.toLowerCase();
  768. if (!valid && t2 === "object") {
  769. valid = value instanceof type;
  770. }
  771. } else if (expectedType === "Object") {
  772. valid = isObject$1(value);
  773. } else if (expectedType === "Array") {
  774. valid = isArray(value);
  775. } else {
  776. {
  777. valid = value instanceof type;
  778. }
  779. }
  780. return {
  781. valid,
  782. expectedType
  783. };
  784. }
  785. function getInvalidTypeMessage$1(name, value, expectedTypes) {
  786. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`;
  787. const expectedType = expectedTypes[0];
  788. const receivedType = toRawType(value);
  789. const expectedValue = styleValue$1(value, expectedType);
  790. const receivedValue = styleValue$1(value, receivedType);
  791. if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$1(expectedType, receivedType)) {
  792. message += ` with value ${expectedValue}`;
  793. }
  794. message += `, got ${receivedType} `;
  795. if (isExplicable$1(receivedType)) {
  796. message += `with value ${receivedValue}.`;
  797. }
  798. return message;
  799. }
  800. function getType$1(ctor) {
  801. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  802. return match ? match[1] : "";
  803. }
  804. function styleValue$1(value, type) {
  805. if (type === "String") {
  806. return `"${value}"`;
  807. } else if (type === "Number") {
  808. return `${Number(value)}`;
  809. } else {
  810. return `${value}`;
  811. }
  812. }
  813. function isExplicable$1(type) {
  814. const explicitTypes = ["string", "number", "boolean"];
  815. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  816. }
  817. function isBoolean$1(...args) {
  818. return args.some((elem) => elem.toLowerCase() === "boolean");
  819. }
  820. function tryCatch(fn) {
  821. return function() {
  822. try {
  823. return fn.apply(fn, arguments);
  824. } catch (e2) {
  825. console.error(e2);
  826. }
  827. };
  828. }
  829. let invokeCallbackId = 1;
  830. const invokeCallbacks = {};
  831. function addInvokeCallback(id, name, callback, keepAlive = false) {
  832. invokeCallbacks[id] = {
  833. name,
  834. keepAlive,
  835. callback
  836. };
  837. return id;
  838. }
  839. function invokeCallback(id, res, extras) {
  840. if (typeof id === "number") {
  841. const opts = invokeCallbacks[id];
  842. if (opts) {
  843. if (!opts.keepAlive) {
  844. delete invokeCallbacks[id];
  845. }
  846. return opts.callback(res, extras);
  847. }
  848. }
  849. return res;
  850. }
  851. const API_SUCCESS = "success";
  852. const API_FAIL = "fail";
  853. const API_COMPLETE = "complete";
  854. function getApiCallbacks(args) {
  855. const apiCallbacks = {};
  856. for (const name in args) {
  857. const fn = args[name];
  858. if (isFunction(fn)) {
  859. apiCallbacks[name] = tryCatch(fn);
  860. delete args[name];
  861. }
  862. }
  863. return apiCallbacks;
  864. }
  865. function normalizeErrMsg(errMsg, name) {
  866. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  867. return name + ":ok";
  868. }
  869. return name + errMsg.substring(errMsg.indexOf(":fail"));
  870. }
  871. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  872. if (!isPlainObject$1(args)) {
  873. args = {};
  874. }
  875. const { success, fail, complete } = getApiCallbacks(args);
  876. const hasSuccess = isFunction(success);
  877. const hasFail = isFunction(fail);
  878. const hasComplete = isFunction(complete);
  879. const callbackId = invokeCallbackId++;
  880. addInvokeCallback(callbackId, name, (res) => {
  881. res = res || {};
  882. res.errMsg = normalizeErrMsg(res.errMsg, name);
  883. isFunction(beforeAll) && beforeAll(res);
  884. if (res.errMsg === name + ":ok") {
  885. isFunction(beforeSuccess) && beforeSuccess(res, args);
  886. hasSuccess && success(res);
  887. } else {
  888. hasFail && fail(res);
  889. }
  890. hasComplete && complete(res);
  891. });
  892. return callbackId;
  893. }
  894. const HOOK_SUCCESS = "success";
  895. const HOOK_FAIL = "fail";
  896. const HOOK_COMPLETE = "complete";
  897. const globalInterceptors = {};
  898. const scopedInterceptors = {};
  899. function wrapperHook(hook, params) {
  900. return function(data) {
  901. return hook(data, params) || data;
  902. };
  903. }
  904. function queue$2(hooks, data, params) {
  905. let promise = false;
  906. for (let i = 0; i < hooks.length; i++) {
  907. const hook = hooks[i];
  908. if (promise) {
  909. promise = Promise.resolve(wrapperHook(hook, params));
  910. } else {
  911. const res = hook(data, params);
  912. if (isPromise(res)) {
  913. promise = Promise.resolve(res);
  914. }
  915. if (res === false) {
  916. return {
  917. then() {
  918. },
  919. catch() {
  920. }
  921. };
  922. }
  923. }
  924. }
  925. return promise || {
  926. then(callback) {
  927. return callback(data);
  928. },
  929. catch() {
  930. }
  931. };
  932. }
  933. function wrapperOptions(interceptors2, options = {}) {
  934. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  935. const hooks = interceptors2[name];
  936. if (!isArray(hooks)) {
  937. return;
  938. }
  939. const oldCallback = options[name];
  940. options[name] = function callbackInterceptor(res) {
  941. queue$2(hooks, res, options).then((res2) => {
  942. return isFunction(oldCallback) && oldCallback(res2) || res2;
  943. });
  944. };
  945. });
  946. return options;
  947. }
  948. function wrapperReturnValue(method, returnValue) {
  949. const returnValueHooks = [];
  950. if (isArray(globalInterceptors.returnValue)) {
  951. returnValueHooks.push(...globalInterceptors.returnValue);
  952. }
  953. const interceptor = scopedInterceptors[method];
  954. if (interceptor && isArray(interceptor.returnValue)) {
  955. returnValueHooks.push(...interceptor.returnValue);
  956. }
  957. returnValueHooks.forEach((hook) => {
  958. returnValue = hook(returnValue) || returnValue;
  959. });
  960. return returnValue;
  961. }
  962. function getApiInterceptorHooks(method) {
  963. const interceptor = /* @__PURE__ */ Object.create(null);
  964. Object.keys(globalInterceptors).forEach((hook) => {
  965. if (hook !== "returnValue") {
  966. interceptor[hook] = globalInterceptors[hook].slice();
  967. }
  968. });
  969. const scopedInterceptor = scopedInterceptors[method];
  970. if (scopedInterceptor) {
  971. Object.keys(scopedInterceptor).forEach((hook) => {
  972. if (hook !== "returnValue") {
  973. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  974. }
  975. });
  976. }
  977. return interceptor;
  978. }
  979. function invokeApi(method, api, options, params) {
  980. const interceptor = getApiInterceptorHooks(method);
  981. if (interceptor && Object.keys(interceptor).length) {
  982. if (isArray(interceptor.invoke)) {
  983. const res = queue$2(interceptor.invoke, options);
  984. return res.then((options2) => {
  985. return api(wrapperOptions(getApiInterceptorHooks(method), options2), ...params);
  986. });
  987. } else {
  988. return api(wrapperOptions(interceptor, options), ...params);
  989. }
  990. }
  991. return api(options, ...params);
  992. }
  993. function hasCallback(args) {
  994. if (isPlainObject$1(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
  995. return true;
  996. }
  997. return false;
  998. }
  999. function handlePromise(promise) {
  1000. return promise;
  1001. }
  1002. function promisify$1(name, fn) {
  1003. return (args = {}, ...rest) => {
  1004. if (hasCallback(args)) {
  1005. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  1006. }
  1007. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  1008. invokeApi(name, fn, extend(args, { success: resolve2, fail: reject }), rest);
  1009. })));
  1010. };
  1011. }
  1012. function formatApiArgs(args, options) {
  1013. const params = args[0];
  1014. if (!options || !options.formatArgs || !isPlainObject$1(options.formatArgs) && isPlainObject$1(params)) {
  1015. return;
  1016. }
  1017. const formatArgs = options.formatArgs;
  1018. const keys = Object.keys(formatArgs);
  1019. for (let i = 0; i < keys.length; i++) {
  1020. const name = keys[i];
  1021. const formatterOrDefaultValue = formatArgs[name];
  1022. if (isFunction(formatterOrDefaultValue)) {
  1023. const errMsg = formatterOrDefaultValue(args[0][name], params);
  1024. if (isString(errMsg)) {
  1025. return errMsg;
  1026. }
  1027. } else {
  1028. if (!hasOwn$1(params, name)) {
  1029. params[name] = formatterOrDefaultValue;
  1030. }
  1031. }
  1032. }
  1033. }
  1034. function invokeSuccess(id, name, res) {
  1035. const result = {
  1036. errMsg: name + ":ok"
  1037. };
  1038. return invokeCallback(id, extend(res || {}, result));
  1039. }
  1040. function invokeFail(id, name, errMsg, errRes = {}) {
  1041. const apiErrMsg = name + ":fail" + (errMsg ? " " + errMsg : "");
  1042. delete errRes.errCode;
  1043. let res = extend({ errMsg: apiErrMsg }, errRes);
  1044. return invokeCallback(id, res);
  1045. }
  1046. function beforeInvokeApi(name, args, protocol, options) {
  1047. {
  1048. validateProtocols(name, args, protocol);
  1049. }
  1050. if (options && options.beforeInvoke) {
  1051. const errMsg2 = options.beforeInvoke(args);
  1052. if (isString(errMsg2)) {
  1053. return errMsg2;
  1054. }
  1055. }
  1056. const errMsg = formatApiArgs(args, options);
  1057. if (errMsg) {
  1058. return errMsg;
  1059. }
  1060. }
  1061. function parseErrMsg(errMsg) {
  1062. if (!errMsg || isString(errMsg)) {
  1063. return errMsg;
  1064. }
  1065. if (errMsg.stack) {
  1066. console.error(errMsg.message + "\n" + errMsg.stack);
  1067. return errMsg.message;
  1068. }
  1069. return errMsg;
  1070. }
  1071. function wrapperTaskApi(name, fn, protocol, options) {
  1072. return (args) => {
  1073. const id = createAsyncApiCallback(name, args, options);
  1074. const errMsg = beforeInvokeApi(name, [args], protocol, options);
  1075. if (errMsg) {
  1076. return invokeFail(id, name, errMsg);
  1077. }
  1078. return fn(args, {
  1079. resolve: (res) => invokeSuccess(id, name, res),
  1080. reject: (errMsg2, errRes) => invokeFail(id, name, parseErrMsg(errMsg2), errRes)
  1081. });
  1082. };
  1083. }
  1084. function wrapperSyncApi(name, fn, protocol, options) {
  1085. return (...args) => {
  1086. const errMsg = beforeInvokeApi(name, args, protocol, options);
  1087. if (errMsg) {
  1088. throw new Error(errMsg);
  1089. }
  1090. return fn.apply(null, args);
  1091. };
  1092. }
  1093. function wrapperAsyncApi(name, fn, protocol, options) {
  1094. return wrapperTaskApi(name, fn, protocol, options);
  1095. }
  1096. function defineSyncApi(name, fn, protocol, options) {
  1097. return wrapperSyncApi(name, fn, protocol, options);
  1098. }
  1099. function defineAsyncApi(name, fn, protocol, options) {
  1100. return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options));
  1101. }
  1102. const API_UPX2PX = "upx2px";
  1103. const Upx2pxProtocol = [
  1104. {
  1105. name: "upx",
  1106. type: [Number, String],
  1107. required: true
  1108. }
  1109. ];
  1110. const EPS = 1e-4;
  1111. const BASE_DEVICE_WIDTH = 750;
  1112. let isIOS = false;
  1113. let deviceWidth = 0;
  1114. let deviceDPR = 0;
  1115. function checkDeviceWidth() {
  1116. const { platform, pixelRatio, windowWidth } = getBaseSystemInfo();
  1117. deviceWidth = windowWidth;
  1118. deviceDPR = pixelRatio;
  1119. isIOS = platform === "ios";
  1120. }
  1121. const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
  1122. if (deviceWidth === 0) {
  1123. checkDeviceWidth();
  1124. }
  1125. number = Number(number);
  1126. if (number === 0) {
  1127. return 0;
  1128. }
  1129. let width = newDeviceWidth || deviceWidth;
  1130. let result = number / BASE_DEVICE_WIDTH * width;
  1131. if (result < 0) {
  1132. result = -result;
  1133. }
  1134. result = Math.floor(result + EPS);
  1135. if (result === 0) {
  1136. if (deviceDPR === 1 || !isIOS) {
  1137. result = 1;
  1138. } else {
  1139. result = 0.5;
  1140. }
  1141. }
  1142. return number < 0 ? -result : result;
  1143. }, Upx2pxProtocol);
  1144. const API_ADD_INTERCEPTOR = "addInterceptor";
  1145. const API_REMOVE_INTERCEPTOR = "removeInterceptor";
  1146. const AddInterceptorProtocol = [
  1147. {
  1148. name: "method",
  1149. type: [String, Object],
  1150. required: true
  1151. }
  1152. ];
  1153. const RemoveInterceptorProtocol = AddInterceptorProtocol;
  1154. function mergeInterceptorHook(interceptors2, interceptor) {
  1155. Object.keys(interceptor).forEach((hook) => {
  1156. if (isFunction(interceptor[hook])) {
  1157. interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]);
  1158. }
  1159. });
  1160. }
  1161. function removeInterceptorHook(interceptors2, interceptor) {
  1162. if (!interceptors2 || !interceptor) {
  1163. return;
  1164. }
  1165. Object.keys(interceptor).forEach((name) => {
  1166. const hooks = interceptors2[name];
  1167. const hook = interceptor[name];
  1168. if (isArray(hooks) && isFunction(hook)) {
  1169. remove(hooks, hook);
  1170. }
  1171. });
  1172. }
  1173. function mergeHook(parentVal, childVal) {
  1174. const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  1175. return res ? dedupeHooks(res) : res;
  1176. }
  1177. function dedupeHooks(hooks) {
  1178. const res = [];
  1179. for (let i = 0; i < hooks.length; i++) {
  1180. if (res.indexOf(hooks[i]) === -1) {
  1181. res.push(hooks[i]);
  1182. }
  1183. }
  1184. return res;
  1185. }
  1186. const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
  1187. if (isString(method) && isPlainObject$1(interceptor)) {
  1188. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
  1189. } else if (isPlainObject$1(method)) {
  1190. mergeInterceptorHook(globalInterceptors, method);
  1191. }
  1192. }, AddInterceptorProtocol);
  1193. const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
  1194. if (isString(method)) {
  1195. if (isPlainObject$1(interceptor)) {
  1196. removeInterceptorHook(scopedInterceptors[method], interceptor);
  1197. } else {
  1198. delete scopedInterceptors[method];
  1199. }
  1200. } else if (isPlainObject$1(method)) {
  1201. removeInterceptorHook(globalInterceptors, method);
  1202. }
  1203. }, RemoveInterceptorProtocol);
  1204. const interceptors = {};
  1205. const API_ON = "$on";
  1206. const OnProtocol = [
  1207. {
  1208. name: "event",
  1209. type: String,
  1210. required: true
  1211. },
  1212. {
  1213. name: "callback",
  1214. type: Function,
  1215. required: true
  1216. }
  1217. ];
  1218. const API_ONCE = "$once";
  1219. const OnceProtocol = OnProtocol;
  1220. const API_OFF = "$off";
  1221. const OffProtocol = [
  1222. {
  1223. name: "event",
  1224. type: [String, Array]
  1225. },
  1226. {
  1227. name: "callback",
  1228. type: Function
  1229. }
  1230. ];
  1231. const API_EMIT = "$emit";
  1232. const EmitProtocol = [
  1233. {
  1234. name: "event",
  1235. type: String,
  1236. required: true
  1237. }
  1238. ];
  1239. const emitter = new E$1();
  1240. const $on = defineSyncApi(API_ON, (name, callback) => {
  1241. emitter.on(name, callback);
  1242. return () => emitter.off(name, callback);
  1243. }, OnProtocol);
  1244. const $once = defineSyncApi(API_ONCE, (name, callback) => {
  1245. emitter.once(name, callback);
  1246. return () => emitter.off(name, callback);
  1247. }, OnceProtocol);
  1248. const $off = defineSyncApi(API_OFF, (name, callback) => {
  1249. if (!name) {
  1250. emitter.e = {};
  1251. return;
  1252. }
  1253. if (!isArray(name))
  1254. name = [name];
  1255. name.forEach((n2) => emitter.off(n2, callback));
  1256. }, OffProtocol);
  1257. const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
  1258. emitter.emit(name, ...args);
  1259. }, EmitProtocol);
  1260. let cid;
  1261. let cidErrMsg;
  1262. let enabled;
  1263. function normalizePushMessage(message) {
  1264. try {
  1265. return JSON.parse(message);
  1266. } catch (e2) {
  1267. }
  1268. return message;
  1269. }
  1270. function invokePushCallback(args) {
  1271. if (args.type === "enabled") {
  1272. enabled = true;
  1273. } else if (args.type === "clientId") {
  1274. cid = args.cid;
  1275. cidErrMsg = args.errMsg;
  1276. invokeGetPushCidCallbacks(cid, args.errMsg);
  1277. } else if (args.type === "pushMsg") {
  1278. const message = {
  1279. type: "receive",
  1280. data: normalizePushMessage(args.message)
  1281. };
  1282. for (let i = 0; i < onPushMessageCallbacks.length; i++) {
  1283. const callback = onPushMessageCallbacks[i];
  1284. callback(message);
  1285. if (message.stopped) {
  1286. break;
  1287. }
  1288. }
  1289. } else if (args.type === "click") {
  1290. onPushMessageCallbacks.forEach((callback) => {
  1291. callback({
  1292. type: "click",
  1293. data: normalizePushMessage(args.message)
  1294. });
  1295. });
  1296. }
  1297. }
  1298. const getPushCidCallbacks = [];
  1299. function invokeGetPushCidCallbacks(cid2, errMsg) {
  1300. getPushCidCallbacks.forEach((callback) => {
  1301. callback(cid2, errMsg);
  1302. });
  1303. getPushCidCallbacks.length = 0;
  1304. }
  1305. const API_GET_PUSH_CLIENT_ID = "getPushClientId";
  1306. const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve: resolve2, reject }) => {
  1307. Promise.resolve().then(() => {
  1308. if (typeof enabled === "undefined") {
  1309. enabled = false;
  1310. cid = "";
  1311. cidErrMsg = "uniPush is not enabled";
  1312. }
  1313. getPushCidCallbacks.push((cid2, errMsg) => {
  1314. if (cid2) {
  1315. resolve2({ cid: cid2 });
  1316. } else {
  1317. reject(errMsg);
  1318. }
  1319. });
  1320. if (typeof cid !== "undefined") {
  1321. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1322. }
  1323. });
  1324. });
  1325. const onPushMessageCallbacks = [];
  1326. const onPushMessage = (fn) => {
  1327. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1328. onPushMessageCallbacks.push(fn);
  1329. }
  1330. };
  1331. const offPushMessage = (fn) => {
  1332. if (!fn) {
  1333. onPushMessageCallbacks.length = 0;
  1334. } else {
  1335. const index2 = onPushMessageCallbacks.indexOf(fn);
  1336. if (index2 > -1) {
  1337. onPushMessageCallbacks.splice(index2, 1);
  1338. }
  1339. }
  1340. };
  1341. const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/;
  1342. const CONTEXT_API_RE = /^create|Manager$/;
  1343. const CONTEXT_API_RE_EXC = ["createBLEConnection"];
  1344. const ASYNC_API = ["createBLEConnection"];
  1345. const CALLBACK_API_RE = /^on|^off/;
  1346. function isContextApi(name) {
  1347. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  1348. }
  1349. function isSyncApi(name) {
  1350. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  1351. }
  1352. function isCallbackApi(name) {
  1353. return CALLBACK_API_RE.test(name) && name !== "onPush";
  1354. }
  1355. function shouldPromise(name) {
  1356. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  1357. return false;
  1358. }
  1359. return true;
  1360. }
  1361. if (!Promise.prototype.finally) {
  1362. Promise.prototype.finally = function(onfinally) {
  1363. const promise = this.constructor;
  1364. return this.then((value) => promise.resolve(onfinally && onfinally()).then(() => value), (reason) => promise.resolve(onfinally && onfinally()).then(() => {
  1365. throw reason;
  1366. }));
  1367. };
  1368. }
  1369. function promisify(name, api) {
  1370. if (!shouldPromise(name)) {
  1371. return api;
  1372. }
  1373. if (!isFunction(api)) {
  1374. return api;
  1375. }
  1376. return function promiseApi(options = {}, ...rest) {
  1377. if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) {
  1378. return wrapperReturnValue(name, invokeApi(name, api, options, rest));
  1379. }
  1380. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  1381. invokeApi(name, api, extend({}, options, {
  1382. success: resolve2,
  1383. fail: reject
  1384. }), rest);
  1385. })));
  1386. };
  1387. }
  1388. const CALLBACKS = ["success", "fail", "cancel", "complete"];
  1389. function initWrapper(protocols2) {
  1390. function processCallback(methodName, method, returnValue) {
  1391. return function(res) {
  1392. return method(processReturnValue(methodName, res, returnValue));
  1393. };
  1394. }
  1395. function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) {
  1396. if (isPlainObject$1(fromArgs)) {
  1397. const toArgs = keepFromArgs === true ? fromArgs : {};
  1398. if (isFunction(argsOption)) {
  1399. argsOption = argsOption(fromArgs, toArgs) || {};
  1400. }
  1401. for (const key in fromArgs) {
  1402. if (hasOwn$1(argsOption, key)) {
  1403. let keyOption = argsOption[key];
  1404. if (isFunction(keyOption)) {
  1405. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1406. }
  1407. if (!keyOption) {
  1408. console.warn(`微信小程序 ${methodName} 暂不支持 ${key}`);
  1409. } else if (isString(keyOption)) {
  1410. toArgs[keyOption] = fromArgs[key];
  1411. } else if (isPlainObject$1(keyOption)) {
  1412. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1413. }
  1414. } else if (CALLBACKS.indexOf(key) !== -1) {
  1415. const callback = fromArgs[key];
  1416. if (isFunction(callback)) {
  1417. toArgs[key] = processCallback(methodName, callback, returnValue);
  1418. }
  1419. } else {
  1420. if (!keepFromArgs && !hasOwn$1(toArgs, key)) {
  1421. toArgs[key] = fromArgs[key];
  1422. }
  1423. }
  1424. }
  1425. return toArgs;
  1426. } else if (isFunction(fromArgs)) {
  1427. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1428. }
  1429. return fromArgs;
  1430. }
  1431. function processReturnValue(methodName, res, returnValue, keepReturnValue = false) {
  1432. if (isFunction(protocols2.returnValue)) {
  1433. res = protocols2.returnValue(methodName, res);
  1434. }
  1435. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1436. }
  1437. return function wrapper(methodName, method) {
  1438. if (!hasOwn$1(protocols2, methodName)) {
  1439. return method;
  1440. }
  1441. const protocol = protocols2[methodName];
  1442. if (!protocol) {
  1443. return function() {
  1444. console.error(`微信小程序 暂不支持${methodName}`);
  1445. };
  1446. }
  1447. return function(arg1, arg2) {
  1448. let options = protocol;
  1449. if (isFunction(protocol)) {
  1450. options = protocol(arg1);
  1451. }
  1452. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1453. const args = [arg1];
  1454. if (typeof arg2 !== "undefined") {
  1455. args.push(arg2);
  1456. }
  1457. const returnValue = wx[options.name || methodName].apply(wx, args);
  1458. if (isSyncApi(methodName)) {
  1459. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1460. }
  1461. return returnValue;
  1462. };
  1463. };
  1464. }
  1465. const getLocale = () => {
  1466. const app = isFunction(getApp) && getApp({ allowDefault: true });
  1467. if (app && app.$vm) {
  1468. return app.$vm.$locale;
  1469. }
  1470. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1471. };
  1472. const setLocale = (locale) => {
  1473. const app = isFunction(getApp) && getApp();
  1474. if (!app) {
  1475. return false;
  1476. }
  1477. const oldLocale = app.$vm.$locale;
  1478. if (oldLocale !== locale) {
  1479. app.$vm.$locale = locale;
  1480. onLocaleChangeCallbacks.forEach((fn) => fn({ locale }));
  1481. return true;
  1482. }
  1483. return false;
  1484. };
  1485. const onLocaleChangeCallbacks = [];
  1486. const onLocaleChange = (fn) => {
  1487. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  1488. onLocaleChangeCallbacks.push(fn);
  1489. }
  1490. };
  1491. if (typeof global !== "undefined") {
  1492. global.getLocale = getLocale;
  1493. }
  1494. const UUID_KEY = "__DC_STAT_UUID";
  1495. let deviceId;
  1496. function useDeviceId(global2 = wx) {
  1497. return function addDeviceId(_, toRes) {
  1498. deviceId = deviceId || global2.getStorageSync(UUID_KEY);
  1499. if (!deviceId) {
  1500. deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
  1501. wx.setStorage({
  1502. key: UUID_KEY,
  1503. data: deviceId
  1504. });
  1505. }
  1506. toRes.deviceId = deviceId;
  1507. };
  1508. }
  1509. function addSafeAreaInsets(fromRes, toRes) {
  1510. if (fromRes.safeArea) {
  1511. const safeArea = fromRes.safeArea;
  1512. toRes.safeAreaInsets = {
  1513. top: safeArea.top,
  1514. left: safeArea.left,
  1515. right: fromRes.windowWidth - safeArea.right,
  1516. bottom: fromRes.screenHeight - safeArea.bottom
  1517. };
  1518. }
  1519. }
  1520. function populateParameters(fromRes, toRes) {
  1521. const { brand = "", model = "", system = "", language = "", theme, version: version2, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation } = fromRes;
  1522. let osName = "";
  1523. let osVersion = "";
  1524. {
  1525. osName = system.split(" ")[0] || "";
  1526. osVersion = system.split(" ")[1] || "";
  1527. }
  1528. let hostVersion = version2;
  1529. let deviceType = getGetDeviceType(fromRes, model);
  1530. let deviceBrand = getDeviceBrand(brand);
  1531. let _hostName = getHostName(fromRes);
  1532. let _deviceOrientation = deviceOrientation;
  1533. let _devicePixelRatio = pixelRatio;
  1534. let _SDKVersion = SDKVersion;
  1535. const hostLanguage = language.replace(/_/g, "-");
  1536. const parameters = {
  1537. appId: "__UNI__C0A0927",
  1538. appName: "PhoneCaseDIY",
  1539. appVersion: "1.0.0",
  1540. appVersionCode: "100",
  1541. appLanguage: getAppLanguage(hostLanguage),
  1542. uniCompileVersion: "4.29",
  1543. uniRuntimeVersion: "4.29",
  1544. uniPlatform: "mp-weixin",
  1545. deviceBrand,
  1546. deviceModel: model,
  1547. deviceType,
  1548. devicePixelRatio: _devicePixelRatio,
  1549. deviceOrientation: _deviceOrientation,
  1550. osName: osName.toLocaleLowerCase(),
  1551. osVersion,
  1552. hostTheme: theme,
  1553. hostVersion,
  1554. hostLanguage,
  1555. hostName: _hostName,
  1556. hostSDKVersion: _SDKVersion,
  1557. hostFontSizeSetting: fontSizeSetting,
  1558. windowTop: 0,
  1559. windowBottom: 0,
  1560. // TODO
  1561. osLanguage: void 0,
  1562. osTheme: void 0,
  1563. ua: void 0,
  1564. hostPackageName: void 0,
  1565. browserName: void 0,
  1566. browserVersion: void 0
  1567. };
  1568. extend(toRes, parameters);
  1569. }
  1570. function getGetDeviceType(fromRes, model) {
  1571. let deviceType = fromRes.deviceType || "phone";
  1572. {
  1573. const deviceTypeMaps = {
  1574. ipad: "pad",
  1575. windows: "pc",
  1576. mac: "pc"
  1577. };
  1578. const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  1579. const _model = model.toLocaleLowerCase();
  1580. for (let index2 = 0; index2 < deviceTypeMapsKeys.length; index2++) {
  1581. const _m = deviceTypeMapsKeys[index2];
  1582. if (_model.indexOf(_m) !== -1) {
  1583. deviceType = deviceTypeMaps[_m];
  1584. break;
  1585. }
  1586. }
  1587. }
  1588. return deviceType;
  1589. }
  1590. function getDeviceBrand(brand) {
  1591. let deviceBrand = brand;
  1592. if (deviceBrand) {
  1593. deviceBrand = deviceBrand.toLocaleLowerCase();
  1594. }
  1595. return deviceBrand;
  1596. }
  1597. function getAppLanguage(defaultLanguage) {
  1598. return getLocale ? getLocale() : defaultLanguage;
  1599. }
  1600. function getHostName(fromRes) {
  1601. const _platform = "WeChat";
  1602. let _hostName = fromRes.hostName || _platform;
  1603. {
  1604. if (fromRes.environment) {
  1605. _hostName = fromRes.environment;
  1606. } else if (fromRes.host && fromRes.host.env) {
  1607. _hostName = fromRes.host.env;
  1608. }
  1609. }
  1610. return _hostName;
  1611. }
  1612. const getSystemInfo = {
  1613. returnValue: (fromRes, toRes) => {
  1614. addSafeAreaInsets(fromRes, toRes);
  1615. useDeviceId()(fromRes, toRes);
  1616. populateParameters(fromRes, toRes);
  1617. }
  1618. };
  1619. const getSystemInfoSync = getSystemInfo;
  1620. const redirectTo = {};
  1621. const previewImage = {
  1622. args(fromArgs, toArgs) {
  1623. let currentIndex = parseInt(fromArgs.current);
  1624. if (isNaN(currentIndex)) {
  1625. return;
  1626. }
  1627. const urls = fromArgs.urls;
  1628. if (!isArray(urls)) {
  1629. return;
  1630. }
  1631. const len = urls.length;
  1632. if (!len) {
  1633. return;
  1634. }
  1635. if (currentIndex < 0) {
  1636. currentIndex = 0;
  1637. } else if (currentIndex >= len) {
  1638. currentIndex = len - 1;
  1639. }
  1640. if (currentIndex > 0) {
  1641. toArgs.current = urls[currentIndex];
  1642. toArgs.urls = urls.filter((item, index2) => index2 < currentIndex ? item !== urls[currentIndex] : true);
  1643. } else {
  1644. toArgs.current = urls[0];
  1645. }
  1646. return {
  1647. indicator: false,
  1648. loop: false
  1649. };
  1650. }
  1651. };
  1652. const showActionSheet = {
  1653. args(fromArgs, toArgs) {
  1654. toArgs.alertText = fromArgs.title;
  1655. }
  1656. };
  1657. const getDeviceInfo = {
  1658. returnValue: (fromRes, toRes) => {
  1659. const { brand, model } = fromRes;
  1660. let deviceType = getGetDeviceType(fromRes, model);
  1661. let deviceBrand = getDeviceBrand(brand);
  1662. useDeviceId()(fromRes, toRes);
  1663. toRes = sortObject(extend(toRes, {
  1664. deviceType,
  1665. deviceBrand,
  1666. deviceModel: model
  1667. }));
  1668. }
  1669. };
  1670. const getAppBaseInfo = {
  1671. returnValue: (fromRes, toRes) => {
  1672. const { version: version2, language, SDKVersion, theme } = fromRes;
  1673. let _hostName = getHostName(fromRes);
  1674. let hostLanguage = language.replace(/_/g, "-");
  1675. toRes = sortObject(extend(toRes, {
  1676. hostVersion: version2,
  1677. hostLanguage,
  1678. hostName: _hostName,
  1679. hostSDKVersion: SDKVersion,
  1680. hostTheme: theme,
  1681. appId: "__UNI__C0A0927",
  1682. appName: "PhoneCaseDIY",
  1683. appVersion: "1.0.0",
  1684. appVersionCode: "100",
  1685. appLanguage: getAppLanguage(hostLanguage)
  1686. }));
  1687. }
  1688. };
  1689. const getWindowInfo = {
  1690. returnValue: (fromRes, toRes) => {
  1691. addSafeAreaInsets(fromRes, toRes);
  1692. toRes = sortObject(extend(toRes, {
  1693. windowTop: 0,
  1694. windowBottom: 0
  1695. }));
  1696. }
  1697. };
  1698. const getAppAuthorizeSetting = {
  1699. returnValue: function(fromRes, toRes) {
  1700. const { locationReducedAccuracy } = fromRes;
  1701. toRes.locationAccuracy = "unsupported";
  1702. if (locationReducedAccuracy === true) {
  1703. toRes.locationAccuracy = "reduced";
  1704. } else if (locationReducedAccuracy === false) {
  1705. toRes.locationAccuracy = "full";
  1706. }
  1707. }
  1708. };
  1709. const baseApis = {
  1710. $on,
  1711. $off,
  1712. $once,
  1713. $emit,
  1714. upx2px,
  1715. interceptors,
  1716. addInterceptor,
  1717. removeInterceptor,
  1718. onCreateVueApp,
  1719. invokeCreateVueAppHook,
  1720. getLocale,
  1721. setLocale,
  1722. onLocaleChange,
  1723. getPushClientId,
  1724. onPushMessage,
  1725. offPushMessage,
  1726. invokePushCallback
  1727. };
  1728. function initUni(api, protocols2, platform = wx) {
  1729. const wrapper = initWrapper(protocols2);
  1730. const UniProxyHandlers = {
  1731. get(target, key) {
  1732. if (hasOwn$1(target, key)) {
  1733. return target[key];
  1734. }
  1735. if (hasOwn$1(api, key)) {
  1736. return promisify(key, api[key]);
  1737. }
  1738. if (hasOwn$1(baseApis, key)) {
  1739. return promisify(key, baseApis[key]);
  1740. }
  1741. return promisify(key, wrapper(key, platform[key]));
  1742. }
  1743. };
  1744. return new Proxy({}, UniProxyHandlers);
  1745. }
  1746. function initGetProvider(providers) {
  1747. return function getProvider2({ service, success, fail, complete }) {
  1748. let res;
  1749. if (providers[service]) {
  1750. res = {
  1751. errMsg: "getProvider:ok",
  1752. service,
  1753. provider: providers[service]
  1754. };
  1755. isFunction(success) && success(res);
  1756. } else {
  1757. res = {
  1758. errMsg: "getProvider:fail:服务[" + service + "]不存在"
  1759. };
  1760. isFunction(fail) && fail(res);
  1761. }
  1762. isFunction(complete) && complete(res);
  1763. };
  1764. }
  1765. const objectKeys = [
  1766. "qy",
  1767. "env",
  1768. "error",
  1769. "version",
  1770. "lanDebug",
  1771. "cloud",
  1772. "serviceMarket",
  1773. "router",
  1774. "worklet",
  1775. "__webpack_require_UNI_MP_PLUGIN__"
  1776. ];
  1777. const singlePageDisableKey = ["lanDebug", "router", "worklet"];
  1778. const launchOption = wx.getLaunchOptionsSync ? wx.getLaunchOptionsSync() : null;
  1779. function isWxKey(key) {
  1780. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  1781. return false;
  1782. }
  1783. return objectKeys.indexOf(key) > -1 || typeof wx[key] === "function";
  1784. }
  1785. function initWx() {
  1786. const newWx = {};
  1787. for (const key in wx) {
  1788. if (isWxKey(key)) {
  1789. newWx[key] = wx[key];
  1790. }
  1791. }
  1792. if (typeof globalThis !== "undefined" && typeof requireMiniProgram === "undefined") {
  1793. globalThis.wx = newWx;
  1794. }
  1795. return newWx;
  1796. }
  1797. const mocks$1 = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  1798. const getProvider = initGetProvider({
  1799. oauth: ["weixin"],
  1800. share: ["weixin"],
  1801. payment: ["wxpay"],
  1802. push: ["weixin"]
  1803. });
  1804. function initComponentMocks(component) {
  1805. const res = /* @__PURE__ */ Object.create(null);
  1806. mocks$1.forEach((name) => {
  1807. res[name] = component[name];
  1808. });
  1809. return res;
  1810. }
  1811. function createSelectorQuery() {
  1812. const query = wx$2.createSelectorQuery();
  1813. const oldIn = query.in;
  1814. query.in = function newIn(component) {
  1815. return oldIn.call(this, initComponentMocks(component));
  1816. };
  1817. return query;
  1818. }
  1819. const wx$2 = initWx();
  1820. let baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();
  1821. if (!baseInfo) {
  1822. baseInfo = wx$2.getSystemInfoSync();
  1823. }
  1824. const host = baseInfo ? baseInfo.host : null;
  1825. const shareVideoMessage = host && host.env === "SAAASDK" ? wx$2.miniapp.shareVideoMessage : wx$2.shareVideoMessage;
  1826. var shims = /* @__PURE__ */ Object.freeze({
  1827. __proto__: null,
  1828. createSelectorQuery,
  1829. getProvider,
  1830. shareVideoMessage
  1831. });
  1832. const compressImage = {
  1833. args(fromArgs, toArgs) {
  1834. if (fromArgs.compressedHeight && !toArgs.compressHeight) {
  1835. toArgs.compressHeight = fromArgs.compressedHeight;
  1836. }
  1837. if (fromArgs.compressedWidth && !toArgs.compressWidth) {
  1838. toArgs.compressWidth = fromArgs.compressedWidth;
  1839. }
  1840. }
  1841. };
  1842. var protocols = /* @__PURE__ */ Object.freeze({
  1843. __proto__: null,
  1844. compressImage,
  1845. getAppAuthorizeSetting,
  1846. getAppBaseInfo,
  1847. getDeviceInfo,
  1848. getSystemInfo,
  1849. getSystemInfoSync,
  1850. getWindowInfo,
  1851. previewImage,
  1852. redirectTo,
  1853. showActionSheet
  1854. });
  1855. const wx$1 = initWx();
  1856. var index = initUni(shims, protocols, wx$1);
  1857. new Set(
  1858. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1859. );
  1860. function toRaw$1(observed) {
  1861. const raw = observed && observed["__v_raw"];
  1862. return raw ? toRaw$1(raw) : observed;
  1863. }
  1864. function isRef$1(r2) {
  1865. return !!(r2 && r2.__v_isRef === true);
  1866. }
  1867. /**
  1868. * @vue/runtime-core v3.4.21
  1869. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  1870. * @license MIT
  1871. **/
  1872. const stack$1 = [];
  1873. function pushWarningContext$1(vnode) {
  1874. stack$1.push(vnode);
  1875. }
  1876. function popWarningContext$1() {
  1877. stack$1.pop();
  1878. }
  1879. function warn$1$1(msg, ...args) {
  1880. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1881. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1882. const trace = getComponentTrace$1();
  1883. if (appWarnHandler) {
  1884. callWithErrorHandling$1(
  1885. appWarnHandler,
  1886. instance,
  1887. 11,
  1888. [
  1889. msg + args.map((a) => {
  1890. var _a, _b;
  1891. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1892. }).join(""),
  1893. instance && instance.proxy,
  1894. trace.map(
  1895. ({ vnode }) => `at <${formatComponentName$1(instance, vnode.type)}>`
  1896. ).join("\n"),
  1897. trace
  1898. ]
  1899. );
  1900. } else {
  1901. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1902. if (trace.length && // avoid spamming console during tests
  1903. true) {
  1904. warnArgs.push(`
  1905. `, ...formatTrace$1(trace));
  1906. }
  1907. console.warn(...warnArgs);
  1908. }
  1909. }
  1910. function getComponentTrace$1() {
  1911. let currentVNode = stack$1[stack$1.length - 1];
  1912. if (!currentVNode) {
  1913. return [];
  1914. }
  1915. const normalizedStack = [];
  1916. while (currentVNode) {
  1917. const last = normalizedStack[0];
  1918. if (last && last.vnode === currentVNode) {
  1919. last.recurseCount++;
  1920. } else {
  1921. normalizedStack.push({
  1922. vnode: currentVNode,
  1923. recurseCount: 0
  1924. });
  1925. }
  1926. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1927. currentVNode = parentInstance && parentInstance.vnode;
  1928. }
  1929. return normalizedStack;
  1930. }
  1931. function formatTrace$1(trace) {
  1932. const logs = [];
  1933. trace.forEach((entry, i) => {
  1934. logs.push(...i === 0 ? [] : [`
  1935. `], ...formatTraceEntry$1(entry));
  1936. });
  1937. return logs;
  1938. }
  1939. function formatTraceEntry$1({ vnode, recurseCount }) {
  1940. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1941. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1942. const open = ` at <${formatComponentName$1(
  1943. vnode.component,
  1944. vnode.type,
  1945. isRoot
  1946. )}`;
  1947. const close = `>` + postfix;
  1948. return vnode.props ? [open, ...formatProps$1(vnode.props), close] : [open + close];
  1949. }
  1950. function formatProps$1(props) {
  1951. const res = [];
  1952. const keys = Object.keys(props);
  1953. keys.slice(0, 3).forEach((key) => {
  1954. res.push(...formatProp$1(key, props[key]));
  1955. });
  1956. if (keys.length > 3) {
  1957. res.push(` ...`);
  1958. }
  1959. return res;
  1960. }
  1961. function formatProp$1(key, value, raw) {
  1962. if (isString(value)) {
  1963. value = JSON.stringify(value);
  1964. return raw ? value : [`${key}=${value}`];
  1965. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1966. return raw ? value : [`${key}=${value}`];
  1967. } else if (isRef$1(value)) {
  1968. value = formatProp$1(key, toRaw$1(value.value), true);
  1969. return raw ? value : [`${key}=Ref<`, value, `>`];
  1970. } else if (isFunction(value)) {
  1971. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1972. } else {
  1973. value = toRaw$1(value);
  1974. return raw ? value : [`${key}=`, value];
  1975. }
  1976. }
  1977. const ErrorTypeStrings$1 = {
  1978. ["sp"]: "serverPrefetch hook",
  1979. ["bc"]: "beforeCreate hook",
  1980. ["c"]: "created hook",
  1981. ["bm"]: "beforeMount hook",
  1982. ["m"]: "mounted hook",
  1983. ["bu"]: "beforeUpdate hook",
  1984. ["u"]: "updated",
  1985. ["bum"]: "beforeUnmount hook",
  1986. ["um"]: "unmounted hook",
  1987. ["a"]: "activated hook",
  1988. ["da"]: "deactivated hook",
  1989. ["ec"]: "errorCaptured hook",
  1990. ["rtc"]: "renderTracked hook",
  1991. ["rtg"]: "renderTriggered hook",
  1992. [0]: "setup function",
  1993. [1]: "render function",
  1994. [2]: "watcher getter",
  1995. [3]: "watcher callback",
  1996. [4]: "watcher cleanup function",
  1997. [5]: "native event handler",
  1998. [6]: "component event handler",
  1999. [7]: "vnode hook",
  2000. [8]: "directive hook",
  2001. [9]: "transition hook",
  2002. [10]: "app errorHandler",
  2003. [11]: "app warnHandler",
  2004. [12]: "ref function",
  2005. [13]: "async component loader",
  2006. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  2007. };
  2008. function callWithErrorHandling$1(fn, instance, type, args) {
  2009. try {
  2010. return args ? fn(...args) : fn();
  2011. } catch (err) {
  2012. handleError$1(err, instance, type);
  2013. }
  2014. }
  2015. function handleError$1(err, instance, type, throwInDev = true) {
  2016. const contextVNode = instance ? instance.vnode : null;
  2017. if (instance) {
  2018. let cur = instance.parent;
  2019. const exposedInstance = instance.proxy;
  2020. const errorInfo = ErrorTypeStrings$1[type];
  2021. while (cur) {
  2022. const errorCapturedHooks = cur.ec;
  2023. if (errorCapturedHooks) {
  2024. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2025. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2026. return;
  2027. }
  2028. }
  2029. }
  2030. cur = cur.parent;
  2031. }
  2032. const appErrorHandler = instance.appContext.config.errorHandler;
  2033. if (appErrorHandler) {
  2034. callWithErrorHandling$1(
  2035. appErrorHandler,
  2036. null,
  2037. 10,
  2038. [err, exposedInstance, errorInfo]
  2039. );
  2040. return;
  2041. }
  2042. }
  2043. logError$1(err, type, contextVNode, throwInDev);
  2044. }
  2045. function logError$1(err, type, contextVNode, throwInDev = true) {
  2046. {
  2047. const info = ErrorTypeStrings$1[type];
  2048. if (contextVNode) {
  2049. pushWarningContext$1(contextVNode);
  2050. }
  2051. warn$1$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2052. if (contextVNode) {
  2053. popWarningContext$1();
  2054. }
  2055. if (throwInDev) {
  2056. throw err;
  2057. } else {
  2058. console.error(err);
  2059. }
  2060. }
  2061. }
  2062. let isFlushing$1 = false;
  2063. let isFlushPending$1 = false;
  2064. const queue$1 = [];
  2065. let flushIndex$1 = 0;
  2066. const pendingPostFlushCbs$1 = [];
  2067. let activePostFlushCbs$1 = null;
  2068. let postFlushIndex$1 = 0;
  2069. const resolvedPromise$1 = /* @__PURE__ */ Promise.resolve();
  2070. const RECURSION_LIMIT$1 = 100;
  2071. function findInsertionIndex$1(id) {
  2072. let start = flushIndex$1 + 1;
  2073. let end = queue$1.length;
  2074. while (start < end) {
  2075. const middle = start + end >>> 1;
  2076. const middleJob = queue$1[middle];
  2077. const middleJobId = getId$1(middleJob);
  2078. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  2079. start = middle + 1;
  2080. } else {
  2081. end = middle;
  2082. }
  2083. }
  2084. return start;
  2085. }
  2086. function queueJob$1(job) {
  2087. if (!queue$1.length || !queue$1.includes(
  2088. job,
  2089. isFlushing$1 && job.allowRecurse ? flushIndex$1 + 1 : flushIndex$1
  2090. )) {
  2091. if (job.id == null) {
  2092. queue$1.push(job);
  2093. } else {
  2094. queue$1.splice(findInsertionIndex$1(job.id), 0, job);
  2095. }
  2096. queueFlush$1();
  2097. }
  2098. }
  2099. function queueFlush$1() {
  2100. if (!isFlushing$1 && !isFlushPending$1) {
  2101. isFlushPending$1 = true;
  2102. resolvedPromise$1.then(flushJobs$1);
  2103. }
  2104. }
  2105. function queuePostFlushCb$1(cb) {
  2106. if (!isArray(cb)) {
  2107. if (!activePostFlushCbs$1 || !activePostFlushCbs$1.includes(
  2108. cb,
  2109. cb.allowRecurse ? postFlushIndex$1 + 1 : postFlushIndex$1
  2110. )) {
  2111. pendingPostFlushCbs$1.push(cb);
  2112. }
  2113. } else {
  2114. pendingPostFlushCbs$1.push(...cb);
  2115. }
  2116. queueFlush$1();
  2117. }
  2118. function flushPostFlushCbs$1(seen) {
  2119. if (pendingPostFlushCbs$1.length) {
  2120. const deduped = [...new Set(pendingPostFlushCbs$1)].sort(
  2121. (a, b) => getId$1(a) - getId$1(b)
  2122. );
  2123. pendingPostFlushCbs$1.length = 0;
  2124. if (activePostFlushCbs$1) {
  2125. activePostFlushCbs$1.push(...deduped);
  2126. return;
  2127. }
  2128. activePostFlushCbs$1 = deduped;
  2129. {
  2130. seen = seen || /* @__PURE__ */ new Map();
  2131. }
  2132. for (postFlushIndex$1 = 0; postFlushIndex$1 < activePostFlushCbs$1.length; postFlushIndex$1++) {
  2133. if (checkRecursiveUpdates$1(seen, activePostFlushCbs$1[postFlushIndex$1])) {
  2134. continue;
  2135. }
  2136. activePostFlushCbs$1[postFlushIndex$1]();
  2137. }
  2138. activePostFlushCbs$1 = null;
  2139. postFlushIndex$1 = 0;
  2140. }
  2141. }
  2142. const getId$1 = (job) => job.id == null ? Infinity : job.id;
  2143. const comparator$1 = (a, b) => {
  2144. const diff2 = getId$1(a) - getId$1(b);
  2145. if (diff2 === 0) {
  2146. if (a.pre && !b.pre)
  2147. return -1;
  2148. if (b.pre && !a.pre)
  2149. return 1;
  2150. }
  2151. return diff2;
  2152. };
  2153. function flushJobs$1(seen) {
  2154. isFlushPending$1 = false;
  2155. isFlushing$1 = true;
  2156. {
  2157. seen = seen || /* @__PURE__ */ new Map();
  2158. }
  2159. queue$1.sort(comparator$1);
  2160. const check = (job) => checkRecursiveUpdates$1(seen, job);
  2161. try {
  2162. for (flushIndex$1 = 0; flushIndex$1 < queue$1.length; flushIndex$1++) {
  2163. const job = queue$1[flushIndex$1];
  2164. if (job && job.active !== false) {
  2165. if (check(job)) {
  2166. continue;
  2167. }
  2168. callWithErrorHandling$1(job, null, 14);
  2169. }
  2170. }
  2171. } finally {
  2172. flushIndex$1 = 0;
  2173. queue$1.length = 0;
  2174. flushPostFlushCbs$1(seen);
  2175. isFlushing$1 = false;
  2176. if (queue$1.length || pendingPostFlushCbs$1.length) {
  2177. flushJobs$1(seen);
  2178. }
  2179. }
  2180. }
  2181. function checkRecursiveUpdates$1(seen, fn) {
  2182. if (!seen.has(fn)) {
  2183. seen.set(fn, 1);
  2184. } else {
  2185. const count = seen.get(fn);
  2186. if (count > RECURSION_LIMIT$1) {
  2187. const instance = fn.ownerInstance;
  2188. const componentName = instance && getComponentName$1(instance.type);
  2189. handleError$1(
  2190. `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.`,
  2191. null,
  2192. 10
  2193. );
  2194. return true;
  2195. } else {
  2196. seen.set(fn, count + 1);
  2197. }
  2198. }
  2199. }
  2200. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  2201. {
  2202. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2203. createRecord: tryWrap(createRecord),
  2204. rerender: tryWrap(rerender),
  2205. reload: tryWrap(reload)
  2206. };
  2207. }
  2208. const map = /* @__PURE__ */ new Map();
  2209. function createRecord(id, initialDef) {
  2210. if (map.has(id)) {
  2211. return false;
  2212. }
  2213. map.set(id, {
  2214. initialDef: normalizeClassComponent(initialDef),
  2215. instances: /* @__PURE__ */ new Set()
  2216. });
  2217. return true;
  2218. }
  2219. function normalizeClassComponent(component) {
  2220. return isClassComponent$1(component) ? component.__vccOpts : component;
  2221. }
  2222. function rerender(id, newRender) {
  2223. const record = map.get(id);
  2224. if (!record) {
  2225. return;
  2226. }
  2227. record.initialDef.render = newRender;
  2228. [...record.instances].forEach((instance) => {
  2229. if (newRender) {
  2230. instance.render = newRender;
  2231. normalizeClassComponent(instance.type).render = newRender;
  2232. }
  2233. instance.renderCache = [];
  2234. instance.effect.dirty = true;
  2235. instance.update();
  2236. });
  2237. }
  2238. function reload(id, newComp) {
  2239. const record = map.get(id);
  2240. if (!record)
  2241. return;
  2242. newComp = normalizeClassComponent(newComp);
  2243. updateComponentDef(record.initialDef, newComp);
  2244. const instances = [...record.instances];
  2245. for (const instance of instances) {
  2246. const oldComp = normalizeClassComponent(instance.type);
  2247. if (!hmrDirtyComponents.has(oldComp)) {
  2248. if (oldComp !== record.initialDef) {
  2249. updateComponentDef(oldComp, newComp);
  2250. }
  2251. hmrDirtyComponents.add(oldComp);
  2252. }
  2253. instance.appContext.propsCache.delete(instance.type);
  2254. instance.appContext.emitsCache.delete(instance.type);
  2255. instance.appContext.optionsCache.delete(instance.type);
  2256. if (instance.ceReload) {
  2257. hmrDirtyComponents.add(oldComp);
  2258. instance.ceReload(newComp.styles);
  2259. hmrDirtyComponents.delete(oldComp);
  2260. } else if (instance.parent) {
  2261. instance.parent.effect.dirty = true;
  2262. queueJob$1(instance.parent.update);
  2263. } else if (instance.appContext.reload) {
  2264. instance.appContext.reload();
  2265. } else if (typeof window !== "undefined") {
  2266. window.location.reload();
  2267. } else {
  2268. console.warn(
  2269. "[HMR] Root or manually mounted instance modified. Full reload required."
  2270. );
  2271. }
  2272. }
  2273. queuePostFlushCb$1(() => {
  2274. for (const instance of instances) {
  2275. hmrDirtyComponents.delete(
  2276. normalizeClassComponent(instance.type)
  2277. );
  2278. }
  2279. });
  2280. }
  2281. function updateComponentDef(oldComp, newComp) {
  2282. extend(oldComp, newComp);
  2283. for (const key in oldComp) {
  2284. if (key !== "__file" && !(key in newComp)) {
  2285. delete oldComp[key];
  2286. }
  2287. }
  2288. }
  2289. function tryWrap(fn) {
  2290. return (id, arg) => {
  2291. try {
  2292. return fn(id, arg);
  2293. } catch (e2) {
  2294. console.error(e2);
  2295. console.warn(
  2296. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2297. );
  2298. }
  2299. };
  2300. }
  2301. {
  2302. const g = getGlobalThis();
  2303. const registerGlobalSetter = (key, setter) => {
  2304. let setters;
  2305. if (!(setters = g[key]))
  2306. setters = g[key] = [];
  2307. setters.push(setter);
  2308. return (v) => {
  2309. if (setters.length > 1)
  2310. setters.forEach((set2) => set2(v));
  2311. else
  2312. setters[0](v);
  2313. };
  2314. };
  2315. registerGlobalSetter(
  2316. `__VUE_INSTANCE_SETTERS__`,
  2317. (v) => v
  2318. );
  2319. registerGlobalSetter(
  2320. `__VUE_SSR_SETTERS__`,
  2321. (v) => v
  2322. );
  2323. }
  2324. const classifyRE$1 = /(?:^|[-_])(\w)/g;
  2325. const classify$1 = (str) => str.replace(classifyRE$1, (c2) => c2.toUpperCase()).replace(/[-_]/g, "");
  2326. function getComponentName$1(Component2, includeInferred = true) {
  2327. return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
  2328. }
  2329. function formatComponentName$1(instance, Component2, isRoot = false) {
  2330. let name = getComponentName$1(Component2);
  2331. if (!name && Component2.__file) {
  2332. const match = Component2.__file.match(/([^/\\]+)\.\w+$/);
  2333. if (match) {
  2334. name = match[1];
  2335. }
  2336. }
  2337. if (!name && instance && instance.parent) {
  2338. const inferFromRegistry = (registry) => {
  2339. for (const key in registry) {
  2340. if (registry[key] === Component2) {
  2341. return key;
  2342. }
  2343. }
  2344. };
  2345. name = inferFromRegistry(
  2346. instance.components || instance.parent.type.components
  2347. ) || inferFromRegistry(instance.appContext.components);
  2348. }
  2349. return name ? classify$1(name) : isRoot ? `App` : `Anonymous`;
  2350. }
  2351. function isClassComponent$1(value) {
  2352. return isFunction(value) && "__vccOpts" in value;
  2353. }
  2354. /**
  2355. * @dcloudio/uni-mp-vue v3.4.21
  2356. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  2357. * @license MIT
  2358. **/
  2359. function warn$2(msg, ...args) {
  2360. console.warn(`[Vue warn] ${msg}`, ...args);
  2361. }
  2362. let activeEffectScope;
  2363. class EffectScope {
  2364. constructor(detached = false) {
  2365. this.detached = detached;
  2366. this._active = true;
  2367. this.effects = [];
  2368. this.cleanups = [];
  2369. this.parent = activeEffectScope;
  2370. if (!detached && activeEffectScope) {
  2371. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  2372. this
  2373. ) - 1;
  2374. }
  2375. }
  2376. get active() {
  2377. return this._active;
  2378. }
  2379. run(fn) {
  2380. if (this._active) {
  2381. const currentEffectScope = activeEffectScope;
  2382. try {
  2383. activeEffectScope = this;
  2384. return fn();
  2385. } finally {
  2386. activeEffectScope = currentEffectScope;
  2387. }
  2388. } else {
  2389. warn$2(`cannot run an inactive effect scope.`);
  2390. }
  2391. }
  2392. /**
  2393. * This should only be called on non-detached scopes
  2394. * @internal
  2395. */
  2396. on() {
  2397. activeEffectScope = this;
  2398. }
  2399. /**
  2400. * This should only be called on non-detached scopes
  2401. * @internal
  2402. */
  2403. off() {
  2404. activeEffectScope = this.parent;
  2405. }
  2406. stop(fromParent) {
  2407. if (this._active) {
  2408. let i, l;
  2409. for (i = 0, l = this.effects.length; i < l; i++) {
  2410. this.effects[i].stop();
  2411. }
  2412. for (i = 0, l = this.cleanups.length; i < l; i++) {
  2413. this.cleanups[i]();
  2414. }
  2415. if (this.scopes) {
  2416. for (i = 0, l = this.scopes.length; i < l; i++) {
  2417. this.scopes[i].stop(true);
  2418. }
  2419. }
  2420. if (!this.detached && this.parent && !fromParent) {
  2421. const last = this.parent.scopes.pop();
  2422. if (last && last !== this) {
  2423. this.parent.scopes[this.index] = last;
  2424. last.index = this.index;
  2425. }
  2426. }
  2427. this.parent = void 0;
  2428. this._active = false;
  2429. }
  2430. }
  2431. }
  2432. function effectScope(detached) {
  2433. return new EffectScope(detached);
  2434. }
  2435. function recordEffectScope(effect2, scope = activeEffectScope) {
  2436. if (scope && scope.active) {
  2437. scope.effects.push(effect2);
  2438. }
  2439. }
  2440. function getCurrentScope() {
  2441. return activeEffectScope;
  2442. }
  2443. function onScopeDispose(fn) {
  2444. if (activeEffectScope) {
  2445. activeEffectScope.cleanups.push(fn);
  2446. } else {
  2447. warn$2(
  2448. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  2449. );
  2450. }
  2451. }
  2452. let activeEffect;
  2453. class ReactiveEffect2 {
  2454. constructor(fn, trigger2, scheduler, scope) {
  2455. this.fn = fn;
  2456. this.trigger = trigger2;
  2457. this.scheduler = scheduler;
  2458. this.active = true;
  2459. this.deps = [];
  2460. this._dirtyLevel = 4;
  2461. this._trackId = 0;
  2462. this._runnings = 0;
  2463. this._shouldSchedule = false;
  2464. this._depsLength = 0;
  2465. recordEffectScope(this, scope);
  2466. }
  2467. get dirty() {
  2468. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  2469. this._dirtyLevel = 1;
  2470. pauseTracking();
  2471. for (let i = 0; i < this._depsLength; i++) {
  2472. const dep = this.deps[i];
  2473. if (dep.computed) {
  2474. triggerComputed(dep.computed);
  2475. if (this._dirtyLevel >= 4) {
  2476. break;
  2477. }
  2478. }
  2479. }
  2480. if (this._dirtyLevel === 1) {
  2481. this._dirtyLevel = 0;
  2482. }
  2483. resetTracking();
  2484. }
  2485. return this._dirtyLevel >= 4;
  2486. }
  2487. set dirty(v) {
  2488. this._dirtyLevel = v ? 4 : 0;
  2489. }
  2490. run() {
  2491. this._dirtyLevel = 0;
  2492. if (!this.active) {
  2493. return this.fn();
  2494. }
  2495. let lastShouldTrack = shouldTrack;
  2496. let lastEffect = activeEffect;
  2497. try {
  2498. shouldTrack = true;
  2499. activeEffect = this;
  2500. this._runnings++;
  2501. preCleanupEffect(this);
  2502. return this.fn();
  2503. } finally {
  2504. postCleanupEffect(this);
  2505. this._runnings--;
  2506. activeEffect = lastEffect;
  2507. shouldTrack = lastShouldTrack;
  2508. }
  2509. }
  2510. stop() {
  2511. var _a;
  2512. if (this.active) {
  2513. preCleanupEffect(this);
  2514. postCleanupEffect(this);
  2515. (_a = this.onStop) == null ? void 0 : _a.call(this);
  2516. this.active = false;
  2517. }
  2518. }
  2519. }
  2520. function triggerComputed(computed2) {
  2521. return computed2.value;
  2522. }
  2523. function preCleanupEffect(effect2) {
  2524. effect2._trackId++;
  2525. effect2._depsLength = 0;
  2526. }
  2527. function postCleanupEffect(effect2) {
  2528. if (effect2.deps.length > effect2._depsLength) {
  2529. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  2530. cleanupDepEffect(effect2.deps[i], effect2);
  2531. }
  2532. effect2.deps.length = effect2._depsLength;
  2533. }
  2534. }
  2535. function cleanupDepEffect(dep, effect2) {
  2536. const trackId = dep.get(effect2);
  2537. if (trackId !== void 0 && effect2._trackId !== trackId) {
  2538. dep.delete(effect2);
  2539. if (dep.size === 0) {
  2540. dep.cleanup();
  2541. }
  2542. }
  2543. }
  2544. let shouldTrack = true;
  2545. let pauseScheduleStack = 0;
  2546. const trackStack = [];
  2547. function pauseTracking() {
  2548. trackStack.push(shouldTrack);
  2549. shouldTrack = false;
  2550. }
  2551. function resetTracking() {
  2552. const last = trackStack.pop();
  2553. shouldTrack = last === void 0 ? true : last;
  2554. }
  2555. function pauseScheduling() {
  2556. pauseScheduleStack++;
  2557. }
  2558. function resetScheduling() {
  2559. pauseScheduleStack--;
  2560. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  2561. queueEffectSchedulers.shift()();
  2562. }
  2563. }
  2564. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  2565. var _a;
  2566. if (dep.get(effect2) !== effect2._trackId) {
  2567. dep.set(effect2, effect2._trackId);
  2568. const oldDep = effect2.deps[effect2._depsLength];
  2569. if (oldDep !== dep) {
  2570. if (oldDep) {
  2571. cleanupDepEffect(oldDep, effect2);
  2572. }
  2573. effect2.deps[effect2._depsLength++] = dep;
  2574. } else {
  2575. effect2._depsLength++;
  2576. }
  2577. {
  2578. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  2579. }
  2580. }
  2581. }
  2582. const queueEffectSchedulers = [];
  2583. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  2584. var _a;
  2585. pauseScheduling();
  2586. for (const effect2 of dep.keys()) {
  2587. let tracking;
  2588. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  2589. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  2590. effect2._dirtyLevel = dirtyLevel;
  2591. }
  2592. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  2593. {
  2594. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  2595. }
  2596. effect2.trigger();
  2597. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  2598. effect2._shouldSchedule = false;
  2599. if (effect2.scheduler) {
  2600. queueEffectSchedulers.push(effect2.scheduler);
  2601. }
  2602. }
  2603. }
  2604. }
  2605. resetScheduling();
  2606. }
  2607. const createDep = (cleanup, computed2) => {
  2608. const dep = /* @__PURE__ */ new Map();
  2609. dep.cleanup = cleanup;
  2610. dep.computed = computed2;
  2611. return dep;
  2612. };
  2613. const targetMap = /* @__PURE__ */ new WeakMap();
  2614. const ITERATE_KEY = Symbol("iterate");
  2615. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  2616. function track(target, type, key) {
  2617. if (shouldTrack && activeEffect) {
  2618. let depsMap = targetMap.get(target);
  2619. if (!depsMap) {
  2620. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  2621. }
  2622. let dep = depsMap.get(key);
  2623. if (!dep) {
  2624. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  2625. }
  2626. trackEffect(
  2627. activeEffect,
  2628. dep,
  2629. {
  2630. target,
  2631. type,
  2632. key
  2633. }
  2634. );
  2635. }
  2636. }
  2637. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  2638. const depsMap = targetMap.get(target);
  2639. if (!depsMap) {
  2640. return;
  2641. }
  2642. let deps = [];
  2643. if (type === "clear") {
  2644. deps = [...depsMap.values()];
  2645. } else if (key === "length" && isArray(target)) {
  2646. const newLength = Number(newValue);
  2647. depsMap.forEach((dep, key2) => {
  2648. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  2649. deps.push(dep);
  2650. }
  2651. });
  2652. } else {
  2653. if (key !== void 0) {
  2654. deps.push(depsMap.get(key));
  2655. }
  2656. switch (type) {
  2657. case "add":
  2658. if (!isArray(target)) {
  2659. deps.push(depsMap.get(ITERATE_KEY));
  2660. if (isMap(target)) {
  2661. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  2662. }
  2663. } else if (isIntegerKey(key)) {
  2664. deps.push(depsMap.get("length"));
  2665. }
  2666. break;
  2667. case "delete":
  2668. if (!isArray(target)) {
  2669. deps.push(depsMap.get(ITERATE_KEY));
  2670. if (isMap(target)) {
  2671. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  2672. }
  2673. }
  2674. break;
  2675. case "set":
  2676. if (isMap(target)) {
  2677. deps.push(depsMap.get(ITERATE_KEY));
  2678. }
  2679. break;
  2680. }
  2681. }
  2682. pauseScheduling();
  2683. for (const dep of deps) {
  2684. if (dep) {
  2685. triggerEffects(
  2686. dep,
  2687. 4,
  2688. {
  2689. target,
  2690. type,
  2691. key,
  2692. newValue,
  2693. oldValue,
  2694. oldTarget
  2695. }
  2696. );
  2697. }
  2698. }
  2699. resetScheduling();
  2700. }
  2701. function getDepFromReactive(object, key) {
  2702. var _a;
  2703. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  2704. }
  2705. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  2706. const builtInSymbols = new Set(
  2707. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  2708. );
  2709. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  2710. function createArrayInstrumentations() {
  2711. const instrumentations = {};
  2712. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  2713. instrumentations[key] = function(...args) {
  2714. const arr = toRaw(this);
  2715. for (let i = 0, l = this.length; i < l; i++) {
  2716. track(arr, "get", i + "");
  2717. }
  2718. const res = arr[key](...args);
  2719. if (res === -1 || res === false) {
  2720. return arr[key](...args.map(toRaw));
  2721. } else {
  2722. return res;
  2723. }
  2724. };
  2725. });
  2726. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  2727. instrumentations[key] = function(...args) {
  2728. pauseTracking();
  2729. pauseScheduling();
  2730. const res = toRaw(this)[key].apply(this, args);
  2731. resetScheduling();
  2732. resetTracking();
  2733. return res;
  2734. };
  2735. });
  2736. return instrumentations;
  2737. }
  2738. function hasOwnProperty(key) {
  2739. const obj = toRaw(this);
  2740. track(obj, "has", key);
  2741. return obj.hasOwnProperty(key);
  2742. }
  2743. class BaseReactiveHandler2 {
  2744. constructor(_isReadonly = false, _isShallow = false) {
  2745. this._isReadonly = _isReadonly;
  2746. this._isShallow = _isShallow;
  2747. }
  2748. get(target, key, receiver) {
  2749. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  2750. if (key === "__v_isReactive") {
  2751. return !isReadonly2;
  2752. } else if (key === "__v_isReadonly") {
  2753. return isReadonly2;
  2754. } else if (key === "__v_isShallow") {
  2755. return isShallow2;
  2756. } else if (key === "__v_raw") {
  2757. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  2758. // this means the reciever is a user proxy of the reactive proxy
  2759. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  2760. return target;
  2761. }
  2762. return;
  2763. }
  2764. const targetIsArray = isArray(target);
  2765. if (!isReadonly2) {
  2766. if (targetIsArray && hasOwn$1(arrayInstrumentations, key)) {
  2767. return Reflect.get(arrayInstrumentations, key, receiver);
  2768. }
  2769. if (key === "hasOwnProperty") {
  2770. return hasOwnProperty;
  2771. }
  2772. }
  2773. const res = Reflect.get(target, key, receiver);
  2774. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  2775. return res;
  2776. }
  2777. if (!isReadonly2) {
  2778. track(target, "get", key);
  2779. }
  2780. if (isShallow2) {
  2781. return res;
  2782. }
  2783. if (isRef(res)) {
  2784. return targetIsArray && isIntegerKey(key) ? res : res.value;
  2785. }
  2786. if (isObject$1(res)) {
  2787. return isReadonly2 ? readonly(res) : reactive(res);
  2788. }
  2789. return res;
  2790. }
  2791. }
  2792. class MutableReactiveHandler2 extends BaseReactiveHandler2 {
  2793. constructor(isShallow2 = false) {
  2794. super(false, isShallow2);
  2795. }
  2796. set(target, key, value, receiver) {
  2797. let oldValue = target[key];
  2798. if (!this._isShallow) {
  2799. const isOldValueReadonly = isReadonly(oldValue);
  2800. if (!isShallow(value) && !isReadonly(value)) {
  2801. oldValue = toRaw(oldValue);
  2802. value = toRaw(value);
  2803. }
  2804. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  2805. if (isOldValueReadonly) {
  2806. return false;
  2807. } else {
  2808. oldValue.value = value;
  2809. return true;
  2810. }
  2811. }
  2812. }
  2813. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$1(target, key);
  2814. const result = Reflect.set(target, key, value, receiver);
  2815. if (target === toRaw(receiver)) {
  2816. if (!hadKey) {
  2817. trigger(target, "add", key, value);
  2818. } else if (hasChanged(value, oldValue)) {
  2819. trigger(target, "set", key, value, oldValue);
  2820. }
  2821. }
  2822. return result;
  2823. }
  2824. deleteProperty(target, key) {
  2825. const hadKey = hasOwn$1(target, key);
  2826. const oldValue = target[key];
  2827. const result = Reflect.deleteProperty(target, key);
  2828. if (result && hadKey) {
  2829. trigger(target, "delete", key, void 0, oldValue);
  2830. }
  2831. return result;
  2832. }
  2833. has(target, key) {
  2834. const result = Reflect.has(target, key);
  2835. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  2836. track(target, "has", key);
  2837. }
  2838. return result;
  2839. }
  2840. ownKeys(target) {
  2841. track(
  2842. target,
  2843. "iterate",
  2844. isArray(target) ? "length" : ITERATE_KEY
  2845. );
  2846. return Reflect.ownKeys(target);
  2847. }
  2848. }
  2849. class ReadonlyReactiveHandler2 extends BaseReactiveHandler2 {
  2850. constructor(isShallow2 = false) {
  2851. super(true, isShallow2);
  2852. }
  2853. set(target, key) {
  2854. {
  2855. warn$2(
  2856. `Set operation on key "${String(key)}" failed: target is readonly.`,
  2857. target
  2858. );
  2859. }
  2860. return true;
  2861. }
  2862. deleteProperty(target, key) {
  2863. {
  2864. warn$2(
  2865. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  2866. target
  2867. );
  2868. }
  2869. return true;
  2870. }
  2871. }
  2872. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler2();
  2873. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler2();
  2874. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler2(
  2875. true
  2876. );
  2877. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler2(true);
  2878. const toShallow = (value) => value;
  2879. const getProto = (v) => Reflect.getPrototypeOf(v);
  2880. function get$1(target, key, isReadonly2 = false, isShallow2 = false) {
  2881. target = target["__v_raw"];
  2882. const rawTarget = toRaw(target);
  2883. const rawKey = toRaw(key);
  2884. if (!isReadonly2) {
  2885. if (hasChanged(key, rawKey)) {
  2886. track(rawTarget, "get", key);
  2887. }
  2888. track(rawTarget, "get", rawKey);
  2889. }
  2890. const { has: has2 } = getProto(rawTarget);
  2891. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2892. if (has2.call(rawTarget, key)) {
  2893. return wrap(target.get(key));
  2894. } else if (has2.call(rawTarget, rawKey)) {
  2895. return wrap(target.get(rawKey));
  2896. } else if (target !== rawTarget) {
  2897. target.get(key);
  2898. }
  2899. }
  2900. function has(key, isReadonly2 = false) {
  2901. const target = this["__v_raw"];
  2902. const rawTarget = toRaw(target);
  2903. const rawKey = toRaw(key);
  2904. if (!isReadonly2) {
  2905. if (hasChanged(key, rawKey)) {
  2906. track(rawTarget, "has", key);
  2907. }
  2908. track(rawTarget, "has", rawKey);
  2909. }
  2910. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  2911. }
  2912. function size(target, isReadonly2 = false) {
  2913. target = target["__v_raw"];
  2914. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  2915. return Reflect.get(target, "size", target);
  2916. }
  2917. function add(value) {
  2918. value = toRaw(value);
  2919. const target = toRaw(this);
  2920. const proto = getProto(target);
  2921. const hadKey = proto.has.call(target, value);
  2922. if (!hadKey) {
  2923. target.add(value);
  2924. trigger(target, "add", value, value);
  2925. }
  2926. return this;
  2927. }
  2928. function set$1$1(key, value) {
  2929. value = toRaw(value);
  2930. const target = toRaw(this);
  2931. const { has: has2, get: get2 } = getProto(target);
  2932. let hadKey = has2.call(target, key);
  2933. if (!hadKey) {
  2934. key = toRaw(key);
  2935. hadKey = has2.call(target, key);
  2936. } else {
  2937. checkIdentityKeys(target, has2, key);
  2938. }
  2939. const oldValue = get2.call(target, key);
  2940. target.set(key, value);
  2941. if (!hadKey) {
  2942. trigger(target, "add", key, value);
  2943. } else if (hasChanged(value, oldValue)) {
  2944. trigger(target, "set", key, value, oldValue);
  2945. }
  2946. return this;
  2947. }
  2948. function deleteEntry(key) {
  2949. const target = toRaw(this);
  2950. const { has: has2, get: get2 } = getProto(target);
  2951. let hadKey = has2.call(target, key);
  2952. if (!hadKey) {
  2953. key = toRaw(key);
  2954. hadKey = has2.call(target, key);
  2955. } else {
  2956. checkIdentityKeys(target, has2, key);
  2957. }
  2958. const oldValue = get2 ? get2.call(target, key) : void 0;
  2959. const result = target.delete(key);
  2960. if (hadKey) {
  2961. trigger(target, "delete", key, void 0, oldValue);
  2962. }
  2963. return result;
  2964. }
  2965. function clear() {
  2966. const target = toRaw(this);
  2967. const hadItems = target.size !== 0;
  2968. const oldTarget = isMap(target) ? new Map(target) : new Set(target);
  2969. const result = target.clear();
  2970. if (hadItems) {
  2971. trigger(target, "clear", void 0, void 0, oldTarget);
  2972. }
  2973. return result;
  2974. }
  2975. function createForEach(isReadonly2, isShallow2) {
  2976. return function forEach(callback, thisArg) {
  2977. const observed = this;
  2978. const target = observed["__v_raw"];
  2979. const rawTarget = toRaw(target);
  2980. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2981. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  2982. return target.forEach((value, key) => {
  2983. return callback.call(thisArg, wrap(value), wrap(key), observed);
  2984. });
  2985. };
  2986. }
  2987. function createIterableMethod(method, isReadonly2, isShallow2) {
  2988. return function(...args) {
  2989. const target = this["__v_raw"];
  2990. const rawTarget = toRaw(target);
  2991. const targetIsMap = isMap(rawTarget);
  2992. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  2993. const isKeyOnly = method === "keys" && targetIsMap;
  2994. const innerIterator = target[method](...args);
  2995. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2996. !isReadonly2 && track(
  2997. rawTarget,
  2998. "iterate",
  2999. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  3000. );
  3001. return {
  3002. // iterator protocol
  3003. next() {
  3004. const { value, done } = innerIterator.next();
  3005. return done ? { value, done } : {
  3006. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  3007. done
  3008. };
  3009. },
  3010. // iterable protocol
  3011. [Symbol.iterator]() {
  3012. return this;
  3013. }
  3014. };
  3015. };
  3016. }
  3017. function createReadonlyMethod(type) {
  3018. return function(...args) {
  3019. {
  3020. const key = args[0] ? `on key "${args[0]}" ` : ``;
  3021. warn$2(
  3022. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  3023. toRaw(this)
  3024. );
  3025. }
  3026. return type === "delete" ? false : type === "clear" ? void 0 : this;
  3027. };
  3028. }
  3029. function createInstrumentations() {
  3030. const mutableInstrumentations2 = {
  3031. get(key) {
  3032. return get$1(this, key);
  3033. },
  3034. get size() {
  3035. return size(this);
  3036. },
  3037. has,
  3038. add,
  3039. set: set$1$1,
  3040. delete: deleteEntry,
  3041. clear,
  3042. forEach: createForEach(false, false)
  3043. };
  3044. const shallowInstrumentations2 = {
  3045. get(key) {
  3046. return get$1(this, key, false, true);
  3047. },
  3048. get size() {
  3049. return size(this);
  3050. },
  3051. has,
  3052. add,
  3053. set: set$1$1,
  3054. delete: deleteEntry,
  3055. clear,
  3056. forEach: createForEach(false, true)
  3057. };
  3058. const readonlyInstrumentations2 = {
  3059. get(key) {
  3060. return get$1(this, key, true);
  3061. },
  3062. get size() {
  3063. return size(this, true);
  3064. },
  3065. has(key) {
  3066. return has.call(this, key, true);
  3067. },
  3068. add: createReadonlyMethod("add"),
  3069. set: createReadonlyMethod("set"),
  3070. delete: createReadonlyMethod("delete"),
  3071. clear: createReadonlyMethod("clear"),
  3072. forEach: createForEach(true, false)
  3073. };
  3074. const shallowReadonlyInstrumentations2 = {
  3075. get(key) {
  3076. return get$1(this, key, true, true);
  3077. },
  3078. get size() {
  3079. return size(this, true);
  3080. },
  3081. has(key) {
  3082. return has.call(this, key, true);
  3083. },
  3084. add: createReadonlyMethod("add"),
  3085. set: createReadonlyMethod("set"),
  3086. delete: createReadonlyMethod("delete"),
  3087. clear: createReadonlyMethod("clear"),
  3088. forEach: createForEach(true, true)
  3089. };
  3090. const iteratorMethods = [
  3091. "keys",
  3092. "values",
  3093. "entries",
  3094. Symbol.iterator
  3095. ];
  3096. iteratorMethods.forEach((method) => {
  3097. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  3098. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  3099. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  3100. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  3101. method,
  3102. true,
  3103. true
  3104. );
  3105. });
  3106. return [
  3107. mutableInstrumentations2,
  3108. readonlyInstrumentations2,
  3109. shallowInstrumentations2,
  3110. shallowReadonlyInstrumentations2
  3111. ];
  3112. }
  3113. const [
  3114. mutableInstrumentations,
  3115. readonlyInstrumentations,
  3116. shallowInstrumentations,
  3117. shallowReadonlyInstrumentations
  3118. ] = /* @__PURE__ */ createInstrumentations();
  3119. function createInstrumentationGetter(isReadonly2, shallow) {
  3120. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  3121. return (target, key, receiver) => {
  3122. if (key === "__v_isReactive") {
  3123. return !isReadonly2;
  3124. } else if (key === "__v_isReadonly") {
  3125. return isReadonly2;
  3126. } else if (key === "__v_raw") {
  3127. return target;
  3128. }
  3129. return Reflect.get(
  3130. hasOwn$1(instrumentations, key) && key in target ? instrumentations : target,
  3131. key,
  3132. receiver
  3133. );
  3134. };
  3135. }
  3136. const mutableCollectionHandlers = {
  3137. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  3138. };
  3139. const shallowCollectionHandlers = {
  3140. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  3141. };
  3142. const readonlyCollectionHandlers = {
  3143. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  3144. };
  3145. const shallowReadonlyCollectionHandlers = {
  3146. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  3147. };
  3148. function checkIdentityKeys(target, has2, key) {
  3149. const rawKey = toRaw(key);
  3150. if (rawKey !== key && has2.call(target, rawKey)) {
  3151. const type = toRawType(target);
  3152. warn$2(
  3153. `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.`
  3154. );
  3155. }
  3156. }
  3157. const reactiveMap = /* @__PURE__ */ new WeakMap();
  3158. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  3159. const readonlyMap = /* @__PURE__ */ new WeakMap();
  3160. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  3161. function targetTypeMap(rawType) {
  3162. switch (rawType) {
  3163. case "Object":
  3164. case "Array":
  3165. return 1;
  3166. case "Map":
  3167. case "Set":
  3168. case "WeakMap":
  3169. case "WeakSet":
  3170. return 2;
  3171. default:
  3172. return 0;
  3173. }
  3174. }
  3175. function getTargetType(value) {
  3176. return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
  3177. }
  3178. function reactive(target) {
  3179. if (isReadonly(target)) {
  3180. return target;
  3181. }
  3182. return createReactiveObject(
  3183. target,
  3184. false,
  3185. mutableHandlers,
  3186. mutableCollectionHandlers,
  3187. reactiveMap
  3188. );
  3189. }
  3190. function shallowReactive(target) {
  3191. return createReactiveObject(
  3192. target,
  3193. false,
  3194. shallowReactiveHandlers,
  3195. shallowCollectionHandlers,
  3196. shallowReactiveMap
  3197. );
  3198. }
  3199. function readonly(target) {
  3200. return createReactiveObject(
  3201. target,
  3202. true,
  3203. readonlyHandlers,
  3204. readonlyCollectionHandlers,
  3205. readonlyMap
  3206. );
  3207. }
  3208. function shallowReadonly(target) {
  3209. return createReactiveObject(
  3210. target,
  3211. true,
  3212. shallowReadonlyHandlers,
  3213. shallowReadonlyCollectionHandlers,
  3214. shallowReadonlyMap
  3215. );
  3216. }
  3217. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  3218. if (!isObject$1(target)) {
  3219. {
  3220. warn$2(`value cannot be made reactive: ${String(target)}`);
  3221. }
  3222. return target;
  3223. }
  3224. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  3225. return target;
  3226. }
  3227. const existingProxy = proxyMap.get(target);
  3228. if (existingProxy) {
  3229. return existingProxy;
  3230. }
  3231. const targetType = getTargetType(target);
  3232. if (targetType === 0) {
  3233. return target;
  3234. }
  3235. const proxy = new Proxy(
  3236. target,
  3237. targetType === 2 ? collectionHandlers : baseHandlers
  3238. );
  3239. proxyMap.set(target, proxy);
  3240. return proxy;
  3241. }
  3242. function isReactive(value) {
  3243. if (isReadonly(value)) {
  3244. return isReactive(value["__v_raw"]);
  3245. }
  3246. return !!(value && value["__v_isReactive"]);
  3247. }
  3248. function isReadonly(value) {
  3249. return !!(value && value["__v_isReadonly"]);
  3250. }
  3251. function isShallow(value) {
  3252. return !!(value && value["__v_isShallow"]);
  3253. }
  3254. function isProxy(value) {
  3255. return isReactive(value) || isReadonly(value);
  3256. }
  3257. function toRaw(observed) {
  3258. const raw = observed && observed["__v_raw"];
  3259. return raw ? toRaw(raw) : observed;
  3260. }
  3261. function markRaw(value) {
  3262. if (Object.isExtensible(value)) {
  3263. def(value, "__v_skip", true);
  3264. }
  3265. return value;
  3266. }
  3267. const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
  3268. const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
  3269. 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`;
  3270. class ComputedRefImpl {
  3271. constructor(getter, _setter, isReadonly2, isSSR) {
  3272. this.getter = getter;
  3273. this._setter = _setter;
  3274. this.dep = void 0;
  3275. this.__v_isRef = true;
  3276. this["__v_isReadonly"] = false;
  3277. this.effect = new ReactiveEffect2(
  3278. () => getter(this._value),
  3279. () => triggerRefValue(
  3280. this,
  3281. this.effect._dirtyLevel === 2 ? 2 : 3
  3282. )
  3283. );
  3284. this.effect.computed = this;
  3285. this.effect.active = this._cacheable = !isSSR;
  3286. this["__v_isReadonly"] = isReadonly2;
  3287. }
  3288. get value() {
  3289. const self2 = toRaw(this);
  3290. if ((!self2._cacheable || self2.effect.dirty) && hasChanged(self2._value, self2._value = self2.effect.run())) {
  3291. triggerRefValue(self2, 4);
  3292. }
  3293. trackRefValue(self2);
  3294. if (self2.effect._dirtyLevel >= 2) {
  3295. if (this._warnRecursive) {
  3296. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  3297. getter: `, this.getter);
  3298. }
  3299. triggerRefValue(self2, 2);
  3300. }
  3301. return self2._value;
  3302. }
  3303. set value(newValue) {
  3304. this._setter(newValue);
  3305. }
  3306. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  3307. get _dirty() {
  3308. return this.effect.dirty;
  3309. }
  3310. set _dirty(v) {
  3311. this.effect.dirty = v;
  3312. }
  3313. // #endregion
  3314. }
  3315. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  3316. let getter;
  3317. let setter;
  3318. const onlyGetter = isFunction(getterOrOptions);
  3319. if (onlyGetter) {
  3320. getter = getterOrOptions;
  3321. setter = () => {
  3322. warn$2("Write operation failed: computed value is readonly");
  3323. };
  3324. } else {
  3325. getter = getterOrOptions.get;
  3326. setter = getterOrOptions.set;
  3327. }
  3328. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  3329. if (debugOptions && !isSSR) {
  3330. cRef.effect.onTrack = debugOptions.onTrack;
  3331. cRef.effect.onTrigger = debugOptions.onTrigger;
  3332. }
  3333. return cRef;
  3334. }
  3335. function trackRefValue(ref2) {
  3336. var _a;
  3337. if (shouldTrack && activeEffect) {
  3338. ref2 = toRaw(ref2);
  3339. trackEffect(
  3340. activeEffect,
  3341. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  3342. () => ref2.dep = void 0,
  3343. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  3344. ),
  3345. {
  3346. target: ref2,
  3347. type: "get",
  3348. key: "value"
  3349. }
  3350. );
  3351. }
  3352. }
  3353. function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
  3354. ref2 = toRaw(ref2);
  3355. const dep = ref2.dep;
  3356. if (dep) {
  3357. triggerEffects(
  3358. dep,
  3359. dirtyLevel,
  3360. {
  3361. target: ref2,
  3362. type: "set",
  3363. key: "value",
  3364. newValue: newVal
  3365. }
  3366. );
  3367. }
  3368. }
  3369. function isRef(r2) {
  3370. return !!(r2 && r2.__v_isRef === true);
  3371. }
  3372. function ref(value) {
  3373. return createRef(value, false);
  3374. }
  3375. function createRef(rawValue, shallow) {
  3376. if (isRef(rawValue)) {
  3377. return rawValue;
  3378. }
  3379. return new RefImpl(rawValue, shallow);
  3380. }
  3381. class RefImpl {
  3382. constructor(value, __v_isShallow) {
  3383. this.__v_isShallow = __v_isShallow;
  3384. this.dep = void 0;
  3385. this.__v_isRef = true;
  3386. this._rawValue = __v_isShallow ? value : toRaw(value);
  3387. this._value = __v_isShallow ? value : toReactive(value);
  3388. }
  3389. get value() {
  3390. trackRefValue(this);
  3391. return this._value;
  3392. }
  3393. set value(newVal) {
  3394. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  3395. newVal = useDirectValue ? newVal : toRaw(newVal);
  3396. if (hasChanged(newVal, this._rawValue)) {
  3397. this._rawValue = newVal;
  3398. this._value = useDirectValue ? newVal : toReactive(newVal);
  3399. triggerRefValue(this, 4, newVal);
  3400. }
  3401. }
  3402. }
  3403. function unref(ref2) {
  3404. return isRef(ref2) ? ref2.value : ref2;
  3405. }
  3406. const shallowUnwrapHandlers = {
  3407. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  3408. set: (target, key, value, receiver) => {
  3409. const oldValue = target[key];
  3410. if (isRef(oldValue) && !isRef(value)) {
  3411. oldValue.value = value;
  3412. return true;
  3413. } else {
  3414. return Reflect.set(target, key, value, receiver);
  3415. }
  3416. }
  3417. };
  3418. function proxyRefs(objectWithRefs) {
  3419. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  3420. }
  3421. function toRefs(object) {
  3422. if (!isProxy(object)) {
  3423. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  3424. }
  3425. const ret = isArray(object) ? new Array(object.length) : {};
  3426. for (const key in object) {
  3427. ret[key] = propertyToRef(object, key);
  3428. }
  3429. return ret;
  3430. }
  3431. class ObjectRefImpl {
  3432. constructor(_object, _key, _defaultValue) {
  3433. this._object = _object;
  3434. this._key = _key;
  3435. this._defaultValue = _defaultValue;
  3436. this.__v_isRef = true;
  3437. }
  3438. get value() {
  3439. const val = this._object[this._key];
  3440. return val === void 0 ? this._defaultValue : val;
  3441. }
  3442. set value(newVal) {
  3443. this._object[this._key] = newVal;
  3444. }
  3445. get dep() {
  3446. return getDepFromReactive(toRaw(this._object), this._key);
  3447. }
  3448. }
  3449. class GetterRefImpl {
  3450. constructor(_getter) {
  3451. this._getter = _getter;
  3452. this.__v_isRef = true;
  3453. this.__v_isReadonly = true;
  3454. }
  3455. get value() {
  3456. return this._getter();
  3457. }
  3458. }
  3459. function toRef(source, key, defaultValue) {
  3460. if (isRef(source)) {
  3461. return source;
  3462. } else if (isFunction(source)) {
  3463. return new GetterRefImpl(source);
  3464. } else if (isObject$1(source) && arguments.length > 1) {
  3465. return propertyToRef(source, key, defaultValue);
  3466. } else {
  3467. return ref(source);
  3468. }
  3469. }
  3470. function propertyToRef(source, key, defaultValue) {
  3471. const val = source[key];
  3472. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  3473. }
  3474. const stack = [];
  3475. function pushWarningContext(vnode) {
  3476. stack.push(vnode);
  3477. }
  3478. function popWarningContext() {
  3479. stack.pop();
  3480. }
  3481. function warn$1(msg, ...args) {
  3482. pauseTracking();
  3483. const instance = stack.length ? stack[stack.length - 1].component : null;
  3484. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  3485. const trace = getComponentTrace();
  3486. if (appWarnHandler) {
  3487. callWithErrorHandling(
  3488. appWarnHandler,
  3489. instance,
  3490. 11,
  3491. [
  3492. msg + args.map((a) => {
  3493. var _a, _b;
  3494. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  3495. }).join(""),
  3496. instance && instance.proxy,
  3497. trace.map(
  3498. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  3499. ).join("\n"),
  3500. trace
  3501. ]
  3502. );
  3503. } else {
  3504. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  3505. if (trace.length && // avoid spamming console during tests
  3506. true) {
  3507. warnArgs.push(`
  3508. `, ...formatTrace(trace));
  3509. }
  3510. console.warn(...warnArgs);
  3511. }
  3512. resetTracking();
  3513. }
  3514. function getComponentTrace() {
  3515. let currentVNode = stack[stack.length - 1];
  3516. if (!currentVNode) {
  3517. return [];
  3518. }
  3519. const normalizedStack = [];
  3520. while (currentVNode) {
  3521. const last = normalizedStack[0];
  3522. if (last && last.vnode === currentVNode) {
  3523. last.recurseCount++;
  3524. } else {
  3525. normalizedStack.push({
  3526. vnode: currentVNode,
  3527. recurseCount: 0
  3528. });
  3529. }
  3530. const parentInstance = currentVNode.component && currentVNode.component.parent;
  3531. currentVNode = parentInstance && parentInstance.vnode;
  3532. }
  3533. return normalizedStack;
  3534. }
  3535. function formatTrace(trace) {
  3536. const logs = [];
  3537. trace.forEach((entry, i) => {
  3538. logs.push(...i === 0 ? [] : [`
  3539. `], ...formatTraceEntry(entry));
  3540. });
  3541. return logs;
  3542. }
  3543. function formatTraceEntry({ vnode, recurseCount }) {
  3544. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  3545. const isRoot = vnode.component ? vnode.component.parent == null : false;
  3546. const open = ` at <${formatComponentName(
  3547. vnode.component,
  3548. vnode.type,
  3549. isRoot
  3550. )}`;
  3551. const close = `>` + postfix;
  3552. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  3553. }
  3554. function formatProps(props) {
  3555. const res = [];
  3556. const keys = Object.keys(props);
  3557. keys.slice(0, 3).forEach((key) => {
  3558. res.push(...formatProp(key, props[key]));
  3559. });
  3560. if (keys.length > 3) {
  3561. res.push(` ...`);
  3562. }
  3563. return res;
  3564. }
  3565. function formatProp(key, value, raw) {
  3566. if (isString(value)) {
  3567. value = JSON.stringify(value);
  3568. return raw ? value : [`${key}=${value}`];
  3569. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  3570. return raw ? value : [`${key}=${value}`];
  3571. } else if (isRef(value)) {
  3572. value = formatProp(key, toRaw(value.value), true);
  3573. return raw ? value : [`${key}=Ref<`, value, `>`];
  3574. } else if (isFunction(value)) {
  3575. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  3576. } else {
  3577. value = toRaw(value);
  3578. return raw ? value : [`${key}=`, value];
  3579. }
  3580. }
  3581. const ErrorTypeStrings = {
  3582. ["sp"]: "serverPrefetch hook",
  3583. ["bc"]: "beforeCreate hook",
  3584. ["c"]: "created hook",
  3585. ["bm"]: "beforeMount hook",
  3586. ["m"]: "mounted hook",
  3587. ["bu"]: "beforeUpdate hook",
  3588. ["u"]: "updated",
  3589. ["bum"]: "beforeUnmount hook",
  3590. ["um"]: "unmounted hook",
  3591. ["a"]: "activated hook",
  3592. ["da"]: "deactivated hook",
  3593. ["ec"]: "errorCaptured hook",
  3594. ["rtc"]: "renderTracked hook",
  3595. ["rtg"]: "renderTriggered hook",
  3596. [0]: "setup function",
  3597. [1]: "render function",
  3598. [2]: "watcher getter",
  3599. [3]: "watcher callback",
  3600. [4]: "watcher cleanup function",
  3601. [5]: "native event handler",
  3602. [6]: "component event handler",
  3603. [7]: "vnode hook",
  3604. [8]: "directive hook",
  3605. [9]: "transition hook",
  3606. [10]: "app errorHandler",
  3607. [11]: "app warnHandler",
  3608. [12]: "ref function",
  3609. [13]: "async component loader",
  3610. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  3611. };
  3612. function callWithErrorHandling(fn, instance, type, args) {
  3613. try {
  3614. return args ? fn(...args) : fn();
  3615. } catch (err) {
  3616. handleError(err, instance, type);
  3617. }
  3618. }
  3619. function callWithAsyncErrorHandling(fn, instance, type, args) {
  3620. if (isFunction(fn)) {
  3621. const res = callWithErrorHandling(fn, instance, type, args);
  3622. if (res && isPromise(res)) {
  3623. res.catch((err) => {
  3624. handleError(err, instance, type);
  3625. });
  3626. }
  3627. return res;
  3628. }
  3629. const values = [];
  3630. for (let i = 0; i < fn.length; i++) {
  3631. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  3632. }
  3633. return values;
  3634. }
  3635. function handleError(err, instance, type, throwInDev = true) {
  3636. const contextVNode = instance ? instance.vnode : null;
  3637. if (instance) {
  3638. let cur = instance.parent;
  3639. const exposedInstance = instance.proxy;
  3640. const errorInfo = ErrorTypeStrings[type] || type;
  3641. while (cur) {
  3642. const errorCapturedHooks = cur.ec;
  3643. if (errorCapturedHooks) {
  3644. for (let i = 0; i < errorCapturedHooks.length; i++) {
  3645. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  3646. return;
  3647. }
  3648. }
  3649. }
  3650. cur = cur.parent;
  3651. }
  3652. const appErrorHandler = instance.appContext.config.errorHandler;
  3653. if (appErrorHandler) {
  3654. callWithErrorHandling(
  3655. appErrorHandler,
  3656. null,
  3657. 10,
  3658. [err, exposedInstance, errorInfo]
  3659. );
  3660. return;
  3661. }
  3662. }
  3663. logError(err, type, contextVNode, throwInDev);
  3664. }
  3665. function logError(err, type, contextVNode, throwInDev = true) {
  3666. {
  3667. const info = ErrorTypeStrings[type] || type;
  3668. if (contextVNode) {
  3669. pushWarningContext(contextVNode);
  3670. }
  3671. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  3672. if (contextVNode) {
  3673. popWarningContext();
  3674. }
  3675. if (throwInDev) {
  3676. console.error(err);
  3677. } else {
  3678. console.error(err);
  3679. }
  3680. }
  3681. }
  3682. let isFlushing = false;
  3683. let isFlushPending = false;
  3684. const queue = [];
  3685. let flushIndex = 0;
  3686. const pendingPostFlushCbs = [];
  3687. let activePostFlushCbs = null;
  3688. let postFlushIndex = 0;
  3689. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  3690. let currentFlushPromise = null;
  3691. const RECURSION_LIMIT = 100;
  3692. function nextTick$1(fn) {
  3693. const p2 = currentFlushPromise || resolvedPromise;
  3694. return fn ? p2.then(this ? fn.bind(this) : fn) : p2;
  3695. }
  3696. function findInsertionIndex(id) {
  3697. let start = flushIndex + 1;
  3698. let end = queue.length;
  3699. while (start < end) {
  3700. const middle = start + end >>> 1;
  3701. const middleJob = queue[middle];
  3702. const middleJobId = getId(middleJob);
  3703. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  3704. start = middle + 1;
  3705. } else {
  3706. end = middle;
  3707. }
  3708. }
  3709. return start;
  3710. }
  3711. function queueJob(job) {
  3712. if (!queue.length || !queue.includes(
  3713. job,
  3714. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  3715. )) {
  3716. if (job.id == null) {
  3717. queue.push(job);
  3718. } else {
  3719. queue.splice(findInsertionIndex(job.id), 0, job);
  3720. }
  3721. queueFlush();
  3722. }
  3723. }
  3724. function queueFlush() {
  3725. if (!isFlushing && !isFlushPending) {
  3726. isFlushPending = true;
  3727. currentFlushPromise = resolvedPromise.then(flushJobs);
  3728. }
  3729. }
  3730. function hasQueueJob(job) {
  3731. return queue.indexOf(job) > -1;
  3732. }
  3733. function invalidateJob(job) {
  3734. const i = queue.indexOf(job);
  3735. if (i > flushIndex) {
  3736. queue.splice(i, 1);
  3737. }
  3738. }
  3739. function queuePostFlushCb(cb) {
  3740. if (!isArray(cb)) {
  3741. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  3742. cb,
  3743. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  3744. )) {
  3745. pendingPostFlushCbs.push(cb);
  3746. }
  3747. } else {
  3748. pendingPostFlushCbs.push(...cb);
  3749. }
  3750. queueFlush();
  3751. }
  3752. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  3753. {
  3754. seen = seen || /* @__PURE__ */ new Map();
  3755. }
  3756. for (; i < queue.length; i++) {
  3757. const cb = queue[i];
  3758. if (cb && cb.pre) {
  3759. if (instance && cb.id !== instance.uid) {
  3760. continue;
  3761. }
  3762. if (checkRecursiveUpdates(seen, cb)) {
  3763. continue;
  3764. }
  3765. queue.splice(i, 1);
  3766. i--;
  3767. cb();
  3768. }
  3769. }
  3770. }
  3771. function flushPostFlushCbs(seen) {
  3772. if (pendingPostFlushCbs.length) {
  3773. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  3774. (a, b) => getId(a) - getId(b)
  3775. );
  3776. pendingPostFlushCbs.length = 0;
  3777. if (activePostFlushCbs) {
  3778. activePostFlushCbs.push(...deduped);
  3779. return;
  3780. }
  3781. activePostFlushCbs = deduped;
  3782. {
  3783. seen = seen || /* @__PURE__ */ new Map();
  3784. }
  3785. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  3786. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  3787. continue;
  3788. }
  3789. activePostFlushCbs[postFlushIndex]();
  3790. }
  3791. activePostFlushCbs = null;
  3792. postFlushIndex = 0;
  3793. }
  3794. }
  3795. const getId = (job) => job.id == null ? Infinity : job.id;
  3796. const comparator = (a, b) => {
  3797. const diff2 = getId(a) - getId(b);
  3798. if (diff2 === 0) {
  3799. if (a.pre && !b.pre)
  3800. return -1;
  3801. if (b.pre && !a.pre)
  3802. return 1;
  3803. }
  3804. return diff2;
  3805. };
  3806. function flushJobs(seen) {
  3807. isFlushPending = false;
  3808. isFlushing = true;
  3809. {
  3810. seen = seen || /* @__PURE__ */ new Map();
  3811. }
  3812. queue.sort(comparator);
  3813. const check = (job) => checkRecursiveUpdates(seen, job);
  3814. try {
  3815. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  3816. const job = queue[flushIndex];
  3817. if (job && job.active !== false) {
  3818. if (check(job)) {
  3819. continue;
  3820. }
  3821. callWithErrorHandling(job, null, 14);
  3822. }
  3823. }
  3824. } finally {
  3825. flushIndex = 0;
  3826. queue.length = 0;
  3827. flushPostFlushCbs(seen);
  3828. isFlushing = false;
  3829. currentFlushPromise = null;
  3830. if (queue.length || pendingPostFlushCbs.length) {
  3831. flushJobs(seen);
  3832. }
  3833. }
  3834. }
  3835. function checkRecursiveUpdates(seen, fn) {
  3836. if (!seen.has(fn)) {
  3837. seen.set(fn, 1);
  3838. } else {
  3839. const count = seen.get(fn);
  3840. if (count > RECURSION_LIMIT) {
  3841. const instance = fn.ownerInstance;
  3842. const componentName = instance && getComponentName(instance.type);
  3843. handleError(
  3844. `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.`,
  3845. null,
  3846. 10
  3847. );
  3848. return true;
  3849. } else {
  3850. seen.set(fn, count + 1);
  3851. }
  3852. }
  3853. }
  3854. let devtools;
  3855. let buffer = [];
  3856. let devtoolsNotInstalled = false;
  3857. function emit$1(event, ...args) {
  3858. if (devtools) {
  3859. devtools.emit(event, ...args);
  3860. } else if (!devtoolsNotInstalled) {
  3861. buffer.push({ event, args });
  3862. }
  3863. }
  3864. function setDevtoolsHook(hook, target) {
  3865. var _a, _b;
  3866. devtools = hook;
  3867. if (devtools) {
  3868. devtools.enabled = true;
  3869. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  3870. buffer = [];
  3871. } else if (
  3872. // handle late devtools injection - only do this if we are in an actual
  3873. // browser environment to avoid the timer handle stalling test runner exit
  3874. // (#4815)
  3875. typeof window !== "undefined" && // some envs mock window but not fully
  3876. window.HTMLElement && // also exclude jsdom
  3877. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  3878. ) {
  3879. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  3880. replay.push((newHook) => {
  3881. setDevtoolsHook(newHook, target);
  3882. });
  3883. setTimeout(() => {
  3884. if (!devtools) {
  3885. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  3886. devtoolsNotInstalled = true;
  3887. buffer = [];
  3888. }
  3889. }, 3e3);
  3890. } else {
  3891. devtoolsNotInstalled = true;
  3892. buffer = [];
  3893. }
  3894. }
  3895. function devtoolsInitApp(app, version2) {
  3896. emit$1("app:init", app, version2, {
  3897. Fragment,
  3898. Text,
  3899. Comment,
  3900. Static
  3901. });
  3902. }
  3903. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  3904. "component:added"
  3905. /* COMPONENT_ADDED */
  3906. );
  3907. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(
  3908. "component:updated"
  3909. /* COMPONENT_UPDATED */
  3910. );
  3911. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  3912. "component:removed"
  3913. /* COMPONENT_REMOVED */
  3914. );
  3915. const devtoolsComponentRemoved = (component) => {
  3916. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  3917. !devtools.cleanupBuffer(component)) {
  3918. _devtoolsComponentRemoved(component);
  3919. }
  3920. };
  3921. /*! #__NO_SIDE_EFFECTS__ */
  3922. // @__NO_SIDE_EFFECTS__
  3923. function createDevtoolsComponentHook(hook) {
  3924. return (component) => {
  3925. emit$1(
  3926. hook,
  3927. component.appContext.app,
  3928. component.uid,
  3929. // fixed by xxxxxx
  3930. // 为 0 是 App,无 parent 是 Page 指向 App
  3931. component.uid === 0 ? void 0 : component.parent ? component.parent.uid : 0,
  3932. component
  3933. );
  3934. };
  3935. }
  3936. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  3937. "perf:start"
  3938. /* PERFORMANCE_START */
  3939. );
  3940. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  3941. "perf:end"
  3942. /* PERFORMANCE_END */
  3943. );
  3944. function createDevtoolsPerformanceHook(hook) {
  3945. return (component, type, time) => {
  3946. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  3947. };
  3948. }
  3949. function devtoolsComponentEmit(component, event, params) {
  3950. emit$1(
  3951. "component:emit",
  3952. component.appContext.app,
  3953. component,
  3954. event,
  3955. params
  3956. );
  3957. }
  3958. function emit(instance, event, ...rawArgs) {
  3959. if (instance.isUnmounted)
  3960. return;
  3961. const props = instance.vnode.props || EMPTY_OBJ;
  3962. {
  3963. const {
  3964. emitsOptions,
  3965. propsOptions: [propsOptions]
  3966. } = instance;
  3967. if (emitsOptions) {
  3968. if (!(event in emitsOptions) && true) {
  3969. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  3970. warn$1(
  3971. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  3972. );
  3973. }
  3974. } else {
  3975. const validator = emitsOptions[event];
  3976. if (isFunction(validator)) {
  3977. const isValid = validator(...rawArgs);
  3978. if (!isValid) {
  3979. warn$1(
  3980. `Invalid event arguments: event validation failed for event "${event}".`
  3981. );
  3982. }
  3983. }
  3984. }
  3985. }
  3986. }
  3987. let args = rawArgs;
  3988. const isModelListener2 = event.startsWith("update:");
  3989. const modelArg = isModelListener2 && event.slice(7);
  3990. if (modelArg && modelArg in props) {
  3991. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  3992. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  3993. if (trim) {
  3994. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  3995. }
  3996. if (number) {
  3997. args = rawArgs.map(looseToNumber);
  3998. }
  3999. }
  4000. {
  4001. devtoolsComponentEmit(instance, event, args);
  4002. }
  4003. {
  4004. const lowerCaseEvent = event.toLowerCase();
  4005. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  4006. warn$1(
  4007. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  4008. instance,
  4009. instance.type
  4010. )} 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(
  4011. event
  4012. )}" instead of "${event}".`
  4013. );
  4014. }
  4015. }
  4016. let handlerName;
  4017. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  4018. props[handlerName = toHandlerKey(camelize(event))];
  4019. if (!handler && isModelListener2) {
  4020. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  4021. }
  4022. if (handler) {
  4023. callWithAsyncErrorHandling(
  4024. handler,
  4025. instance,
  4026. 6,
  4027. args
  4028. );
  4029. }
  4030. const onceHandler = props[handlerName + `Once`];
  4031. if (onceHandler) {
  4032. if (!instance.emitted) {
  4033. instance.emitted = {};
  4034. } else if (instance.emitted[handlerName]) {
  4035. return;
  4036. }
  4037. instance.emitted[handlerName] = true;
  4038. callWithAsyncErrorHandling(
  4039. onceHandler,
  4040. instance,
  4041. 6,
  4042. args
  4043. );
  4044. }
  4045. }
  4046. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  4047. const cache = appContext.emitsCache;
  4048. const cached = cache.get(comp);
  4049. if (cached !== void 0) {
  4050. return cached;
  4051. }
  4052. const raw = comp.emits;
  4053. let normalized = {};
  4054. let hasExtends = false;
  4055. if (!isFunction(comp)) {
  4056. const extendEmits = (raw2) => {
  4057. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  4058. if (normalizedFromExtend) {
  4059. hasExtends = true;
  4060. extend(normalized, normalizedFromExtend);
  4061. }
  4062. };
  4063. if (!asMixin && appContext.mixins.length) {
  4064. appContext.mixins.forEach(extendEmits);
  4065. }
  4066. if (comp.extends) {
  4067. extendEmits(comp.extends);
  4068. }
  4069. if (comp.mixins) {
  4070. comp.mixins.forEach(extendEmits);
  4071. }
  4072. }
  4073. if (!raw && !hasExtends) {
  4074. if (isObject$1(comp)) {
  4075. cache.set(comp, null);
  4076. }
  4077. return null;
  4078. }
  4079. if (isArray(raw)) {
  4080. raw.forEach((key) => normalized[key] = null);
  4081. } else {
  4082. extend(normalized, raw);
  4083. }
  4084. if (isObject$1(comp)) {
  4085. cache.set(comp, normalized);
  4086. }
  4087. return normalized;
  4088. }
  4089. function isEmitListener(options, key) {
  4090. if (!options || !isOn(key)) {
  4091. return false;
  4092. }
  4093. key = key.slice(2).replace(/Once$/, "");
  4094. return hasOwn$1(options, key[0].toLowerCase() + key.slice(1)) || hasOwn$1(options, hyphenate(key)) || hasOwn$1(options, key);
  4095. }
  4096. let currentRenderingInstance = null;
  4097. function setCurrentRenderingInstance(instance) {
  4098. const prev = currentRenderingInstance;
  4099. currentRenderingInstance = instance;
  4100. instance && instance.type.__scopeId || null;
  4101. return prev;
  4102. }
  4103. const COMPONENTS = "components";
  4104. function resolveComponent(name, maybeSelfReference) {
  4105. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4106. }
  4107. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4108. const instance = currentRenderingInstance || currentInstance;
  4109. if (instance) {
  4110. const Component2 = instance.type;
  4111. if (type === COMPONENTS) {
  4112. const selfName = getComponentName(
  4113. Component2,
  4114. false
  4115. );
  4116. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4117. return Component2;
  4118. }
  4119. }
  4120. const res = (
  4121. // local registration
  4122. // check instance[type] first which is resolved for options API
  4123. resolve(instance[type] || Component2[type], name) || // global registration
  4124. resolve(instance.appContext[type], name)
  4125. );
  4126. if (!res && maybeSelfReference) {
  4127. return Component2;
  4128. }
  4129. if (warnMissing && !res) {
  4130. const extra = type === COMPONENTS ? `
  4131. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4132. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4133. }
  4134. return res;
  4135. } else {
  4136. warn$1(
  4137. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4138. );
  4139. }
  4140. }
  4141. function resolve(registry, name) {
  4142. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4143. }
  4144. const INITIAL_WATCHER_VALUE = {};
  4145. function watch(source, cb, options) {
  4146. if (!isFunction(cb)) {
  4147. warn$1(
  4148. `\`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.`
  4149. );
  4150. }
  4151. return doWatch(source, cb, options);
  4152. }
  4153. function doWatch(source, cb, {
  4154. immediate,
  4155. deep,
  4156. flush,
  4157. once: once2,
  4158. onTrack,
  4159. onTrigger
  4160. } = EMPTY_OBJ) {
  4161. if (cb && once2) {
  4162. const _cb = cb;
  4163. cb = (...args) => {
  4164. _cb(...args);
  4165. unwatch();
  4166. };
  4167. }
  4168. if (deep !== void 0 && typeof deep === "number") {
  4169. warn$1(
  4170. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  4171. );
  4172. }
  4173. if (!cb) {
  4174. if (immediate !== void 0) {
  4175. warn$1(
  4176. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  4177. );
  4178. }
  4179. if (deep !== void 0) {
  4180. warn$1(
  4181. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  4182. );
  4183. }
  4184. if (once2 !== void 0) {
  4185. warn$1(
  4186. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  4187. );
  4188. }
  4189. }
  4190. const warnInvalidSource = (s2) => {
  4191. warn$1(
  4192. `Invalid watch source: `,
  4193. s2,
  4194. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  4195. );
  4196. };
  4197. const instance = currentInstance;
  4198. const reactiveGetter = (source2) => deep === true ? source2 : (
  4199. // for deep: false, only traverse root-level properties
  4200. traverse(source2, deep === false ? 1 : void 0)
  4201. );
  4202. let getter;
  4203. let forceTrigger = false;
  4204. let isMultiSource = false;
  4205. if (isRef(source)) {
  4206. getter = () => source.value;
  4207. forceTrigger = isShallow(source);
  4208. } else if (isReactive(source)) {
  4209. getter = () => reactiveGetter(source);
  4210. forceTrigger = true;
  4211. } else if (isArray(source)) {
  4212. isMultiSource = true;
  4213. forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2));
  4214. getter = () => source.map((s2) => {
  4215. if (isRef(s2)) {
  4216. return s2.value;
  4217. } else if (isReactive(s2)) {
  4218. return reactiveGetter(s2);
  4219. } else if (isFunction(s2)) {
  4220. return callWithErrorHandling(s2, instance, 2);
  4221. } else {
  4222. warnInvalidSource(s2);
  4223. }
  4224. });
  4225. } else if (isFunction(source)) {
  4226. if (cb) {
  4227. getter = () => callWithErrorHandling(source, instance, 2);
  4228. } else {
  4229. getter = () => {
  4230. if (cleanup) {
  4231. cleanup();
  4232. }
  4233. return callWithAsyncErrorHandling(
  4234. source,
  4235. instance,
  4236. 3,
  4237. [onCleanup]
  4238. );
  4239. };
  4240. }
  4241. } else {
  4242. getter = NOOP;
  4243. warnInvalidSource(source);
  4244. }
  4245. if (cb && deep) {
  4246. const baseGetter = getter;
  4247. getter = () => traverse(baseGetter());
  4248. }
  4249. let cleanup;
  4250. let onCleanup = (fn) => {
  4251. cleanup = effect2.onStop = () => {
  4252. callWithErrorHandling(fn, instance, 4);
  4253. cleanup = effect2.onStop = void 0;
  4254. };
  4255. };
  4256. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  4257. const job = () => {
  4258. if (!effect2.active || !effect2.dirty) {
  4259. return;
  4260. }
  4261. if (cb) {
  4262. const newValue = effect2.run();
  4263. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  4264. if (cleanup) {
  4265. cleanup();
  4266. }
  4267. callWithAsyncErrorHandling(cb, instance, 3, [
  4268. newValue,
  4269. // pass undefined as the old value when it's changed for the first time
  4270. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  4271. onCleanup
  4272. ]);
  4273. oldValue = newValue;
  4274. }
  4275. } else {
  4276. effect2.run();
  4277. }
  4278. };
  4279. job.allowRecurse = !!cb;
  4280. let scheduler;
  4281. if (flush === "sync") {
  4282. scheduler = job;
  4283. } else if (flush === "post") {
  4284. scheduler = () => queuePostRenderEffect$1(job, instance && instance.suspense);
  4285. } else {
  4286. job.pre = true;
  4287. if (instance)
  4288. job.id = instance.uid;
  4289. scheduler = () => queueJob(job);
  4290. }
  4291. const effect2 = new ReactiveEffect2(getter, NOOP, scheduler);
  4292. const scope = getCurrentScope();
  4293. const unwatch = () => {
  4294. effect2.stop();
  4295. if (scope) {
  4296. remove(scope.effects, effect2);
  4297. }
  4298. };
  4299. {
  4300. effect2.onTrack = onTrack;
  4301. effect2.onTrigger = onTrigger;
  4302. }
  4303. if (cb) {
  4304. if (immediate) {
  4305. job();
  4306. } else {
  4307. oldValue = effect2.run();
  4308. }
  4309. } else if (flush === "post") {
  4310. queuePostRenderEffect$1(
  4311. effect2.run.bind(effect2),
  4312. instance && instance.suspense
  4313. );
  4314. } else {
  4315. effect2.run();
  4316. }
  4317. return unwatch;
  4318. }
  4319. function instanceWatch(source, value, options) {
  4320. const publicThis = this.proxy;
  4321. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  4322. let cb;
  4323. if (isFunction(value)) {
  4324. cb = value;
  4325. } else {
  4326. cb = value.handler;
  4327. options = value;
  4328. }
  4329. const reset = setCurrentInstance(this);
  4330. const res = doWatch(getter, cb.bind(publicThis), options);
  4331. reset();
  4332. return res;
  4333. }
  4334. function createPathGetter(ctx, path) {
  4335. const segments = path.split(".");
  4336. return () => {
  4337. let cur = ctx;
  4338. for (let i = 0; i < segments.length && cur; i++) {
  4339. cur = cur[segments[i]];
  4340. }
  4341. return cur;
  4342. };
  4343. }
  4344. function traverse(value, depth, currentDepth = 0, seen) {
  4345. if (!isObject$1(value) || value["__v_skip"]) {
  4346. return value;
  4347. }
  4348. if (depth && depth > 0) {
  4349. if (currentDepth >= depth) {
  4350. return value;
  4351. }
  4352. currentDepth++;
  4353. }
  4354. seen = seen || /* @__PURE__ */ new Set();
  4355. if (seen.has(value)) {
  4356. return value;
  4357. }
  4358. seen.add(value);
  4359. if (isRef(value)) {
  4360. traverse(value.value, depth, currentDepth, seen);
  4361. } else if (isArray(value)) {
  4362. for (let i = 0; i < value.length; i++) {
  4363. traverse(value[i], depth, currentDepth, seen);
  4364. }
  4365. } else if (isSet(value) || isMap(value)) {
  4366. value.forEach((v) => {
  4367. traverse(v, depth, currentDepth, seen);
  4368. });
  4369. } else if (isPlainObject$1(value)) {
  4370. for (const key in value) {
  4371. traverse(value[key], depth, currentDepth, seen);
  4372. }
  4373. }
  4374. return value;
  4375. }
  4376. function validateDirectiveName(name) {
  4377. if (isBuiltInDirective(name)) {
  4378. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  4379. }
  4380. }
  4381. function createAppContext() {
  4382. return {
  4383. app: null,
  4384. config: {
  4385. isNativeTag: NO,
  4386. performance: false,
  4387. globalProperties: {},
  4388. optionMergeStrategies: {},
  4389. errorHandler: void 0,
  4390. warnHandler: void 0,
  4391. compilerOptions: {}
  4392. },
  4393. mixins: [],
  4394. components: {},
  4395. directives: {},
  4396. provides: /* @__PURE__ */ Object.create(null),
  4397. optionsCache: /* @__PURE__ */ new WeakMap(),
  4398. propsCache: /* @__PURE__ */ new WeakMap(),
  4399. emitsCache: /* @__PURE__ */ new WeakMap()
  4400. };
  4401. }
  4402. let uid$1 = 0;
  4403. function createAppAPI(render, hydrate) {
  4404. return function createApp2(rootComponent, rootProps = null) {
  4405. if (!isFunction(rootComponent)) {
  4406. rootComponent = extend({}, rootComponent);
  4407. }
  4408. if (rootProps != null && !isObject$1(rootProps)) {
  4409. warn$1(`root props passed to app.mount() must be an object.`);
  4410. rootProps = null;
  4411. }
  4412. const context = createAppContext();
  4413. const installedPlugins = /* @__PURE__ */ new WeakSet();
  4414. const app = context.app = {
  4415. _uid: uid$1++,
  4416. _component: rootComponent,
  4417. _props: rootProps,
  4418. _container: null,
  4419. _context: context,
  4420. _instance: null,
  4421. version,
  4422. get config() {
  4423. return context.config;
  4424. },
  4425. set config(v) {
  4426. {
  4427. warn$1(
  4428. `app.config cannot be replaced. Modify individual options instead.`
  4429. );
  4430. }
  4431. },
  4432. use(plugin2, ...options) {
  4433. if (installedPlugins.has(plugin2)) {
  4434. warn$1(`Plugin has already been applied to target app.`);
  4435. } else if (plugin2 && isFunction(plugin2.install)) {
  4436. installedPlugins.add(plugin2);
  4437. plugin2.install(app, ...options);
  4438. } else if (isFunction(plugin2)) {
  4439. installedPlugins.add(plugin2);
  4440. plugin2(app, ...options);
  4441. } else {
  4442. warn$1(
  4443. `A plugin must either be a function or an object with an "install" function.`
  4444. );
  4445. }
  4446. return app;
  4447. },
  4448. mixin(mixin) {
  4449. {
  4450. if (!context.mixins.includes(mixin)) {
  4451. context.mixins.push(mixin);
  4452. } else {
  4453. warn$1(
  4454. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  4455. );
  4456. }
  4457. }
  4458. return app;
  4459. },
  4460. component(name, component) {
  4461. {
  4462. validateComponentName(name, context.config);
  4463. }
  4464. if (!component) {
  4465. return context.components[name];
  4466. }
  4467. if (context.components[name]) {
  4468. warn$1(`Component "${name}" has already been registered in target app.`);
  4469. }
  4470. context.components[name] = component;
  4471. return app;
  4472. },
  4473. directive(name, directive) {
  4474. {
  4475. validateDirectiveName(name);
  4476. }
  4477. if (!directive) {
  4478. return context.directives[name];
  4479. }
  4480. if (context.directives[name]) {
  4481. warn$1(`Directive "${name}" has already been registered in target app.`);
  4482. }
  4483. context.directives[name] = directive;
  4484. return app;
  4485. },
  4486. // fixed by xxxxxx
  4487. mount() {
  4488. },
  4489. // fixed by xxxxxx
  4490. unmount() {
  4491. },
  4492. provide(key, value) {
  4493. if (key in context.provides) {
  4494. warn$1(
  4495. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  4496. );
  4497. }
  4498. context.provides[key] = value;
  4499. return app;
  4500. },
  4501. runWithContext(fn) {
  4502. const lastApp = currentApp;
  4503. currentApp = app;
  4504. try {
  4505. return fn();
  4506. } finally {
  4507. currentApp = lastApp;
  4508. }
  4509. }
  4510. };
  4511. return app;
  4512. };
  4513. }
  4514. let currentApp = null;
  4515. function provide(key, value) {
  4516. if (!currentInstance) {
  4517. {
  4518. warn$1(`provide() can only be used inside setup().`);
  4519. }
  4520. } else {
  4521. let provides = currentInstance.provides;
  4522. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  4523. if (parentProvides === provides) {
  4524. provides = currentInstance.provides = Object.create(parentProvides);
  4525. }
  4526. provides[key] = value;
  4527. if (currentInstance.type.mpType === "app") {
  4528. currentInstance.appContext.app.provide(key, value);
  4529. }
  4530. }
  4531. }
  4532. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  4533. const instance = currentInstance || currentRenderingInstance;
  4534. if (instance || currentApp) {
  4535. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  4536. if (provides && key in provides) {
  4537. return provides[key];
  4538. } else if (arguments.length > 1) {
  4539. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  4540. } else {
  4541. warn$1(`injection "${String(key)}" not found.`);
  4542. }
  4543. } else {
  4544. warn$1(`inject() can only be used inside setup() or functional components.`);
  4545. }
  4546. }
  4547. function hasInjectionContext() {
  4548. return !!(currentInstance || currentRenderingInstance || currentApp);
  4549. }
  4550. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4551. function onActivated(hook, target) {
  4552. registerKeepAliveHook(hook, "a", target);
  4553. }
  4554. function onDeactivated(hook, target) {
  4555. registerKeepAliveHook(hook, "da", target);
  4556. }
  4557. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4558. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4559. let current = target;
  4560. while (current) {
  4561. if (current.isDeactivated) {
  4562. return;
  4563. }
  4564. current = current.parent;
  4565. }
  4566. return hook();
  4567. });
  4568. injectHook(type, wrappedHook, target);
  4569. if (target) {
  4570. let current = target.parent;
  4571. while (current && current.parent) {
  4572. if (isKeepAlive(current.parent.vnode)) {
  4573. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4574. }
  4575. current = current.parent;
  4576. }
  4577. }
  4578. }
  4579. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4580. const injected = injectHook(
  4581. type,
  4582. hook,
  4583. keepAliveRoot,
  4584. true
  4585. /* prepend */
  4586. );
  4587. onUnmounted(() => {
  4588. remove(keepAliveRoot[type], injected);
  4589. }, target);
  4590. }
  4591. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4592. if (target) {
  4593. if (isRootHook(type)) {
  4594. target = target.root;
  4595. }
  4596. const hooks = target[type] || (target[type] = []);
  4597. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4598. if (target.isUnmounted) {
  4599. return;
  4600. }
  4601. pauseTracking();
  4602. const reset = setCurrentInstance(target);
  4603. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4604. reset();
  4605. resetTracking();
  4606. return res;
  4607. });
  4608. if (prepend) {
  4609. hooks.unshift(wrappedHook);
  4610. } else {
  4611. hooks.push(wrappedHook);
  4612. }
  4613. return wrappedHook;
  4614. } else {
  4615. const apiName = toHandlerKey(
  4616. (ErrorTypeStrings[type] || type.replace(/^on/, "")).replace(/ hook$/, "")
  4617. );
  4618. warn$1(
  4619. `${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().`
  4620. );
  4621. }
  4622. }
  4623. const createHook$1 = (lifecycle) => (hook, target = currentInstance) => (
  4624. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4625. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4626. );
  4627. const onBeforeMount = createHook$1("bm");
  4628. const onMounted = createHook$1("m");
  4629. const onBeforeUpdate = createHook$1("bu");
  4630. const onUpdated = createHook$1("u");
  4631. const onBeforeUnmount = createHook$1("bum");
  4632. const onUnmounted = createHook$1("um");
  4633. const onServerPrefetch = createHook$1("sp");
  4634. const onRenderTriggered = createHook$1(
  4635. "rtg"
  4636. );
  4637. const onRenderTracked = createHook$1(
  4638. "rtc"
  4639. );
  4640. function onErrorCaptured(hook, target = currentInstance) {
  4641. injectHook("ec", hook, target);
  4642. }
  4643. const getPublicInstance = (i) => {
  4644. if (!i)
  4645. return null;
  4646. if (isStatefulComponent(i))
  4647. return getExposeProxy(i) || i.proxy;
  4648. return getPublicInstance(i.parent);
  4649. };
  4650. const publicPropertiesMap = (
  4651. // Move PURE marker to new line to workaround compiler discarding it
  4652. // due to type annotation
  4653. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4654. $: (i) => i,
  4655. // fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的
  4656. // $el: i => i.vnode.el,
  4657. $el: (i) => i.__$el || (i.__$el = {}),
  4658. $data: (i) => i.data,
  4659. $props: (i) => shallowReadonly(i.props),
  4660. $attrs: (i) => shallowReadonly(i.attrs),
  4661. $slots: (i) => shallowReadonly(i.slots),
  4662. $refs: (i) => shallowReadonly(i.refs),
  4663. $parent: (i) => getPublicInstance(i.parent),
  4664. $root: (i) => getPublicInstance(i.root),
  4665. $emit: (i) => i.emit,
  4666. $options: (i) => resolveMergedOptions(i),
  4667. $forceUpdate: (i) => i.f || (i.f = () => {
  4668. i.effect.dirty = true;
  4669. queueJob(i.update);
  4670. }),
  4671. // $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx
  4672. $watch: (i) => instanceWatch.bind(i)
  4673. })
  4674. );
  4675. const isReservedPrefix = (key) => key === "_" || key === "$";
  4676. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn$1(state, key);
  4677. const PublicInstanceProxyHandlers = {
  4678. get({ _: instance }, key) {
  4679. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4680. if (key === "__isVue") {
  4681. return true;
  4682. }
  4683. let normalizedProps;
  4684. if (key[0] !== "$") {
  4685. const n2 = accessCache[key];
  4686. if (n2 !== void 0) {
  4687. switch (n2) {
  4688. case 1:
  4689. return setupState[key];
  4690. case 2:
  4691. return data[key];
  4692. case 4:
  4693. return ctx[key];
  4694. case 3:
  4695. return props[key];
  4696. }
  4697. } else if (hasSetupBinding(setupState, key)) {
  4698. accessCache[key] = 1;
  4699. return setupState[key];
  4700. } else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) {
  4701. accessCache[key] = 2;
  4702. return data[key];
  4703. } else if (
  4704. // only cache other properties when instance has declared (thus stable)
  4705. // props
  4706. (normalizedProps = instance.propsOptions[0]) && hasOwn$1(normalizedProps, key)
  4707. ) {
  4708. accessCache[key] = 3;
  4709. return props[key];
  4710. } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
  4711. accessCache[key] = 4;
  4712. return ctx[key];
  4713. } else if (shouldCacheAccess) {
  4714. accessCache[key] = 0;
  4715. }
  4716. }
  4717. const publicGetter = publicPropertiesMap[key];
  4718. let cssModule, globalProperties;
  4719. if (publicGetter) {
  4720. if (key === "$attrs") {
  4721. track(instance, "get", key);
  4722. } else if (key === "$slots") {
  4723. track(instance, "get", key);
  4724. }
  4725. return publicGetter(instance);
  4726. } else if (
  4727. // css module (injected by vue-loader)
  4728. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4729. ) {
  4730. return cssModule;
  4731. } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
  4732. accessCache[key] = 4;
  4733. return ctx[key];
  4734. } else if (
  4735. // global properties
  4736. globalProperties = appContext.config.globalProperties, hasOwn$1(globalProperties, key)
  4737. ) {
  4738. {
  4739. return globalProperties[key];
  4740. }
  4741. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4742. // to infinite warning loop
  4743. key.indexOf("__v") !== 0)) {
  4744. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$1(data, key)) {
  4745. warn$1(
  4746. `Property ${JSON.stringify(
  4747. key
  4748. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4749. );
  4750. } else if (instance === currentRenderingInstance) {
  4751. warn$1(
  4752. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4753. );
  4754. }
  4755. }
  4756. },
  4757. set({ _: instance }, key, value) {
  4758. const { data, setupState, ctx } = instance;
  4759. if (hasSetupBinding(setupState, key)) {
  4760. setupState[key] = value;
  4761. return true;
  4762. } else if (setupState.__isScriptSetup && hasOwn$1(setupState, key)) {
  4763. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4764. return false;
  4765. } else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) {
  4766. data[key] = value;
  4767. return true;
  4768. } else if (hasOwn$1(instance.props, key)) {
  4769. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  4770. return false;
  4771. }
  4772. if (key[0] === "$" && key.slice(1) in instance) {
  4773. warn$1(
  4774. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4775. );
  4776. return false;
  4777. } else {
  4778. if (key in instance.appContext.config.globalProperties) {
  4779. Object.defineProperty(ctx, key, {
  4780. enumerable: true,
  4781. configurable: true,
  4782. value
  4783. });
  4784. } else {
  4785. ctx[key] = value;
  4786. }
  4787. }
  4788. return true;
  4789. },
  4790. has({
  4791. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4792. }, key) {
  4793. let normalizedProps;
  4794. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn$1(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn$1(normalizedProps, key) || hasOwn$1(ctx, key) || hasOwn$1(publicPropertiesMap, key) || hasOwn$1(appContext.config.globalProperties, key);
  4795. },
  4796. defineProperty(target, key, descriptor) {
  4797. if (descriptor.get != null) {
  4798. target._.accessCache[key] = 0;
  4799. } else if (hasOwn$1(descriptor, "value")) {
  4800. this.set(target, key, descriptor.value, null);
  4801. }
  4802. return Reflect.defineProperty(target, key, descriptor);
  4803. }
  4804. };
  4805. {
  4806. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4807. warn$1(
  4808. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4809. );
  4810. return Reflect.ownKeys(target);
  4811. };
  4812. }
  4813. function createDevRenderContext(instance) {
  4814. const target = {};
  4815. Object.defineProperty(target, `_`, {
  4816. configurable: true,
  4817. enumerable: false,
  4818. get: () => instance
  4819. });
  4820. Object.keys(publicPropertiesMap).forEach((key) => {
  4821. Object.defineProperty(target, key, {
  4822. configurable: true,
  4823. enumerable: false,
  4824. get: () => publicPropertiesMap[key](instance),
  4825. // intercepted by the proxy so no need for implementation,
  4826. // but needed to prevent set errors
  4827. set: NOOP
  4828. });
  4829. });
  4830. return target;
  4831. }
  4832. function exposePropsOnRenderContext(instance) {
  4833. const {
  4834. ctx,
  4835. propsOptions: [propsOptions]
  4836. } = instance;
  4837. if (propsOptions) {
  4838. Object.keys(propsOptions).forEach((key) => {
  4839. Object.defineProperty(ctx, key, {
  4840. enumerable: true,
  4841. configurable: true,
  4842. get: () => instance.props[key],
  4843. set: NOOP
  4844. });
  4845. });
  4846. }
  4847. }
  4848. function exposeSetupStateOnRenderContext(instance) {
  4849. const { ctx, setupState } = instance;
  4850. Object.keys(toRaw(setupState)).forEach((key) => {
  4851. if (!setupState.__isScriptSetup) {
  4852. if (isReservedPrefix(key[0])) {
  4853. warn$1(
  4854. `setup() return property ${JSON.stringify(
  4855. key
  4856. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4857. );
  4858. return;
  4859. }
  4860. Object.defineProperty(ctx, key, {
  4861. enumerable: true,
  4862. configurable: true,
  4863. get: () => setupState[key],
  4864. set: NOOP
  4865. });
  4866. }
  4867. });
  4868. }
  4869. function normalizePropsOrEmits(props) {
  4870. return isArray(props) ? props.reduce(
  4871. (normalized, p2) => (normalized[p2] = null, normalized),
  4872. {}
  4873. ) : props;
  4874. }
  4875. function createDuplicateChecker() {
  4876. const cache = /* @__PURE__ */ Object.create(null);
  4877. return (type, key) => {
  4878. if (cache[key]) {
  4879. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4880. } else {
  4881. cache[key] = type;
  4882. }
  4883. };
  4884. }
  4885. let shouldCacheAccess = true;
  4886. function applyOptions$1(instance) {
  4887. const options = resolveMergedOptions(instance);
  4888. const publicThis = instance.proxy;
  4889. const ctx = instance.ctx;
  4890. shouldCacheAccess = false;
  4891. if (options.beforeCreate) {
  4892. callHook$1(options.beforeCreate, instance, "bc");
  4893. }
  4894. const {
  4895. // state
  4896. data: dataOptions,
  4897. computed: computedOptions,
  4898. methods,
  4899. watch: watchOptions,
  4900. provide: provideOptions,
  4901. inject: injectOptions,
  4902. // lifecycle
  4903. created,
  4904. beforeMount,
  4905. mounted,
  4906. beforeUpdate,
  4907. updated,
  4908. activated,
  4909. deactivated,
  4910. beforeDestroy,
  4911. beforeUnmount,
  4912. destroyed,
  4913. unmounted,
  4914. render,
  4915. renderTracked,
  4916. renderTriggered,
  4917. errorCaptured,
  4918. serverPrefetch,
  4919. // public API
  4920. expose,
  4921. inheritAttrs,
  4922. // assets
  4923. components,
  4924. directives,
  4925. filters
  4926. } = options;
  4927. const checkDuplicateProperties = createDuplicateChecker();
  4928. {
  4929. const [propsOptions] = instance.propsOptions;
  4930. if (propsOptions) {
  4931. for (const key in propsOptions) {
  4932. checkDuplicateProperties("Props", key);
  4933. }
  4934. }
  4935. }
  4936. if (injectOptions) {
  4937. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4938. }
  4939. if (methods) {
  4940. for (const key in methods) {
  4941. const methodHandler = methods[key];
  4942. if (isFunction(methodHandler)) {
  4943. {
  4944. Object.defineProperty(ctx, key, {
  4945. value: methodHandler.bind(publicThis),
  4946. configurable: true,
  4947. enumerable: true,
  4948. writable: true
  4949. });
  4950. }
  4951. {
  4952. checkDuplicateProperties("Methods", key);
  4953. }
  4954. } else {
  4955. warn$1(
  4956. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4957. );
  4958. }
  4959. }
  4960. }
  4961. if (dataOptions) {
  4962. if (!isFunction(dataOptions)) {
  4963. warn$1(
  4964. `The data option must be a function. Plain object usage is no longer supported.`
  4965. );
  4966. }
  4967. const data = dataOptions.call(publicThis, publicThis);
  4968. if (isPromise(data)) {
  4969. warn$1(
  4970. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4971. );
  4972. }
  4973. if (!isObject$1(data)) {
  4974. warn$1(`data() should return an object.`);
  4975. } else {
  4976. instance.data = reactive(data);
  4977. {
  4978. for (const key in data) {
  4979. checkDuplicateProperties("Data", key);
  4980. if (!isReservedPrefix(key[0])) {
  4981. Object.defineProperty(ctx, key, {
  4982. configurable: true,
  4983. enumerable: true,
  4984. get: () => data[key],
  4985. set: NOOP
  4986. });
  4987. }
  4988. }
  4989. }
  4990. }
  4991. }
  4992. shouldCacheAccess = true;
  4993. if (computedOptions) {
  4994. for (const key in computedOptions) {
  4995. const opt = computedOptions[key];
  4996. const get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4997. if (get2 === NOOP) {
  4998. warn$1(`Computed property "${key}" has no getter.`);
  4999. }
  5000. const set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5001. warn$1(
  5002. `Write operation failed: computed property "${key}" is readonly.`
  5003. );
  5004. };
  5005. const c2 = computed({
  5006. get: get2,
  5007. set: set2
  5008. });
  5009. Object.defineProperty(ctx, key, {
  5010. enumerable: true,
  5011. configurable: true,
  5012. get: () => c2.value,
  5013. set: (v) => c2.value = v
  5014. });
  5015. {
  5016. checkDuplicateProperties("Computed", key);
  5017. }
  5018. }
  5019. }
  5020. if (watchOptions) {
  5021. for (const key in watchOptions) {
  5022. createWatcher(watchOptions[key], ctx, publicThis, key);
  5023. }
  5024. }
  5025. {
  5026. if (provideOptions) {
  5027. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5028. Reflect.ownKeys(provides).forEach((key) => {
  5029. provide(key, provides[key]);
  5030. });
  5031. }
  5032. }
  5033. {
  5034. if (created) {
  5035. callHook$1(created, instance, "c");
  5036. }
  5037. }
  5038. function registerLifecycleHook(register, hook) {
  5039. if (isArray(hook)) {
  5040. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5041. } else if (hook) {
  5042. register(hook.bind(publicThis));
  5043. }
  5044. }
  5045. registerLifecycleHook(onBeforeMount, beforeMount);
  5046. registerLifecycleHook(onMounted, mounted);
  5047. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5048. registerLifecycleHook(onUpdated, updated);
  5049. registerLifecycleHook(onActivated, activated);
  5050. registerLifecycleHook(onDeactivated, deactivated);
  5051. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5052. registerLifecycleHook(onRenderTracked, renderTracked);
  5053. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5054. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5055. registerLifecycleHook(onUnmounted, unmounted);
  5056. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5057. if (isArray(expose)) {
  5058. if (expose.length) {
  5059. const exposed = instance.exposed || (instance.exposed = {});
  5060. expose.forEach((key) => {
  5061. Object.defineProperty(exposed, key, {
  5062. get: () => publicThis[key],
  5063. set: (val) => publicThis[key] = val
  5064. });
  5065. });
  5066. } else if (!instance.exposed) {
  5067. instance.exposed = {};
  5068. }
  5069. }
  5070. if (render && instance.render === NOOP) {
  5071. instance.render = render;
  5072. }
  5073. if (inheritAttrs != null) {
  5074. instance.inheritAttrs = inheritAttrs;
  5075. }
  5076. if (components)
  5077. instance.components = components;
  5078. if (directives)
  5079. instance.directives = directives;
  5080. if (instance.ctx.$onApplyOptions) {
  5081. instance.ctx.$onApplyOptions(options, instance, publicThis);
  5082. }
  5083. }
  5084. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5085. if (isArray(injectOptions)) {
  5086. injectOptions = normalizeInject(injectOptions);
  5087. }
  5088. for (const key in injectOptions) {
  5089. const opt = injectOptions[key];
  5090. let injected;
  5091. if (isObject$1(opt)) {
  5092. if ("default" in opt) {
  5093. injected = inject(
  5094. opt.from || key,
  5095. opt.default,
  5096. true
  5097. );
  5098. } else {
  5099. injected = inject(opt.from || key);
  5100. }
  5101. } else {
  5102. injected = inject(opt);
  5103. }
  5104. if (isRef(injected)) {
  5105. Object.defineProperty(ctx, key, {
  5106. enumerable: true,
  5107. configurable: true,
  5108. get: () => injected.value,
  5109. set: (v) => injected.value = v
  5110. });
  5111. } else {
  5112. ctx[key] = injected;
  5113. }
  5114. {
  5115. checkDuplicateProperties("Inject", key);
  5116. }
  5117. }
  5118. }
  5119. function callHook$1(hook, instance, type) {
  5120. callWithAsyncErrorHandling(
  5121. isArray(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
  5122. instance,
  5123. type
  5124. );
  5125. }
  5126. function createWatcher(raw, ctx, publicThis, key) {
  5127. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5128. if (isString(raw)) {
  5129. const handler = ctx[raw];
  5130. if (isFunction(handler)) {
  5131. watch(getter, handler);
  5132. } else {
  5133. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5134. }
  5135. } else if (isFunction(raw)) {
  5136. watch(getter, raw.bind(publicThis));
  5137. } else if (isObject$1(raw)) {
  5138. if (isArray(raw)) {
  5139. raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key));
  5140. } else {
  5141. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5142. if (isFunction(handler)) {
  5143. watch(getter, handler, raw);
  5144. } else {
  5145. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5146. }
  5147. }
  5148. } else {
  5149. warn$1(`Invalid watch option: "${key}"`, raw);
  5150. }
  5151. }
  5152. function resolveMergedOptions(instance) {
  5153. const base = instance.type;
  5154. const { mixins, extends: extendsOptions } = base;
  5155. const {
  5156. mixins: globalMixins,
  5157. optionsCache: cache,
  5158. config: { optionMergeStrategies }
  5159. } = instance.appContext;
  5160. const cached = cache.get(base);
  5161. let resolved;
  5162. if (cached) {
  5163. resolved = cached;
  5164. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5165. {
  5166. resolved = base;
  5167. }
  5168. } else {
  5169. resolved = {};
  5170. if (globalMixins.length) {
  5171. globalMixins.forEach(
  5172. (m2) => mergeOptions(resolved, m2, optionMergeStrategies, true)
  5173. );
  5174. }
  5175. mergeOptions(resolved, base, optionMergeStrategies);
  5176. }
  5177. if (isObject$1(base)) {
  5178. cache.set(base, resolved);
  5179. }
  5180. return resolved;
  5181. }
  5182. function mergeOptions(to, from, strats, asMixin = false) {
  5183. const { mixins, extends: extendsOptions } = from;
  5184. if (extendsOptions) {
  5185. mergeOptions(to, extendsOptions, strats, true);
  5186. }
  5187. if (mixins) {
  5188. mixins.forEach(
  5189. (m2) => mergeOptions(to, m2, strats, true)
  5190. );
  5191. }
  5192. for (const key in from) {
  5193. if (asMixin && key === "expose") {
  5194. warn$1(
  5195. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5196. );
  5197. } else {
  5198. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5199. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5200. }
  5201. }
  5202. return to;
  5203. }
  5204. const internalOptionMergeStrats = {
  5205. data: mergeDataFn,
  5206. props: mergeEmitsOrPropsOptions,
  5207. emits: mergeEmitsOrPropsOptions,
  5208. // objects
  5209. methods: mergeObjectOptions,
  5210. computed: mergeObjectOptions,
  5211. // lifecycle
  5212. beforeCreate: mergeAsArray$1,
  5213. created: mergeAsArray$1,
  5214. beforeMount: mergeAsArray$1,
  5215. mounted: mergeAsArray$1,
  5216. beforeUpdate: mergeAsArray$1,
  5217. updated: mergeAsArray$1,
  5218. beforeDestroy: mergeAsArray$1,
  5219. beforeUnmount: mergeAsArray$1,
  5220. destroyed: mergeAsArray$1,
  5221. unmounted: mergeAsArray$1,
  5222. activated: mergeAsArray$1,
  5223. deactivated: mergeAsArray$1,
  5224. errorCaptured: mergeAsArray$1,
  5225. serverPrefetch: mergeAsArray$1,
  5226. // assets
  5227. components: mergeObjectOptions,
  5228. directives: mergeObjectOptions,
  5229. // watch
  5230. watch: mergeWatchOptions,
  5231. // provide / inject
  5232. provide: mergeDataFn,
  5233. inject: mergeInject
  5234. };
  5235. function mergeDataFn(to, from) {
  5236. if (!from) {
  5237. return to;
  5238. }
  5239. if (!to) {
  5240. return from;
  5241. }
  5242. return function mergedDataFn() {
  5243. return extend(
  5244. isFunction(to) ? to.call(this, this) : to,
  5245. isFunction(from) ? from.call(this, this) : from
  5246. );
  5247. };
  5248. }
  5249. function mergeInject(to, from) {
  5250. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5251. }
  5252. function normalizeInject(raw) {
  5253. if (isArray(raw)) {
  5254. const res = {};
  5255. for (let i = 0; i < raw.length; i++) {
  5256. res[raw[i]] = raw[i];
  5257. }
  5258. return res;
  5259. }
  5260. return raw;
  5261. }
  5262. function mergeAsArray$1(to, from) {
  5263. return to ? [...new Set([].concat(to, from))] : from;
  5264. }
  5265. function mergeObjectOptions(to, from) {
  5266. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5267. }
  5268. function mergeEmitsOrPropsOptions(to, from) {
  5269. if (to) {
  5270. if (isArray(to) && isArray(from)) {
  5271. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5272. }
  5273. return extend(
  5274. /* @__PURE__ */ Object.create(null),
  5275. normalizePropsOrEmits(to),
  5276. normalizePropsOrEmits(from != null ? from : {})
  5277. );
  5278. } else {
  5279. return from;
  5280. }
  5281. }
  5282. function mergeWatchOptions(to, from) {
  5283. if (!to)
  5284. return from;
  5285. if (!from)
  5286. return to;
  5287. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5288. for (const key in from) {
  5289. merged[key] = mergeAsArray$1(to[key], from[key]);
  5290. }
  5291. return merged;
  5292. }
  5293. function initProps$1(instance, rawProps, isStateful, isSSR = false) {
  5294. const props = {};
  5295. const attrs = {};
  5296. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5297. setFullProps(instance, rawProps, props, attrs);
  5298. for (const key in instance.propsOptions[0]) {
  5299. if (!(key in props)) {
  5300. props[key] = void 0;
  5301. }
  5302. }
  5303. {
  5304. validateProps(rawProps || {}, props, instance);
  5305. }
  5306. if (isStateful) {
  5307. instance.props = isSSR ? props : shallowReactive(props);
  5308. } else {
  5309. if (!instance.type.props) {
  5310. instance.props = attrs;
  5311. } else {
  5312. instance.props = props;
  5313. }
  5314. }
  5315. instance.attrs = attrs;
  5316. }
  5317. function isInHmrContext(instance) {
  5318. while (instance) {
  5319. if (instance.type.__hmrId)
  5320. return true;
  5321. instance = instance.parent;
  5322. }
  5323. }
  5324. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5325. const {
  5326. props,
  5327. attrs,
  5328. vnode: { patchFlag }
  5329. } = instance;
  5330. const rawCurrentProps = toRaw(props);
  5331. const [options] = instance.propsOptions;
  5332. let hasAttrsChanged = false;
  5333. if (
  5334. // always force full diff in dev
  5335. // - #1942 if hmr is enabled with sfc component
  5336. // - vite#872 non-sfc component used by sfc component
  5337. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5338. ) {
  5339. if (patchFlag & 8) {
  5340. const propsToUpdate = instance.vnode.dynamicProps;
  5341. for (let i = 0; i < propsToUpdate.length; i++) {
  5342. let key = propsToUpdate[i];
  5343. if (isEmitListener(instance.emitsOptions, key)) {
  5344. continue;
  5345. }
  5346. const value = rawProps[key];
  5347. if (options) {
  5348. if (hasOwn$1(attrs, key)) {
  5349. if (value !== attrs[key]) {
  5350. attrs[key] = value;
  5351. hasAttrsChanged = true;
  5352. }
  5353. } else {
  5354. const camelizedKey = camelize(key);
  5355. props[camelizedKey] = resolvePropValue(
  5356. options,
  5357. rawCurrentProps,
  5358. camelizedKey,
  5359. value,
  5360. instance,
  5361. false
  5362. );
  5363. }
  5364. } else {
  5365. if (value !== attrs[key]) {
  5366. attrs[key] = value;
  5367. hasAttrsChanged = true;
  5368. }
  5369. }
  5370. }
  5371. }
  5372. } else {
  5373. if (setFullProps(instance, rawProps, props, attrs)) {
  5374. hasAttrsChanged = true;
  5375. }
  5376. let kebabKey;
  5377. for (const key in rawCurrentProps) {
  5378. if (!rawProps || // for camelCase
  5379. !hasOwn$1(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5380. // and converted to camelCase (#955)
  5381. ((kebabKey = hyphenate(key)) === key || !hasOwn$1(rawProps, kebabKey))) {
  5382. if (options) {
  5383. if (rawPrevProps && // for camelCase
  5384. (rawPrevProps[key] !== void 0 || // for kebab-case
  5385. rawPrevProps[kebabKey] !== void 0)) {
  5386. props[key] = resolvePropValue(
  5387. options,
  5388. rawCurrentProps,
  5389. key,
  5390. void 0,
  5391. instance,
  5392. true
  5393. );
  5394. }
  5395. } else {
  5396. delete props[key];
  5397. }
  5398. }
  5399. }
  5400. if (attrs !== rawCurrentProps) {
  5401. for (const key in attrs) {
  5402. if (!rawProps || !hasOwn$1(rawProps, key) && true) {
  5403. delete attrs[key];
  5404. hasAttrsChanged = true;
  5405. }
  5406. }
  5407. }
  5408. }
  5409. if (hasAttrsChanged) {
  5410. trigger(instance, "set", "$attrs");
  5411. }
  5412. {
  5413. validateProps(rawProps || {}, props, instance);
  5414. }
  5415. }
  5416. function setFullProps(instance, rawProps, props, attrs) {
  5417. const [options, needCastKeys] = instance.propsOptions;
  5418. let hasAttrsChanged = false;
  5419. let rawCastValues;
  5420. if (rawProps) {
  5421. for (let key in rawProps) {
  5422. if (isReservedProp(key)) {
  5423. continue;
  5424. }
  5425. const value = rawProps[key];
  5426. let camelKey;
  5427. if (options && hasOwn$1(options, camelKey = camelize(key))) {
  5428. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5429. props[camelKey] = value;
  5430. } else {
  5431. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5432. }
  5433. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5434. if (!(key in attrs) || value !== attrs[key]) {
  5435. attrs[key] = value;
  5436. hasAttrsChanged = true;
  5437. }
  5438. }
  5439. }
  5440. }
  5441. if (needCastKeys) {
  5442. const rawCurrentProps = toRaw(props);
  5443. const castValues = rawCastValues || EMPTY_OBJ;
  5444. for (let i = 0; i < needCastKeys.length; i++) {
  5445. const key = needCastKeys[i];
  5446. props[key] = resolvePropValue(
  5447. options,
  5448. rawCurrentProps,
  5449. key,
  5450. castValues[key],
  5451. instance,
  5452. !hasOwn$1(castValues, key)
  5453. );
  5454. }
  5455. }
  5456. return hasAttrsChanged;
  5457. }
  5458. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5459. const opt = options[key];
  5460. if (opt != null) {
  5461. const hasDefault = hasOwn$1(opt, "default");
  5462. if (hasDefault && value === void 0) {
  5463. const defaultValue = opt.default;
  5464. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5465. const { propsDefaults } = instance;
  5466. if (key in propsDefaults) {
  5467. value = propsDefaults[key];
  5468. } else {
  5469. const reset = setCurrentInstance(instance);
  5470. value = propsDefaults[key] = defaultValue.call(
  5471. null,
  5472. props
  5473. );
  5474. reset();
  5475. }
  5476. } else {
  5477. value = defaultValue;
  5478. }
  5479. }
  5480. if (opt[
  5481. 0
  5482. /* shouldCast */
  5483. ]) {
  5484. if (isAbsent && !hasDefault) {
  5485. value = false;
  5486. } else if (opt[
  5487. 1
  5488. /* shouldCastTrue */
  5489. ] && (value === "" || value === hyphenate(key))) {
  5490. value = true;
  5491. }
  5492. }
  5493. }
  5494. return value;
  5495. }
  5496. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5497. const cache = appContext.propsCache;
  5498. const cached = cache.get(comp);
  5499. if (cached) {
  5500. return cached;
  5501. }
  5502. const raw = comp.props;
  5503. const normalized = {};
  5504. const needCastKeys = [];
  5505. let hasExtends = false;
  5506. if (!isFunction(comp)) {
  5507. const extendProps = (raw2) => {
  5508. hasExtends = true;
  5509. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5510. extend(normalized, props);
  5511. if (keys)
  5512. needCastKeys.push(...keys);
  5513. };
  5514. if (!asMixin && appContext.mixins.length) {
  5515. appContext.mixins.forEach(extendProps);
  5516. }
  5517. if (comp.extends) {
  5518. extendProps(comp.extends);
  5519. }
  5520. if (comp.mixins) {
  5521. comp.mixins.forEach(extendProps);
  5522. }
  5523. }
  5524. if (!raw && !hasExtends) {
  5525. if (isObject$1(comp)) {
  5526. cache.set(comp, EMPTY_ARR);
  5527. }
  5528. return EMPTY_ARR;
  5529. }
  5530. if (isArray(raw)) {
  5531. for (let i = 0; i < raw.length; i++) {
  5532. if (!isString(raw[i])) {
  5533. warn$1(`props must be strings when using array syntax.`, raw[i]);
  5534. }
  5535. const normalizedKey = camelize(raw[i]);
  5536. if (validatePropName(normalizedKey)) {
  5537. normalized[normalizedKey] = EMPTY_OBJ;
  5538. }
  5539. }
  5540. } else if (raw) {
  5541. if (!isObject$1(raw)) {
  5542. warn$1(`invalid props options`, raw);
  5543. }
  5544. for (const key in raw) {
  5545. const normalizedKey = camelize(key);
  5546. if (validatePropName(normalizedKey)) {
  5547. const opt = raw[key];
  5548. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5549. if (prop) {
  5550. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5551. const stringIndex = getTypeIndex(String, prop.type);
  5552. prop[
  5553. 0
  5554. /* shouldCast */
  5555. ] = booleanIndex > -1;
  5556. prop[
  5557. 1
  5558. /* shouldCastTrue */
  5559. ] = stringIndex < 0 || booleanIndex < stringIndex;
  5560. if (booleanIndex > -1 || hasOwn$1(prop, "default")) {
  5561. needCastKeys.push(normalizedKey);
  5562. }
  5563. }
  5564. }
  5565. }
  5566. }
  5567. const res = [normalized, needCastKeys];
  5568. if (isObject$1(comp)) {
  5569. cache.set(comp, res);
  5570. }
  5571. return res;
  5572. }
  5573. function validatePropName(key) {
  5574. if (key[0] !== "$" && !isReservedProp(key)) {
  5575. return true;
  5576. } else {
  5577. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  5578. }
  5579. return false;
  5580. }
  5581. function getType(ctor) {
  5582. if (ctor === null) {
  5583. return "null";
  5584. }
  5585. if (typeof ctor === "function") {
  5586. return ctor.name || "";
  5587. } else if (typeof ctor === "object") {
  5588. const name = ctor.constructor && ctor.constructor.name;
  5589. return name || "";
  5590. }
  5591. return "";
  5592. }
  5593. function isSameType(a, b) {
  5594. return getType(a) === getType(b);
  5595. }
  5596. function getTypeIndex(type, expectedTypes) {
  5597. if (isArray(expectedTypes)) {
  5598. return expectedTypes.findIndex((t2) => isSameType(t2, type));
  5599. } else if (isFunction(expectedTypes)) {
  5600. return isSameType(expectedTypes, type) ? 0 : -1;
  5601. }
  5602. return -1;
  5603. }
  5604. function validateProps(rawProps, props, instance) {
  5605. const resolvedValues = toRaw(props);
  5606. const options = instance.propsOptions[0];
  5607. for (const key in options) {
  5608. let opt = options[key];
  5609. if (opt == null)
  5610. continue;
  5611. validateProp(
  5612. key,
  5613. resolvedValues[key],
  5614. opt,
  5615. shallowReadonly(resolvedValues),
  5616. !hasOwn$1(rawProps, key) && !hasOwn$1(rawProps, hyphenate(key))
  5617. );
  5618. }
  5619. }
  5620. function validateProp(name, value, prop, props, isAbsent) {
  5621. const { type, required, validator, skipCheck } = prop;
  5622. if (required && isAbsent) {
  5623. warn$1('Missing required prop: "' + name + '"');
  5624. return;
  5625. }
  5626. if (value == null && !required) {
  5627. return;
  5628. }
  5629. if (type != null && type !== true && !skipCheck) {
  5630. let isValid = false;
  5631. const types = isArray(type) ? type : [type];
  5632. const expectedTypes = [];
  5633. for (let i = 0; i < types.length && !isValid; i++) {
  5634. const { valid, expectedType } = assertType(value, types[i]);
  5635. expectedTypes.push(expectedType || "");
  5636. isValid = valid;
  5637. }
  5638. if (!isValid) {
  5639. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  5640. return;
  5641. }
  5642. }
  5643. if (validator && !validator(value, props)) {
  5644. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  5645. }
  5646. }
  5647. const isSimpleType = /* @__PURE__ */ makeMap(
  5648. "String,Number,Boolean,Function,Symbol,BigInt"
  5649. );
  5650. function assertType(value, type) {
  5651. let valid;
  5652. const expectedType = getType(type);
  5653. if (isSimpleType(expectedType)) {
  5654. const t2 = typeof value;
  5655. valid = t2 === expectedType.toLowerCase();
  5656. if (!valid && t2 === "object") {
  5657. valid = value instanceof type;
  5658. }
  5659. } else if (expectedType === "Object") {
  5660. valid = isObject$1(value);
  5661. } else if (expectedType === "Array") {
  5662. valid = isArray(value);
  5663. } else if (expectedType === "null") {
  5664. valid = value === null;
  5665. } else {
  5666. valid = value instanceof type;
  5667. }
  5668. return {
  5669. valid,
  5670. expectedType
  5671. };
  5672. }
  5673. function getInvalidTypeMessage(name, value, expectedTypes) {
  5674. if (expectedTypes.length === 0) {
  5675. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  5676. }
  5677. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5678. const expectedType = expectedTypes[0];
  5679. const receivedType = toRawType(value);
  5680. const expectedValue = styleValue(value, expectedType);
  5681. const receivedValue = styleValue(value, receivedType);
  5682. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5683. message += ` with value ${expectedValue}`;
  5684. }
  5685. message += `, got ${receivedType} `;
  5686. if (isExplicable(receivedType)) {
  5687. message += `with value ${receivedValue}.`;
  5688. }
  5689. return message;
  5690. }
  5691. function styleValue(value, type) {
  5692. if (type === "String") {
  5693. return `"${value}"`;
  5694. } else if (type === "Number") {
  5695. return `${Number(value)}`;
  5696. } else {
  5697. return `${value}`;
  5698. }
  5699. }
  5700. function isExplicable(type) {
  5701. const explicitTypes = ["string", "number", "boolean"];
  5702. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5703. }
  5704. function isBoolean(...args) {
  5705. return args.some((elem) => elem.toLowerCase() === "boolean");
  5706. }
  5707. let supported;
  5708. let perf;
  5709. function startMeasure(instance, type) {
  5710. if (instance.appContext.config.performance && isSupported()) {
  5711. perf.mark(`vue-${type}-${instance.uid}`);
  5712. }
  5713. {
  5714. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  5715. }
  5716. }
  5717. function endMeasure(instance, type) {
  5718. if (instance.appContext.config.performance && isSupported()) {
  5719. const startTag = `vue-${type}-${instance.uid}`;
  5720. const endTag = startTag + `:end`;
  5721. perf.mark(endTag);
  5722. perf.measure(
  5723. `<${formatComponentName(instance, instance.type)}> ${type}`,
  5724. startTag,
  5725. endTag
  5726. );
  5727. perf.clearMarks(startTag);
  5728. perf.clearMarks(endTag);
  5729. }
  5730. {
  5731. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  5732. }
  5733. }
  5734. function isSupported() {
  5735. if (supported !== void 0) {
  5736. return supported;
  5737. }
  5738. if (typeof window !== "undefined" && window.performance) {
  5739. supported = true;
  5740. perf = window.performance;
  5741. } else {
  5742. supported = false;
  5743. }
  5744. return supported;
  5745. }
  5746. const queuePostRenderEffect$1 = queuePostFlushCb;
  5747. const Fragment = Symbol.for("v-fgt");
  5748. const Text = Symbol.for("v-txt");
  5749. const Comment = Symbol.for("v-cmt");
  5750. const Static = Symbol.for("v-stc");
  5751. function isVNode(value) {
  5752. return value ? value.__v_isVNode === true : false;
  5753. }
  5754. const InternalObjectKey = `__vInternal`;
  5755. function guardReactiveProps(props) {
  5756. if (!props)
  5757. return null;
  5758. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  5759. }
  5760. const emptyAppContext = createAppContext();
  5761. let uid = 0;
  5762. function createComponentInstance(vnode, parent, suspense) {
  5763. const type = vnode.type;
  5764. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  5765. const instance = {
  5766. uid: uid++,
  5767. vnode,
  5768. type,
  5769. parent,
  5770. appContext,
  5771. root: null,
  5772. // to be immediately set
  5773. next: null,
  5774. subTree: null,
  5775. // will be set synchronously right after creation
  5776. effect: null,
  5777. update: null,
  5778. // will be set synchronously right after creation
  5779. scope: new EffectScope(
  5780. true
  5781. /* detached */
  5782. ),
  5783. render: null,
  5784. proxy: null,
  5785. exposed: null,
  5786. exposeProxy: null,
  5787. withProxy: null,
  5788. provides: parent ? parent.provides : Object.create(appContext.provides),
  5789. accessCache: null,
  5790. renderCache: [],
  5791. // local resolved assets
  5792. components: null,
  5793. directives: null,
  5794. // resolved props and emits options
  5795. propsOptions: normalizePropsOptions(type, appContext),
  5796. emitsOptions: normalizeEmitsOptions(type, appContext),
  5797. // emit
  5798. emit: null,
  5799. // to be set immediately
  5800. emitted: null,
  5801. // props default value
  5802. propsDefaults: EMPTY_OBJ,
  5803. // inheritAttrs
  5804. inheritAttrs: type.inheritAttrs,
  5805. // state
  5806. ctx: EMPTY_OBJ,
  5807. data: EMPTY_OBJ,
  5808. props: EMPTY_OBJ,
  5809. attrs: EMPTY_OBJ,
  5810. slots: EMPTY_OBJ,
  5811. refs: EMPTY_OBJ,
  5812. setupState: EMPTY_OBJ,
  5813. setupContext: null,
  5814. attrsProxy: null,
  5815. slotsProxy: null,
  5816. // suspense related
  5817. suspense,
  5818. suspenseId: suspense ? suspense.pendingId : 0,
  5819. asyncDep: null,
  5820. asyncResolved: false,
  5821. // lifecycle hooks
  5822. // not using enums here because it results in computed properties
  5823. isMounted: false,
  5824. isUnmounted: false,
  5825. isDeactivated: false,
  5826. bc: null,
  5827. c: null,
  5828. bm: null,
  5829. m: null,
  5830. bu: null,
  5831. u: null,
  5832. um: null,
  5833. bum: null,
  5834. da: null,
  5835. a: null,
  5836. rtg: null,
  5837. rtc: null,
  5838. ec: null,
  5839. sp: null
  5840. };
  5841. {
  5842. instance.ctx = createDevRenderContext(instance);
  5843. }
  5844. instance.root = parent ? parent.root : instance;
  5845. instance.emit = emit.bind(null, instance);
  5846. if (vnode.ce) {
  5847. vnode.ce(instance);
  5848. }
  5849. return instance;
  5850. }
  5851. let currentInstance = null;
  5852. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  5853. let internalSetCurrentInstance;
  5854. let setInSSRSetupState;
  5855. {
  5856. internalSetCurrentInstance = (i) => {
  5857. currentInstance = i;
  5858. };
  5859. setInSSRSetupState = (v) => {
  5860. isInSSRComponentSetup = v;
  5861. };
  5862. }
  5863. const setCurrentInstance = (instance) => {
  5864. const prev = currentInstance;
  5865. internalSetCurrentInstance(instance);
  5866. instance.scope.on();
  5867. return () => {
  5868. instance.scope.off();
  5869. internalSetCurrentInstance(prev);
  5870. };
  5871. };
  5872. const unsetCurrentInstance = () => {
  5873. currentInstance && currentInstance.scope.off();
  5874. internalSetCurrentInstance(null);
  5875. };
  5876. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  5877. function validateComponentName(name, { isNativeTag }) {
  5878. if (isBuiltInTag(name) || isNativeTag(name)) {
  5879. warn$1(
  5880. "Do not use built-in or reserved HTML elements as component id: " + name
  5881. );
  5882. }
  5883. }
  5884. function isStatefulComponent(instance) {
  5885. return instance.vnode.shapeFlag & 4;
  5886. }
  5887. let isInSSRComponentSetup = false;
  5888. function setupComponent(instance, isSSR = false) {
  5889. isSSR && setInSSRSetupState(isSSR);
  5890. const {
  5891. props
  5892. /*, children*/
  5893. } = instance.vnode;
  5894. const isStateful = isStatefulComponent(instance);
  5895. initProps$1(instance, props, isStateful, isSSR);
  5896. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  5897. isSSR && setInSSRSetupState(false);
  5898. return setupResult;
  5899. }
  5900. function setupStatefulComponent(instance, isSSR) {
  5901. const Component2 = instance.type;
  5902. {
  5903. if (Component2.name) {
  5904. validateComponentName(Component2.name, instance.appContext.config);
  5905. }
  5906. if (Component2.components) {
  5907. const names = Object.keys(Component2.components);
  5908. for (let i = 0; i < names.length; i++) {
  5909. validateComponentName(names[i], instance.appContext.config);
  5910. }
  5911. }
  5912. if (Component2.directives) {
  5913. const names = Object.keys(Component2.directives);
  5914. for (let i = 0; i < names.length; i++) {
  5915. validateDirectiveName(names[i]);
  5916. }
  5917. }
  5918. if (Component2.compilerOptions && isRuntimeOnly()) {
  5919. warn$1(
  5920. `"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.`
  5921. );
  5922. }
  5923. }
  5924. instance.accessCache = /* @__PURE__ */ Object.create(null);
  5925. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  5926. {
  5927. exposePropsOnRenderContext(instance);
  5928. }
  5929. const { setup } = Component2;
  5930. if (setup) {
  5931. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  5932. const reset = setCurrentInstance(instance);
  5933. pauseTracking();
  5934. const setupResult = callWithErrorHandling(
  5935. setup,
  5936. instance,
  5937. 0,
  5938. [
  5939. shallowReadonly(instance.props),
  5940. setupContext
  5941. ]
  5942. );
  5943. resetTracking();
  5944. reset();
  5945. if (isPromise(setupResult)) {
  5946. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  5947. {
  5948. warn$1(
  5949. `setup() returned a Promise, but the version of Vue you are using does not support it yet.`
  5950. );
  5951. }
  5952. } else {
  5953. handleSetupResult(instance, setupResult, isSSR);
  5954. }
  5955. } else {
  5956. finishComponentSetup(instance, isSSR);
  5957. }
  5958. }
  5959. function handleSetupResult(instance, setupResult, isSSR) {
  5960. if (isFunction(setupResult)) {
  5961. {
  5962. instance.render = setupResult;
  5963. }
  5964. } else if (isObject$1(setupResult)) {
  5965. if (isVNode(setupResult)) {
  5966. warn$1(
  5967. `setup() should not return VNodes directly - return a render function instead.`
  5968. );
  5969. }
  5970. {
  5971. instance.devtoolsRawSetupState = setupResult;
  5972. }
  5973. instance.setupState = proxyRefs(setupResult);
  5974. {
  5975. exposeSetupStateOnRenderContext(instance);
  5976. }
  5977. } else if (setupResult !== void 0) {
  5978. warn$1(
  5979. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  5980. );
  5981. }
  5982. finishComponentSetup(instance, isSSR);
  5983. }
  5984. let compile;
  5985. const isRuntimeOnly = () => !compile;
  5986. function finishComponentSetup(instance, isSSR, skipOptions) {
  5987. const Component2 = instance.type;
  5988. if (!instance.render) {
  5989. instance.render = Component2.render || NOOP;
  5990. }
  5991. {
  5992. const reset = setCurrentInstance(instance);
  5993. pauseTracking();
  5994. try {
  5995. applyOptions$1(instance);
  5996. } finally {
  5997. resetTracking();
  5998. reset();
  5999. }
  6000. }
  6001. if (!Component2.render && instance.render === NOOP && !isSSR) {
  6002. if (Component2.template) {
  6003. warn$1(
  6004. `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".`
  6005. );
  6006. } else {
  6007. warn$1(`Component is missing template or render function.`);
  6008. }
  6009. }
  6010. }
  6011. function getAttrsProxy(instance) {
  6012. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  6013. instance.attrs,
  6014. {
  6015. get(target, key) {
  6016. track(instance, "get", "$attrs");
  6017. return target[key];
  6018. },
  6019. set() {
  6020. warn$1(`setupContext.attrs is readonly.`);
  6021. return false;
  6022. },
  6023. deleteProperty() {
  6024. warn$1(`setupContext.attrs is readonly.`);
  6025. return false;
  6026. }
  6027. }
  6028. ));
  6029. }
  6030. function getSlotsProxy(instance) {
  6031. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  6032. get(target, key) {
  6033. track(instance, "get", "$slots");
  6034. return target[key];
  6035. }
  6036. }));
  6037. }
  6038. function createSetupContext(instance) {
  6039. const expose = (exposed) => {
  6040. {
  6041. if (instance.exposed) {
  6042. warn$1(`expose() should be called only once per setup().`);
  6043. }
  6044. if (exposed != null) {
  6045. let exposedType = typeof exposed;
  6046. if (exposedType === "object") {
  6047. if (isArray(exposed)) {
  6048. exposedType = "array";
  6049. } else if (isRef(exposed)) {
  6050. exposedType = "ref";
  6051. }
  6052. }
  6053. if (exposedType !== "object") {
  6054. warn$1(
  6055. `expose() should be passed a plain object, received ${exposedType}.`
  6056. );
  6057. }
  6058. }
  6059. }
  6060. instance.exposed = exposed || {};
  6061. };
  6062. {
  6063. return Object.freeze({
  6064. get attrs() {
  6065. return getAttrsProxy(instance);
  6066. },
  6067. get slots() {
  6068. return getSlotsProxy(instance);
  6069. },
  6070. get emit() {
  6071. return (event, ...args) => instance.emit(event, ...args);
  6072. },
  6073. expose
  6074. });
  6075. }
  6076. }
  6077. function getExposeProxy(instance) {
  6078. if (instance.exposed) {
  6079. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  6080. get(target, key) {
  6081. if (key in target) {
  6082. return target[key];
  6083. }
  6084. return instance.proxy[key];
  6085. },
  6086. has(target, key) {
  6087. return key in target || key in publicPropertiesMap;
  6088. }
  6089. }));
  6090. }
  6091. }
  6092. const classifyRE = /(?:^|[-_])(\w)/g;
  6093. const classify = (str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, "");
  6094. function getComponentName(Component2, includeInferred = true) {
  6095. return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
  6096. }
  6097. function formatComponentName(instance, Component2, isRoot = false) {
  6098. let name = getComponentName(Component2);
  6099. if (!name && Component2.__file) {
  6100. const match = Component2.__file.match(/([^/\\]+)\.\w+$/);
  6101. if (match) {
  6102. name = match[1];
  6103. }
  6104. }
  6105. if (!name && instance && instance.parent) {
  6106. const inferFromRegistry = (registry) => {
  6107. for (const key in registry) {
  6108. if (registry[key] === Component2) {
  6109. return key;
  6110. }
  6111. }
  6112. };
  6113. name = inferFromRegistry(
  6114. instance.components || instance.parent.type.components
  6115. ) || inferFromRegistry(instance.appContext.components);
  6116. }
  6117. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  6118. }
  6119. const computed = (getterOrOptions, debugOptions) => {
  6120. const c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  6121. {
  6122. const i = getCurrentInstance();
  6123. if (i && i.appContext.config.warnRecursiveComputed) {
  6124. c2._warnRecursive = true;
  6125. }
  6126. }
  6127. return c2;
  6128. };
  6129. const version = "3.4.21";
  6130. const warn = warn$1;
  6131. function unwrapper(target) {
  6132. return unref(target);
  6133. }
  6134. const ARRAYTYPE = "[object Array]";
  6135. const OBJECTTYPE = "[object Object]";
  6136. function diff(current, pre) {
  6137. const result = {};
  6138. syncKeys(current, pre);
  6139. _diff(current, pre, "", result);
  6140. return result;
  6141. }
  6142. function syncKeys(current, pre) {
  6143. current = unwrapper(current);
  6144. if (current === pre)
  6145. return;
  6146. const rootCurrentType = toTypeString(current);
  6147. const rootPreType = toTypeString(pre);
  6148. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6149. for (let key in pre) {
  6150. const currentValue = current[key];
  6151. if (currentValue === void 0) {
  6152. current[key] = null;
  6153. } else {
  6154. syncKeys(currentValue, pre[key]);
  6155. }
  6156. }
  6157. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6158. if (current.length >= pre.length) {
  6159. pre.forEach((item, index2) => {
  6160. syncKeys(current[index2], item);
  6161. });
  6162. }
  6163. }
  6164. }
  6165. function _diff(current, pre, path, result) {
  6166. current = unwrapper(current);
  6167. if (current === pre)
  6168. return;
  6169. const rootCurrentType = toTypeString(current);
  6170. const rootPreType = toTypeString(pre);
  6171. if (rootCurrentType == OBJECTTYPE) {
  6172. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6173. setResult(result, path, current);
  6174. } else {
  6175. for (let key in current) {
  6176. const currentValue = unwrapper(current[key]);
  6177. const preValue = pre[key];
  6178. const currentType = toTypeString(currentValue);
  6179. const preType = toTypeString(preValue);
  6180. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6181. if (currentValue != preValue) {
  6182. setResult(
  6183. result,
  6184. (path == "" ? "" : path + ".") + key,
  6185. currentValue
  6186. );
  6187. }
  6188. } else if (currentType == ARRAYTYPE) {
  6189. if (preType != ARRAYTYPE) {
  6190. setResult(
  6191. result,
  6192. (path == "" ? "" : path + ".") + key,
  6193. currentValue
  6194. );
  6195. } else {
  6196. if (currentValue.length < preValue.length) {
  6197. setResult(
  6198. result,
  6199. (path == "" ? "" : path + ".") + key,
  6200. currentValue
  6201. );
  6202. } else {
  6203. currentValue.forEach((item, index2) => {
  6204. _diff(
  6205. item,
  6206. preValue[index2],
  6207. (path == "" ? "" : path + ".") + key + "[" + index2 + "]",
  6208. result
  6209. );
  6210. });
  6211. }
  6212. }
  6213. } else if (currentType == OBJECTTYPE) {
  6214. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6215. setResult(
  6216. result,
  6217. (path == "" ? "" : path + ".") + key,
  6218. currentValue
  6219. );
  6220. } else {
  6221. for (let subKey in currentValue) {
  6222. _diff(
  6223. currentValue[subKey],
  6224. preValue[subKey],
  6225. (path == "" ? "" : path + ".") + key + "." + subKey,
  6226. result
  6227. );
  6228. }
  6229. }
  6230. }
  6231. }
  6232. }
  6233. } else if (rootCurrentType == ARRAYTYPE) {
  6234. if (rootPreType != ARRAYTYPE) {
  6235. setResult(result, path, current);
  6236. } else {
  6237. if (current.length < pre.length) {
  6238. setResult(result, path, current);
  6239. } else {
  6240. current.forEach((item, index2) => {
  6241. _diff(item, pre[index2], path + "[" + index2 + "]", result);
  6242. });
  6243. }
  6244. }
  6245. } else {
  6246. setResult(result, path, current);
  6247. }
  6248. }
  6249. function setResult(result, k, v) {
  6250. result[k] = v;
  6251. }
  6252. function hasComponentEffect(instance) {
  6253. return queue.includes(instance.update);
  6254. }
  6255. function flushCallbacks(instance) {
  6256. const ctx = instance.ctx;
  6257. const callbacks = ctx.__next_tick_callbacks;
  6258. if (callbacks && callbacks.length) {
  6259. const copies = callbacks.slice(0);
  6260. callbacks.length = 0;
  6261. for (let i = 0; i < copies.length; i++) {
  6262. copies[i]();
  6263. }
  6264. }
  6265. }
  6266. function nextTick(instance, fn) {
  6267. const ctx = instance.ctx;
  6268. if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
  6269. return nextTick$1(fn && fn.bind(instance.proxy));
  6270. }
  6271. let _resolve;
  6272. if (!ctx.__next_tick_callbacks) {
  6273. ctx.__next_tick_callbacks = [];
  6274. }
  6275. ctx.__next_tick_callbacks.push(() => {
  6276. if (fn) {
  6277. callWithErrorHandling(
  6278. fn.bind(instance.proxy),
  6279. instance,
  6280. 14
  6281. );
  6282. } else if (_resolve) {
  6283. _resolve(instance.proxy);
  6284. }
  6285. });
  6286. return new Promise((resolve2) => {
  6287. _resolve = resolve2;
  6288. });
  6289. }
  6290. function clone(src, seen) {
  6291. src = unwrapper(src);
  6292. const type = typeof src;
  6293. if (type === "object" && src !== null) {
  6294. let copy = seen.get(src);
  6295. if (typeof copy !== "undefined") {
  6296. return copy;
  6297. }
  6298. if (isArray(src)) {
  6299. const len = src.length;
  6300. copy = new Array(len);
  6301. seen.set(src, copy);
  6302. for (let i = 0; i < len; i++) {
  6303. copy[i] = clone(src[i], seen);
  6304. }
  6305. } else {
  6306. copy = {};
  6307. seen.set(src, copy);
  6308. for (const name in src) {
  6309. if (hasOwn$1(src, name)) {
  6310. copy[name] = clone(src[name], seen);
  6311. }
  6312. }
  6313. }
  6314. return copy;
  6315. }
  6316. if (type !== "symbol") {
  6317. return src;
  6318. }
  6319. }
  6320. function deepCopy(src) {
  6321. return clone(src, typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : /* @__PURE__ */ new Map());
  6322. }
  6323. function getMPInstanceData(instance, keys) {
  6324. const data = instance.data;
  6325. const ret = /* @__PURE__ */ Object.create(null);
  6326. keys.forEach((key) => {
  6327. ret[key] = data[key];
  6328. });
  6329. return ret;
  6330. }
  6331. function patch(instance, data, oldData) {
  6332. if (!data) {
  6333. return;
  6334. }
  6335. data = deepCopy(data);
  6336. const ctx = instance.ctx;
  6337. const mpType = ctx.mpType;
  6338. if (mpType === "page" || mpType === "component") {
  6339. data.r0 = 1;
  6340. const mpInstance = ctx.$scope;
  6341. const keys = Object.keys(data);
  6342. const diffData = diff(data, oldData || getMPInstanceData(mpInstance, keys));
  6343. if (Object.keys(diffData).length) {
  6344. ctx.__next_tick_pending = true;
  6345. mpInstance.setData(diffData, () => {
  6346. ctx.__next_tick_pending = false;
  6347. flushCallbacks(instance);
  6348. });
  6349. flushPreFlushCbs();
  6350. } else {
  6351. flushCallbacks(instance);
  6352. }
  6353. }
  6354. }
  6355. function initAppConfig(appConfig) {
  6356. appConfig.globalProperties.$nextTick = function $nextTick(fn) {
  6357. return nextTick(this.$, fn);
  6358. };
  6359. }
  6360. function onApplyOptions(options, instance, publicThis) {
  6361. instance.appContext.config.globalProperties.$applyOptions(
  6362. options,
  6363. instance,
  6364. publicThis
  6365. );
  6366. const computedOptions = options.computed;
  6367. if (computedOptions) {
  6368. const keys = Object.keys(computedOptions);
  6369. if (keys.length) {
  6370. const ctx = instance.ctx;
  6371. if (!ctx.$computedKeys) {
  6372. ctx.$computedKeys = [];
  6373. }
  6374. ctx.$computedKeys.push(...keys);
  6375. }
  6376. }
  6377. delete instance.ctx.$onApplyOptions;
  6378. }
  6379. function setRef$1(instance, isUnmount = false) {
  6380. const {
  6381. setupState,
  6382. $templateRefs,
  6383. ctx: { $scope, $mpPlatform }
  6384. } = instance;
  6385. if ($mpPlatform === "mp-alipay") {
  6386. return;
  6387. }
  6388. if (!$templateRefs || !$scope) {
  6389. return;
  6390. }
  6391. if (isUnmount) {
  6392. return $templateRefs.forEach(
  6393. (templateRef) => setTemplateRef(templateRef, null, setupState)
  6394. );
  6395. }
  6396. const check = $mpPlatform === "mp-baidu" || $mpPlatform === "mp-toutiao";
  6397. const doSetByRefs = (refs) => {
  6398. const mpComponents = (
  6399. // 字节小程序 selectAllComponents 可能返回 null
  6400. // https://github.com/dcloudio/uni-app/issues/3954
  6401. ($scope.selectAllComponents(".r") || []).concat(
  6402. $scope.selectAllComponents(".r-i-f") || []
  6403. )
  6404. );
  6405. return refs.filter((templateRef) => {
  6406. const refValue = findComponentPublicInstance(mpComponents, templateRef.i);
  6407. if (check && refValue === null) {
  6408. return true;
  6409. }
  6410. setTemplateRef(templateRef, refValue, setupState);
  6411. return false;
  6412. });
  6413. };
  6414. const doSet = () => {
  6415. const refs = doSetByRefs($templateRefs);
  6416. if (refs.length && instance.proxy && instance.proxy.$scope) {
  6417. instance.proxy.$scope.setData({ r1: 1 }, () => {
  6418. doSetByRefs(refs);
  6419. });
  6420. }
  6421. };
  6422. if ($scope._$setRef) {
  6423. $scope._$setRef(doSet);
  6424. } else {
  6425. nextTick(instance, doSet);
  6426. }
  6427. }
  6428. function toSkip(value) {
  6429. if (isObject$1(value)) {
  6430. markRaw(value);
  6431. }
  6432. return value;
  6433. }
  6434. function findComponentPublicInstance(mpComponents, id) {
  6435. const mpInstance = mpComponents.find(
  6436. (com) => com && (com.properties || com.props).uI === id
  6437. );
  6438. if (mpInstance) {
  6439. const vm = mpInstance.$vm;
  6440. if (vm) {
  6441. return getExposeProxy(vm.$) || vm;
  6442. }
  6443. return toSkip(mpInstance);
  6444. }
  6445. return null;
  6446. }
  6447. function setTemplateRef({ r: r2, f: f2 }, refValue, setupState) {
  6448. if (isFunction(r2)) {
  6449. r2(refValue, {});
  6450. } else {
  6451. const _isString = isString(r2);
  6452. const _isRef = isRef(r2);
  6453. if (_isString || _isRef) {
  6454. if (f2) {
  6455. if (!_isRef) {
  6456. return;
  6457. }
  6458. if (!isArray(r2.value)) {
  6459. r2.value = [];
  6460. }
  6461. const existing = r2.value;
  6462. if (existing.indexOf(refValue) === -1) {
  6463. existing.push(refValue);
  6464. if (!refValue) {
  6465. return;
  6466. }
  6467. onBeforeUnmount(() => remove(existing, refValue), refValue.$);
  6468. }
  6469. } else if (_isString) {
  6470. if (hasOwn$1(setupState, r2)) {
  6471. setupState[r2] = refValue;
  6472. }
  6473. } else if (isRef(r2)) {
  6474. r2.value = refValue;
  6475. } else {
  6476. warnRef(r2);
  6477. }
  6478. } else {
  6479. warnRef(r2);
  6480. }
  6481. }
  6482. }
  6483. function warnRef(ref2) {
  6484. warn("Invalid template ref type:", ref2, `(${typeof ref2})`);
  6485. }
  6486. const queuePostRenderEffect = queuePostFlushCb;
  6487. function mountComponent(initialVNode, options) {
  6488. const instance = initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null);
  6489. {
  6490. instance.ctx.$onApplyOptions = onApplyOptions;
  6491. instance.ctx.$children = [];
  6492. }
  6493. if (options.mpType === "app") {
  6494. instance.render = NOOP;
  6495. }
  6496. if (options.onBeforeSetup) {
  6497. options.onBeforeSetup(instance, options);
  6498. }
  6499. {
  6500. pushWarningContext(initialVNode);
  6501. startMeasure(instance, `mount`);
  6502. }
  6503. {
  6504. startMeasure(instance, `init`);
  6505. }
  6506. setupComponent(instance);
  6507. {
  6508. endMeasure(instance, `init`);
  6509. }
  6510. {
  6511. if (options.parentComponent && instance.proxy) {
  6512. options.parentComponent.ctx.$children.push(getExposeProxy(instance) || instance.proxy);
  6513. }
  6514. }
  6515. setupRenderEffect(instance);
  6516. {
  6517. popWarningContext();
  6518. endMeasure(instance, `mount`);
  6519. }
  6520. return instance.proxy;
  6521. }
  6522. const getFunctionalFallthrough = (attrs) => {
  6523. let res;
  6524. for (const key in attrs) {
  6525. if (key === "class" || key === "style" || isOn(key)) {
  6526. (res || (res = {}))[key] = attrs[key];
  6527. }
  6528. }
  6529. return res;
  6530. };
  6531. function renderComponentRoot(instance) {
  6532. const {
  6533. type: Component2,
  6534. vnode,
  6535. proxy,
  6536. withProxy,
  6537. props,
  6538. propsOptions: [propsOptions],
  6539. slots,
  6540. attrs,
  6541. emit: emit2,
  6542. render,
  6543. renderCache,
  6544. data,
  6545. setupState,
  6546. ctx,
  6547. uid: uid2,
  6548. appContext: {
  6549. app: {
  6550. config: {
  6551. globalProperties: { pruneComponentPropsCache: pruneComponentPropsCache2 }
  6552. }
  6553. }
  6554. },
  6555. inheritAttrs
  6556. } = instance;
  6557. instance.$templateRefs = [];
  6558. instance.$ei = 0;
  6559. pruneComponentPropsCache2(uid2);
  6560. instance.__counter = instance.__counter === 0 ? 1 : 0;
  6561. let result;
  6562. const prev = setCurrentRenderingInstance(instance);
  6563. try {
  6564. if (vnode.shapeFlag & 4) {
  6565. fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
  6566. const proxyToUse = withProxy || proxy;
  6567. result = render.call(
  6568. proxyToUse,
  6569. proxyToUse,
  6570. renderCache,
  6571. props,
  6572. setupState,
  6573. data,
  6574. ctx
  6575. );
  6576. } else {
  6577. fallthroughAttrs(
  6578. inheritAttrs,
  6579. props,
  6580. propsOptions,
  6581. Component2.props ? attrs : getFunctionalFallthrough(attrs)
  6582. );
  6583. const render2 = Component2;
  6584. result = render2.length > 1 ? render2(props, { attrs, slots, emit: emit2 }) : render2(
  6585. props,
  6586. null
  6587. /* we know it doesn't need it */
  6588. );
  6589. }
  6590. } catch (err) {
  6591. handleError(err, instance, 1);
  6592. result = false;
  6593. }
  6594. setRef$1(instance);
  6595. setCurrentRenderingInstance(prev);
  6596. return result;
  6597. }
  6598. function fallthroughAttrs(inheritAttrs, props, propsOptions, fallthroughAttrs2) {
  6599. if (props && fallthroughAttrs2 && inheritAttrs !== false) {
  6600. const keys = Object.keys(fallthroughAttrs2).filter(
  6601. (key) => key !== "class" && key !== "style"
  6602. );
  6603. if (!keys.length) {
  6604. return;
  6605. }
  6606. if (propsOptions && keys.some(isModelListener)) {
  6607. keys.forEach((key) => {
  6608. if (!isModelListener(key) || !(key.slice(9) in propsOptions)) {
  6609. props[key] = fallthroughAttrs2[key];
  6610. }
  6611. });
  6612. } else {
  6613. keys.forEach((key) => props[key] = fallthroughAttrs2[key]);
  6614. }
  6615. }
  6616. }
  6617. const updateComponentPreRender = (instance) => {
  6618. pauseTracking();
  6619. flushPreFlushCbs();
  6620. resetTracking();
  6621. };
  6622. function componentUpdateScopedSlotsFn() {
  6623. const scopedSlotsData = this.$scopedSlotsData;
  6624. if (!scopedSlotsData || scopedSlotsData.length === 0) {
  6625. return;
  6626. }
  6627. const mpInstance = this.ctx.$scope;
  6628. const oldData = mpInstance.data;
  6629. const diffData = /* @__PURE__ */ Object.create(null);
  6630. scopedSlotsData.forEach(({ path, index: index2, data }) => {
  6631. const oldScopedSlotData = getValueByDataPath(oldData, path);
  6632. const diffPath = isString(index2) ? `${path}.${index2}` : `${path}[${index2}]`;
  6633. if (typeof oldScopedSlotData === "undefined" || typeof oldScopedSlotData[index2] === "undefined") {
  6634. diffData[diffPath] = data;
  6635. } else {
  6636. const diffScopedSlotData = diff(
  6637. data,
  6638. oldScopedSlotData[index2]
  6639. );
  6640. Object.keys(diffScopedSlotData).forEach((name) => {
  6641. diffData[diffPath + "." + name] = diffScopedSlotData[name];
  6642. });
  6643. }
  6644. });
  6645. scopedSlotsData.length = 0;
  6646. if (Object.keys(diffData).length) {
  6647. mpInstance.setData(diffData);
  6648. }
  6649. }
  6650. function toggleRecurse({ effect: effect2, update }, allowed) {
  6651. effect2.allowRecurse = update.allowRecurse = allowed;
  6652. }
  6653. function setupRenderEffect(instance) {
  6654. const updateScopedSlots = componentUpdateScopedSlotsFn.bind(
  6655. instance
  6656. );
  6657. instance.$updateScopedSlots = () => nextTick$1(() => queueJob(updateScopedSlots));
  6658. const componentUpdateFn = () => {
  6659. if (!instance.isMounted) {
  6660. onBeforeUnmount(() => {
  6661. setRef$1(instance, true);
  6662. }, instance);
  6663. {
  6664. startMeasure(instance, `patch`);
  6665. }
  6666. patch(instance, renderComponentRoot(instance));
  6667. {
  6668. endMeasure(instance, `patch`);
  6669. }
  6670. {
  6671. devtoolsComponentAdded(instance);
  6672. }
  6673. } else {
  6674. const { next, bu, u } = instance;
  6675. {
  6676. pushWarningContext(next || instance.vnode);
  6677. }
  6678. toggleRecurse(instance, false);
  6679. updateComponentPreRender();
  6680. if (bu) {
  6681. invokeArrayFns$1(bu);
  6682. }
  6683. toggleRecurse(instance, true);
  6684. {
  6685. startMeasure(instance, `patch`);
  6686. }
  6687. patch(instance, renderComponentRoot(instance));
  6688. {
  6689. endMeasure(instance, `patch`);
  6690. }
  6691. if (u) {
  6692. queuePostRenderEffect(u);
  6693. }
  6694. {
  6695. devtoolsComponentUpdated(instance);
  6696. }
  6697. {
  6698. popWarningContext();
  6699. }
  6700. }
  6701. };
  6702. const effect2 = instance.effect = new ReactiveEffect2(
  6703. componentUpdateFn,
  6704. NOOP,
  6705. () => queueJob(update),
  6706. instance.scope
  6707. // track it in component's effect scope
  6708. );
  6709. const update = instance.update = () => {
  6710. if (effect2.dirty) {
  6711. effect2.run();
  6712. }
  6713. };
  6714. update.id = instance.uid;
  6715. toggleRecurse(instance, true);
  6716. {
  6717. effect2.onTrack = instance.rtc ? (e2) => invokeArrayFns$1(instance.rtc, e2) : void 0;
  6718. effect2.onTrigger = instance.rtg ? (e2) => invokeArrayFns$1(instance.rtg, e2) : void 0;
  6719. update.ownerInstance = instance;
  6720. }
  6721. update();
  6722. }
  6723. function unmountComponent(instance) {
  6724. const { bum, scope, update, um } = instance;
  6725. if (bum) {
  6726. invokeArrayFns$1(bum);
  6727. }
  6728. scope.stop();
  6729. if (update) {
  6730. update.active = false;
  6731. }
  6732. if (um) {
  6733. queuePostRenderEffect(um);
  6734. }
  6735. queuePostRenderEffect(() => {
  6736. instance.isUnmounted = true;
  6737. });
  6738. {
  6739. devtoolsComponentRemoved(instance);
  6740. }
  6741. }
  6742. const oldCreateApp = createAppAPI();
  6743. function getTarget() {
  6744. if (typeof window !== "undefined") {
  6745. return window;
  6746. }
  6747. if (typeof globalThis !== "undefined") {
  6748. return globalThis;
  6749. }
  6750. if (typeof global !== "undefined") {
  6751. return global;
  6752. }
  6753. if (typeof my !== "undefined") {
  6754. return my;
  6755. }
  6756. }
  6757. function createVueApp(rootComponent, rootProps = null) {
  6758. const target = getTarget();
  6759. target.__VUE__ = true;
  6760. {
  6761. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6762. }
  6763. const app = oldCreateApp(rootComponent, rootProps);
  6764. const appContext = app._context;
  6765. initAppConfig(appContext.config);
  6766. const createVNode2 = (initialVNode) => {
  6767. initialVNode.appContext = appContext;
  6768. initialVNode.shapeFlag = 6;
  6769. return initialVNode;
  6770. };
  6771. const createComponent2 = function createComponent22(initialVNode, options) {
  6772. return mountComponent(createVNode2(initialVNode), options);
  6773. };
  6774. const destroyComponent = function destroyComponent2(component) {
  6775. return component && unmountComponent(component.$);
  6776. };
  6777. app.mount = function mount() {
  6778. rootComponent.render = NOOP;
  6779. const instance = mountComponent(
  6780. createVNode2({ type: rootComponent }),
  6781. {
  6782. mpType: "app",
  6783. mpInstance: null,
  6784. parentComponent: null,
  6785. slots: [],
  6786. props: null
  6787. }
  6788. );
  6789. app._instance = instance.$;
  6790. {
  6791. devtoolsInitApp(app, version);
  6792. }
  6793. instance.$app = app;
  6794. instance.$createComponent = createComponent2;
  6795. instance.$destroyComponent = destroyComponent;
  6796. appContext.$appInstance = instance;
  6797. return instance;
  6798. };
  6799. app.unmount = function unmount() {
  6800. warn(`Cannot unmount an app.`);
  6801. };
  6802. return app;
  6803. }
  6804. function injectLifecycleHook(name, hook, publicThis, instance) {
  6805. if (isFunction(hook)) {
  6806. injectHook(name, hook.bind(publicThis), instance);
  6807. }
  6808. }
  6809. function initHooks$1(options, instance, publicThis) {
  6810. const mpType = options.mpType || publicThis.$mpType;
  6811. if (!mpType || mpType === "component") {
  6812. return;
  6813. }
  6814. Object.keys(options).forEach((name) => {
  6815. if (isUniLifecycleHook(name, options[name], false)) {
  6816. const hooks = options[name];
  6817. if (isArray(hooks)) {
  6818. hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
  6819. } else {
  6820. injectLifecycleHook(name, hooks, publicThis, instance);
  6821. }
  6822. }
  6823. });
  6824. }
  6825. function applyOptions$2(options, instance, publicThis) {
  6826. initHooks$1(options, instance, publicThis);
  6827. }
  6828. function set$2(target, key, val) {
  6829. return target[key] = val;
  6830. }
  6831. function $callMethod(method, ...args) {
  6832. const fn = this[method];
  6833. if (fn) {
  6834. return fn(...args);
  6835. }
  6836. console.error(`method ${method} not found`);
  6837. return null;
  6838. }
  6839. function createErrorHandler(app) {
  6840. return function errorHandler(err, instance, _info) {
  6841. if (!instance) {
  6842. throw err;
  6843. }
  6844. const appInstance = app._instance;
  6845. if (!appInstance || !appInstance.proxy) {
  6846. throw err;
  6847. }
  6848. {
  6849. appInstance.proxy.$callHook(ON_ERROR, err);
  6850. }
  6851. };
  6852. }
  6853. function mergeAsArray(to, from) {
  6854. return to ? [...new Set([].concat(to, from))] : from;
  6855. }
  6856. function initOptionMergeStrategies(optionMergeStrategies) {
  6857. UniLifecycleHooks.forEach((name) => {
  6858. optionMergeStrategies[name] = mergeAsArray;
  6859. });
  6860. }
  6861. let realAtob;
  6862. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  6863. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  6864. if (typeof atob !== "function") {
  6865. realAtob = function(str) {
  6866. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  6867. if (!b64re.test(str)) {
  6868. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  6869. }
  6870. str += "==".slice(2 - (str.length & 3));
  6871. var bitmap;
  6872. var result = "";
  6873. var r1;
  6874. var r2;
  6875. var i = 0;
  6876. for (; i < str.length; ) {
  6877. 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++)));
  6878. 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);
  6879. }
  6880. return result;
  6881. };
  6882. } else {
  6883. realAtob = atob;
  6884. }
  6885. function b64DecodeUnicode(str) {
  6886. return decodeURIComponent(realAtob(str).split("").map(function(c2) {
  6887. return "%" + ("00" + c2.charCodeAt(0).toString(16)).slice(-2);
  6888. }).join(""));
  6889. }
  6890. function getCurrentUserInfo() {
  6891. const token = index.getStorageSync("uni_id_token") || "";
  6892. const tokenArr = token.split(".");
  6893. if (!token || tokenArr.length !== 3) {
  6894. return {
  6895. uid: null,
  6896. role: [],
  6897. permission: [],
  6898. tokenExpired: 0
  6899. };
  6900. }
  6901. let userInfo;
  6902. try {
  6903. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  6904. } catch (error) {
  6905. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  6906. }
  6907. userInfo.tokenExpired = userInfo.exp * 1e3;
  6908. delete userInfo.exp;
  6909. delete userInfo.iat;
  6910. return userInfo;
  6911. }
  6912. function uniIdMixin(globalProperties) {
  6913. globalProperties.uniIDHasRole = function(roleId) {
  6914. const { role } = getCurrentUserInfo();
  6915. return role.indexOf(roleId) > -1;
  6916. };
  6917. globalProperties.uniIDHasPermission = function(permissionId) {
  6918. const { permission } = getCurrentUserInfo();
  6919. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  6920. };
  6921. globalProperties.uniIDTokenValid = function() {
  6922. const { tokenExpired } = getCurrentUserInfo();
  6923. return tokenExpired > Date.now();
  6924. };
  6925. }
  6926. function initApp(app) {
  6927. const appConfig = app._context.config;
  6928. appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
  6929. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  6930. const globalProperties = appConfig.globalProperties;
  6931. {
  6932. uniIdMixin(globalProperties);
  6933. }
  6934. {
  6935. globalProperties.$set = set$2;
  6936. globalProperties.$applyOptions = applyOptions$2;
  6937. globalProperties.$callMethod = $callMethod;
  6938. }
  6939. {
  6940. index.invokeCreateVueAppHook(app);
  6941. }
  6942. }
  6943. const propsCaches = /* @__PURE__ */ Object.create(null);
  6944. function renderProps(props) {
  6945. const { uid: uid2, __counter } = getCurrentInstance();
  6946. const propsId = (propsCaches[uid2] || (propsCaches[uid2] = [])).push(guardReactiveProps(props)) - 1;
  6947. return uid2 + "," + propsId + "," + __counter;
  6948. }
  6949. function pruneComponentPropsCache(uid2) {
  6950. delete propsCaches[uid2];
  6951. }
  6952. function findComponentPropsData(up) {
  6953. if (!up) {
  6954. return;
  6955. }
  6956. const [uid2, propsId] = up.split(",");
  6957. if (!propsCaches[uid2]) {
  6958. return;
  6959. }
  6960. return propsCaches[uid2][parseInt(propsId)];
  6961. }
  6962. var plugin = {
  6963. install(app) {
  6964. initApp(app);
  6965. app.config.globalProperties.pruneComponentPropsCache = pruneComponentPropsCache;
  6966. const oldMount = app.mount;
  6967. app.mount = function mount(rootContainer) {
  6968. const instance = oldMount.call(app, rootContainer);
  6969. const createApp2 = getCreateApp();
  6970. if (createApp2) {
  6971. createApp2(instance);
  6972. } else {
  6973. if (typeof createMiniProgramApp !== "undefined") {
  6974. createMiniProgramApp(instance);
  6975. }
  6976. }
  6977. return instance;
  6978. };
  6979. }
  6980. };
  6981. function getCreateApp() {
  6982. const method = "createApp";
  6983. if (typeof global !== "undefined" && typeof global[method] !== "undefined") {
  6984. return global[method];
  6985. } else if (typeof my !== "undefined") {
  6986. return my[method];
  6987. }
  6988. }
  6989. function vOn(value, key) {
  6990. const instance = getCurrentInstance();
  6991. const ctx = instance.ctx;
  6992. const extraKey = typeof key !== "undefined" && (ctx.$mpPlatform === "mp-weixin" || ctx.$mpPlatform === "mp-qq" || ctx.$mpPlatform === "mp-xhs") && (isString(key) || typeof key === "number") ? "_" + key : "";
  6993. const name = "e" + instance.$ei++ + extraKey;
  6994. const mpInstance = ctx.$scope;
  6995. if (!value) {
  6996. delete mpInstance[name];
  6997. return name;
  6998. }
  6999. const existingInvoker = mpInstance[name];
  7000. if (existingInvoker) {
  7001. existingInvoker.value = value;
  7002. } else {
  7003. mpInstance[name] = createInvoker(value, instance);
  7004. }
  7005. return name;
  7006. }
  7007. function createInvoker(initialValue, instance) {
  7008. const invoker = (e2) => {
  7009. patchMPEvent(e2);
  7010. let args = [e2];
  7011. if (e2.detail && e2.detail.__args__) {
  7012. args = e2.detail.__args__;
  7013. }
  7014. const eventValue = invoker.value;
  7015. const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, eventValue), instance, 5, args);
  7016. const eventTarget = e2.target;
  7017. const eventSync = eventTarget ? eventTarget.dataset ? String(eventTarget.dataset.eventsync) === "true" : false : false;
  7018. if (bubbles.includes(e2.type) && !eventSync) {
  7019. setTimeout(invoke);
  7020. } else {
  7021. const res = invoke();
  7022. if (e2.type === "input" && (isArray(res) || isPromise(res))) {
  7023. return;
  7024. }
  7025. return res;
  7026. }
  7027. };
  7028. invoker.value = initialValue;
  7029. return invoker;
  7030. }
  7031. const bubbles = [
  7032. // touch事件暂不做延迟,否则在 Android 上会影响性能,比如一些拖拽跟手手势等
  7033. // 'touchstart',
  7034. // 'touchmove',
  7035. // 'touchcancel',
  7036. // 'touchend',
  7037. "tap",
  7038. "longpress",
  7039. "longtap",
  7040. "transitionend",
  7041. "animationstart",
  7042. "animationiteration",
  7043. "animationend",
  7044. "touchforcechange"
  7045. ];
  7046. function patchMPEvent(event) {
  7047. if (event.type && event.target) {
  7048. event.preventDefault = NOOP;
  7049. event.stopPropagation = NOOP;
  7050. event.stopImmediatePropagation = NOOP;
  7051. if (!hasOwn$1(event, "detail")) {
  7052. event.detail = {};
  7053. }
  7054. if (hasOwn$1(event, "markerId")) {
  7055. event.detail = typeof event.detail === "object" ? event.detail : {};
  7056. event.detail.markerId = event.markerId;
  7057. }
  7058. if (isPlainObject$1(event.detail) && hasOwn$1(event.detail, "checked") && !hasOwn$1(event.detail, "value")) {
  7059. event.detail.value = event.detail.checked;
  7060. }
  7061. if (isPlainObject$1(event.detail)) {
  7062. event.target = extend({}, event.target, event.detail);
  7063. }
  7064. }
  7065. }
  7066. function patchStopImmediatePropagation(e2, value) {
  7067. if (isArray(value)) {
  7068. const originalStop = e2.stopImmediatePropagation;
  7069. e2.stopImmediatePropagation = () => {
  7070. originalStop && originalStop.call(e2);
  7071. e2._stopped = true;
  7072. };
  7073. return value.map((fn) => (e3) => !e3._stopped && fn(e3));
  7074. } else {
  7075. return value;
  7076. }
  7077. }
  7078. function vFor(source, renderItem) {
  7079. let ret;
  7080. if (isArray(source) || isString(source)) {
  7081. ret = new Array(source.length);
  7082. for (let i = 0, l = source.length; i < l; i++) {
  7083. ret[i] = renderItem(source[i], i, i);
  7084. }
  7085. } else if (typeof source === "number") {
  7086. if (!Number.isInteger(source)) {
  7087. warn(`The v-for range expect an integer value but got ${source}.`);
  7088. return [];
  7089. }
  7090. ret = new Array(source);
  7091. for (let i = 0; i < source; i++) {
  7092. ret[i] = renderItem(i + 1, i, i);
  7093. }
  7094. } else if (isObject$1(source)) {
  7095. if (source[Symbol.iterator]) {
  7096. ret = Array.from(source, (item, i) => renderItem(item, i, i));
  7097. } else {
  7098. const keys = Object.keys(source);
  7099. ret = new Array(keys.length);
  7100. for (let i = 0, l = keys.length; i < l; i++) {
  7101. const key = keys[i];
  7102. ret[i] = renderItem(source[key], key, i);
  7103. }
  7104. }
  7105. } else {
  7106. ret = [];
  7107. }
  7108. return ret;
  7109. }
  7110. function renderSlot(name, props = {}, key) {
  7111. const instance = getCurrentInstance();
  7112. const { parent, isMounted, ctx: { $scope } } = instance;
  7113. const vueIds = ($scope.properties || $scope.props).uI;
  7114. if (!vueIds) {
  7115. return;
  7116. }
  7117. if (!parent && !isMounted) {
  7118. onMounted(() => {
  7119. renderSlot(name, props, key);
  7120. }, instance);
  7121. return;
  7122. }
  7123. const invoker = findScopedSlotInvoker(vueIds, instance);
  7124. if (invoker) {
  7125. invoker(name, props, key);
  7126. }
  7127. }
  7128. function findScopedSlotInvoker(vueId, instance) {
  7129. let parent = instance.parent;
  7130. while (parent) {
  7131. const invokers = parent.$ssi;
  7132. if (invokers && invokers[vueId]) {
  7133. return invokers[vueId];
  7134. }
  7135. parent = parent.parent;
  7136. }
  7137. }
  7138. function withScopedSlot(fn, { name, path, vueId }) {
  7139. const instance = getCurrentInstance();
  7140. fn.path = path;
  7141. const scopedSlots = instance.$ssi || (instance.$ssi = {});
  7142. const invoker = scopedSlots[vueId] || (scopedSlots[vueId] = createScopedSlotInvoker(instance));
  7143. if (!invoker.slots[name]) {
  7144. invoker.slots[name] = {
  7145. fn
  7146. };
  7147. } else {
  7148. invoker.slots[name].fn = fn;
  7149. }
  7150. return getValueByDataPath(instance.ctx.$scope.data, path);
  7151. }
  7152. function createScopedSlotInvoker(instance) {
  7153. const invoker = (slotName, args, index2) => {
  7154. const slot = invoker.slots[slotName];
  7155. if (!slot) {
  7156. return;
  7157. }
  7158. const hasIndex = typeof index2 !== "undefined";
  7159. index2 = index2 || 0;
  7160. const prevInstance = setCurrentRenderingInstance(instance);
  7161. const data = slot.fn(args, slotName + (hasIndex ? "-" + index2 : ""), index2);
  7162. const path = slot.fn.path;
  7163. setCurrentRenderingInstance(prevInstance);
  7164. (instance.$scopedSlotsData || (instance.$scopedSlotsData = [])).push({
  7165. path,
  7166. index: index2,
  7167. data
  7168. });
  7169. instance.$updateScopedSlots();
  7170. };
  7171. invoker.slots = {};
  7172. return invoker;
  7173. }
  7174. function stringifyStyle(value) {
  7175. if (isString(value)) {
  7176. return value;
  7177. }
  7178. return stringify(normalizeStyle(value));
  7179. }
  7180. function stringify(styles) {
  7181. let ret = "";
  7182. if (!styles || isString(styles)) {
  7183. return ret;
  7184. }
  7185. for (const key in styles) {
  7186. ret += `${key.startsWith(`--`) ? key : hyphenate(key)}:${styles[key]};`;
  7187. }
  7188. return ret;
  7189. }
  7190. function setRef(ref2, id, opts = {}) {
  7191. const { $templateRefs } = getCurrentInstance();
  7192. $templateRefs.push({ i: id, r: ref2, k: opts.k, f: opts.f });
  7193. }
  7194. const o = (value, key) => vOn(value, key);
  7195. const f = (source, renderItem) => vFor(source, renderItem);
  7196. const r = (name, props, key) => renderSlot(name, props, key);
  7197. const w = (fn, options) => withScopedSlot(fn, options);
  7198. const s = (value) => stringifyStyle(value);
  7199. const e = (target, ...sources) => extend(target, ...sources);
  7200. const n = (value) => normalizeClass(value);
  7201. const t = (val) => toDisplayString(val);
  7202. const p = (props) => renderProps(props);
  7203. const sr = (ref2, id, opts) => setRef(ref2, id, opts);
  7204. function createApp$1(rootComponent, rootProps = null) {
  7205. rootComponent && (rootComponent.mpType = "app");
  7206. return createVueApp(rootComponent, rootProps).use(plugin);
  7207. }
  7208. const createSSRApp = createApp$1;
  7209. const MP_METHODS = [
  7210. "createSelectorQuery",
  7211. "createIntersectionObserver",
  7212. "selectAllComponents",
  7213. "selectComponent"
  7214. ];
  7215. function createEmitFn(oldEmit, ctx) {
  7216. return function emit2(event, ...args) {
  7217. const scope = ctx.$scope;
  7218. if (scope && event) {
  7219. const detail = { __args__: args };
  7220. {
  7221. scope.triggerEvent(event, detail);
  7222. }
  7223. }
  7224. return oldEmit.apply(this, [event, ...args]);
  7225. };
  7226. }
  7227. function initBaseInstance(instance, options) {
  7228. const ctx = instance.ctx;
  7229. ctx.mpType = options.mpType;
  7230. ctx.$mpType = options.mpType;
  7231. ctx.$mpPlatform = "mp-weixin";
  7232. ctx.$scope = options.mpInstance;
  7233. ctx.$mp = {};
  7234. {
  7235. ctx._self = {};
  7236. }
  7237. instance.slots = {};
  7238. if (isArray(options.slots) && options.slots.length) {
  7239. options.slots.forEach((name) => {
  7240. instance.slots[name] = true;
  7241. });
  7242. if (instance.slots[SLOT_DEFAULT_NAME]) {
  7243. instance.slots.default = true;
  7244. }
  7245. }
  7246. ctx.getOpenerEventChannel = function() {
  7247. {
  7248. return options.mpInstance.getOpenerEventChannel();
  7249. }
  7250. };
  7251. ctx.$hasHook = hasHook;
  7252. ctx.$callHook = callHook;
  7253. instance.emit = createEmitFn(instance.emit, ctx);
  7254. }
  7255. function initComponentInstance(instance, options) {
  7256. initBaseInstance(instance, options);
  7257. const ctx = instance.ctx;
  7258. MP_METHODS.forEach((method) => {
  7259. ctx[method] = function(...args) {
  7260. const mpInstance = ctx.$scope;
  7261. if (mpInstance && mpInstance[method]) {
  7262. return mpInstance[method].apply(mpInstance, args);
  7263. }
  7264. };
  7265. });
  7266. }
  7267. function initMocks(instance, mpInstance, mocks2) {
  7268. const ctx = instance.ctx;
  7269. mocks2.forEach((mock) => {
  7270. if (hasOwn$1(mpInstance, mock)) {
  7271. instance[mock] = ctx[mock] = mpInstance[mock];
  7272. }
  7273. });
  7274. }
  7275. function hasHook(name) {
  7276. const hooks = this.$[name];
  7277. if (hooks && hooks.length) {
  7278. return true;
  7279. }
  7280. return false;
  7281. }
  7282. function callHook(name, args) {
  7283. if (name === "mounted") {
  7284. callHook.call(this, "bm");
  7285. this.$.isMounted = true;
  7286. name = "m";
  7287. }
  7288. const hooks = this.$[name];
  7289. return hooks && invokeArrayFns(hooks, args);
  7290. }
  7291. const PAGE_INIT_HOOKS = [
  7292. ON_LOAD,
  7293. ON_SHOW,
  7294. ON_HIDE,
  7295. ON_UNLOAD,
  7296. ON_RESIZE,
  7297. ON_TAB_ITEM_TAP,
  7298. ON_REACH_BOTTOM,
  7299. ON_PULL_DOWN_REFRESH,
  7300. ON_ADD_TO_FAVORITES
  7301. // 'onReady', // lifetimes.ready
  7302. // 'onPageScroll', // 影响性能,开发者手动注册
  7303. // 'onShareTimeline', // 右上角菜单,开发者手动注册
  7304. // 'onShareAppMessage' // 右上角菜单,开发者手动注册
  7305. ];
  7306. function findHooks(vueOptions, hooks = /* @__PURE__ */ new Set()) {
  7307. if (vueOptions) {
  7308. Object.keys(vueOptions).forEach((name) => {
  7309. if (isUniLifecycleHook(name, vueOptions[name])) {
  7310. hooks.add(name);
  7311. }
  7312. });
  7313. {
  7314. const { extends: extendsOptions, mixins } = vueOptions;
  7315. if (mixins) {
  7316. mixins.forEach((mixin) => findHooks(mixin, hooks));
  7317. }
  7318. if (extendsOptions) {
  7319. findHooks(extendsOptions, hooks);
  7320. }
  7321. }
  7322. }
  7323. return hooks;
  7324. }
  7325. function initHook(mpOptions, hook, excludes) {
  7326. if (excludes.indexOf(hook) === -1 && !hasOwn$1(mpOptions, hook)) {
  7327. mpOptions[hook] = function(args) {
  7328. return this.$vm && this.$vm.$callHook(hook, args);
  7329. };
  7330. }
  7331. }
  7332. const EXCLUDE_HOOKS = [ON_READY];
  7333. function initHooks(mpOptions, hooks, excludes = EXCLUDE_HOOKS) {
  7334. hooks.forEach((hook) => initHook(mpOptions, hook, excludes));
  7335. }
  7336. function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
  7337. findHooks(vueOptions).forEach((hook) => initHook(mpOptions, hook, excludes));
  7338. }
  7339. function initRuntimeHooks(mpOptions, runtimeHooks) {
  7340. if (!runtimeHooks) {
  7341. return;
  7342. }
  7343. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7344. hooks.forEach((hook) => {
  7345. if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
  7346. initHook(mpOptions, hook, []);
  7347. }
  7348. });
  7349. }
  7350. const findMixinRuntimeHooks = /* @__PURE__ */ once(() => {
  7351. const runtimeHooks = [];
  7352. const app = isFunction(getApp) && getApp({ allowDefault: true });
  7353. if (app && app.$vm && app.$vm.$) {
  7354. const mixins = app.$vm.$.appContext.mixins;
  7355. if (isArray(mixins)) {
  7356. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7357. mixins.forEach((mixin) => {
  7358. hooks.forEach((hook) => {
  7359. if (hasOwn$1(mixin, hook) && !runtimeHooks.includes(hook)) {
  7360. runtimeHooks.push(hook);
  7361. }
  7362. });
  7363. });
  7364. }
  7365. }
  7366. return runtimeHooks;
  7367. });
  7368. function initMixinRuntimeHooks(mpOptions) {
  7369. initHooks(mpOptions, findMixinRuntimeHooks());
  7370. }
  7371. const HOOKS = [
  7372. ON_SHOW,
  7373. ON_HIDE,
  7374. ON_ERROR,
  7375. ON_THEME_CHANGE,
  7376. ON_PAGE_NOT_FOUND,
  7377. ON_UNHANDLE_REJECTION
  7378. ];
  7379. function parseApp(instance, parseAppOptions) {
  7380. const internalInstance = instance.$;
  7381. const appOptions = {
  7382. globalData: instance.$options && instance.$options.globalData || {},
  7383. $vm: instance,
  7384. // mp-alipay 组件 data 初始化比 onLaunch 早,提前挂载
  7385. onLaunch(options) {
  7386. this.$vm = instance;
  7387. const ctx = internalInstance.ctx;
  7388. if (this.$vm && ctx.$scope) {
  7389. return;
  7390. }
  7391. initBaseInstance(internalInstance, {
  7392. mpType: "app",
  7393. mpInstance: this,
  7394. slots: []
  7395. });
  7396. ctx.globalData = this.globalData;
  7397. instance.$callHook(ON_LAUNCH, options);
  7398. }
  7399. };
  7400. const { onError } = internalInstance;
  7401. if (onError) {
  7402. internalInstance.appContext.config.errorHandler = (err) => {
  7403. instance.$callHook(ON_ERROR, err);
  7404. };
  7405. }
  7406. initLocale(instance);
  7407. const vueOptions = instance.$.type;
  7408. initHooks(appOptions, HOOKS);
  7409. initUnknownHooks(appOptions, vueOptions);
  7410. {
  7411. const methods = vueOptions.methods;
  7412. methods && extend(appOptions, methods);
  7413. }
  7414. if (parseAppOptions) {
  7415. parseAppOptions.parse(appOptions);
  7416. }
  7417. return appOptions;
  7418. }
  7419. function initCreateApp(parseAppOptions) {
  7420. return function createApp2(vm) {
  7421. return App(parseApp(vm, parseAppOptions));
  7422. };
  7423. }
  7424. function initCreateSubpackageApp(parseAppOptions) {
  7425. return function createApp2(vm) {
  7426. const appOptions = parseApp(vm, parseAppOptions);
  7427. const app = isFunction(getApp) && getApp({
  7428. allowDefault: true
  7429. });
  7430. if (!app)
  7431. return;
  7432. vm.$.ctx.$scope = app;
  7433. const globalData = app.globalData;
  7434. if (globalData) {
  7435. Object.keys(appOptions.globalData).forEach((name) => {
  7436. if (!hasOwn$1(globalData, name)) {
  7437. globalData[name] = appOptions.globalData[name];
  7438. }
  7439. });
  7440. }
  7441. Object.keys(appOptions).forEach((name) => {
  7442. if (!hasOwn$1(app, name)) {
  7443. app[name] = appOptions[name];
  7444. }
  7445. });
  7446. initAppLifecycle(appOptions, vm);
  7447. };
  7448. }
  7449. function initAppLifecycle(appOptions, vm) {
  7450. if (isFunction(appOptions.onLaunch)) {
  7451. const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  7452. appOptions.onLaunch(args);
  7453. }
  7454. if (isFunction(appOptions.onShow) && wx.onAppShow) {
  7455. wx.onAppShow((args) => {
  7456. vm.$callHook("onShow", args);
  7457. });
  7458. }
  7459. if (isFunction(appOptions.onHide) && wx.onAppHide) {
  7460. wx.onAppHide((args) => {
  7461. vm.$callHook("onHide", args);
  7462. });
  7463. }
  7464. }
  7465. function initLocale(appVm) {
  7466. const locale = ref(normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  7467. Object.defineProperty(appVm, "$locale", {
  7468. get() {
  7469. return locale.value;
  7470. },
  7471. set(v) {
  7472. locale.value = v;
  7473. }
  7474. });
  7475. }
  7476. function initVueIds(vueIds, mpInstance) {
  7477. if (!vueIds) {
  7478. return;
  7479. }
  7480. const ids = vueIds.split(",");
  7481. const len = ids.length;
  7482. if (len === 1) {
  7483. mpInstance._$vueId = ids[0];
  7484. } else if (len === 2) {
  7485. mpInstance._$vueId = ids[0];
  7486. mpInstance._$vuePid = ids[1];
  7487. }
  7488. }
  7489. const EXTRAS = ["externalClasses"];
  7490. function initExtraOptions(miniProgramComponentOptions, vueOptions) {
  7491. EXTRAS.forEach((name) => {
  7492. if (hasOwn$1(vueOptions, name)) {
  7493. miniProgramComponentOptions[name] = vueOptions[name];
  7494. }
  7495. });
  7496. }
  7497. const WORKLET_RE = /_(.*)_worklet_factory_/;
  7498. function initWorkletMethods(mpMethods, vueMethods) {
  7499. if (vueMethods) {
  7500. Object.keys(vueMethods).forEach((name) => {
  7501. const matches = name.match(WORKLET_RE);
  7502. if (matches) {
  7503. const workletName = matches[1];
  7504. mpMethods[name] = vueMethods[name];
  7505. mpMethods[workletName] = vueMethods[workletName];
  7506. }
  7507. });
  7508. }
  7509. }
  7510. function initWxsCallMethods(methods, wxsCallMethods) {
  7511. if (!isArray(wxsCallMethods)) {
  7512. return;
  7513. }
  7514. wxsCallMethods.forEach((callMethod) => {
  7515. methods[callMethod] = function(args) {
  7516. return this.$vm[callMethod](args);
  7517. };
  7518. });
  7519. }
  7520. function selectAllComponents(mpInstance, selector, $refs) {
  7521. const components = mpInstance.selectAllComponents(selector);
  7522. components.forEach((component) => {
  7523. const ref2 = component.properties.uR;
  7524. $refs[ref2] = component.$vm || component;
  7525. });
  7526. }
  7527. function initRefs(instance, mpInstance) {
  7528. Object.defineProperty(instance, "refs", {
  7529. get() {
  7530. const $refs = {};
  7531. selectAllComponents(mpInstance, ".r", $refs);
  7532. const forComponents = mpInstance.selectAllComponents(".r-i-f");
  7533. forComponents.forEach((component) => {
  7534. const ref2 = component.properties.uR;
  7535. if (!ref2) {
  7536. return;
  7537. }
  7538. if (!$refs[ref2]) {
  7539. $refs[ref2] = [];
  7540. }
  7541. $refs[ref2].push(component.$vm || component);
  7542. });
  7543. return $refs;
  7544. }
  7545. });
  7546. }
  7547. function findVmByVueId(instance, vuePid) {
  7548. const $children = instance.$children;
  7549. for (let i = $children.length - 1; i >= 0; i--) {
  7550. const childVm = $children[i];
  7551. if (childVm.$scope._$vueId === vuePid) {
  7552. return childVm;
  7553. }
  7554. }
  7555. let parentVm;
  7556. for (let i = $children.length - 1; i >= 0; i--) {
  7557. parentVm = findVmByVueId($children[i], vuePid);
  7558. if (parentVm) {
  7559. return parentVm;
  7560. }
  7561. }
  7562. }
  7563. const builtInProps = [
  7564. // 百度小程序,快手小程序自定义组件不支持绑定动态事件,动态dataset,故通过props传递事件信息
  7565. // event-opts
  7566. "eO",
  7567. // 组件 ref
  7568. "uR",
  7569. // 组件 ref-in-for
  7570. "uRIF",
  7571. // 组件 id
  7572. "uI",
  7573. // 组件类型 m: 小程序组件
  7574. "uT",
  7575. // 组件 props
  7576. "uP",
  7577. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  7578. "uS"
  7579. ];
  7580. function initDefaultProps(options, isBehavior = false) {
  7581. const properties = {};
  7582. if (!isBehavior) {
  7583. builtInProps.forEach((name) => {
  7584. properties[name] = {
  7585. type: null,
  7586. value: ""
  7587. };
  7588. });
  7589. properties.uS = {
  7590. type: null,
  7591. value: [],
  7592. observer: function(newVal) {
  7593. const $slots = /* @__PURE__ */ Object.create(null);
  7594. newVal && newVal.forEach((slotName) => {
  7595. $slots[slotName] = true;
  7596. });
  7597. this.setData({
  7598. $slots
  7599. });
  7600. }
  7601. };
  7602. }
  7603. if (options.behaviors) {
  7604. if (options.behaviors.includes("wx://form-field")) {
  7605. if (!options.properties || !options.properties.name) {
  7606. properties.name = {
  7607. type: null,
  7608. value: ""
  7609. };
  7610. }
  7611. if (!options.properties || !options.properties.value) {
  7612. properties.value = {
  7613. type: null,
  7614. value: ""
  7615. };
  7616. }
  7617. }
  7618. }
  7619. return properties;
  7620. }
  7621. function initVirtualHostProps(options) {
  7622. const properties = {};
  7623. {
  7624. if (options && options.virtualHost) {
  7625. properties.virtualHostStyle = {
  7626. type: null,
  7627. value: ""
  7628. };
  7629. properties.virtualHostClass = {
  7630. type: null,
  7631. value: ""
  7632. };
  7633. }
  7634. }
  7635. return properties;
  7636. }
  7637. function initProps(mpComponentOptions) {
  7638. if (!mpComponentOptions.properties) {
  7639. mpComponentOptions.properties = {};
  7640. }
  7641. extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
  7642. }
  7643. const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  7644. function parsePropType(type, defaultValue) {
  7645. if (isArray(type) && type.length === 1) {
  7646. return type[0];
  7647. }
  7648. return type;
  7649. }
  7650. function normalizePropType(type, defaultValue) {
  7651. const res = parsePropType(type);
  7652. return PROP_TYPES.indexOf(res) !== -1 ? res : null;
  7653. }
  7654. function initPageProps({ properties }, rawProps) {
  7655. if (isArray(rawProps)) {
  7656. rawProps.forEach((key) => {
  7657. properties[key] = {
  7658. type: String,
  7659. value: ""
  7660. };
  7661. });
  7662. } else if (isPlainObject$1(rawProps)) {
  7663. Object.keys(rawProps).forEach((key) => {
  7664. const opts = rawProps[key];
  7665. if (isPlainObject$1(opts)) {
  7666. let value = opts.default;
  7667. if (isFunction(value)) {
  7668. value = value();
  7669. }
  7670. const type = opts.type;
  7671. opts.type = normalizePropType(type);
  7672. properties[key] = {
  7673. type: opts.type,
  7674. value
  7675. };
  7676. } else {
  7677. properties[key] = {
  7678. type: normalizePropType(opts)
  7679. };
  7680. }
  7681. });
  7682. }
  7683. }
  7684. function findPropsData(properties, isPage2) {
  7685. return (isPage2 ? findPagePropsData(properties) : findComponentPropsData(properties.uP)) || {};
  7686. }
  7687. function findPagePropsData(properties) {
  7688. const propsData = {};
  7689. if (isPlainObject$1(properties)) {
  7690. Object.keys(properties).forEach((name) => {
  7691. if (builtInProps.indexOf(name) === -1) {
  7692. propsData[name] = properties[name];
  7693. }
  7694. });
  7695. }
  7696. return propsData;
  7697. }
  7698. function initFormField(vm) {
  7699. const vueOptions = vm.$options;
  7700. if (isArray(vueOptions.behaviors) && vueOptions.behaviors.includes("uni://form-field")) {
  7701. vm.$watch("modelValue", () => {
  7702. vm.$scope && vm.$scope.setData({
  7703. name: vm.name,
  7704. value: vm.modelValue
  7705. });
  7706. }, {
  7707. immediate: true
  7708. });
  7709. }
  7710. }
  7711. function initData(_) {
  7712. return {};
  7713. }
  7714. function initPropsObserver(componentOptions) {
  7715. const observe = function observe2() {
  7716. const up = this.properties.uP;
  7717. if (!up) {
  7718. return;
  7719. }
  7720. if (this.$vm) {
  7721. updateComponentProps(up, this.$vm.$);
  7722. } else if (this.properties.uT === "m") {
  7723. updateMiniProgramComponentProperties(up, this);
  7724. }
  7725. };
  7726. {
  7727. if (!componentOptions.observers) {
  7728. componentOptions.observers = {};
  7729. }
  7730. componentOptions.observers.uP = observe;
  7731. }
  7732. }
  7733. function updateMiniProgramComponentProperties(up, mpInstance) {
  7734. const prevProps = mpInstance.properties;
  7735. const nextProps = findComponentPropsData(up) || {};
  7736. if (hasPropsChanged(prevProps, nextProps, false)) {
  7737. mpInstance.setData(nextProps);
  7738. }
  7739. }
  7740. function updateComponentProps(up, instance) {
  7741. const prevProps = toRaw(instance.props);
  7742. const nextProps = findComponentPropsData(up) || {};
  7743. if (hasPropsChanged(prevProps, nextProps)) {
  7744. updateProps(instance, nextProps, prevProps, false);
  7745. if (hasQueueJob(instance.update)) {
  7746. invalidateJob(instance.update);
  7747. }
  7748. {
  7749. instance.update();
  7750. }
  7751. }
  7752. }
  7753. function hasPropsChanged(prevProps, nextProps, checkLen = true) {
  7754. const nextKeys = Object.keys(nextProps);
  7755. if (checkLen && nextKeys.length !== Object.keys(prevProps).length) {
  7756. return true;
  7757. }
  7758. for (let i = 0; i < nextKeys.length; i++) {
  7759. const key = nextKeys[i];
  7760. if (nextProps[key] !== prevProps[key]) {
  7761. return true;
  7762. }
  7763. }
  7764. return false;
  7765. }
  7766. function initBehaviors(vueOptions) {
  7767. const vueBehaviors = vueOptions.behaviors;
  7768. let vueProps = vueOptions.props;
  7769. if (!vueProps) {
  7770. vueOptions.props = vueProps = [];
  7771. }
  7772. const behaviors = [];
  7773. if (isArray(vueBehaviors)) {
  7774. vueBehaviors.forEach((behavior) => {
  7775. behaviors.push(behavior.replace("uni://", "wx://"));
  7776. if (behavior === "uni://form-field") {
  7777. if (isArray(vueProps)) {
  7778. vueProps.push("name");
  7779. vueProps.push("modelValue");
  7780. } else {
  7781. vueProps.name = {
  7782. type: String,
  7783. default: ""
  7784. };
  7785. vueProps.modelValue = {
  7786. type: [String, Number, Boolean, Array, Object, Date],
  7787. default: ""
  7788. };
  7789. }
  7790. }
  7791. });
  7792. }
  7793. return behaviors;
  7794. }
  7795. function applyOptions(componentOptions, vueOptions) {
  7796. componentOptions.data = initData();
  7797. componentOptions.behaviors = initBehaviors(vueOptions);
  7798. }
  7799. function parseComponent(vueOptions, { parse: parse2, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
  7800. vueOptions = vueOptions.default || vueOptions;
  7801. const options = {
  7802. multipleSlots: true,
  7803. // styleIsolation: 'apply-shared',
  7804. addGlobalClass: true,
  7805. pureDataPattern: /^uP$/
  7806. };
  7807. if (isArray(vueOptions.mixins)) {
  7808. vueOptions.mixins.forEach((item) => {
  7809. if (isObject$1(item.options)) {
  7810. extend(options, item.options);
  7811. }
  7812. });
  7813. }
  7814. if (vueOptions.options) {
  7815. extend(options, vueOptions.options);
  7816. }
  7817. const mpComponentOptions = {
  7818. options,
  7819. lifetimes: initLifetimes2({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }),
  7820. pageLifetimes: {
  7821. show() {
  7822. this.$vm && this.$vm.$callHook("onPageShow");
  7823. },
  7824. hide() {
  7825. this.$vm && this.$vm.$callHook("onPageHide");
  7826. },
  7827. resize(size2) {
  7828. this.$vm && this.$vm.$callHook("onPageResize", size2);
  7829. }
  7830. },
  7831. methods: {
  7832. __l: handleLink2
  7833. }
  7834. };
  7835. {
  7836. applyOptions(mpComponentOptions, vueOptions);
  7837. }
  7838. initProps(mpComponentOptions);
  7839. initPropsObserver(mpComponentOptions);
  7840. initExtraOptions(mpComponentOptions, vueOptions);
  7841. initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
  7842. {
  7843. initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
  7844. }
  7845. if (parse2) {
  7846. parse2(mpComponentOptions, { handleLink: handleLink2 });
  7847. }
  7848. return mpComponentOptions;
  7849. }
  7850. function initCreateComponent(parseOptions2) {
  7851. return function createComponent2(vueComponentOptions) {
  7852. return Component(parseComponent(vueComponentOptions, parseOptions2));
  7853. };
  7854. }
  7855. let $createComponentFn;
  7856. let $destroyComponentFn;
  7857. function getAppVm() {
  7858. return getApp().$vm;
  7859. }
  7860. function $createComponent(initialVNode, options) {
  7861. if (!$createComponentFn) {
  7862. $createComponentFn = getAppVm().$createComponent;
  7863. }
  7864. const proxy = $createComponentFn(initialVNode, options);
  7865. return getExposeProxy(proxy.$) || proxy;
  7866. }
  7867. function $destroyComponent(instance) {
  7868. if (!$destroyComponentFn) {
  7869. $destroyComponentFn = getAppVm().$destroyComponent;
  7870. }
  7871. return $destroyComponentFn(instance);
  7872. }
  7873. function parsePage(vueOptions, parseOptions2) {
  7874. const { parse: parse2, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
  7875. const miniProgramPageOptions = parseComponent(vueOptions, {
  7876. mocks: mocks2,
  7877. isPage: isPage2,
  7878. initRelation: initRelation2,
  7879. handleLink: handleLink2,
  7880. initLifetimes: initLifetimes2
  7881. });
  7882. initPageProps(miniProgramPageOptions, (vueOptions.default || vueOptions).props);
  7883. const methods = miniProgramPageOptions.methods;
  7884. methods.onLoad = function(query) {
  7885. this.options = query;
  7886. this.$page = {
  7887. fullPath: addLeadingSlash(this.route + stringifyQuery(query))
  7888. };
  7889. return this.$vm && this.$vm.$callHook(ON_LOAD, query);
  7890. };
  7891. initHooks(methods, PAGE_INIT_HOOKS);
  7892. {
  7893. initUnknownHooks(methods, vueOptions);
  7894. }
  7895. initRuntimeHooks(methods, vueOptions.__runtimeHooks);
  7896. initMixinRuntimeHooks(methods);
  7897. parse2 && parse2(miniProgramPageOptions, { handleLink: handleLink2 });
  7898. return miniProgramPageOptions;
  7899. }
  7900. function initCreatePage(parseOptions2) {
  7901. return function createPage2(vuePageOptions) {
  7902. return Component(parsePage(vuePageOptions, parseOptions2));
  7903. };
  7904. }
  7905. function initCreatePluginApp(parseAppOptions) {
  7906. return function createApp2(vm) {
  7907. initAppLifecycle(parseApp(vm, parseAppOptions), vm);
  7908. };
  7909. }
  7910. const MPPage = Page;
  7911. const MPComponent = Component;
  7912. function initTriggerEvent(mpInstance) {
  7913. const oldTriggerEvent = mpInstance.triggerEvent;
  7914. const newTriggerEvent = function(event, ...args) {
  7915. return oldTriggerEvent.apply(mpInstance, [customizeEvent(event), ...args]);
  7916. };
  7917. try {
  7918. mpInstance.triggerEvent = newTriggerEvent;
  7919. } catch (error) {
  7920. mpInstance._triggerEvent = newTriggerEvent;
  7921. }
  7922. }
  7923. function initMiniProgramHook(name, options, isComponent) {
  7924. const oldHook = options[name];
  7925. if (!oldHook) {
  7926. options[name] = function() {
  7927. initTriggerEvent(this);
  7928. };
  7929. } else {
  7930. options[name] = function(...args) {
  7931. initTriggerEvent(this);
  7932. return oldHook.apply(this, args);
  7933. };
  7934. }
  7935. }
  7936. Page = function(options) {
  7937. initMiniProgramHook(ON_LOAD, options);
  7938. return MPPage(options);
  7939. };
  7940. Component = function(options) {
  7941. initMiniProgramHook("created", options);
  7942. const isVueComponent = options.properties && options.properties.uP;
  7943. if (!isVueComponent) {
  7944. initProps(options);
  7945. initPropsObserver(options);
  7946. }
  7947. return MPComponent(options);
  7948. };
  7949. function initLifetimes({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }) {
  7950. return {
  7951. attached() {
  7952. let properties = this.properties;
  7953. initVueIds(properties.uI, this);
  7954. const relationOptions = {
  7955. vuePid: this._$vuePid
  7956. };
  7957. initRelation2(this, relationOptions);
  7958. const mpInstance = this;
  7959. const isMiniProgramPage = isPage2(mpInstance);
  7960. let propsData = properties;
  7961. this.$vm = $createComponent({
  7962. type: vueOptions,
  7963. props: findPropsData(propsData, isMiniProgramPage)
  7964. }, {
  7965. mpType: isMiniProgramPage ? "page" : "component",
  7966. mpInstance,
  7967. slots: properties.uS || {},
  7968. // vueSlots
  7969. parentComponent: relationOptions.parent && relationOptions.parent.$,
  7970. onBeforeSetup(instance, options) {
  7971. initRefs(instance, mpInstance);
  7972. initMocks(instance, mpInstance, mocks2);
  7973. initComponentInstance(instance, options);
  7974. }
  7975. });
  7976. if (!isMiniProgramPage) {
  7977. initFormField(this.$vm);
  7978. }
  7979. },
  7980. ready() {
  7981. if (this.$vm) {
  7982. {
  7983. this.$vm.$callHook("mounted");
  7984. this.$vm.$callHook(ON_READY);
  7985. }
  7986. }
  7987. },
  7988. detached() {
  7989. if (this.$vm) {
  7990. pruneComponentPropsCache(this.$vm.$.uid);
  7991. $destroyComponent(this.$vm);
  7992. }
  7993. }
  7994. };
  7995. }
  7996. const mocks = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  7997. function isPage(mpInstance) {
  7998. return !!mpInstance.route;
  7999. }
  8000. function initRelation(mpInstance, detail) {
  8001. mpInstance.triggerEvent("__l", detail);
  8002. }
  8003. function handleLink(event) {
  8004. const detail = event.detail || event.value;
  8005. const vuePid = detail.vuePid;
  8006. let parentVm;
  8007. if (vuePid) {
  8008. parentVm = findVmByVueId(this.$vm, vuePid);
  8009. }
  8010. if (!parentVm) {
  8011. parentVm = this.$vm;
  8012. }
  8013. detail.parent = parentVm;
  8014. }
  8015. var parseOptions = /* @__PURE__ */ Object.freeze({
  8016. __proto__: null,
  8017. handleLink,
  8018. initLifetimes,
  8019. initRelation,
  8020. isPage,
  8021. mocks
  8022. });
  8023. const createApp = initCreateApp();
  8024. const createPage = initCreatePage(parseOptions);
  8025. const createComponent = initCreateComponent(parseOptions);
  8026. const createPluginApp = initCreatePluginApp();
  8027. const createSubpackageApp = initCreateSubpackageApp();
  8028. {
  8029. wx.createApp = global.createApp = createApp;
  8030. wx.createPage = createPage;
  8031. wx.createComponent = createComponent;
  8032. wx.createPluginApp = global.createPluginApp = createPluginApp;
  8033. wx.createSubpackageApp = global.createSubpackageApp = createSubpackageApp;
  8034. }
  8035. var isVue2 = false;
  8036. function set$1(target, key, val) {
  8037. if (Array.isArray(target)) {
  8038. target.length = Math.max(target.length, key);
  8039. target.splice(key, 1, val);
  8040. return val;
  8041. }
  8042. target[key] = val;
  8043. return val;
  8044. }
  8045. function del(target, key) {
  8046. if (Array.isArray(target)) {
  8047. target.splice(key, 1);
  8048. return;
  8049. }
  8050. delete target[key];
  8051. }
  8052. /*!
  8053. * pinia v2.1.7
  8054. * (c) 2023 Eduardo San Martin Morote
  8055. * @license MIT
  8056. */
  8057. let activePinia;
  8058. const setActivePinia = (pinia) => activePinia = pinia;
  8059. const piniaSymbol = Symbol("pinia");
  8060. function isPlainObject(o2) {
  8061. return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function";
  8062. }
  8063. var MutationType;
  8064. (function(MutationType2) {
  8065. MutationType2["direct"] = "direct";
  8066. MutationType2["patchObject"] = "patch object";
  8067. MutationType2["patchFunction"] = "patch function";
  8068. })(MutationType || (MutationType = {}));
  8069. const IS_CLIENT = typeof window !== "undefined";
  8070. const USE_DEVTOOLS = IS_CLIENT;
  8071. const componentStateTypes = [];
  8072. const getStoreType = (id) => "🍍 " + id;
  8073. function addStoreToDevtools(app, store) {
  8074. if (!componentStateTypes.includes(getStoreType(store.$id))) {
  8075. componentStateTypes.push(getStoreType(store.$id));
  8076. }
  8077. }
  8078. function patchActionForGrouping(store, actionNames, wrapWithProxy) {
  8079. const actions = actionNames.reduce((storeActions, actionName) => {
  8080. storeActions[actionName] = toRaw(store)[actionName];
  8081. return storeActions;
  8082. }, {});
  8083. for (const actionName in actions) {
  8084. store[actionName] = function() {
  8085. const trackedStore = wrapWithProxy ? new Proxy(store, {
  8086. get(...args) {
  8087. return Reflect.get(...args);
  8088. },
  8089. set(...args) {
  8090. return Reflect.set(...args);
  8091. }
  8092. }) : store;
  8093. const retValue = actions[actionName].apply(trackedStore, arguments);
  8094. return retValue;
  8095. };
  8096. }
  8097. }
  8098. function devtoolsPlugin({ app, store, options }) {
  8099. if (store.$id.startsWith("__hot:")) {
  8100. return;
  8101. }
  8102. store._isOptionsAPI = !!options.state;
  8103. patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
  8104. const originalHotUpdate = store._hotUpdate;
  8105. toRaw(store)._hotUpdate = function(newStore) {
  8106. originalHotUpdate.apply(this, arguments);
  8107. patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
  8108. };
  8109. addStoreToDevtools(
  8110. app,
  8111. // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
  8112. store
  8113. );
  8114. }
  8115. function createPinia() {
  8116. const scope = effectScope(true);
  8117. const state = scope.run(() => ref({}));
  8118. let _p = [];
  8119. let toBeInstalled = [];
  8120. const pinia = markRaw({
  8121. install(app) {
  8122. setActivePinia(pinia);
  8123. {
  8124. pinia._a = app;
  8125. app.provide(piniaSymbol, pinia);
  8126. app.config.globalProperties.$pinia = pinia;
  8127. toBeInstalled.forEach((plugin2) => _p.push(plugin2));
  8128. toBeInstalled = [];
  8129. }
  8130. },
  8131. use(plugin2) {
  8132. if (!this._a && !isVue2) {
  8133. toBeInstalled.push(plugin2);
  8134. } else {
  8135. _p.push(plugin2);
  8136. }
  8137. return this;
  8138. },
  8139. _p,
  8140. // it's actually undefined here
  8141. // @ts-expect-error
  8142. _a: null,
  8143. _e: scope,
  8144. _s: /* @__PURE__ */ new Map(),
  8145. state
  8146. });
  8147. if (USE_DEVTOOLS && typeof Proxy !== "undefined") {
  8148. pinia.use(devtoolsPlugin);
  8149. }
  8150. return pinia;
  8151. }
  8152. function patchObject(newState, oldState) {
  8153. for (const key in oldState) {
  8154. const subPatch = oldState[key];
  8155. if (!(key in newState)) {
  8156. continue;
  8157. }
  8158. const targetValue = newState[key];
  8159. if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
  8160. newState[key] = patchObject(targetValue, subPatch);
  8161. } else {
  8162. {
  8163. newState[key] = subPatch;
  8164. }
  8165. }
  8166. }
  8167. return newState;
  8168. }
  8169. const noop = () => {
  8170. };
  8171. function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
  8172. subscriptions.push(callback);
  8173. const removeSubscription = () => {
  8174. const idx = subscriptions.indexOf(callback);
  8175. if (idx > -1) {
  8176. subscriptions.splice(idx, 1);
  8177. onCleanup();
  8178. }
  8179. };
  8180. if (!detached && getCurrentScope()) {
  8181. onScopeDispose(removeSubscription);
  8182. }
  8183. return removeSubscription;
  8184. }
  8185. function triggerSubscriptions(subscriptions, ...args) {
  8186. subscriptions.slice().forEach((callback) => {
  8187. callback(...args);
  8188. });
  8189. }
  8190. const fallbackRunWithContext = (fn) => fn();
  8191. function mergeReactiveObjects(target, patchToApply) {
  8192. if (target instanceof Map && patchToApply instanceof Map) {
  8193. patchToApply.forEach((value, key) => target.set(key, value));
  8194. }
  8195. if (target instanceof Set && patchToApply instanceof Set) {
  8196. patchToApply.forEach(target.add, target);
  8197. }
  8198. for (const key in patchToApply) {
  8199. if (!patchToApply.hasOwnProperty(key))
  8200. continue;
  8201. const subPatch = patchToApply[key];
  8202. const targetValue = target[key];
  8203. if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
  8204. target[key] = mergeReactiveObjects(targetValue, subPatch);
  8205. } else {
  8206. target[key] = subPatch;
  8207. }
  8208. }
  8209. return target;
  8210. }
  8211. const skipHydrateSymbol = Symbol("pinia:skipHydration");
  8212. function shouldHydrate(obj) {
  8213. return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
  8214. }
  8215. const { assign } = Object;
  8216. function isComputed(o2) {
  8217. return !!(isRef(o2) && o2.effect);
  8218. }
  8219. function createOptionsStore(id, options, pinia, hot) {
  8220. const { state, actions, getters } = options;
  8221. const initialState = pinia.state.value[id];
  8222. let store;
  8223. function setup() {
  8224. if (!initialState && !hot) {
  8225. {
  8226. pinia.state.value[id] = state ? state() : {};
  8227. }
  8228. }
  8229. const localState = hot ? (
  8230. // use ref() to unwrap refs inside state TODO: check if this is still necessary
  8231. toRefs(ref(state ? state() : {}).value)
  8232. ) : toRefs(pinia.state.value[id]);
  8233. return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
  8234. if (name in localState) {
  8235. console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
  8236. }
  8237. computedGetters[name] = markRaw(computed(() => {
  8238. setActivePinia(pinia);
  8239. const store2 = pinia._s.get(id);
  8240. return getters[name].call(store2, store2);
  8241. }));
  8242. return computedGetters;
  8243. }, {}));
  8244. }
  8245. store = createSetupStore(id, setup, options, pinia, hot, true);
  8246. return store;
  8247. }
  8248. function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
  8249. let scope;
  8250. const optionsForPlugin = assign({ actions: {} }, options);
  8251. if (!pinia._e.active) {
  8252. throw new Error("Pinia destroyed");
  8253. }
  8254. const $subscribeOptions = {
  8255. deep: true
  8256. // flush: 'post',
  8257. };
  8258. {
  8259. $subscribeOptions.onTrigger = (event) => {
  8260. if (isListening) {
  8261. debuggerEvents = event;
  8262. } else if (isListening == false && !store._hotUpdating) {
  8263. if (Array.isArray(debuggerEvents)) {
  8264. debuggerEvents.push(event);
  8265. } else {
  8266. console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
  8267. }
  8268. }
  8269. };
  8270. }
  8271. let isListening;
  8272. let isSyncListening;
  8273. let subscriptions = [];
  8274. let actionSubscriptions = [];
  8275. let debuggerEvents;
  8276. const initialState = pinia.state.value[$id];
  8277. if (!isOptionsStore && !initialState && !hot) {
  8278. {
  8279. pinia.state.value[$id] = {};
  8280. }
  8281. }
  8282. const hotState = ref({});
  8283. let activeListener;
  8284. function $patch(partialStateOrMutator) {
  8285. let subscriptionMutation;
  8286. isListening = isSyncListening = false;
  8287. {
  8288. debuggerEvents = [];
  8289. }
  8290. if (typeof partialStateOrMutator === "function") {
  8291. partialStateOrMutator(pinia.state.value[$id]);
  8292. subscriptionMutation = {
  8293. type: MutationType.patchFunction,
  8294. storeId: $id,
  8295. events: debuggerEvents
  8296. };
  8297. } else {
  8298. mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
  8299. subscriptionMutation = {
  8300. type: MutationType.patchObject,
  8301. payload: partialStateOrMutator,
  8302. storeId: $id,
  8303. events: debuggerEvents
  8304. };
  8305. }
  8306. const myListenerId = activeListener = Symbol();
  8307. nextTick$1().then(() => {
  8308. if (activeListener === myListenerId) {
  8309. isListening = true;
  8310. }
  8311. });
  8312. isSyncListening = true;
  8313. triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
  8314. }
  8315. const $reset = isOptionsStore ? function $reset2() {
  8316. const { state } = options;
  8317. const newState = state ? state() : {};
  8318. this.$patch(($state) => {
  8319. assign($state, newState);
  8320. });
  8321. } : (
  8322. /* istanbul ignore next */
  8323. () => {
  8324. throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
  8325. }
  8326. );
  8327. function $dispose() {
  8328. scope.stop();
  8329. subscriptions = [];
  8330. actionSubscriptions = [];
  8331. pinia._s.delete($id);
  8332. }
  8333. function wrapAction(name, action) {
  8334. return function() {
  8335. setActivePinia(pinia);
  8336. const args = Array.from(arguments);
  8337. const afterCallbackList = [];
  8338. const onErrorCallbackList = [];
  8339. function after(callback) {
  8340. afterCallbackList.push(callback);
  8341. }
  8342. function onError(callback) {
  8343. onErrorCallbackList.push(callback);
  8344. }
  8345. triggerSubscriptions(actionSubscriptions, {
  8346. args,
  8347. name,
  8348. store,
  8349. after,
  8350. onError
  8351. });
  8352. let ret;
  8353. try {
  8354. ret = action.apply(this && this.$id === $id ? this : store, args);
  8355. } catch (error) {
  8356. triggerSubscriptions(onErrorCallbackList, error);
  8357. throw error;
  8358. }
  8359. if (ret instanceof Promise) {
  8360. return ret.then((value) => {
  8361. triggerSubscriptions(afterCallbackList, value);
  8362. return value;
  8363. }).catch((error) => {
  8364. triggerSubscriptions(onErrorCallbackList, error);
  8365. return Promise.reject(error);
  8366. });
  8367. }
  8368. triggerSubscriptions(afterCallbackList, ret);
  8369. return ret;
  8370. };
  8371. }
  8372. const _hmrPayload = /* @__PURE__ */ markRaw({
  8373. actions: {},
  8374. getters: {},
  8375. state: [],
  8376. hotState
  8377. });
  8378. const partialStore = {
  8379. _p: pinia,
  8380. // _s: scope,
  8381. $id,
  8382. $onAction: addSubscription.bind(null, actionSubscriptions),
  8383. $patch,
  8384. $reset,
  8385. $subscribe(callback, options2 = {}) {
  8386. const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
  8387. const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
  8388. if (options2.flush === "sync" ? isSyncListening : isListening) {
  8389. callback({
  8390. storeId: $id,
  8391. type: MutationType.direct,
  8392. events: debuggerEvents
  8393. }, state);
  8394. }
  8395. }, assign({}, $subscribeOptions, options2)));
  8396. return removeSubscription;
  8397. },
  8398. $dispose
  8399. };
  8400. const store = reactive(assign(
  8401. {
  8402. _hmrPayload,
  8403. _customProperties: markRaw(/* @__PURE__ */ new Set())
  8404. // devtools custom properties
  8405. },
  8406. partialStore
  8407. // must be added later
  8408. // setupStore
  8409. ));
  8410. pinia._s.set($id, store);
  8411. const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
  8412. const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(setup)));
  8413. for (const key in setupStore) {
  8414. const prop = setupStore[key];
  8415. if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
  8416. if (hot) {
  8417. set$1(hotState.value, key, toRef(setupStore, key));
  8418. } else if (!isOptionsStore) {
  8419. if (initialState && shouldHydrate(prop)) {
  8420. if (isRef(prop)) {
  8421. prop.value = initialState[key];
  8422. } else {
  8423. mergeReactiveObjects(prop, initialState[key]);
  8424. }
  8425. }
  8426. {
  8427. pinia.state.value[$id][key] = prop;
  8428. }
  8429. }
  8430. {
  8431. _hmrPayload.state.push(key);
  8432. }
  8433. } else if (typeof prop === "function") {
  8434. const actionValue = hot ? prop : wrapAction(key, prop);
  8435. {
  8436. setupStore[key] = actionValue;
  8437. }
  8438. {
  8439. _hmrPayload.actions[key] = prop;
  8440. }
  8441. optionsForPlugin.actions[key] = prop;
  8442. } else {
  8443. if (isComputed(prop)) {
  8444. _hmrPayload.getters[key] = isOptionsStore ? (
  8445. // @ts-expect-error
  8446. options.getters[key]
  8447. ) : prop;
  8448. if (IS_CLIENT) {
  8449. const getters = setupStore._getters || // @ts-expect-error: same
  8450. (setupStore._getters = markRaw([]));
  8451. getters.push(key);
  8452. }
  8453. }
  8454. }
  8455. }
  8456. {
  8457. assign(store, setupStore);
  8458. assign(toRaw(store), setupStore);
  8459. }
  8460. Object.defineProperty(store, "$state", {
  8461. get: () => hot ? hotState.value : pinia.state.value[$id],
  8462. set: (state) => {
  8463. if (hot) {
  8464. throw new Error("cannot set hotState");
  8465. }
  8466. $patch(($state) => {
  8467. assign($state, state);
  8468. });
  8469. }
  8470. });
  8471. {
  8472. store._hotUpdate = markRaw((newStore) => {
  8473. store._hotUpdating = true;
  8474. newStore._hmrPayload.state.forEach((stateKey) => {
  8475. if (stateKey in store.$state) {
  8476. const newStateTarget = newStore.$state[stateKey];
  8477. const oldStateSource = store.$state[stateKey];
  8478. if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
  8479. patchObject(newStateTarget, oldStateSource);
  8480. } else {
  8481. newStore.$state[stateKey] = oldStateSource;
  8482. }
  8483. }
  8484. set$1(store, stateKey, toRef(newStore.$state, stateKey));
  8485. });
  8486. Object.keys(store.$state).forEach((stateKey) => {
  8487. if (!(stateKey in newStore.$state)) {
  8488. del(store, stateKey);
  8489. }
  8490. });
  8491. isListening = false;
  8492. isSyncListening = false;
  8493. pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
  8494. isSyncListening = true;
  8495. nextTick$1().then(() => {
  8496. isListening = true;
  8497. });
  8498. for (const actionName in newStore._hmrPayload.actions) {
  8499. const action = newStore[actionName];
  8500. set$1(store, actionName, wrapAction(actionName, action));
  8501. }
  8502. for (const getterName in newStore._hmrPayload.getters) {
  8503. const getter = newStore._hmrPayload.getters[getterName];
  8504. const getterValue = isOptionsStore ? (
  8505. // special handling of options api
  8506. computed(() => {
  8507. setActivePinia(pinia);
  8508. return getter.call(store, store);
  8509. })
  8510. ) : getter;
  8511. set$1(store, getterName, getterValue);
  8512. }
  8513. Object.keys(store._hmrPayload.getters).forEach((key) => {
  8514. if (!(key in newStore._hmrPayload.getters)) {
  8515. del(store, key);
  8516. }
  8517. });
  8518. Object.keys(store._hmrPayload.actions).forEach((key) => {
  8519. if (!(key in newStore._hmrPayload.actions)) {
  8520. del(store, key);
  8521. }
  8522. });
  8523. store._hmrPayload = newStore._hmrPayload;
  8524. store._getters = newStore._getters;
  8525. store._hotUpdating = false;
  8526. });
  8527. }
  8528. if (USE_DEVTOOLS) {
  8529. const nonEnumerable = {
  8530. writable: true,
  8531. configurable: true,
  8532. // avoid warning on devtools trying to display this property
  8533. enumerable: false
  8534. };
  8535. ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
  8536. Object.defineProperty(store, p2, assign({ value: store[p2] }, nonEnumerable));
  8537. });
  8538. }
  8539. pinia._p.forEach((extender) => {
  8540. if (USE_DEVTOOLS) {
  8541. const extensions = scope.run(() => extender({
  8542. store,
  8543. app: pinia._a,
  8544. pinia,
  8545. options: optionsForPlugin
  8546. }));
  8547. Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
  8548. assign(store, extensions);
  8549. } else {
  8550. assign(store, scope.run(() => extender({
  8551. store,
  8552. app: pinia._a,
  8553. pinia,
  8554. options: optionsForPlugin
  8555. })));
  8556. }
  8557. });
  8558. if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
  8559. console.warn(`[🍍]: The "state" must be a plain object. It cannot be
  8560. state: () => new MyClass()
  8561. Found in store "${store.$id}".`);
  8562. }
  8563. if (initialState && isOptionsStore && options.hydrate) {
  8564. options.hydrate(store.$state, initialState);
  8565. }
  8566. isListening = true;
  8567. isSyncListening = true;
  8568. return store;
  8569. }
  8570. function defineStore(idOrOptions, setup, setupOptions) {
  8571. let id;
  8572. let options;
  8573. const isSetupStore = typeof setup === "function";
  8574. if (typeof idOrOptions === "string") {
  8575. id = idOrOptions;
  8576. options = isSetupStore ? setupOptions : setup;
  8577. } else {
  8578. options = idOrOptions;
  8579. id = idOrOptions.id;
  8580. if (typeof id !== "string") {
  8581. throw new Error(`[🍍]: "defineStore()" must be passed a store id as its first argument.`);
  8582. }
  8583. }
  8584. function useStore(pinia, hot) {
  8585. const hasContext = hasInjectionContext();
  8586. pinia = // in test mode, ignore the argument provided as we can always retrieve a
  8587. // pinia instance with getActivePinia()
  8588. pinia || (hasContext ? inject(piniaSymbol, null) : null);
  8589. if (pinia)
  8590. setActivePinia(pinia);
  8591. if (!activePinia) {
  8592. throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
  8593. See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
  8594. This will fail in production.`);
  8595. }
  8596. pinia = activePinia;
  8597. if (!pinia._s.has(id)) {
  8598. if (isSetupStore) {
  8599. createSetupStore(id, setup, options, pinia);
  8600. } else {
  8601. createOptionsStore(id, options, pinia);
  8602. }
  8603. {
  8604. useStore._pinia = pinia;
  8605. }
  8606. }
  8607. const store = pinia._s.get(id);
  8608. if (hot) {
  8609. const hotId = "__hot:" + id;
  8610. const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
  8611. hot._hotUpdate(newStore);
  8612. delete pinia.state.value[hotId];
  8613. pinia._s.delete(hotId);
  8614. }
  8615. if (IS_CLIENT) {
  8616. const currentInstance2 = getCurrentInstance();
  8617. if (currentInstance2 && currentInstance2.proxy && // avoid adding stores that are just built for hot module replacement
  8618. !hot) {
  8619. const vm = currentInstance2.proxy;
  8620. const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
  8621. cache[id] = store;
  8622. }
  8623. }
  8624. return store;
  8625. }
  8626. useStore.$id = id;
  8627. return useStore;
  8628. }
  8629. function storeToRefs(store) {
  8630. {
  8631. store = toRaw(store);
  8632. const refs = {};
  8633. for (const key in store) {
  8634. const value = store[key];
  8635. if (isRef(value) || isReactive(value)) {
  8636. refs[key] = // ---
  8637. toRef(store, key);
  8638. }
  8639. }
  8640. return refs;
  8641. }
  8642. }
  8643. const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
  8644. const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
  8645. const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
  8646. function jsonParseTransform(key, value) {
  8647. if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
  8648. warnKeyDropped(key);
  8649. return;
  8650. }
  8651. return value;
  8652. }
  8653. function warnKeyDropped(key) {
  8654. console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
  8655. }
  8656. function destr(value, options = {}) {
  8657. if (typeof value !== "string") {
  8658. return value;
  8659. }
  8660. const _value = value.trim();
  8661. if (
  8662. // eslint-disable-next-line unicorn/prefer-at
  8663. value[0] === '"' && value.endsWith('"') && !value.includes("\\")
  8664. ) {
  8665. return _value.slice(1, -1);
  8666. }
  8667. if (_value.length <= 9) {
  8668. const _lval = _value.toLowerCase();
  8669. if (_lval === "true") {
  8670. return true;
  8671. }
  8672. if (_lval === "false") {
  8673. return false;
  8674. }
  8675. if (_lval === "undefined") {
  8676. return void 0;
  8677. }
  8678. if (_lval === "null") {
  8679. return null;
  8680. }
  8681. if (_lval === "nan") {
  8682. return Number.NaN;
  8683. }
  8684. if (_lval === "infinity") {
  8685. return Number.POSITIVE_INFINITY;
  8686. }
  8687. if (_lval === "-infinity") {
  8688. return Number.NEGATIVE_INFINITY;
  8689. }
  8690. }
  8691. if (!JsonSigRx.test(value)) {
  8692. if (options.strict) {
  8693. throw new SyntaxError("[destr] Invalid JSON");
  8694. }
  8695. return value;
  8696. }
  8697. try {
  8698. if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
  8699. if (options.strict) {
  8700. throw new Error("[destr] Possible prototype pollution");
  8701. }
  8702. return JSON.parse(value, jsonParseTransform);
  8703. }
  8704. return JSON.parse(value);
  8705. } catch (error) {
  8706. if (options.strict) {
  8707. throw error;
  8708. }
  8709. return value;
  8710. }
  8711. }
  8712. function get(obj, path) {
  8713. if (obj == null)
  8714. return void 0;
  8715. let value = obj;
  8716. for (let i = 0; i < path.length; i++) {
  8717. if (value == null || value[path[i]] == null)
  8718. return void 0;
  8719. value = value[path[i]];
  8720. }
  8721. return value;
  8722. }
  8723. function set(obj, value, path) {
  8724. if (path.length === 0)
  8725. return value;
  8726. const idx = path[0];
  8727. if (path.length > 1) {
  8728. value = set(
  8729. typeof obj !== "object" || obj === null || !Object.prototype.hasOwnProperty.call(obj, idx) ? Number.isInteger(Number(path[1])) ? [] : {} : obj[idx],
  8730. value,
  8731. Array.prototype.slice.call(path, 1)
  8732. );
  8733. }
  8734. if (Number.isInteger(Number(idx)) && Array.isArray(obj))
  8735. return obj.slice()[idx];
  8736. return Object.assign({}, obj, { [idx]: value });
  8737. }
  8738. function unset(obj, path) {
  8739. if (obj == null || path.length === 0)
  8740. return obj;
  8741. if (path.length === 1) {
  8742. if (obj == null)
  8743. return obj;
  8744. if (Number.isInteger(path[0]) && Array.isArray(obj))
  8745. return Array.prototype.slice.call(obj, 0).splice(path[0], 1);
  8746. const result = {};
  8747. for (const p2 in obj)
  8748. result[p2] = obj[p2];
  8749. delete result[path[0]];
  8750. return result;
  8751. }
  8752. if (obj[path[0]] == null) {
  8753. if (Number.isInteger(path[0]) && Array.isArray(obj))
  8754. return Array.prototype.concat.call([], obj);
  8755. const result = {};
  8756. for (const p2 in obj)
  8757. result[p2] = obj[p2];
  8758. return result;
  8759. }
  8760. return set(
  8761. obj,
  8762. unset(
  8763. obj[path[0]],
  8764. Array.prototype.slice.call(path, 1)
  8765. ),
  8766. [path[0]]
  8767. );
  8768. }
  8769. function deepPickUnsafe(obj, paths) {
  8770. return paths.map((p2) => p2.split(".")).map((p2) => [p2, get(obj, p2)]).filter((t2) => t2[1] !== void 0).reduce((acc, cur) => set(acc, cur[1], cur[0]), {});
  8771. }
  8772. function deepOmitUnsafe(obj, paths) {
  8773. return paths.map((p2) => p2.split(".")).reduce((acc, cur) => unset(acc, cur), obj);
  8774. }
  8775. function hydrateStore(store, {
  8776. storage,
  8777. serializer,
  8778. key,
  8779. debug,
  8780. pick,
  8781. omit,
  8782. beforeHydrate,
  8783. afterHydrate
  8784. }, context, runHooks = true) {
  8785. try {
  8786. if (runHooks)
  8787. beforeHydrate == null ? void 0 : beforeHydrate(context);
  8788. const fromStorage = storage.getItem(key);
  8789. if (fromStorage) {
  8790. const deserialized = serializer.deserialize(fromStorage);
  8791. const picked = pick ? deepPickUnsafe(deserialized, pick) : deserialized;
  8792. const omitted = omit ? deepOmitUnsafe(picked, omit) : picked;
  8793. store.$patch(omitted);
  8794. }
  8795. if (runHooks)
  8796. afterHydrate == null ? void 0 : afterHydrate(context);
  8797. } catch (error) {
  8798. if (debug)
  8799. console.error("[pinia-plugin-persistedstate]", error);
  8800. }
  8801. }
  8802. function persistState(state, {
  8803. storage,
  8804. serializer,
  8805. key,
  8806. debug,
  8807. pick,
  8808. omit
  8809. }) {
  8810. try {
  8811. const picked = pick ? deepPickUnsafe(state, pick) : state;
  8812. const omitted = omit ? deepOmitUnsafe(picked, omit) : picked;
  8813. const toStorage = serializer.serialize(omitted);
  8814. storage.setItem(key, toStorage);
  8815. } catch (error) {
  8816. if (debug)
  8817. console.error("[pinia-plugin-persistedstate]", error);
  8818. }
  8819. }
  8820. function createPersistence(context, optionsParser, auto) {
  8821. const { pinia, store, options: { persist = auto } } = context;
  8822. if (!persist)
  8823. return;
  8824. if (!(store.$id in pinia.state.value)) {
  8825. const originalStore = pinia._s.get(store.$id.replace("__hot:", ""));
  8826. if (originalStore)
  8827. Promise.resolve().then(() => originalStore.$persist());
  8828. return;
  8829. }
  8830. const persistenceOptions = Array.isArray(persist) ? persist : persist === true ? [{}] : [persist];
  8831. const persistences = persistenceOptions.map(optionsParser);
  8832. store.$hydrate = ({ runHooks = true } = {}) => {
  8833. persistences.forEach((p2) => {
  8834. hydrateStore(store, p2, context, runHooks);
  8835. });
  8836. };
  8837. store.$persist = () => {
  8838. persistences.forEach((p2) => {
  8839. persistState(store.$state, p2);
  8840. });
  8841. };
  8842. persistences.forEach((p2) => {
  8843. hydrateStore(store, p2, context);
  8844. store.$subscribe(
  8845. (_mutation, state) => persistState(state, p2),
  8846. { detached: true }
  8847. );
  8848. });
  8849. }
  8850. function createPersistedState(options = {}) {
  8851. return function(context) {
  8852. createPersistence(
  8853. context,
  8854. (p2) => ({
  8855. key: (options.key ? options.key : (x) => x)(p2.key ?? context.store.$id),
  8856. debug: p2.debug ?? options.debug ?? false,
  8857. serializer: p2.serializer ?? options.serializer ?? {
  8858. serialize: (data) => JSON.stringify(data),
  8859. deserialize: (data) => destr(data)
  8860. },
  8861. storage: p2.storage ?? options.storage ?? window.localStorage,
  8862. beforeHydrate: p2.beforeHydrate,
  8863. afterHydrate: p2.afterHydrate,
  8864. pick: p2.pick,
  8865. omit: p2.omit
  8866. }),
  8867. options.auto ?? false
  8868. );
  8869. };
  8870. }
  8871. var src_default = createPersistedState();
  8872. const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
  8873. !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
  8874. };
  8875. const onPageScroll = /* @__PURE__ */ createHook(ON_PAGE_SCROLL);
  8876. exports._export_sfc = _export_sfc;
  8877. exports.computed = computed;
  8878. exports.createPinia = createPinia;
  8879. exports.createSSRApp = createSSRApp;
  8880. exports.defineStore = defineStore;
  8881. exports.e = e;
  8882. exports.f = f;
  8883. exports.index = index;
  8884. exports.initVueI18n = initVueI18n;
  8885. exports.n = n;
  8886. exports.nextTick$1 = nextTick$1;
  8887. exports.o = o;
  8888. exports.onMounted = onMounted;
  8889. exports.onPageScroll = onPageScroll;
  8890. exports.p = p;
  8891. exports.r = r;
  8892. exports.reactive = reactive;
  8893. exports.ref = ref;
  8894. exports.resolveComponent = resolveComponent;
  8895. exports.s = s;
  8896. exports.sr = sr;
  8897. exports.src_default = src_default;
  8898. exports.storeToRefs = storeToRefs;
  8899. exports.t = t;
  8900. exports.unref = unref;
  8901. exports.w = w;