runtime-core.esm-bundler.js 230 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740
  1. import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
  2. export { EffectScope, ReactiveEffect, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
  3. import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, capitalize, isGloballyWhitelisted, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';
  4. export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
  5. const stack = [];
  6. function pushWarningContext(vnode) {
  7. stack.push(vnode);
  8. }
  9. function popWarningContext() {
  10. stack.pop();
  11. }
  12. function warn(msg, ...args) {
  13. if (!!!(process.env.NODE_ENV !== "production"))
  14. return;
  15. pauseTracking();
  16. const instance = stack.length ? stack[stack.length - 1].component : null;
  17. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  18. const trace = getComponentTrace();
  19. if (appWarnHandler) {
  20. callWithErrorHandling(
  21. appWarnHandler,
  22. instance,
  23. 11,
  24. [
  25. msg + args.join(""),
  26. instance && instance.proxy,
  27. trace.map(
  28. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  29. ).join("\n"),
  30. trace
  31. ]
  32. );
  33. } else {
  34. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  35. if (trace.length && // avoid spamming console during tests
  36. true) {
  37. warnArgs.push(`
  38. `, ...formatTrace(trace));
  39. }
  40. console.warn(...warnArgs);
  41. }
  42. resetTracking();
  43. }
  44. function getComponentTrace() {
  45. let currentVNode = stack[stack.length - 1];
  46. if (!currentVNode) {
  47. return [];
  48. }
  49. const normalizedStack = [];
  50. while (currentVNode) {
  51. const last = normalizedStack[0];
  52. if (last && last.vnode === currentVNode) {
  53. last.recurseCount++;
  54. } else {
  55. normalizedStack.push({
  56. vnode: currentVNode,
  57. recurseCount: 0
  58. });
  59. }
  60. const parentInstance = currentVNode.component && currentVNode.component.parent;
  61. currentVNode = parentInstance && parentInstance.vnode;
  62. }
  63. return normalizedStack;
  64. }
  65. function formatTrace(trace) {
  66. const logs = [];
  67. trace.forEach((entry, i) => {
  68. logs.push(...i === 0 ? [] : [`
  69. `], ...formatTraceEntry(entry));
  70. });
  71. return logs;
  72. }
  73. function formatTraceEntry({ vnode, recurseCount }) {
  74. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  75. const isRoot = vnode.component ? vnode.component.parent == null : false;
  76. const open = ` at <${formatComponentName(
  77. vnode.component,
  78. vnode.type,
  79. isRoot
  80. )}`;
  81. const close = `>` + postfix;
  82. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  83. }
  84. function formatProps(props) {
  85. const res = [];
  86. const keys = Object.keys(props);
  87. keys.slice(0, 3).forEach((key) => {
  88. res.push(...formatProp(key, props[key]));
  89. });
  90. if (keys.length > 3) {
  91. res.push(` ...`);
  92. }
  93. return res;
  94. }
  95. function formatProp(key, value, raw) {
  96. if (isString(value)) {
  97. value = JSON.stringify(value);
  98. return raw ? value : [`${key}=${value}`];
  99. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  100. return raw ? value : [`${key}=${value}`];
  101. } else if (isRef(value)) {
  102. value = formatProp(key, toRaw(value.value), true);
  103. return raw ? value : [`${key}=Ref<`, value, `>`];
  104. } else if (isFunction(value)) {
  105. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  106. } else {
  107. value = toRaw(value);
  108. return raw ? value : [`${key}=`, value];
  109. }
  110. }
  111. function assertNumber(val, type) {
  112. if (!!!(process.env.NODE_ENV !== "production"))
  113. return;
  114. if (val === void 0) {
  115. return;
  116. } else if (typeof val !== "number") {
  117. warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  118. } else if (isNaN(val)) {
  119. warn(`${type} is NaN - the duration expression might be incorrect.`);
  120. }
  121. }
  122. const ErrorTypeStrings = {
  123. ["sp"]: "serverPrefetch hook",
  124. ["bc"]: "beforeCreate hook",
  125. ["c"]: "created hook",
  126. ["bm"]: "beforeMount hook",
  127. ["m"]: "mounted hook",
  128. ["bu"]: "beforeUpdate hook",
  129. ["u"]: "updated",
  130. ["bum"]: "beforeUnmount hook",
  131. ["um"]: "unmounted hook",
  132. ["a"]: "activated hook",
  133. ["da"]: "deactivated hook",
  134. ["ec"]: "errorCaptured hook",
  135. ["rtc"]: "renderTracked hook",
  136. ["rtg"]: "renderTriggered hook",
  137. [0]: "setup function",
  138. [1]: "render function",
  139. [2]: "watcher getter",
  140. [3]: "watcher callback",
  141. [4]: "watcher cleanup function",
  142. [5]: "native event handler",
  143. [6]: "component event handler",
  144. [7]: "vnode hook",
  145. [8]: "directive hook",
  146. [9]: "transition hook",
  147. [10]: "app errorHandler",
  148. [11]: "app warnHandler",
  149. [12]: "ref function",
  150. [13]: "async component loader",
  151. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  152. };
  153. function callWithErrorHandling(fn, instance, type, args) {
  154. let res;
  155. try {
  156. res = args ? fn(...args) : fn();
  157. } catch (err) {
  158. handleError(err, instance, type);
  159. }
  160. return res;
  161. }
  162. function callWithAsyncErrorHandling(fn, instance, type, args) {
  163. if (isFunction(fn)) {
  164. const res = callWithErrorHandling(fn, instance, type, args);
  165. if (res && isPromise(res)) {
  166. res.catch((err) => {
  167. handleError(err, instance, type);
  168. });
  169. }
  170. return res;
  171. }
  172. const values = [];
  173. for (let i = 0; i < fn.length; i++) {
  174. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  175. }
  176. return values;
  177. }
  178. function handleError(err, instance, type, throwInDev = true) {
  179. const contextVNode = instance ? instance.vnode : null;
  180. if (instance) {
  181. let cur = instance.parent;
  182. const exposedInstance = instance.proxy;
  183. const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : type;
  184. while (cur) {
  185. const errorCapturedHooks = cur.ec;
  186. if (errorCapturedHooks) {
  187. for (let i = 0; i < errorCapturedHooks.length; i++) {
  188. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  189. return;
  190. }
  191. }
  192. }
  193. cur = cur.parent;
  194. }
  195. const appErrorHandler = instance.appContext.config.errorHandler;
  196. if (appErrorHandler) {
  197. callWithErrorHandling(
  198. appErrorHandler,
  199. null,
  200. 10,
  201. [err, exposedInstance, errorInfo]
  202. );
  203. return;
  204. }
  205. }
  206. logError(err, type, contextVNode, throwInDev);
  207. }
  208. function logError(err, type, contextVNode, throwInDev = true) {
  209. if (!!(process.env.NODE_ENV !== "production")) {
  210. const info = ErrorTypeStrings[type];
  211. if (contextVNode) {
  212. pushWarningContext(contextVNode);
  213. }
  214. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  215. if (contextVNode) {
  216. popWarningContext();
  217. }
  218. if (throwInDev) {
  219. throw err;
  220. } else {
  221. console.error(err);
  222. }
  223. } else {
  224. console.error(err);
  225. }
  226. }
  227. let isFlushing = false;
  228. let isFlushPending = false;
  229. const queue = [];
  230. let flushIndex = 0;
  231. const pendingPostFlushCbs = [];
  232. let activePostFlushCbs = null;
  233. let postFlushIndex = 0;
  234. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  235. let currentFlushPromise = null;
  236. const RECURSION_LIMIT = 100;
  237. function nextTick(fn) {
  238. const p = currentFlushPromise || resolvedPromise;
  239. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  240. }
  241. function findInsertionIndex(id) {
  242. let start = flushIndex + 1;
  243. let end = queue.length;
  244. while (start < end) {
  245. const middle = start + end >>> 1;
  246. const middleJobId = getId(queue[middle]);
  247. middleJobId < id ? start = middle + 1 : end = middle;
  248. }
  249. return start;
  250. }
  251. function queueJob(job) {
  252. if (!queue.length || !queue.includes(
  253. job,
  254. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  255. )) {
  256. if (job.id == null) {
  257. queue.push(job);
  258. } else {
  259. queue.splice(findInsertionIndex(job.id), 0, job);
  260. }
  261. queueFlush();
  262. }
  263. }
  264. function queueFlush() {
  265. if (!isFlushing && !isFlushPending) {
  266. isFlushPending = true;
  267. currentFlushPromise = resolvedPromise.then(flushJobs);
  268. }
  269. }
  270. function invalidateJob(job) {
  271. const i = queue.indexOf(job);
  272. if (i > flushIndex) {
  273. queue.splice(i, 1);
  274. }
  275. }
  276. function queuePostFlushCb(cb) {
  277. if (!isArray(cb)) {
  278. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  279. cb,
  280. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  281. )) {
  282. pendingPostFlushCbs.push(cb);
  283. }
  284. } else {
  285. pendingPostFlushCbs.push(...cb);
  286. }
  287. queueFlush();
  288. }
  289. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  290. if (!!(process.env.NODE_ENV !== "production")) {
  291. seen = seen || /* @__PURE__ */ new Map();
  292. }
  293. for (; i < queue.length; i++) {
  294. const cb = queue[i];
  295. if (cb && cb.pre) {
  296. if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
  297. continue;
  298. }
  299. queue.splice(i, 1);
  300. i--;
  301. cb();
  302. }
  303. }
  304. }
  305. function flushPostFlushCbs(seen) {
  306. if (pendingPostFlushCbs.length) {
  307. const deduped = [...new Set(pendingPostFlushCbs)];
  308. pendingPostFlushCbs.length = 0;
  309. if (activePostFlushCbs) {
  310. activePostFlushCbs.push(...deduped);
  311. return;
  312. }
  313. activePostFlushCbs = deduped;
  314. if (!!(process.env.NODE_ENV !== "production")) {
  315. seen = seen || /* @__PURE__ */ new Map();
  316. }
  317. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  318. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  319. if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  320. continue;
  321. }
  322. activePostFlushCbs[postFlushIndex]();
  323. }
  324. activePostFlushCbs = null;
  325. postFlushIndex = 0;
  326. }
  327. }
  328. const getId = (job) => job.id == null ? Infinity : job.id;
  329. const comparator = (a, b) => {
  330. const diff = getId(a) - getId(b);
  331. if (diff === 0) {
  332. if (a.pre && !b.pre)
  333. return -1;
  334. if (b.pre && !a.pre)
  335. return 1;
  336. }
  337. return diff;
  338. };
  339. function flushJobs(seen) {
  340. isFlushPending = false;
  341. isFlushing = true;
  342. if (!!(process.env.NODE_ENV !== "production")) {
  343. seen = seen || /* @__PURE__ */ new Map();
  344. }
  345. queue.sort(comparator);
  346. const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
  347. try {
  348. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  349. const job = queue[flushIndex];
  350. if (job && job.active !== false) {
  351. if (!!(process.env.NODE_ENV !== "production") && check(job)) {
  352. continue;
  353. }
  354. callWithErrorHandling(job, null, 14);
  355. }
  356. }
  357. } finally {
  358. flushIndex = 0;
  359. queue.length = 0;
  360. flushPostFlushCbs(seen);
  361. isFlushing = false;
  362. currentFlushPromise = null;
  363. if (queue.length || pendingPostFlushCbs.length) {
  364. flushJobs(seen);
  365. }
  366. }
  367. }
  368. function checkRecursiveUpdates(seen, fn) {
  369. if (!seen.has(fn)) {
  370. seen.set(fn, 1);
  371. } else {
  372. const count = seen.get(fn);
  373. if (count > RECURSION_LIMIT) {
  374. const instance = fn.ownerInstance;
  375. const componentName = instance && getComponentName(instance.type);
  376. warn(
  377. `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.`
  378. );
  379. return true;
  380. } else {
  381. seen.set(fn, count + 1);
  382. }
  383. }
  384. }
  385. let isHmrUpdating = false;
  386. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  387. if (!!(process.env.NODE_ENV !== "production")) {
  388. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  389. createRecord: tryWrap(createRecord),
  390. rerender: tryWrap(rerender),
  391. reload: tryWrap(reload)
  392. };
  393. }
  394. const map = /* @__PURE__ */ new Map();
  395. function registerHMR(instance) {
  396. const id = instance.type.__hmrId;
  397. let record = map.get(id);
  398. if (!record) {
  399. createRecord(id, instance.type);
  400. record = map.get(id);
  401. }
  402. record.instances.add(instance);
  403. }
  404. function unregisterHMR(instance) {
  405. map.get(instance.type.__hmrId).instances.delete(instance);
  406. }
  407. function createRecord(id, initialDef) {
  408. if (map.has(id)) {
  409. return false;
  410. }
  411. map.set(id, {
  412. initialDef: normalizeClassComponent(initialDef),
  413. instances: /* @__PURE__ */ new Set()
  414. });
  415. return true;
  416. }
  417. function normalizeClassComponent(component) {
  418. return isClassComponent(component) ? component.__vccOpts : component;
  419. }
  420. function rerender(id, newRender) {
  421. const record = map.get(id);
  422. if (!record) {
  423. return;
  424. }
  425. record.initialDef.render = newRender;
  426. [...record.instances].forEach((instance) => {
  427. if (newRender) {
  428. instance.render = newRender;
  429. normalizeClassComponent(instance.type).render = newRender;
  430. }
  431. instance.renderCache = [];
  432. isHmrUpdating = true;
  433. instance.update();
  434. isHmrUpdating = false;
  435. });
  436. }
  437. function reload(id, newComp) {
  438. const record = map.get(id);
  439. if (!record)
  440. return;
  441. newComp = normalizeClassComponent(newComp);
  442. updateComponentDef(record.initialDef, newComp);
  443. const instances = [...record.instances];
  444. for (const instance of instances) {
  445. const oldComp = normalizeClassComponent(instance.type);
  446. if (!hmrDirtyComponents.has(oldComp)) {
  447. if (oldComp !== record.initialDef) {
  448. updateComponentDef(oldComp, newComp);
  449. }
  450. hmrDirtyComponents.add(oldComp);
  451. }
  452. instance.appContext.propsCache.delete(instance.type);
  453. instance.appContext.emitsCache.delete(instance.type);
  454. instance.appContext.optionsCache.delete(instance.type);
  455. if (instance.ceReload) {
  456. hmrDirtyComponents.add(oldComp);
  457. instance.ceReload(newComp.styles);
  458. hmrDirtyComponents.delete(oldComp);
  459. } else if (instance.parent) {
  460. queueJob(instance.parent.update);
  461. } else if (instance.appContext.reload) {
  462. instance.appContext.reload();
  463. } else if (typeof window !== "undefined") {
  464. window.location.reload();
  465. } else {
  466. console.warn(
  467. "[HMR] Root or manually mounted instance modified. Full reload required."
  468. );
  469. }
  470. }
  471. queuePostFlushCb(() => {
  472. for (const instance of instances) {
  473. hmrDirtyComponents.delete(
  474. normalizeClassComponent(instance.type)
  475. );
  476. }
  477. });
  478. }
  479. function updateComponentDef(oldComp, newComp) {
  480. extend(oldComp, newComp);
  481. for (const key in oldComp) {
  482. if (key !== "__file" && !(key in newComp)) {
  483. delete oldComp[key];
  484. }
  485. }
  486. }
  487. function tryWrap(fn) {
  488. return (id, arg) => {
  489. try {
  490. return fn(id, arg);
  491. } catch (e) {
  492. console.error(e);
  493. console.warn(
  494. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  495. );
  496. }
  497. };
  498. }
  499. let devtools;
  500. let buffer = [];
  501. let devtoolsNotInstalled = false;
  502. function emit$1(event, ...args) {
  503. if (devtools) {
  504. devtools.emit(event, ...args);
  505. } else if (!devtoolsNotInstalled) {
  506. buffer.push({ event, args });
  507. }
  508. }
  509. function setDevtoolsHook(hook, target) {
  510. var _a, _b;
  511. devtools = hook;
  512. if (devtools) {
  513. devtools.enabled = true;
  514. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  515. buffer = [];
  516. } else if (
  517. // handle late devtools injection - only do this if we are in an actual
  518. // browser environment to avoid the timer handle stalling test runner exit
  519. // (#4815)
  520. typeof window !== "undefined" && // some envs mock window but not fully
  521. window.HTMLElement && // also exclude jsdom
  522. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  523. ) {
  524. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  525. replay.push((newHook) => {
  526. setDevtoolsHook(newHook, target);
  527. });
  528. setTimeout(() => {
  529. if (!devtools) {
  530. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  531. devtoolsNotInstalled = true;
  532. buffer = [];
  533. }
  534. }, 3e3);
  535. } else {
  536. devtoolsNotInstalled = true;
  537. buffer = [];
  538. }
  539. }
  540. function devtoolsInitApp(app, version) {
  541. emit$1("app:init" /* APP_INIT */, app, version, {
  542. Fragment,
  543. Text,
  544. Comment,
  545. Static
  546. });
  547. }
  548. function devtoolsUnmountApp(app) {
  549. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  550. }
  551. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  552. "component:added" /* COMPONENT_ADDED */
  553. );
  554. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  555. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  556. "component:removed" /* COMPONENT_REMOVED */
  557. );
  558. const devtoolsComponentRemoved = (component) => {
  559. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  560. !devtools.cleanupBuffer(component)) {
  561. _devtoolsComponentRemoved(component);
  562. }
  563. };
  564. function createDevtoolsComponentHook(hook) {
  565. return (component) => {
  566. emit$1(
  567. hook,
  568. component.appContext.app,
  569. component.uid,
  570. component.parent ? component.parent.uid : void 0,
  571. component
  572. );
  573. };
  574. }
  575. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  576. "perf:start" /* PERFORMANCE_START */
  577. );
  578. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  579. "perf:end" /* PERFORMANCE_END */
  580. );
  581. function createDevtoolsPerformanceHook(hook) {
  582. return (component, type, time) => {
  583. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  584. };
  585. }
  586. function devtoolsComponentEmit(component, event, params) {
  587. emit$1(
  588. "component:emit" /* COMPONENT_EMIT */,
  589. component.appContext.app,
  590. component,
  591. event,
  592. params
  593. );
  594. }
  595. function emit(instance, event, ...rawArgs) {
  596. if (instance.isUnmounted)
  597. return;
  598. const props = instance.vnode.props || EMPTY_OBJ;
  599. if (!!(process.env.NODE_ENV !== "production")) {
  600. const {
  601. emitsOptions,
  602. propsOptions: [propsOptions]
  603. } = instance;
  604. if (emitsOptions) {
  605. if (!(event in emitsOptions) && true) {
  606. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  607. warn(
  608. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  609. );
  610. }
  611. } else {
  612. const validator = emitsOptions[event];
  613. if (isFunction(validator)) {
  614. const isValid = validator(...rawArgs);
  615. if (!isValid) {
  616. warn(
  617. `Invalid event arguments: event validation failed for event "${event}".`
  618. );
  619. }
  620. }
  621. }
  622. }
  623. }
  624. let args = rawArgs;
  625. const isModelListener = event.startsWith("update:");
  626. const modelArg = isModelListener && event.slice(7);
  627. if (modelArg && modelArg in props) {
  628. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  629. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  630. if (trim) {
  631. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  632. }
  633. if (number) {
  634. args = rawArgs.map(looseToNumber);
  635. }
  636. }
  637. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  638. devtoolsComponentEmit(instance, event, args);
  639. }
  640. if (!!(process.env.NODE_ENV !== "production")) {
  641. const lowerCaseEvent = event.toLowerCase();
  642. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  643. warn(
  644. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  645. instance,
  646. instance.type
  647. )} 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(event)}" instead of "${event}".`
  648. );
  649. }
  650. }
  651. let handlerName;
  652. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  653. props[handlerName = toHandlerKey(camelize(event))];
  654. if (!handler && isModelListener) {
  655. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  656. }
  657. if (handler) {
  658. callWithAsyncErrorHandling(
  659. handler,
  660. instance,
  661. 6,
  662. args
  663. );
  664. }
  665. const onceHandler = props[handlerName + `Once`];
  666. if (onceHandler) {
  667. if (!instance.emitted) {
  668. instance.emitted = {};
  669. } else if (instance.emitted[handlerName]) {
  670. return;
  671. }
  672. instance.emitted[handlerName] = true;
  673. callWithAsyncErrorHandling(
  674. onceHandler,
  675. instance,
  676. 6,
  677. args
  678. );
  679. }
  680. }
  681. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  682. const cache = appContext.emitsCache;
  683. const cached = cache.get(comp);
  684. if (cached !== void 0) {
  685. return cached;
  686. }
  687. const raw = comp.emits;
  688. let normalized = {};
  689. let hasExtends = false;
  690. if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
  691. const extendEmits = (raw2) => {
  692. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  693. if (normalizedFromExtend) {
  694. hasExtends = true;
  695. extend(normalized, normalizedFromExtend);
  696. }
  697. };
  698. if (!asMixin && appContext.mixins.length) {
  699. appContext.mixins.forEach(extendEmits);
  700. }
  701. if (comp.extends) {
  702. extendEmits(comp.extends);
  703. }
  704. if (comp.mixins) {
  705. comp.mixins.forEach(extendEmits);
  706. }
  707. }
  708. if (!raw && !hasExtends) {
  709. if (isObject(comp)) {
  710. cache.set(comp, null);
  711. }
  712. return null;
  713. }
  714. if (isArray(raw)) {
  715. raw.forEach((key) => normalized[key] = null);
  716. } else {
  717. extend(normalized, raw);
  718. }
  719. if (isObject(comp)) {
  720. cache.set(comp, normalized);
  721. }
  722. return normalized;
  723. }
  724. function isEmitListener(options, key) {
  725. if (!options || !isOn(key)) {
  726. return false;
  727. }
  728. key = key.slice(2).replace(/Once$/, "");
  729. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  730. }
  731. let currentRenderingInstance = null;
  732. let currentScopeId = null;
  733. function setCurrentRenderingInstance(instance) {
  734. const prev = currentRenderingInstance;
  735. currentRenderingInstance = instance;
  736. currentScopeId = instance && instance.type.__scopeId || null;
  737. return prev;
  738. }
  739. function pushScopeId(id) {
  740. currentScopeId = id;
  741. }
  742. function popScopeId() {
  743. currentScopeId = null;
  744. }
  745. const withScopeId = (_id) => withCtx;
  746. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  747. if (!ctx)
  748. return fn;
  749. if (fn._n) {
  750. return fn;
  751. }
  752. const renderFnWithContext = (...args) => {
  753. if (renderFnWithContext._d) {
  754. setBlockTracking(-1);
  755. }
  756. const prevInstance = setCurrentRenderingInstance(ctx);
  757. let res;
  758. try {
  759. res = fn(...args);
  760. } finally {
  761. setCurrentRenderingInstance(prevInstance);
  762. if (renderFnWithContext._d) {
  763. setBlockTracking(1);
  764. }
  765. }
  766. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  767. devtoolsComponentUpdated(ctx);
  768. }
  769. return res;
  770. };
  771. renderFnWithContext._n = true;
  772. renderFnWithContext._c = true;
  773. renderFnWithContext._d = true;
  774. return renderFnWithContext;
  775. }
  776. let accessedAttrs = false;
  777. function markAttrsAccessed() {
  778. accessedAttrs = true;
  779. }
  780. function renderComponentRoot(instance) {
  781. const {
  782. type: Component,
  783. vnode,
  784. proxy,
  785. withProxy,
  786. props,
  787. propsOptions: [propsOptions],
  788. slots,
  789. attrs,
  790. emit,
  791. render,
  792. renderCache,
  793. data,
  794. setupState,
  795. ctx,
  796. inheritAttrs
  797. } = instance;
  798. let result;
  799. let fallthroughAttrs;
  800. const prev = setCurrentRenderingInstance(instance);
  801. if (!!(process.env.NODE_ENV !== "production")) {
  802. accessedAttrs = false;
  803. }
  804. try {
  805. if (vnode.shapeFlag & 4) {
  806. const proxyToUse = withProxy || proxy;
  807. result = normalizeVNode(
  808. render.call(
  809. proxyToUse,
  810. proxyToUse,
  811. renderCache,
  812. props,
  813. setupState,
  814. data,
  815. ctx
  816. )
  817. );
  818. fallthroughAttrs = attrs;
  819. } else {
  820. const render2 = Component;
  821. if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
  822. markAttrsAccessed();
  823. }
  824. result = normalizeVNode(
  825. render2.length > 1 ? render2(
  826. props,
  827. !!(process.env.NODE_ENV !== "production") ? {
  828. get attrs() {
  829. markAttrsAccessed();
  830. return attrs;
  831. },
  832. slots,
  833. emit
  834. } : { attrs, slots, emit }
  835. ) : render2(
  836. props,
  837. null
  838. /* we know it doesn't need it */
  839. )
  840. );
  841. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  842. }
  843. } catch (err) {
  844. blockStack.length = 0;
  845. handleError(err, instance, 1);
  846. result = createVNode(Comment);
  847. }
  848. let root = result;
  849. let setRoot = void 0;
  850. if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
  851. [root, setRoot] = getChildRoot(result);
  852. }
  853. if (fallthroughAttrs && inheritAttrs !== false) {
  854. const keys = Object.keys(fallthroughAttrs);
  855. const { shapeFlag } = root;
  856. if (keys.length) {
  857. if (shapeFlag & (1 | 6)) {
  858. if (propsOptions && keys.some(isModelListener)) {
  859. fallthroughAttrs = filterModelListeners(
  860. fallthroughAttrs,
  861. propsOptions
  862. );
  863. }
  864. root = cloneVNode(root, fallthroughAttrs);
  865. } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
  866. const allAttrs = Object.keys(attrs);
  867. const eventAttrs = [];
  868. const extraAttrs = [];
  869. for (let i = 0, l = allAttrs.length; i < l; i++) {
  870. const key = allAttrs[i];
  871. if (isOn(key)) {
  872. if (!isModelListener(key)) {
  873. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  874. }
  875. } else {
  876. extraAttrs.push(key);
  877. }
  878. }
  879. if (extraAttrs.length) {
  880. warn(
  881. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  882. );
  883. }
  884. if (eventAttrs.length) {
  885. warn(
  886. `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
  887. );
  888. }
  889. }
  890. }
  891. }
  892. if (vnode.dirs) {
  893. if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
  894. warn(
  895. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  896. );
  897. }
  898. root = cloneVNode(root);
  899. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  900. }
  901. if (vnode.transition) {
  902. if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
  903. warn(
  904. `Component inside <Transition> renders non-element root node that cannot be animated.`
  905. );
  906. }
  907. root.transition = vnode.transition;
  908. }
  909. if (!!(process.env.NODE_ENV !== "production") && setRoot) {
  910. setRoot(root);
  911. } else {
  912. result = root;
  913. }
  914. setCurrentRenderingInstance(prev);
  915. return result;
  916. }
  917. const getChildRoot = (vnode) => {
  918. const rawChildren = vnode.children;
  919. const dynamicChildren = vnode.dynamicChildren;
  920. const childRoot = filterSingleRoot(rawChildren);
  921. if (!childRoot) {
  922. return [vnode, void 0];
  923. }
  924. const index = rawChildren.indexOf(childRoot);
  925. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  926. const setRoot = (updatedRoot) => {
  927. rawChildren[index] = updatedRoot;
  928. if (dynamicChildren) {
  929. if (dynamicIndex > -1) {
  930. dynamicChildren[dynamicIndex] = updatedRoot;
  931. } else if (updatedRoot.patchFlag > 0) {
  932. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  933. }
  934. }
  935. };
  936. return [normalizeVNode(childRoot), setRoot];
  937. };
  938. function filterSingleRoot(children) {
  939. let singleRoot;
  940. for (let i = 0; i < children.length; i++) {
  941. const child = children[i];
  942. if (isVNode(child)) {
  943. if (child.type !== Comment || child.children === "v-if") {
  944. if (singleRoot) {
  945. return;
  946. } else {
  947. singleRoot = child;
  948. }
  949. }
  950. } else {
  951. return;
  952. }
  953. }
  954. return singleRoot;
  955. }
  956. const getFunctionalFallthrough = (attrs) => {
  957. let res;
  958. for (const key in attrs) {
  959. if (key === "class" || key === "style" || isOn(key)) {
  960. (res || (res = {}))[key] = attrs[key];
  961. }
  962. }
  963. return res;
  964. };
  965. const filterModelListeners = (attrs, props) => {
  966. const res = {};
  967. for (const key in attrs) {
  968. if (!isModelListener(key) || !(key.slice(9) in props)) {
  969. res[key] = attrs[key];
  970. }
  971. }
  972. return res;
  973. };
  974. const isElementRoot = (vnode) => {
  975. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  976. };
  977. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  978. const { props: prevProps, children: prevChildren, component } = prevVNode;
  979. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  980. const emits = component.emitsOptions;
  981. if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
  982. return true;
  983. }
  984. if (nextVNode.dirs || nextVNode.transition) {
  985. return true;
  986. }
  987. if (optimized && patchFlag >= 0) {
  988. if (patchFlag & 1024) {
  989. return true;
  990. }
  991. if (patchFlag & 16) {
  992. if (!prevProps) {
  993. return !!nextProps;
  994. }
  995. return hasPropsChanged(prevProps, nextProps, emits);
  996. } else if (patchFlag & 8) {
  997. const dynamicProps = nextVNode.dynamicProps;
  998. for (let i = 0; i < dynamicProps.length; i++) {
  999. const key = dynamicProps[i];
  1000. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  1001. return true;
  1002. }
  1003. }
  1004. }
  1005. } else {
  1006. if (prevChildren || nextChildren) {
  1007. if (!nextChildren || !nextChildren.$stable) {
  1008. return true;
  1009. }
  1010. }
  1011. if (prevProps === nextProps) {
  1012. return false;
  1013. }
  1014. if (!prevProps) {
  1015. return !!nextProps;
  1016. }
  1017. if (!nextProps) {
  1018. return true;
  1019. }
  1020. return hasPropsChanged(prevProps, nextProps, emits);
  1021. }
  1022. return false;
  1023. }
  1024. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  1025. const nextKeys = Object.keys(nextProps);
  1026. if (nextKeys.length !== Object.keys(prevProps).length) {
  1027. return true;
  1028. }
  1029. for (let i = 0; i < nextKeys.length; i++) {
  1030. const key = nextKeys[i];
  1031. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  1032. return true;
  1033. }
  1034. }
  1035. return false;
  1036. }
  1037. function updateHOCHostEl({ vnode, parent }, el) {
  1038. while (parent && parent.subTree === vnode) {
  1039. (vnode = parent.vnode).el = el;
  1040. parent = parent.parent;
  1041. }
  1042. }
  1043. const isSuspense = (type) => type.__isSuspense;
  1044. const SuspenseImpl = {
  1045. name: "Suspense",
  1046. // In order to make Suspense tree-shakable, we need to avoid importing it
  1047. // directly in the renderer. The renderer checks for the __isSuspense flag
  1048. // on a vnode's type and calls the `process` method, passing in renderer
  1049. // internals.
  1050. __isSuspense: true,
  1051. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  1052. if (n1 == null) {
  1053. mountSuspense(
  1054. n2,
  1055. container,
  1056. anchor,
  1057. parentComponent,
  1058. parentSuspense,
  1059. isSVG,
  1060. slotScopeIds,
  1061. optimized,
  1062. rendererInternals
  1063. );
  1064. } else {
  1065. patchSuspense(
  1066. n1,
  1067. n2,
  1068. container,
  1069. anchor,
  1070. parentComponent,
  1071. isSVG,
  1072. slotScopeIds,
  1073. optimized,
  1074. rendererInternals
  1075. );
  1076. }
  1077. },
  1078. hydrate: hydrateSuspense,
  1079. create: createSuspenseBoundary,
  1080. normalize: normalizeSuspenseChildren
  1081. };
  1082. const Suspense = SuspenseImpl ;
  1083. function triggerEvent(vnode, name) {
  1084. const eventListener = vnode.props && vnode.props[name];
  1085. if (isFunction(eventListener)) {
  1086. eventListener();
  1087. }
  1088. }
  1089. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  1090. const {
  1091. p: patch,
  1092. o: { createElement }
  1093. } = rendererInternals;
  1094. const hiddenContainer = createElement("div");
  1095. const suspense = vnode.suspense = createSuspenseBoundary(
  1096. vnode,
  1097. parentSuspense,
  1098. parentComponent,
  1099. container,
  1100. hiddenContainer,
  1101. anchor,
  1102. isSVG,
  1103. slotScopeIds,
  1104. optimized,
  1105. rendererInternals
  1106. );
  1107. patch(
  1108. null,
  1109. suspense.pendingBranch = vnode.ssContent,
  1110. hiddenContainer,
  1111. null,
  1112. parentComponent,
  1113. suspense,
  1114. isSVG,
  1115. slotScopeIds
  1116. );
  1117. if (suspense.deps > 0) {
  1118. triggerEvent(vnode, "onPending");
  1119. triggerEvent(vnode, "onFallback");
  1120. patch(
  1121. null,
  1122. vnode.ssFallback,
  1123. container,
  1124. anchor,
  1125. parentComponent,
  1126. null,
  1127. // fallback tree will not have suspense context
  1128. isSVG,
  1129. slotScopeIds
  1130. );
  1131. setActiveBranch(suspense, vnode.ssFallback);
  1132. } else {
  1133. suspense.resolve(false, true);
  1134. }
  1135. }
  1136. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  1137. const suspense = n2.suspense = n1.suspense;
  1138. suspense.vnode = n2;
  1139. n2.el = n1.el;
  1140. const newBranch = n2.ssContent;
  1141. const newFallback = n2.ssFallback;
  1142. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  1143. if (pendingBranch) {
  1144. suspense.pendingBranch = newBranch;
  1145. if (isSameVNodeType(newBranch, pendingBranch)) {
  1146. patch(
  1147. pendingBranch,
  1148. newBranch,
  1149. suspense.hiddenContainer,
  1150. null,
  1151. parentComponent,
  1152. suspense,
  1153. isSVG,
  1154. slotScopeIds,
  1155. optimized
  1156. );
  1157. if (suspense.deps <= 0) {
  1158. suspense.resolve();
  1159. } else if (isInFallback) {
  1160. patch(
  1161. activeBranch,
  1162. newFallback,
  1163. container,
  1164. anchor,
  1165. parentComponent,
  1166. null,
  1167. // fallback tree will not have suspense context
  1168. isSVG,
  1169. slotScopeIds,
  1170. optimized
  1171. );
  1172. setActiveBranch(suspense, newFallback);
  1173. }
  1174. } else {
  1175. suspense.pendingId++;
  1176. if (isHydrating) {
  1177. suspense.isHydrating = false;
  1178. suspense.activeBranch = pendingBranch;
  1179. } else {
  1180. unmount(pendingBranch, parentComponent, suspense);
  1181. }
  1182. suspense.deps = 0;
  1183. suspense.effects.length = 0;
  1184. suspense.hiddenContainer = createElement("div");
  1185. if (isInFallback) {
  1186. patch(
  1187. null,
  1188. newBranch,
  1189. suspense.hiddenContainer,
  1190. null,
  1191. parentComponent,
  1192. suspense,
  1193. isSVG,
  1194. slotScopeIds,
  1195. optimized
  1196. );
  1197. if (suspense.deps <= 0) {
  1198. suspense.resolve();
  1199. } else {
  1200. patch(
  1201. activeBranch,
  1202. newFallback,
  1203. container,
  1204. anchor,
  1205. parentComponent,
  1206. null,
  1207. // fallback tree will not have suspense context
  1208. isSVG,
  1209. slotScopeIds,
  1210. optimized
  1211. );
  1212. setActiveBranch(suspense, newFallback);
  1213. }
  1214. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  1215. patch(
  1216. activeBranch,
  1217. newBranch,
  1218. container,
  1219. anchor,
  1220. parentComponent,
  1221. suspense,
  1222. isSVG,
  1223. slotScopeIds,
  1224. optimized
  1225. );
  1226. suspense.resolve(true);
  1227. } else {
  1228. patch(
  1229. null,
  1230. newBranch,
  1231. suspense.hiddenContainer,
  1232. null,
  1233. parentComponent,
  1234. suspense,
  1235. isSVG,
  1236. slotScopeIds,
  1237. optimized
  1238. );
  1239. if (suspense.deps <= 0) {
  1240. suspense.resolve();
  1241. }
  1242. }
  1243. }
  1244. } else {
  1245. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  1246. patch(
  1247. activeBranch,
  1248. newBranch,
  1249. container,
  1250. anchor,
  1251. parentComponent,
  1252. suspense,
  1253. isSVG,
  1254. slotScopeIds,
  1255. optimized
  1256. );
  1257. setActiveBranch(suspense, newBranch);
  1258. } else {
  1259. triggerEvent(n2, "onPending");
  1260. suspense.pendingBranch = newBranch;
  1261. suspense.pendingId++;
  1262. patch(
  1263. null,
  1264. newBranch,
  1265. suspense.hiddenContainer,
  1266. null,
  1267. parentComponent,
  1268. suspense,
  1269. isSVG,
  1270. slotScopeIds,
  1271. optimized
  1272. );
  1273. if (suspense.deps <= 0) {
  1274. suspense.resolve();
  1275. } else {
  1276. const { timeout, pendingId } = suspense;
  1277. if (timeout > 0) {
  1278. setTimeout(() => {
  1279. if (suspense.pendingId === pendingId) {
  1280. suspense.fallback(newFallback);
  1281. }
  1282. }, timeout);
  1283. } else if (timeout === 0) {
  1284. suspense.fallback(newFallback);
  1285. }
  1286. }
  1287. }
  1288. }
  1289. }
  1290. let hasWarned = false;
  1291. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  1292. if (!!(process.env.NODE_ENV !== "production") && true && !hasWarned) {
  1293. hasWarned = true;
  1294. console[console.info ? "info" : "log"](
  1295. `<Suspense> is an experimental feature and its API will likely change.`
  1296. );
  1297. }
  1298. const {
  1299. p: patch,
  1300. m: move,
  1301. um: unmount,
  1302. n: next,
  1303. o: { parentNode, remove }
  1304. } = rendererInternals;
  1305. let parentSuspenseId;
  1306. const isSuspensible = isVNodeSuspensible(vnode);
  1307. if (isSuspensible) {
  1308. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  1309. parentSuspenseId = parentSuspense.pendingId;
  1310. parentSuspense.deps++;
  1311. }
  1312. }
  1313. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  1314. if (!!(process.env.NODE_ENV !== "production")) {
  1315. assertNumber(timeout, `Suspense timeout`);
  1316. }
  1317. const suspense = {
  1318. vnode,
  1319. parent: parentSuspense,
  1320. parentComponent,
  1321. isSVG,
  1322. container,
  1323. hiddenContainer,
  1324. anchor,
  1325. deps: 0,
  1326. pendingId: 0,
  1327. timeout: typeof timeout === "number" ? timeout : -1,
  1328. activeBranch: null,
  1329. pendingBranch: null,
  1330. isInFallback: true,
  1331. isHydrating,
  1332. isUnmounted: false,
  1333. effects: [],
  1334. resolve(resume = false, sync = false) {
  1335. if (!!(process.env.NODE_ENV !== "production")) {
  1336. if (!resume && !suspense.pendingBranch) {
  1337. throw new Error(
  1338. `suspense.resolve() is called without a pending branch.`
  1339. );
  1340. }
  1341. if (suspense.isUnmounted) {
  1342. throw new Error(
  1343. `suspense.resolve() is called on an already unmounted suspense boundary.`
  1344. );
  1345. }
  1346. }
  1347. const {
  1348. vnode: vnode2,
  1349. activeBranch,
  1350. pendingBranch,
  1351. pendingId,
  1352. effects,
  1353. parentComponent: parentComponent2,
  1354. container: container2
  1355. } = suspense;
  1356. if (suspense.isHydrating) {
  1357. suspense.isHydrating = false;
  1358. } else if (!resume) {
  1359. const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  1360. if (delayEnter) {
  1361. activeBranch.transition.afterLeave = () => {
  1362. if (pendingId === suspense.pendingId) {
  1363. move(pendingBranch, container2, anchor2, 0);
  1364. }
  1365. };
  1366. }
  1367. let { anchor: anchor2 } = suspense;
  1368. if (activeBranch) {
  1369. anchor2 = next(activeBranch);
  1370. unmount(activeBranch, parentComponent2, suspense, true);
  1371. }
  1372. if (!delayEnter) {
  1373. move(pendingBranch, container2, anchor2, 0);
  1374. }
  1375. }
  1376. setActiveBranch(suspense, pendingBranch);
  1377. suspense.pendingBranch = null;
  1378. suspense.isInFallback = false;
  1379. let parent = suspense.parent;
  1380. let hasUnresolvedAncestor = false;
  1381. while (parent) {
  1382. if (parent.pendingBranch) {
  1383. parent.effects.push(...effects);
  1384. hasUnresolvedAncestor = true;
  1385. break;
  1386. }
  1387. parent = parent.parent;
  1388. }
  1389. if (!hasUnresolvedAncestor) {
  1390. queuePostFlushCb(effects);
  1391. }
  1392. suspense.effects = [];
  1393. if (isSuspensible) {
  1394. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  1395. parentSuspense.deps--;
  1396. if (parentSuspense.deps === 0 && !sync) {
  1397. parentSuspense.resolve();
  1398. }
  1399. }
  1400. }
  1401. triggerEvent(vnode2, "onResolve");
  1402. },
  1403. fallback(fallbackVNode) {
  1404. if (!suspense.pendingBranch) {
  1405. return;
  1406. }
  1407. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  1408. triggerEvent(vnode2, "onFallback");
  1409. const anchor2 = next(activeBranch);
  1410. const mountFallback = () => {
  1411. if (!suspense.isInFallback) {
  1412. return;
  1413. }
  1414. patch(
  1415. null,
  1416. fallbackVNode,
  1417. container2,
  1418. anchor2,
  1419. parentComponent2,
  1420. null,
  1421. // fallback tree will not have suspense context
  1422. isSVG2,
  1423. slotScopeIds,
  1424. optimized
  1425. );
  1426. setActiveBranch(suspense, fallbackVNode);
  1427. };
  1428. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  1429. if (delayEnter) {
  1430. activeBranch.transition.afterLeave = mountFallback;
  1431. }
  1432. suspense.isInFallback = true;
  1433. unmount(
  1434. activeBranch,
  1435. parentComponent2,
  1436. null,
  1437. // no suspense so unmount hooks fire now
  1438. true
  1439. // shouldRemove
  1440. );
  1441. if (!delayEnter) {
  1442. mountFallback();
  1443. }
  1444. },
  1445. move(container2, anchor2, type) {
  1446. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  1447. suspense.container = container2;
  1448. },
  1449. next() {
  1450. return suspense.activeBranch && next(suspense.activeBranch);
  1451. },
  1452. registerDep(instance, setupRenderEffect) {
  1453. const isInPendingSuspense = !!suspense.pendingBranch;
  1454. if (isInPendingSuspense) {
  1455. suspense.deps++;
  1456. }
  1457. const hydratedEl = instance.vnode.el;
  1458. instance.asyncDep.catch((err) => {
  1459. handleError(err, instance, 0);
  1460. }).then((asyncSetupResult) => {
  1461. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  1462. return;
  1463. }
  1464. instance.asyncResolved = true;
  1465. const { vnode: vnode2 } = instance;
  1466. if (!!(process.env.NODE_ENV !== "production")) {
  1467. pushWarningContext(vnode2);
  1468. }
  1469. handleSetupResult(instance, asyncSetupResult, false);
  1470. if (hydratedEl) {
  1471. vnode2.el = hydratedEl;
  1472. }
  1473. const placeholder = !hydratedEl && instance.subTree.el;
  1474. setupRenderEffect(
  1475. instance,
  1476. vnode2,
  1477. // component may have been moved before resolve.
  1478. // if this is not a hydration, instance.subTree will be the comment
  1479. // placeholder.
  1480. parentNode(hydratedEl || instance.subTree.el),
  1481. // anchor will not be used if this is hydration, so only need to
  1482. // consider the comment placeholder case.
  1483. hydratedEl ? null : next(instance.subTree),
  1484. suspense,
  1485. isSVG,
  1486. optimized
  1487. );
  1488. if (placeholder) {
  1489. remove(placeholder);
  1490. }
  1491. updateHOCHostEl(instance, vnode2.el);
  1492. if (!!(process.env.NODE_ENV !== "production")) {
  1493. popWarningContext();
  1494. }
  1495. if (isInPendingSuspense && --suspense.deps === 0) {
  1496. suspense.resolve();
  1497. }
  1498. });
  1499. },
  1500. unmount(parentSuspense2, doRemove) {
  1501. suspense.isUnmounted = true;
  1502. if (suspense.activeBranch) {
  1503. unmount(
  1504. suspense.activeBranch,
  1505. parentComponent,
  1506. parentSuspense2,
  1507. doRemove
  1508. );
  1509. }
  1510. if (suspense.pendingBranch) {
  1511. unmount(
  1512. suspense.pendingBranch,
  1513. parentComponent,
  1514. parentSuspense2,
  1515. doRemove
  1516. );
  1517. }
  1518. }
  1519. };
  1520. return suspense;
  1521. }
  1522. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  1523. const suspense = vnode.suspense = createSuspenseBoundary(
  1524. vnode,
  1525. parentSuspense,
  1526. parentComponent,
  1527. node.parentNode,
  1528. document.createElement("div"),
  1529. null,
  1530. isSVG,
  1531. slotScopeIds,
  1532. optimized,
  1533. rendererInternals,
  1534. true
  1535. /* hydrating */
  1536. );
  1537. const result = hydrateNode(
  1538. node,
  1539. suspense.pendingBranch = vnode.ssContent,
  1540. parentComponent,
  1541. suspense,
  1542. slotScopeIds,
  1543. optimized
  1544. );
  1545. if (suspense.deps === 0) {
  1546. suspense.resolve(false, true);
  1547. }
  1548. return result;
  1549. }
  1550. function normalizeSuspenseChildren(vnode) {
  1551. const { shapeFlag, children } = vnode;
  1552. const isSlotChildren = shapeFlag & 32;
  1553. vnode.ssContent = normalizeSuspenseSlot(
  1554. isSlotChildren ? children.default : children
  1555. );
  1556. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  1557. }
  1558. function normalizeSuspenseSlot(s) {
  1559. let block;
  1560. if (isFunction(s)) {
  1561. const trackBlock = isBlockTreeEnabled && s._c;
  1562. if (trackBlock) {
  1563. s._d = false;
  1564. openBlock();
  1565. }
  1566. s = s();
  1567. if (trackBlock) {
  1568. s._d = true;
  1569. block = currentBlock;
  1570. closeBlock();
  1571. }
  1572. }
  1573. if (isArray(s)) {
  1574. const singleChild = filterSingleRoot(s);
  1575. if (!!(process.env.NODE_ENV !== "production") && !singleChild) {
  1576. warn(`<Suspense> slots expect a single root node.`);
  1577. }
  1578. s = singleChild;
  1579. }
  1580. s = normalizeVNode(s);
  1581. if (block && !s.dynamicChildren) {
  1582. s.dynamicChildren = block.filter((c) => c !== s);
  1583. }
  1584. return s;
  1585. }
  1586. function queueEffectWithSuspense(fn, suspense) {
  1587. if (suspense && suspense.pendingBranch) {
  1588. if (isArray(fn)) {
  1589. suspense.effects.push(...fn);
  1590. } else {
  1591. suspense.effects.push(fn);
  1592. }
  1593. } else {
  1594. queuePostFlushCb(fn);
  1595. }
  1596. }
  1597. function setActiveBranch(suspense, branch) {
  1598. suspense.activeBranch = branch;
  1599. const { vnode, parentComponent } = suspense;
  1600. const el = vnode.el = branch.el;
  1601. if (parentComponent && parentComponent.subTree === vnode) {
  1602. parentComponent.vnode.el = el;
  1603. updateHOCHostEl(parentComponent, el);
  1604. }
  1605. }
  1606. function isVNodeSuspensible(vnode) {
  1607. var _a;
  1608. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  1609. }
  1610. function watchEffect(effect, options) {
  1611. return doWatch(effect, null, options);
  1612. }
  1613. function watchPostEffect(effect, options) {
  1614. return doWatch(
  1615. effect,
  1616. null,
  1617. !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "post" }) : { flush: "post" }
  1618. );
  1619. }
  1620. function watchSyncEffect(effect, options) {
  1621. return doWatch(
  1622. effect,
  1623. null,
  1624. !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
  1625. );
  1626. }
  1627. const INITIAL_WATCHER_VALUE = {};
  1628. function watch(source, cb, options) {
  1629. if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
  1630. warn(
  1631. `\`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.`
  1632. );
  1633. }
  1634. return doWatch(source, cb, options);
  1635. }
  1636. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  1637. var _a;
  1638. if (!!(process.env.NODE_ENV !== "production") && !cb) {
  1639. if (immediate !== void 0) {
  1640. warn(
  1641. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  1642. );
  1643. }
  1644. if (deep !== void 0) {
  1645. warn(
  1646. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  1647. );
  1648. }
  1649. }
  1650. const warnInvalidSource = (s) => {
  1651. warn(
  1652. `Invalid watch source: `,
  1653. s,
  1654. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  1655. );
  1656. };
  1657. const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  1658. let getter;
  1659. let forceTrigger = false;
  1660. let isMultiSource = false;
  1661. if (isRef(source)) {
  1662. getter = () => source.value;
  1663. forceTrigger = isShallow$1(source);
  1664. } else if (isReactive(source)) {
  1665. getter = () => source;
  1666. deep = true;
  1667. } else if (isArray(source)) {
  1668. isMultiSource = true;
  1669. forceTrigger = source.some((s) => isReactive(s) || isShallow$1(s));
  1670. getter = () => source.map((s) => {
  1671. if (isRef(s)) {
  1672. return s.value;
  1673. } else if (isReactive(s)) {
  1674. return traverse(s);
  1675. } else if (isFunction(s)) {
  1676. return callWithErrorHandling(s, instance, 2);
  1677. } else {
  1678. !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
  1679. }
  1680. });
  1681. } else if (isFunction(source)) {
  1682. if (cb) {
  1683. getter = () => callWithErrorHandling(source, instance, 2);
  1684. } else {
  1685. getter = () => {
  1686. if (instance && instance.isUnmounted) {
  1687. return;
  1688. }
  1689. if (cleanup) {
  1690. cleanup();
  1691. }
  1692. return callWithAsyncErrorHandling(
  1693. source,
  1694. instance,
  1695. 3,
  1696. [onCleanup]
  1697. );
  1698. };
  1699. }
  1700. } else {
  1701. getter = NOOP;
  1702. !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
  1703. }
  1704. if (cb && deep) {
  1705. const baseGetter = getter;
  1706. getter = () => traverse(baseGetter());
  1707. }
  1708. let cleanup;
  1709. let onCleanup = (fn) => {
  1710. cleanup = effect.onStop = () => {
  1711. callWithErrorHandling(fn, instance, 4);
  1712. };
  1713. };
  1714. let ssrCleanup;
  1715. if (isInSSRComponentSetup) {
  1716. onCleanup = NOOP;
  1717. if (!cb) {
  1718. getter();
  1719. } else if (immediate) {
  1720. callWithAsyncErrorHandling(cb, instance, 3, [
  1721. getter(),
  1722. isMultiSource ? [] : void 0,
  1723. onCleanup
  1724. ]);
  1725. }
  1726. if (flush === "sync") {
  1727. const ctx = useSSRContext();
  1728. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  1729. } else {
  1730. return NOOP;
  1731. }
  1732. }
  1733. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1734. const job = () => {
  1735. if (!effect.active) {
  1736. return;
  1737. }
  1738. if (cb) {
  1739. const newValue = effect.run();
  1740. if (deep || forceTrigger || (isMultiSource ? newValue.some(
  1741. (v, i) => hasChanged(v, oldValue[i])
  1742. ) : hasChanged(newValue, oldValue)) || false) {
  1743. if (cleanup) {
  1744. cleanup();
  1745. }
  1746. callWithAsyncErrorHandling(cb, instance, 3, [
  1747. newValue,
  1748. // pass undefined as the old value when it's changed for the first time
  1749. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1750. onCleanup
  1751. ]);
  1752. oldValue = newValue;
  1753. }
  1754. } else {
  1755. effect.run();
  1756. }
  1757. };
  1758. job.allowRecurse = !!cb;
  1759. let scheduler;
  1760. if (flush === "sync") {
  1761. scheduler = job;
  1762. } else if (flush === "post") {
  1763. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  1764. } else {
  1765. job.pre = true;
  1766. if (instance)
  1767. job.id = instance.uid;
  1768. scheduler = () => queueJob(job);
  1769. }
  1770. const effect = new ReactiveEffect(getter, scheduler);
  1771. if (!!(process.env.NODE_ENV !== "production")) {
  1772. effect.onTrack = onTrack;
  1773. effect.onTrigger = onTrigger;
  1774. }
  1775. if (cb) {
  1776. if (immediate) {
  1777. job();
  1778. } else {
  1779. oldValue = effect.run();
  1780. }
  1781. } else if (flush === "post") {
  1782. queuePostRenderEffect(
  1783. effect.run.bind(effect),
  1784. instance && instance.suspense
  1785. );
  1786. } else {
  1787. effect.run();
  1788. }
  1789. const unwatch = () => {
  1790. effect.stop();
  1791. if (instance && instance.scope) {
  1792. remove(instance.scope.effects, effect);
  1793. }
  1794. };
  1795. if (ssrCleanup)
  1796. ssrCleanup.push(unwatch);
  1797. return unwatch;
  1798. }
  1799. function instanceWatch(source, value, options) {
  1800. const publicThis = this.proxy;
  1801. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  1802. let cb;
  1803. if (isFunction(value)) {
  1804. cb = value;
  1805. } else {
  1806. cb = value.handler;
  1807. options = value;
  1808. }
  1809. const cur = currentInstance;
  1810. setCurrentInstance(this);
  1811. const res = doWatch(getter, cb.bind(publicThis), options);
  1812. if (cur) {
  1813. setCurrentInstance(cur);
  1814. } else {
  1815. unsetCurrentInstance();
  1816. }
  1817. return res;
  1818. }
  1819. function createPathGetter(ctx, path) {
  1820. const segments = path.split(".");
  1821. return () => {
  1822. let cur = ctx;
  1823. for (let i = 0; i < segments.length && cur; i++) {
  1824. cur = cur[segments[i]];
  1825. }
  1826. return cur;
  1827. };
  1828. }
  1829. function traverse(value, seen) {
  1830. if (!isObject(value) || value["__v_skip"]) {
  1831. return value;
  1832. }
  1833. seen = seen || /* @__PURE__ */ new Set();
  1834. if (seen.has(value)) {
  1835. return value;
  1836. }
  1837. seen.add(value);
  1838. if (isRef(value)) {
  1839. traverse(value.value, seen);
  1840. } else if (isArray(value)) {
  1841. for (let i = 0; i < value.length; i++) {
  1842. traverse(value[i], seen);
  1843. }
  1844. } else if (isSet(value) || isMap(value)) {
  1845. value.forEach((v) => {
  1846. traverse(v, seen);
  1847. });
  1848. } else if (isPlainObject(value)) {
  1849. for (const key in value) {
  1850. traverse(value[key], seen);
  1851. }
  1852. }
  1853. return value;
  1854. }
  1855. function validateDirectiveName(name) {
  1856. if (isBuiltInDirective(name)) {
  1857. warn("Do not use built-in directive ids as custom directive id: " + name);
  1858. }
  1859. }
  1860. function withDirectives(vnode, directives) {
  1861. const internalInstance = currentRenderingInstance;
  1862. if (internalInstance === null) {
  1863. !!(process.env.NODE_ENV !== "production") && warn(`withDirectives can only be used inside render functions.`);
  1864. return vnode;
  1865. }
  1866. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  1867. const bindings = vnode.dirs || (vnode.dirs = []);
  1868. for (let i = 0; i < directives.length; i++) {
  1869. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  1870. if (dir) {
  1871. if (isFunction(dir)) {
  1872. dir = {
  1873. mounted: dir,
  1874. updated: dir
  1875. };
  1876. }
  1877. if (dir.deep) {
  1878. traverse(value);
  1879. }
  1880. bindings.push({
  1881. dir,
  1882. instance,
  1883. value,
  1884. oldValue: void 0,
  1885. arg,
  1886. modifiers
  1887. });
  1888. }
  1889. }
  1890. return vnode;
  1891. }
  1892. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  1893. const bindings = vnode.dirs;
  1894. const oldBindings = prevVNode && prevVNode.dirs;
  1895. for (let i = 0; i < bindings.length; i++) {
  1896. const binding = bindings[i];
  1897. if (oldBindings) {
  1898. binding.oldValue = oldBindings[i].value;
  1899. }
  1900. let hook = binding.dir[name];
  1901. if (hook) {
  1902. pauseTracking();
  1903. callWithAsyncErrorHandling(hook, instance, 8, [
  1904. vnode.el,
  1905. binding,
  1906. vnode,
  1907. prevVNode
  1908. ]);
  1909. resetTracking();
  1910. }
  1911. }
  1912. }
  1913. function useTransitionState() {
  1914. const state = {
  1915. isMounted: false,
  1916. isLeaving: false,
  1917. isUnmounting: false,
  1918. leavingVNodes: /* @__PURE__ */ new Map()
  1919. };
  1920. onMounted(() => {
  1921. state.isMounted = true;
  1922. });
  1923. onBeforeUnmount(() => {
  1924. state.isUnmounting = true;
  1925. });
  1926. return state;
  1927. }
  1928. const TransitionHookValidator = [Function, Array];
  1929. const BaseTransitionPropsValidators = {
  1930. mode: String,
  1931. appear: Boolean,
  1932. persisted: Boolean,
  1933. // enter
  1934. onBeforeEnter: TransitionHookValidator,
  1935. onEnter: TransitionHookValidator,
  1936. onAfterEnter: TransitionHookValidator,
  1937. onEnterCancelled: TransitionHookValidator,
  1938. // leave
  1939. onBeforeLeave: TransitionHookValidator,
  1940. onLeave: TransitionHookValidator,
  1941. onAfterLeave: TransitionHookValidator,
  1942. onLeaveCancelled: TransitionHookValidator,
  1943. // appear
  1944. onBeforeAppear: TransitionHookValidator,
  1945. onAppear: TransitionHookValidator,
  1946. onAfterAppear: TransitionHookValidator,
  1947. onAppearCancelled: TransitionHookValidator
  1948. };
  1949. const BaseTransitionImpl = {
  1950. name: `BaseTransition`,
  1951. props: BaseTransitionPropsValidators,
  1952. setup(props, { slots }) {
  1953. const instance = getCurrentInstance();
  1954. const state = useTransitionState();
  1955. let prevTransitionKey;
  1956. return () => {
  1957. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  1958. if (!children || !children.length) {
  1959. return;
  1960. }
  1961. let child = children[0];
  1962. if (children.length > 1) {
  1963. let hasFound = false;
  1964. for (const c of children) {
  1965. if (c.type !== Comment) {
  1966. if (!!(process.env.NODE_ENV !== "production") && hasFound) {
  1967. warn(
  1968. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  1969. );
  1970. break;
  1971. }
  1972. child = c;
  1973. hasFound = true;
  1974. if (!!!(process.env.NODE_ENV !== "production"))
  1975. break;
  1976. }
  1977. }
  1978. }
  1979. const rawProps = toRaw(props);
  1980. const { mode } = rawProps;
  1981. if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  1982. warn(`invalid <transition> mode: ${mode}`);
  1983. }
  1984. if (state.isLeaving) {
  1985. return emptyPlaceholder(child);
  1986. }
  1987. const innerChild = getKeepAliveChild(child);
  1988. if (!innerChild) {
  1989. return emptyPlaceholder(child);
  1990. }
  1991. const enterHooks = resolveTransitionHooks(
  1992. innerChild,
  1993. rawProps,
  1994. state,
  1995. instance
  1996. );
  1997. setTransitionHooks(innerChild, enterHooks);
  1998. const oldChild = instance.subTree;
  1999. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2000. let transitionKeyChanged = false;
  2001. const { getTransitionKey } = innerChild.type;
  2002. if (getTransitionKey) {
  2003. const key = getTransitionKey();
  2004. if (prevTransitionKey === void 0) {
  2005. prevTransitionKey = key;
  2006. } else if (key !== prevTransitionKey) {
  2007. prevTransitionKey = key;
  2008. transitionKeyChanged = true;
  2009. }
  2010. }
  2011. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  2012. const leavingHooks = resolveTransitionHooks(
  2013. oldInnerChild,
  2014. rawProps,
  2015. state,
  2016. instance
  2017. );
  2018. setTransitionHooks(oldInnerChild, leavingHooks);
  2019. if (mode === "out-in") {
  2020. state.isLeaving = true;
  2021. leavingHooks.afterLeave = () => {
  2022. state.isLeaving = false;
  2023. if (instance.update.active !== false) {
  2024. instance.update();
  2025. }
  2026. };
  2027. return emptyPlaceholder(child);
  2028. } else if (mode === "in-out" && innerChild.type !== Comment) {
  2029. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2030. const leavingVNodesCache = getLeavingNodesForType(
  2031. state,
  2032. oldInnerChild
  2033. );
  2034. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2035. el._leaveCb = () => {
  2036. earlyRemove();
  2037. el._leaveCb = void 0;
  2038. delete enterHooks.delayedLeave;
  2039. };
  2040. enterHooks.delayedLeave = delayedLeave;
  2041. };
  2042. }
  2043. }
  2044. return child;
  2045. };
  2046. }
  2047. };
  2048. const BaseTransition = BaseTransitionImpl;
  2049. function getLeavingNodesForType(state, vnode) {
  2050. const { leavingVNodes } = state;
  2051. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  2052. if (!leavingVNodesCache) {
  2053. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  2054. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2055. }
  2056. return leavingVNodesCache;
  2057. }
  2058. function resolveTransitionHooks(vnode, props, state, instance) {
  2059. const {
  2060. appear,
  2061. mode,
  2062. persisted = false,
  2063. onBeforeEnter,
  2064. onEnter,
  2065. onAfterEnter,
  2066. onEnterCancelled,
  2067. onBeforeLeave,
  2068. onLeave,
  2069. onAfterLeave,
  2070. onLeaveCancelled,
  2071. onBeforeAppear,
  2072. onAppear,
  2073. onAfterAppear,
  2074. onAppearCancelled
  2075. } = props;
  2076. const key = String(vnode.key);
  2077. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2078. const callHook = (hook, args) => {
  2079. hook && callWithAsyncErrorHandling(
  2080. hook,
  2081. instance,
  2082. 9,
  2083. args
  2084. );
  2085. };
  2086. const callAsyncHook = (hook, args) => {
  2087. const done = args[1];
  2088. callHook(hook, args);
  2089. if (isArray(hook)) {
  2090. if (hook.every((hook2) => hook2.length <= 1))
  2091. done();
  2092. } else if (hook.length <= 1) {
  2093. done();
  2094. }
  2095. };
  2096. const hooks = {
  2097. mode,
  2098. persisted,
  2099. beforeEnter(el) {
  2100. let hook = onBeforeEnter;
  2101. if (!state.isMounted) {
  2102. if (appear) {
  2103. hook = onBeforeAppear || onBeforeEnter;
  2104. } else {
  2105. return;
  2106. }
  2107. }
  2108. if (el._leaveCb) {
  2109. el._leaveCb(
  2110. true
  2111. /* cancelled */
  2112. );
  2113. }
  2114. const leavingVNode = leavingVNodesCache[key];
  2115. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  2116. leavingVNode.el._leaveCb();
  2117. }
  2118. callHook(hook, [el]);
  2119. },
  2120. enter(el) {
  2121. let hook = onEnter;
  2122. let afterHook = onAfterEnter;
  2123. let cancelHook = onEnterCancelled;
  2124. if (!state.isMounted) {
  2125. if (appear) {
  2126. hook = onAppear || onEnter;
  2127. afterHook = onAfterAppear || onAfterEnter;
  2128. cancelHook = onAppearCancelled || onEnterCancelled;
  2129. } else {
  2130. return;
  2131. }
  2132. }
  2133. let called = false;
  2134. const done = el._enterCb = (cancelled) => {
  2135. if (called)
  2136. return;
  2137. called = true;
  2138. if (cancelled) {
  2139. callHook(cancelHook, [el]);
  2140. } else {
  2141. callHook(afterHook, [el]);
  2142. }
  2143. if (hooks.delayedLeave) {
  2144. hooks.delayedLeave();
  2145. }
  2146. el._enterCb = void 0;
  2147. };
  2148. if (hook) {
  2149. callAsyncHook(hook, [el, done]);
  2150. } else {
  2151. done();
  2152. }
  2153. },
  2154. leave(el, remove) {
  2155. const key2 = String(vnode.key);
  2156. if (el._enterCb) {
  2157. el._enterCb(
  2158. true
  2159. /* cancelled */
  2160. );
  2161. }
  2162. if (state.isUnmounting) {
  2163. return remove();
  2164. }
  2165. callHook(onBeforeLeave, [el]);
  2166. let called = false;
  2167. const done = el._leaveCb = (cancelled) => {
  2168. if (called)
  2169. return;
  2170. called = true;
  2171. remove();
  2172. if (cancelled) {
  2173. callHook(onLeaveCancelled, [el]);
  2174. } else {
  2175. callHook(onAfterLeave, [el]);
  2176. }
  2177. el._leaveCb = void 0;
  2178. if (leavingVNodesCache[key2] === vnode) {
  2179. delete leavingVNodesCache[key2];
  2180. }
  2181. };
  2182. leavingVNodesCache[key2] = vnode;
  2183. if (onLeave) {
  2184. callAsyncHook(onLeave, [el, done]);
  2185. } else {
  2186. done();
  2187. }
  2188. },
  2189. clone(vnode2) {
  2190. return resolveTransitionHooks(vnode2, props, state, instance);
  2191. }
  2192. };
  2193. return hooks;
  2194. }
  2195. function emptyPlaceholder(vnode) {
  2196. if (isKeepAlive(vnode)) {
  2197. vnode = cloneVNode(vnode);
  2198. vnode.children = null;
  2199. return vnode;
  2200. }
  2201. }
  2202. function getKeepAliveChild(vnode) {
  2203. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  2204. }
  2205. function setTransitionHooks(vnode, hooks) {
  2206. if (vnode.shapeFlag & 6 && vnode.component) {
  2207. setTransitionHooks(vnode.component.subTree, hooks);
  2208. } else if (vnode.shapeFlag & 128) {
  2209. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2210. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2211. } else {
  2212. vnode.transition = hooks;
  2213. }
  2214. }
  2215. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  2216. let ret = [];
  2217. let keyedFragmentCount = 0;
  2218. for (let i = 0; i < children.length; i++) {
  2219. let child = children[i];
  2220. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2221. if (child.type === Fragment) {
  2222. if (child.patchFlag & 128)
  2223. keyedFragmentCount++;
  2224. ret = ret.concat(
  2225. getTransitionRawChildren(child.children, keepComment, key)
  2226. );
  2227. } else if (keepComment || child.type !== Comment) {
  2228. ret.push(key != null ? cloneVNode(child, { key }) : child);
  2229. }
  2230. }
  2231. if (keyedFragmentCount > 1) {
  2232. for (let i = 0; i < ret.length; i++) {
  2233. ret[i].patchFlag = -2;
  2234. }
  2235. }
  2236. return ret;
  2237. }
  2238. function defineComponent(options, extraOptions) {
  2239. return isFunction(options) ? (
  2240. // #8326: extend call and options.name access are considered side-effects
  2241. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  2242. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  2243. ) : options;
  2244. }
  2245. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2246. function defineAsyncComponent(source) {
  2247. if (isFunction(source)) {
  2248. source = { loader: source };
  2249. }
  2250. const {
  2251. loader,
  2252. loadingComponent,
  2253. errorComponent,
  2254. delay = 200,
  2255. timeout,
  2256. // undefined = never times out
  2257. suspensible = true,
  2258. onError: userOnError
  2259. } = source;
  2260. let pendingRequest = null;
  2261. let resolvedComp;
  2262. let retries = 0;
  2263. const retry = () => {
  2264. retries++;
  2265. pendingRequest = null;
  2266. return load();
  2267. };
  2268. const load = () => {
  2269. let thisRequest;
  2270. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  2271. err = err instanceof Error ? err : new Error(String(err));
  2272. if (userOnError) {
  2273. return new Promise((resolve, reject) => {
  2274. const userRetry = () => resolve(retry());
  2275. const userFail = () => reject(err);
  2276. userOnError(err, userRetry, userFail, retries + 1);
  2277. });
  2278. } else {
  2279. throw err;
  2280. }
  2281. }).then((comp) => {
  2282. if (thisRequest !== pendingRequest && pendingRequest) {
  2283. return pendingRequest;
  2284. }
  2285. if (!!(process.env.NODE_ENV !== "production") && !comp) {
  2286. warn(
  2287. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  2288. );
  2289. }
  2290. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  2291. comp = comp.default;
  2292. }
  2293. if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) {
  2294. throw new Error(`Invalid async component load result: ${comp}`);
  2295. }
  2296. resolvedComp = comp;
  2297. return comp;
  2298. }));
  2299. };
  2300. return defineComponent({
  2301. name: "AsyncComponentWrapper",
  2302. __asyncLoader: load,
  2303. get __asyncResolved() {
  2304. return resolvedComp;
  2305. },
  2306. setup() {
  2307. const instance = currentInstance;
  2308. if (resolvedComp) {
  2309. return () => createInnerComp(resolvedComp, instance);
  2310. }
  2311. const onError = (err) => {
  2312. pendingRequest = null;
  2313. handleError(
  2314. err,
  2315. instance,
  2316. 13,
  2317. !errorComponent
  2318. /* do not throw in dev if user provided error component */
  2319. );
  2320. };
  2321. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  2322. return load().then((comp) => {
  2323. return () => createInnerComp(comp, instance);
  2324. }).catch((err) => {
  2325. onError(err);
  2326. return () => errorComponent ? createVNode(errorComponent, {
  2327. error: err
  2328. }) : null;
  2329. });
  2330. }
  2331. const loaded = ref(false);
  2332. const error = ref();
  2333. const delayed = ref(!!delay);
  2334. if (delay) {
  2335. setTimeout(() => {
  2336. delayed.value = false;
  2337. }, delay);
  2338. }
  2339. if (timeout != null) {
  2340. setTimeout(() => {
  2341. if (!loaded.value && !error.value) {
  2342. const err = new Error(
  2343. `Async component timed out after ${timeout}ms.`
  2344. );
  2345. onError(err);
  2346. error.value = err;
  2347. }
  2348. }, timeout);
  2349. }
  2350. load().then(() => {
  2351. loaded.value = true;
  2352. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  2353. queueJob(instance.parent.update);
  2354. }
  2355. }).catch((err) => {
  2356. onError(err);
  2357. error.value = err;
  2358. });
  2359. return () => {
  2360. if (loaded.value && resolvedComp) {
  2361. return createInnerComp(resolvedComp, instance);
  2362. } else if (error.value && errorComponent) {
  2363. return createVNode(errorComponent, {
  2364. error: error.value
  2365. });
  2366. } else if (loadingComponent && !delayed.value) {
  2367. return createVNode(loadingComponent);
  2368. }
  2369. };
  2370. }
  2371. });
  2372. }
  2373. function createInnerComp(comp, parent) {
  2374. const { ref: ref2, props, children, ce } = parent.vnode;
  2375. const vnode = createVNode(comp, props, children);
  2376. vnode.ref = ref2;
  2377. vnode.ce = ce;
  2378. delete parent.vnode.ce;
  2379. return vnode;
  2380. }
  2381. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2382. const KeepAliveImpl = {
  2383. name: `KeepAlive`,
  2384. // Marker for special handling inside the renderer. We are not using a ===
  2385. // check directly on KeepAlive in the renderer, because importing it directly
  2386. // would prevent it from being tree-shaken.
  2387. __isKeepAlive: true,
  2388. props: {
  2389. include: [String, RegExp, Array],
  2390. exclude: [String, RegExp, Array],
  2391. max: [String, Number]
  2392. },
  2393. setup(props, { slots }) {
  2394. const instance = getCurrentInstance();
  2395. const sharedContext = instance.ctx;
  2396. if (!sharedContext.renderer) {
  2397. return () => {
  2398. const children = slots.default && slots.default();
  2399. return children && children.length === 1 ? children[0] : children;
  2400. };
  2401. }
  2402. const cache = /* @__PURE__ */ new Map();
  2403. const keys = /* @__PURE__ */ new Set();
  2404. let current = null;
  2405. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  2406. instance.__v_cache = cache;
  2407. }
  2408. const parentSuspense = instance.suspense;
  2409. const {
  2410. renderer: {
  2411. p: patch,
  2412. m: move,
  2413. um: _unmount,
  2414. o: { createElement }
  2415. }
  2416. } = sharedContext;
  2417. const storageContainer = createElement("div");
  2418. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  2419. const instance2 = vnode.component;
  2420. move(vnode, container, anchor, 0, parentSuspense);
  2421. patch(
  2422. instance2.vnode,
  2423. vnode,
  2424. container,
  2425. anchor,
  2426. instance2,
  2427. parentSuspense,
  2428. isSVG,
  2429. vnode.slotScopeIds,
  2430. optimized
  2431. );
  2432. queuePostRenderEffect(() => {
  2433. instance2.isDeactivated = false;
  2434. if (instance2.a) {
  2435. invokeArrayFns(instance2.a);
  2436. }
  2437. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  2438. if (vnodeHook) {
  2439. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2440. }
  2441. }, parentSuspense);
  2442. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  2443. devtoolsComponentAdded(instance2);
  2444. }
  2445. };
  2446. sharedContext.deactivate = (vnode) => {
  2447. const instance2 = vnode.component;
  2448. move(vnode, storageContainer, null, 1, parentSuspense);
  2449. queuePostRenderEffect(() => {
  2450. if (instance2.da) {
  2451. invokeArrayFns(instance2.da);
  2452. }
  2453. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  2454. if (vnodeHook) {
  2455. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2456. }
  2457. instance2.isDeactivated = true;
  2458. }, parentSuspense);
  2459. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  2460. devtoolsComponentAdded(instance2);
  2461. }
  2462. };
  2463. function unmount(vnode) {
  2464. resetShapeFlag(vnode);
  2465. _unmount(vnode, instance, parentSuspense, true);
  2466. }
  2467. function pruneCache(filter) {
  2468. cache.forEach((vnode, key) => {
  2469. const name = getComponentName(vnode.type);
  2470. if (name && (!filter || !filter(name))) {
  2471. pruneCacheEntry(key);
  2472. }
  2473. });
  2474. }
  2475. function pruneCacheEntry(key) {
  2476. const cached = cache.get(key);
  2477. if (!current || !isSameVNodeType(cached, current)) {
  2478. unmount(cached);
  2479. } else if (current) {
  2480. resetShapeFlag(current);
  2481. }
  2482. cache.delete(key);
  2483. keys.delete(key);
  2484. }
  2485. watch(
  2486. () => [props.include, props.exclude],
  2487. ([include, exclude]) => {
  2488. include && pruneCache((name) => matches(include, name));
  2489. exclude && pruneCache((name) => !matches(exclude, name));
  2490. },
  2491. // prune post-render after `current` has been updated
  2492. { flush: "post", deep: true }
  2493. );
  2494. let pendingCacheKey = null;
  2495. const cacheSubtree = () => {
  2496. if (pendingCacheKey != null) {
  2497. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2498. }
  2499. };
  2500. onMounted(cacheSubtree);
  2501. onUpdated(cacheSubtree);
  2502. onBeforeUnmount(() => {
  2503. cache.forEach((cached) => {
  2504. const { subTree, suspense } = instance;
  2505. const vnode = getInnerChild(subTree);
  2506. if (cached.type === vnode.type && cached.key === vnode.key) {
  2507. resetShapeFlag(vnode);
  2508. const da = vnode.component.da;
  2509. da && queuePostRenderEffect(da, suspense);
  2510. return;
  2511. }
  2512. unmount(cached);
  2513. });
  2514. });
  2515. return () => {
  2516. pendingCacheKey = null;
  2517. if (!slots.default) {
  2518. return null;
  2519. }
  2520. const children = slots.default();
  2521. const rawVNode = children[0];
  2522. if (children.length > 1) {
  2523. if (!!(process.env.NODE_ENV !== "production")) {
  2524. warn(`KeepAlive should contain exactly one component child.`);
  2525. }
  2526. current = null;
  2527. return children;
  2528. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2529. current = null;
  2530. return rawVNode;
  2531. }
  2532. let vnode = getInnerChild(rawVNode);
  2533. const comp = vnode.type;
  2534. const name = getComponentName(
  2535. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2536. );
  2537. const { include, exclude, max } = props;
  2538. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2539. current = vnode;
  2540. return rawVNode;
  2541. }
  2542. const key = vnode.key == null ? comp : vnode.key;
  2543. const cachedVNode = cache.get(key);
  2544. if (vnode.el) {
  2545. vnode = cloneVNode(vnode);
  2546. if (rawVNode.shapeFlag & 128) {
  2547. rawVNode.ssContent = vnode;
  2548. }
  2549. }
  2550. pendingCacheKey = key;
  2551. if (cachedVNode) {
  2552. vnode.el = cachedVNode.el;
  2553. vnode.component = cachedVNode.component;
  2554. if (vnode.transition) {
  2555. setTransitionHooks(vnode, vnode.transition);
  2556. }
  2557. vnode.shapeFlag |= 512;
  2558. keys.delete(key);
  2559. keys.add(key);
  2560. } else {
  2561. keys.add(key);
  2562. if (max && keys.size > parseInt(max, 10)) {
  2563. pruneCacheEntry(keys.values().next().value);
  2564. }
  2565. }
  2566. vnode.shapeFlag |= 256;
  2567. current = vnode;
  2568. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  2569. };
  2570. }
  2571. };
  2572. const KeepAlive = KeepAliveImpl;
  2573. function matches(pattern, name) {
  2574. if (isArray(pattern)) {
  2575. return pattern.some((p) => matches(p, name));
  2576. } else if (isString(pattern)) {
  2577. return pattern.split(",").includes(name);
  2578. } else if (isRegExp(pattern)) {
  2579. return pattern.test(name);
  2580. }
  2581. return false;
  2582. }
  2583. function onActivated(hook, target) {
  2584. registerKeepAliveHook(hook, "a", target);
  2585. }
  2586. function onDeactivated(hook, target) {
  2587. registerKeepAliveHook(hook, "da", target);
  2588. }
  2589. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2590. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2591. let current = target;
  2592. while (current) {
  2593. if (current.isDeactivated) {
  2594. return;
  2595. }
  2596. current = current.parent;
  2597. }
  2598. return hook();
  2599. });
  2600. injectHook(type, wrappedHook, target);
  2601. if (target) {
  2602. let current = target.parent;
  2603. while (current && current.parent) {
  2604. if (isKeepAlive(current.parent.vnode)) {
  2605. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2606. }
  2607. current = current.parent;
  2608. }
  2609. }
  2610. }
  2611. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2612. const injected = injectHook(
  2613. type,
  2614. hook,
  2615. keepAliveRoot,
  2616. true
  2617. /* prepend */
  2618. );
  2619. onUnmounted(() => {
  2620. remove(keepAliveRoot[type], injected);
  2621. }, target);
  2622. }
  2623. function resetShapeFlag(vnode) {
  2624. vnode.shapeFlag &= ~256;
  2625. vnode.shapeFlag &= ~512;
  2626. }
  2627. function getInnerChild(vnode) {
  2628. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  2629. }
  2630. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2631. if (target) {
  2632. const hooks = target[type] || (target[type] = []);
  2633. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2634. if (target.isUnmounted) {
  2635. return;
  2636. }
  2637. pauseTracking();
  2638. setCurrentInstance(target);
  2639. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2640. unsetCurrentInstance();
  2641. resetTracking();
  2642. return res;
  2643. });
  2644. if (prepend) {
  2645. hooks.unshift(wrappedHook);
  2646. } else {
  2647. hooks.push(wrappedHook);
  2648. }
  2649. return wrappedHook;
  2650. } else if (!!(process.env.NODE_ENV !== "production")) {
  2651. const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
  2652. warn(
  2653. `${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().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
  2654. );
  2655. }
  2656. }
  2657. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2658. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2659. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2660. );
  2661. const onBeforeMount = createHook("bm");
  2662. const onMounted = createHook("m");
  2663. const onBeforeUpdate = createHook("bu");
  2664. const onUpdated = createHook("u");
  2665. const onBeforeUnmount = createHook("bum");
  2666. const onUnmounted = createHook("um");
  2667. const onServerPrefetch = createHook("sp");
  2668. const onRenderTriggered = createHook(
  2669. "rtg"
  2670. );
  2671. const onRenderTracked = createHook(
  2672. "rtc"
  2673. );
  2674. function onErrorCaptured(hook, target = currentInstance) {
  2675. injectHook("ec", hook, target);
  2676. }
  2677. const COMPONENTS = "components";
  2678. const DIRECTIVES = "directives";
  2679. function resolveComponent(name, maybeSelfReference) {
  2680. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2681. }
  2682. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2683. function resolveDynamicComponent(component) {
  2684. if (isString(component)) {
  2685. return resolveAsset(COMPONENTS, component, false) || component;
  2686. } else {
  2687. return component || NULL_DYNAMIC_COMPONENT;
  2688. }
  2689. }
  2690. function resolveDirective(name) {
  2691. return resolveAsset(DIRECTIVES, name);
  2692. }
  2693. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2694. const instance = currentRenderingInstance || currentInstance;
  2695. if (instance) {
  2696. const Component = instance.type;
  2697. if (type === COMPONENTS) {
  2698. const selfName = getComponentName(
  2699. Component,
  2700. false
  2701. /* do not include inferred name to avoid breaking existing code */
  2702. );
  2703. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  2704. return Component;
  2705. }
  2706. }
  2707. const res = (
  2708. // local registration
  2709. // check instance[type] first which is resolved for options API
  2710. resolve(instance[type] || Component[type], name) || // global registration
  2711. resolve(instance.appContext[type], name)
  2712. );
  2713. if (!res && maybeSelfReference) {
  2714. return Component;
  2715. }
  2716. if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
  2717. const extra = type === COMPONENTS ? `
  2718. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2719. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2720. }
  2721. return res;
  2722. } else if (!!(process.env.NODE_ENV !== "production")) {
  2723. warn(
  2724. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2725. );
  2726. }
  2727. }
  2728. function resolve(registry, name) {
  2729. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  2730. }
  2731. function renderList(source, renderItem, cache, index) {
  2732. let ret;
  2733. const cached = cache && cache[index];
  2734. if (isArray(source) || isString(source)) {
  2735. ret = new Array(source.length);
  2736. for (let i = 0, l = source.length; i < l; i++) {
  2737. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  2738. }
  2739. } else if (typeof source === "number") {
  2740. if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
  2741. warn(`The v-for range expect an integer value but got ${source}.`);
  2742. }
  2743. ret = new Array(source);
  2744. for (let i = 0; i < source; i++) {
  2745. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  2746. }
  2747. } else if (isObject(source)) {
  2748. if (source[Symbol.iterator]) {
  2749. ret = Array.from(
  2750. source,
  2751. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  2752. );
  2753. } else {
  2754. const keys = Object.keys(source);
  2755. ret = new Array(keys.length);
  2756. for (let i = 0, l = keys.length; i < l; i++) {
  2757. const key = keys[i];
  2758. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  2759. }
  2760. }
  2761. } else {
  2762. ret = [];
  2763. }
  2764. if (cache) {
  2765. cache[index] = ret;
  2766. }
  2767. return ret;
  2768. }
  2769. function createSlots(slots, dynamicSlots) {
  2770. for (let i = 0; i < dynamicSlots.length; i++) {
  2771. const slot = dynamicSlots[i];
  2772. if (isArray(slot)) {
  2773. for (let j = 0; j < slot.length; j++) {
  2774. slots[slot[j].name] = slot[j].fn;
  2775. }
  2776. } else if (slot) {
  2777. slots[slot.name] = slot.key ? (...args) => {
  2778. const res = slot.fn(...args);
  2779. if (res)
  2780. res.key = slot.key;
  2781. return res;
  2782. } : slot.fn;
  2783. }
  2784. }
  2785. return slots;
  2786. }
  2787. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  2788. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  2789. if (name !== "default")
  2790. props.name = name;
  2791. return createVNode("slot", props, fallback && fallback());
  2792. }
  2793. let slot = slots[name];
  2794. if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
  2795. warn(
  2796. `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
  2797. );
  2798. slot = () => [];
  2799. }
  2800. if (slot && slot._c) {
  2801. slot._d = false;
  2802. }
  2803. openBlock();
  2804. const validSlotContent = slot && ensureValidVNode(slot(props));
  2805. const rendered = createBlock(
  2806. Fragment,
  2807. {
  2808. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  2809. // key attached in the `createSlots` helper, respect that
  2810. validSlotContent && validSlotContent.key || `_${name}`
  2811. },
  2812. validSlotContent || (fallback ? fallback() : []),
  2813. validSlotContent && slots._ === 1 ? 64 : -2
  2814. );
  2815. if (!noSlotted && rendered.scopeId) {
  2816. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  2817. }
  2818. if (slot && slot._c) {
  2819. slot._d = true;
  2820. }
  2821. return rendered;
  2822. }
  2823. function ensureValidVNode(vnodes) {
  2824. return vnodes.some((child) => {
  2825. if (!isVNode(child))
  2826. return true;
  2827. if (child.type === Comment)
  2828. return false;
  2829. if (child.type === Fragment && !ensureValidVNode(child.children))
  2830. return false;
  2831. return true;
  2832. }) ? vnodes : null;
  2833. }
  2834. function toHandlers(obj, preserveCaseIfNecessary) {
  2835. const ret = {};
  2836. if (!!(process.env.NODE_ENV !== "production") && !isObject(obj)) {
  2837. warn(`v-on with no argument expects an object value.`);
  2838. return ret;
  2839. }
  2840. for (const key in obj) {
  2841. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  2842. }
  2843. return ret;
  2844. }
  2845. const getPublicInstance = (i) => {
  2846. if (!i)
  2847. return null;
  2848. if (isStatefulComponent(i))
  2849. return getExposeProxy(i) || i.proxy;
  2850. return getPublicInstance(i.parent);
  2851. };
  2852. const publicPropertiesMap = (
  2853. // Move PURE marker to new line to workaround compiler discarding it
  2854. // due to type annotation
  2855. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  2856. $: (i) => i,
  2857. $el: (i) => i.vnode.el,
  2858. $data: (i) => i.data,
  2859. $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
  2860. $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
  2861. $slots: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.slots) : i.slots,
  2862. $refs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.refs) : i.refs,
  2863. $parent: (i) => getPublicInstance(i.parent),
  2864. $root: (i) => getPublicInstance(i.root),
  2865. $emit: (i) => i.emit,
  2866. $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
  2867. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  2868. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  2869. $watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
  2870. })
  2871. );
  2872. const isReservedPrefix = (key) => key === "_" || key === "$";
  2873. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  2874. const PublicInstanceProxyHandlers = {
  2875. get({ _: instance }, key) {
  2876. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2877. if (!!(process.env.NODE_ENV !== "production") && key === "__isVue") {
  2878. return true;
  2879. }
  2880. let normalizedProps;
  2881. if (key[0] !== "$") {
  2882. const n = accessCache[key];
  2883. if (n !== void 0) {
  2884. switch (n) {
  2885. case 1 /* SETUP */:
  2886. return setupState[key];
  2887. case 2 /* DATA */:
  2888. return data[key];
  2889. case 4 /* CONTEXT */:
  2890. return ctx[key];
  2891. case 3 /* PROPS */:
  2892. return props[key];
  2893. }
  2894. } else if (hasSetupBinding(setupState, key)) {
  2895. accessCache[key] = 1 /* SETUP */;
  2896. return setupState[key];
  2897. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2898. accessCache[key] = 2 /* DATA */;
  2899. return data[key];
  2900. } else if (
  2901. // only cache other properties when instance has declared (thus stable)
  2902. // props
  2903. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  2904. ) {
  2905. accessCache[key] = 3 /* PROPS */;
  2906. return props[key];
  2907. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2908. accessCache[key] = 4 /* CONTEXT */;
  2909. return ctx[key];
  2910. } else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
  2911. accessCache[key] = 0 /* OTHER */;
  2912. }
  2913. }
  2914. const publicGetter = publicPropertiesMap[key];
  2915. let cssModule, globalProperties;
  2916. if (publicGetter) {
  2917. if (key === "$attrs") {
  2918. track(instance, "get", key);
  2919. !!(process.env.NODE_ENV !== "production") && markAttrsAccessed();
  2920. } else if (!!(process.env.NODE_ENV !== "production") && key === "$slots") {
  2921. track(instance, "get", key);
  2922. }
  2923. return publicGetter(instance);
  2924. } else if (
  2925. // css module (injected by vue-loader)
  2926. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2927. ) {
  2928. return cssModule;
  2929. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2930. accessCache[key] = 4 /* CONTEXT */;
  2931. return ctx[key];
  2932. } else if (
  2933. // global properties
  2934. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  2935. ) {
  2936. {
  2937. return globalProperties[key];
  2938. }
  2939. } else if (!!(process.env.NODE_ENV !== "production") && currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  2940. // to infinite warning loop
  2941. key.indexOf("__v") !== 0)) {
  2942. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  2943. warn(
  2944. `Property ${JSON.stringify(
  2945. key
  2946. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  2947. );
  2948. } else if (instance === currentRenderingInstance) {
  2949. warn(
  2950. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  2951. );
  2952. }
  2953. }
  2954. },
  2955. set({ _: instance }, key, value) {
  2956. const { data, setupState, ctx } = instance;
  2957. if (hasSetupBinding(setupState, key)) {
  2958. setupState[key] = value;
  2959. return true;
  2960. } else if (!!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup && hasOwn(setupState, key)) {
  2961. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  2962. return false;
  2963. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2964. data[key] = value;
  2965. return true;
  2966. } else if (hasOwn(instance.props, key)) {
  2967. !!(process.env.NODE_ENV !== "production") && warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  2968. return false;
  2969. }
  2970. if (key[0] === "$" && key.slice(1) in instance) {
  2971. !!(process.env.NODE_ENV !== "production") && warn(
  2972. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  2973. );
  2974. return false;
  2975. } else {
  2976. if (!!(process.env.NODE_ENV !== "production") && key in instance.appContext.config.globalProperties) {
  2977. Object.defineProperty(ctx, key, {
  2978. enumerable: true,
  2979. configurable: true,
  2980. value
  2981. });
  2982. } else {
  2983. ctx[key] = value;
  2984. }
  2985. }
  2986. return true;
  2987. },
  2988. has({
  2989. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2990. }, key) {
  2991. let normalizedProps;
  2992. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  2993. },
  2994. defineProperty(target, key, descriptor) {
  2995. if (descriptor.get != null) {
  2996. target._.accessCache[key] = 0;
  2997. } else if (hasOwn(descriptor, "value")) {
  2998. this.set(target, key, descriptor.value, null);
  2999. }
  3000. return Reflect.defineProperty(target, key, descriptor);
  3001. }
  3002. };
  3003. if (!!(process.env.NODE_ENV !== "production") && true) {
  3004. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3005. warn(
  3006. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  3007. );
  3008. return Reflect.ownKeys(target);
  3009. };
  3010. }
  3011. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  3012. {},
  3013. PublicInstanceProxyHandlers,
  3014. {
  3015. get(target, key) {
  3016. if (key === Symbol.unscopables) {
  3017. return;
  3018. }
  3019. return PublicInstanceProxyHandlers.get(target, key, target);
  3020. },
  3021. has(_, key) {
  3022. const has = key[0] !== "_" && !isGloballyWhitelisted(key);
  3023. if (!!(process.env.NODE_ENV !== "production") && !has && PublicInstanceProxyHandlers.has(_, key)) {
  3024. warn(
  3025. `Property ${JSON.stringify(
  3026. key
  3027. )} should not start with _ which is a reserved prefix for Vue internals.`
  3028. );
  3029. }
  3030. return has;
  3031. }
  3032. }
  3033. );
  3034. function createDevRenderContext(instance) {
  3035. const target = {};
  3036. Object.defineProperty(target, `_`, {
  3037. configurable: true,
  3038. enumerable: false,
  3039. get: () => instance
  3040. });
  3041. Object.keys(publicPropertiesMap).forEach((key) => {
  3042. Object.defineProperty(target, key, {
  3043. configurable: true,
  3044. enumerable: false,
  3045. get: () => publicPropertiesMap[key](instance),
  3046. // intercepted by the proxy so no need for implementation,
  3047. // but needed to prevent set errors
  3048. set: NOOP
  3049. });
  3050. });
  3051. return target;
  3052. }
  3053. function exposePropsOnRenderContext(instance) {
  3054. const {
  3055. ctx,
  3056. propsOptions: [propsOptions]
  3057. } = instance;
  3058. if (propsOptions) {
  3059. Object.keys(propsOptions).forEach((key) => {
  3060. Object.defineProperty(ctx, key, {
  3061. enumerable: true,
  3062. configurable: true,
  3063. get: () => instance.props[key],
  3064. set: NOOP
  3065. });
  3066. });
  3067. }
  3068. }
  3069. function exposeSetupStateOnRenderContext(instance) {
  3070. const { ctx, setupState } = instance;
  3071. Object.keys(toRaw(setupState)).forEach((key) => {
  3072. if (!setupState.__isScriptSetup) {
  3073. if (isReservedPrefix(key[0])) {
  3074. warn(
  3075. `setup() return property ${JSON.stringify(
  3076. key
  3077. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  3078. );
  3079. return;
  3080. }
  3081. Object.defineProperty(ctx, key, {
  3082. enumerable: true,
  3083. configurable: true,
  3084. get: () => setupState[key],
  3085. set: NOOP
  3086. });
  3087. }
  3088. });
  3089. }
  3090. const warnRuntimeUsage = (method) => warn(
  3091. `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
  3092. );
  3093. function defineProps() {
  3094. if (!!(process.env.NODE_ENV !== "production")) {
  3095. warnRuntimeUsage(`defineProps`);
  3096. }
  3097. return null;
  3098. }
  3099. function defineEmits() {
  3100. if (!!(process.env.NODE_ENV !== "production")) {
  3101. warnRuntimeUsage(`defineEmits`);
  3102. }
  3103. return null;
  3104. }
  3105. function defineExpose(exposed) {
  3106. if (!!(process.env.NODE_ENV !== "production")) {
  3107. warnRuntimeUsage(`defineExpose`);
  3108. }
  3109. }
  3110. function defineOptions(options) {
  3111. if (!!(process.env.NODE_ENV !== "production")) {
  3112. warnRuntimeUsage(`defineOptions`);
  3113. }
  3114. }
  3115. function defineSlots() {
  3116. if (!!(process.env.NODE_ENV !== "production")) {
  3117. warnRuntimeUsage(`defineSlots`);
  3118. }
  3119. return null;
  3120. }
  3121. function defineModel() {
  3122. if (!!(process.env.NODE_ENV !== "production")) {
  3123. warnRuntimeUsage("defineModel");
  3124. }
  3125. }
  3126. function withDefaults(props, defaults) {
  3127. if (!!(process.env.NODE_ENV !== "production")) {
  3128. warnRuntimeUsage(`withDefaults`);
  3129. }
  3130. return null;
  3131. }
  3132. function useSlots() {
  3133. return getContext().slots;
  3134. }
  3135. function useAttrs() {
  3136. return getContext().attrs;
  3137. }
  3138. function useModel(props, name, options) {
  3139. const i = getCurrentInstance();
  3140. if (!!(process.env.NODE_ENV !== "production") && !i) {
  3141. warn(`useModel() called without active instance.`);
  3142. return ref();
  3143. }
  3144. if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][name]) {
  3145. warn(`useModel() called with prop "${name}" which is not declared.`);
  3146. return ref();
  3147. }
  3148. if (options && options.local) {
  3149. const proxy = ref(props[name]);
  3150. watch(
  3151. () => props[name],
  3152. (v) => proxy.value = v
  3153. );
  3154. watch(proxy, (value) => {
  3155. if (value !== props[name]) {
  3156. i.emit(`update:${name}`, value);
  3157. }
  3158. });
  3159. return proxy;
  3160. } else {
  3161. return {
  3162. __v_isRef: true,
  3163. get value() {
  3164. return props[name];
  3165. },
  3166. set value(value) {
  3167. i.emit(`update:${name}`, value);
  3168. }
  3169. };
  3170. }
  3171. }
  3172. function getContext() {
  3173. const i = getCurrentInstance();
  3174. if (!!(process.env.NODE_ENV !== "production") && !i) {
  3175. warn(`useContext() called without active instance.`);
  3176. }
  3177. return i.setupContext || (i.setupContext = createSetupContext(i));
  3178. }
  3179. function normalizePropsOrEmits(props) {
  3180. return isArray(props) ? props.reduce(
  3181. (normalized, p) => (normalized[p] = null, normalized),
  3182. {}
  3183. ) : props;
  3184. }
  3185. function mergeDefaults(raw, defaults) {
  3186. const props = normalizePropsOrEmits(raw);
  3187. for (const key in defaults) {
  3188. if (key.startsWith("__skip"))
  3189. continue;
  3190. let opt = props[key];
  3191. if (opt) {
  3192. if (isArray(opt) || isFunction(opt)) {
  3193. opt = props[key] = { type: opt, default: defaults[key] };
  3194. } else {
  3195. opt.default = defaults[key];
  3196. }
  3197. } else if (opt === null) {
  3198. opt = props[key] = { default: defaults[key] };
  3199. } else if (!!(process.env.NODE_ENV !== "production")) {
  3200. warn(`props default key "${key}" has no corresponding declaration.`);
  3201. }
  3202. if (opt && defaults[`__skip_${key}`]) {
  3203. opt.skipFactory = true;
  3204. }
  3205. }
  3206. return props;
  3207. }
  3208. function mergeModels(a, b) {
  3209. if (!a || !b)
  3210. return a || b;
  3211. if (isArray(a) && isArray(b))
  3212. return a.concat(b);
  3213. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  3214. }
  3215. function createPropsRestProxy(props, excludedKeys) {
  3216. const ret = {};
  3217. for (const key in props) {
  3218. if (!excludedKeys.includes(key)) {
  3219. Object.defineProperty(ret, key, {
  3220. enumerable: true,
  3221. get: () => props[key]
  3222. });
  3223. }
  3224. }
  3225. return ret;
  3226. }
  3227. function withAsyncContext(getAwaitable) {
  3228. const ctx = getCurrentInstance();
  3229. if (!!(process.env.NODE_ENV !== "production") && !ctx) {
  3230. warn(
  3231. `withAsyncContext called without active current instance. This is likely a bug.`
  3232. );
  3233. }
  3234. let awaitable = getAwaitable();
  3235. unsetCurrentInstance();
  3236. if (isPromise(awaitable)) {
  3237. awaitable = awaitable.catch((e) => {
  3238. setCurrentInstance(ctx);
  3239. throw e;
  3240. });
  3241. }
  3242. return [awaitable, () => setCurrentInstance(ctx)];
  3243. }
  3244. function createDuplicateChecker() {
  3245. const cache = /* @__PURE__ */ Object.create(null);
  3246. return (type, key) => {
  3247. if (cache[key]) {
  3248. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3249. } else {
  3250. cache[key] = type;
  3251. }
  3252. };
  3253. }
  3254. let shouldCacheAccess = true;
  3255. function applyOptions(instance) {
  3256. const options = resolveMergedOptions(instance);
  3257. const publicThis = instance.proxy;
  3258. const ctx = instance.ctx;
  3259. shouldCacheAccess = false;
  3260. if (options.beforeCreate) {
  3261. callHook(options.beforeCreate, instance, "bc");
  3262. }
  3263. const {
  3264. // state
  3265. data: dataOptions,
  3266. computed: computedOptions,
  3267. methods,
  3268. watch: watchOptions,
  3269. provide: provideOptions,
  3270. inject: injectOptions,
  3271. // lifecycle
  3272. created,
  3273. beforeMount,
  3274. mounted,
  3275. beforeUpdate,
  3276. updated,
  3277. activated,
  3278. deactivated,
  3279. beforeDestroy,
  3280. beforeUnmount,
  3281. destroyed,
  3282. unmounted,
  3283. render,
  3284. renderTracked,
  3285. renderTriggered,
  3286. errorCaptured,
  3287. serverPrefetch,
  3288. // public API
  3289. expose,
  3290. inheritAttrs,
  3291. // assets
  3292. components,
  3293. directives,
  3294. filters
  3295. } = options;
  3296. const checkDuplicateProperties = !!(process.env.NODE_ENV !== "production") ? createDuplicateChecker() : null;
  3297. if (!!(process.env.NODE_ENV !== "production")) {
  3298. const [propsOptions] = instance.propsOptions;
  3299. if (propsOptions) {
  3300. for (const key in propsOptions) {
  3301. checkDuplicateProperties("Props" /* PROPS */, key);
  3302. }
  3303. }
  3304. }
  3305. if (injectOptions) {
  3306. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  3307. }
  3308. if (methods) {
  3309. for (const key in methods) {
  3310. const methodHandler = methods[key];
  3311. if (isFunction(methodHandler)) {
  3312. if (!!(process.env.NODE_ENV !== "production")) {
  3313. Object.defineProperty(ctx, key, {
  3314. value: methodHandler.bind(publicThis),
  3315. configurable: true,
  3316. enumerable: true,
  3317. writable: true
  3318. });
  3319. } else {
  3320. ctx[key] = methodHandler.bind(publicThis);
  3321. }
  3322. if (!!(process.env.NODE_ENV !== "production")) {
  3323. checkDuplicateProperties("Methods" /* METHODS */, key);
  3324. }
  3325. } else if (!!(process.env.NODE_ENV !== "production")) {
  3326. warn(
  3327. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  3328. );
  3329. }
  3330. }
  3331. }
  3332. if (dataOptions) {
  3333. if (!!(process.env.NODE_ENV !== "production") && !isFunction(dataOptions)) {
  3334. warn(
  3335. `The data option must be a function. Plain object usage is no longer supported.`
  3336. );
  3337. }
  3338. const data = dataOptions.call(publicThis, publicThis);
  3339. if (!!(process.env.NODE_ENV !== "production") && isPromise(data)) {
  3340. warn(
  3341. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  3342. );
  3343. }
  3344. if (!isObject(data)) {
  3345. !!(process.env.NODE_ENV !== "production") && warn(`data() should return an object.`);
  3346. } else {
  3347. instance.data = reactive(data);
  3348. if (!!(process.env.NODE_ENV !== "production")) {
  3349. for (const key in data) {
  3350. checkDuplicateProperties("Data" /* DATA */, key);
  3351. if (!isReservedPrefix(key[0])) {
  3352. Object.defineProperty(ctx, key, {
  3353. configurable: true,
  3354. enumerable: true,
  3355. get: () => data[key],
  3356. set: NOOP
  3357. });
  3358. }
  3359. }
  3360. }
  3361. }
  3362. }
  3363. shouldCacheAccess = true;
  3364. if (computedOptions) {
  3365. for (const key in computedOptions) {
  3366. const opt = computedOptions[key];
  3367. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  3368. if (!!(process.env.NODE_ENV !== "production") && get === NOOP) {
  3369. warn(`Computed property "${key}" has no getter.`);
  3370. }
  3371. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : !!(process.env.NODE_ENV !== "production") ? () => {
  3372. warn(
  3373. `Write operation failed: computed property "${key}" is readonly.`
  3374. );
  3375. } : NOOP;
  3376. const c = computed({
  3377. get,
  3378. set
  3379. });
  3380. Object.defineProperty(ctx, key, {
  3381. enumerable: true,
  3382. configurable: true,
  3383. get: () => c.value,
  3384. set: (v) => c.value = v
  3385. });
  3386. if (!!(process.env.NODE_ENV !== "production")) {
  3387. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  3388. }
  3389. }
  3390. }
  3391. if (watchOptions) {
  3392. for (const key in watchOptions) {
  3393. createWatcher(watchOptions[key], ctx, publicThis, key);
  3394. }
  3395. }
  3396. if (provideOptions) {
  3397. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3398. Reflect.ownKeys(provides).forEach((key) => {
  3399. provide(key, provides[key]);
  3400. });
  3401. }
  3402. if (created) {
  3403. callHook(created, instance, "c");
  3404. }
  3405. function registerLifecycleHook(register, hook) {
  3406. if (isArray(hook)) {
  3407. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3408. } else if (hook) {
  3409. register(hook.bind(publicThis));
  3410. }
  3411. }
  3412. registerLifecycleHook(onBeforeMount, beforeMount);
  3413. registerLifecycleHook(onMounted, mounted);
  3414. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3415. registerLifecycleHook(onUpdated, updated);
  3416. registerLifecycleHook(onActivated, activated);
  3417. registerLifecycleHook(onDeactivated, deactivated);
  3418. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3419. registerLifecycleHook(onRenderTracked, renderTracked);
  3420. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3421. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3422. registerLifecycleHook(onUnmounted, unmounted);
  3423. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3424. if (isArray(expose)) {
  3425. if (expose.length) {
  3426. const exposed = instance.exposed || (instance.exposed = {});
  3427. expose.forEach((key) => {
  3428. Object.defineProperty(exposed, key, {
  3429. get: () => publicThis[key],
  3430. set: (val) => publicThis[key] = val
  3431. });
  3432. });
  3433. } else if (!instance.exposed) {
  3434. instance.exposed = {};
  3435. }
  3436. }
  3437. if (render && instance.render === NOOP) {
  3438. instance.render = render;
  3439. }
  3440. if (inheritAttrs != null) {
  3441. instance.inheritAttrs = inheritAttrs;
  3442. }
  3443. if (components)
  3444. instance.components = components;
  3445. if (directives)
  3446. instance.directives = directives;
  3447. }
  3448. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3449. if (isArray(injectOptions)) {
  3450. injectOptions = normalizeInject(injectOptions);
  3451. }
  3452. for (const key in injectOptions) {
  3453. const opt = injectOptions[key];
  3454. let injected;
  3455. if (isObject(opt)) {
  3456. if ("default" in opt) {
  3457. injected = inject(
  3458. opt.from || key,
  3459. opt.default,
  3460. true
  3461. /* treat default function as factory */
  3462. );
  3463. } else {
  3464. injected = inject(opt.from || key);
  3465. }
  3466. } else {
  3467. injected = inject(opt);
  3468. }
  3469. if (isRef(injected)) {
  3470. Object.defineProperty(ctx, key, {
  3471. enumerable: true,
  3472. configurable: true,
  3473. get: () => injected.value,
  3474. set: (v) => injected.value = v
  3475. });
  3476. } else {
  3477. ctx[key] = injected;
  3478. }
  3479. if (!!(process.env.NODE_ENV !== "production")) {
  3480. checkDuplicateProperties("Inject" /* INJECT */, key);
  3481. }
  3482. }
  3483. }
  3484. function callHook(hook, instance, type) {
  3485. callWithAsyncErrorHandling(
  3486. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  3487. instance,
  3488. type
  3489. );
  3490. }
  3491. function createWatcher(raw, ctx, publicThis, key) {
  3492. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3493. if (isString(raw)) {
  3494. const handler = ctx[raw];
  3495. if (isFunction(handler)) {
  3496. watch(getter, handler);
  3497. } else if (!!(process.env.NODE_ENV !== "production")) {
  3498. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  3499. }
  3500. } else if (isFunction(raw)) {
  3501. watch(getter, raw.bind(publicThis));
  3502. } else if (isObject(raw)) {
  3503. if (isArray(raw)) {
  3504. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  3505. } else {
  3506. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3507. if (isFunction(handler)) {
  3508. watch(getter, handler, raw);
  3509. } else if (!!(process.env.NODE_ENV !== "production")) {
  3510. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3511. }
  3512. }
  3513. } else if (!!(process.env.NODE_ENV !== "production")) {
  3514. warn(`Invalid watch option: "${key}"`, raw);
  3515. }
  3516. }
  3517. function resolveMergedOptions(instance) {
  3518. const base = instance.type;
  3519. const { mixins, extends: extendsOptions } = base;
  3520. const {
  3521. mixins: globalMixins,
  3522. optionsCache: cache,
  3523. config: { optionMergeStrategies }
  3524. } = instance.appContext;
  3525. const cached = cache.get(base);
  3526. let resolved;
  3527. if (cached) {
  3528. resolved = cached;
  3529. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3530. {
  3531. resolved = base;
  3532. }
  3533. } else {
  3534. resolved = {};
  3535. if (globalMixins.length) {
  3536. globalMixins.forEach(
  3537. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  3538. );
  3539. }
  3540. mergeOptions(resolved, base, optionMergeStrategies);
  3541. }
  3542. if (isObject(base)) {
  3543. cache.set(base, resolved);
  3544. }
  3545. return resolved;
  3546. }
  3547. function mergeOptions(to, from, strats, asMixin = false) {
  3548. const { mixins, extends: extendsOptions } = from;
  3549. if (extendsOptions) {
  3550. mergeOptions(to, extendsOptions, strats, true);
  3551. }
  3552. if (mixins) {
  3553. mixins.forEach(
  3554. (m) => mergeOptions(to, m, strats, true)
  3555. );
  3556. }
  3557. for (const key in from) {
  3558. if (asMixin && key === "expose") {
  3559. !!(process.env.NODE_ENV !== "production") && warn(
  3560. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3561. );
  3562. } else {
  3563. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3564. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3565. }
  3566. }
  3567. return to;
  3568. }
  3569. const internalOptionMergeStrats = {
  3570. data: mergeDataFn,
  3571. props: mergeEmitsOrPropsOptions,
  3572. emits: mergeEmitsOrPropsOptions,
  3573. // objects
  3574. methods: mergeObjectOptions,
  3575. computed: mergeObjectOptions,
  3576. // lifecycle
  3577. beforeCreate: mergeAsArray,
  3578. created: mergeAsArray,
  3579. beforeMount: mergeAsArray,
  3580. mounted: mergeAsArray,
  3581. beforeUpdate: mergeAsArray,
  3582. updated: mergeAsArray,
  3583. beforeDestroy: mergeAsArray,
  3584. beforeUnmount: mergeAsArray,
  3585. destroyed: mergeAsArray,
  3586. unmounted: mergeAsArray,
  3587. activated: mergeAsArray,
  3588. deactivated: mergeAsArray,
  3589. errorCaptured: mergeAsArray,
  3590. serverPrefetch: mergeAsArray,
  3591. // assets
  3592. components: mergeObjectOptions,
  3593. directives: mergeObjectOptions,
  3594. // watch
  3595. watch: mergeWatchOptions,
  3596. // provide / inject
  3597. provide: mergeDataFn,
  3598. inject: mergeInject
  3599. };
  3600. function mergeDataFn(to, from) {
  3601. if (!from) {
  3602. return to;
  3603. }
  3604. if (!to) {
  3605. return from;
  3606. }
  3607. return function mergedDataFn() {
  3608. return (extend)(
  3609. isFunction(to) ? to.call(this, this) : to,
  3610. isFunction(from) ? from.call(this, this) : from
  3611. );
  3612. };
  3613. }
  3614. function mergeInject(to, from) {
  3615. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  3616. }
  3617. function normalizeInject(raw) {
  3618. if (isArray(raw)) {
  3619. const res = {};
  3620. for (let i = 0; i < raw.length; i++) {
  3621. res[raw[i]] = raw[i];
  3622. }
  3623. return res;
  3624. }
  3625. return raw;
  3626. }
  3627. function mergeAsArray(to, from) {
  3628. return to ? [...new Set([].concat(to, from))] : from;
  3629. }
  3630. function mergeObjectOptions(to, from) {
  3631. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  3632. }
  3633. function mergeEmitsOrPropsOptions(to, from) {
  3634. if (to) {
  3635. if (isArray(to) && isArray(from)) {
  3636. return [.../* @__PURE__ */ new Set([...to, ...from])];
  3637. }
  3638. return extend(
  3639. /* @__PURE__ */ Object.create(null),
  3640. normalizePropsOrEmits(to),
  3641. normalizePropsOrEmits(from != null ? from : {})
  3642. );
  3643. } else {
  3644. return from;
  3645. }
  3646. }
  3647. function mergeWatchOptions(to, from) {
  3648. if (!to)
  3649. return from;
  3650. if (!from)
  3651. return to;
  3652. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  3653. for (const key in from) {
  3654. merged[key] = mergeAsArray(to[key], from[key]);
  3655. }
  3656. return merged;
  3657. }
  3658. function createAppContext() {
  3659. return {
  3660. app: null,
  3661. config: {
  3662. isNativeTag: NO,
  3663. performance: false,
  3664. globalProperties: {},
  3665. optionMergeStrategies: {},
  3666. errorHandler: void 0,
  3667. warnHandler: void 0,
  3668. compilerOptions: {}
  3669. },
  3670. mixins: [],
  3671. components: {},
  3672. directives: {},
  3673. provides: /* @__PURE__ */ Object.create(null),
  3674. optionsCache: /* @__PURE__ */ new WeakMap(),
  3675. propsCache: /* @__PURE__ */ new WeakMap(),
  3676. emitsCache: /* @__PURE__ */ new WeakMap()
  3677. };
  3678. }
  3679. let uid$1 = 0;
  3680. function createAppAPI(render, hydrate) {
  3681. return function createApp(rootComponent, rootProps = null) {
  3682. if (!isFunction(rootComponent)) {
  3683. rootComponent = extend({}, rootComponent);
  3684. }
  3685. if (rootProps != null && !isObject(rootProps)) {
  3686. !!(process.env.NODE_ENV !== "production") && warn(`root props passed to app.mount() must be an object.`);
  3687. rootProps = null;
  3688. }
  3689. const context = createAppContext();
  3690. if (!!(process.env.NODE_ENV !== "production")) {
  3691. Object.defineProperty(context.config, "unwrapInjectedRef", {
  3692. get() {
  3693. return true;
  3694. },
  3695. set() {
  3696. warn(
  3697. `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
  3698. );
  3699. }
  3700. });
  3701. }
  3702. const installedPlugins = /* @__PURE__ */ new Set();
  3703. let isMounted = false;
  3704. const app = context.app = {
  3705. _uid: uid$1++,
  3706. _component: rootComponent,
  3707. _props: rootProps,
  3708. _container: null,
  3709. _context: context,
  3710. _instance: null,
  3711. version,
  3712. get config() {
  3713. return context.config;
  3714. },
  3715. set config(v) {
  3716. if (!!(process.env.NODE_ENV !== "production")) {
  3717. warn(
  3718. `app.config cannot be replaced. Modify individual options instead.`
  3719. );
  3720. }
  3721. },
  3722. use(plugin, ...options) {
  3723. if (installedPlugins.has(plugin)) {
  3724. !!(process.env.NODE_ENV !== "production") && warn(`Plugin has already been applied to target app.`);
  3725. } else if (plugin && isFunction(plugin.install)) {
  3726. installedPlugins.add(plugin);
  3727. plugin.install(app, ...options);
  3728. } else if (isFunction(plugin)) {
  3729. installedPlugins.add(plugin);
  3730. plugin(app, ...options);
  3731. } else if (!!(process.env.NODE_ENV !== "production")) {
  3732. warn(
  3733. `A plugin must either be a function or an object with an "install" function.`
  3734. );
  3735. }
  3736. return app;
  3737. },
  3738. mixin(mixin) {
  3739. if (__VUE_OPTIONS_API__) {
  3740. if (!context.mixins.includes(mixin)) {
  3741. context.mixins.push(mixin);
  3742. } else if (!!(process.env.NODE_ENV !== "production")) {
  3743. warn(
  3744. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  3745. );
  3746. }
  3747. } else if (!!(process.env.NODE_ENV !== "production")) {
  3748. warn("Mixins are only available in builds supporting Options API");
  3749. }
  3750. return app;
  3751. },
  3752. component(name, component) {
  3753. if (!!(process.env.NODE_ENV !== "production")) {
  3754. validateComponentName(name, context.config);
  3755. }
  3756. if (!component) {
  3757. return context.components[name];
  3758. }
  3759. if (!!(process.env.NODE_ENV !== "production") && context.components[name]) {
  3760. warn(`Component "${name}" has already been registered in target app.`);
  3761. }
  3762. context.components[name] = component;
  3763. return app;
  3764. },
  3765. directive(name, directive) {
  3766. if (!!(process.env.NODE_ENV !== "production")) {
  3767. validateDirectiveName(name);
  3768. }
  3769. if (!directive) {
  3770. return context.directives[name];
  3771. }
  3772. if (!!(process.env.NODE_ENV !== "production") && context.directives[name]) {
  3773. warn(`Directive "${name}" has already been registered in target app.`);
  3774. }
  3775. context.directives[name] = directive;
  3776. return app;
  3777. },
  3778. mount(rootContainer, isHydrate, isSVG) {
  3779. if (!isMounted) {
  3780. if (!!(process.env.NODE_ENV !== "production") && rootContainer.__vue_app__) {
  3781. warn(
  3782. `There is already an app instance mounted on the host container.
  3783. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  3784. );
  3785. }
  3786. const vnode = createVNode(
  3787. rootComponent,
  3788. rootProps
  3789. );
  3790. vnode.appContext = context;
  3791. if (!!(process.env.NODE_ENV !== "production")) {
  3792. context.reload = () => {
  3793. render(cloneVNode(vnode), rootContainer, isSVG);
  3794. };
  3795. }
  3796. if (isHydrate && hydrate) {
  3797. hydrate(vnode, rootContainer);
  3798. } else {
  3799. render(vnode, rootContainer, isSVG);
  3800. }
  3801. isMounted = true;
  3802. app._container = rootContainer;
  3803. rootContainer.__vue_app__ = app;
  3804. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  3805. app._instance = vnode.component;
  3806. devtoolsInitApp(app, version);
  3807. }
  3808. return getExposeProxy(vnode.component) || vnode.component.proxy;
  3809. } else if (!!(process.env.NODE_ENV !== "production")) {
  3810. warn(
  3811. `App has already been mounted.
  3812. If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
  3813. );
  3814. }
  3815. },
  3816. unmount() {
  3817. if (isMounted) {
  3818. render(null, app._container);
  3819. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  3820. app._instance = null;
  3821. devtoolsUnmountApp(app);
  3822. }
  3823. delete app._container.__vue_app__;
  3824. } else if (!!(process.env.NODE_ENV !== "production")) {
  3825. warn(`Cannot unmount an app that is not mounted.`);
  3826. }
  3827. },
  3828. provide(key, value) {
  3829. if (!!(process.env.NODE_ENV !== "production") && key in context.provides) {
  3830. warn(
  3831. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  3832. );
  3833. }
  3834. context.provides[key] = value;
  3835. return app;
  3836. },
  3837. runWithContext(fn) {
  3838. currentApp = app;
  3839. try {
  3840. return fn();
  3841. } finally {
  3842. currentApp = null;
  3843. }
  3844. }
  3845. };
  3846. return app;
  3847. };
  3848. }
  3849. let currentApp = null;
  3850. function provide(key, value) {
  3851. if (!currentInstance) {
  3852. if (!!(process.env.NODE_ENV !== "production")) {
  3853. warn(`provide() can only be used inside setup().`);
  3854. }
  3855. } else {
  3856. let provides = currentInstance.provides;
  3857. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3858. if (parentProvides === provides) {
  3859. provides = currentInstance.provides = Object.create(parentProvides);
  3860. }
  3861. provides[key] = value;
  3862. }
  3863. }
  3864. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3865. const instance = currentInstance || currentRenderingInstance;
  3866. if (instance || currentApp) {
  3867. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  3868. if (provides && key in provides) {
  3869. return provides[key];
  3870. } else if (arguments.length > 1) {
  3871. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3872. } else if (!!(process.env.NODE_ENV !== "production")) {
  3873. warn(`injection "${String(key)}" not found.`);
  3874. }
  3875. } else if (!!(process.env.NODE_ENV !== "production")) {
  3876. warn(`inject() can only be used inside setup() or functional components.`);
  3877. }
  3878. }
  3879. function hasInjectionContext() {
  3880. return !!(currentInstance || currentRenderingInstance || currentApp);
  3881. }
  3882. function initProps(instance, rawProps, isStateful, isSSR = false) {
  3883. const props = {};
  3884. const attrs = {};
  3885. def(attrs, InternalObjectKey, 1);
  3886. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  3887. setFullProps(instance, rawProps, props, attrs);
  3888. for (const key in instance.propsOptions[0]) {
  3889. if (!(key in props)) {
  3890. props[key] = void 0;
  3891. }
  3892. }
  3893. if (!!(process.env.NODE_ENV !== "production")) {
  3894. validateProps(rawProps || {}, props, instance);
  3895. }
  3896. if (isStateful) {
  3897. instance.props = isSSR ? props : shallowReactive(props);
  3898. } else {
  3899. if (!instance.type.props) {
  3900. instance.props = attrs;
  3901. } else {
  3902. instance.props = props;
  3903. }
  3904. }
  3905. instance.attrs = attrs;
  3906. }
  3907. function isInHmrContext(instance) {
  3908. while (instance) {
  3909. if (instance.type.__hmrId)
  3910. return true;
  3911. instance = instance.parent;
  3912. }
  3913. }
  3914. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3915. const {
  3916. props,
  3917. attrs,
  3918. vnode: { patchFlag }
  3919. } = instance;
  3920. const rawCurrentProps = toRaw(props);
  3921. const [options] = instance.propsOptions;
  3922. let hasAttrsChanged = false;
  3923. if (
  3924. // always force full diff in dev
  3925. // - #1942 if hmr is enabled with sfc component
  3926. // - vite#872 non-sfc component used by sfc component
  3927. !(!!(process.env.NODE_ENV !== "production") && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  3928. ) {
  3929. if (patchFlag & 8) {
  3930. const propsToUpdate = instance.vnode.dynamicProps;
  3931. for (let i = 0; i < propsToUpdate.length; i++) {
  3932. let key = propsToUpdate[i];
  3933. if (isEmitListener(instance.emitsOptions, key)) {
  3934. continue;
  3935. }
  3936. const value = rawProps[key];
  3937. if (options) {
  3938. if (hasOwn(attrs, key)) {
  3939. if (value !== attrs[key]) {
  3940. attrs[key] = value;
  3941. hasAttrsChanged = true;
  3942. }
  3943. } else {
  3944. const camelizedKey = camelize(key);
  3945. props[camelizedKey] = resolvePropValue(
  3946. options,
  3947. rawCurrentProps,
  3948. camelizedKey,
  3949. value,
  3950. instance,
  3951. false
  3952. /* isAbsent */
  3953. );
  3954. }
  3955. } else {
  3956. if (value !== attrs[key]) {
  3957. attrs[key] = value;
  3958. hasAttrsChanged = true;
  3959. }
  3960. }
  3961. }
  3962. }
  3963. } else {
  3964. if (setFullProps(instance, rawProps, props, attrs)) {
  3965. hasAttrsChanged = true;
  3966. }
  3967. let kebabKey;
  3968. for (const key in rawCurrentProps) {
  3969. if (!rawProps || // for camelCase
  3970. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3971. // and converted to camelCase (#955)
  3972. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  3973. if (options) {
  3974. if (rawPrevProps && // for camelCase
  3975. (rawPrevProps[key] !== void 0 || // for kebab-case
  3976. rawPrevProps[kebabKey] !== void 0)) {
  3977. props[key] = resolvePropValue(
  3978. options,
  3979. rawCurrentProps,
  3980. key,
  3981. void 0,
  3982. instance,
  3983. true
  3984. /* isAbsent */
  3985. );
  3986. }
  3987. } else {
  3988. delete props[key];
  3989. }
  3990. }
  3991. }
  3992. if (attrs !== rawCurrentProps) {
  3993. for (const key in attrs) {
  3994. if (!rawProps || !hasOwn(rawProps, key) && true) {
  3995. delete attrs[key];
  3996. hasAttrsChanged = true;
  3997. }
  3998. }
  3999. }
  4000. }
  4001. if (hasAttrsChanged) {
  4002. trigger(instance, "set", "$attrs");
  4003. }
  4004. if (!!(process.env.NODE_ENV !== "production")) {
  4005. validateProps(rawProps || {}, props, instance);
  4006. }
  4007. }
  4008. function setFullProps(instance, rawProps, props, attrs) {
  4009. const [options, needCastKeys] = instance.propsOptions;
  4010. let hasAttrsChanged = false;
  4011. let rawCastValues;
  4012. if (rawProps) {
  4013. for (let key in rawProps) {
  4014. if (isReservedProp(key)) {
  4015. continue;
  4016. }
  4017. const value = rawProps[key];
  4018. let camelKey;
  4019. if (options && hasOwn(options, camelKey = camelize(key))) {
  4020. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4021. props[camelKey] = value;
  4022. } else {
  4023. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4024. }
  4025. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4026. if (!(key in attrs) || value !== attrs[key]) {
  4027. attrs[key] = value;
  4028. hasAttrsChanged = true;
  4029. }
  4030. }
  4031. }
  4032. }
  4033. if (needCastKeys) {
  4034. const rawCurrentProps = toRaw(props);
  4035. const castValues = rawCastValues || EMPTY_OBJ;
  4036. for (let i = 0; i < needCastKeys.length; i++) {
  4037. const key = needCastKeys[i];
  4038. props[key] = resolvePropValue(
  4039. options,
  4040. rawCurrentProps,
  4041. key,
  4042. castValues[key],
  4043. instance,
  4044. !hasOwn(castValues, key)
  4045. );
  4046. }
  4047. }
  4048. return hasAttrsChanged;
  4049. }
  4050. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4051. const opt = options[key];
  4052. if (opt != null) {
  4053. const hasDefault = hasOwn(opt, "default");
  4054. if (hasDefault && value === void 0) {
  4055. const defaultValue = opt.default;
  4056. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  4057. const { propsDefaults } = instance;
  4058. if (key in propsDefaults) {
  4059. value = propsDefaults[key];
  4060. } else {
  4061. setCurrentInstance(instance);
  4062. value = propsDefaults[key] = defaultValue.call(
  4063. null,
  4064. props
  4065. );
  4066. unsetCurrentInstance();
  4067. }
  4068. } else {
  4069. value = defaultValue;
  4070. }
  4071. }
  4072. if (opt[0 /* shouldCast */]) {
  4073. if (isAbsent && !hasDefault) {
  4074. value = false;
  4075. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  4076. value = true;
  4077. }
  4078. }
  4079. }
  4080. return value;
  4081. }
  4082. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4083. const cache = appContext.propsCache;
  4084. const cached = cache.get(comp);
  4085. if (cached) {
  4086. return cached;
  4087. }
  4088. const raw = comp.props;
  4089. const normalized = {};
  4090. const needCastKeys = [];
  4091. let hasExtends = false;
  4092. if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
  4093. const extendProps = (raw2) => {
  4094. hasExtends = true;
  4095. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4096. extend(normalized, props);
  4097. if (keys)
  4098. needCastKeys.push(...keys);
  4099. };
  4100. if (!asMixin && appContext.mixins.length) {
  4101. appContext.mixins.forEach(extendProps);
  4102. }
  4103. if (comp.extends) {
  4104. extendProps(comp.extends);
  4105. }
  4106. if (comp.mixins) {
  4107. comp.mixins.forEach(extendProps);
  4108. }
  4109. }
  4110. if (!raw && !hasExtends) {
  4111. if (isObject(comp)) {
  4112. cache.set(comp, EMPTY_ARR);
  4113. }
  4114. return EMPTY_ARR;
  4115. }
  4116. if (isArray(raw)) {
  4117. for (let i = 0; i < raw.length; i++) {
  4118. if (!!(process.env.NODE_ENV !== "production") && !isString(raw[i])) {
  4119. warn(`props must be strings when using array syntax.`, raw[i]);
  4120. }
  4121. const normalizedKey = camelize(raw[i]);
  4122. if (validatePropName(normalizedKey)) {
  4123. normalized[normalizedKey] = EMPTY_OBJ;
  4124. }
  4125. }
  4126. } else if (raw) {
  4127. if (!!(process.env.NODE_ENV !== "production") && !isObject(raw)) {
  4128. warn(`invalid props options`, raw);
  4129. }
  4130. for (const key in raw) {
  4131. const normalizedKey = camelize(key);
  4132. if (validatePropName(normalizedKey)) {
  4133. const opt = raw[key];
  4134. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  4135. if (prop) {
  4136. const booleanIndex = getTypeIndex(Boolean, prop.type);
  4137. const stringIndex = getTypeIndex(String, prop.type);
  4138. prop[0 /* shouldCast */] = booleanIndex > -1;
  4139. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  4140. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  4141. needCastKeys.push(normalizedKey);
  4142. }
  4143. }
  4144. }
  4145. }
  4146. }
  4147. const res = [normalized, needCastKeys];
  4148. if (isObject(comp)) {
  4149. cache.set(comp, res);
  4150. }
  4151. return res;
  4152. }
  4153. function validatePropName(key) {
  4154. if (key[0] !== "$") {
  4155. return true;
  4156. } else if (!!(process.env.NODE_ENV !== "production")) {
  4157. warn(`Invalid prop name: "${key}" is a reserved property.`);
  4158. }
  4159. return false;
  4160. }
  4161. function getType(ctor) {
  4162. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  4163. return match ? match[2] : ctor === null ? "null" : "";
  4164. }
  4165. function isSameType(a, b) {
  4166. return getType(a) === getType(b);
  4167. }
  4168. function getTypeIndex(type, expectedTypes) {
  4169. if (isArray(expectedTypes)) {
  4170. return expectedTypes.findIndex((t) => isSameType(t, type));
  4171. } else if (isFunction(expectedTypes)) {
  4172. return isSameType(expectedTypes, type) ? 0 : -1;
  4173. }
  4174. return -1;
  4175. }
  4176. function validateProps(rawProps, props, instance) {
  4177. const resolvedValues = toRaw(props);
  4178. const options = instance.propsOptions[0];
  4179. for (const key in options) {
  4180. let opt = options[key];
  4181. if (opt == null)
  4182. continue;
  4183. validateProp(
  4184. key,
  4185. resolvedValues[key],
  4186. opt,
  4187. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  4188. );
  4189. }
  4190. }
  4191. function validateProp(name, value, prop, isAbsent) {
  4192. const { type, required, validator, skipCheck } = prop;
  4193. if (required && isAbsent) {
  4194. warn('Missing required prop: "' + name + '"');
  4195. return;
  4196. }
  4197. if (value == null && !required) {
  4198. return;
  4199. }
  4200. if (type != null && type !== true && !skipCheck) {
  4201. let isValid = false;
  4202. const types = isArray(type) ? type : [type];
  4203. const expectedTypes = [];
  4204. for (let i = 0; i < types.length && !isValid; i++) {
  4205. const { valid, expectedType } = assertType(value, types[i]);
  4206. expectedTypes.push(expectedType || "");
  4207. isValid = valid;
  4208. }
  4209. if (!isValid) {
  4210. warn(getInvalidTypeMessage(name, value, expectedTypes));
  4211. return;
  4212. }
  4213. }
  4214. if (validator && !validator(value)) {
  4215. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  4216. }
  4217. }
  4218. const isSimpleType = /* @__PURE__ */ makeMap(
  4219. "String,Number,Boolean,Function,Symbol,BigInt"
  4220. );
  4221. function assertType(value, type) {
  4222. let valid;
  4223. const expectedType = getType(type);
  4224. if (isSimpleType(expectedType)) {
  4225. const t = typeof value;
  4226. valid = t === expectedType.toLowerCase();
  4227. if (!valid && t === "object") {
  4228. valid = value instanceof type;
  4229. }
  4230. } else if (expectedType === "Object") {
  4231. valid = isObject(value);
  4232. } else if (expectedType === "Array") {
  4233. valid = isArray(value);
  4234. } else if (expectedType === "null") {
  4235. valid = value === null;
  4236. } else {
  4237. valid = value instanceof type;
  4238. }
  4239. return {
  4240. valid,
  4241. expectedType
  4242. };
  4243. }
  4244. function getInvalidTypeMessage(name, value, expectedTypes) {
  4245. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  4246. const expectedType = expectedTypes[0];
  4247. const receivedType = toRawType(value);
  4248. const expectedValue = styleValue(value, expectedType);
  4249. const receivedValue = styleValue(value, receivedType);
  4250. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4251. message += ` with value ${expectedValue}`;
  4252. }
  4253. message += `, got ${receivedType} `;
  4254. if (isExplicable(receivedType)) {
  4255. message += `with value ${receivedValue}.`;
  4256. }
  4257. return message;
  4258. }
  4259. function styleValue(value, type) {
  4260. if (type === "String") {
  4261. return `"${value}"`;
  4262. } else if (type === "Number") {
  4263. return `${Number(value)}`;
  4264. } else {
  4265. return `${value}`;
  4266. }
  4267. }
  4268. function isExplicable(type) {
  4269. const explicitTypes = ["string", "number", "boolean"];
  4270. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4271. }
  4272. function isBoolean(...args) {
  4273. return args.some((elem) => elem.toLowerCase() === "boolean");
  4274. }
  4275. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  4276. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4277. const normalizeSlot = (key, rawSlot, ctx) => {
  4278. if (rawSlot._n) {
  4279. return rawSlot;
  4280. }
  4281. const normalized = withCtx((...args) => {
  4282. if (!!(process.env.NODE_ENV !== "production") && currentInstance) {
  4283. warn(
  4284. `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
  4285. );
  4286. }
  4287. return normalizeSlotValue(rawSlot(...args));
  4288. }, ctx);
  4289. normalized._c = false;
  4290. return normalized;
  4291. };
  4292. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  4293. const ctx = rawSlots._ctx;
  4294. for (const key in rawSlots) {
  4295. if (isInternalKey(key))
  4296. continue;
  4297. const value = rawSlots[key];
  4298. if (isFunction(value)) {
  4299. slots[key] = normalizeSlot(key, value, ctx);
  4300. } else if (value != null) {
  4301. if (!!(process.env.NODE_ENV !== "production") && true) {
  4302. warn(
  4303. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  4304. );
  4305. }
  4306. const normalized = normalizeSlotValue(value);
  4307. slots[key] = () => normalized;
  4308. }
  4309. }
  4310. };
  4311. const normalizeVNodeSlots = (instance, children) => {
  4312. if (!!(process.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
  4313. warn(
  4314. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  4315. );
  4316. }
  4317. const normalized = normalizeSlotValue(children);
  4318. instance.slots.default = () => normalized;
  4319. };
  4320. const initSlots = (instance, children) => {
  4321. if (instance.vnode.shapeFlag & 32) {
  4322. const type = children._;
  4323. if (type) {
  4324. instance.slots = toRaw(children);
  4325. def(children, "_", type);
  4326. } else {
  4327. normalizeObjectSlots(
  4328. children,
  4329. instance.slots = {});
  4330. }
  4331. } else {
  4332. instance.slots = {};
  4333. if (children) {
  4334. normalizeVNodeSlots(instance, children);
  4335. }
  4336. }
  4337. def(instance.slots, InternalObjectKey, 1);
  4338. };
  4339. const updateSlots = (instance, children, optimized) => {
  4340. const { vnode, slots } = instance;
  4341. let needDeletionCheck = true;
  4342. let deletionComparisonTarget = EMPTY_OBJ;
  4343. if (vnode.shapeFlag & 32) {
  4344. const type = children._;
  4345. if (type) {
  4346. if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
  4347. extend(slots, children);
  4348. trigger(instance, "set", "$slots");
  4349. } else if (optimized && type === 1) {
  4350. needDeletionCheck = false;
  4351. } else {
  4352. extend(slots, children);
  4353. if (!optimized && type === 1) {
  4354. delete slots._;
  4355. }
  4356. }
  4357. } else {
  4358. needDeletionCheck = !children.$stable;
  4359. normalizeObjectSlots(children, slots);
  4360. }
  4361. deletionComparisonTarget = children;
  4362. } else if (children) {
  4363. normalizeVNodeSlots(instance, children);
  4364. deletionComparisonTarget = { default: 1 };
  4365. }
  4366. if (needDeletionCheck) {
  4367. for (const key in slots) {
  4368. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  4369. delete slots[key];
  4370. }
  4371. }
  4372. }
  4373. };
  4374. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4375. if (isArray(rawRef)) {
  4376. rawRef.forEach(
  4377. (r, i) => setRef(
  4378. r,
  4379. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4380. parentSuspense,
  4381. vnode,
  4382. isUnmount
  4383. )
  4384. );
  4385. return;
  4386. }
  4387. if (isAsyncWrapper(vnode) && !isUnmount) {
  4388. return;
  4389. }
  4390. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  4391. const value = isUnmount ? null : refValue;
  4392. const { i: owner, r: ref } = rawRef;
  4393. if (!!(process.env.NODE_ENV !== "production") && !owner) {
  4394. warn(
  4395. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4396. );
  4397. return;
  4398. }
  4399. const oldRef = oldRawRef && oldRawRef.r;
  4400. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4401. const setupState = owner.setupState;
  4402. if (oldRef != null && oldRef !== ref) {
  4403. if (isString(oldRef)) {
  4404. refs[oldRef] = null;
  4405. if (hasOwn(setupState, oldRef)) {
  4406. setupState[oldRef] = null;
  4407. }
  4408. } else if (isRef(oldRef)) {
  4409. oldRef.value = null;
  4410. }
  4411. }
  4412. if (isFunction(ref)) {
  4413. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4414. } else {
  4415. const _isString = isString(ref);
  4416. const _isRef = isRef(ref);
  4417. if (_isString || _isRef) {
  4418. const doSet = () => {
  4419. if (rawRef.f) {
  4420. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  4421. if (isUnmount) {
  4422. isArray(existing) && remove(existing, refValue);
  4423. } else {
  4424. if (!isArray(existing)) {
  4425. if (_isString) {
  4426. refs[ref] = [refValue];
  4427. if (hasOwn(setupState, ref)) {
  4428. setupState[ref] = refs[ref];
  4429. }
  4430. } else {
  4431. ref.value = [refValue];
  4432. if (rawRef.k)
  4433. refs[rawRef.k] = ref.value;
  4434. }
  4435. } else if (!existing.includes(refValue)) {
  4436. existing.push(refValue);
  4437. }
  4438. }
  4439. } else if (_isString) {
  4440. refs[ref] = value;
  4441. if (hasOwn(setupState, ref)) {
  4442. setupState[ref] = value;
  4443. }
  4444. } else if (_isRef) {
  4445. ref.value = value;
  4446. if (rawRef.k)
  4447. refs[rawRef.k] = value;
  4448. } else if (!!(process.env.NODE_ENV !== "production")) {
  4449. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  4450. }
  4451. };
  4452. if (value) {
  4453. doSet.id = -1;
  4454. queuePostRenderEffect(doSet, parentSuspense);
  4455. } else {
  4456. doSet();
  4457. }
  4458. } else if (!!(process.env.NODE_ENV !== "production")) {
  4459. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  4460. }
  4461. }
  4462. }
  4463. let hasMismatch = false;
  4464. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  4465. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  4466. function createHydrationFunctions(rendererInternals) {
  4467. const {
  4468. mt: mountComponent,
  4469. p: patch,
  4470. o: {
  4471. patchProp,
  4472. createText,
  4473. nextSibling,
  4474. parentNode,
  4475. remove,
  4476. insert,
  4477. createComment
  4478. }
  4479. } = rendererInternals;
  4480. const hydrate = (vnode, container) => {
  4481. if (!container.hasChildNodes()) {
  4482. !!(process.env.NODE_ENV !== "production") && warn(
  4483. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  4484. );
  4485. patch(null, vnode, container);
  4486. flushPostFlushCbs();
  4487. container._vnode = vnode;
  4488. return;
  4489. }
  4490. hasMismatch = false;
  4491. hydrateNode(container.firstChild, vnode, null, null, null);
  4492. flushPostFlushCbs();
  4493. container._vnode = vnode;
  4494. if (hasMismatch && true) {
  4495. console.error(`Hydration completed but contains mismatches.`);
  4496. }
  4497. };
  4498. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  4499. const isFragmentStart = isComment(node) && node.data === "[";
  4500. const onMismatch = () => handleMismatch(
  4501. node,
  4502. vnode,
  4503. parentComponent,
  4504. parentSuspense,
  4505. slotScopeIds,
  4506. isFragmentStart
  4507. );
  4508. const { type, ref, shapeFlag, patchFlag } = vnode;
  4509. let domType = node.nodeType;
  4510. vnode.el = node;
  4511. if (patchFlag === -2) {
  4512. optimized = false;
  4513. vnode.dynamicChildren = null;
  4514. }
  4515. let nextNode = null;
  4516. switch (type) {
  4517. case Text:
  4518. if (domType !== 3 /* TEXT */) {
  4519. if (vnode.children === "") {
  4520. insert(vnode.el = createText(""), parentNode(node), node);
  4521. nextNode = node;
  4522. } else {
  4523. nextNode = onMismatch();
  4524. }
  4525. } else {
  4526. if (node.data !== vnode.children) {
  4527. hasMismatch = true;
  4528. !!(process.env.NODE_ENV !== "production") && warn(
  4529. `Hydration text mismatch:
  4530. - Client: ${JSON.stringify(node.data)}
  4531. - Server: ${JSON.stringify(vnode.children)}`
  4532. );
  4533. node.data = vnode.children;
  4534. }
  4535. nextNode = nextSibling(node);
  4536. }
  4537. break;
  4538. case Comment:
  4539. if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  4540. nextNode = onMismatch();
  4541. } else {
  4542. nextNode = nextSibling(node);
  4543. }
  4544. break;
  4545. case Static:
  4546. if (isFragmentStart) {
  4547. node = nextSibling(node);
  4548. domType = node.nodeType;
  4549. }
  4550. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  4551. nextNode = node;
  4552. const needToAdoptContent = !vnode.children.length;
  4553. for (let i = 0; i < vnode.staticCount; i++) {
  4554. if (needToAdoptContent)
  4555. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  4556. if (i === vnode.staticCount - 1) {
  4557. vnode.anchor = nextNode;
  4558. }
  4559. nextNode = nextSibling(nextNode);
  4560. }
  4561. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4562. } else {
  4563. onMismatch();
  4564. }
  4565. break;
  4566. case Fragment:
  4567. if (!isFragmentStart) {
  4568. nextNode = onMismatch();
  4569. } else {
  4570. nextNode = hydrateFragment(
  4571. node,
  4572. vnode,
  4573. parentComponent,
  4574. parentSuspense,
  4575. slotScopeIds,
  4576. optimized
  4577. );
  4578. }
  4579. break;
  4580. default:
  4581. if (shapeFlag & 1) {
  4582. if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  4583. nextNode = onMismatch();
  4584. } else {
  4585. nextNode = hydrateElement(
  4586. node,
  4587. vnode,
  4588. parentComponent,
  4589. parentSuspense,
  4590. slotScopeIds,
  4591. optimized
  4592. );
  4593. }
  4594. } else if (shapeFlag & 6) {
  4595. vnode.slotScopeIds = slotScopeIds;
  4596. const container = parentNode(node);
  4597. mountComponent(
  4598. vnode,
  4599. container,
  4600. null,
  4601. parentComponent,
  4602. parentSuspense,
  4603. isSVGContainer(container),
  4604. optimized
  4605. );
  4606. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  4607. if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
  4608. nextNode = nextSibling(nextNode);
  4609. }
  4610. if (isAsyncWrapper(vnode)) {
  4611. let subTree;
  4612. if (isFragmentStart) {
  4613. subTree = createVNode(Fragment);
  4614. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4615. } else {
  4616. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  4617. }
  4618. subTree.el = node;
  4619. vnode.component.subTree = subTree;
  4620. }
  4621. } else if (shapeFlag & 64) {
  4622. if (domType !== 8 /* COMMENT */) {
  4623. nextNode = onMismatch();
  4624. } else {
  4625. nextNode = vnode.type.hydrate(
  4626. node,
  4627. vnode,
  4628. parentComponent,
  4629. parentSuspense,
  4630. slotScopeIds,
  4631. optimized,
  4632. rendererInternals,
  4633. hydrateChildren
  4634. );
  4635. }
  4636. } else if (shapeFlag & 128) {
  4637. nextNode = vnode.type.hydrate(
  4638. node,
  4639. vnode,
  4640. parentComponent,
  4641. parentSuspense,
  4642. isSVGContainer(parentNode(node)),
  4643. slotScopeIds,
  4644. optimized,
  4645. rendererInternals,
  4646. hydrateNode
  4647. );
  4648. } else if (!!(process.env.NODE_ENV !== "production")) {
  4649. warn("Invalid HostVNode type:", type, `(${typeof type})`);
  4650. }
  4651. }
  4652. if (ref != null) {
  4653. setRef(ref, null, parentSuspense, vnode);
  4654. }
  4655. return nextNode;
  4656. };
  4657. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4658. optimized = optimized || !!vnode.dynamicChildren;
  4659. const { type, props, patchFlag, shapeFlag, dirs } = vnode;
  4660. const forcePatchValue = type === "input" && dirs || type === "option";
  4661. if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
  4662. if (dirs) {
  4663. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4664. }
  4665. if (props) {
  4666. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  4667. for (const key in props) {
  4668. if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
  4669. patchProp(
  4670. el,
  4671. key,
  4672. null,
  4673. props[key],
  4674. false,
  4675. void 0,
  4676. parentComponent
  4677. );
  4678. }
  4679. }
  4680. } else if (props.onClick) {
  4681. patchProp(
  4682. el,
  4683. "onClick",
  4684. null,
  4685. props.onClick,
  4686. false,
  4687. void 0,
  4688. parentComponent
  4689. );
  4690. }
  4691. }
  4692. let vnodeHooks;
  4693. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4694. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4695. }
  4696. if (dirs) {
  4697. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4698. }
  4699. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  4700. queueEffectWithSuspense(() => {
  4701. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4702. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4703. }, parentSuspense);
  4704. }
  4705. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4706. !(props && (props.innerHTML || props.textContent))) {
  4707. let next = hydrateChildren(
  4708. el.firstChild,
  4709. vnode,
  4710. el,
  4711. parentComponent,
  4712. parentSuspense,
  4713. slotScopeIds,
  4714. optimized
  4715. );
  4716. let hasWarned = false;
  4717. while (next) {
  4718. hasMismatch = true;
  4719. if (!!(process.env.NODE_ENV !== "production") && !hasWarned) {
  4720. warn(
  4721. `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
  4722. );
  4723. hasWarned = true;
  4724. }
  4725. const cur = next;
  4726. next = next.nextSibling;
  4727. remove(cur);
  4728. }
  4729. } else if (shapeFlag & 8) {
  4730. if (el.textContent !== vnode.children) {
  4731. hasMismatch = true;
  4732. !!(process.env.NODE_ENV !== "production") && warn(
  4733. `Hydration text content mismatch in <${vnode.type}>:
  4734. - Client: ${el.textContent}
  4735. - Server: ${vnode.children}`
  4736. );
  4737. el.textContent = vnode.children;
  4738. }
  4739. }
  4740. }
  4741. return el.nextSibling;
  4742. };
  4743. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4744. optimized = optimized || !!parentVNode.dynamicChildren;
  4745. const children = parentVNode.children;
  4746. const l = children.length;
  4747. let hasWarned = false;
  4748. for (let i = 0; i < l; i++) {
  4749. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4750. if (node) {
  4751. node = hydrateNode(
  4752. node,
  4753. vnode,
  4754. parentComponent,
  4755. parentSuspense,
  4756. slotScopeIds,
  4757. optimized
  4758. );
  4759. } else if (vnode.type === Text && !vnode.children) {
  4760. continue;
  4761. } else {
  4762. hasMismatch = true;
  4763. if (!!(process.env.NODE_ENV !== "production") && !hasWarned) {
  4764. warn(
  4765. `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
  4766. );
  4767. hasWarned = true;
  4768. }
  4769. patch(
  4770. null,
  4771. vnode,
  4772. container,
  4773. null,
  4774. parentComponent,
  4775. parentSuspense,
  4776. isSVGContainer(container),
  4777. slotScopeIds
  4778. );
  4779. }
  4780. }
  4781. return node;
  4782. };
  4783. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4784. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4785. if (fragmentSlotScopeIds) {
  4786. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4787. }
  4788. const container = parentNode(node);
  4789. const next = hydrateChildren(
  4790. nextSibling(node),
  4791. vnode,
  4792. container,
  4793. parentComponent,
  4794. parentSuspense,
  4795. slotScopeIds,
  4796. optimized
  4797. );
  4798. if (next && isComment(next) && next.data === "]") {
  4799. return nextSibling(vnode.anchor = next);
  4800. } else {
  4801. hasMismatch = true;
  4802. insert(vnode.anchor = createComment(`]`), container, next);
  4803. return next;
  4804. }
  4805. };
  4806. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4807. hasMismatch = true;
  4808. !!(process.env.NODE_ENV !== "production") && warn(
  4809. `Hydration node mismatch:
  4810. - Client vnode:`,
  4811. vnode.type,
  4812. `
  4813. - Server rendered DOM:`,
  4814. node,
  4815. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
  4816. );
  4817. vnode.el = null;
  4818. if (isFragment) {
  4819. const end = locateClosingAsyncAnchor(node);
  4820. while (true) {
  4821. const next2 = nextSibling(node);
  4822. if (next2 && next2 !== end) {
  4823. remove(next2);
  4824. } else {
  4825. break;
  4826. }
  4827. }
  4828. }
  4829. const next = nextSibling(node);
  4830. const container = parentNode(node);
  4831. remove(node);
  4832. patch(
  4833. null,
  4834. vnode,
  4835. container,
  4836. next,
  4837. parentComponent,
  4838. parentSuspense,
  4839. isSVGContainer(container),
  4840. slotScopeIds
  4841. );
  4842. return next;
  4843. };
  4844. const locateClosingAsyncAnchor = (node) => {
  4845. let match = 0;
  4846. while (node) {
  4847. node = nextSibling(node);
  4848. if (node && isComment(node)) {
  4849. if (node.data === "[")
  4850. match++;
  4851. if (node.data === "]") {
  4852. if (match === 0) {
  4853. return nextSibling(node);
  4854. } else {
  4855. match--;
  4856. }
  4857. }
  4858. }
  4859. }
  4860. return node;
  4861. };
  4862. return [hydrate, hydrateNode];
  4863. }
  4864. let supported;
  4865. let perf;
  4866. function startMeasure(instance, type) {
  4867. if (instance.appContext.config.performance && isSupported()) {
  4868. perf.mark(`vue-${type}-${instance.uid}`);
  4869. }
  4870. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  4871. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  4872. }
  4873. }
  4874. function endMeasure(instance, type) {
  4875. if (instance.appContext.config.performance && isSupported()) {
  4876. const startTag = `vue-${type}-${instance.uid}`;
  4877. const endTag = startTag + `:end`;
  4878. perf.mark(endTag);
  4879. perf.measure(
  4880. `<${formatComponentName(instance, instance.type)}> ${type}`,
  4881. startTag,
  4882. endTag
  4883. );
  4884. perf.clearMarks(startTag);
  4885. perf.clearMarks(endTag);
  4886. }
  4887. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  4888. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  4889. }
  4890. }
  4891. function isSupported() {
  4892. if (supported !== void 0) {
  4893. return supported;
  4894. }
  4895. if (typeof window !== "undefined" && window.performance) {
  4896. supported = true;
  4897. perf = window.performance;
  4898. } else {
  4899. supported = false;
  4900. }
  4901. return supported;
  4902. }
  4903. function initFeatureFlags() {
  4904. const needWarn = [];
  4905. if (typeof __VUE_OPTIONS_API__ !== "boolean") {
  4906. !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_OPTIONS_API__`);
  4907. getGlobalThis().__VUE_OPTIONS_API__ = true;
  4908. }
  4909. if (typeof __VUE_PROD_DEVTOOLS__ !== "boolean") {
  4910. !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
  4911. getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
  4912. }
  4913. if (!!(process.env.NODE_ENV !== "production") && needWarn.length) {
  4914. const multi = needWarn.length > 1;
  4915. console.warn(
  4916. `Feature flag${multi ? `s` : ``} ${needWarn.join(", ")} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
  4917. For more details, see https://link.vuejs.org/feature-flags.`
  4918. );
  4919. }
  4920. }
  4921. const queuePostRenderEffect = queueEffectWithSuspense ;
  4922. function createRenderer(options) {
  4923. return baseCreateRenderer(options);
  4924. }
  4925. function createHydrationRenderer(options) {
  4926. return baseCreateRenderer(options, createHydrationFunctions);
  4927. }
  4928. function baseCreateRenderer(options, createHydrationFns) {
  4929. {
  4930. initFeatureFlags();
  4931. }
  4932. const target = getGlobalThis();
  4933. target.__VUE__ = true;
  4934. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  4935. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  4936. }
  4937. const {
  4938. insert: hostInsert,
  4939. remove: hostRemove,
  4940. patchProp: hostPatchProp,
  4941. createElement: hostCreateElement,
  4942. createText: hostCreateText,
  4943. createComment: hostCreateComment,
  4944. setText: hostSetText,
  4945. setElementText: hostSetElementText,
  4946. parentNode: hostParentNode,
  4947. nextSibling: hostNextSibling,
  4948. setScopeId: hostSetScopeId = NOOP,
  4949. insertStaticContent: hostInsertStaticContent
  4950. } = options;
  4951. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!(process.env.NODE_ENV !== "production") && isHmrUpdating ? false : !!n2.dynamicChildren) => {
  4952. if (n1 === n2) {
  4953. return;
  4954. }
  4955. if (n1 && !isSameVNodeType(n1, n2)) {
  4956. anchor = getNextHostNode(n1);
  4957. unmount(n1, parentComponent, parentSuspense, true);
  4958. n1 = null;
  4959. }
  4960. if (n2.patchFlag === -2) {
  4961. optimized = false;
  4962. n2.dynamicChildren = null;
  4963. }
  4964. const { type, ref, shapeFlag } = n2;
  4965. switch (type) {
  4966. case Text:
  4967. processText(n1, n2, container, anchor);
  4968. break;
  4969. case Comment:
  4970. processCommentNode(n1, n2, container, anchor);
  4971. break;
  4972. case Static:
  4973. if (n1 == null) {
  4974. mountStaticNode(n2, container, anchor, isSVG);
  4975. } else if (!!(process.env.NODE_ENV !== "production")) {
  4976. patchStaticNode(n1, n2, container, isSVG);
  4977. }
  4978. break;
  4979. case Fragment:
  4980. processFragment(
  4981. n1,
  4982. n2,
  4983. container,
  4984. anchor,
  4985. parentComponent,
  4986. parentSuspense,
  4987. isSVG,
  4988. slotScopeIds,
  4989. optimized
  4990. );
  4991. break;
  4992. default:
  4993. if (shapeFlag & 1) {
  4994. processElement(
  4995. n1,
  4996. n2,
  4997. container,
  4998. anchor,
  4999. parentComponent,
  5000. parentSuspense,
  5001. isSVG,
  5002. slotScopeIds,
  5003. optimized
  5004. );
  5005. } else if (shapeFlag & 6) {
  5006. processComponent(
  5007. n1,
  5008. n2,
  5009. container,
  5010. anchor,
  5011. parentComponent,
  5012. parentSuspense,
  5013. isSVG,
  5014. slotScopeIds,
  5015. optimized
  5016. );
  5017. } else if (shapeFlag & 64) {
  5018. type.process(
  5019. n1,
  5020. n2,
  5021. container,
  5022. anchor,
  5023. parentComponent,
  5024. parentSuspense,
  5025. isSVG,
  5026. slotScopeIds,
  5027. optimized,
  5028. internals
  5029. );
  5030. } else if (shapeFlag & 128) {
  5031. type.process(
  5032. n1,
  5033. n2,
  5034. container,
  5035. anchor,
  5036. parentComponent,
  5037. parentSuspense,
  5038. isSVG,
  5039. slotScopeIds,
  5040. optimized,
  5041. internals
  5042. );
  5043. } else if (!!(process.env.NODE_ENV !== "production")) {
  5044. warn("Invalid VNode type:", type, `(${typeof type})`);
  5045. }
  5046. }
  5047. if (ref != null && parentComponent) {
  5048. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  5049. }
  5050. };
  5051. const processText = (n1, n2, container, anchor) => {
  5052. if (n1 == null) {
  5053. hostInsert(
  5054. n2.el = hostCreateText(n2.children),
  5055. container,
  5056. anchor
  5057. );
  5058. } else {
  5059. const el = n2.el = n1.el;
  5060. if (n2.children !== n1.children) {
  5061. hostSetText(el, n2.children);
  5062. }
  5063. }
  5064. };
  5065. const processCommentNode = (n1, n2, container, anchor) => {
  5066. if (n1 == null) {
  5067. hostInsert(
  5068. n2.el = hostCreateComment(n2.children || ""),
  5069. container,
  5070. anchor
  5071. );
  5072. } else {
  5073. n2.el = n1.el;
  5074. }
  5075. };
  5076. const mountStaticNode = (n2, container, anchor, isSVG) => {
  5077. [n2.el, n2.anchor] = hostInsertStaticContent(
  5078. n2.children,
  5079. container,
  5080. anchor,
  5081. isSVG,
  5082. n2.el,
  5083. n2.anchor
  5084. );
  5085. };
  5086. const patchStaticNode = (n1, n2, container, isSVG) => {
  5087. if (n2.children !== n1.children) {
  5088. const anchor = hostNextSibling(n1.anchor);
  5089. removeStaticNode(n1);
  5090. [n2.el, n2.anchor] = hostInsertStaticContent(
  5091. n2.children,
  5092. container,
  5093. anchor,
  5094. isSVG
  5095. );
  5096. } else {
  5097. n2.el = n1.el;
  5098. n2.anchor = n1.anchor;
  5099. }
  5100. };
  5101. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  5102. let next;
  5103. while (el && el !== anchor) {
  5104. next = hostNextSibling(el);
  5105. hostInsert(el, container, nextSibling);
  5106. el = next;
  5107. }
  5108. hostInsert(anchor, container, nextSibling);
  5109. };
  5110. const removeStaticNode = ({ el, anchor }) => {
  5111. let next;
  5112. while (el && el !== anchor) {
  5113. next = hostNextSibling(el);
  5114. hostRemove(el);
  5115. el = next;
  5116. }
  5117. hostRemove(anchor);
  5118. };
  5119. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5120. isSVG = isSVG || n2.type === "svg";
  5121. if (n1 == null) {
  5122. mountElement(
  5123. n2,
  5124. container,
  5125. anchor,
  5126. parentComponent,
  5127. parentSuspense,
  5128. isSVG,
  5129. slotScopeIds,
  5130. optimized
  5131. );
  5132. } else {
  5133. patchElement(
  5134. n1,
  5135. n2,
  5136. parentComponent,
  5137. parentSuspense,
  5138. isSVG,
  5139. slotScopeIds,
  5140. optimized
  5141. );
  5142. }
  5143. };
  5144. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5145. let el;
  5146. let vnodeHook;
  5147. const { type, props, shapeFlag, transition, dirs } = vnode;
  5148. el = vnode.el = hostCreateElement(
  5149. vnode.type,
  5150. isSVG,
  5151. props && props.is,
  5152. props
  5153. );
  5154. if (shapeFlag & 8) {
  5155. hostSetElementText(el, vnode.children);
  5156. } else if (shapeFlag & 16) {
  5157. mountChildren(
  5158. vnode.children,
  5159. el,
  5160. null,
  5161. parentComponent,
  5162. parentSuspense,
  5163. isSVG && type !== "foreignObject",
  5164. slotScopeIds,
  5165. optimized
  5166. );
  5167. }
  5168. if (dirs) {
  5169. invokeDirectiveHook(vnode, null, parentComponent, "created");
  5170. }
  5171. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  5172. if (props) {
  5173. for (const key in props) {
  5174. if (key !== "value" && !isReservedProp(key)) {
  5175. hostPatchProp(
  5176. el,
  5177. key,
  5178. null,
  5179. props[key],
  5180. isSVG,
  5181. vnode.children,
  5182. parentComponent,
  5183. parentSuspense,
  5184. unmountChildren
  5185. );
  5186. }
  5187. }
  5188. if ("value" in props) {
  5189. hostPatchProp(el, "value", null, props.value);
  5190. }
  5191. if (vnodeHook = props.onVnodeBeforeMount) {
  5192. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5193. }
  5194. }
  5195. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  5196. Object.defineProperty(el, "__vnode", {
  5197. value: vnode,
  5198. enumerable: false
  5199. });
  5200. Object.defineProperty(el, "__vueParentComponent", {
  5201. value: parentComponent,
  5202. enumerable: false
  5203. });
  5204. }
  5205. if (dirs) {
  5206. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  5207. }
  5208. const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  5209. if (needCallTransitionHooks) {
  5210. transition.beforeEnter(el);
  5211. }
  5212. hostInsert(el, container, anchor);
  5213. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  5214. queuePostRenderEffect(() => {
  5215. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5216. needCallTransitionHooks && transition.enter(el);
  5217. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  5218. }, parentSuspense);
  5219. }
  5220. };
  5221. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  5222. if (scopeId) {
  5223. hostSetScopeId(el, scopeId);
  5224. }
  5225. if (slotScopeIds) {
  5226. for (let i = 0; i < slotScopeIds.length; i++) {
  5227. hostSetScopeId(el, slotScopeIds[i]);
  5228. }
  5229. }
  5230. if (parentComponent) {
  5231. let subTree = parentComponent.subTree;
  5232. if (!!(process.env.NODE_ENV !== "production") && subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  5233. subTree = filterSingleRoot(subTree.children) || subTree;
  5234. }
  5235. if (vnode === subTree) {
  5236. const parentVNode = parentComponent.vnode;
  5237. setScopeId(
  5238. el,
  5239. parentVNode,
  5240. parentVNode.scopeId,
  5241. parentVNode.slotScopeIds,
  5242. parentComponent.parent
  5243. );
  5244. }
  5245. }
  5246. };
  5247. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  5248. for (let i = start; i < children.length; i++) {
  5249. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  5250. patch(
  5251. null,
  5252. child,
  5253. container,
  5254. anchor,
  5255. parentComponent,
  5256. parentSuspense,
  5257. isSVG,
  5258. slotScopeIds,
  5259. optimized
  5260. );
  5261. }
  5262. };
  5263. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5264. const el = n2.el = n1.el;
  5265. let { patchFlag, dynamicChildren, dirs } = n2;
  5266. patchFlag |= n1.patchFlag & 16;
  5267. const oldProps = n1.props || EMPTY_OBJ;
  5268. const newProps = n2.props || EMPTY_OBJ;
  5269. let vnodeHook;
  5270. parentComponent && toggleRecurse(parentComponent, false);
  5271. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  5272. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  5273. }
  5274. if (dirs) {
  5275. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  5276. }
  5277. parentComponent && toggleRecurse(parentComponent, true);
  5278. if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
  5279. patchFlag = 0;
  5280. optimized = false;
  5281. dynamicChildren = null;
  5282. }
  5283. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  5284. if (dynamicChildren) {
  5285. patchBlockChildren(
  5286. n1.dynamicChildren,
  5287. dynamicChildren,
  5288. el,
  5289. parentComponent,
  5290. parentSuspense,
  5291. areChildrenSVG,
  5292. slotScopeIds
  5293. );
  5294. if (!!(process.env.NODE_ENV !== "production")) {
  5295. traverseStaticChildren(n1, n2);
  5296. }
  5297. } else if (!optimized) {
  5298. patchChildren(
  5299. n1,
  5300. n2,
  5301. el,
  5302. null,
  5303. parentComponent,
  5304. parentSuspense,
  5305. areChildrenSVG,
  5306. slotScopeIds,
  5307. false
  5308. );
  5309. }
  5310. if (patchFlag > 0) {
  5311. if (patchFlag & 16) {
  5312. patchProps(
  5313. el,
  5314. n2,
  5315. oldProps,
  5316. newProps,
  5317. parentComponent,
  5318. parentSuspense,
  5319. isSVG
  5320. );
  5321. } else {
  5322. if (patchFlag & 2) {
  5323. if (oldProps.class !== newProps.class) {
  5324. hostPatchProp(el, "class", null, newProps.class, isSVG);
  5325. }
  5326. }
  5327. if (patchFlag & 4) {
  5328. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  5329. }
  5330. if (patchFlag & 8) {
  5331. const propsToUpdate = n2.dynamicProps;
  5332. for (let i = 0; i < propsToUpdate.length; i++) {
  5333. const key = propsToUpdate[i];
  5334. const prev = oldProps[key];
  5335. const next = newProps[key];
  5336. if (next !== prev || key === "value") {
  5337. hostPatchProp(
  5338. el,
  5339. key,
  5340. prev,
  5341. next,
  5342. isSVG,
  5343. n1.children,
  5344. parentComponent,
  5345. parentSuspense,
  5346. unmountChildren
  5347. );
  5348. }
  5349. }
  5350. }
  5351. }
  5352. if (patchFlag & 1) {
  5353. if (n1.children !== n2.children) {
  5354. hostSetElementText(el, n2.children);
  5355. }
  5356. }
  5357. } else if (!optimized && dynamicChildren == null) {
  5358. patchProps(
  5359. el,
  5360. n2,
  5361. oldProps,
  5362. newProps,
  5363. parentComponent,
  5364. parentSuspense,
  5365. isSVG
  5366. );
  5367. }
  5368. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  5369. queuePostRenderEffect(() => {
  5370. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  5371. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  5372. }, parentSuspense);
  5373. }
  5374. };
  5375. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  5376. for (let i = 0; i < newChildren.length; i++) {
  5377. const oldVNode = oldChildren[i];
  5378. const newVNode = newChildren[i];
  5379. const container = (
  5380. // oldVNode may be an errored async setup() component inside Suspense
  5381. // which will not have a mounted element
  5382. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  5383. // of the Fragment itself so it can move its children.
  5384. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  5385. // which also requires the correct parent container
  5386. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  5387. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  5388. // In other cases, the parent container is not actually used so we
  5389. // just pass the block element here to avoid a DOM parentNode call.
  5390. fallbackContainer
  5391. )
  5392. );
  5393. patch(
  5394. oldVNode,
  5395. newVNode,
  5396. container,
  5397. null,
  5398. parentComponent,
  5399. parentSuspense,
  5400. isSVG,
  5401. slotScopeIds,
  5402. true
  5403. );
  5404. }
  5405. };
  5406. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  5407. if (oldProps !== newProps) {
  5408. if (oldProps !== EMPTY_OBJ) {
  5409. for (const key in oldProps) {
  5410. if (!isReservedProp(key) && !(key in newProps)) {
  5411. hostPatchProp(
  5412. el,
  5413. key,
  5414. oldProps[key],
  5415. null,
  5416. isSVG,
  5417. vnode.children,
  5418. parentComponent,
  5419. parentSuspense,
  5420. unmountChildren
  5421. );
  5422. }
  5423. }
  5424. }
  5425. for (const key in newProps) {
  5426. if (isReservedProp(key))
  5427. continue;
  5428. const next = newProps[key];
  5429. const prev = oldProps[key];
  5430. if (next !== prev && key !== "value") {
  5431. hostPatchProp(
  5432. el,
  5433. key,
  5434. prev,
  5435. next,
  5436. isSVG,
  5437. vnode.children,
  5438. parentComponent,
  5439. parentSuspense,
  5440. unmountChildren
  5441. );
  5442. }
  5443. }
  5444. if ("value" in newProps) {
  5445. hostPatchProp(el, "value", oldProps.value, newProps.value);
  5446. }
  5447. }
  5448. };
  5449. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5450. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  5451. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  5452. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  5453. if (!!(process.env.NODE_ENV !== "production") && // #5523 dev root fragment may inherit directives
  5454. (isHmrUpdating || patchFlag & 2048)) {
  5455. patchFlag = 0;
  5456. optimized = false;
  5457. dynamicChildren = null;
  5458. }
  5459. if (fragmentSlotScopeIds) {
  5460. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  5461. }
  5462. if (n1 == null) {
  5463. hostInsert(fragmentStartAnchor, container, anchor);
  5464. hostInsert(fragmentEndAnchor, container, anchor);
  5465. mountChildren(
  5466. n2.children,
  5467. container,
  5468. fragmentEndAnchor,
  5469. parentComponent,
  5470. parentSuspense,
  5471. isSVG,
  5472. slotScopeIds,
  5473. optimized
  5474. );
  5475. } else {
  5476. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  5477. // of renderSlot() with no valid children
  5478. n1.dynamicChildren) {
  5479. patchBlockChildren(
  5480. n1.dynamicChildren,
  5481. dynamicChildren,
  5482. container,
  5483. parentComponent,
  5484. parentSuspense,
  5485. isSVG,
  5486. slotScopeIds
  5487. );
  5488. if (!!(process.env.NODE_ENV !== "production")) {
  5489. traverseStaticChildren(n1, n2);
  5490. } else if (
  5491. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  5492. // get moved around. Make sure all root level vnodes inherit el.
  5493. // #2134 or if it's a component root, it may also get moved around
  5494. // as the component is being moved.
  5495. n2.key != null || parentComponent && n2 === parentComponent.subTree
  5496. ) {
  5497. traverseStaticChildren(
  5498. n1,
  5499. n2,
  5500. true
  5501. /* shallow */
  5502. );
  5503. }
  5504. } else {
  5505. patchChildren(
  5506. n1,
  5507. n2,
  5508. container,
  5509. fragmentEndAnchor,
  5510. parentComponent,
  5511. parentSuspense,
  5512. isSVG,
  5513. slotScopeIds,
  5514. optimized
  5515. );
  5516. }
  5517. }
  5518. };
  5519. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5520. n2.slotScopeIds = slotScopeIds;
  5521. if (n1 == null) {
  5522. if (n2.shapeFlag & 512) {
  5523. parentComponent.ctx.activate(
  5524. n2,
  5525. container,
  5526. anchor,
  5527. isSVG,
  5528. optimized
  5529. );
  5530. } else {
  5531. mountComponent(
  5532. n2,
  5533. container,
  5534. anchor,
  5535. parentComponent,
  5536. parentSuspense,
  5537. isSVG,
  5538. optimized
  5539. );
  5540. }
  5541. } else {
  5542. updateComponent(n1, n2, optimized);
  5543. }
  5544. };
  5545. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  5546. const instance = (initialVNode.component = createComponentInstance(
  5547. initialVNode,
  5548. parentComponent,
  5549. parentSuspense
  5550. ));
  5551. if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
  5552. registerHMR(instance);
  5553. }
  5554. if (!!(process.env.NODE_ENV !== "production")) {
  5555. pushWarningContext(initialVNode);
  5556. startMeasure(instance, `mount`);
  5557. }
  5558. if (isKeepAlive(initialVNode)) {
  5559. instance.ctx.renderer = internals;
  5560. }
  5561. {
  5562. if (!!(process.env.NODE_ENV !== "production")) {
  5563. startMeasure(instance, `init`);
  5564. }
  5565. setupComponent(instance);
  5566. if (!!(process.env.NODE_ENV !== "production")) {
  5567. endMeasure(instance, `init`);
  5568. }
  5569. }
  5570. if (instance.asyncDep) {
  5571. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  5572. if (!initialVNode.el) {
  5573. const placeholder = instance.subTree = createVNode(Comment);
  5574. processCommentNode(null, placeholder, container, anchor);
  5575. }
  5576. return;
  5577. }
  5578. setupRenderEffect(
  5579. instance,
  5580. initialVNode,
  5581. container,
  5582. anchor,
  5583. parentSuspense,
  5584. isSVG,
  5585. optimized
  5586. );
  5587. if (!!(process.env.NODE_ENV !== "production")) {
  5588. popWarningContext();
  5589. endMeasure(instance, `mount`);
  5590. }
  5591. };
  5592. const updateComponent = (n1, n2, optimized) => {
  5593. const instance = n2.component = n1.component;
  5594. if (shouldUpdateComponent(n1, n2, optimized)) {
  5595. if (instance.asyncDep && !instance.asyncResolved) {
  5596. if (!!(process.env.NODE_ENV !== "production")) {
  5597. pushWarningContext(n2);
  5598. }
  5599. updateComponentPreRender(instance, n2, optimized);
  5600. if (!!(process.env.NODE_ENV !== "production")) {
  5601. popWarningContext();
  5602. }
  5603. return;
  5604. } else {
  5605. instance.next = n2;
  5606. invalidateJob(instance.update);
  5607. instance.update();
  5608. }
  5609. } else {
  5610. n2.el = n1.el;
  5611. instance.vnode = n2;
  5612. }
  5613. };
  5614. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  5615. const componentUpdateFn = () => {
  5616. if (!instance.isMounted) {
  5617. let vnodeHook;
  5618. const { el, props } = initialVNode;
  5619. const { bm, m, parent } = instance;
  5620. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  5621. toggleRecurse(instance, false);
  5622. if (bm) {
  5623. invokeArrayFns(bm);
  5624. }
  5625. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  5626. invokeVNodeHook(vnodeHook, parent, initialVNode);
  5627. }
  5628. toggleRecurse(instance, true);
  5629. if (el && hydrateNode) {
  5630. const hydrateSubTree = () => {
  5631. if (!!(process.env.NODE_ENV !== "production")) {
  5632. startMeasure(instance, `render`);
  5633. }
  5634. instance.subTree = renderComponentRoot(instance);
  5635. if (!!(process.env.NODE_ENV !== "production")) {
  5636. endMeasure(instance, `render`);
  5637. }
  5638. if (!!(process.env.NODE_ENV !== "production")) {
  5639. startMeasure(instance, `hydrate`);
  5640. }
  5641. hydrateNode(
  5642. el,
  5643. instance.subTree,
  5644. instance,
  5645. parentSuspense,
  5646. null
  5647. );
  5648. if (!!(process.env.NODE_ENV !== "production")) {
  5649. endMeasure(instance, `hydrate`);
  5650. }
  5651. };
  5652. if (isAsyncWrapperVNode) {
  5653. initialVNode.type.__asyncLoader().then(
  5654. // note: we are moving the render call into an async callback,
  5655. // which means it won't track dependencies - but it's ok because
  5656. // a server-rendered async wrapper is already in resolved state
  5657. // and it will never need to change.
  5658. () => !instance.isUnmounted && hydrateSubTree()
  5659. );
  5660. } else {
  5661. hydrateSubTree();
  5662. }
  5663. } else {
  5664. if (!!(process.env.NODE_ENV !== "production")) {
  5665. startMeasure(instance, `render`);
  5666. }
  5667. const subTree = instance.subTree = renderComponentRoot(instance);
  5668. if (!!(process.env.NODE_ENV !== "production")) {
  5669. endMeasure(instance, `render`);
  5670. }
  5671. if (!!(process.env.NODE_ENV !== "production")) {
  5672. startMeasure(instance, `patch`);
  5673. }
  5674. patch(
  5675. null,
  5676. subTree,
  5677. container,
  5678. anchor,
  5679. instance,
  5680. parentSuspense,
  5681. isSVG
  5682. );
  5683. if (!!(process.env.NODE_ENV !== "production")) {
  5684. endMeasure(instance, `patch`);
  5685. }
  5686. initialVNode.el = subTree.el;
  5687. }
  5688. if (m) {
  5689. queuePostRenderEffect(m, parentSuspense);
  5690. }
  5691. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  5692. const scopedInitialVNode = initialVNode;
  5693. queuePostRenderEffect(
  5694. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  5695. parentSuspense
  5696. );
  5697. }
  5698. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  5699. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  5700. }
  5701. instance.isMounted = true;
  5702. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  5703. devtoolsComponentAdded(instance);
  5704. }
  5705. initialVNode = container = anchor = null;
  5706. } else {
  5707. let { next, bu, u, parent, vnode } = instance;
  5708. let originNext = next;
  5709. let vnodeHook;
  5710. if (!!(process.env.NODE_ENV !== "production")) {
  5711. pushWarningContext(next || instance.vnode);
  5712. }
  5713. toggleRecurse(instance, false);
  5714. if (next) {
  5715. next.el = vnode.el;
  5716. updateComponentPreRender(instance, next, optimized);
  5717. } else {
  5718. next = vnode;
  5719. }
  5720. if (bu) {
  5721. invokeArrayFns(bu);
  5722. }
  5723. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  5724. invokeVNodeHook(vnodeHook, parent, next, vnode);
  5725. }
  5726. toggleRecurse(instance, true);
  5727. if (!!(process.env.NODE_ENV !== "production")) {
  5728. startMeasure(instance, `render`);
  5729. }
  5730. const nextTree = renderComponentRoot(instance);
  5731. if (!!(process.env.NODE_ENV !== "production")) {
  5732. endMeasure(instance, `render`);
  5733. }
  5734. const prevTree = instance.subTree;
  5735. instance.subTree = nextTree;
  5736. if (!!(process.env.NODE_ENV !== "production")) {
  5737. startMeasure(instance, `patch`);
  5738. }
  5739. patch(
  5740. prevTree,
  5741. nextTree,
  5742. // parent may have changed if it's in a teleport
  5743. hostParentNode(prevTree.el),
  5744. // anchor may have changed if it's in a fragment
  5745. getNextHostNode(prevTree),
  5746. instance,
  5747. parentSuspense,
  5748. isSVG
  5749. );
  5750. if (!!(process.env.NODE_ENV !== "production")) {
  5751. endMeasure(instance, `patch`);
  5752. }
  5753. next.el = nextTree.el;
  5754. if (originNext === null) {
  5755. updateHOCHostEl(instance, nextTree.el);
  5756. }
  5757. if (u) {
  5758. queuePostRenderEffect(u, parentSuspense);
  5759. }
  5760. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  5761. queuePostRenderEffect(
  5762. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  5763. parentSuspense
  5764. );
  5765. }
  5766. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  5767. devtoolsComponentUpdated(instance);
  5768. }
  5769. if (!!(process.env.NODE_ENV !== "production")) {
  5770. popWarningContext();
  5771. }
  5772. }
  5773. };
  5774. const effect = instance.effect = new ReactiveEffect(
  5775. componentUpdateFn,
  5776. () => queueJob(update),
  5777. instance.scope
  5778. // track it in component's effect scope
  5779. );
  5780. const update = instance.update = () => effect.run();
  5781. update.id = instance.uid;
  5782. toggleRecurse(instance, true);
  5783. if (!!(process.env.NODE_ENV !== "production")) {
  5784. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  5785. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  5786. update.ownerInstance = instance;
  5787. }
  5788. update();
  5789. };
  5790. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  5791. nextVNode.component = instance;
  5792. const prevProps = instance.vnode.props;
  5793. instance.vnode = nextVNode;
  5794. instance.next = null;
  5795. updateProps(instance, nextVNode.props, prevProps, optimized);
  5796. updateSlots(instance, nextVNode.children, optimized);
  5797. pauseTracking();
  5798. flushPreFlushCbs();
  5799. resetTracking();
  5800. };
  5801. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  5802. const c1 = n1 && n1.children;
  5803. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  5804. const c2 = n2.children;
  5805. const { patchFlag, shapeFlag } = n2;
  5806. if (patchFlag > 0) {
  5807. if (patchFlag & 128) {
  5808. patchKeyedChildren(
  5809. c1,
  5810. c2,
  5811. container,
  5812. anchor,
  5813. parentComponent,
  5814. parentSuspense,
  5815. isSVG,
  5816. slotScopeIds,
  5817. optimized
  5818. );
  5819. return;
  5820. } else if (patchFlag & 256) {
  5821. patchUnkeyedChildren(
  5822. c1,
  5823. c2,
  5824. container,
  5825. anchor,
  5826. parentComponent,
  5827. parentSuspense,
  5828. isSVG,
  5829. slotScopeIds,
  5830. optimized
  5831. );
  5832. return;
  5833. }
  5834. }
  5835. if (shapeFlag & 8) {
  5836. if (prevShapeFlag & 16) {
  5837. unmountChildren(c1, parentComponent, parentSuspense);
  5838. }
  5839. if (c2 !== c1) {
  5840. hostSetElementText(container, c2);
  5841. }
  5842. } else {
  5843. if (prevShapeFlag & 16) {
  5844. if (shapeFlag & 16) {
  5845. patchKeyedChildren(
  5846. c1,
  5847. c2,
  5848. container,
  5849. anchor,
  5850. parentComponent,
  5851. parentSuspense,
  5852. isSVG,
  5853. slotScopeIds,
  5854. optimized
  5855. );
  5856. } else {
  5857. unmountChildren(c1, parentComponent, parentSuspense, true);
  5858. }
  5859. } else {
  5860. if (prevShapeFlag & 8) {
  5861. hostSetElementText(container, "");
  5862. }
  5863. if (shapeFlag & 16) {
  5864. mountChildren(
  5865. c2,
  5866. container,
  5867. anchor,
  5868. parentComponent,
  5869. parentSuspense,
  5870. isSVG,
  5871. slotScopeIds,
  5872. optimized
  5873. );
  5874. }
  5875. }
  5876. }
  5877. };
  5878. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5879. c1 = c1 || EMPTY_ARR;
  5880. c2 = c2 || EMPTY_ARR;
  5881. const oldLength = c1.length;
  5882. const newLength = c2.length;
  5883. const commonLength = Math.min(oldLength, newLength);
  5884. let i;
  5885. for (i = 0; i < commonLength; i++) {
  5886. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5887. patch(
  5888. c1[i],
  5889. nextChild,
  5890. container,
  5891. null,
  5892. parentComponent,
  5893. parentSuspense,
  5894. isSVG,
  5895. slotScopeIds,
  5896. optimized
  5897. );
  5898. }
  5899. if (oldLength > newLength) {
  5900. unmountChildren(
  5901. c1,
  5902. parentComponent,
  5903. parentSuspense,
  5904. true,
  5905. false,
  5906. commonLength
  5907. );
  5908. } else {
  5909. mountChildren(
  5910. c2,
  5911. container,
  5912. anchor,
  5913. parentComponent,
  5914. parentSuspense,
  5915. isSVG,
  5916. slotScopeIds,
  5917. optimized,
  5918. commonLength
  5919. );
  5920. }
  5921. };
  5922. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5923. let i = 0;
  5924. const l2 = c2.length;
  5925. let e1 = c1.length - 1;
  5926. let e2 = l2 - 1;
  5927. while (i <= e1 && i <= e2) {
  5928. const n1 = c1[i];
  5929. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5930. if (isSameVNodeType(n1, n2)) {
  5931. patch(
  5932. n1,
  5933. n2,
  5934. container,
  5935. null,
  5936. parentComponent,
  5937. parentSuspense,
  5938. isSVG,
  5939. slotScopeIds,
  5940. optimized
  5941. );
  5942. } else {
  5943. break;
  5944. }
  5945. i++;
  5946. }
  5947. while (i <= e1 && i <= e2) {
  5948. const n1 = c1[e1];
  5949. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  5950. if (isSameVNodeType(n1, n2)) {
  5951. patch(
  5952. n1,
  5953. n2,
  5954. container,
  5955. null,
  5956. parentComponent,
  5957. parentSuspense,
  5958. isSVG,
  5959. slotScopeIds,
  5960. optimized
  5961. );
  5962. } else {
  5963. break;
  5964. }
  5965. e1--;
  5966. e2--;
  5967. }
  5968. if (i > e1) {
  5969. if (i <= e2) {
  5970. const nextPos = e2 + 1;
  5971. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  5972. while (i <= e2) {
  5973. patch(
  5974. null,
  5975. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  5976. container,
  5977. anchor,
  5978. parentComponent,
  5979. parentSuspense,
  5980. isSVG,
  5981. slotScopeIds,
  5982. optimized
  5983. );
  5984. i++;
  5985. }
  5986. }
  5987. } else if (i > e2) {
  5988. while (i <= e1) {
  5989. unmount(c1[i], parentComponent, parentSuspense, true);
  5990. i++;
  5991. }
  5992. } else {
  5993. const s1 = i;
  5994. const s2 = i;
  5995. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  5996. for (i = s2; i <= e2; i++) {
  5997. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5998. if (nextChild.key != null) {
  5999. if (!!(process.env.NODE_ENV !== "production") && keyToNewIndexMap.has(nextChild.key)) {
  6000. warn(
  6001. `Duplicate keys found during update:`,
  6002. JSON.stringify(nextChild.key),
  6003. `Make sure keys are unique.`
  6004. );
  6005. }
  6006. keyToNewIndexMap.set(nextChild.key, i);
  6007. }
  6008. }
  6009. let j;
  6010. let patched = 0;
  6011. const toBePatched = e2 - s2 + 1;
  6012. let moved = false;
  6013. let maxNewIndexSoFar = 0;
  6014. const newIndexToOldIndexMap = new Array(toBePatched);
  6015. for (i = 0; i < toBePatched; i++)
  6016. newIndexToOldIndexMap[i] = 0;
  6017. for (i = s1; i <= e1; i++) {
  6018. const prevChild = c1[i];
  6019. if (patched >= toBePatched) {
  6020. unmount(prevChild, parentComponent, parentSuspense, true);
  6021. continue;
  6022. }
  6023. let newIndex;
  6024. if (prevChild.key != null) {
  6025. newIndex = keyToNewIndexMap.get(prevChild.key);
  6026. } else {
  6027. for (j = s2; j <= e2; j++) {
  6028. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  6029. newIndex = j;
  6030. break;
  6031. }
  6032. }
  6033. }
  6034. if (newIndex === void 0) {
  6035. unmount(prevChild, parentComponent, parentSuspense, true);
  6036. } else {
  6037. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  6038. if (newIndex >= maxNewIndexSoFar) {
  6039. maxNewIndexSoFar = newIndex;
  6040. } else {
  6041. moved = true;
  6042. }
  6043. patch(
  6044. prevChild,
  6045. c2[newIndex],
  6046. container,
  6047. null,
  6048. parentComponent,
  6049. parentSuspense,
  6050. isSVG,
  6051. slotScopeIds,
  6052. optimized
  6053. );
  6054. patched++;
  6055. }
  6056. }
  6057. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  6058. j = increasingNewIndexSequence.length - 1;
  6059. for (i = toBePatched - 1; i >= 0; i--) {
  6060. const nextIndex = s2 + i;
  6061. const nextChild = c2[nextIndex];
  6062. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  6063. if (newIndexToOldIndexMap[i] === 0) {
  6064. patch(
  6065. null,
  6066. nextChild,
  6067. container,
  6068. anchor,
  6069. parentComponent,
  6070. parentSuspense,
  6071. isSVG,
  6072. slotScopeIds,
  6073. optimized
  6074. );
  6075. } else if (moved) {
  6076. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  6077. move(nextChild, container, anchor, 2);
  6078. } else {
  6079. j--;
  6080. }
  6081. }
  6082. }
  6083. }
  6084. };
  6085. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  6086. const { el, type, transition, children, shapeFlag } = vnode;
  6087. if (shapeFlag & 6) {
  6088. move(vnode.component.subTree, container, anchor, moveType);
  6089. return;
  6090. }
  6091. if (shapeFlag & 128) {
  6092. vnode.suspense.move(container, anchor, moveType);
  6093. return;
  6094. }
  6095. if (shapeFlag & 64) {
  6096. type.move(vnode, container, anchor, internals);
  6097. return;
  6098. }
  6099. if (type === Fragment) {
  6100. hostInsert(el, container, anchor);
  6101. for (let i = 0; i < children.length; i++) {
  6102. move(children[i], container, anchor, moveType);
  6103. }
  6104. hostInsert(vnode.anchor, container, anchor);
  6105. return;
  6106. }
  6107. if (type === Static) {
  6108. moveStaticNode(vnode, container, anchor);
  6109. return;
  6110. }
  6111. const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
  6112. if (needTransition) {
  6113. if (moveType === 0) {
  6114. transition.beforeEnter(el);
  6115. hostInsert(el, container, anchor);
  6116. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  6117. } else {
  6118. const { leave, delayLeave, afterLeave } = transition;
  6119. const remove2 = () => hostInsert(el, container, anchor);
  6120. const performLeave = () => {
  6121. leave(el, () => {
  6122. remove2();
  6123. afterLeave && afterLeave();
  6124. });
  6125. };
  6126. if (delayLeave) {
  6127. delayLeave(el, remove2, performLeave);
  6128. } else {
  6129. performLeave();
  6130. }
  6131. }
  6132. } else {
  6133. hostInsert(el, container, anchor);
  6134. }
  6135. };
  6136. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  6137. const {
  6138. type,
  6139. props,
  6140. ref,
  6141. children,
  6142. dynamicChildren,
  6143. shapeFlag,
  6144. patchFlag,
  6145. dirs
  6146. } = vnode;
  6147. if (ref != null) {
  6148. setRef(ref, null, parentSuspense, vnode, true);
  6149. }
  6150. if (shapeFlag & 256) {
  6151. parentComponent.ctx.deactivate(vnode);
  6152. return;
  6153. }
  6154. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  6155. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  6156. let vnodeHook;
  6157. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  6158. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6159. }
  6160. if (shapeFlag & 6) {
  6161. unmountComponent(vnode.component, parentSuspense, doRemove);
  6162. } else {
  6163. if (shapeFlag & 128) {
  6164. vnode.suspense.unmount(parentSuspense, doRemove);
  6165. return;
  6166. }
  6167. if (shouldInvokeDirs) {
  6168. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  6169. }
  6170. if (shapeFlag & 64) {
  6171. vnode.type.remove(
  6172. vnode,
  6173. parentComponent,
  6174. parentSuspense,
  6175. optimized,
  6176. internals,
  6177. doRemove
  6178. );
  6179. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  6180. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  6181. unmountChildren(
  6182. dynamicChildren,
  6183. parentComponent,
  6184. parentSuspense,
  6185. false,
  6186. true
  6187. );
  6188. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  6189. unmountChildren(children, parentComponent, parentSuspense);
  6190. }
  6191. if (doRemove) {
  6192. remove(vnode);
  6193. }
  6194. }
  6195. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  6196. queuePostRenderEffect(() => {
  6197. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6198. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  6199. }, parentSuspense);
  6200. }
  6201. };
  6202. const remove = (vnode) => {
  6203. const { type, el, anchor, transition } = vnode;
  6204. if (type === Fragment) {
  6205. if (!!(process.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  6206. vnode.children.forEach((child) => {
  6207. if (child.type === Comment) {
  6208. hostRemove(child.el);
  6209. } else {
  6210. remove(child);
  6211. }
  6212. });
  6213. } else {
  6214. removeFragment(el, anchor);
  6215. }
  6216. return;
  6217. }
  6218. if (type === Static) {
  6219. removeStaticNode(vnode);
  6220. return;
  6221. }
  6222. const performRemove = () => {
  6223. hostRemove(el);
  6224. if (transition && !transition.persisted && transition.afterLeave) {
  6225. transition.afterLeave();
  6226. }
  6227. };
  6228. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  6229. const { leave, delayLeave } = transition;
  6230. const performLeave = () => leave(el, performRemove);
  6231. if (delayLeave) {
  6232. delayLeave(vnode.el, performRemove, performLeave);
  6233. } else {
  6234. performLeave();
  6235. }
  6236. } else {
  6237. performRemove();
  6238. }
  6239. };
  6240. const removeFragment = (cur, end) => {
  6241. let next;
  6242. while (cur !== end) {
  6243. next = hostNextSibling(cur);
  6244. hostRemove(cur);
  6245. cur = next;
  6246. }
  6247. hostRemove(end);
  6248. };
  6249. const unmountComponent = (instance, parentSuspense, doRemove) => {
  6250. if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
  6251. unregisterHMR(instance);
  6252. }
  6253. const { bum, scope, update, subTree, um } = instance;
  6254. if (bum) {
  6255. invokeArrayFns(bum);
  6256. }
  6257. scope.stop();
  6258. if (update) {
  6259. update.active = false;
  6260. unmount(subTree, instance, parentSuspense, doRemove);
  6261. }
  6262. if (um) {
  6263. queuePostRenderEffect(um, parentSuspense);
  6264. }
  6265. queuePostRenderEffect(() => {
  6266. instance.isUnmounted = true;
  6267. }, parentSuspense);
  6268. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  6269. parentSuspense.deps--;
  6270. if (parentSuspense.deps === 0) {
  6271. parentSuspense.resolve();
  6272. }
  6273. }
  6274. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  6275. devtoolsComponentRemoved(instance);
  6276. }
  6277. };
  6278. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  6279. for (let i = start; i < children.length; i++) {
  6280. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  6281. }
  6282. };
  6283. const getNextHostNode = (vnode) => {
  6284. if (vnode.shapeFlag & 6) {
  6285. return getNextHostNode(vnode.component.subTree);
  6286. }
  6287. if (vnode.shapeFlag & 128) {
  6288. return vnode.suspense.next();
  6289. }
  6290. return hostNextSibling(vnode.anchor || vnode.el);
  6291. };
  6292. const render = (vnode, container, isSVG) => {
  6293. if (vnode == null) {
  6294. if (container._vnode) {
  6295. unmount(container._vnode, null, null, true);
  6296. }
  6297. } else {
  6298. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  6299. }
  6300. flushPreFlushCbs();
  6301. flushPostFlushCbs();
  6302. container._vnode = vnode;
  6303. };
  6304. const internals = {
  6305. p: patch,
  6306. um: unmount,
  6307. m: move,
  6308. r: remove,
  6309. mt: mountComponent,
  6310. mc: mountChildren,
  6311. pc: patchChildren,
  6312. pbc: patchBlockChildren,
  6313. n: getNextHostNode,
  6314. o: options
  6315. };
  6316. let hydrate;
  6317. let hydrateNode;
  6318. if (createHydrationFns) {
  6319. [hydrate, hydrateNode] = createHydrationFns(
  6320. internals
  6321. );
  6322. }
  6323. return {
  6324. render,
  6325. hydrate,
  6326. createApp: createAppAPI(render, hydrate)
  6327. };
  6328. }
  6329. function toggleRecurse({ effect, update }, allowed) {
  6330. effect.allowRecurse = update.allowRecurse = allowed;
  6331. }
  6332. function traverseStaticChildren(n1, n2, shallow = false) {
  6333. const ch1 = n1.children;
  6334. const ch2 = n2.children;
  6335. if (isArray(ch1) && isArray(ch2)) {
  6336. for (let i = 0; i < ch1.length; i++) {
  6337. const c1 = ch1[i];
  6338. let c2 = ch2[i];
  6339. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  6340. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  6341. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  6342. c2.el = c1.el;
  6343. }
  6344. if (!shallow)
  6345. traverseStaticChildren(c1, c2);
  6346. }
  6347. if (c2.type === Text) {
  6348. c2.el = c1.el;
  6349. }
  6350. if (!!(process.env.NODE_ENV !== "production") && c2.type === Comment && !c2.el) {
  6351. c2.el = c1.el;
  6352. }
  6353. }
  6354. }
  6355. }
  6356. function getSequence(arr) {
  6357. const p = arr.slice();
  6358. const result = [0];
  6359. let i, j, u, v, c;
  6360. const len = arr.length;
  6361. for (i = 0; i < len; i++) {
  6362. const arrI = arr[i];
  6363. if (arrI !== 0) {
  6364. j = result[result.length - 1];
  6365. if (arr[j] < arrI) {
  6366. p[i] = j;
  6367. result.push(i);
  6368. continue;
  6369. }
  6370. u = 0;
  6371. v = result.length - 1;
  6372. while (u < v) {
  6373. c = u + v >> 1;
  6374. if (arr[result[c]] < arrI) {
  6375. u = c + 1;
  6376. } else {
  6377. v = c;
  6378. }
  6379. }
  6380. if (arrI < arr[result[u]]) {
  6381. if (u > 0) {
  6382. p[i] = result[u - 1];
  6383. }
  6384. result[u] = i;
  6385. }
  6386. }
  6387. }
  6388. u = result.length;
  6389. v = result[u - 1];
  6390. while (u-- > 0) {
  6391. result[u] = v;
  6392. v = p[v];
  6393. }
  6394. return result;
  6395. }
  6396. const isTeleport = (type) => type.__isTeleport;
  6397. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  6398. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  6399. const resolveTarget = (props, select) => {
  6400. const targetSelector = props && props.to;
  6401. if (isString(targetSelector)) {
  6402. if (!select) {
  6403. !!(process.env.NODE_ENV !== "production") && warn(
  6404. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  6405. );
  6406. return null;
  6407. } else {
  6408. const target = select(targetSelector);
  6409. if (!target) {
  6410. !!(process.env.NODE_ENV !== "production") && warn(
  6411. `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
  6412. );
  6413. }
  6414. return target;
  6415. }
  6416. } else {
  6417. if (!!(process.env.NODE_ENV !== "production") && !targetSelector && !isTeleportDisabled(props)) {
  6418. warn(`Invalid Teleport target: ${targetSelector}`);
  6419. }
  6420. return targetSelector;
  6421. }
  6422. };
  6423. const TeleportImpl = {
  6424. __isTeleport: true,
  6425. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  6426. const {
  6427. mc: mountChildren,
  6428. pc: patchChildren,
  6429. pbc: patchBlockChildren,
  6430. o: { insert, querySelector, createText, createComment }
  6431. } = internals;
  6432. const disabled = isTeleportDisabled(n2.props);
  6433. let { shapeFlag, children, dynamicChildren } = n2;
  6434. if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
  6435. optimized = false;
  6436. dynamicChildren = null;
  6437. }
  6438. if (n1 == null) {
  6439. const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
  6440. const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
  6441. insert(placeholder, container, anchor);
  6442. insert(mainAnchor, container, anchor);
  6443. const target = n2.target = resolveTarget(n2.props, querySelector);
  6444. const targetAnchor = n2.targetAnchor = createText("");
  6445. if (target) {
  6446. insert(targetAnchor, target);
  6447. isSVG = isSVG || isTargetSVG(target);
  6448. } else if (!!(process.env.NODE_ENV !== "production") && !disabled) {
  6449. warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
  6450. }
  6451. const mount = (container2, anchor2) => {
  6452. if (shapeFlag & 16) {
  6453. mountChildren(
  6454. children,
  6455. container2,
  6456. anchor2,
  6457. parentComponent,
  6458. parentSuspense,
  6459. isSVG,
  6460. slotScopeIds,
  6461. optimized
  6462. );
  6463. }
  6464. };
  6465. if (disabled) {
  6466. mount(container, mainAnchor);
  6467. } else if (target) {
  6468. mount(target, targetAnchor);
  6469. }
  6470. } else {
  6471. n2.el = n1.el;
  6472. const mainAnchor = n2.anchor = n1.anchor;
  6473. const target = n2.target = n1.target;
  6474. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  6475. const wasDisabled = isTeleportDisabled(n1.props);
  6476. const currentContainer = wasDisabled ? container : target;
  6477. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  6478. isSVG = isSVG || isTargetSVG(target);
  6479. if (dynamicChildren) {
  6480. patchBlockChildren(
  6481. n1.dynamicChildren,
  6482. dynamicChildren,
  6483. currentContainer,
  6484. parentComponent,
  6485. parentSuspense,
  6486. isSVG,
  6487. slotScopeIds
  6488. );
  6489. traverseStaticChildren(n1, n2, true);
  6490. } else if (!optimized) {
  6491. patchChildren(
  6492. n1,
  6493. n2,
  6494. currentContainer,
  6495. currentAnchor,
  6496. parentComponent,
  6497. parentSuspense,
  6498. isSVG,
  6499. slotScopeIds,
  6500. false
  6501. );
  6502. }
  6503. if (disabled) {
  6504. if (!wasDisabled) {
  6505. moveTeleport(
  6506. n2,
  6507. container,
  6508. mainAnchor,
  6509. internals,
  6510. 1
  6511. );
  6512. }
  6513. } else {
  6514. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  6515. const nextTarget = n2.target = resolveTarget(
  6516. n2.props,
  6517. querySelector
  6518. );
  6519. if (nextTarget) {
  6520. moveTeleport(
  6521. n2,
  6522. nextTarget,
  6523. null,
  6524. internals,
  6525. 0
  6526. );
  6527. } else if (!!(process.env.NODE_ENV !== "production")) {
  6528. warn(
  6529. "Invalid Teleport target on update:",
  6530. target,
  6531. `(${typeof target})`
  6532. );
  6533. }
  6534. } else if (wasDisabled) {
  6535. moveTeleport(
  6536. n2,
  6537. target,
  6538. targetAnchor,
  6539. internals,
  6540. 1
  6541. );
  6542. }
  6543. }
  6544. }
  6545. updateCssVars(n2);
  6546. },
  6547. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  6548. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  6549. if (target) {
  6550. hostRemove(targetAnchor);
  6551. }
  6552. if (doRemove || !isTeleportDisabled(props)) {
  6553. hostRemove(anchor);
  6554. if (shapeFlag & 16) {
  6555. for (let i = 0; i < children.length; i++) {
  6556. const child = children[i];
  6557. unmount(
  6558. child,
  6559. parentComponent,
  6560. parentSuspense,
  6561. true,
  6562. !!child.dynamicChildren
  6563. );
  6564. }
  6565. }
  6566. }
  6567. },
  6568. move: moveTeleport,
  6569. hydrate: hydrateTeleport
  6570. };
  6571. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  6572. if (moveType === 0) {
  6573. insert(vnode.targetAnchor, container, parentAnchor);
  6574. }
  6575. const { el, anchor, shapeFlag, children, props } = vnode;
  6576. const isReorder = moveType === 2;
  6577. if (isReorder) {
  6578. insert(el, container, parentAnchor);
  6579. }
  6580. if (!isReorder || isTeleportDisabled(props)) {
  6581. if (shapeFlag & 16) {
  6582. for (let i = 0; i < children.length; i++) {
  6583. move(
  6584. children[i],
  6585. container,
  6586. parentAnchor,
  6587. 2
  6588. );
  6589. }
  6590. }
  6591. }
  6592. if (isReorder) {
  6593. insert(anchor, container, parentAnchor);
  6594. }
  6595. }
  6596. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  6597. o: { nextSibling, parentNode, querySelector }
  6598. }, hydrateChildren) {
  6599. const target = vnode.target = resolveTarget(
  6600. vnode.props,
  6601. querySelector
  6602. );
  6603. if (target) {
  6604. const targetNode = target._lpa || target.firstChild;
  6605. if (vnode.shapeFlag & 16) {
  6606. if (isTeleportDisabled(vnode.props)) {
  6607. vnode.anchor = hydrateChildren(
  6608. nextSibling(node),
  6609. vnode,
  6610. parentNode(node),
  6611. parentComponent,
  6612. parentSuspense,
  6613. slotScopeIds,
  6614. optimized
  6615. );
  6616. vnode.targetAnchor = targetNode;
  6617. } else {
  6618. vnode.anchor = nextSibling(node);
  6619. let targetAnchor = targetNode;
  6620. while (targetAnchor) {
  6621. targetAnchor = nextSibling(targetAnchor);
  6622. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  6623. vnode.targetAnchor = targetAnchor;
  6624. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  6625. break;
  6626. }
  6627. }
  6628. hydrateChildren(
  6629. targetNode,
  6630. vnode,
  6631. target,
  6632. parentComponent,
  6633. parentSuspense,
  6634. slotScopeIds,
  6635. optimized
  6636. );
  6637. }
  6638. }
  6639. updateCssVars(vnode);
  6640. }
  6641. return vnode.anchor && nextSibling(vnode.anchor);
  6642. }
  6643. const Teleport = TeleportImpl;
  6644. function updateCssVars(vnode) {
  6645. const ctx = vnode.ctx;
  6646. if (ctx && ctx.ut) {
  6647. let node = vnode.children[0].el;
  6648. while (node !== vnode.targetAnchor) {
  6649. if (node.nodeType === 1)
  6650. node.setAttribute("data-v-owner", ctx.uid);
  6651. node = node.nextSibling;
  6652. }
  6653. ctx.ut();
  6654. }
  6655. }
  6656. const Fragment = Symbol.for("v-fgt");
  6657. const Text = Symbol.for("v-txt");
  6658. const Comment = Symbol.for("v-cmt");
  6659. const Static = Symbol.for("v-stc");
  6660. const blockStack = [];
  6661. let currentBlock = null;
  6662. function openBlock(disableTracking = false) {
  6663. blockStack.push(currentBlock = disableTracking ? null : []);
  6664. }
  6665. function closeBlock() {
  6666. blockStack.pop();
  6667. currentBlock = blockStack[blockStack.length - 1] || null;
  6668. }
  6669. let isBlockTreeEnabled = 1;
  6670. function setBlockTracking(value) {
  6671. isBlockTreeEnabled += value;
  6672. }
  6673. function setupBlock(vnode) {
  6674. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  6675. closeBlock();
  6676. if (isBlockTreeEnabled > 0 && currentBlock) {
  6677. currentBlock.push(vnode);
  6678. }
  6679. return vnode;
  6680. }
  6681. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  6682. return setupBlock(
  6683. createBaseVNode(
  6684. type,
  6685. props,
  6686. children,
  6687. patchFlag,
  6688. dynamicProps,
  6689. shapeFlag,
  6690. true
  6691. /* isBlock */
  6692. )
  6693. );
  6694. }
  6695. function createBlock(type, props, children, patchFlag, dynamicProps) {
  6696. return setupBlock(
  6697. createVNode(
  6698. type,
  6699. props,
  6700. children,
  6701. patchFlag,
  6702. dynamicProps,
  6703. true
  6704. /* isBlock: prevent a block from tracking itself */
  6705. )
  6706. );
  6707. }
  6708. function isVNode(value) {
  6709. return value ? value.__v_isVNode === true : false;
  6710. }
  6711. function isSameVNodeType(n1, n2) {
  6712. if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  6713. n1.shapeFlag &= ~256;
  6714. n2.shapeFlag &= ~512;
  6715. return false;
  6716. }
  6717. return n1.type === n2.type && n1.key === n2.key;
  6718. }
  6719. let vnodeArgsTransformer;
  6720. function transformVNodeArgs(transformer) {
  6721. vnodeArgsTransformer = transformer;
  6722. }
  6723. const createVNodeWithArgsTransform = (...args) => {
  6724. return _createVNode(
  6725. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  6726. );
  6727. };
  6728. const InternalObjectKey = `__vInternal`;
  6729. const normalizeKey = ({ key }) => key != null ? key : null;
  6730. const normalizeRef = ({
  6731. ref,
  6732. ref_key,
  6733. ref_for
  6734. }) => {
  6735. if (typeof ref === "number") {
  6736. ref = "" + ref;
  6737. }
  6738. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  6739. };
  6740. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  6741. const vnode = {
  6742. __v_isVNode: true,
  6743. __v_skip: true,
  6744. type,
  6745. props,
  6746. key: props && normalizeKey(props),
  6747. ref: props && normalizeRef(props),
  6748. scopeId: currentScopeId,
  6749. slotScopeIds: null,
  6750. children,
  6751. component: null,
  6752. suspense: null,
  6753. ssContent: null,
  6754. ssFallback: null,
  6755. dirs: null,
  6756. transition: null,
  6757. el: null,
  6758. anchor: null,
  6759. target: null,
  6760. targetAnchor: null,
  6761. staticCount: 0,
  6762. shapeFlag,
  6763. patchFlag,
  6764. dynamicProps,
  6765. dynamicChildren: null,
  6766. appContext: null,
  6767. ctx: currentRenderingInstance
  6768. };
  6769. if (needFullChildrenNormalization) {
  6770. normalizeChildren(vnode, children);
  6771. if (shapeFlag & 128) {
  6772. type.normalize(vnode);
  6773. }
  6774. } else if (children) {
  6775. vnode.shapeFlag |= isString(children) ? 8 : 16;
  6776. }
  6777. if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
  6778. warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  6779. }
  6780. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  6781. !isBlockNode && // has current parent block
  6782. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  6783. // component nodes also should always be patched, because even if the
  6784. // component doesn't need to update, it needs to persist the instance on to
  6785. // the next vnode so that it can be properly unmounted later.
  6786. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  6787. // vnode should not be considered dynamic due to handler caching.
  6788. vnode.patchFlag !== 32) {
  6789. currentBlock.push(vnode);
  6790. }
  6791. return vnode;
  6792. }
  6793. const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
  6794. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  6795. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  6796. if (!!(process.env.NODE_ENV !== "production") && !type) {
  6797. warn(`Invalid vnode type when creating vnode: ${type}.`);
  6798. }
  6799. type = Comment;
  6800. }
  6801. if (isVNode(type)) {
  6802. const cloned = cloneVNode(
  6803. type,
  6804. props,
  6805. true
  6806. /* mergeRef: true */
  6807. );
  6808. if (children) {
  6809. normalizeChildren(cloned, children);
  6810. }
  6811. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  6812. if (cloned.shapeFlag & 6) {
  6813. currentBlock[currentBlock.indexOf(type)] = cloned;
  6814. } else {
  6815. currentBlock.push(cloned);
  6816. }
  6817. }
  6818. cloned.patchFlag |= -2;
  6819. return cloned;
  6820. }
  6821. if (isClassComponent(type)) {
  6822. type = type.__vccOpts;
  6823. }
  6824. if (props) {
  6825. props = guardReactiveProps(props);
  6826. let { class: klass, style } = props;
  6827. if (klass && !isString(klass)) {
  6828. props.class = normalizeClass(klass);
  6829. }
  6830. if (isObject(style)) {
  6831. if (isProxy(style) && !isArray(style)) {
  6832. style = extend({}, style);
  6833. }
  6834. props.style = normalizeStyle(style);
  6835. }
  6836. }
  6837. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  6838. if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
  6839. type = toRaw(type);
  6840. warn(
  6841. `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
  6842. `
  6843. Component that was made reactive: `,
  6844. type
  6845. );
  6846. }
  6847. return createBaseVNode(
  6848. type,
  6849. props,
  6850. children,
  6851. patchFlag,
  6852. dynamicProps,
  6853. shapeFlag,
  6854. isBlockNode,
  6855. true
  6856. );
  6857. }
  6858. function guardReactiveProps(props) {
  6859. if (!props)
  6860. return null;
  6861. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  6862. }
  6863. function cloneVNode(vnode, extraProps, mergeRef = false) {
  6864. const { props, ref, patchFlag, children } = vnode;
  6865. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  6866. const cloned = {
  6867. __v_isVNode: true,
  6868. __v_skip: true,
  6869. type: vnode.type,
  6870. props: mergedProps,
  6871. key: mergedProps && normalizeKey(mergedProps),
  6872. ref: extraProps && extraProps.ref ? (
  6873. // #2078 in the case of <component :is="vnode" ref="extra"/>
  6874. // if the vnode itself already has a ref, cloneVNode will need to merge
  6875. // the refs so the single vnode can be set on multiple refs
  6876. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  6877. ) : ref,
  6878. scopeId: vnode.scopeId,
  6879. slotScopeIds: vnode.slotScopeIds,
  6880. children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  6881. target: vnode.target,
  6882. targetAnchor: vnode.targetAnchor,
  6883. staticCount: vnode.staticCount,
  6884. shapeFlag: vnode.shapeFlag,
  6885. // if the vnode is cloned with extra props, we can no longer assume its
  6886. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  6887. // note: preserve flag for fragments since they use the flag for children
  6888. // fast paths only.
  6889. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  6890. dynamicProps: vnode.dynamicProps,
  6891. dynamicChildren: vnode.dynamicChildren,
  6892. appContext: vnode.appContext,
  6893. dirs: vnode.dirs,
  6894. transition: vnode.transition,
  6895. // These should technically only be non-null on mounted VNodes. However,
  6896. // they *should* be copied for kept-alive vnodes. So we just always copy
  6897. // them since them being non-null during a mount doesn't affect the logic as
  6898. // they will simply be overwritten.
  6899. component: vnode.component,
  6900. suspense: vnode.suspense,
  6901. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  6902. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  6903. el: vnode.el,
  6904. anchor: vnode.anchor,
  6905. ctx: vnode.ctx,
  6906. ce: vnode.ce
  6907. };
  6908. return cloned;
  6909. }
  6910. function deepCloneVNode(vnode) {
  6911. const cloned = cloneVNode(vnode);
  6912. if (isArray(vnode.children)) {
  6913. cloned.children = vnode.children.map(deepCloneVNode);
  6914. }
  6915. return cloned;
  6916. }
  6917. function createTextVNode(text = " ", flag = 0) {
  6918. return createVNode(Text, null, text, flag);
  6919. }
  6920. function createStaticVNode(content, numberOfNodes) {
  6921. const vnode = createVNode(Static, null, content);
  6922. vnode.staticCount = numberOfNodes;
  6923. return vnode;
  6924. }
  6925. function createCommentVNode(text = "", asBlock = false) {
  6926. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  6927. }
  6928. function normalizeVNode(child) {
  6929. if (child == null || typeof child === "boolean") {
  6930. return createVNode(Comment);
  6931. } else if (isArray(child)) {
  6932. return createVNode(
  6933. Fragment,
  6934. null,
  6935. // #3666, avoid reference pollution when reusing vnode
  6936. child.slice()
  6937. );
  6938. } else if (typeof child === "object") {
  6939. return cloneIfMounted(child);
  6940. } else {
  6941. return createVNode(Text, null, String(child));
  6942. }
  6943. }
  6944. function cloneIfMounted(child) {
  6945. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  6946. }
  6947. function normalizeChildren(vnode, children) {
  6948. let type = 0;
  6949. const { shapeFlag } = vnode;
  6950. if (children == null) {
  6951. children = null;
  6952. } else if (isArray(children)) {
  6953. type = 16;
  6954. } else if (typeof children === "object") {
  6955. if (shapeFlag & (1 | 64)) {
  6956. const slot = children.default;
  6957. if (slot) {
  6958. slot._c && (slot._d = false);
  6959. normalizeChildren(vnode, slot());
  6960. slot._c && (slot._d = true);
  6961. }
  6962. return;
  6963. } else {
  6964. type = 32;
  6965. const slotFlag = children._;
  6966. if (!slotFlag && !(InternalObjectKey in children)) {
  6967. children._ctx = currentRenderingInstance;
  6968. } else if (slotFlag === 3 && currentRenderingInstance) {
  6969. if (currentRenderingInstance.slots._ === 1) {
  6970. children._ = 1;
  6971. } else {
  6972. children._ = 2;
  6973. vnode.patchFlag |= 1024;
  6974. }
  6975. }
  6976. }
  6977. } else if (isFunction(children)) {
  6978. children = { default: children, _ctx: currentRenderingInstance };
  6979. type = 32;
  6980. } else {
  6981. children = String(children);
  6982. if (shapeFlag & 64) {
  6983. type = 16;
  6984. children = [createTextVNode(children)];
  6985. } else {
  6986. type = 8;
  6987. }
  6988. }
  6989. vnode.children = children;
  6990. vnode.shapeFlag |= type;
  6991. }
  6992. function mergeProps(...args) {
  6993. const ret = {};
  6994. for (let i = 0; i < args.length; i++) {
  6995. const toMerge = args[i];
  6996. for (const key in toMerge) {
  6997. if (key === "class") {
  6998. if (ret.class !== toMerge.class) {
  6999. ret.class = normalizeClass([ret.class, toMerge.class]);
  7000. }
  7001. } else if (key === "style") {
  7002. ret.style = normalizeStyle([ret.style, toMerge.style]);
  7003. } else if (isOn(key)) {
  7004. const existing = ret[key];
  7005. const incoming = toMerge[key];
  7006. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  7007. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  7008. }
  7009. } else if (key !== "") {
  7010. ret[key] = toMerge[key];
  7011. }
  7012. }
  7013. }
  7014. return ret;
  7015. }
  7016. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  7017. callWithAsyncErrorHandling(hook, instance, 7, [
  7018. vnode,
  7019. prevVNode
  7020. ]);
  7021. }
  7022. const emptyAppContext = createAppContext();
  7023. let uid = 0;
  7024. function createComponentInstance(vnode, parent, suspense) {
  7025. const type = vnode.type;
  7026. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  7027. const instance = {
  7028. uid: uid++,
  7029. vnode,
  7030. type,
  7031. parent,
  7032. appContext,
  7033. root: null,
  7034. // to be immediately set
  7035. next: null,
  7036. subTree: null,
  7037. // will be set synchronously right after creation
  7038. effect: null,
  7039. update: null,
  7040. // will be set synchronously right after creation
  7041. scope: new EffectScope(
  7042. true
  7043. /* detached */
  7044. ),
  7045. render: null,
  7046. proxy: null,
  7047. exposed: null,
  7048. exposeProxy: null,
  7049. withProxy: null,
  7050. provides: parent ? parent.provides : Object.create(appContext.provides),
  7051. accessCache: null,
  7052. renderCache: [],
  7053. // local resolved assets
  7054. components: null,
  7055. directives: null,
  7056. // resolved props and emits options
  7057. propsOptions: normalizePropsOptions(type, appContext),
  7058. emitsOptions: normalizeEmitsOptions(type, appContext),
  7059. // emit
  7060. emit: null,
  7061. // to be set immediately
  7062. emitted: null,
  7063. // props default value
  7064. propsDefaults: EMPTY_OBJ,
  7065. // inheritAttrs
  7066. inheritAttrs: type.inheritAttrs,
  7067. // state
  7068. ctx: EMPTY_OBJ,
  7069. data: EMPTY_OBJ,
  7070. props: EMPTY_OBJ,
  7071. attrs: EMPTY_OBJ,
  7072. slots: EMPTY_OBJ,
  7073. refs: EMPTY_OBJ,
  7074. setupState: EMPTY_OBJ,
  7075. setupContext: null,
  7076. attrsProxy: null,
  7077. slotsProxy: null,
  7078. // suspense related
  7079. suspense,
  7080. suspenseId: suspense ? suspense.pendingId : 0,
  7081. asyncDep: null,
  7082. asyncResolved: false,
  7083. // lifecycle hooks
  7084. // not using enums here because it results in computed properties
  7085. isMounted: false,
  7086. isUnmounted: false,
  7087. isDeactivated: false,
  7088. bc: null,
  7089. c: null,
  7090. bm: null,
  7091. m: null,
  7092. bu: null,
  7093. u: null,
  7094. um: null,
  7095. bum: null,
  7096. da: null,
  7097. a: null,
  7098. rtg: null,
  7099. rtc: null,
  7100. ec: null,
  7101. sp: null
  7102. };
  7103. if (!!(process.env.NODE_ENV !== "production")) {
  7104. instance.ctx = createDevRenderContext(instance);
  7105. } else {
  7106. instance.ctx = { _: instance };
  7107. }
  7108. instance.root = parent ? parent.root : instance;
  7109. instance.emit = emit.bind(null, instance);
  7110. if (vnode.ce) {
  7111. vnode.ce(instance);
  7112. }
  7113. return instance;
  7114. }
  7115. let currentInstance = null;
  7116. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  7117. let internalSetCurrentInstance;
  7118. let globalCurrentInstanceSetters;
  7119. let settersKey = "__VUE_INSTANCE_SETTERS__";
  7120. {
  7121. if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
  7122. globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
  7123. }
  7124. globalCurrentInstanceSetters.push((i) => currentInstance = i);
  7125. internalSetCurrentInstance = (instance) => {
  7126. if (globalCurrentInstanceSetters.length > 1) {
  7127. globalCurrentInstanceSetters.forEach((s) => s(instance));
  7128. } else {
  7129. globalCurrentInstanceSetters[0](instance);
  7130. }
  7131. };
  7132. }
  7133. const setCurrentInstance = (instance) => {
  7134. internalSetCurrentInstance(instance);
  7135. instance.scope.on();
  7136. };
  7137. const unsetCurrentInstance = () => {
  7138. currentInstance && currentInstance.scope.off();
  7139. internalSetCurrentInstance(null);
  7140. };
  7141. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  7142. function validateComponentName(name, config) {
  7143. const appIsNativeTag = config.isNativeTag || NO;
  7144. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  7145. warn(
  7146. "Do not use built-in or reserved HTML elements as component id: " + name
  7147. );
  7148. }
  7149. }
  7150. function isStatefulComponent(instance) {
  7151. return instance.vnode.shapeFlag & 4;
  7152. }
  7153. let isInSSRComponentSetup = false;
  7154. function setupComponent(instance, isSSR = false) {
  7155. isInSSRComponentSetup = isSSR;
  7156. const { props, children } = instance.vnode;
  7157. const isStateful = isStatefulComponent(instance);
  7158. initProps(instance, props, isStateful, isSSR);
  7159. initSlots(instance, children);
  7160. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  7161. isInSSRComponentSetup = false;
  7162. return setupResult;
  7163. }
  7164. function setupStatefulComponent(instance, isSSR) {
  7165. var _a;
  7166. const Component = instance.type;
  7167. if (!!(process.env.NODE_ENV !== "production")) {
  7168. if (Component.name) {
  7169. validateComponentName(Component.name, instance.appContext.config);
  7170. }
  7171. if (Component.components) {
  7172. const names = Object.keys(Component.components);
  7173. for (let i = 0; i < names.length; i++) {
  7174. validateComponentName(names[i], instance.appContext.config);
  7175. }
  7176. }
  7177. if (Component.directives) {
  7178. const names = Object.keys(Component.directives);
  7179. for (let i = 0; i < names.length; i++) {
  7180. validateDirectiveName(names[i]);
  7181. }
  7182. }
  7183. if (Component.compilerOptions && isRuntimeOnly()) {
  7184. warn(
  7185. `"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.`
  7186. );
  7187. }
  7188. }
  7189. instance.accessCache = /* @__PURE__ */ Object.create(null);
  7190. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  7191. if (!!(process.env.NODE_ENV !== "production")) {
  7192. exposePropsOnRenderContext(instance);
  7193. }
  7194. const { setup } = Component;
  7195. if (setup) {
  7196. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  7197. setCurrentInstance(instance);
  7198. pauseTracking();
  7199. const setupResult = callWithErrorHandling(
  7200. setup,
  7201. instance,
  7202. 0,
  7203. [!!(process.env.NODE_ENV !== "production") ? shallowReadonly(instance.props) : instance.props, setupContext]
  7204. );
  7205. resetTracking();
  7206. unsetCurrentInstance();
  7207. if (isPromise(setupResult)) {
  7208. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  7209. if (isSSR) {
  7210. return setupResult.then((resolvedResult) => {
  7211. handleSetupResult(instance, resolvedResult, isSSR);
  7212. }).catch((e) => {
  7213. handleError(e, instance, 0);
  7214. });
  7215. } else {
  7216. instance.asyncDep = setupResult;
  7217. if (!!(process.env.NODE_ENV !== "production") && !instance.suspense) {
  7218. const name = (_a = Component.name) != null ? _a : "Anonymous";
  7219. warn(
  7220. `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
  7221. );
  7222. }
  7223. }
  7224. } else {
  7225. handleSetupResult(instance, setupResult, isSSR);
  7226. }
  7227. } else {
  7228. finishComponentSetup(instance, isSSR);
  7229. }
  7230. }
  7231. function handleSetupResult(instance, setupResult, isSSR) {
  7232. if (isFunction(setupResult)) {
  7233. if (instance.type.__ssrInlineRender) {
  7234. instance.ssrRender = setupResult;
  7235. } else {
  7236. instance.render = setupResult;
  7237. }
  7238. } else if (isObject(setupResult)) {
  7239. if (!!(process.env.NODE_ENV !== "production") && isVNode(setupResult)) {
  7240. warn(
  7241. `setup() should not return VNodes directly - return a render function instead.`
  7242. );
  7243. }
  7244. if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
  7245. instance.devtoolsRawSetupState = setupResult;
  7246. }
  7247. instance.setupState = proxyRefs(setupResult);
  7248. if (!!(process.env.NODE_ENV !== "production")) {
  7249. exposeSetupStateOnRenderContext(instance);
  7250. }
  7251. } else if (!!(process.env.NODE_ENV !== "production") && setupResult !== void 0) {
  7252. warn(
  7253. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  7254. );
  7255. }
  7256. finishComponentSetup(instance, isSSR);
  7257. }
  7258. let compile;
  7259. let installWithProxy;
  7260. function registerRuntimeCompiler(_compile) {
  7261. compile = _compile;
  7262. installWithProxy = (i) => {
  7263. if (i.render._rc) {
  7264. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  7265. }
  7266. };
  7267. }
  7268. const isRuntimeOnly = () => !compile;
  7269. function finishComponentSetup(instance, isSSR, skipOptions) {
  7270. const Component = instance.type;
  7271. if (!instance.render) {
  7272. if (!isSSR && compile && !Component.render) {
  7273. const template = Component.template || resolveMergedOptions(instance).template;
  7274. if (template) {
  7275. if (!!(process.env.NODE_ENV !== "production")) {
  7276. startMeasure(instance, `compile`);
  7277. }
  7278. const { isCustomElement, compilerOptions } = instance.appContext.config;
  7279. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  7280. const finalCompilerOptions = extend(
  7281. extend(
  7282. {
  7283. isCustomElement,
  7284. delimiters
  7285. },
  7286. compilerOptions
  7287. ),
  7288. componentCompilerOptions
  7289. );
  7290. Component.render = compile(template, finalCompilerOptions);
  7291. if (!!(process.env.NODE_ENV !== "production")) {
  7292. endMeasure(instance, `compile`);
  7293. }
  7294. }
  7295. }
  7296. instance.render = Component.render || NOOP;
  7297. if (installWithProxy) {
  7298. installWithProxy(instance);
  7299. }
  7300. }
  7301. if (__VUE_OPTIONS_API__ && true) {
  7302. setCurrentInstance(instance);
  7303. pauseTracking();
  7304. applyOptions(instance);
  7305. resetTracking();
  7306. unsetCurrentInstance();
  7307. }
  7308. if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
  7309. if (!compile && Component.template) {
  7310. warn(
  7311. `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".` )
  7312. /* should not happen */
  7313. );
  7314. } else {
  7315. warn(`Component is missing template or render function.`);
  7316. }
  7317. }
  7318. }
  7319. function getAttrsProxy(instance) {
  7320. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  7321. instance.attrs,
  7322. !!(process.env.NODE_ENV !== "production") ? {
  7323. get(target, key) {
  7324. markAttrsAccessed();
  7325. track(instance, "get", "$attrs");
  7326. return target[key];
  7327. },
  7328. set() {
  7329. warn(`setupContext.attrs is readonly.`);
  7330. return false;
  7331. },
  7332. deleteProperty() {
  7333. warn(`setupContext.attrs is readonly.`);
  7334. return false;
  7335. }
  7336. } : {
  7337. get(target, key) {
  7338. track(instance, "get", "$attrs");
  7339. return target[key];
  7340. }
  7341. }
  7342. ));
  7343. }
  7344. function getSlotsProxy(instance) {
  7345. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  7346. get(target, key) {
  7347. track(instance, "get", "$slots");
  7348. return target[key];
  7349. }
  7350. }));
  7351. }
  7352. function createSetupContext(instance) {
  7353. const expose = (exposed) => {
  7354. if (!!(process.env.NODE_ENV !== "production")) {
  7355. if (instance.exposed) {
  7356. warn(`expose() should be called only once per setup().`);
  7357. }
  7358. if (exposed != null) {
  7359. let exposedType = typeof exposed;
  7360. if (exposedType === "object") {
  7361. if (isArray(exposed)) {
  7362. exposedType = "array";
  7363. } else if (isRef(exposed)) {
  7364. exposedType = "ref";
  7365. }
  7366. }
  7367. if (exposedType !== "object") {
  7368. warn(
  7369. `expose() should be passed a plain object, received ${exposedType}.`
  7370. );
  7371. }
  7372. }
  7373. }
  7374. instance.exposed = exposed || {};
  7375. };
  7376. if (!!(process.env.NODE_ENV !== "production")) {
  7377. return Object.freeze({
  7378. get attrs() {
  7379. return getAttrsProxy(instance);
  7380. },
  7381. get slots() {
  7382. return getSlotsProxy(instance);
  7383. },
  7384. get emit() {
  7385. return (event, ...args) => instance.emit(event, ...args);
  7386. },
  7387. expose
  7388. });
  7389. } else {
  7390. return {
  7391. get attrs() {
  7392. return getAttrsProxy(instance);
  7393. },
  7394. slots: instance.slots,
  7395. emit: instance.emit,
  7396. expose
  7397. };
  7398. }
  7399. }
  7400. function getExposeProxy(instance) {
  7401. if (instance.exposed) {
  7402. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  7403. get(target, key) {
  7404. if (key in target) {
  7405. return target[key];
  7406. } else if (key in publicPropertiesMap) {
  7407. return publicPropertiesMap[key](instance);
  7408. }
  7409. },
  7410. has(target, key) {
  7411. return key in target || key in publicPropertiesMap;
  7412. }
  7413. }));
  7414. }
  7415. }
  7416. const classifyRE = /(?:^|[-_])(\w)/g;
  7417. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  7418. function getComponentName(Component, includeInferred = true) {
  7419. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  7420. }
  7421. function formatComponentName(instance, Component, isRoot = false) {
  7422. let name = getComponentName(Component);
  7423. if (!name && Component.__file) {
  7424. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  7425. if (match) {
  7426. name = match[1];
  7427. }
  7428. }
  7429. if (!name && instance && instance.parent) {
  7430. const inferFromRegistry = (registry) => {
  7431. for (const key in registry) {
  7432. if (registry[key] === Component) {
  7433. return key;
  7434. }
  7435. }
  7436. };
  7437. name = inferFromRegistry(
  7438. instance.components || instance.parent.type.components
  7439. ) || inferFromRegistry(instance.appContext.components);
  7440. }
  7441. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  7442. }
  7443. function isClassComponent(value) {
  7444. return isFunction(value) && "__vccOpts" in value;
  7445. }
  7446. const computed = (getterOrOptions, debugOptions) => {
  7447. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  7448. };
  7449. function h(type, propsOrChildren, children) {
  7450. const l = arguments.length;
  7451. if (l === 2) {
  7452. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  7453. if (isVNode(propsOrChildren)) {
  7454. return createVNode(type, null, [propsOrChildren]);
  7455. }
  7456. return createVNode(type, propsOrChildren);
  7457. } else {
  7458. return createVNode(type, null, propsOrChildren);
  7459. }
  7460. } else {
  7461. if (l > 3) {
  7462. children = Array.prototype.slice.call(arguments, 2);
  7463. } else if (l === 3 && isVNode(children)) {
  7464. children = [children];
  7465. }
  7466. return createVNode(type, propsOrChildren, children);
  7467. }
  7468. }
  7469. const ssrContextKey = Symbol.for("v-scx");
  7470. const useSSRContext = () => {
  7471. {
  7472. const ctx = inject(ssrContextKey);
  7473. if (!ctx) {
  7474. !!(process.env.NODE_ENV !== "production") && warn(
  7475. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  7476. );
  7477. }
  7478. return ctx;
  7479. }
  7480. };
  7481. function isShallow(value) {
  7482. return !!(value && value["__v_isShallow"]);
  7483. }
  7484. function initCustomFormatter() {
  7485. if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
  7486. return;
  7487. }
  7488. const vueStyle = { style: "color:#3ba776" };
  7489. const numberStyle = { style: "color:#0b1bc9" };
  7490. const stringStyle = { style: "color:#b62e24" };
  7491. const keywordStyle = { style: "color:#9d288c" };
  7492. const formatter = {
  7493. header(obj) {
  7494. if (!isObject(obj)) {
  7495. return null;
  7496. }
  7497. if (obj.__isVue) {
  7498. return ["div", vueStyle, `VueInstance`];
  7499. } else if (isRef(obj)) {
  7500. return [
  7501. "div",
  7502. {},
  7503. ["span", vueStyle, genRefFlag(obj)],
  7504. "<",
  7505. formatValue(obj.value),
  7506. `>`
  7507. ];
  7508. } else if (isReactive(obj)) {
  7509. return [
  7510. "div",
  7511. {},
  7512. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  7513. "<",
  7514. formatValue(obj),
  7515. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  7516. ];
  7517. } else if (isReadonly(obj)) {
  7518. return [
  7519. "div",
  7520. {},
  7521. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  7522. "<",
  7523. formatValue(obj),
  7524. ">"
  7525. ];
  7526. }
  7527. return null;
  7528. },
  7529. hasBody(obj) {
  7530. return obj && obj.__isVue;
  7531. },
  7532. body(obj) {
  7533. if (obj && obj.__isVue) {
  7534. return [
  7535. "div",
  7536. {},
  7537. ...formatInstance(obj.$)
  7538. ];
  7539. }
  7540. }
  7541. };
  7542. function formatInstance(instance) {
  7543. const blocks = [];
  7544. if (instance.type.props && instance.props) {
  7545. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  7546. }
  7547. if (instance.setupState !== EMPTY_OBJ) {
  7548. blocks.push(createInstanceBlock("setup", instance.setupState));
  7549. }
  7550. if (instance.data !== EMPTY_OBJ) {
  7551. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  7552. }
  7553. const computed = extractKeys(instance, "computed");
  7554. if (computed) {
  7555. blocks.push(createInstanceBlock("computed", computed));
  7556. }
  7557. const injected = extractKeys(instance, "inject");
  7558. if (injected) {
  7559. blocks.push(createInstanceBlock("injected", injected));
  7560. }
  7561. blocks.push([
  7562. "div",
  7563. {},
  7564. [
  7565. "span",
  7566. {
  7567. style: keywordStyle.style + ";opacity:0.66"
  7568. },
  7569. "$ (internal): "
  7570. ],
  7571. ["object", { object: instance }]
  7572. ]);
  7573. return blocks;
  7574. }
  7575. function createInstanceBlock(type, target) {
  7576. target = extend({}, target);
  7577. if (!Object.keys(target).length) {
  7578. return ["span", {}];
  7579. }
  7580. return [
  7581. "div",
  7582. { style: "line-height:1.25em;margin-bottom:0.6em" },
  7583. [
  7584. "div",
  7585. {
  7586. style: "color:#476582"
  7587. },
  7588. type
  7589. ],
  7590. [
  7591. "div",
  7592. {
  7593. style: "padding-left:1.25em"
  7594. },
  7595. ...Object.keys(target).map((key) => {
  7596. return [
  7597. "div",
  7598. {},
  7599. ["span", keywordStyle, key + ": "],
  7600. formatValue(target[key], false)
  7601. ];
  7602. })
  7603. ]
  7604. ];
  7605. }
  7606. function formatValue(v, asRaw = true) {
  7607. if (typeof v === "number") {
  7608. return ["span", numberStyle, v];
  7609. } else if (typeof v === "string") {
  7610. return ["span", stringStyle, JSON.stringify(v)];
  7611. } else if (typeof v === "boolean") {
  7612. return ["span", keywordStyle, v];
  7613. } else if (isObject(v)) {
  7614. return ["object", { object: asRaw ? toRaw(v) : v }];
  7615. } else {
  7616. return ["span", stringStyle, String(v)];
  7617. }
  7618. }
  7619. function extractKeys(instance, type) {
  7620. const Comp = instance.type;
  7621. if (isFunction(Comp)) {
  7622. return;
  7623. }
  7624. const extracted = {};
  7625. for (const key in instance.ctx) {
  7626. if (isKeyOfType(Comp, key, type)) {
  7627. extracted[key] = instance.ctx[key];
  7628. }
  7629. }
  7630. return extracted;
  7631. }
  7632. function isKeyOfType(Comp, key, type) {
  7633. const opts = Comp[type];
  7634. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  7635. return true;
  7636. }
  7637. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  7638. return true;
  7639. }
  7640. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  7641. return true;
  7642. }
  7643. }
  7644. function genRefFlag(v) {
  7645. if (isShallow(v)) {
  7646. return `ShallowRef`;
  7647. }
  7648. if (v.effect) {
  7649. return `ComputedRef`;
  7650. }
  7651. return `Ref`;
  7652. }
  7653. if (window.devtoolsFormatters) {
  7654. window.devtoolsFormatters.push(formatter);
  7655. } else {
  7656. window.devtoolsFormatters = [formatter];
  7657. }
  7658. }
  7659. function withMemo(memo, render, cache, index) {
  7660. const cached = cache[index];
  7661. if (cached && isMemoSame(cached, memo)) {
  7662. return cached;
  7663. }
  7664. const ret = render();
  7665. ret.memo = memo.slice();
  7666. return cache[index] = ret;
  7667. }
  7668. function isMemoSame(cached, memo) {
  7669. const prev = cached.memo;
  7670. if (prev.length != memo.length) {
  7671. return false;
  7672. }
  7673. for (let i = 0; i < prev.length; i++) {
  7674. if (hasChanged(prev[i], memo[i])) {
  7675. return false;
  7676. }
  7677. }
  7678. if (isBlockTreeEnabled > 0 && currentBlock) {
  7679. currentBlock.push(cached);
  7680. }
  7681. return true;
  7682. }
  7683. const version = "3.3.4";
  7684. const _ssrUtils = {
  7685. createComponentInstance,
  7686. setupComponent,
  7687. renderComponentRoot,
  7688. setCurrentRenderingInstance,
  7689. isVNode: isVNode,
  7690. normalizeVNode
  7691. };
  7692. const ssrUtils = _ssrUtils ;
  7693. const resolveFilter = null;
  7694. const compatUtils = null;
  7695. export { BaseTransition, BaseTransitionPropsValidators, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeModels, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useModel, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };