vue.global.js 569 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002
  1. var Vue = (function (exports) {
  2. 'use strict';
  3. function makeMap(str, expectsLowerCase) {
  4. const map = /* @__PURE__ */ Object.create(null);
  5. const list = str.split(",");
  6. for (let i = 0; i < list.length; i++) {
  7. map[list[i]] = true;
  8. }
  9. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  10. }
  11. const EMPTY_OBJ = Object.freeze({});
  12. const EMPTY_ARR = Object.freeze([]);
  13. const NOOP = () => {
  14. };
  15. const NO = () => false;
  16. const onRE = /^on[^a-z]/;
  17. const isOn = (key) => onRE.test(key);
  18. const isModelListener = (key) => key.startsWith("onUpdate:");
  19. const extend = Object.assign;
  20. const remove = (arr, el) => {
  21. const i = arr.indexOf(el);
  22. if (i > -1) {
  23. arr.splice(i, 1);
  24. }
  25. };
  26. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  27. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  28. const isArray = Array.isArray;
  29. const isMap = (val) => toTypeString(val) === "[object Map]";
  30. const isSet = (val) => toTypeString(val) === "[object Set]";
  31. const isDate = (val) => toTypeString(val) === "[object Date]";
  32. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  33. const isFunction = (val) => typeof val === "function";
  34. const isString = (val) => typeof val === "string";
  35. const isSymbol = (val) => typeof val === "symbol";
  36. const isObject = (val) => val !== null && typeof val === "object";
  37. const isPromise = (val) => {
  38. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  39. };
  40. const objectToString = Object.prototype.toString;
  41. const toTypeString = (value) => objectToString.call(value);
  42. const toRawType = (value) => {
  43. return toTypeString(value).slice(8, -1);
  44. };
  45. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  46. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  47. const isReservedProp = /* @__PURE__ */ makeMap(
  48. // the leading comma is intentional so empty string "" is also included
  49. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  50. );
  51. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  52. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  53. );
  54. const cacheStringFunction = (fn) => {
  55. const cache = /* @__PURE__ */ Object.create(null);
  56. return (str) => {
  57. const hit = cache[str];
  58. return hit || (cache[str] = fn(str));
  59. };
  60. };
  61. const camelizeRE = /-(\w)/g;
  62. const camelize = cacheStringFunction((str) => {
  63. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  64. });
  65. const hyphenateRE = /\B([A-Z])/g;
  66. const hyphenate = cacheStringFunction(
  67. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  68. );
  69. const capitalize = cacheStringFunction((str) => {
  70. return str.charAt(0).toUpperCase() + str.slice(1);
  71. });
  72. const toHandlerKey = cacheStringFunction((str) => {
  73. const s = str ? `on${capitalize(str)}` : ``;
  74. return s;
  75. });
  76. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  77. const invokeArrayFns = (fns, arg) => {
  78. for (let i = 0; i < fns.length; i++) {
  79. fns[i](arg);
  80. }
  81. };
  82. const def = (obj, key, value) => {
  83. Object.defineProperty(obj, key, {
  84. configurable: true,
  85. enumerable: false,
  86. value
  87. });
  88. };
  89. const looseToNumber = (val) => {
  90. const n = parseFloat(val);
  91. return isNaN(n) ? val : n;
  92. };
  93. const toNumber = (val) => {
  94. const n = isString(val) ? Number(val) : NaN;
  95. return isNaN(n) ? val : n;
  96. };
  97. let _globalThis;
  98. const getGlobalThis = () => {
  99. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  100. };
  101. const PatchFlagNames = {
  102. [1]: `TEXT`,
  103. [2]: `CLASS`,
  104. [4]: `STYLE`,
  105. [8]: `PROPS`,
  106. [16]: `FULL_PROPS`,
  107. [32]: `HYDRATE_EVENTS`,
  108. [64]: `STABLE_FRAGMENT`,
  109. [128]: `KEYED_FRAGMENT`,
  110. [256]: `UNKEYED_FRAGMENT`,
  111. [512]: `NEED_PATCH`,
  112. [1024]: `DYNAMIC_SLOTS`,
  113. [2048]: `DEV_ROOT_FRAGMENT`,
  114. [-1]: `HOISTED`,
  115. [-2]: `BAIL`
  116. };
  117. const slotFlagsText = {
  118. [1]: "STABLE",
  119. [2]: "DYNAMIC",
  120. [3]: "FORWARDED"
  121. };
  122. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
  123. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  124. const range = 2;
  125. function generateCodeFrame(source, start = 0, end = source.length) {
  126. let lines = source.split(/(\r?\n)/);
  127. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  128. lines = lines.filter((_, idx) => idx % 2 === 0);
  129. let count = 0;
  130. const res = [];
  131. for (let i = 0; i < lines.length; i++) {
  132. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  133. if (count >= start) {
  134. for (let j = i - range; j <= i + range || end > count; j++) {
  135. if (j < 0 || j >= lines.length)
  136. continue;
  137. const line = j + 1;
  138. res.push(
  139. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  140. );
  141. const lineLength = lines[j].length;
  142. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  143. if (j === i) {
  144. const pad = start - (count - (lineLength + newLineSeqLength));
  145. const length = Math.max(
  146. 1,
  147. end > count ? lineLength - pad : end - start
  148. );
  149. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  150. } else if (j > i) {
  151. if (end > count) {
  152. const length = Math.max(Math.min(end - count, lineLength), 1);
  153. res.push(` | ` + "^".repeat(length));
  154. }
  155. count += lineLength + newLineSeqLength;
  156. }
  157. }
  158. break;
  159. }
  160. }
  161. return res.join("\n");
  162. }
  163. function normalizeStyle(value) {
  164. if (isArray(value)) {
  165. const res = {};
  166. for (let i = 0; i < value.length; i++) {
  167. const item = value[i];
  168. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  169. if (normalized) {
  170. for (const key in normalized) {
  171. res[key] = normalized[key];
  172. }
  173. }
  174. }
  175. return res;
  176. } else if (isString(value) || isObject(value)) {
  177. return value;
  178. }
  179. }
  180. const listDelimiterRE = /;(?![^(]*\))/g;
  181. const propertyDelimiterRE = /:([^]+)/;
  182. const styleCommentRE = /\/\*[^]*?\*\//g;
  183. function parseStringStyle(cssText) {
  184. const ret = {};
  185. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  186. if (item) {
  187. const tmp = item.split(propertyDelimiterRE);
  188. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  189. }
  190. });
  191. return ret;
  192. }
  193. function normalizeClass(value) {
  194. let res = "";
  195. if (isString(value)) {
  196. res = value;
  197. } else if (isArray(value)) {
  198. for (let i = 0; i < value.length; i++) {
  199. const normalized = normalizeClass(value[i]);
  200. if (normalized) {
  201. res += normalized + " ";
  202. }
  203. }
  204. } else if (isObject(value)) {
  205. for (const name in value) {
  206. if (value[name]) {
  207. res += name + " ";
  208. }
  209. }
  210. }
  211. return res.trim();
  212. }
  213. function normalizeProps(props) {
  214. if (!props)
  215. return null;
  216. let {class: klass, style} = props;
  217. if (klass && !isString(klass)) {
  218. props.class = normalizeClass(klass);
  219. }
  220. if (style) {
  221. props.style = normalizeStyle(style);
  222. }
  223. return props;
  224. }
  225. const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  226. const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  227. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  228. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  229. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  230. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  231. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  232. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  233. function includeBooleanAttr(value) {
  234. return !!value || value === "";
  235. }
  236. function looseCompareArrays(a, b) {
  237. if (a.length !== b.length)
  238. return false;
  239. let equal = true;
  240. for (let i = 0; equal && i < a.length; i++) {
  241. equal = looseEqual(a[i], b[i]);
  242. }
  243. return equal;
  244. }
  245. function looseEqual(a, b) {
  246. if (a === b)
  247. return true;
  248. let aValidType = isDate(a);
  249. let bValidType = isDate(b);
  250. if (aValidType || bValidType) {
  251. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  252. }
  253. aValidType = isSymbol(a);
  254. bValidType = isSymbol(b);
  255. if (aValidType || bValidType) {
  256. return a === b;
  257. }
  258. aValidType = isArray(a);
  259. bValidType = isArray(b);
  260. if (aValidType || bValidType) {
  261. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  262. }
  263. aValidType = isObject(a);
  264. bValidType = isObject(b);
  265. if (aValidType || bValidType) {
  266. if (!aValidType || !bValidType) {
  267. return false;
  268. }
  269. const aKeysCount = Object.keys(a).length;
  270. const bKeysCount = Object.keys(b).length;
  271. if (aKeysCount !== bKeysCount) {
  272. return false;
  273. }
  274. for (const key in a) {
  275. const aHasKey = a.hasOwnProperty(key);
  276. const bHasKey = b.hasOwnProperty(key);
  277. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  278. return false;
  279. }
  280. }
  281. }
  282. return String(a) === String(b);
  283. }
  284. function looseIndexOf(arr, val) {
  285. return arr.findIndex((item) => looseEqual(item, val));
  286. }
  287. const toDisplayString = (val) => {
  288. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  289. };
  290. const replacer = (_key, val) => {
  291. if (val && val.__v_isRef) {
  292. return replacer(_key, val.value);
  293. } else if (isMap(val)) {
  294. return {
  295. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  296. entries[`${key} =>`] = val2;
  297. return entries;
  298. }, {})
  299. };
  300. } else if (isSet(val)) {
  301. return {
  302. [`Set(${val.size})`]: [...val.values()]
  303. };
  304. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  305. return String(val);
  306. }
  307. return val;
  308. };
  309. function warn$1(msg, ...args) {
  310. console.warn(`[Vue warn] ${msg}`, ...args);
  311. }
  312. let activeEffectScope;
  313. class EffectScope {
  314. constructor(detached = false) {
  315. this.detached = detached;
  316. /**
  317. * @internal
  318. */
  319. this._active = true;
  320. /**
  321. * @internal
  322. */
  323. this.effects = [];
  324. /**
  325. * @internal
  326. */
  327. this.cleanups = [];
  328. this.parent = activeEffectScope;
  329. if (!detached && activeEffectScope) {
  330. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  331. this
  332. ) - 1;
  333. }
  334. }
  335. get active() {
  336. return this._active;
  337. }
  338. run(fn) {
  339. if (this._active) {
  340. const currentEffectScope = activeEffectScope;
  341. try {
  342. activeEffectScope = this;
  343. return fn();
  344. } finally {
  345. activeEffectScope = currentEffectScope;
  346. }
  347. } else {
  348. warn$1(`cannot run an inactive effect scope.`);
  349. }
  350. }
  351. /**
  352. * This should only be called on non-detached scopes
  353. * @internal
  354. */
  355. on() {
  356. activeEffectScope = this;
  357. }
  358. /**
  359. * This should only be called on non-detached scopes
  360. * @internal
  361. */
  362. off() {
  363. activeEffectScope = this.parent;
  364. }
  365. stop(fromParent) {
  366. if (this._active) {
  367. let i, l;
  368. for (i = 0, l = this.effects.length; i < l; i++) {
  369. this.effects[i].stop();
  370. }
  371. for (i = 0, l = this.cleanups.length; i < l; i++) {
  372. this.cleanups[i]();
  373. }
  374. if (this.scopes) {
  375. for (i = 0, l = this.scopes.length; i < l; i++) {
  376. this.scopes[i].stop(true);
  377. }
  378. }
  379. if (!this.detached && this.parent && !fromParent) {
  380. const last = this.parent.scopes.pop();
  381. if (last && last !== this) {
  382. this.parent.scopes[this.index] = last;
  383. last.index = this.index;
  384. }
  385. }
  386. this.parent = void 0;
  387. this._active = false;
  388. }
  389. }
  390. }
  391. function effectScope(detached) {
  392. return new EffectScope(detached);
  393. }
  394. function recordEffectScope(effect, scope = activeEffectScope) {
  395. if (scope && scope.active) {
  396. scope.effects.push(effect);
  397. }
  398. }
  399. function getCurrentScope() {
  400. return activeEffectScope;
  401. }
  402. function onScopeDispose(fn) {
  403. if (activeEffectScope) {
  404. activeEffectScope.cleanups.push(fn);
  405. } else {
  406. warn$1(
  407. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  408. );
  409. }
  410. }
  411. const createDep = (effects) => {
  412. const dep = new Set(effects);
  413. dep.w = 0;
  414. dep.n = 0;
  415. return dep;
  416. };
  417. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  418. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  419. const initDepMarkers = ({deps}) => {
  420. if (deps.length) {
  421. for (let i = 0; i < deps.length; i++) {
  422. deps[i].w |= trackOpBit;
  423. }
  424. }
  425. };
  426. const finalizeDepMarkers = (effect) => {
  427. const {deps} = effect;
  428. if (deps.length) {
  429. let ptr = 0;
  430. for (let i = 0; i < deps.length; i++) {
  431. const dep = deps[i];
  432. if (wasTracked(dep) && !newTracked(dep)) {
  433. dep.delete(effect);
  434. } else {
  435. deps[ptr++] = dep;
  436. }
  437. dep.w &= ~trackOpBit;
  438. dep.n &= ~trackOpBit;
  439. }
  440. deps.length = ptr;
  441. }
  442. };
  443. const targetMap = /* @__PURE__ */ new WeakMap();
  444. let effectTrackDepth = 0;
  445. let trackOpBit = 1;
  446. const maxMarkerBits = 30;
  447. let activeEffect;
  448. const ITERATE_KEY = Symbol("iterate");
  449. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  450. class ReactiveEffect {
  451. constructor(fn, scheduler = null, scope) {
  452. this.fn = fn;
  453. this.scheduler = scheduler;
  454. this.active = true;
  455. this.deps = [];
  456. this.parent = void 0;
  457. recordEffectScope(this, scope);
  458. }
  459. run() {
  460. if (!this.active) {
  461. return this.fn();
  462. }
  463. let parent = activeEffect;
  464. let lastShouldTrack = shouldTrack;
  465. while (parent) {
  466. if (parent === this) {
  467. return;
  468. }
  469. parent = parent.parent;
  470. }
  471. try {
  472. this.parent = activeEffect;
  473. activeEffect = this;
  474. shouldTrack = true;
  475. trackOpBit = 1 << ++effectTrackDepth;
  476. if (effectTrackDepth <= maxMarkerBits) {
  477. initDepMarkers(this);
  478. } else {
  479. cleanupEffect(this);
  480. }
  481. return this.fn();
  482. } finally {
  483. if (effectTrackDepth <= maxMarkerBits) {
  484. finalizeDepMarkers(this);
  485. }
  486. trackOpBit = 1 << --effectTrackDepth;
  487. activeEffect = this.parent;
  488. shouldTrack = lastShouldTrack;
  489. this.parent = void 0;
  490. if (this.deferStop) {
  491. this.stop();
  492. }
  493. }
  494. }
  495. stop() {
  496. if (activeEffect === this) {
  497. this.deferStop = true;
  498. } else if (this.active) {
  499. cleanupEffect(this);
  500. if (this.onStop) {
  501. this.onStop();
  502. }
  503. this.active = false;
  504. }
  505. }
  506. }
  507. function cleanupEffect(effect2) {
  508. const {deps} = effect2;
  509. if (deps.length) {
  510. for (let i = 0; i < deps.length; i++) {
  511. deps[i].delete(effect2);
  512. }
  513. deps.length = 0;
  514. }
  515. }
  516. function effect(fn, options) {
  517. if (fn.effect instanceof ReactiveEffect) {
  518. fn = fn.effect.fn;
  519. }
  520. const _effect = new ReactiveEffect(fn);
  521. if (options) {
  522. extend(_effect, options);
  523. if (options.scope)
  524. recordEffectScope(_effect, options.scope);
  525. }
  526. if (!options || !options.lazy) {
  527. _effect.run();
  528. }
  529. const runner = _effect.run.bind(_effect);
  530. runner.effect = _effect;
  531. return runner;
  532. }
  533. function stop(runner) {
  534. runner.effect.stop();
  535. }
  536. let shouldTrack = true;
  537. const trackStack = [];
  538. function pauseTracking() {
  539. trackStack.push(shouldTrack);
  540. shouldTrack = false;
  541. }
  542. function resetTracking() {
  543. const last = trackStack.pop();
  544. shouldTrack = last === void 0 ? true : last;
  545. }
  546. function track(target, type, key) {
  547. if (shouldTrack && activeEffect) {
  548. let depsMap = targetMap.get(target);
  549. if (!depsMap) {
  550. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  551. }
  552. let dep = depsMap.get(key);
  553. if (!dep) {
  554. depsMap.set(key, dep = createDep());
  555. }
  556. const eventInfo = {effect: activeEffect, target, type, key};
  557. trackEffects(dep, eventInfo);
  558. }
  559. }
  560. function trackEffects(dep, debuggerEventExtraInfo) {
  561. let shouldTrack2 = false;
  562. if (effectTrackDepth <= maxMarkerBits) {
  563. if (!newTracked(dep)) {
  564. dep.n |= trackOpBit;
  565. shouldTrack2 = !wasTracked(dep);
  566. }
  567. } else {
  568. shouldTrack2 = !dep.has(activeEffect);
  569. }
  570. if (shouldTrack2) {
  571. dep.add(activeEffect);
  572. activeEffect.deps.push(dep);
  573. if (activeEffect.onTrack) {
  574. activeEffect.onTrack(
  575. extend(
  576. {
  577. effect: activeEffect
  578. },
  579. debuggerEventExtraInfo
  580. )
  581. );
  582. }
  583. }
  584. }
  585. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  586. const depsMap = targetMap.get(target);
  587. if (!depsMap) {
  588. return;
  589. }
  590. let deps = [];
  591. if (type === "clear") {
  592. deps = [...depsMap.values()];
  593. } else if (key === "length" && isArray(target)) {
  594. const newLength = Number(newValue);
  595. depsMap.forEach((dep, key2) => {
  596. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  597. deps.push(dep);
  598. }
  599. });
  600. } else {
  601. if (key !== void 0) {
  602. deps.push(depsMap.get(key));
  603. }
  604. switch (type) {
  605. case "add":
  606. if (!isArray(target)) {
  607. deps.push(depsMap.get(ITERATE_KEY));
  608. if (isMap(target)) {
  609. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  610. }
  611. } else if (isIntegerKey(key)) {
  612. deps.push(depsMap.get("length"));
  613. }
  614. break;
  615. case "delete":
  616. if (!isArray(target)) {
  617. deps.push(depsMap.get(ITERATE_KEY));
  618. if (isMap(target)) {
  619. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  620. }
  621. }
  622. break;
  623. case "set":
  624. if (isMap(target)) {
  625. deps.push(depsMap.get(ITERATE_KEY));
  626. }
  627. break;
  628. }
  629. }
  630. const eventInfo = {target, type, key, newValue, oldValue, oldTarget};
  631. if (deps.length === 1) {
  632. if (deps[0]) {
  633. {
  634. triggerEffects(deps[0], eventInfo);
  635. }
  636. }
  637. } else {
  638. const effects = [];
  639. for (const dep of deps) {
  640. if (dep) {
  641. effects.push(...dep);
  642. }
  643. }
  644. {
  645. triggerEffects(createDep(effects), eventInfo);
  646. }
  647. }
  648. }
  649. function triggerEffects(dep, debuggerEventExtraInfo) {
  650. const effects = isArray(dep) ? dep : [...dep];
  651. for (const effect2 of effects) {
  652. if (effect2.computed) {
  653. triggerEffect(effect2, debuggerEventExtraInfo);
  654. }
  655. }
  656. for (const effect2 of effects) {
  657. if (!effect2.computed) {
  658. triggerEffect(effect2, debuggerEventExtraInfo);
  659. }
  660. }
  661. }
  662. function triggerEffect(effect2, debuggerEventExtraInfo) {
  663. if (effect2 !== activeEffect || effect2.allowRecurse) {
  664. if (effect2.onTrigger) {
  665. effect2.onTrigger(extend({effect: effect2}, debuggerEventExtraInfo));
  666. }
  667. if (effect2.scheduler) {
  668. effect2.scheduler();
  669. } else {
  670. effect2.run();
  671. }
  672. }
  673. }
  674. function getDepFromReactive(object, key) {
  675. var _a;
  676. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  677. }
  678. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  679. const builtInSymbols = new Set(
  680. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  681. );
  682. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  683. function createArrayInstrumentations() {
  684. const instrumentations = {};
  685. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  686. instrumentations[key] = function (...args) {
  687. const arr = toRaw(this);
  688. for (let i = 0, l = this.length; i < l; i++) {
  689. track(arr, "get", i + "");
  690. }
  691. const res = arr[key](...args);
  692. if (res === -1 || res === false) {
  693. return arr[key](...args.map(toRaw));
  694. } else {
  695. return res;
  696. }
  697. };
  698. });
  699. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  700. instrumentations[key] = function (...args) {
  701. pauseTracking();
  702. const res = toRaw(this)[key].apply(this, args);
  703. resetTracking();
  704. return res;
  705. };
  706. });
  707. return instrumentations;
  708. }
  709. function hasOwnProperty(key) {
  710. const obj = toRaw(this);
  711. track(obj, "has", key);
  712. return obj.hasOwnProperty(key);
  713. }
  714. class BaseReactiveHandler {
  715. constructor(_isReadonly = false, _shallow = false) {
  716. this._isReadonly = _isReadonly;
  717. this._shallow = _shallow;
  718. }
  719. get(target, key, receiver) {
  720. const isReadonly2 = this._isReadonly, shallow = this._shallow;
  721. if (key === "__v_isReactive") {
  722. return !isReadonly2;
  723. } else if (key === "__v_isReadonly") {
  724. return isReadonly2;
  725. } else if (key === "__v_isShallow") {
  726. return shallow;
  727. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  728. return target;
  729. }
  730. const targetIsArray = isArray(target);
  731. if (!isReadonly2) {
  732. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  733. return Reflect.get(arrayInstrumentations, key, receiver);
  734. }
  735. if (key === "hasOwnProperty") {
  736. return hasOwnProperty;
  737. }
  738. }
  739. const res = Reflect.get(target, key, receiver);
  740. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  741. return res;
  742. }
  743. if (!isReadonly2) {
  744. track(target, "get", key);
  745. }
  746. if (shallow) {
  747. return res;
  748. }
  749. if (isRef(res)) {
  750. return targetIsArray && isIntegerKey(key) ? res : res.value;
  751. }
  752. if (isObject(res)) {
  753. return isReadonly2 ? readonly(res) : reactive(res);
  754. }
  755. return res;
  756. }
  757. }
  758. class MutableReactiveHandler extends BaseReactiveHandler {
  759. constructor(shallow = false) {
  760. super(false, shallow);
  761. }
  762. set(target, key, value, receiver) {
  763. let oldValue = target[key];
  764. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  765. return false;
  766. }
  767. if (!this._shallow) {
  768. if (!isShallow(value) && !isReadonly(value)) {
  769. oldValue = toRaw(oldValue);
  770. value = toRaw(value);
  771. }
  772. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  773. oldValue.value = value;
  774. return true;
  775. }
  776. }
  777. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  778. const result = Reflect.set(target, key, value, receiver);
  779. if (target === toRaw(receiver)) {
  780. if (!hadKey) {
  781. trigger(target, "add", key, value);
  782. } else if (hasChanged(value, oldValue)) {
  783. trigger(target, "set", key, value, oldValue);
  784. }
  785. }
  786. return result;
  787. }
  788. deleteProperty(target, key) {
  789. const hadKey = hasOwn(target, key);
  790. const oldValue = target[key];
  791. const result = Reflect.deleteProperty(target, key);
  792. if (result && hadKey) {
  793. trigger(target, "delete", key, void 0, oldValue);
  794. }
  795. return result;
  796. }
  797. has(target, key) {
  798. const result = Reflect.has(target, key);
  799. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  800. track(target, "has", key);
  801. }
  802. return result;
  803. }
  804. ownKeys(target) {
  805. track(
  806. target,
  807. "iterate",
  808. isArray(target) ? "length" : ITERATE_KEY
  809. );
  810. return Reflect.ownKeys(target);
  811. }
  812. }
  813. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  814. constructor(shallow = false) {
  815. super(true, shallow);
  816. }
  817. set(target, key) {
  818. {
  819. warn$1(
  820. `Set operation on key "${String(key)}" failed: target is readonly.`,
  821. target
  822. );
  823. }
  824. return true;
  825. }
  826. deleteProperty(target, key) {
  827. {
  828. warn$1(
  829. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  830. target
  831. );
  832. }
  833. return true;
  834. }
  835. }
  836. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  837. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  838. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  839. true
  840. );
  841. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  842. const toShallow = (value) => value;
  843. const getProto = (v) => Reflect.getPrototypeOf(v);
  844. function get(target, key, isReadonly = false, isShallow = false) {
  845. target = target["__v_raw"];
  846. const rawTarget = toRaw(target);
  847. const rawKey = toRaw(key);
  848. if (!isReadonly) {
  849. if (hasChanged(key, rawKey)) {
  850. track(rawTarget, "get", key);
  851. }
  852. track(rawTarget, "get", rawKey);
  853. }
  854. const {has: has2} = getProto(rawTarget);
  855. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  856. if (has2.call(rawTarget, key)) {
  857. return wrap(target.get(key));
  858. } else if (has2.call(rawTarget, rawKey)) {
  859. return wrap(target.get(rawKey));
  860. } else if (target !== rawTarget) {
  861. target.get(key);
  862. }
  863. }
  864. function has(key, isReadonly = false) {
  865. const target = this["__v_raw"];
  866. const rawTarget = toRaw(target);
  867. const rawKey = toRaw(key);
  868. if (!isReadonly) {
  869. if (hasChanged(key, rawKey)) {
  870. track(rawTarget, "has", key);
  871. }
  872. track(rawTarget, "has", rawKey);
  873. }
  874. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  875. }
  876. function size(target, isReadonly = false) {
  877. target = target["__v_raw"];
  878. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  879. return Reflect.get(target, "size", target);
  880. }
  881. function add(value) {
  882. value = toRaw(value);
  883. const target = toRaw(this);
  884. const proto = getProto(target);
  885. const hadKey = proto.has.call(target, value);
  886. if (!hadKey) {
  887. target.add(value);
  888. trigger(target, "add", value, value);
  889. }
  890. return this;
  891. }
  892. function set(key, value) {
  893. value = toRaw(value);
  894. const target = toRaw(this);
  895. const {has: has2, get: get2} = getProto(target);
  896. let hadKey = has2.call(target, key);
  897. if (!hadKey) {
  898. key = toRaw(key);
  899. hadKey = has2.call(target, key);
  900. } else {
  901. checkIdentityKeys(target, has2, key);
  902. }
  903. const oldValue = get2.call(target, key);
  904. target.set(key, value);
  905. if (!hadKey) {
  906. trigger(target, "add", key, value);
  907. } else if (hasChanged(value, oldValue)) {
  908. trigger(target, "set", key, value, oldValue);
  909. }
  910. return this;
  911. }
  912. function deleteEntry(key) {
  913. const target = toRaw(this);
  914. const {has: has2, get: get2} = getProto(target);
  915. let hadKey = has2.call(target, key);
  916. if (!hadKey) {
  917. key = toRaw(key);
  918. hadKey = has2.call(target, key);
  919. } else {
  920. checkIdentityKeys(target, has2, key);
  921. }
  922. const oldValue = get2 ? get2.call(target, key) : void 0;
  923. const result = target.delete(key);
  924. if (hadKey) {
  925. trigger(target, "delete", key, void 0, oldValue);
  926. }
  927. return result;
  928. }
  929. function clear() {
  930. const target = toRaw(this);
  931. const hadItems = target.size !== 0;
  932. const oldTarget = isMap(target) ? new Map(target) : new Set(target);
  933. const result = target.clear();
  934. if (hadItems) {
  935. trigger(target, "clear", void 0, void 0, oldTarget);
  936. }
  937. return result;
  938. }
  939. function createForEach(isReadonly, isShallow) {
  940. return function forEach(callback, thisArg) {
  941. const observed = this;
  942. const target = observed["__v_raw"];
  943. const rawTarget = toRaw(target);
  944. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  945. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  946. return target.forEach((value, key) => {
  947. return callback.call(thisArg, wrap(value), wrap(key), observed);
  948. });
  949. };
  950. }
  951. function createIterableMethod(method, isReadonly, isShallow) {
  952. return function (...args) {
  953. const target = this["__v_raw"];
  954. const rawTarget = toRaw(target);
  955. const targetIsMap = isMap(rawTarget);
  956. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  957. const isKeyOnly = method === "keys" && targetIsMap;
  958. const innerIterator = target[method](...args);
  959. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  960. !isReadonly && track(
  961. rawTarget,
  962. "iterate",
  963. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  964. );
  965. return {
  966. // iterator protocol
  967. next() {
  968. const {value, done} = innerIterator.next();
  969. return done ? {value, done} : {
  970. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  971. done
  972. };
  973. },
  974. // iterable protocol
  975. [Symbol.iterator]() {
  976. return this;
  977. }
  978. };
  979. };
  980. }
  981. function createReadonlyMethod(type) {
  982. return function (...args) {
  983. {
  984. const key = args[0] ? `on key "${args[0]}" ` : ``;
  985. console.warn(
  986. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  987. toRaw(this)
  988. );
  989. }
  990. return type === "delete" ? false : this;
  991. };
  992. }
  993. function createInstrumentations() {
  994. const mutableInstrumentations2 = {
  995. get(key) {
  996. return get(this, key);
  997. },
  998. get size() {
  999. return size(this);
  1000. },
  1001. has,
  1002. add,
  1003. set,
  1004. delete: deleteEntry,
  1005. clear,
  1006. forEach: createForEach(false, false)
  1007. };
  1008. const shallowInstrumentations2 = {
  1009. get(key) {
  1010. return get(this, key, false, true);
  1011. },
  1012. get size() {
  1013. return size(this);
  1014. },
  1015. has,
  1016. add,
  1017. set,
  1018. delete: deleteEntry,
  1019. clear,
  1020. forEach: createForEach(false, true)
  1021. };
  1022. const readonlyInstrumentations2 = {
  1023. get(key) {
  1024. return get(this, key, true);
  1025. },
  1026. get size() {
  1027. return size(this, true);
  1028. },
  1029. has(key) {
  1030. return has.call(this, key, true);
  1031. },
  1032. add: createReadonlyMethod("add"),
  1033. set: createReadonlyMethod("set"),
  1034. delete: createReadonlyMethod("delete"),
  1035. clear: createReadonlyMethod("clear"),
  1036. forEach: createForEach(true, false)
  1037. };
  1038. const shallowReadonlyInstrumentations2 = {
  1039. get(key) {
  1040. return get(this, key, true, true);
  1041. },
  1042. get size() {
  1043. return size(this, true);
  1044. },
  1045. has(key) {
  1046. return has.call(this, key, true);
  1047. },
  1048. add: createReadonlyMethod("add"),
  1049. set: createReadonlyMethod("set"),
  1050. delete: createReadonlyMethod("delete"),
  1051. clear: createReadonlyMethod("clear"),
  1052. forEach: createForEach(true, true)
  1053. };
  1054. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1055. iteratorMethods.forEach((method) => {
  1056. mutableInstrumentations2[method] = createIterableMethod(
  1057. method,
  1058. false,
  1059. false
  1060. );
  1061. readonlyInstrumentations2[method] = createIterableMethod(
  1062. method,
  1063. true,
  1064. false
  1065. );
  1066. shallowInstrumentations2[method] = createIterableMethod(
  1067. method,
  1068. false,
  1069. true
  1070. );
  1071. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1072. method,
  1073. true,
  1074. true
  1075. );
  1076. });
  1077. return [
  1078. mutableInstrumentations2,
  1079. readonlyInstrumentations2,
  1080. shallowInstrumentations2,
  1081. shallowReadonlyInstrumentations2
  1082. ];
  1083. }
  1084. const [
  1085. mutableInstrumentations,
  1086. readonlyInstrumentations,
  1087. shallowInstrumentations,
  1088. shallowReadonlyInstrumentations
  1089. ] = /* @__PURE__ */ createInstrumentations();
  1090. function createInstrumentationGetter(isReadonly, shallow) {
  1091. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1092. return (target, key, receiver) => {
  1093. if (key === "__v_isReactive") {
  1094. return !isReadonly;
  1095. } else if (key === "__v_isReadonly") {
  1096. return isReadonly;
  1097. } else if (key === "__v_raw") {
  1098. return target;
  1099. }
  1100. return Reflect.get(
  1101. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1102. key,
  1103. receiver
  1104. );
  1105. };
  1106. }
  1107. const mutableCollectionHandlers = {
  1108. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1109. };
  1110. const shallowCollectionHandlers = {
  1111. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1112. };
  1113. const readonlyCollectionHandlers = {
  1114. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1115. };
  1116. const shallowReadonlyCollectionHandlers = {
  1117. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1118. };
  1119. function checkIdentityKeys(target, has2, key) {
  1120. const rawKey = toRaw(key);
  1121. if (rawKey !== key && has2.call(target, rawKey)) {
  1122. const type = toRawType(target);
  1123. console.warn(
  1124. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1125. );
  1126. }
  1127. }
  1128. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1129. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1130. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1131. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1132. function targetTypeMap(rawType) {
  1133. switch (rawType) {
  1134. case "Object":
  1135. case "Array":
  1136. return 1 /* COMMON */;
  1137. case "Map":
  1138. case "Set":
  1139. case "WeakMap":
  1140. case "WeakSet":
  1141. return 2 /* COLLECTION */;
  1142. default:
  1143. return 0 /* INVALID */;
  1144. }
  1145. }
  1146. function getTargetType(value) {
  1147. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1148. }
  1149. function reactive(target) {
  1150. if (isReadonly(target)) {
  1151. return target;
  1152. }
  1153. return createReactiveObject(
  1154. target,
  1155. false,
  1156. mutableHandlers,
  1157. mutableCollectionHandlers,
  1158. reactiveMap
  1159. );
  1160. }
  1161. function shallowReactive(target) {
  1162. return createReactiveObject(
  1163. target,
  1164. false,
  1165. shallowReactiveHandlers,
  1166. shallowCollectionHandlers,
  1167. shallowReactiveMap
  1168. );
  1169. }
  1170. function readonly(target) {
  1171. return createReactiveObject(
  1172. target,
  1173. true,
  1174. readonlyHandlers,
  1175. readonlyCollectionHandlers,
  1176. readonlyMap
  1177. );
  1178. }
  1179. function shallowReadonly(target) {
  1180. return createReactiveObject(
  1181. target,
  1182. true,
  1183. shallowReadonlyHandlers,
  1184. shallowReadonlyCollectionHandlers,
  1185. shallowReadonlyMap
  1186. );
  1187. }
  1188. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1189. if (!isObject(target)) {
  1190. {
  1191. console.warn(`value cannot be made reactive: ${String(target)}`);
  1192. }
  1193. return target;
  1194. }
  1195. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1196. return target;
  1197. }
  1198. const existingProxy = proxyMap.get(target);
  1199. if (existingProxy) {
  1200. return existingProxy;
  1201. }
  1202. const targetType = getTargetType(target);
  1203. if (targetType === 0 /* INVALID */) {
  1204. return target;
  1205. }
  1206. const proxy = new Proxy(
  1207. target,
  1208. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1209. );
  1210. proxyMap.set(target, proxy);
  1211. return proxy;
  1212. }
  1213. function isReactive(value) {
  1214. if (isReadonly(value)) {
  1215. return isReactive(value["__v_raw"]);
  1216. }
  1217. return !!(value && value["__v_isReactive"]);
  1218. }
  1219. function isReadonly(value) {
  1220. return !!(value && value["__v_isReadonly"]);
  1221. }
  1222. function isShallow(value) {
  1223. return !!(value && value["__v_isShallow"]);
  1224. }
  1225. function isProxy(value) {
  1226. return isReactive(value) || isReadonly(value);
  1227. }
  1228. function toRaw(observed) {
  1229. const raw = observed && observed["__v_raw"];
  1230. return raw ? toRaw(raw) : observed;
  1231. }
  1232. function markRaw(value) {
  1233. def(value, "__v_skip", true);
  1234. return value;
  1235. }
  1236. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1237. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1238. function trackRefValue(ref2) {
  1239. if (shouldTrack && activeEffect) {
  1240. ref2 = toRaw(ref2);
  1241. {
  1242. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  1243. target: ref2,
  1244. type: "get",
  1245. key: "value"
  1246. });
  1247. }
  1248. }
  1249. }
  1250. function triggerRefValue(ref2, newVal) {
  1251. ref2 = toRaw(ref2);
  1252. const dep = ref2.dep;
  1253. if (dep) {
  1254. {
  1255. triggerEffects(dep, {
  1256. target: ref2,
  1257. type: "set",
  1258. key: "value",
  1259. newValue: newVal
  1260. });
  1261. }
  1262. }
  1263. }
  1264. function isRef(r) {
  1265. return !!(r && r.__v_isRef === true);
  1266. }
  1267. function ref(value) {
  1268. return createRef(value, false);
  1269. }
  1270. function shallowRef(value) {
  1271. return createRef(value, true);
  1272. }
  1273. function createRef(rawValue, shallow) {
  1274. if (isRef(rawValue)) {
  1275. return rawValue;
  1276. }
  1277. return new RefImpl(rawValue, shallow);
  1278. }
  1279. class RefImpl {
  1280. constructor(value, __v_isShallow) {
  1281. this.__v_isShallow = __v_isShallow;
  1282. this.dep = void 0;
  1283. this.__v_isRef = true;
  1284. this._rawValue = __v_isShallow ? value : toRaw(value);
  1285. this._value = __v_isShallow ? value : toReactive(value);
  1286. }
  1287. get value() {
  1288. trackRefValue(this);
  1289. return this._value;
  1290. }
  1291. set value(newVal) {
  1292. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1293. newVal = useDirectValue ? newVal : toRaw(newVal);
  1294. if (hasChanged(newVal, this._rawValue)) {
  1295. this._rawValue = newVal;
  1296. this._value = useDirectValue ? newVal : toReactive(newVal);
  1297. triggerRefValue(this, newVal);
  1298. }
  1299. }
  1300. }
  1301. function triggerRef(ref2) {
  1302. triggerRefValue(ref2, ref2.value);
  1303. }
  1304. function unref(ref2) {
  1305. return isRef(ref2) ? ref2.value : ref2;
  1306. }
  1307. function toValue(source) {
  1308. return isFunction(source) ? source() : unref(source);
  1309. }
  1310. const shallowUnwrapHandlers = {
  1311. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1312. set: (target, key, value, receiver) => {
  1313. const oldValue = target[key];
  1314. if (isRef(oldValue) && !isRef(value)) {
  1315. oldValue.value = value;
  1316. return true;
  1317. } else {
  1318. return Reflect.set(target, key, value, receiver);
  1319. }
  1320. }
  1321. };
  1322. function proxyRefs(objectWithRefs) {
  1323. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1324. }
  1325. class CustomRefImpl {
  1326. constructor(factory) {
  1327. this.dep = void 0;
  1328. this.__v_isRef = true;
  1329. const {get, set} = factory(
  1330. () => trackRefValue(this),
  1331. () => triggerRefValue(this)
  1332. );
  1333. this._get = get;
  1334. this._set = set;
  1335. }
  1336. get value() {
  1337. return this._get();
  1338. }
  1339. set value(newVal) {
  1340. this._set(newVal);
  1341. }
  1342. }
  1343. function customRef(factory) {
  1344. return new CustomRefImpl(factory);
  1345. }
  1346. function toRefs(object) {
  1347. if (!isProxy(object)) {
  1348. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1349. }
  1350. const ret = isArray(object) ? new Array(object.length) : {};
  1351. for (const key in object) {
  1352. ret[key] = propertyToRef(object, key);
  1353. }
  1354. return ret;
  1355. }
  1356. class ObjectRefImpl {
  1357. constructor(_object, _key, _defaultValue) {
  1358. this._object = _object;
  1359. this._key = _key;
  1360. this._defaultValue = _defaultValue;
  1361. this.__v_isRef = true;
  1362. }
  1363. get value() {
  1364. const val = this._object[this._key];
  1365. return val === void 0 ? this._defaultValue : val;
  1366. }
  1367. set value(newVal) {
  1368. this._object[this._key] = newVal;
  1369. }
  1370. get dep() {
  1371. return getDepFromReactive(toRaw(this._object), this._key);
  1372. }
  1373. }
  1374. class GetterRefImpl {
  1375. constructor(_getter) {
  1376. this._getter = _getter;
  1377. this.__v_isRef = true;
  1378. this.__v_isReadonly = true;
  1379. }
  1380. get value() {
  1381. return this._getter();
  1382. }
  1383. }
  1384. function toRef(source, key, defaultValue) {
  1385. if (isRef(source)) {
  1386. return source;
  1387. } else if (isFunction(source)) {
  1388. return new GetterRefImpl(source);
  1389. } else if (isObject(source) && arguments.length > 1) {
  1390. return propertyToRef(source, key, defaultValue);
  1391. } else {
  1392. return ref(source);
  1393. }
  1394. }
  1395. function propertyToRef(source, key, defaultValue) {
  1396. const val = source[key];
  1397. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1398. }
  1399. class ComputedRefImpl {
  1400. constructor(getter, _setter, isReadonly, isSSR) {
  1401. this._setter = _setter;
  1402. this.dep = void 0;
  1403. this.__v_isRef = true;
  1404. this["__v_isReadonly"] = false;
  1405. this._dirty = true;
  1406. this.effect = new ReactiveEffect(getter, () => {
  1407. if (!this._dirty) {
  1408. this._dirty = true;
  1409. triggerRefValue(this);
  1410. }
  1411. });
  1412. this.effect.computed = this;
  1413. this.effect.active = this._cacheable = !isSSR;
  1414. this["__v_isReadonly"] = isReadonly;
  1415. }
  1416. get value() {
  1417. const self = toRaw(this);
  1418. trackRefValue(self);
  1419. if (self._dirty || !self._cacheable) {
  1420. self._dirty = false;
  1421. self._value = self.effect.run();
  1422. }
  1423. return self._value;
  1424. }
  1425. set value(newValue) {
  1426. this._setter(newValue);
  1427. }
  1428. }
  1429. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1430. let getter;
  1431. let setter;
  1432. const onlyGetter = isFunction(getterOrOptions);
  1433. if (onlyGetter) {
  1434. getter = getterOrOptions;
  1435. setter = () => {
  1436. console.warn("Write operation failed: computed value is readonly");
  1437. };
  1438. } else {
  1439. getter = getterOrOptions.get;
  1440. setter = getterOrOptions.set;
  1441. }
  1442. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1443. if (debugOptions && !isSSR) {
  1444. cRef.effect.onTrack = debugOptions.onTrack;
  1445. cRef.effect.onTrigger = debugOptions.onTrigger;
  1446. }
  1447. return cRef;
  1448. }
  1449. const stack = [];
  1450. function pushWarningContext(vnode) {
  1451. stack.push(vnode);
  1452. }
  1453. function popWarningContext() {
  1454. stack.pop();
  1455. }
  1456. function warn(msg, ...args) {
  1457. pauseTracking();
  1458. const instance = stack.length ? stack[stack.length - 1].component : null;
  1459. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1460. const trace = getComponentTrace();
  1461. if (appWarnHandler) {
  1462. callWithErrorHandling(
  1463. appWarnHandler,
  1464. instance,
  1465. 11,
  1466. [
  1467. msg + args.join(""),
  1468. instance && instance.proxy,
  1469. trace.map(
  1470. ({vnode}) => `at <${formatComponentName(instance, vnode.type)}>`
  1471. ).join("\n"),
  1472. trace
  1473. ]
  1474. );
  1475. } else {
  1476. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1477. if (trace.length && // avoid spamming console during tests
  1478. true) {
  1479. warnArgs.push(`
  1480. `, ...formatTrace(trace));
  1481. }
  1482. console.warn(...warnArgs);
  1483. }
  1484. resetTracking();
  1485. }
  1486. function getComponentTrace() {
  1487. let currentVNode = stack[stack.length - 1];
  1488. if (!currentVNode) {
  1489. return [];
  1490. }
  1491. const normalizedStack = [];
  1492. while (currentVNode) {
  1493. const last = normalizedStack[0];
  1494. if (last && last.vnode === currentVNode) {
  1495. last.recurseCount++;
  1496. } else {
  1497. normalizedStack.push({
  1498. vnode: currentVNode,
  1499. recurseCount: 0
  1500. });
  1501. }
  1502. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1503. currentVNode = parentInstance && parentInstance.vnode;
  1504. }
  1505. return normalizedStack;
  1506. }
  1507. function formatTrace(trace) {
  1508. const logs = [];
  1509. trace.forEach((entry, i) => {
  1510. logs.push(...i === 0 ? [] : [`
  1511. `], ...formatTraceEntry(entry));
  1512. });
  1513. return logs;
  1514. }
  1515. function formatTraceEntry({vnode, recurseCount}) {
  1516. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1517. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1518. const open = ` at <${formatComponentName(
  1519. vnode.component,
  1520. vnode.type,
  1521. isRoot
  1522. )}`;
  1523. const close = `>` + postfix;
  1524. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1525. }
  1526. function formatProps(props) {
  1527. const res = [];
  1528. const keys = Object.keys(props);
  1529. keys.slice(0, 3).forEach((key) => {
  1530. res.push(...formatProp(key, props[key]));
  1531. });
  1532. if (keys.length > 3) {
  1533. res.push(` ...`);
  1534. }
  1535. return res;
  1536. }
  1537. function formatProp(key, value, raw) {
  1538. if (isString(value)) {
  1539. value = JSON.stringify(value);
  1540. return raw ? value : [`${key}=${value}`];
  1541. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1542. return raw ? value : [`${key}=${value}`];
  1543. } else if (isRef(value)) {
  1544. value = formatProp(key, toRaw(value.value), true);
  1545. return raw ? value : [`${key}=Ref<`, value, `>`];
  1546. } else if (isFunction(value)) {
  1547. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1548. } else {
  1549. value = toRaw(value);
  1550. return raw ? value : [`${key}=`, value];
  1551. }
  1552. }
  1553. function assertNumber(val, type) {
  1554. if (val === void 0) {
  1555. return;
  1556. } else if (typeof val !== "number") {
  1557. warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1558. } else if (isNaN(val)) {
  1559. warn(`${type} is NaN - the duration expression might be incorrect.`);
  1560. }
  1561. }
  1562. const ErrorTypeStrings = {
  1563. ["sp"]: "serverPrefetch hook",
  1564. ["bc"]: "beforeCreate hook",
  1565. ["c"]: "created hook",
  1566. ["bm"]: "beforeMount hook",
  1567. ["m"]: "mounted hook",
  1568. ["bu"]: "beforeUpdate hook",
  1569. ["u"]: "updated",
  1570. ["bum"]: "beforeUnmount hook",
  1571. ["um"]: "unmounted hook",
  1572. ["a"]: "activated hook",
  1573. ["da"]: "deactivated hook",
  1574. ["ec"]: "errorCaptured hook",
  1575. ["rtc"]: "renderTracked hook",
  1576. ["rtg"]: "renderTriggered hook",
  1577. [0]: "setup function",
  1578. [1]: "render function",
  1579. [2]: "watcher getter",
  1580. [3]: "watcher callback",
  1581. [4]: "watcher cleanup function",
  1582. [5]: "native event handler",
  1583. [6]: "component event handler",
  1584. [7]: "vnode hook",
  1585. [8]: "directive hook",
  1586. [9]: "transition hook",
  1587. [10]: "app errorHandler",
  1588. [11]: "app warnHandler",
  1589. [12]: "ref function",
  1590. [13]: "async component loader",
  1591. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  1592. };
  1593. function callWithErrorHandling(fn, instance, type, args) {
  1594. let res;
  1595. try {
  1596. res = args ? fn(...args) : fn();
  1597. } catch (err) {
  1598. handleError(err, instance, type);
  1599. }
  1600. return res;
  1601. }
  1602. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1603. if (isFunction(fn)) {
  1604. const res = callWithErrorHandling(fn, instance, type, args);
  1605. if (res && isPromise(res)) {
  1606. res.catch((err) => {
  1607. handleError(err, instance, type);
  1608. });
  1609. }
  1610. return res;
  1611. }
  1612. const values = [];
  1613. for (let i = 0; i < fn.length; i++) {
  1614. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1615. }
  1616. return values;
  1617. }
  1618. function handleError(err, instance, type, throwInDev = true) {
  1619. const contextVNode = instance ? instance.vnode : null;
  1620. if (instance) {
  1621. let cur = instance.parent;
  1622. const exposedInstance = instance.proxy;
  1623. const errorInfo = ErrorTypeStrings[type];
  1624. while (cur) {
  1625. const errorCapturedHooks = cur.ec;
  1626. if (errorCapturedHooks) {
  1627. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1628. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1629. return;
  1630. }
  1631. }
  1632. }
  1633. cur = cur.parent;
  1634. }
  1635. const appErrorHandler = instance.appContext.config.errorHandler;
  1636. if (appErrorHandler) {
  1637. callWithErrorHandling(
  1638. appErrorHandler,
  1639. null,
  1640. 10,
  1641. [err, exposedInstance, errorInfo]
  1642. );
  1643. return;
  1644. }
  1645. }
  1646. logError(err, type, contextVNode, throwInDev);
  1647. }
  1648. function logError(err, type, contextVNode, throwInDev = true) {
  1649. {
  1650. const info = ErrorTypeStrings[type];
  1651. if (contextVNode) {
  1652. pushWarningContext(contextVNode);
  1653. }
  1654. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1655. if (contextVNode) {
  1656. popWarningContext();
  1657. }
  1658. if (throwInDev) {
  1659. throw err;
  1660. } else {
  1661. console.error(err);
  1662. }
  1663. }
  1664. }
  1665. let isFlushing = false;
  1666. let isFlushPending = false;
  1667. const queue = [];
  1668. let flushIndex = 0;
  1669. const pendingPostFlushCbs = [];
  1670. let activePostFlushCbs = null;
  1671. let postFlushIndex = 0;
  1672. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1673. let currentFlushPromise = null;
  1674. const RECURSION_LIMIT = 100;
  1675. function nextTick(fn) {
  1676. const p = currentFlushPromise || resolvedPromise;
  1677. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1678. }
  1679. function findInsertionIndex(id) {
  1680. let start = flushIndex + 1;
  1681. let end = queue.length;
  1682. while (start < end) {
  1683. const middle = start + end >>> 1;
  1684. const middleJob = queue[middle];
  1685. const middleJobId = getId(middleJob);
  1686. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1687. start = middle + 1;
  1688. } else {
  1689. end = middle;
  1690. }
  1691. }
  1692. return start;
  1693. }
  1694. function queueJob(job) {
  1695. if (!queue.length || !queue.includes(
  1696. job,
  1697. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1698. )) {
  1699. if (job.id == null) {
  1700. queue.push(job);
  1701. } else {
  1702. queue.splice(findInsertionIndex(job.id), 0, job);
  1703. }
  1704. queueFlush();
  1705. }
  1706. }
  1707. function queueFlush() {
  1708. if (!isFlushing && !isFlushPending) {
  1709. isFlushPending = true;
  1710. currentFlushPromise = resolvedPromise.then(flushJobs);
  1711. }
  1712. }
  1713. function invalidateJob(job) {
  1714. const i = queue.indexOf(job);
  1715. if (i > flushIndex) {
  1716. queue.splice(i, 1);
  1717. }
  1718. }
  1719. function queuePostFlushCb(cb) {
  1720. if (!isArray(cb)) {
  1721. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1722. cb,
  1723. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1724. )) {
  1725. pendingPostFlushCbs.push(cb);
  1726. }
  1727. } else {
  1728. pendingPostFlushCbs.push(...cb);
  1729. }
  1730. queueFlush();
  1731. }
  1732. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  1733. {
  1734. seen = seen || /* @__PURE__ */ new Map();
  1735. }
  1736. for (; i < queue.length; i++) {
  1737. const cb = queue[i];
  1738. if (cb && cb.pre) {
  1739. if (checkRecursiveUpdates(seen, cb)) {
  1740. continue;
  1741. }
  1742. queue.splice(i, 1);
  1743. i--;
  1744. cb();
  1745. }
  1746. }
  1747. }
  1748. function flushPostFlushCbs(seen) {
  1749. if (pendingPostFlushCbs.length) {
  1750. const deduped = [...new Set(pendingPostFlushCbs)];
  1751. pendingPostFlushCbs.length = 0;
  1752. if (activePostFlushCbs) {
  1753. activePostFlushCbs.push(...deduped);
  1754. return;
  1755. }
  1756. activePostFlushCbs = deduped;
  1757. {
  1758. seen = seen || /* @__PURE__ */ new Map();
  1759. }
  1760. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1761. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1762. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1763. continue;
  1764. }
  1765. activePostFlushCbs[postFlushIndex]();
  1766. }
  1767. activePostFlushCbs = null;
  1768. postFlushIndex = 0;
  1769. }
  1770. }
  1771. const getId = (job) => job.id == null ? Infinity : job.id;
  1772. const comparator = (a, b) => {
  1773. const diff = getId(a) - getId(b);
  1774. if (diff === 0) {
  1775. if (a.pre && !b.pre)
  1776. return -1;
  1777. if (b.pre && !a.pre)
  1778. return 1;
  1779. }
  1780. return diff;
  1781. };
  1782. function flushJobs(seen) {
  1783. isFlushPending = false;
  1784. isFlushing = true;
  1785. {
  1786. seen = seen || /* @__PURE__ */ new Map();
  1787. }
  1788. queue.sort(comparator);
  1789. const check = (job) => checkRecursiveUpdates(seen, job);
  1790. try {
  1791. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1792. const job = queue[flushIndex];
  1793. if (job && job.active !== false) {
  1794. if (check(job)) {
  1795. continue;
  1796. }
  1797. callWithErrorHandling(job, null, 14);
  1798. }
  1799. }
  1800. } finally {
  1801. flushIndex = 0;
  1802. queue.length = 0;
  1803. flushPostFlushCbs(seen);
  1804. isFlushing = false;
  1805. currentFlushPromise = null;
  1806. if (queue.length || pendingPostFlushCbs.length) {
  1807. flushJobs(seen);
  1808. }
  1809. }
  1810. }
  1811. function checkRecursiveUpdates(seen, fn) {
  1812. if (!seen.has(fn)) {
  1813. seen.set(fn, 1);
  1814. } else {
  1815. const count = seen.get(fn);
  1816. if (count > RECURSION_LIMIT) {
  1817. const instance = fn.ownerInstance;
  1818. const componentName = instance && getComponentName(instance.type);
  1819. warn(
  1820. `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
  1821. );
  1822. return true;
  1823. } else {
  1824. seen.set(fn, count + 1);
  1825. }
  1826. }
  1827. }
  1828. let isHmrUpdating = false;
  1829. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1830. {
  1831. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1832. createRecord: tryWrap(createRecord),
  1833. rerender: tryWrap(rerender),
  1834. reload: tryWrap(reload)
  1835. };
  1836. }
  1837. const map = /* @__PURE__ */ new Map();
  1838. function registerHMR(instance) {
  1839. const id = instance.type.__hmrId;
  1840. let record = map.get(id);
  1841. if (!record) {
  1842. createRecord(id, instance.type);
  1843. record = map.get(id);
  1844. }
  1845. record.instances.add(instance);
  1846. }
  1847. function unregisterHMR(instance) {
  1848. map.get(instance.type.__hmrId).instances.delete(instance);
  1849. }
  1850. function createRecord(id, initialDef) {
  1851. if (map.has(id)) {
  1852. return false;
  1853. }
  1854. map.set(id, {
  1855. initialDef: normalizeClassComponent(initialDef),
  1856. instances: /* @__PURE__ */ new Set()
  1857. });
  1858. return true;
  1859. }
  1860. function normalizeClassComponent(component) {
  1861. return isClassComponent(component) ? component.__vccOpts : component;
  1862. }
  1863. function rerender(id, newRender) {
  1864. const record = map.get(id);
  1865. if (!record) {
  1866. return;
  1867. }
  1868. record.initialDef.render = newRender;
  1869. [...record.instances].forEach((instance) => {
  1870. if (newRender) {
  1871. instance.render = newRender;
  1872. normalizeClassComponent(instance.type).render = newRender;
  1873. }
  1874. instance.renderCache = [];
  1875. isHmrUpdating = true;
  1876. instance.update();
  1877. isHmrUpdating = false;
  1878. });
  1879. }
  1880. function reload(id, newComp) {
  1881. const record = map.get(id);
  1882. if (!record)
  1883. return;
  1884. newComp = normalizeClassComponent(newComp);
  1885. updateComponentDef(record.initialDef, newComp);
  1886. const instances = [...record.instances];
  1887. for (const instance of instances) {
  1888. const oldComp = normalizeClassComponent(instance.type);
  1889. if (!hmrDirtyComponents.has(oldComp)) {
  1890. if (oldComp !== record.initialDef) {
  1891. updateComponentDef(oldComp, newComp);
  1892. }
  1893. hmrDirtyComponents.add(oldComp);
  1894. }
  1895. instance.appContext.propsCache.delete(instance.type);
  1896. instance.appContext.emitsCache.delete(instance.type);
  1897. instance.appContext.optionsCache.delete(instance.type);
  1898. if (instance.ceReload) {
  1899. hmrDirtyComponents.add(oldComp);
  1900. instance.ceReload(newComp.styles);
  1901. hmrDirtyComponents.delete(oldComp);
  1902. } else if (instance.parent) {
  1903. queueJob(instance.parent.update);
  1904. } else if (instance.appContext.reload) {
  1905. instance.appContext.reload();
  1906. } else if (typeof window !== "undefined") {
  1907. window.location.reload();
  1908. } else {
  1909. console.warn(
  1910. "[HMR] Root or manually mounted instance modified. Full reload required."
  1911. );
  1912. }
  1913. }
  1914. queuePostFlushCb(() => {
  1915. for (const instance of instances) {
  1916. hmrDirtyComponents.delete(
  1917. normalizeClassComponent(instance.type)
  1918. );
  1919. }
  1920. });
  1921. }
  1922. function updateComponentDef(oldComp, newComp) {
  1923. extend(oldComp, newComp);
  1924. for (const key in oldComp) {
  1925. if (key !== "__file" && !(key in newComp)) {
  1926. delete oldComp[key];
  1927. }
  1928. }
  1929. }
  1930. function tryWrap(fn) {
  1931. return (id, arg) => {
  1932. try {
  1933. return fn(id, arg);
  1934. } catch (e) {
  1935. console.error(e);
  1936. console.warn(
  1937. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  1938. );
  1939. }
  1940. };
  1941. }
  1942. exports.devtools = void 0;
  1943. let buffer = [];
  1944. let devtoolsNotInstalled = false;
  1945. function emit$1(event, ...args) {
  1946. if (exports.devtools) {
  1947. exports.devtools.emit(event, ...args);
  1948. } else if (!devtoolsNotInstalled) {
  1949. buffer.push({event, args});
  1950. }
  1951. }
  1952. function setDevtoolsHook(hook, target) {
  1953. var _a, _b;
  1954. exports.devtools = hook;
  1955. if (exports.devtools) {
  1956. exports.devtools.enabled = true;
  1957. buffer.forEach(({event, args}) => exports.devtools.emit(event, ...args));
  1958. buffer = [];
  1959. } else if (
  1960. // handle late devtools injection - only do this if we are in an actual
  1961. // browser environment to avoid the timer handle stalling test runner exit
  1962. // (#4815)
  1963. typeof window !== "undefined" && // some envs mock window but not fully
  1964. window.HTMLElement && // also exclude jsdom
  1965. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1966. ) {
  1967. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1968. replay.push((newHook) => {
  1969. setDevtoolsHook(newHook, target);
  1970. });
  1971. setTimeout(() => {
  1972. if (!exports.devtools) {
  1973. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1974. devtoolsNotInstalled = true;
  1975. buffer = [];
  1976. }
  1977. }, 3e3);
  1978. } else {
  1979. devtoolsNotInstalled = true;
  1980. buffer = [];
  1981. }
  1982. }
  1983. function devtoolsInitApp(app, version) {
  1984. emit$1("app:init" /* APP_INIT */, app, version, {
  1985. Fragment,
  1986. Text,
  1987. Comment,
  1988. Static
  1989. });
  1990. }
  1991. function devtoolsUnmountApp(app) {
  1992. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  1993. }
  1994. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  1995. "component:added" /* COMPONENT_ADDED */
  1996. );
  1997. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  1998. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  1999. "component:removed" /* COMPONENT_REMOVED */
  2000. );
  2001. const devtoolsComponentRemoved = (component) => {
  2002. if (exports.devtools && typeof exports.devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2003. !exports.devtools.cleanupBuffer(component)) {
  2004. _devtoolsComponentRemoved(component);
  2005. }
  2006. };
  2007. function createDevtoolsComponentHook(hook) {
  2008. return (component) => {
  2009. emit$1(
  2010. hook,
  2011. component.appContext.app,
  2012. component.uid,
  2013. component.parent ? component.parent.uid : void 0,
  2014. component
  2015. );
  2016. };
  2017. }
  2018. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2019. "perf:start" /* PERFORMANCE_START */
  2020. );
  2021. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2022. "perf:end" /* PERFORMANCE_END */
  2023. );
  2024. function createDevtoolsPerformanceHook(hook) {
  2025. return (component, type, time) => {
  2026. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2027. };
  2028. }
  2029. function devtoolsComponentEmit(component, event, params) {
  2030. emit$1(
  2031. "component:emit" /* COMPONENT_EMIT */,
  2032. component.appContext.app,
  2033. component,
  2034. event,
  2035. params
  2036. );
  2037. }
  2038. function emit(instance, event, ...rawArgs) {
  2039. if (instance.isUnmounted)
  2040. return;
  2041. const props = instance.vnode.props || EMPTY_OBJ;
  2042. {
  2043. const {
  2044. emitsOptions,
  2045. propsOptions: [propsOptions]
  2046. } = instance;
  2047. if (emitsOptions) {
  2048. if (!(event in emitsOptions) && true) {
  2049. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  2050. warn(
  2051. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  2052. );
  2053. }
  2054. } else {
  2055. const validator = emitsOptions[event];
  2056. if (isFunction(validator)) {
  2057. const isValid = validator(...rawArgs);
  2058. if (!isValid) {
  2059. warn(
  2060. `Invalid event arguments: event validation failed for event "${event}".`
  2061. );
  2062. }
  2063. }
  2064. }
  2065. }
  2066. }
  2067. let args = rawArgs;
  2068. const isModelListener = event.startsWith("update:");
  2069. const modelArg = isModelListener && event.slice(7);
  2070. if (modelArg && modelArg in props) {
  2071. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2072. const {number, trim} = props[modifiersKey] || EMPTY_OBJ;
  2073. if (trim) {
  2074. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2075. }
  2076. if (number) {
  2077. args = rawArgs.map(looseToNumber);
  2078. }
  2079. }
  2080. {
  2081. devtoolsComponentEmit(instance, event, args);
  2082. }
  2083. {
  2084. const lowerCaseEvent = event.toLowerCase();
  2085. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2086. warn(
  2087. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2088. instance,
  2089. instance.type
  2090. )} 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}".`
  2091. );
  2092. }
  2093. }
  2094. let handlerName;
  2095. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2096. props[handlerName = toHandlerKey(camelize(event))];
  2097. if (!handler && isModelListener) {
  2098. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2099. }
  2100. if (handler) {
  2101. callWithAsyncErrorHandling(
  2102. handler,
  2103. instance,
  2104. 6,
  2105. args
  2106. );
  2107. }
  2108. const onceHandler = props[handlerName + `Once`];
  2109. if (onceHandler) {
  2110. if (!instance.emitted) {
  2111. instance.emitted = {};
  2112. } else if (instance.emitted[handlerName]) {
  2113. return;
  2114. }
  2115. instance.emitted[handlerName] = true;
  2116. callWithAsyncErrorHandling(
  2117. onceHandler,
  2118. instance,
  2119. 6,
  2120. args
  2121. );
  2122. }
  2123. }
  2124. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2125. const cache = appContext.emitsCache;
  2126. const cached = cache.get(comp);
  2127. if (cached !== void 0) {
  2128. return cached;
  2129. }
  2130. const raw = comp.emits;
  2131. let normalized = {};
  2132. let hasExtends = false;
  2133. if (!isFunction(comp)) {
  2134. const extendEmits = (raw2) => {
  2135. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2136. if (normalizedFromExtend) {
  2137. hasExtends = true;
  2138. extend(normalized, normalizedFromExtend);
  2139. }
  2140. };
  2141. if (!asMixin && appContext.mixins.length) {
  2142. appContext.mixins.forEach(extendEmits);
  2143. }
  2144. if (comp.extends) {
  2145. extendEmits(comp.extends);
  2146. }
  2147. if (comp.mixins) {
  2148. comp.mixins.forEach(extendEmits);
  2149. }
  2150. }
  2151. if (!raw && !hasExtends) {
  2152. if (isObject(comp)) {
  2153. cache.set(comp, null);
  2154. }
  2155. return null;
  2156. }
  2157. if (isArray(raw)) {
  2158. raw.forEach((key) => normalized[key] = null);
  2159. } else {
  2160. extend(normalized, raw);
  2161. }
  2162. if (isObject(comp)) {
  2163. cache.set(comp, normalized);
  2164. }
  2165. return normalized;
  2166. }
  2167. function isEmitListener(options, key) {
  2168. if (!options || !isOn(key)) {
  2169. return false;
  2170. }
  2171. key = key.slice(2).replace(/Once$/, "");
  2172. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2173. }
  2174. let currentRenderingInstance = null;
  2175. let currentScopeId = null;
  2176. function setCurrentRenderingInstance(instance) {
  2177. const prev = currentRenderingInstance;
  2178. currentRenderingInstance = instance;
  2179. currentScopeId = instance && instance.type.__scopeId || null;
  2180. return prev;
  2181. }
  2182. function pushScopeId(id) {
  2183. currentScopeId = id;
  2184. }
  2185. function popScopeId() {
  2186. currentScopeId = null;
  2187. }
  2188. const withScopeId = (_id) => withCtx;
  2189. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2190. if (!ctx)
  2191. return fn;
  2192. if (fn._n) {
  2193. return fn;
  2194. }
  2195. const renderFnWithContext = (...args) => {
  2196. if (renderFnWithContext._d) {
  2197. setBlockTracking(-1);
  2198. }
  2199. const prevInstance = setCurrentRenderingInstance(ctx);
  2200. let res;
  2201. try {
  2202. res = fn(...args);
  2203. } finally {
  2204. setCurrentRenderingInstance(prevInstance);
  2205. if (renderFnWithContext._d) {
  2206. setBlockTracking(1);
  2207. }
  2208. }
  2209. {
  2210. devtoolsComponentUpdated(ctx);
  2211. }
  2212. return res;
  2213. };
  2214. renderFnWithContext._n = true;
  2215. renderFnWithContext._c = true;
  2216. renderFnWithContext._d = true;
  2217. return renderFnWithContext;
  2218. }
  2219. let accessedAttrs = false;
  2220. function markAttrsAccessed() {
  2221. accessedAttrs = true;
  2222. }
  2223. function renderComponentRoot(instance) {
  2224. const {
  2225. type: Component,
  2226. vnode,
  2227. proxy,
  2228. withProxy,
  2229. props,
  2230. propsOptions: [propsOptions],
  2231. slots,
  2232. attrs,
  2233. emit,
  2234. render,
  2235. renderCache,
  2236. data,
  2237. setupState,
  2238. ctx,
  2239. inheritAttrs
  2240. } = instance;
  2241. let result;
  2242. let fallthroughAttrs;
  2243. const prev = setCurrentRenderingInstance(instance);
  2244. {
  2245. accessedAttrs = false;
  2246. }
  2247. try {
  2248. if (vnode.shapeFlag & 4) {
  2249. const proxyToUse = withProxy || proxy;
  2250. result = normalizeVNode(
  2251. render.call(
  2252. proxyToUse,
  2253. proxyToUse,
  2254. renderCache,
  2255. props,
  2256. setupState,
  2257. data,
  2258. ctx
  2259. )
  2260. );
  2261. fallthroughAttrs = attrs;
  2262. } else {
  2263. const render2 = Component;
  2264. if (attrs === props) {
  2265. markAttrsAccessed();
  2266. }
  2267. result = normalizeVNode(
  2268. render2.length > 1 ? render2(
  2269. props,
  2270. true ? {
  2271. get attrs() {
  2272. markAttrsAccessed();
  2273. return attrs;
  2274. },
  2275. slots,
  2276. emit
  2277. } : {attrs, slots, emit}
  2278. ) : render2(
  2279. props,
  2280. null
  2281. /* we know it doesn't need it */
  2282. )
  2283. );
  2284. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2285. }
  2286. } catch (err) {
  2287. blockStack.length = 0;
  2288. handleError(err, instance, 1);
  2289. result = createVNode(Comment);
  2290. }
  2291. let root = result;
  2292. let setRoot = void 0;
  2293. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2294. [root, setRoot] = getChildRoot(result);
  2295. }
  2296. if (fallthroughAttrs && inheritAttrs !== false) {
  2297. const keys = Object.keys(fallthroughAttrs);
  2298. const {shapeFlag} = root;
  2299. if (keys.length) {
  2300. if (shapeFlag & (1 | 6)) {
  2301. if (propsOptions && keys.some(isModelListener)) {
  2302. fallthroughAttrs = filterModelListeners(
  2303. fallthroughAttrs,
  2304. propsOptions
  2305. );
  2306. }
  2307. root = cloneVNode(root, fallthroughAttrs);
  2308. } else if (!accessedAttrs && root.type !== Comment) {
  2309. const allAttrs = Object.keys(attrs);
  2310. const eventAttrs = [];
  2311. const extraAttrs = [];
  2312. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2313. const key = allAttrs[i];
  2314. if (isOn(key)) {
  2315. if (!isModelListener(key)) {
  2316. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2317. }
  2318. } else {
  2319. extraAttrs.push(key);
  2320. }
  2321. }
  2322. if (extraAttrs.length) {
  2323. warn(
  2324. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2325. );
  2326. }
  2327. if (eventAttrs.length) {
  2328. warn(
  2329. `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.`
  2330. );
  2331. }
  2332. }
  2333. }
  2334. }
  2335. if (vnode.dirs) {
  2336. if (!isElementRoot(root)) {
  2337. warn(
  2338. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2339. );
  2340. }
  2341. root = cloneVNode(root);
  2342. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2343. }
  2344. if (vnode.transition) {
  2345. if (!isElementRoot(root)) {
  2346. warn(
  2347. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2348. );
  2349. }
  2350. root.transition = vnode.transition;
  2351. }
  2352. if (setRoot) {
  2353. setRoot(root);
  2354. } else {
  2355. result = root;
  2356. }
  2357. setCurrentRenderingInstance(prev);
  2358. return result;
  2359. }
  2360. const getChildRoot = (vnode) => {
  2361. const rawChildren = vnode.children;
  2362. const dynamicChildren = vnode.dynamicChildren;
  2363. const childRoot = filterSingleRoot(rawChildren);
  2364. if (!childRoot) {
  2365. return [vnode, void 0];
  2366. }
  2367. const index = rawChildren.indexOf(childRoot);
  2368. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2369. const setRoot = (updatedRoot) => {
  2370. rawChildren[index] = updatedRoot;
  2371. if (dynamicChildren) {
  2372. if (dynamicIndex > -1) {
  2373. dynamicChildren[dynamicIndex] = updatedRoot;
  2374. } else if (updatedRoot.patchFlag > 0) {
  2375. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2376. }
  2377. }
  2378. };
  2379. return [normalizeVNode(childRoot), setRoot];
  2380. };
  2381. function filterSingleRoot(children) {
  2382. let singleRoot;
  2383. for (let i = 0; i < children.length; i++) {
  2384. const child = children[i];
  2385. if (isVNode(child)) {
  2386. if (child.type !== Comment || child.children === "v-if") {
  2387. if (singleRoot) {
  2388. return;
  2389. } else {
  2390. singleRoot = child;
  2391. }
  2392. }
  2393. } else {
  2394. return;
  2395. }
  2396. }
  2397. return singleRoot;
  2398. }
  2399. const getFunctionalFallthrough = (attrs) => {
  2400. let res;
  2401. for (const key in attrs) {
  2402. if (key === "class" || key === "style" || isOn(key)) {
  2403. (res || (res = {}))[key] = attrs[key];
  2404. }
  2405. }
  2406. return res;
  2407. };
  2408. const filterModelListeners = (attrs, props) => {
  2409. const res = {};
  2410. for (const key in attrs) {
  2411. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2412. res[key] = attrs[key];
  2413. }
  2414. }
  2415. return res;
  2416. };
  2417. const isElementRoot = (vnode) => {
  2418. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2419. };
  2420. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2421. const {props: prevProps, children: prevChildren, component} = prevVNode;
  2422. const {props: nextProps, children: nextChildren, patchFlag} = nextVNode;
  2423. const emits = component.emitsOptions;
  2424. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2425. return true;
  2426. }
  2427. if (nextVNode.dirs || nextVNode.transition) {
  2428. return true;
  2429. }
  2430. if (optimized && patchFlag >= 0) {
  2431. if (patchFlag & 1024) {
  2432. return true;
  2433. }
  2434. if (patchFlag & 16) {
  2435. if (!prevProps) {
  2436. return !!nextProps;
  2437. }
  2438. return hasPropsChanged(prevProps, nextProps, emits);
  2439. } else if (patchFlag & 8) {
  2440. const dynamicProps = nextVNode.dynamicProps;
  2441. for (let i = 0; i < dynamicProps.length; i++) {
  2442. const key = dynamicProps[i];
  2443. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2444. return true;
  2445. }
  2446. }
  2447. }
  2448. } else {
  2449. if (prevChildren || nextChildren) {
  2450. if (!nextChildren || !nextChildren.$stable) {
  2451. return true;
  2452. }
  2453. }
  2454. if (prevProps === nextProps) {
  2455. return false;
  2456. }
  2457. if (!prevProps) {
  2458. return !!nextProps;
  2459. }
  2460. if (!nextProps) {
  2461. return true;
  2462. }
  2463. return hasPropsChanged(prevProps, nextProps, emits);
  2464. }
  2465. return false;
  2466. }
  2467. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2468. const nextKeys = Object.keys(nextProps);
  2469. if (nextKeys.length !== Object.keys(prevProps).length) {
  2470. return true;
  2471. }
  2472. for (let i = 0; i < nextKeys.length; i++) {
  2473. const key = nextKeys[i];
  2474. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2475. return true;
  2476. }
  2477. }
  2478. return false;
  2479. }
  2480. function updateHOCHostEl({vnode, parent}, el) {
  2481. while (parent && parent.subTree === vnode) {
  2482. (vnode = parent.vnode).el = el;
  2483. parent = parent.parent;
  2484. }
  2485. }
  2486. const COMPONENTS = "components";
  2487. const DIRECTIVES = "directives";
  2488. function resolveComponent(name, maybeSelfReference) {
  2489. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2490. }
  2491. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2492. function resolveDynamicComponent(component) {
  2493. if (isString(component)) {
  2494. return resolveAsset(COMPONENTS, component, false) || component;
  2495. } else {
  2496. return component || NULL_DYNAMIC_COMPONENT;
  2497. }
  2498. }
  2499. function resolveDirective(name) {
  2500. return resolveAsset(DIRECTIVES, name);
  2501. }
  2502. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2503. const instance = currentRenderingInstance || currentInstance;
  2504. if (instance) {
  2505. const Component = instance.type;
  2506. if (type === COMPONENTS) {
  2507. const selfName = getComponentName(
  2508. Component,
  2509. false
  2510. /* do not include inferred name to avoid breaking existing code */
  2511. );
  2512. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  2513. return Component;
  2514. }
  2515. }
  2516. const res = (
  2517. // local registration
  2518. // check instance[type] first which is resolved for options API
  2519. resolve(instance[type] || Component[type], name) || // global registration
  2520. resolve(instance.appContext[type], name)
  2521. );
  2522. if (!res && maybeSelfReference) {
  2523. return Component;
  2524. }
  2525. if (warnMissing && !res) {
  2526. const extra = type === COMPONENTS ? `
  2527. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2528. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2529. }
  2530. return res;
  2531. } else {
  2532. warn(
  2533. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2534. );
  2535. }
  2536. }
  2537. function resolve(registry, name) {
  2538. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  2539. }
  2540. const isSuspense = (type) => type.__isSuspense;
  2541. const SuspenseImpl = {
  2542. name: "Suspense",
  2543. // In order to make Suspense tree-shakable, we need to avoid importing it
  2544. // directly in the renderer. The renderer checks for the __isSuspense flag
  2545. // on a vnode's type and calls the `process` method, passing in renderer
  2546. // internals.
  2547. __isSuspense: true,
  2548. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2549. if (n1 == null) {
  2550. mountSuspense(
  2551. n2,
  2552. container,
  2553. anchor,
  2554. parentComponent,
  2555. parentSuspense,
  2556. isSVG,
  2557. slotScopeIds,
  2558. optimized,
  2559. rendererInternals
  2560. );
  2561. } else {
  2562. patchSuspense(
  2563. n1,
  2564. n2,
  2565. container,
  2566. anchor,
  2567. parentComponent,
  2568. isSVG,
  2569. slotScopeIds,
  2570. optimized,
  2571. rendererInternals
  2572. );
  2573. }
  2574. },
  2575. hydrate: hydrateSuspense,
  2576. create: createSuspenseBoundary,
  2577. normalize: normalizeSuspenseChildren
  2578. };
  2579. const Suspense = SuspenseImpl;
  2580. function triggerEvent(vnode, name) {
  2581. const eventListener = vnode.props && vnode.props[name];
  2582. if (isFunction(eventListener)) {
  2583. eventListener();
  2584. }
  2585. }
  2586. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2587. const {
  2588. p: patch,
  2589. o: {createElement}
  2590. } = rendererInternals;
  2591. const hiddenContainer = createElement("div");
  2592. const suspense = vnode.suspense = createSuspenseBoundary(
  2593. vnode,
  2594. parentSuspense,
  2595. parentComponent,
  2596. container,
  2597. hiddenContainer,
  2598. anchor,
  2599. isSVG,
  2600. slotScopeIds,
  2601. optimized,
  2602. rendererInternals
  2603. );
  2604. patch(
  2605. null,
  2606. suspense.pendingBranch = vnode.ssContent,
  2607. hiddenContainer,
  2608. null,
  2609. parentComponent,
  2610. suspense,
  2611. isSVG,
  2612. slotScopeIds
  2613. );
  2614. if (suspense.deps > 0) {
  2615. triggerEvent(vnode, "onPending");
  2616. triggerEvent(vnode, "onFallback");
  2617. patch(
  2618. null,
  2619. vnode.ssFallback,
  2620. container,
  2621. anchor,
  2622. parentComponent,
  2623. null,
  2624. // fallback tree will not have suspense context
  2625. isSVG,
  2626. slotScopeIds
  2627. );
  2628. setActiveBranch(suspense, vnode.ssFallback);
  2629. } else {
  2630. suspense.resolve(false, true);
  2631. }
  2632. }
  2633. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, {
  2634. p: patch,
  2635. um: unmount,
  2636. o: {createElement}
  2637. }) {
  2638. const suspense = n2.suspense = n1.suspense;
  2639. suspense.vnode = n2;
  2640. n2.el = n1.el;
  2641. const newBranch = n2.ssContent;
  2642. const newFallback = n2.ssFallback;
  2643. const {activeBranch, pendingBranch, isInFallback, isHydrating} = suspense;
  2644. if (pendingBranch) {
  2645. suspense.pendingBranch = newBranch;
  2646. if (isSameVNodeType(newBranch, pendingBranch)) {
  2647. patch(
  2648. pendingBranch,
  2649. newBranch,
  2650. suspense.hiddenContainer,
  2651. null,
  2652. parentComponent,
  2653. suspense,
  2654. isSVG,
  2655. slotScopeIds,
  2656. optimized
  2657. );
  2658. if (suspense.deps <= 0) {
  2659. suspense.resolve();
  2660. } else if (isInFallback) {
  2661. patch(
  2662. activeBranch,
  2663. newFallback,
  2664. container,
  2665. anchor,
  2666. parentComponent,
  2667. null,
  2668. // fallback tree will not have suspense context
  2669. isSVG,
  2670. slotScopeIds,
  2671. optimized
  2672. );
  2673. setActiveBranch(suspense, newFallback);
  2674. }
  2675. } else {
  2676. suspense.pendingId++;
  2677. if (isHydrating) {
  2678. suspense.isHydrating = false;
  2679. suspense.activeBranch = pendingBranch;
  2680. } else {
  2681. unmount(pendingBranch, parentComponent, suspense);
  2682. }
  2683. suspense.deps = 0;
  2684. suspense.effects.length = 0;
  2685. suspense.hiddenContainer = createElement("div");
  2686. if (isInFallback) {
  2687. patch(
  2688. null,
  2689. newBranch,
  2690. suspense.hiddenContainer,
  2691. null,
  2692. parentComponent,
  2693. suspense,
  2694. isSVG,
  2695. slotScopeIds,
  2696. optimized
  2697. );
  2698. if (suspense.deps <= 0) {
  2699. suspense.resolve();
  2700. } else {
  2701. patch(
  2702. activeBranch,
  2703. newFallback,
  2704. container,
  2705. anchor,
  2706. parentComponent,
  2707. null,
  2708. // fallback tree will not have suspense context
  2709. isSVG,
  2710. slotScopeIds,
  2711. optimized
  2712. );
  2713. setActiveBranch(suspense, newFallback);
  2714. }
  2715. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2716. patch(
  2717. activeBranch,
  2718. newBranch,
  2719. container,
  2720. anchor,
  2721. parentComponent,
  2722. suspense,
  2723. isSVG,
  2724. slotScopeIds,
  2725. optimized
  2726. );
  2727. suspense.resolve(true);
  2728. } else {
  2729. patch(
  2730. null,
  2731. newBranch,
  2732. suspense.hiddenContainer,
  2733. null,
  2734. parentComponent,
  2735. suspense,
  2736. isSVG,
  2737. slotScopeIds,
  2738. optimized
  2739. );
  2740. if (suspense.deps <= 0) {
  2741. suspense.resolve();
  2742. }
  2743. }
  2744. }
  2745. } else {
  2746. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2747. patch(
  2748. activeBranch,
  2749. newBranch,
  2750. container,
  2751. anchor,
  2752. parentComponent,
  2753. suspense,
  2754. isSVG,
  2755. slotScopeIds,
  2756. optimized
  2757. );
  2758. setActiveBranch(suspense, newBranch);
  2759. } else {
  2760. triggerEvent(n2, "onPending");
  2761. suspense.pendingBranch = newBranch;
  2762. suspense.pendingId++;
  2763. patch(
  2764. null,
  2765. newBranch,
  2766. suspense.hiddenContainer,
  2767. null,
  2768. parentComponent,
  2769. suspense,
  2770. isSVG,
  2771. slotScopeIds,
  2772. optimized
  2773. );
  2774. if (suspense.deps <= 0) {
  2775. suspense.resolve();
  2776. } else {
  2777. const {timeout, pendingId} = suspense;
  2778. if (timeout > 0) {
  2779. setTimeout(() => {
  2780. if (suspense.pendingId === pendingId) {
  2781. suspense.fallback(newFallback);
  2782. }
  2783. }, timeout);
  2784. } else if (timeout === 0) {
  2785. suspense.fallback(newFallback);
  2786. }
  2787. }
  2788. }
  2789. }
  2790. }
  2791. let hasWarned = false;
  2792. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2793. if (!hasWarned) {
  2794. hasWarned = true;
  2795. console[console.info ? "info" : "log"](
  2796. `<Suspense> is an experimental feature and its API will likely change.`
  2797. );
  2798. }
  2799. const {
  2800. p: patch,
  2801. m: move,
  2802. um: unmount,
  2803. n: next,
  2804. o: {parentNode, remove}
  2805. } = rendererInternals;
  2806. let parentSuspenseId;
  2807. const isSuspensible = isVNodeSuspensible(vnode);
  2808. if (isSuspensible) {
  2809. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  2810. parentSuspenseId = parentSuspense.pendingId;
  2811. parentSuspense.deps++;
  2812. }
  2813. }
  2814. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  2815. {
  2816. assertNumber(timeout, `Suspense timeout`);
  2817. }
  2818. const suspense = {
  2819. vnode,
  2820. parent: parentSuspense,
  2821. parentComponent,
  2822. isSVG,
  2823. container,
  2824. hiddenContainer,
  2825. anchor,
  2826. deps: 0,
  2827. pendingId: 0,
  2828. timeout: typeof timeout === "number" ? timeout : -1,
  2829. activeBranch: null,
  2830. pendingBranch: null,
  2831. isInFallback: true,
  2832. isHydrating,
  2833. isUnmounted: false,
  2834. effects: [],
  2835. resolve(resume = false, sync = false) {
  2836. {
  2837. if (!resume && !suspense.pendingBranch) {
  2838. throw new Error(
  2839. `suspense.resolve() is called without a pending branch.`
  2840. );
  2841. }
  2842. if (suspense.isUnmounted) {
  2843. throw new Error(
  2844. `suspense.resolve() is called on an already unmounted suspense boundary.`
  2845. );
  2846. }
  2847. }
  2848. const {
  2849. vnode: vnode2,
  2850. activeBranch,
  2851. pendingBranch,
  2852. pendingId,
  2853. effects,
  2854. parentComponent: parentComponent2,
  2855. container: container2
  2856. } = suspense;
  2857. let delayEnter = false;
  2858. if (suspense.isHydrating) {
  2859. suspense.isHydrating = false;
  2860. } else if (!resume) {
  2861. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  2862. if (delayEnter) {
  2863. activeBranch.transition.afterLeave = () => {
  2864. if (pendingId === suspense.pendingId) {
  2865. move(pendingBranch, container2, anchor2, 0);
  2866. queuePostFlushCb(effects);
  2867. }
  2868. };
  2869. }
  2870. let {anchor: anchor2} = suspense;
  2871. if (activeBranch) {
  2872. anchor2 = next(activeBranch);
  2873. unmount(activeBranch, parentComponent2, suspense, true);
  2874. }
  2875. if (!delayEnter) {
  2876. move(pendingBranch, container2, anchor2, 0);
  2877. }
  2878. }
  2879. setActiveBranch(suspense, pendingBranch);
  2880. suspense.pendingBranch = null;
  2881. suspense.isInFallback = false;
  2882. let parent = suspense.parent;
  2883. let hasUnresolvedAncestor = false;
  2884. while (parent) {
  2885. if (parent.pendingBranch) {
  2886. parent.effects.push(...effects);
  2887. hasUnresolvedAncestor = true;
  2888. break;
  2889. }
  2890. parent = parent.parent;
  2891. }
  2892. if (!hasUnresolvedAncestor && !delayEnter) {
  2893. queuePostFlushCb(effects);
  2894. }
  2895. suspense.effects = [];
  2896. if (isSuspensible) {
  2897. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  2898. parentSuspense.deps--;
  2899. if (parentSuspense.deps === 0 && !sync) {
  2900. parentSuspense.resolve();
  2901. }
  2902. }
  2903. }
  2904. triggerEvent(vnode2, "onResolve");
  2905. },
  2906. fallback(fallbackVNode) {
  2907. if (!suspense.pendingBranch) {
  2908. return;
  2909. }
  2910. const {
  2911. vnode: vnode2,
  2912. activeBranch,
  2913. parentComponent: parentComponent2,
  2914. container: container2,
  2915. isSVG: isSVG2
  2916. } = suspense;
  2917. triggerEvent(vnode2, "onFallback");
  2918. const anchor2 = next(activeBranch);
  2919. const mountFallback = () => {
  2920. if (!suspense.isInFallback) {
  2921. return;
  2922. }
  2923. patch(
  2924. null,
  2925. fallbackVNode,
  2926. container2,
  2927. anchor2,
  2928. parentComponent2,
  2929. null,
  2930. // fallback tree will not have suspense context
  2931. isSVG2,
  2932. slotScopeIds,
  2933. optimized
  2934. );
  2935. setActiveBranch(suspense, fallbackVNode);
  2936. };
  2937. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  2938. if (delayEnter) {
  2939. activeBranch.transition.afterLeave = mountFallback;
  2940. }
  2941. suspense.isInFallback = true;
  2942. unmount(
  2943. activeBranch,
  2944. parentComponent2,
  2945. null,
  2946. // no suspense so unmount hooks fire now
  2947. true
  2948. // shouldRemove
  2949. );
  2950. if (!delayEnter) {
  2951. mountFallback();
  2952. }
  2953. },
  2954. move(container2, anchor2, type) {
  2955. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  2956. suspense.container = container2;
  2957. },
  2958. next() {
  2959. return suspense.activeBranch && next(suspense.activeBranch);
  2960. },
  2961. registerDep(instance, setupRenderEffect) {
  2962. const isInPendingSuspense = !!suspense.pendingBranch;
  2963. if (isInPendingSuspense) {
  2964. suspense.deps++;
  2965. }
  2966. const hydratedEl = instance.vnode.el;
  2967. instance.asyncDep.catch((err) => {
  2968. handleError(err, instance, 0);
  2969. }).then((asyncSetupResult) => {
  2970. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2971. return;
  2972. }
  2973. instance.asyncResolved = true;
  2974. const {vnode: vnode2} = instance;
  2975. {
  2976. pushWarningContext(vnode2);
  2977. }
  2978. handleSetupResult(instance, asyncSetupResult, false);
  2979. if (hydratedEl) {
  2980. vnode2.el = hydratedEl;
  2981. }
  2982. const placeholder = !hydratedEl && instance.subTree.el;
  2983. setupRenderEffect(
  2984. instance,
  2985. vnode2,
  2986. // component may have been moved before resolve.
  2987. // if this is not a hydration, instance.subTree will be the comment
  2988. // placeholder.
  2989. parentNode(hydratedEl || instance.subTree.el),
  2990. // anchor will not be used if this is hydration, so only need to
  2991. // consider the comment placeholder case.
  2992. hydratedEl ? null : next(instance.subTree),
  2993. suspense,
  2994. isSVG,
  2995. optimized
  2996. );
  2997. if (placeholder) {
  2998. remove(placeholder);
  2999. }
  3000. updateHOCHostEl(instance, vnode2.el);
  3001. {
  3002. popWarningContext();
  3003. }
  3004. if (isInPendingSuspense && --suspense.deps === 0) {
  3005. suspense.resolve();
  3006. }
  3007. });
  3008. },
  3009. unmount(parentSuspense2, doRemove) {
  3010. suspense.isUnmounted = true;
  3011. if (suspense.activeBranch) {
  3012. unmount(
  3013. suspense.activeBranch,
  3014. parentComponent,
  3015. parentSuspense2,
  3016. doRemove
  3017. );
  3018. }
  3019. if (suspense.pendingBranch) {
  3020. unmount(
  3021. suspense.pendingBranch,
  3022. parentComponent,
  3023. parentSuspense2,
  3024. doRemove
  3025. );
  3026. }
  3027. }
  3028. };
  3029. return suspense;
  3030. }
  3031. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  3032. const suspense = vnode.suspense = createSuspenseBoundary(
  3033. vnode,
  3034. parentSuspense,
  3035. parentComponent,
  3036. node.parentNode,
  3037. document.createElement("div"),
  3038. null,
  3039. isSVG,
  3040. slotScopeIds,
  3041. optimized,
  3042. rendererInternals,
  3043. true
  3044. /* hydrating */
  3045. );
  3046. const result = hydrateNode(
  3047. node,
  3048. suspense.pendingBranch = vnode.ssContent,
  3049. parentComponent,
  3050. suspense,
  3051. slotScopeIds,
  3052. optimized
  3053. );
  3054. if (suspense.deps === 0) {
  3055. suspense.resolve(false, true);
  3056. }
  3057. return result;
  3058. }
  3059. function normalizeSuspenseChildren(vnode) {
  3060. const {shapeFlag, children} = vnode;
  3061. const isSlotChildren = shapeFlag & 32;
  3062. vnode.ssContent = normalizeSuspenseSlot(
  3063. isSlotChildren ? children.default : children
  3064. );
  3065. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  3066. }
  3067. function normalizeSuspenseSlot(s) {
  3068. let block;
  3069. if (isFunction(s)) {
  3070. const trackBlock = isBlockTreeEnabled && s._c;
  3071. if (trackBlock) {
  3072. s._d = false;
  3073. openBlock();
  3074. }
  3075. s = s();
  3076. if (trackBlock) {
  3077. s._d = true;
  3078. block = currentBlock;
  3079. closeBlock();
  3080. }
  3081. }
  3082. if (isArray(s)) {
  3083. const singleChild = filterSingleRoot(s);
  3084. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  3085. warn(`<Suspense> slots expect a single root node.`);
  3086. }
  3087. s = singleChild;
  3088. }
  3089. s = normalizeVNode(s);
  3090. if (block && !s.dynamicChildren) {
  3091. s.dynamicChildren = block.filter((c) => c !== s);
  3092. }
  3093. return s;
  3094. }
  3095. function queueEffectWithSuspense(fn, suspense) {
  3096. if (suspense && suspense.pendingBranch) {
  3097. if (isArray(fn)) {
  3098. suspense.effects.push(...fn);
  3099. } else {
  3100. suspense.effects.push(fn);
  3101. }
  3102. } else {
  3103. queuePostFlushCb(fn);
  3104. }
  3105. }
  3106. function setActiveBranch(suspense, branch) {
  3107. suspense.activeBranch = branch;
  3108. const {vnode, parentComponent} = suspense;
  3109. const el = vnode.el = branch.el;
  3110. if (parentComponent && parentComponent.subTree === vnode) {
  3111. parentComponent.vnode.el = el;
  3112. updateHOCHostEl(parentComponent, el);
  3113. }
  3114. }
  3115. function isVNodeSuspensible(vnode) {
  3116. var _a;
  3117. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  3118. }
  3119. function watchEffect(effect, options) {
  3120. return doWatch(effect, null, options);
  3121. }
  3122. function watchPostEffect(effect, options) {
  3123. return doWatch(
  3124. effect,
  3125. null,
  3126. extend({}, options, {flush: "post"})
  3127. );
  3128. }
  3129. function watchSyncEffect(effect, options) {
  3130. return doWatch(
  3131. effect,
  3132. null,
  3133. extend({}, options, {flush: "sync"})
  3134. );
  3135. }
  3136. const INITIAL_WATCHER_VALUE = {};
  3137. function watch(source, cb, options) {
  3138. if (!isFunction(cb)) {
  3139. warn(
  3140. `\`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.`
  3141. );
  3142. }
  3143. return doWatch(source, cb, options);
  3144. }
  3145. function doWatch(source, cb, {immediate, deep, flush, onTrack, onTrigger} = EMPTY_OBJ) {
  3146. var _a;
  3147. if (!cb) {
  3148. if (immediate !== void 0) {
  3149. warn(
  3150. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3151. );
  3152. }
  3153. if (deep !== void 0) {
  3154. warn(
  3155. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3156. );
  3157. }
  3158. }
  3159. const warnInvalidSource = (s) => {
  3160. warn(
  3161. `Invalid watch source: `,
  3162. s,
  3163. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3164. );
  3165. };
  3166. const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  3167. let getter;
  3168. let forceTrigger = false;
  3169. let isMultiSource = false;
  3170. if (isRef(source)) {
  3171. getter = () => source.value;
  3172. forceTrigger = isShallow(source);
  3173. } else if (isReactive(source)) {
  3174. getter = () => source;
  3175. deep = true;
  3176. } else if (isArray(source)) {
  3177. isMultiSource = true;
  3178. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3179. getter = () => source.map((s) => {
  3180. if (isRef(s)) {
  3181. return s.value;
  3182. } else if (isReactive(s)) {
  3183. return traverse(s);
  3184. } else if (isFunction(s)) {
  3185. return callWithErrorHandling(s, instance, 2);
  3186. } else {
  3187. warnInvalidSource(s);
  3188. }
  3189. });
  3190. } else if (isFunction(source)) {
  3191. if (cb) {
  3192. getter = () => callWithErrorHandling(source, instance, 2);
  3193. } else {
  3194. getter = () => {
  3195. if (instance && instance.isUnmounted) {
  3196. return;
  3197. }
  3198. if (cleanup) {
  3199. cleanup();
  3200. }
  3201. return callWithAsyncErrorHandling(
  3202. source,
  3203. instance,
  3204. 3,
  3205. [onCleanup]
  3206. );
  3207. };
  3208. }
  3209. } else {
  3210. getter = NOOP;
  3211. warnInvalidSource(source);
  3212. }
  3213. if (cb && deep) {
  3214. const baseGetter = getter;
  3215. getter = () => traverse(baseGetter());
  3216. }
  3217. let cleanup;
  3218. let onCleanup = (fn) => {
  3219. cleanup = effect.onStop = () => {
  3220. callWithErrorHandling(fn, instance, 4);
  3221. };
  3222. };
  3223. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3224. const job = () => {
  3225. if (!effect.active) {
  3226. return;
  3227. }
  3228. if (cb) {
  3229. const newValue = effect.run();
  3230. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  3231. if (cleanup) {
  3232. cleanup();
  3233. }
  3234. callWithAsyncErrorHandling(cb, instance, 3, [
  3235. newValue,
  3236. // pass undefined as the old value when it's changed for the first time
  3237. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3238. onCleanup
  3239. ]);
  3240. oldValue = newValue;
  3241. }
  3242. } else {
  3243. effect.run();
  3244. }
  3245. };
  3246. job.allowRecurse = !!cb;
  3247. let scheduler;
  3248. if (flush === "sync") {
  3249. scheduler = job;
  3250. } else if (flush === "post") {
  3251. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3252. } else {
  3253. job.pre = true;
  3254. if (instance)
  3255. job.id = instance.uid;
  3256. scheduler = () => queueJob(job);
  3257. }
  3258. const effect = new ReactiveEffect(getter, scheduler);
  3259. {
  3260. effect.onTrack = onTrack;
  3261. effect.onTrigger = onTrigger;
  3262. }
  3263. if (cb) {
  3264. if (immediate) {
  3265. job();
  3266. } else {
  3267. oldValue = effect.run();
  3268. }
  3269. } else if (flush === "post") {
  3270. queuePostRenderEffect(
  3271. effect.run.bind(effect),
  3272. instance && instance.suspense
  3273. );
  3274. } else {
  3275. effect.run();
  3276. }
  3277. const unwatch = () => {
  3278. effect.stop();
  3279. if (instance && instance.scope) {
  3280. remove(instance.scope.effects, effect);
  3281. }
  3282. };
  3283. return unwatch;
  3284. }
  3285. function instanceWatch(source, value, options) {
  3286. const publicThis = this.proxy;
  3287. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3288. let cb;
  3289. if (isFunction(value)) {
  3290. cb = value;
  3291. } else {
  3292. cb = value.handler;
  3293. options = value;
  3294. }
  3295. const cur = currentInstance;
  3296. setCurrentInstance(this);
  3297. const res = doWatch(getter, cb.bind(publicThis), options);
  3298. if (cur) {
  3299. setCurrentInstance(cur);
  3300. } else {
  3301. unsetCurrentInstance();
  3302. }
  3303. return res;
  3304. }
  3305. function createPathGetter(ctx, path) {
  3306. const segments = path.split(".");
  3307. return () => {
  3308. let cur = ctx;
  3309. for (let i = 0; i < segments.length && cur; i++) {
  3310. cur = cur[segments[i]];
  3311. }
  3312. return cur;
  3313. };
  3314. }
  3315. function traverse(value, seen) {
  3316. if (!isObject(value) || value["__v_skip"]) {
  3317. return value;
  3318. }
  3319. seen = seen || /* @__PURE__ */ new Set();
  3320. if (seen.has(value)) {
  3321. return value;
  3322. }
  3323. seen.add(value);
  3324. if (isRef(value)) {
  3325. traverse(value.value, seen);
  3326. } else if (isArray(value)) {
  3327. for (let i = 0; i < value.length; i++) {
  3328. traverse(value[i], seen);
  3329. }
  3330. } else if (isSet(value) || isMap(value)) {
  3331. value.forEach((v) => {
  3332. traverse(v, seen);
  3333. });
  3334. } else if (isPlainObject(value)) {
  3335. for (const key in value) {
  3336. traverse(value[key], seen);
  3337. }
  3338. }
  3339. return value;
  3340. }
  3341. function validateDirectiveName(name) {
  3342. if (isBuiltInDirective(name)) {
  3343. warn("Do not use built-in directive ids as custom directive id: " + name);
  3344. }
  3345. }
  3346. function withDirectives(vnode, directives) {
  3347. const internalInstance = currentRenderingInstance;
  3348. if (internalInstance === null) {
  3349. warn(`withDirectives can only be used inside render functions.`);
  3350. return vnode;
  3351. }
  3352. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  3353. const bindings = vnode.dirs || (vnode.dirs = []);
  3354. for (let i = 0; i < directives.length; i++) {
  3355. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3356. if (dir) {
  3357. if (isFunction(dir)) {
  3358. dir = {
  3359. mounted: dir,
  3360. updated: dir
  3361. };
  3362. }
  3363. if (dir.deep) {
  3364. traverse(value);
  3365. }
  3366. bindings.push({
  3367. dir,
  3368. instance,
  3369. value,
  3370. oldValue: void 0,
  3371. arg,
  3372. modifiers
  3373. });
  3374. }
  3375. }
  3376. return vnode;
  3377. }
  3378. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3379. const bindings = vnode.dirs;
  3380. const oldBindings = prevVNode && prevVNode.dirs;
  3381. for (let i = 0; i < bindings.length; i++) {
  3382. const binding = bindings[i];
  3383. if (oldBindings) {
  3384. binding.oldValue = oldBindings[i].value;
  3385. }
  3386. let hook = binding.dir[name];
  3387. if (hook) {
  3388. pauseTracking();
  3389. callWithAsyncErrorHandling(hook, instance, 8, [
  3390. vnode.el,
  3391. binding,
  3392. vnode,
  3393. prevVNode
  3394. ]);
  3395. resetTracking();
  3396. }
  3397. }
  3398. }
  3399. const leaveCbKey = Symbol("_leaveCb");
  3400. const enterCbKey$1 = Symbol("_enterCb");
  3401. function useTransitionState() {
  3402. const state = {
  3403. isMounted: false,
  3404. isLeaving: false,
  3405. isUnmounting: false,
  3406. leavingVNodes: /* @__PURE__ */ new Map()
  3407. };
  3408. onMounted(() => {
  3409. state.isMounted = true;
  3410. });
  3411. onBeforeUnmount(() => {
  3412. state.isUnmounting = true;
  3413. });
  3414. return state;
  3415. }
  3416. const TransitionHookValidator = [Function, Array];
  3417. const BaseTransitionPropsValidators = {
  3418. mode: String,
  3419. appear: Boolean,
  3420. persisted: Boolean,
  3421. // enter
  3422. onBeforeEnter: TransitionHookValidator,
  3423. onEnter: TransitionHookValidator,
  3424. onAfterEnter: TransitionHookValidator,
  3425. onEnterCancelled: TransitionHookValidator,
  3426. // leave
  3427. onBeforeLeave: TransitionHookValidator,
  3428. onLeave: TransitionHookValidator,
  3429. onAfterLeave: TransitionHookValidator,
  3430. onLeaveCancelled: TransitionHookValidator,
  3431. // appear
  3432. onBeforeAppear: TransitionHookValidator,
  3433. onAppear: TransitionHookValidator,
  3434. onAfterAppear: TransitionHookValidator,
  3435. onAppearCancelled: TransitionHookValidator
  3436. };
  3437. const BaseTransitionImpl = {
  3438. name: `BaseTransition`,
  3439. props: BaseTransitionPropsValidators,
  3440. setup(props, {slots}) {
  3441. const instance = getCurrentInstance();
  3442. const state = useTransitionState();
  3443. let prevTransitionKey;
  3444. return () => {
  3445. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3446. if (!children || !children.length) {
  3447. return;
  3448. }
  3449. let child = children[0];
  3450. if (children.length > 1) {
  3451. let hasFound = false;
  3452. for (const c of children) {
  3453. if (c.type !== Comment) {
  3454. if (hasFound) {
  3455. warn(
  3456. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3457. );
  3458. break;
  3459. }
  3460. child = c;
  3461. hasFound = true;
  3462. }
  3463. }
  3464. }
  3465. const rawProps = toRaw(props);
  3466. const {mode} = rawProps;
  3467. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3468. warn(`invalid <transition> mode: ${mode}`);
  3469. }
  3470. if (state.isLeaving) {
  3471. return emptyPlaceholder(child);
  3472. }
  3473. const innerChild = getKeepAliveChild(child);
  3474. if (!innerChild) {
  3475. return emptyPlaceholder(child);
  3476. }
  3477. const enterHooks = resolveTransitionHooks(
  3478. innerChild,
  3479. rawProps,
  3480. state,
  3481. instance
  3482. );
  3483. setTransitionHooks(innerChild, enterHooks);
  3484. const oldChild = instance.subTree;
  3485. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3486. let transitionKeyChanged = false;
  3487. const {getTransitionKey} = innerChild.type;
  3488. if (getTransitionKey) {
  3489. const key = getTransitionKey();
  3490. if (prevTransitionKey === void 0) {
  3491. prevTransitionKey = key;
  3492. } else if (key !== prevTransitionKey) {
  3493. prevTransitionKey = key;
  3494. transitionKeyChanged = true;
  3495. }
  3496. }
  3497. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  3498. const leavingHooks = resolveTransitionHooks(
  3499. oldInnerChild,
  3500. rawProps,
  3501. state,
  3502. instance
  3503. );
  3504. setTransitionHooks(oldInnerChild, leavingHooks);
  3505. if (mode === "out-in") {
  3506. state.isLeaving = true;
  3507. leavingHooks.afterLeave = () => {
  3508. state.isLeaving = false;
  3509. if (instance.update.active !== false) {
  3510. instance.update();
  3511. }
  3512. };
  3513. return emptyPlaceholder(child);
  3514. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3515. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3516. const leavingVNodesCache = getLeavingNodesForType(
  3517. state,
  3518. oldInnerChild
  3519. );
  3520. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3521. el[leaveCbKey] = () => {
  3522. earlyRemove();
  3523. el[leaveCbKey] = void 0;
  3524. delete enterHooks.delayedLeave;
  3525. };
  3526. enterHooks.delayedLeave = delayedLeave;
  3527. };
  3528. }
  3529. }
  3530. return child;
  3531. };
  3532. }
  3533. };
  3534. const BaseTransition = BaseTransitionImpl;
  3535. function getLeavingNodesForType(state, vnode) {
  3536. const {leavingVNodes} = state;
  3537. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3538. if (!leavingVNodesCache) {
  3539. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3540. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3541. }
  3542. return leavingVNodesCache;
  3543. }
  3544. function resolveTransitionHooks(vnode, props, state, instance) {
  3545. const {
  3546. appear,
  3547. mode,
  3548. persisted = false,
  3549. onBeforeEnter,
  3550. onEnter,
  3551. onAfterEnter,
  3552. onEnterCancelled,
  3553. onBeforeLeave,
  3554. onLeave,
  3555. onAfterLeave,
  3556. onLeaveCancelled,
  3557. onBeforeAppear,
  3558. onAppear,
  3559. onAfterAppear,
  3560. onAppearCancelled
  3561. } = props;
  3562. const key = String(vnode.key);
  3563. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3564. const callHook = (hook, args) => {
  3565. hook && callWithAsyncErrorHandling(
  3566. hook,
  3567. instance,
  3568. 9,
  3569. args
  3570. );
  3571. };
  3572. const callAsyncHook = (hook, args) => {
  3573. const done = args[1];
  3574. callHook(hook, args);
  3575. if (isArray(hook)) {
  3576. if (hook.every((hook2) => hook2.length <= 1))
  3577. done();
  3578. } else if (hook.length <= 1) {
  3579. done();
  3580. }
  3581. };
  3582. const hooks = {
  3583. mode,
  3584. persisted,
  3585. beforeEnter(el) {
  3586. let hook = onBeforeEnter;
  3587. if (!state.isMounted) {
  3588. if (appear) {
  3589. hook = onBeforeAppear || onBeforeEnter;
  3590. } else {
  3591. return;
  3592. }
  3593. }
  3594. if (el[leaveCbKey]) {
  3595. el[leaveCbKey](
  3596. true
  3597. /* cancelled */
  3598. );
  3599. }
  3600. const leavingVNode = leavingVNodesCache[key];
  3601. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3602. leavingVNode.el[leaveCbKey]();
  3603. }
  3604. callHook(hook, [el]);
  3605. },
  3606. enter(el) {
  3607. let hook = onEnter;
  3608. let afterHook = onAfterEnter;
  3609. let cancelHook = onEnterCancelled;
  3610. if (!state.isMounted) {
  3611. if (appear) {
  3612. hook = onAppear || onEnter;
  3613. afterHook = onAfterAppear || onAfterEnter;
  3614. cancelHook = onAppearCancelled || onEnterCancelled;
  3615. } else {
  3616. return;
  3617. }
  3618. }
  3619. let called = false;
  3620. const done = el[enterCbKey$1] = (cancelled) => {
  3621. if (called)
  3622. return;
  3623. called = true;
  3624. if (cancelled) {
  3625. callHook(cancelHook, [el]);
  3626. } else {
  3627. callHook(afterHook, [el]);
  3628. }
  3629. if (hooks.delayedLeave) {
  3630. hooks.delayedLeave();
  3631. }
  3632. el[enterCbKey$1] = void 0;
  3633. };
  3634. if (hook) {
  3635. callAsyncHook(hook, [el, done]);
  3636. } else {
  3637. done();
  3638. }
  3639. },
  3640. leave(el, remove) {
  3641. const key2 = String(vnode.key);
  3642. if (el[enterCbKey$1]) {
  3643. el[enterCbKey$1](
  3644. true
  3645. /* cancelled */
  3646. );
  3647. }
  3648. if (state.isUnmounting) {
  3649. return remove();
  3650. }
  3651. callHook(onBeforeLeave, [el]);
  3652. let called = false;
  3653. const done = el[leaveCbKey] = (cancelled) => {
  3654. if (called)
  3655. return;
  3656. called = true;
  3657. remove();
  3658. if (cancelled) {
  3659. callHook(onLeaveCancelled, [el]);
  3660. } else {
  3661. callHook(onAfterLeave, [el]);
  3662. }
  3663. el[leaveCbKey] = void 0;
  3664. if (leavingVNodesCache[key2] === vnode) {
  3665. delete leavingVNodesCache[key2];
  3666. }
  3667. };
  3668. leavingVNodesCache[key2] = vnode;
  3669. if (onLeave) {
  3670. callAsyncHook(onLeave, [el, done]);
  3671. } else {
  3672. done();
  3673. }
  3674. },
  3675. clone(vnode2) {
  3676. return resolveTransitionHooks(vnode2, props, state, instance);
  3677. }
  3678. };
  3679. return hooks;
  3680. }
  3681. function emptyPlaceholder(vnode) {
  3682. if (isKeepAlive(vnode)) {
  3683. vnode = cloneVNode(vnode);
  3684. vnode.children = null;
  3685. return vnode;
  3686. }
  3687. }
  3688. function getKeepAliveChild(vnode) {
  3689. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  3690. }
  3691. function setTransitionHooks(vnode, hooks) {
  3692. if (vnode.shapeFlag & 6 && vnode.component) {
  3693. setTransitionHooks(vnode.component.subTree, hooks);
  3694. } else if (vnode.shapeFlag & 128) {
  3695. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3696. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3697. } else {
  3698. vnode.transition = hooks;
  3699. }
  3700. }
  3701. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3702. let ret = [];
  3703. let keyedFragmentCount = 0;
  3704. for (let i = 0; i < children.length; i++) {
  3705. let child = children[i];
  3706. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3707. if (child.type === Fragment) {
  3708. if (child.patchFlag & 128)
  3709. keyedFragmentCount++;
  3710. ret = ret.concat(
  3711. getTransitionRawChildren(child.children, keepComment, key)
  3712. );
  3713. } else if (keepComment || child.type !== Comment) {
  3714. ret.push(key != null ? cloneVNode(child, {key}) : child);
  3715. }
  3716. }
  3717. if (keyedFragmentCount > 1) {
  3718. for (let i = 0; i < ret.length; i++) {
  3719. ret[i].patchFlag = -2;
  3720. }
  3721. }
  3722. return ret;
  3723. }
  3724. /*! #__NO_SIDE_EFFECTS__ */
  3725. // @__NO_SIDE_EFFECTS__
  3726. function defineComponent(options, extraOptions) {
  3727. return isFunction(options) ? (
  3728. // #8326: extend call and options.name access are considered side-effects
  3729. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3730. /* @__PURE__ */ (() => extend({name: options.name}, extraOptions, {setup: options}))()
  3731. ) : options;
  3732. }
  3733. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3734. /*! #__NO_SIDE_EFFECTS__ */
  3735. // @__NO_SIDE_EFFECTS__
  3736. function defineAsyncComponent(source) {
  3737. if (isFunction(source)) {
  3738. source = {loader: source};
  3739. }
  3740. const {
  3741. loader,
  3742. loadingComponent,
  3743. errorComponent,
  3744. delay = 200,
  3745. timeout,
  3746. // undefined = never times out
  3747. suspensible = true,
  3748. onError: userOnError
  3749. } = source;
  3750. let pendingRequest = null;
  3751. let resolvedComp;
  3752. let retries = 0;
  3753. const retry = () => {
  3754. retries++;
  3755. pendingRequest = null;
  3756. return load();
  3757. };
  3758. const load = () => {
  3759. let thisRequest;
  3760. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3761. err = err instanceof Error ? err : new Error(String(err));
  3762. if (userOnError) {
  3763. return new Promise((resolve, reject) => {
  3764. const userRetry = () => resolve(retry());
  3765. const userFail = () => reject(err);
  3766. userOnError(err, userRetry, userFail, retries + 1);
  3767. });
  3768. } else {
  3769. throw err;
  3770. }
  3771. }).then((comp) => {
  3772. if (thisRequest !== pendingRequest && pendingRequest) {
  3773. return pendingRequest;
  3774. }
  3775. if (!comp) {
  3776. warn(
  3777. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  3778. );
  3779. }
  3780. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  3781. comp = comp.default;
  3782. }
  3783. if (comp && !isObject(comp) && !isFunction(comp)) {
  3784. throw new Error(`Invalid async component load result: ${comp}`);
  3785. }
  3786. resolvedComp = comp;
  3787. return comp;
  3788. }));
  3789. };
  3790. return defineComponent({
  3791. name: "AsyncComponentWrapper",
  3792. __asyncLoader: load,
  3793. get __asyncResolved() {
  3794. return resolvedComp;
  3795. },
  3796. setup() {
  3797. const instance = currentInstance;
  3798. if (resolvedComp) {
  3799. return () => createInnerComp(resolvedComp, instance);
  3800. }
  3801. const onError = (err) => {
  3802. pendingRequest = null;
  3803. handleError(
  3804. err,
  3805. instance,
  3806. 13,
  3807. !errorComponent
  3808. /* do not throw in dev if user provided error component */
  3809. );
  3810. };
  3811. if (suspensible && instance.suspense || false) {
  3812. return load().then((comp) => {
  3813. return () => createInnerComp(comp, instance);
  3814. }).catch((err) => {
  3815. onError(err);
  3816. return () => errorComponent ? createVNode(errorComponent, {
  3817. error: err
  3818. }) : null;
  3819. });
  3820. }
  3821. const loaded = ref(false);
  3822. const error = ref();
  3823. const delayed = ref(!!delay);
  3824. if (delay) {
  3825. setTimeout(() => {
  3826. delayed.value = false;
  3827. }, delay);
  3828. }
  3829. if (timeout != null) {
  3830. setTimeout(() => {
  3831. if (!loaded.value && !error.value) {
  3832. const err = new Error(
  3833. `Async component timed out after ${timeout}ms.`
  3834. );
  3835. onError(err);
  3836. error.value = err;
  3837. }
  3838. }, timeout);
  3839. }
  3840. load().then(() => {
  3841. loaded.value = true;
  3842. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3843. queueJob(instance.parent.update);
  3844. }
  3845. }).catch((err) => {
  3846. onError(err);
  3847. error.value = err;
  3848. });
  3849. return () => {
  3850. if (loaded.value && resolvedComp) {
  3851. return createInnerComp(resolvedComp, instance);
  3852. } else if (error.value && errorComponent) {
  3853. return createVNode(errorComponent, {
  3854. error: error.value
  3855. });
  3856. } else if (loadingComponent && !delayed.value) {
  3857. return createVNode(loadingComponent);
  3858. }
  3859. };
  3860. }
  3861. });
  3862. }
  3863. function createInnerComp(comp, parent) {
  3864. const {ref: ref2, props, children, ce} = parent.vnode;
  3865. const vnode = createVNode(comp, props, children);
  3866. vnode.ref = ref2;
  3867. vnode.ce = ce;
  3868. delete parent.vnode.ce;
  3869. return vnode;
  3870. }
  3871. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  3872. const KeepAliveImpl = {
  3873. name: `KeepAlive`,
  3874. // Marker for special handling inside the renderer. We are not using a ===
  3875. // check directly on KeepAlive in the renderer, because importing it directly
  3876. // would prevent it from being tree-shaken.
  3877. __isKeepAlive: true,
  3878. props: {
  3879. include: [String, RegExp, Array],
  3880. exclude: [String, RegExp, Array],
  3881. max: [String, Number]
  3882. },
  3883. setup(props, {slots}) {
  3884. const instance = getCurrentInstance();
  3885. const sharedContext = instance.ctx;
  3886. const cache = /* @__PURE__ */ new Map();
  3887. const keys = /* @__PURE__ */ new Set();
  3888. let current = null;
  3889. {
  3890. instance.__v_cache = cache;
  3891. }
  3892. const parentSuspense = instance.suspense;
  3893. const {
  3894. renderer: {
  3895. p: patch,
  3896. m: move,
  3897. um: _unmount,
  3898. o: {createElement}
  3899. }
  3900. } = sharedContext;
  3901. const storageContainer = createElement("div");
  3902. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3903. const instance2 = vnode.component;
  3904. move(vnode, container, anchor, 0, parentSuspense);
  3905. patch(
  3906. instance2.vnode,
  3907. vnode,
  3908. container,
  3909. anchor,
  3910. instance2,
  3911. parentSuspense,
  3912. isSVG,
  3913. vnode.slotScopeIds,
  3914. optimized
  3915. );
  3916. queuePostRenderEffect(() => {
  3917. instance2.isDeactivated = false;
  3918. if (instance2.a) {
  3919. invokeArrayFns(instance2.a);
  3920. }
  3921. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3922. if (vnodeHook) {
  3923. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3924. }
  3925. }, parentSuspense);
  3926. {
  3927. devtoolsComponentAdded(instance2);
  3928. }
  3929. };
  3930. sharedContext.deactivate = (vnode) => {
  3931. const instance2 = vnode.component;
  3932. move(vnode, storageContainer, null, 1, parentSuspense);
  3933. queuePostRenderEffect(() => {
  3934. if (instance2.da) {
  3935. invokeArrayFns(instance2.da);
  3936. }
  3937. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3938. if (vnodeHook) {
  3939. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3940. }
  3941. instance2.isDeactivated = true;
  3942. }, parentSuspense);
  3943. {
  3944. devtoolsComponentAdded(instance2);
  3945. }
  3946. };
  3947. function unmount(vnode) {
  3948. resetShapeFlag(vnode);
  3949. _unmount(vnode, instance, parentSuspense, true);
  3950. }
  3951. function pruneCache(filter) {
  3952. cache.forEach((vnode, key) => {
  3953. const name = getComponentName(vnode.type);
  3954. if (name && (!filter || !filter(name))) {
  3955. pruneCacheEntry(key);
  3956. }
  3957. });
  3958. }
  3959. function pruneCacheEntry(key) {
  3960. const cached = cache.get(key);
  3961. if (!current || !isSameVNodeType(cached, current)) {
  3962. unmount(cached);
  3963. } else if (current) {
  3964. resetShapeFlag(current);
  3965. }
  3966. cache.delete(key);
  3967. keys.delete(key);
  3968. }
  3969. watch(
  3970. () => [props.include, props.exclude],
  3971. ([include, exclude]) => {
  3972. include && pruneCache((name) => matches(include, name));
  3973. exclude && pruneCache((name) => !matches(exclude, name));
  3974. },
  3975. // prune post-render after `current` has been updated
  3976. {flush: "post", deep: true}
  3977. );
  3978. let pendingCacheKey = null;
  3979. const cacheSubtree = () => {
  3980. if (pendingCacheKey != null) {
  3981. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3982. }
  3983. };
  3984. onMounted(cacheSubtree);
  3985. onUpdated(cacheSubtree);
  3986. onBeforeUnmount(() => {
  3987. cache.forEach((cached) => {
  3988. const {subTree, suspense} = instance;
  3989. const vnode = getInnerChild(subTree);
  3990. if (cached.type === vnode.type && cached.key === vnode.key) {
  3991. resetShapeFlag(vnode);
  3992. const da = vnode.component.da;
  3993. da && queuePostRenderEffect(da, suspense);
  3994. return;
  3995. }
  3996. unmount(cached);
  3997. });
  3998. });
  3999. return () => {
  4000. pendingCacheKey = null;
  4001. if (!slots.default) {
  4002. return null;
  4003. }
  4004. const children = slots.default();
  4005. const rawVNode = children[0];
  4006. if (children.length > 1) {
  4007. {
  4008. warn(`KeepAlive should contain exactly one component child.`);
  4009. }
  4010. current = null;
  4011. return children;
  4012. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4013. current = null;
  4014. return rawVNode;
  4015. }
  4016. let vnode = getInnerChild(rawVNode);
  4017. const comp = vnode.type;
  4018. const name = getComponentName(
  4019. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4020. );
  4021. const {include, exclude, max} = props;
  4022. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4023. current = vnode;
  4024. return rawVNode;
  4025. }
  4026. const key = vnode.key == null ? comp : vnode.key;
  4027. const cachedVNode = cache.get(key);
  4028. if (vnode.el) {
  4029. vnode = cloneVNode(vnode);
  4030. if (rawVNode.shapeFlag & 128) {
  4031. rawVNode.ssContent = vnode;
  4032. }
  4033. }
  4034. pendingCacheKey = key;
  4035. if (cachedVNode) {
  4036. vnode.el = cachedVNode.el;
  4037. vnode.component = cachedVNode.component;
  4038. if (vnode.transition) {
  4039. setTransitionHooks(vnode, vnode.transition);
  4040. }
  4041. vnode.shapeFlag |= 512;
  4042. keys.delete(key);
  4043. keys.add(key);
  4044. } else {
  4045. keys.add(key);
  4046. if (max && keys.size > parseInt(max, 10)) {
  4047. pruneCacheEntry(keys.values().next().value);
  4048. }
  4049. }
  4050. vnode.shapeFlag |= 256;
  4051. current = vnode;
  4052. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4053. };
  4054. }
  4055. };
  4056. const KeepAlive = KeepAliveImpl;
  4057. function matches(pattern, name) {
  4058. if (isArray(pattern)) {
  4059. return pattern.some((p) => matches(p, name));
  4060. } else if (isString(pattern)) {
  4061. return pattern.split(",").includes(name);
  4062. } else if (isRegExp(pattern)) {
  4063. return pattern.test(name);
  4064. }
  4065. return false;
  4066. }
  4067. function onActivated(hook, target) {
  4068. registerKeepAliveHook(hook, "a", target);
  4069. }
  4070. function onDeactivated(hook, target) {
  4071. registerKeepAliveHook(hook, "da", target);
  4072. }
  4073. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4074. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4075. let current = target;
  4076. while (current) {
  4077. if (current.isDeactivated) {
  4078. return;
  4079. }
  4080. current = current.parent;
  4081. }
  4082. return hook();
  4083. });
  4084. injectHook(type, wrappedHook, target);
  4085. if (target) {
  4086. let current = target.parent;
  4087. while (current && current.parent) {
  4088. if (isKeepAlive(current.parent.vnode)) {
  4089. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4090. }
  4091. current = current.parent;
  4092. }
  4093. }
  4094. }
  4095. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4096. const injected = injectHook(
  4097. type,
  4098. hook,
  4099. keepAliveRoot,
  4100. true
  4101. /* prepend */
  4102. );
  4103. onUnmounted(() => {
  4104. remove(keepAliveRoot[type], injected);
  4105. }, target);
  4106. }
  4107. function resetShapeFlag(vnode) {
  4108. vnode.shapeFlag &= ~256;
  4109. vnode.shapeFlag &= ~512;
  4110. }
  4111. function getInnerChild(vnode) {
  4112. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4113. }
  4114. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4115. if (target) {
  4116. const hooks = target[type] || (target[type] = []);
  4117. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4118. if (target.isUnmounted) {
  4119. return;
  4120. }
  4121. pauseTracking();
  4122. setCurrentInstance(target);
  4123. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4124. unsetCurrentInstance();
  4125. resetTracking();
  4126. return res;
  4127. });
  4128. if (prepend) {
  4129. hooks.unshift(wrappedHook);
  4130. } else {
  4131. hooks.push(wrappedHook);
  4132. }
  4133. return wrappedHook;
  4134. } else {
  4135. const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
  4136. warn(
  4137. `${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.`)
  4138. );
  4139. }
  4140. }
  4141. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4142. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4143. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4144. );
  4145. const onBeforeMount = createHook("bm");
  4146. const onMounted = createHook("m");
  4147. const onBeforeUpdate = createHook("bu");
  4148. const onUpdated = createHook("u");
  4149. const onBeforeUnmount = createHook("bum");
  4150. const onUnmounted = createHook("um");
  4151. const onServerPrefetch = createHook("sp");
  4152. const onRenderTriggered = createHook(
  4153. "rtg"
  4154. );
  4155. const onRenderTracked = createHook(
  4156. "rtc"
  4157. );
  4158. function onErrorCaptured(hook, target = currentInstance) {
  4159. injectHook("ec", hook, target);
  4160. }
  4161. function renderList(source, renderItem, cache, index) {
  4162. let ret;
  4163. const cached = cache && cache[index];
  4164. if (isArray(source) || isString(source)) {
  4165. ret = new Array(source.length);
  4166. for (let i = 0, l = source.length; i < l; i++) {
  4167. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4168. }
  4169. } else if (typeof source === "number") {
  4170. if (!Number.isInteger(source)) {
  4171. warn(`The v-for range expect an integer value but got ${source}.`);
  4172. }
  4173. ret = new Array(source);
  4174. for (let i = 0; i < source; i++) {
  4175. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4176. }
  4177. } else if (isObject(source)) {
  4178. if (source[Symbol.iterator]) {
  4179. ret = Array.from(
  4180. source,
  4181. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4182. );
  4183. } else {
  4184. const keys = Object.keys(source);
  4185. ret = new Array(keys.length);
  4186. for (let i = 0, l = keys.length; i < l; i++) {
  4187. const key = keys[i];
  4188. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4189. }
  4190. }
  4191. } else {
  4192. ret = [];
  4193. }
  4194. if (cache) {
  4195. cache[index] = ret;
  4196. }
  4197. return ret;
  4198. }
  4199. function createSlots(slots, dynamicSlots) {
  4200. for (let i = 0; i < dynamicSlots.length; i++) {
  4201. const slot = dynamicSlots[i];
  4202. if (isArray(slot)) {
  4203. for (let j = 0; j < slot.length; j++) {
  4204. slots[slot[j].name] = slot[j].fn;
  4205. }
  4206. } else if (slot) {
  4207. slots[slot.name] = slot.key ? (...args) => {
  4208. const res = slot.fn(...args);
  4209. if (res)
  4210. res.key = slot.key;
  4211. return res;
  4212. } : slot.fn;
  4213. }
  4214. }
  4215. return slots;
  4216. }
  4217. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4218. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4219. if (name !== "default")
  4220. props.name = name;
  4221. return createVNode("slot", props, fallback && fallback());
  4222. }
  4223. let slot = slots[name];
  4224. if (slot && slot.length > 1) {
  4225. warn(
  4226. `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.`
  4227. );
  4228. slot = () => [];
  4229. }
  4230. if (slot && slot._c) {
  4231. slot._d = false;
  4232. }
  4233. openBlock();
  4234. const validSlotContent = slot && ensureValidVNode(slot(props));
  4235. const rendered = createBlock(
  4236. Fragment,
  4237. {
  4238. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4239. // key attached in the `createSlots` helper, respect that
  4240. validSlotContent && validSlotContent.key || `_${name}`
  4241. },
  4242. validSlotContent || (fallback ? fallback() : []),
  4243. validSlotContent && slots._ === 1 ? 64 : -2
  4244. );
  4245. if (!noSlotted && rendered.scopeId) {
  4246. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4247. }
  4248. if (slot && slot._c) {
  4249. slot._d = true;
  4250. }
  4251. return rendered;
  4252. }
  4253. function ensureValidVNode(vnodes) {
  4254. return vnodes.some((child) => {
  4255. if (!isVNode(child))
  4256. return true;
  4257. if (child.type === Comment)
  4258. return false;
  4259. if (child.type === Fragment && !ensureValidVNode(child.children))
  4260. return false;
  4261. return true;
  4262. }) ? vnodes : null;
  4263. }
  4264. function toHandlers(obj, preserveCaseIfNecessary) {
  4265. const ret = {};
  4266. if (!isObject(obj)) {
  4267. warn(`v-on with no argument expects an object value.`);
  4268. return ret;
  4269. }
  4270. for (const key in obj) {
  4271. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4272. }
  4273. return ret;
  4274. }
  4275. const getPublicInstance = (i) => {
  4276. if (!i)
  4277. return null;
  4278. if (isStatefulComponent(i))
  4279. return getExposeProxy(i) || i.proxy;
  4280. return getPublicInstance(i.parent);
  4281. };
  4282. const publicPropertiesMap = (
  4283. // Move PURE marker to new line to workaround compiler discarding it
  4284. // due to type annotation
  4285. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4286. $: (i) => i,
  4287. $el: (i) => i.vnode.el,
  4288. $data: (i) => i.data,
  4289. $props: (i) => shallowReadonly(i.props),
  4290. $attrs: (i) => shallowReadonly(i.attrs),
  4291. $slots: (i) => shallowReadonly(i.slots),
  4292. $refs: (i) => shallowReadonly(i.refs),
  4293. $parent: (i) => getPublicInstance(i.parent),
  4294. $root: (i) => getPublicInstance(i.root),
  4295. $emit: (i) => i.emit,
  4296. $options: (i) => resolveMergedOptions(i),
  4297. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  4298. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4299. $watch: (i) => instanceWatch.bind(i)
  4300. })
  4301. );
  4302. const isReservedPrefix = (key) => key === "_" || key === "$";
  4303. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4304. const PublicInstanceProxyHandlers = {
  4305. get({_: instance}, key) {
  4306. const {ctx, setupState, data, props, accessCache, type, appContext} = instance;
  4307. if (key === "__isVue") {
  4308. return true;
  4309. }
  4310. let normalizedProps;
  4311. if (key[0] !== "$") {
  4312. const n = accessCache[key];
  4313. if (n !== void 0) {
  4314. switch (n) {
  4315. case 1 /* SETUP */
  4316. :
  4317. return setupState[key];
  4318. case 2 /* DATA */
  4319. :
  4320. return data[key];
  4321. case 4 /* CONTEXT */
  4322. :
  4323. return ctx[key];
  4324. case 3 /* PROPS */
  4325. :
  4326. return props[key];
  4327. }
  4328. } else if (hasSetupBinding(setupState, key)) {
  4329. accessCache[key] = 1 /* SETUP */;
  4330. return setupState[key];
  4331. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4332. accessCache[key] = 2 /* DATA */;
  4333. return data[key];
  4334. } else if (
  4335. // only cache other properties when instance has declared (thus stable)
  4336. // props
  4337. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4338. ) {
  4339. accessCache[key] = 3 /* PROPS */;
  4340. return props[key];
  4341. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4342. accessCache[key] = 4 /* CONTEXT */;
  4343. return ctx[key];
  4344. } else if (shouldCacheAccess) {
  4345. accessCache[key] = 0 /* OTHER */;
  4346. }
  4347. }
  4348. const publicGetter = publicPropertiesMap[key];
  4349. let cssModule, globalProperties;
  4350. if (publicGetter) {
  4351. if (key === "$attrs") {
  4352. track(instance, "get", key);
  4353. markAttrsAccessed();
  4354. } else if (key === "$slots") {
  4355. track(instance, "get", key);
  4356. }
  4357. return publicGetter(instance);
  4358. } else if (
  4359. // css module (injected by vue-loader)
  4360. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4361. ) {
  4362. return cssModule;
  4363. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4364. accessCache[key] = 4 /* CONTEXT */;
  4365. return ctx[key];
  4366. } else if (
  4367. // global properties
  4368. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4369. ) {
  4370. {
  4371. return globalProperties[key];
  4372. }
  4373. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4374. // to infinite warning loop
  4375. key.indexOf("__v") !== 0)) {
  4376. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4377. warn(
  4378. `Property ${JSON.stringify(
  4379. key
  4380. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4381. );
  4382. } else if (instance === currentRenderingInstance) {
  4383. warn(
  4384. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4385. );
  4386. }
  4387. }
  4388. },
  4389. set({_: instance}, key, value) {
  4390. const {data, setupState, ctx} = instance;
  4391. if (hasSetupBinding(setupState, key)) {
  4392. setupState[key] = value;
  4393. return true;
  4394. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4395. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4396. return false;
  4397. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4398. data[key] = value;
  4399. return true;
  4400. } else if (hasOwn(instance.props, key)) {
  4401. warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  4402. return false;
  4403. }
  4404. if (key[0] === "$" && key.slice(1) in instance) {
  4405. warn(
  4406. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4407. );
  4408. return false;
  4409. } else {
  4410. if (key in instance.appContext.config.globalProperties) {
  4411. Object.defineProperty(ctx, key, {
  4412. enumerable: true,
  4413. configurable: true,
  4414. value
  4415. });
  4416. } else {
  4417. ctx[key] = value;
  4418. }
  4419. }
  4420. return true;
  4421. },
  4422. has({
  4423. _: {data, setupState, accessCache, ctx, appContext, propsOptions}
  4424. }, key) {
  4425. let normalizedProps;
  4426. 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);
  4427. },
  4428. defineProperty(target, key, descriptor) {
  4429. if (descriptor.get != null) {
  4430. target._.accessCache[key] = 0;
  4431. } else if (hasOwn(descriptor, "value")) {
  4432. this.set(target, key, descriptor.value, null);
  4433. }
  4434. return Reflect.defineProperty(target, key, descriptor);
  4435. }
  4436. };
  4437. {
  4438. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4439. warn(
  4440. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4441. );
  4442. return Reflect.ownKeys(target);
  4443. };
  4444. }
  4445. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4446. {},
  4447. PublicInstanceProxyHandlers,
  4448. {
  4449. get(target, key) {
  4450. if (key === Symbol.unscopables) {
  4451. return;
  4452. }
  4453. return PublicInstanceProxyHandlers.get(target, key, target);
  4454. },
  4455. has(_, key) {
  4456. const has = key[0] !== "_" && !isGloballyAllowed(key);
  4457. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4458. warn(
  4459. `Property ${JSON.stringify(
  4460. key
  4461. )} should not start with _ which is a reserved prefix for Vue internals.`
  4462. );
  4463. }
  4464. return has;
  4465. }
  4466. }
  4467. );
  4468. function createDevRenderContext(instance) {
  4469. const target = {};
  4470. Object.defineProperty(target, `_`, {
  4471. configurable: true,
  4472. enumerable: false,
  4473. get: () => instance
  4474. });
  4475. Object.keys(publicPropertiesMap).forEach((key) => {
  4476. Object.defineProperty(target, key, {
  4477. configurable: true,
  4478. enumerable: false,
  4479. get: () => publicPropertiesMap[key](instance),
  4480. // intercepted by the proxy so no need for implementation,
  4481. // but needed to prevent set errors
  4482. set: NOOP
  4483. });
  4484. });
  4485. return target;
  4486. }
  4487. function exposePropsOnRenderContext(instance) {
  4488. const {
  4489. ctx,
  4490. propsOptions: [propsOptions]
  4491. } = instance;
  4492. if (propsOptions) {
  4493. Object.keys(propsOptions).forEach((key) => {
  4494. Object.defineProperty(ctx, key, {
  4495. enumerable: true,
  4496. configurable: true,
  4497. get: () => instance.props[key],
  4498. set: NOOP
  4499. });
  4500. });
  4501. }
  4502. }
  4503. function exposeSetupStateOnRenderContext(instance) {
  4504. const {ctx, setupState} = instance;
  4505. Object.keys(toRaw(setupState)).forEach((key) => {
  4506. if (!setupState.__isScriptSetup) {
  4507. if (isReservedPrefix(key[0])) {
  4508. warn(
  4509. `setup() return property ${JSON.stringify(
  4510. key
  4511. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4512. );
  4513. return;
  4514. }
  4515. Object.defineProperty(ctx, key, {
  4516. enumerable: true,
  4517. configurable: true,
  4518. get: () => setupState[key],
  4519. set: NOOP
  4520. });
  4521. }
  4522. });
  4523. }
  4524. const warnRuntimeUsage = (method) => warn(
  4525. `${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.`
  4526. );
  4527. function defineProps() {
  4528. {
  4529. warnRuntimeUsage(`defineProps`);
  4530. }
  4531. return null;
  4532. }
  4533. function defineEmits() {
  4534. {
  4535. warnRuntimeUsage(`defineEmits`);
  4536. }
  4537. return null;
  4538. }
  4539. function defineExpose(exposed) {
  4540. {
  4541. warnRuntimeUsage(`defineExpose`);
  4542. }
  4543. }
  4544. function defineOptions(options) {
  4545. {
  4546. warnRuntimeUsage(`defineOptions`);
  4547. }
  4548. }
  4549. function defineSlots() {
  4550. {
  4551. warnRuntimeUsage(`defineSlots`);
  4552. }
  4553. return null;
  4554. }
  4555. function defineModel() {
  4556. {
  4557. warnRuntimeUsage("defineModel");
  4558. }
  4559. }
  4560. function withDefaults(props, defaults) {
  4561. {
  4562. warnRuntimeUsage(`withDefaults`);
  4563. }
  4564. return null;
  4565. }
  4566. function useSlots() {
  4567. return getContext().slots;
  4568. }
  4569. function useAttrs() {
  4570. return getContext().attrs;
  4571. }
  4572. function useModel(props, name, options) {
  4573. const i = getCurrentInstance();
  4574. if (!i) {
  4575. warn(`useModel() called without active instance.`);
  4576. return ref();
  4577. }
  4578. if (!i.propsOptions[0][name]) {
  4579. warn(`useModel() called with prop "${name}" which is not declared.`);
  4580. return ref();
  4581. }
  4582. if (options && options.local) {
  4583. const proxy = ref(props[name]);
  4584. watch(
  4585. () => props[name],
  4586. (v) => proxy.value = v
  4587. );
  4588. watch(proxy, (value) => {
  4589. if (value !== props[name]) {
  4590. i.emit(`update:${name}`, value);
  4591. }
  4592. });
  4593. return proxy;
  4594. } else {
  4595. return {
  4596. __v_isRef: true,
  4597. get value() {
  4598. return props[name];
  4599. },
  4600. set value(value) {
  4601. i.emit(`update:${name}`, value);
  4602. }
  4603. };
  4604. }
  4605. }
  4606. function getContext() {
  4607. const i = getCurrentInstance();
  4608. if (!i) {
  4609. warn(`useContext() called without active instance.`);
  4610. }
  4611. return i.setupContext || (i.setupContext = createSetupContext(i));
  4612. }
  4613. function normalizePropsOrEmits(props) {
  4614. return isArray(props) ? props.reduce(
  4615. (normalized, p) => (normalized[p] = null, normalized),
  4616. {}
  4617. ) : props;
  4618. }
  4619. function mergeDefaults(raw, defaults) {
  4620. const props = normalizePropsOrEmits(raw);
  4621. for (const key in defaults) {
  4622. if (key.startsWith("__skip"))
  4623. continue;
  4624. let opt = props[key];
  4625. if (opt) {
  4626. if (isArray(opt) || isFunction(opt)) {
  4627. opt = props[key] = {type: opt, default: defaults[key]};
  4628. } else {
  4629. opt.default = defaults[key];
  4630. }
  4631. } else if (opt === null) {
  4632. opt = props[key] = {default: defaults[key]};
  4633. } else {
  4634. warn(`props default key "${key}" has no corresponding declaration.`);
  4635. }
  4636. if (opt && defaults[`__skip_${key}`]) {
  4637. opt.skipFactory = true;
  4638. }
  4639. }
  4640. return props;
  4641. }
  4642. function mergeModels(a, b) {
  4643. if (!a || !b)
  4644. return a || b;
  4645. if (isArray(a) && isArray(b))
  4646. return a.concat(b);
  4647. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4648. }
  4649. function createPropsRestProxy(props, excludedKeys) {
  4650. const ret = {};
  4651. for (const key in props) {
  4652. if (!excludedKeys.includes(key)) {
  4653. Object.defineProperty(ret, key, {
  4654. enumerable: true,
  4655. get: () => props[key]
  4656. });
  4657. }
  4658. }
  4659. return ret;
  4660. }
  4661. function withAsyncContext(getAwaitable) {
  4662. const ctx = getCurrentInstance();
  4663. if (!ctx) {
  4664. warn(
  4665. `withAsyncContext called without active current instance. This is likely a bug.`
  4666. );
  4667. }
  4668. let awaitable = getAwaitable();
  4669. unsetCurrentInstance();
  4670. if (isPromise(awaitable)) {
  4671. awaitable = awaitable.catch((e) => {
  4672. setCurrentInstance(ctx);
  4673. throw e;
  4674. });
  4675. }
  4676. return [awaitable, () => setCurrentInstance(ctx)];
  4677. }
  4678. function createDuplicateChecker() {
  4679. const cache = /* @__PURE__ */ Object.create(null);
  4680. return (type, key) => {
  4681. if (cache[key]) {
  4682. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4683. } else {
  4684. cache[key] = type;
  4685. }
  4686. };
  4687. }
  4688. let shouldCacheAccess = true;
  4689. function applyOptions(instance) {
  4690. const options = resolveMergedOptions(instance);
  4691. const publicThis = instance.proxy;
  4692. const ctx = instance.ctx;
  4693. shouldCacheAccess = false;
  4694. if (options.beforeCreate) {
  4695. callHook$1(options.beforeCreate, instance, "bc");
  4696. }
  4697. const {
  4698. // state
  4699. data: dataOptions,
  4700. computed: computedOptions,
  4701. methods,
  4702. watch: watchOptions,
  4703. provide: provideOptions,
  4704. inject: injectOptions,
  4705. // lifecycle
  4706. created,
  4707. beforeMount,
  4708. mounted,
  4709. beforeUpdate,
  4710. updated,
  4711. activated,
  4712. deactivated,
  4713. beforeDestroy,
  4714. beforeUnmount,
  4715. destroyed,
  4716. unmounted,
  4717. render,
  4718. renderTracked,
  4719. renderTriggered,
  4720. errorCaptured,
  4721. serverPrefetch,
  4722. // public API
  4723. expose,
  4724. inheritAttrs,
  4725. // assets
  4726. components,
  4727. directives,
  4728. filters
  4729. } = options;
  4730. const checkDuplicateProperties = createDuplicateChecker();
  4731. {
  4732. const [propsOptions] = instance.propsOptions;
  4733. if (propsOptions) {
  4734. for (const key in propsOptions) {
  4735. checkDuplicateProperties("Props" /* PROPS */, key);
  4736. }
  4737. }
  4738. }
  4739. if (injectOptions) {
  4740. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4741. }
  4742. if (methods) {
  4743. for (const key in methods) {
  4744. const methodHandler = methods[key];
  4745. if (isFunction(methodHandler)) {
  4746. {
  4747. Object.defineProperty(ctx, key, {
  4748. value: methodHandler.bind(publicThis),
  4749. configurable: true,
  4750. enumerable: true,
  4751. writable: true
  4752. });
  4753. }
  4754. {
  4755. checkDuplicateProperties("Methods" /* METHODS */, key);
  4756. }
  4757. } else {
  4758. warn(
  4759. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4760. );
  4761. }
  4762. }
  4763. }
  4764. if (dataOptions) {
  4765. if (!isFunction(dataOptions)) {
  4766. warn(
  4767. `The data option must be a function. Plain object usage is no longer supported.`
  4768. );
  4769. }
  4770. const data = dataOptions.call(publicThis, publicThis);
  4771. if (isPromise(data)) {
  4772. warn(
  4773. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4774. );
  4775. }
  4776. if (!isObject(data)) {
  4777. warn(`data() should return an object.`);
  4778. } else {
  4779. instance.data = reactive(data);
  4780. {
  4781. for (const key in data) {
  4782. checkDuplicateProperties("Data" /* DATA */, key);
  4783. if (!isReservedPrefix(key[0])) {
  4784. Object.defineProperty(ctx, key, {
  4785. configurable: true,
  4786. enumerable: true,
  4787. get: () => data[key],
  4788. set: NOOP
  4789. });
  4790. }
  4791. }
  4792. }
  4793. }
  4794. }
  4795. shouldCacheAccess = true;
  4796. if (computedOptions) {
  4797. for (const key in computedOptions) {
  4798. const opt = computedOptions[key];
  4799. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4800. if (get === NOOP) {
  4801. warn(`Computed property "${key}" has no getter.`);
  4802. }
  4803. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4804. warn(
  4805. `Write operation failed: computed property "${key}" is readonly.`
  4806. );
  4807. };
  4808. const c = computed({
  4809. get,
  4810. set
  4811. });
  4812. Object.defineProperty(ctx, key, {
  4813. enumerable: true,
  4814. configurable: true,
  4815. get: () => c.value,
  4816. set: (v) => c.value = v
  4817. });
  4818. {
  4819. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  4820. }
  4821. }
  4822. }
  4823. if (watchOptions) {
  4824. for (const key in watchOptions) {
  4825. createWatcher(watchOptions[key], ctx, publicThis, key);
  4826. }
  4827. }
  4828. if (provideOptions) {
  4829. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4830. Reflect.ownKeys(provides).forEach((key) => {
  4831. provide(key, provides[key]);
  4832. });
  4833. }
  4834. if (created) {
  4835. callHook$1(created, instance, "c");
  4836. }
  4837. function registerLifecycleHook(register, hook) {
  4838. if (isArray(hook)) {
  4839. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  4840. } else if (hook) {
  4841. register(hook.bind(publicThis));
  4842. }
  4843. }
  4844. registerLifecycleHook(onBeforeMount, beforeMount);
  4845. registerLifecycleHook(onMounted, mounted);
  4846. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4847. registerLifecycleHook(onUpdated, updated);
  4848. registerLifecycleHook(onActivated, activated);
  4849. registerLifecycleHook(onDeactivated, deactivated);
  4850. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4851. registerLifecycleHook(onRenderTracked, renderTracked);
  4852. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4853. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4854. registerLifecycleHook(onUnmounted, unmounted);
  4855. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4856. if (isArray(expose)) {
  4857. if (expose.length) {
  4858. const exposed = instance.exposed || (instance.exposed = {});
  4859. expose.forEach((key) => {
  4860. Object.defineProperty(exposed, key, {
  4861. get: () => publicThis[key],
  4862. set: (val) => publicThis[key] = val
  4863. });
  4864. });
  4865. } else if (!instance.exposed) {
  4866. instance.exposed = {};
  4867. }
  4868. }
  4869. if (render && instance.render === NOOP) {
  4870. instance.render = render;
  4871. }
  4872. if (inheritAttrs != null) {
  4873. instance.inheritAttrs = inheritAttrs;
  4874. }
  4875. if (components)
  4876. instance.components = components;
  4877. if (directives)
  4878. instance.directives = directives;
  4879. }
  4880. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  4881. if (isArray(injectOptions)) {
  4882. injectOptions = normalizeInject(injectOptions);
  4883. }
  4884. for (const key in injectOptions) {
  4885. const opt = injectOptions[key];
  4886. let injected;
  4887. if (isObject(opt)) {
  4888. if ("default" in opt) {
  4889. injected = inject(
  4890. opt.from || key,
  4891. opt.default,
  4892. true
  4893. /* treat default function as factory */
  4894. );
  4895. } else {
  4896. injected = inject(opt.from || key);
  4897. }
  4898. } else {
  4899. injected = inject(opt);
  4900. }
  4901. if (isRef(injected)) {
  4902. Object.defineProperty(ctx, key, {
  4903. enumerable: true,
  4904. configurable: true,
  4905. get: () => injected.value,
  4906. set: (v) => injected.value = v
  4907. });
  4908. } else {
  4909. ctx[key] = injected;
  4910. }
  4911. {
  4912. checkDuplicateProperties("Inject" /* INJECT */, key);
  4913. }
  4914. }
  4915. }
  4916. function callHook$1(hook, instance, type) {
  4917. callWithAsyncErrorHandling(
  4918. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  4919. instance,
  4920. type
  4921. );
  4922. }
  4923. function createWatcher(raw, ctx, publicThis, key) {
  4924. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  4925. if (isString(raw)) {
  4926. const handler = ctx[raw];
  4927. if (isFunction(handler)) {
  4928. watch(getter, handler);
  4929. } else {
  4930. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  4931. }
  4932. } else if (isFunction(raw)) {
  4933. watch(getter, raw.bind(publicThis));
  4934. } else if (isObject(raw)) {
  4935. if (isArray(raw)) {
  4936. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  4937. } else {
  4938. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4939. if (isFunction(handler)) {
  4940. watch(getter, handler, raw);
  4941. } else {
  4942. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  4943. }
  4944. }
  4945. } else {
  4946. warn(`Invalid watch option: "${key}"`, raw);
  4947. }
  4948. }
  4949. function resolveMergedOptions(instance) {
  4950. const base = instance.type;
  4951. const {mixins, extends: extendsOptions} = base;
  4952. const {
  4953. mixins: globalMixins,
  4954. optionsCache: cache,
  4955. config: {optionMergeStrategies}
  4956. } = instance.appContext;
  4957. const cached = cache.get(base);
  4958. let resolved;
  4959. if (cached) {
  4960. resolved = cached;
  4961. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4962. {
  4963. resolved = base;
  4964. }
  4965. } else {
  4966. resolved = {};
  4967. if (globalMixins.length) {
  4968. globalMixins.forEach(
  4969. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  4970. );
  4971. }
  4972. mergeOptions(resolved, base, optionMergeStrategies);
  4973. }
  4974. if (isObject(base)) {
  4975. cache.set(base, resolved);
  4976. }
  4977. return resolved;
  4978. }
  4979. function mergeOptions(to, from, strats, asMixin = false) {
  4980. const {mixins, extends: extendsOptions} = from;
  4981. if (extendsOptions) {
  4982. mergeOptions(to, extendsOptions, strats, true);
  4983. }
  4984. if (mixins) {
  4985. mixins.forEach(
  4986. (m) => mergeOptions(to, m, strats, true)
  4987. );
  4988. }
  4989. for (const key in from) {
  4990. if (asMixin && key === "expose") {
  4991. warn(
  4992. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  4993. );
  4994. } else {
  4995. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  4996. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4997. }
  4998. }
  4999. return to;
  5000. }
  5001. const internalOptionMergeStrats = {
  5002. data: mergeDataFn,
  5003. props: mergeEmitsOrPropsOptions,
  5004. emits: mergeEmitsOrPropsOptions,
  5005. // objects
  5006. methods: mergeObjectOptions,
  5007. computed: mergeObjectOptions,
  5008. // lifecycle
  5009. beforeCreate: mergeAsArray$1,
  5010. created: mergeAsArray$1,
  5011. beforeMount: mergeAsArray$1,
  5012. mounted: mergeAsArray$1,
  5013. beforeUpdate: mergeAsArray$1,
  5014. updated: mergeAsArray$1,
  5015. beforeDestroy: mergeAsArray$1,
  5016. beforeUnmount: mergeAsArray$1,
  5017. destroyed: mergeAsArray$1,
  5018. unmounted: mergeAsArray$1,
  5019. activated: mergeAsArray$1,
  5020. deactivated: mergeAsArray$1,
  5021. errorCaptured: mergeAsArray$1,
  5022. serverPrefetch: mergeAsArray$1,
  5023. // assets
  5024. components: mergeObjectOptions,
  5025. directives: mergeObjectOptions,
  5026. // watch
  5027. watch: mergeWatchOptions,
  5028. // provide / inject
  5029. provide: mergeDataFn,
  5030. inject: mergeInject
  5031. };
  5032. function mergeDataFn(to, from) {
  5033. if (!from) {
  5034. return to;
  5035. }
  5036. if (!to) {
  5037. return from;
  5038. }
  5039. return function mergedDataFn() {
  5040. return (extend)(
  5041. isFunction(to) ? to.call(this, this) : to,
  5042. isFunction(from) ? from.call(this, this) : from
  5043. );
  5044. };
  5045. }
  5046. function mergeInject(to, from) {
  5047. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5048. }
  5049. function normalizeInject(raw) {
  5050. if (isArray(raw)) {
  5051. const res = {};
  5052. for (let i = 0; i < raw.length; i++) {
  5053. res[raw[i]] = raw[i];
  5054. }
  5055. return res;
  5056. }
  5057. return raw;
  5058. }
  5059. function mergeAsArray$1(to, from) {
  5060. return to ? [...new Set([].concat(to, from))] : from;
  5061. }
  5062. function mergeObjectOptions(to, from) {
  5063. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5064. }
  5065. function mergeEmitsOrPropsOptions(to, from) {
  5066. if (to) {
  5067. if (isArray(to) && isArray(from)) {
  5068. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5069. }
  5070. return extend(
  5071. /* @__PURE__ */ Object.create(null),
  5072. normalizePropsOrEmits(to),
  5073. normalizePropsOrEmits(from != null ? from : {})
  5074. );
  5075. } else {
  5076. return from;
  5077. }
  5078. }
  5079. function mergeWatchOptions(to, from) {
  5080. if (!to)
  5081. return from;
  5082. if (!from)
  5083. return to;
  5084. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5085. for (const key in from) {
  5086. merged[key] = mergeAsArray$1(to[key], from[key]);
  5087. }
  5088. return merged;
  5089. }
  5090. function createAppContext() {
  5091. return {
  5092. app: null,
  5093. config: {
  5094. isNativeTag: NO,
  5095. performance: false,
  5096. globalProperties: {},
  5097. optionMergeStrategies: {},
  5098. errorHandler: void 0,
  5099. warnHandler: void 0,
  5100. compilerOptions: {}
  5101. },
  5102. mixins: [],
  5103. components: {},
  5104. directives: {},
  5105. provides: /* @__PURE__ */ Object.create(null),
  5106. optionsCache: /* @__PURE__ */ new WeakMap(),
  5107. propsCache: /* @__PURE__ */ new WeakMap(),
  5108. emitsCache: /* @__PURE__ */ new WeakMap()
  5109. };
  5110. }
  5111. let uid$1 = 0;
  5112. function createAppAPI(render, hydrate) {
  5113. return function createApp(rootComponent, rootProps = null) {
  5114. if (!isFunction(rootComponent)) {
  5115. rootComponent = extend({}, rootComponent);
  5116. }
  5117. if (rootProps != null && !isObject(rootProps)) {
  5118. warn(`root props passed to app.mount() must be an object.`);
  5119. rootProps = null;
  5120. }
  5121. const context = createAppContext();
  5122. {
  5123. Object.defineProperty(context.config, "unwrapInjectedRef", {
  5124. get() {
  5125. return true;
  5126. },
  5127. set() {
  5128. warn(
  5129. `app.config.unwrapInjectedRef has been deprecated. 3.3 now always unwraps injected refs in Options API.`
  5130. );
  5131. }
  5132. });
  5133. }
  5134. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5135. let isMounted = false;
  5136. const app = context.app = {
  5137. _uid: uid$1++,
  5138. _component: rootComponent,
  5139. _props: rootProps,
  5140. _container: null,
  5141. _context: context,
  5142. _instance: null,
  5143. version,
  5144. get config() {
  5145. return context.config;
  5146. },
  5147. set config(v) {
  5148. {
  5149. warn(
  5150. `app.config cannot be replaced. Modify individual options instead.`
  5151. );
  5152. }
  5153. },
  5154. use(plugin, ...options) {
  5155. if (installedPlugins.has(plugin)) {
  5156. warn(`Plugin has already been applied to target app.`);
  5157. } else if (plugin && isFunction(plugin.install)) {
  5158. installedPlugins.add(plugin);
  5159. plugin.install(app, ...options);
  5160. } else if (isFunction(plugin)) {
  5161. installedPlugins.add(plugin);
  5162. plugin(app, ...options);
  5163. } else {
  5164. warn(
  5165. `A plugin must either be a function or an object with an "install" function.`
  5166. );
  5167. }
  5168. return app;
  5169. },
  5170. mixin(mixin) {
  5171. {
  5172. if (!context.mixins.includes(mixin)) {
  5173. context.mixins.push(mixin);
  5174. } else {
  5175. warn(
  5176. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5177. );
  5178. }
  5179. }
  5180. return app;
  5181. },
  5182. component(name, component) {
  5183. {
  5184. validateComponentName(name, context.config);
  5185. }
  5186. if (!component) {
  5187. return context.components[name];
  5188. }
  5189. if (context.components[name]) {
  5190. warn(`Component "${name}" has already been registered in target app.`);
  5191. }
  5192. context.components[name] = component;
  5193. return app;
  5194. },
  5195. directive(name, directive) {
  5196. {
  5197. validateDirectiveName(name);
  5198. }
  5199. if (!directive) {
  5200. return context.directives[name];
  5201. }
  5202. if (context.directives[name]) {
  5203. warn(`Directive "${name}" has already been registered in target app.`);
  5204. }
  5205. context.directives[name] = directive;
  5206. return app;
  5207. },
  5208. mount(rootContainer, isHydrate, isSVG) {
  5209. if (!isMounted) {
  5210. if (rootContainer.__vue_app__) {
  5211. warn(
  5212. `There is already an app instance mounted on the host container.
  5213. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5214. );
  5215. }
  5216. const vnode = createVNode(rootComponent, rootProps);
  5217. vnode.appContext = context;
  5218. {
  5219. context.reload = () => {
  5220. render(cloneVNode(vnode), rootContainer, isSVG);
  5221. };
  5222. }
  5223. if (isHydrate && hydrate) {
  5224. hydrate(vnode, rootContainer);
  5225. } else {
  5226. render(vnode, rootContainer, isSVG);
  5227. }
  5228. isMounted = true;
  5229. app._container = rootContainer;
  5230. rootContainer.__vue_app__ = app;
  5231. {
  5232. app._instance = vnode.component;
  5233. devtoolsInitApp(app, version);
  5234. }
  5235. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5236. } else {
  5237. warn(
  5238. `App has already been mounted.
  5239. 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)\``
  5240. );
  5241. }
  5242. },
  5243. unmount() {
  5244. if (isMounted) {
  5245. render(null, app._container);
  5246. {
  5247. app._instance = null;
  5248. devtoolsUnmountApp(app);
  5249. }
  5250. delete app._container.__vue_app__;
  5251. } else {
  5252. warn(`Cannot unmount an app that is not mounted.`);
  5253. }
  5254. },
  5255. provide(key, value) {
  5256. if (key in context.provides) {
  5257. warn(
  5258. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5259. );
  5260. }
  5261. context.provides[key] = value;
  5262. return app;
  5263. },
  5264. runWithContext(fn) {
  5265. currentApp = app;
  5266. try {
  5267. return fn();
  5268. } finally {
  5269. currentApp = null;
  5270. }
  5271. }
  5272. };
  5273. return app;
  5274. };
  5275. }
  5276. let currentApp = null;
  5277. function provide(key, value) {
  5278. if (!currentInstance) {
  5279. {
  5280. warn(`provide() can only be used inside setup().`);
  5281. }
  5282. } else {
  5283. let provides = currentInstance.provides;
  5284. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5285. if (parentProvides === provides) {
  5286. provides = currentInstance.provides = Object.create(parentProvides);
  5287. }
  5288. provides[key] = value;
  5289. }
  5290. }
  5291. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5292. const instance = currentInstance || currentRenderingInstance;
  5293. if (instance || currentApp) {
  5294. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5295. if (provides && key in provides) {
  5296. return provides[key];
  5297. } else if (arguments.length > 1) {
  5298. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5299. } else {
  5300. warn(`injection "${String(key)}" not found.`);
  5301. }
  5302. } else {
  5303. warn(`inject() can only be used inside setup() or functional components.`);
  5304. }
  5305. }
  5306. function hasInjectionContext() {
  5307. return !!(currentInstance || currentRenderingInstance || currentApp);
  5308. }
  5309. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5310. const props = {};
  5311. const attrs = {};
  5312. def(attrs, InternalObjectKey, 1);
  5313. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5314. setFullProps(instance, rawProps, props, attrs);
  5315. for (const key in instance.propsOptions[0]) {
  5316. if (!(key in props)) {
  5317. props[key] = void 0;
  5318. }
  5319. }
  5320. {
  5321. validateProps(rawProps || {}, props, instance);
  5322. }
  5323. if (isStateful) {
  5324. instance.props = isSSR ? props : shallowReactive(props);
  5325. } else {
  5326. if (!instance.type.props) {
  5327. instance.props = attrs;
  5328. } else {
  5329. instance.props = props;
  5330. }
  5331. }
  5332. instance.attrs = attrs;
  5333. }
  5334. function isInHmrContext(instance) {
  5335. while (instance) {
  5336. if (instance.type.__hmrId)
  5337. return true;
  5338. instance = instance.parent;
  5339. }
  5340. }
  5341. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5342. const {
  5343. props,
  5344. attrs,
  5345. vnode: {patchFlag}
  5346. } = instance;
  5347. const rawCurrentProps = toRaw(props);
  5348. const [options] = instance.propsOptions;
  5349. let hasAttrsChanged = false;
  5350. if (
  5351. // always force full diff in dev
  5352. // - #1942 if hmr is enabled with sfc component
  5353. // - vite#872 non-sfc component used by sfc component
  5354. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5355. ) {
  5356. if (patchFlag & 8) {
  5357. const propsToUpdate = instance.vnode.dynamicProps;
  5358. for (let i = 0; i < propsToUpdate.length; i++) {
  5359. let key = propsToUpdate[i];
  5360. if (isEmitListener(instance.emitsOptions, key)) {
  5361. continue;
  5362. }
  5363. const value = rawProps[key];
  5364. if (options) {
  5365. if (hasOwn(attrs, key)) {
  5366. if (value !== attrs[key]) {
  5367. attrs[key] = value;
  5368. hasAttrsChanged = true;
  5369. }
  5370. } else {
  5371. const camelizedKey = camelize(key);
  5372. props[camelizedKey] = resolvePropValue(
  5373. options,
  5374. rawCurrentProps,
  5375. camelizedKey,
  5376. value,
  5377. instance,
  5378. false
  5379. /* isAbsent */
  5380. );
  5381. }
  5382. } else {
  5383. if (value !== attrs[key]) {
  5384. attrs[key] = value;
  5385. hasAttrsChanged = true;
  5386. }
  5387. }
  5388. }
  5389. }
  5390. } else {
  5391. if (setFullProps(instance, rawProps, props, attrs)) {
  5392. hasAttrsChanged = true;
  5393. }
  5394. let kebabKey;
  5395. for (const key in rawCurrentProps) {
  5396. if (!rawProps || // for camelCase
  5397. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5398. // and converted to camelCase (#955)
  5399. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5400. if (options) {
  5401. if (rawPrevProps && // for camelCase
  5402. (rawPrevProps[key] !== void 0 || // for kebab-case
  5403. rawPrevProps[kebabKey] !== void 0)) {
  5404. props[key] = resolvePropValue(
  5405. options,
  5406. rawCurrentProps,
  5407. key,
  5408. void 0,
  5409. instance,
  5410. true
  5411. /* isAbsent */
  5412. );
  5413. }
  5414. } else {
  5415. delete props[key];
  5416. }
  5417. }
  5418. }
  5419. if (attrs !== rawCurrentProps) {
  5420. for (const key in attrs) {
  5421. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5422. delete attrs[key];
  5423. hasAttrsChanged = true;
  5424. }
  5425. }
  5426. }
  5427. }
  5428. if (hasAttrsChanged) {
  5429. trigger(instance, "set", "$attrs");
  5430. }
  5431. {
  5432. validateProps(rawProps || {}, props, instance);
  5433. }
  5434. }
  5435. function setFullProps(instance, rawProps, props, attrs) {
  5436. const [options, needCastKeys] = instance.propsOptions;
  5437. let hasAttrsChanged = false;
  5438. let rawCastValues;
  5439. if (rawProps) {
  5440. for (let key in rawProps) {
  5441. if (isReservedProp(key)) {
  5442. continue;
  5443. }
  5444. const value = rawProps[key];
  5445. let camelKey;
  5446. if (options && hasOwn(options, camelKey = camelize(key))) {
  5447. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5448. props[camelKey] = value;
  5449. } else {
  5450. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5451. }
  5452. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5453. if (!(key in attrs) || value !== attrs[key]) {
  5454. attrs[key] = value;
  5455. hasAttrsChanged = true;
  5456. }
  5457. }
  5458. }
  5459. }
  5460. if (needCastKeys) {
  5461. const rawCurrentProps = toRaw(props);
  5462. const castValues = rawCastValues || EMPTY_OBJ;
  5463. for (let i = 0; i < needCastKeys.length; i++) {
  5464. const key = needCastKeys[i];
  5465. props[key] = resolvePropValue(
  5466. options,
  5467. rawCurrentProps,
  5468. key,
  5469. castValues[key],
  5470. instance,
  5471. !hasOwn(castValues, key)
  5472. );
  5473. }
  5474. }
  5475. return hasAttrsChanged;
  5476. }
  5477. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5478. const opt = options[key];
  5479. if (opt != null) {
  5480. const hasDefault = hasOwn(opt, "default");
  5481. if (hasDefault && value === void 0) {
  5482. const defaultValue = opt.default;
  5483. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5484. const {propsDefaults} = instance;
  5485. if (key in propsDefaults) {
  5486. value = propsDefaults[key];
  5487. } else {
  5488. setCurrentInstance(instance);
  5489. value = propsDefaults[key] = defaultValue.call(
  5490. null,
  5491. props
  5492. );
  5493. unsetCurrentInstance();
  5494. }
  5495. } else {
  5496. value = defaultValue;
  5497. }
  5498. }
  5499. if (opt[0 /* shouldCast */]) {
  5500. if (isAbsent && !hasDefault) {
  5501. value = false;
  5502. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5503. value = true;
  5504. }
  5505. }
  5506. }
  5507. return value;
  5508. }
  5509. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5510. const cache = appContext.propsCache;
  5511. const cached = cache.get(comp);
  5512. if (cached) {
  5513. return cached;
  5514. }
  5515. const raw = comp.props;
  5516. const normalized = {};
  5517. const needCastKeys = [];
  5518. let hasExtends = false;
  5519. if (!isFunction(comp)) {
  5520. const extendProps = (raw2) => {
  5521. hasExtends = true;
  5522. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5523. extend(normalized, props);
  5524. if (keys)
  5525. needCastKeys.push(...keys);
  5526. };
  5527. if (!asMixin && appContext.mixins.length) {
  5528. appContext.mixins.forEach(extendProps);
  5529. }
  5530. if (comp.extends) {
  5531. extendProps(comp.extends);
  5532. }
  5533. if (comp.mixins) {
  5534. comp.mixins.forEach(extendProps);
  5535. }
  5536. }
  5537. if (!raw && !hasExtends) {
  5538. if (isObject(comp)) {
  5539. cache.set(comp, EMPTY_ARR);
  5540. }
  5541. return EMPTY_ARR;
  5542. }
  5543. if (isArray(raw)) {
  5544. for (let i = 0; i < raw.length; i++) {
  5545. if (!isString(raw[i])) {
  5546. warn(`props must be strings when using array syntax.`, raw[i]);
  5547. }
  5548. const normalizedKey = camelize(raw[i]);
  5549. if (validatePropName(normalizedKey)) {
  5550. normalized[normalizedKey] = EMPTY_OBJ;
  5551. }
  5552. }
  5553. } else if (raw) {
  5554. if (!isObject(raw)) {
  5555. warn(`invalid props options`, raw);
  5556. }
  5557. for (const key in raw) {
  5558. const normalizedKey = camelize(key);
  5559. if (validatePropName(normalizedKey)) {
  5560. const opt = raw[key];
  5561. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? {type: opt} : extend({}, opt);
  5562. if (prop) {
  5563. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5564. const stringIndex = getTypeIndex(String, prop.type);
  5565. prop[0 /* shouldCast */] = booleanIndex > -1;
  5566. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5567. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5568. needCastKeys.push(normalizedKey);
  5569. }
  5570. }
  5571. }
  5572. }
  5573. }
  5574. const res = [normalized, needCastKeys];
  5575. if (isObject(comp)) {
  5576. cache.set(comp, res);
  5577. }
  5578. return res;
  5579. }
  5580. function validatePropName(key) {
  5581. if (key[0] !== "$") {
  5582. return true;
  5583. } else {
  5584. warn(`Invalid prop name: "${key}" is a reserved property.`);
  5585. }
  5586. return false;
  5587. }
  5588. function getType(ctor) {
  5589. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  5590. return match ? match[2] : ctor === null ? "null" : "";
  5591. }
  5592. function isSameType(a, b) {
  5593. return getType(a) === getType(b);
  5594. }
  5595. function getTypeIndex(type, expectedTypes) {
  5596. if (isArray(expectedTypes)) {
  5597. return expectedTypes.findIndex((t) => isSameType(t, type));
  5598. } else if (isFunction(expectedTypes)) {
  5599. return isSameType(expectedTypes, type) ? 0 : -1;
  5600. }
  5601. return -1;
  5602. }
  5603. function validateProps(rawProps, props, instance) {
  5604. const resolvedValues = toRaw(props);
  5605. const options = instance.propsOptions[0];
  5606. for (const key in options) {
  5607. let opt = options[key];
  5608. if (opt == null)
  5609. continue;
  5610. validateProp(
  5611. key,
  5612. resolvedValues[key],
  5613. opt,
  5614. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5615. );
  5616. }
  5617. }
  5618. function validateProp(name, value, prop, isAbsent) {
  5619. const {type, required, validator, skipCheck} = prop;
  5620. if (required && isAbsent) {
  5621. warn('Missing required prop: "' + name + '"');
  5622. return;
  5623. }
  5624. if (value == null && !required) {
  5625. return;
  5626. }
  5627. if (type != null && type !== true && !skipCheck) {
  5628. let isValid = false;
  5629. const types = isArray(type) ? type : [type];
  5630. const expectedTypes = [];
  5631. for (let i = 0; i < types.length && !isValid; i++) {
  5632. const {valid, expectedType} = assertType(value, types[i]);
  5633. expectedTypes.push(expectedType || "");
  5634. isValid = valid;
  5635. }
  5636. if (!isValid) {
  5637. warn(getInvalidTypeMessage(name, value, expectedTypes));
  5638. return;
  5639. }
  5640. }
  5641. if (validator && !validator(value)) {
  5642. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  5643. }
  5644. }
  5645. const isSimpleType = /* @__PURE__ */ makeMap(
  5646. "String,Number,Boolean,Function,Symbol,BigInt"
  5647. );
  5648. function assertType(value, type) {
  5649. let valid;
  5650. const expectedType = getType(type);
  5651. if (isSimpleType(expectedType)) {
  5652. const t = typeof value;
  5653. valid = t === expectedType.toLowerCase();
  5654. if (!valid && t === "object") {
  5655. valid = value instanceof type;
  5656. }
  5657. } else if (expectedType === "Object") {
  5658. valid = isObject(value);
  5659. } else if (expectedType === "Array") {
  5660. valid = isArray(value);
  5661. } else if (expectedType === "null") {
  5662. valid = value === null;
  5663. } else {
  5664. valid = value instanceof type;
  5665. }
  5666. return {
  5667. valid,
  5668. expectedType
  5669. };
  5670. }
  5671. function getInvalidTypeMessage(name, value, expectedTypes) {
  5672. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5673. const expectedType = expectedTypes[0];
  5674. const receivedType = toRawType(value);
  5675. const expectedValue = styleValue(value, expectedType);
  5676. const receivedValue = styleValue(value, receivedType);
  5677. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5678. message += ` with value ${expectedValue}`;
  5679. }
  5680. message += `, got ${receivedType} `;
  5681. if (isExplicable(receivedType)) {
  5682. message += `with value ${receivedValue}.`;
  5683. }
  5684. return message;
  5685. }
  5686. function styleValue(value, type) {
  5687. if (type === "String") {
  5688. return `"${value}"`;
  5689. } else if (type === "Number") {
  5690. return `${Number(value)}`;
  5691. } else {
  5692. return `${value}`;
  5693. }
  5694. }
  5695. function isExplicable(type) {
  5696. const explicitTypes = ["string", "number", "boolean"];
  5697. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5698. }
  5699. function isBoolean(...args) {
  5700. return args.some((elem) => elem.toLowerCase() === "boolean");
  5701. }
  5702. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5703. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5704. const normalizeSlot = (key, rawSlot, ctx) => {
  5705. if (rawSlot._n) {
  5706. return rawSlot;
  5707. }
  5708. const normalized = withCtx((...args) => {
  5709. if (currentInstance) {
  5710. warn(
  5711. `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.`
  5712. );
  5713. }
  5714. return normalizeSlotValue(rawSlot(...args));
  5715. }, ctx);
  5716. normalized._c = false;
  5717. return normalized;
  5718. };
  5719. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5720. const ctx = rawSlots._ctx;
  5721. for (const key in rawSlots) {
  5722. if (isInternalKey(key))
  5723. continue;
  5724. const value = rawSlots[key];
  5725. if (isFunction(value)) {
  5726. slots[key] = normalizeSlot(key, value, ctx);
  5727. } else if (value != null) {
  5728. {
  5729. warn(
  5730. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5731. );
  5732. }
  5733. const normalized = normalizeSlotValue(value);
  5734. slots[key] = () => normalized;
  5735. }
  5736. }
  5737. };
  5738. const normalizeVNodeSlots = (instance, children) => {
  5739. if (!isKeepAlive(instance.vnode) && true) {
  5740. warn(
  5741. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5742. );
  5743. }
  5744. const normalized = normalizeSlotValue(children);
  5745. instance.slots.default = () => normalized;
  5746. };
  5747. const initSlots = (instance, children) => {
  5748. if (instance.vnode.shapeFlag & 32) {
  5749. const type = children._;
  5750. if (type) {
  5751. instance.slots = toRaw(children);
  5752. def(children, "_", type);
  5753. } else {
  5754. normalizeObjectSlots(
  5755. children,
  5756. instance.slots = {});
  5757. }
  5758. } else {
  5759. instance.slots = {};
  5760. if (children) {
  5761. normalizeVNodeSlots(instance, children);
  5762. }
  5763. }
  5764. def(instance.slots, InternalObjectKey, 1);
  5765. };
  5766. const updateSlots = (instance, children, optimized) => {
  5767. const {vnode, slots} = instance;
  5768. let needDeletionCheck = true;
  5769. let deletionComparisonTarget = EMPTY_OBJ;
  5770. if (vnode.shapeFlag & 32) {
  5771. const type = children._;
  5772. if (type) {
  5773. if (isHmrUpdating) {
  5774. extend(slots, children);
  5775. trigger(instance, "set", "$slots");
  5776. } else if (optimized && type === 1) {
  5777. needDeletionCheck = false;
  5778. } else {
  5779. extend(slots, children);
  5780. if (!optimized && type === 1) {
  5781. delete slots._;
  5782. }
  5783. }
  5784. } else {
  5785. needDeletionCheck = !children.$stable;
  5786. normalizeObjectSlots(children, slots);
  5787. }
  5788. deletionComparisonTarget = children;
  5789. } else if (children) {
  5790. normalizeVNodeSlots(instance, children);
  5791. deletionComparisonTarget = {default: 1};
  5792. }
  5793. if (needDeletionCheck) {
  5794. for (const key in slots) {
  5795. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  5796. delete slots[key];
  5797. }
  5798. }
  5799. }
  5800. };
  5801. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  5802. if (isArray(rawRef)) {
  5803. rawRef.forEach(
  5804. (r, i) => setRef(
  5805. r,
  5806. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  5807. parentSuspense,
  5808. vnode,
  5809. isUnmount
  5810. )
  5811. );
  5812. return;
  5813. }
  5814. if (isAsyncWrapper(vnode) && !isUnmount) {
  5815. return;
  5816. }
  5817. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  5818. const value = isUnmount ? null : refValue;
  5819. const {i: owner, r: ref} = rawRef;
  5820. if (!owner) {
  5821. warn(
  5822. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  5823. );
  5824. return;
  5825. }
  5826. const oldRef = oldRawRef && oldRawRef.r;
  5827. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  5828. const setupState = owner.setupState;
  5829. if (oldRef != null && oldRef !== ref) {
  5830. if (isString(oldRef)) {
  5831. refs[oldRef] = null;
  5832. if (hasOwn(setupState, oldRef)) {
  5833. setupState[oldRef] = null;
  5834. }
  5835. } else if (isRef(oldRef)) {
  5836. oldRef.value = null;
  5837. }
  5838. }
  5839. if (isFunction(ref)) {
  5840. callWithErrorHandling(ref, owner, 12, [value, refs]);
  5841. } else {
  5842. const _isString = isString(ref);
  5843. const _isRef = isRef(ref);
  5844. if (_isString || _isRef) {
  5845. const doSet = () => {
  5846. if (rawRef.f) {
  5847. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  5848. if (isUnmount) {
  5849. isArray(existing) && remove(existing, refValue);
  5850. } else {
  5851. if (!isArray(existing)) {
  5852. if (_isString) {
  5853. refs[ref] = [refValue];
  5854. if (hasOwn(setupState, ref)) {
  5855. setupState[ref] = refs[ref];
  5856. }
  5857. } else {
  5858. ref.value = [refValue];
  5859. if (rawRef.k)
  5860. refs[rawRef.k] = ref.value;
  5861. }
  5862. } else if (!existing.includes(refValue)) {
  5863. existing.push(refValue);
  5864. }
  5865. }
  5866. } else if (_isString) {
  5867. refs[ref] = value;
  5868. if (hasOwn(setupState, ref)) {
  5869. setupState[ref] = value;
  5870. }
  5871. } else if (_isRef) {
  5872. ref.value = value;
  5873. if (rawRef.k)
  5874. refs[rawRef.k] = value;
  5875. } else {
  5876. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5877. }
  5878. };
  5879. if (value) {
  5880. doSet.id = -1;
  5881. queuePostRenderEffect(doSet, parentSuspense);
  5882. } else {
  5883. doSet();
  5884. }
  5885. } else {
  5886. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5887. }
  5888. }
  5889. }
  5890. let hasMismatch = false;
  5891. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  5892. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5893. function createHydrationFunctions(rendererInternals) {
  5894. const {
  5895. mt: mountComponent,
  5896. p: patch,
  5897. o: {
  5898. patchProp,
  5899. createText,
  5900. nextSibling,
  5901. parentNode,
  5902. remove,
  5903. insert,
  5904. createComment
  5905. }
  5906. } = rendererInternals;
  5907. const hydrate = (vnode, container) => {
  5908. if (!container.hasChildNodes()) {
  5909. warn(
  5910. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5911. );
  5912. patch(null, vnode, container);
  5913. flushPostFlushCbs();
  5914. container._vnode = vnode;
  5915. return;
  5916. }
  5917. hasMismatch = false;
  5918. hydrateNode(container.firstChild, vnode, null, null, null);
  5919. flushPostFlushCbs();
  5920. container._vnode = vnode;
  5921. if (hasMismatch && true) {
  5922. console.error(`Hydration completed but contains mismatches.`);
  5923. }
  5924. };
  5925. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5926. const isFragmentStart = isComment(node) && node.data === "[";
  5927. const onMismatch = () => handleMismatch(
  5928. node,
  5929. vnode,
  5930. parentComponent,
  5931. parentSuspense,
  5932. slotScopeIds,
  5933. isFragmentStart
  5934. );
  5935. const {type, ref, shapeFlag, patchFlag} = vnode;
  5936. let domType = node.nodeType;
  5937. vnode.el = node;
  5938. if (patchFlag === -2) {
  5939. optimized = false;
  5940. vnode.dynamicChildren = null;
  5941. }
  5942. let nextNode = null;
  5943. switch (type) {
  5944. case Text:
  5945. if (domType !== 3 /* TEXT */) {
  5946. if (vnode.children === "") {
  5947. insert(vnode.el = createText(""), parentNode(node), node);
  5948. nextNode = node;
  5949. } else {
  5950. nextNode = onMismatch();
  5951. }
  5952. } else {
  5953. if (node.data !== vnode.children) {
  5954. hasMismatch = true;
  5955. warn(
  5956. `Hydration text mismatch:
  5957. - Server rendered: ${JSON.stringify(
  5958. node.data
  5959. )}
  5960. - Client rendered: ${JSON.stringify(vnode.children)}`
  5961. );
  5962. node.data = vnode.children;
  5963. }
  5964. nextNode = nextSibling(node);
  5965. }
  5966. break;
  5967. case Comment:
  5968. if (isTemplateNode(node)) {
  5969. nextNode = nextSibling(node);
  5970. replaceNode(
  5971. vnode.el = node.content.firstChild,
  5972. node,
  5973. parentComponent
  5974. );
  5975. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5976. nextNode = onMismatch();
  5977. } else {
  5978. nextNode = nextSibling(node);
  5979. }
  5980. break;
  5981. case Static:
  5982. if (isFragmentStart) {
  5983. node = nextSibling(node);
  5984. domType = node.nodeType;
  5985. }
  5986. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5987. nextNode = node;
  5988. const needToAdoptContent = !vnode.children.length;
  5989. for (let i = 0; i < vnode.staticCount; i++) {
  5990. if (needToAdoptContent)
  5991. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5992. if (i === vnode.staticCount - 1) {
  5993. vnode.anchor = nextNode;
  5994. }
  5995. nextNode = nextSibling(nextNode);
  5996. }
  5997. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5998. } else {
  5999. onMismatch();
  6000. }
  6001. break;
  6002. case Fragment:
  6003. if (!isFragmentStart) {
  6004. nextNode = onMismatch();
  6005. } else {
  6006. nextNode = hydrateFragment(
  6007. node,
  6008. vnode,
  6009. parentComponent,
  6010. parentSuspense,
  6011. slotScopeIds,
  6012. optimized
  6013. );
  6014. }
  6015. break;
  6016. default:
  6017. if (shapeFlag & 1) {
  6018. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  6019. nextNode = onMismatch();
  6020. } else {
  6021. nextNode = hydrateElement(
  6022. node,
  6023. vnode,
  6024. parentComponent,
  6025. parentSuspense,
  6026. slotScopeIds,
  6027. optimized
  6028. );
  6029. }
  6030. } else if (shapeFlag & 6) {
  6031. vnode.slotScopeIds = slotScopeIds;
  6032. const container = parentNode(node);
  6033. if (isFragmentStart) {
  6034. nextNode = locateClosingAnchor(node);
  6035. } else if (isComment(node) && node.data === "teleport start") {
  6036. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  6037. } else {
  6038. nextNode = nextSibling(node);
  6039. }
  6040. mountComponent(
  6041. vnode,
  6042. container,
  6043. null,
  6044. parentComponent,
  6045. parentSuspense,
  6046. isSVGContainer(container),
  6047. optimized
  6048. );
  6049. if (isAsyncWrapper(vnode)) {
  6050. let subTree;
  6051. if (isFragmentStart) {
  6052. subTree = createVNode(Fragment);
  6053. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  6054. } else {
  6055. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  6056. }
  6057. subTree.el = node;
  6058. vnode.component.subTree = subTree;
  6059. }
  6060. } else if (shapeFlag & 64) {
  6061. if (domType !== 8 /* COMMENT */) {
  6062. nextNode = onMismatch();
  6063. } else {
  6064. nextNode = vnode.type.hydrate(
  6065. node,
  6066. vnode,
  6067. parentComponent,
  6068. parentSuspense,
  6069. slotScopeIds,
  6070. optimized,
  6071. rendererInternals,
  6072. hydrateChildren
  6073. );
  6074. }
  6075. } else if (shapeFlag & 128) {
  6076. nextNode = vnode.type.hydrate(
  6077. node,
  6078. vnode,
  6079. parentComponent,
  6080. parentSuspense,
  6081. isSVGContainer(parentNode(node)),
  6082. slotScopeIds,
  6083. optimized,
  6084. rendererInternals,
  6085. hydrateNode
  6086. );
  6087. } else {
  6088. warn("Invalid HostVNode type:", type, `(${typeof type})`);
  6089. }
  6090. }
  6091. if (ref != null) {
  6092. setRef(ref, null, parentSuspense, vnode);
  6093. }
  6094. return nextNode;
  6095. };
  6096. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6097. optimized = optimized || !!vnode.dynamicChildren;
  6098. const {type, props, patchFlag, shapeFlag, dirs, transition} = vnode;
  6099. const forcePatchValue = type === "input" && dirs || type === "option";
  6100. {
  6101. if (dirs) {
  6102. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6103. }
  6104. if (props) {
  6105. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  6106. for (const key in props) {
  6107. if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
  6108. patchProp(
  6109. el,
  6110. key,
  6111. null,
  6112. props[key],
  6113. false,
  6114. void 0,
  6115. parentComponent
  6116. );
  6117. }
  6118. }
  6119. } else if (props.onClick) {
  6120. patchProp(
  6121. el,
  6122. "onClick",
  6123. null,
  6124. props.onClick,
  6125. false,
  6126. void 0,
  6127. parentComponent
  6128. );
  6129. }
  6130. }
  6131. let vnodeHooks;
  6132. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6133. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6134. }
  6135. let needCallTransitionHooks = false;
  6136. if (isTemplateNode(el)) {
  6137. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  6138. const content = el.content.firstChild;
  6139. if (needCallTransitionHooks) {
  6140. transition.beforeEnter(content);
  6141. }
  6142. replaceNode(content, el, parentComponent);
  6143. vnode.el = el = content;
  6144. }
  6145. if (dirs) {
  6146. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6147. }
  6148. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  6149. queueEffectWithSuspense(() => {
  6150. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6151. needCallTransitionHooks && transition.enter(el);
  6152. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6153. }, parentSuspense);
  6154. }
  6155. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6156. !(props && (props.innerHTML || props.textContent))) {
  6157. let next = hydrateChildren(
  6158. el.firstChild,
  6159. vnode,
  6160. el,
  6161. parentComponent,
  6162. parentSuspense,
  6163. slotScopeIds,
  6164. optimized
  6165. );
  6166. let hasWarned = false;
  6167. while (next) {
  6168. hasMismatch = true;
  6169. if (!hasWarned) {
  6170. warn(
  6171. `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
  6172. );
  6173. hasWarned = true;
  6174. }
  6175. const cur = next;
  6176. next = next.nextSibling;
  6177. remove(cur);
  6178. }
  6179. } else if (shapeFlag & 8) {
  6180. if (el.textContent !== vnode.children) {
  6181. hasMismatch = true;
  6182. warn(
  6183. `Hydration text content mismatch in <${vnode.type}>:
  6184. - Server rendered: ${el.textContent}
  6185. - Client rendered: ${vnode.children}`
  6186. );
  6187. el.textContent = vnode.children;
  6188. }
  6189. }
  6190. }
  6191. return el.nextSibling;
  6192. };
  6193. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6194. optimized = optimized || !!parentVNode.dynamicChildren;
  6195. const children = parentVNode.children;
  6196. const l = children.length;
  6197. let hasWarned = false;
  6198. for (let i = 0; i < l; i++) {
  6199. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6200. if (node) {
  6201. node = hydrateNode(
  6202. node,
  6203. vnode,
  6204. parentComponent,
  6205. parentSuspense,
  6206. slotScopeIds,
  6207. optimized
  6208. );
  6209. } else if (vnode.type === Text && !vnode.children) {
  6210. continue;
  6211. } else {
  6212. hasMismatch = true;
  6213. if (!hasWarned) {
  6214. warn(
  6215. `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
  6216. );
  6217. hasWarned = true;
  6218. }
  6219. patch(
  6220. null,
  6221. vnode,
  6222. container,
  6223. null,
  6224. parentComponent,
  6225. parentSuspense,
  6226. isSVGContainer(container),
  6227. slotScopeIds
  6228. );
  6229. }
  6230. }
  6231. return node;
  6232. };
  6233. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6234. const {slotScopeIds: fragmentSlotScopeIds} = vnode;
  6235. if (fragmentSlotScopeIds) {
  6236. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6237. }
  6238. const container = parentNode(node);
  6239. const next = hydrateChildren(
  6240. nextSibling(node),
  6241. vnode,
  6242. container,
  6243. parentComponent,
  6244. parentSuspense,
  6245. slotScopeIds,
  6246. optimized
  6247. );
  6248. if (next && isComment(next) && next.data === "]") {
  6249. return nextSibling(vnode.anchor = next);
  6250. } else {
  6251. hasMismatch = true;
  6252. insert(vnode.anchor = createComment(`]`), container, next);
  6253. return next;
  6254. }
  6255. };
  6256. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6257. hasMismatch = true;
  6258. warn(
  6259. `Hydration node mismatch:
  6260. - Client vnode:`,
  6261. vnode.type,
  6262. `
  6263. - Server rendered DOM:`,
  6264. node,
  6265. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
  6266. );
  6267. vnode.el = null;
  6268. if (isFragment) {
  6269. const end = locateClosingAnchor(node);
  6270. while (true) {
  6271. const next2 = nextSibling(node);
  6272. if (next2 && next2 !== end) {
  6273. remove(next2);
  6274. } else {
  6275. break;
  6276. }
  6277. }
  6278. }
  6279. const next = nextSibling(node);
  6280. const container = parentNode(node);
  6281. remove(node);
  6282. patch(
  6283. null,
  6284. vnode,
  6285. container,
  6286. next,
  6287. parentComponent,
  6288. parentSuspense,
  6289. isSVGContainer(container),
  6290. slotScopeIds
  6291. );
  6292. return next;
  6293. };
  6294. const locateClosingAnchor = (node, open = "[", close = "]") => {
  6295. let match = 0;
  6296. while (node) {
  6297. node = nextSibling(node);
  6298. if (node && isComment(node)) {
  6299. if (node.data === open)
  6300. match++;
  6301. if (node.data === close) {
  6302. if (match === 0) {
  6303. return nextSibling(node);
  6304. } else {
  6305. match--;
  6306. }
  6307. }
  6308. }
  6309. }
  6310. return node;
  6311. };
  6312. const replaceNode = (newNode, oldNode, parentComponent) => {
  6313. const parentNode2 = oldNode.parentNode;
  6314. if (parentNode2) {
  6315. parentNode2.replaceChild(newNode, oldNode);
  6316. }
  6317. let parent = parentComponent;
  6318. while (parent) {
  6319. if (parent.vnode.el === oldNode) {
  6320. parent.vnode.el = parent.subTree.el = newNode;
  6321. }
  6322. parent = parent.parent;
  6323. }
  6324. };
  6325. const isTemplateNode = (node) => {
  6326. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  6327. };
  6328. return [hydrate, hydrateNode];
  6329. }
  6330. let supported;
  6331. let perf;
  6332. function startMeasure(instance, type) {
  6333. if (instance.appContext.config.performance && isSupported()) {
  6334. perf.mark(`vue-${type}-${instance.uid}`);
  6335. }
  6336. {
  6337. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6338. }
  6339. }
  6340. function endMeasure(instance, type) {
  6341. if (instance.appContext.config.performance && isSupported()) {
  6342. const startTag = `vue-${type}-${instance.uid}`;
  6343. const endTag = startTag + `:end`;
  6344. perf.mark(endTag);
  6345. perf.measure(
  6346. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6347. startTag,
  6348. endTag
  6349. );
  6350. perf.clearMarks(startTag);
  6351. perf.clearMarks(endTag);
  6352. }
  6353. {
  6354. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6355. }
  6356. }
  6357. function isSupported() {
  6358. if (supported !== void 0) {
  6359. return supported;
  6360. }
  6361. if (typeof window !== "undefined" && window.performance) {
  6362. supported = true;
  6363. perf = window.performance;
  6364. } else {
  6365. supported = false;
  6366. }
  6367. return supported;
  6368. }
  6369. const queuePostRenderEffect = queueEffectWithSuspense;
  6370. function createRenderer(options) {
  6371. return baseCreateRenderer(options);
  6372. }
  6373. function createHydrationRenderer(options) {
  6374. return baseCreateRenderer(options, createHydrationFunctions);
  6375. }
  6376. function baseCreateRenderer(options, createHydrationFns) {
  6377. const target = getGlobalThis();
  6378. target.__VUE__ = true;
  6379. {
  6380. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6381. }
  6382. const {
  6383. insert: hostInsert,
  6384. remove: hostRemove,
  6385. patchProp: hostPatchProp,
  6386. createElement: hostCreateElement,
  6387. createText: hostCreateText,
  6388. createComment: hostCreateComment,
  6389. setText: hostSetText,
  6390. setElementText: hostSetElementText,
  6391. parentNode: hostParentNode,
  6392. nextSibling: hostNextSibling,
  6393. setScopeId: hostSetScopeId = NOOP,
  6394. insertStaticContent: hostInsertStaticContent
  6395. } = options;
  6396. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6397. if (n1 === n2) {
  6398. return;
  6399. }
  6400. if (n1 && !isSameVNodeType(n1, n2)) {
  6401. anchor = getNextHostNode(n1);
  6402. unmount(n1, parentComponent, parentSuspense, true);
  6403. n1 = null;
  6404. }
  6405. if (n2.patchFlag === -2) {
  6406. optimized = false;
  6407. n2.dynamicChildren = null;
  6408. }
  6409. const {type, ref, shapeFlag} = n2;
  6410. switch (type) {
  6411. case Text:
  6412. processText(n1, n2, container, anchor);
  6413. break;
  6414. case Comment:
  6415. processCommentNode(n1, n2, container, anchor);
  6416. break;
  6417. case Static:
  6418. if (n1 == null) {
  6419. mountStaticNode(n2, container, anchor, isSVG);
  6420. } else {
  6421. patchStaticNode(n1, n2, container, isSVG);
  6422. }
  6423. break;
  6424. case Fragment:
  6425. processFragment(
  6426. n1,
  6427. n2,
  6428. container,
  6429. anchor,
  6430. parentComponent,
  6431. parentSuspense,
  6432. isSVG,
  6433. slotScopeIds,
  6434. optimized
  6435. );
  6436. break;
  6437. default:
  6438. if (shapeFlag & 1) {
  6439. processElement(
  6440. n1,
  6441. n2,
  6442. container,
  6443. anchor,
  6444. parentComponent,
  6445. parentSuspense,
  6446. isSVG,
  6447. slotScopeIds,
  6448. optimized
  6449. );
  6450. } else if (shapeFlag & 6) {
  6451. processComponent(
  6452. n1,
  6453. n2,
  6454. container,
  6455. anchor,
  6456. parentComponent,
  6457. parentSuspense,
  6458. isSVG,
  6459. slotScopeIds,
  6460. optimized
  6461. );
  6462. } else if (shapeFlag & 64) {
  6463. type.process(
  6464. n1,
  6465. n2,
  6466. container,
  6467. anchor,
  6468. parentComponent,
  6469. parentSuspense,
  6470. isSVG,
  6471. slotScopeIds,
  6472. optimized,
  6473. internals
  6474. );
  6475. } else if (shapeFlag & 128) {
  6476. type.process(
  6477. n1,
  6478. n2,
  6479. container,
  6480. anchor,
  6481. parentComponent,
  6482. parentSuspense,
  6483. isSVG,
  6484. slotScopeIds,
  6485. optimized,
  6486. internals
  6487. );
  6488. } else {
  6489. warn("Invalid VNode type:", type, `(${typeof type})`);
  6490. }
  6491. }
  6492. if (ref != null && parentComponent) {
  6493. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6494. }
  6495. };
  6496. const processText = (n1, n2, container, anchor) => {
  6497. if (n1 == null) {
  6498. hostInsert(
  6499. n2.el = hostCreateText(n2.children),
  6500. container,
  6501. anchor
  6502. );
  6503. } else {
  6504. const el = n2.el = n1.el;
  6505. if (n2.children !== n1.children) {
  6506. hostSetText(el, n2.children);
  6507. }
  6508. }
  6509. };
  6510. const processCommentNode = (n1, n2, container, anchor) => {
  6511. if (n1 == null) {
  6512. hostInsert(
  6513. n2.el = hostCreateComment(n2.children || ""),
  6514. container,
  6515. anchor
  6516. );
  6517. } else {
  6518. n2.el = n1.el;
  6519. }
  6520. };
  6521. const mountStaticNode = (n2, container, anchor, isSVG) => {
  6522. [n2.el, n2.anchor] = hostInsertStaticContent(
  6523. n2.children,
  6524. container,
  6525. anchor,
  6526. isSVG,
  6527. n2.el,
  6528. n2.anchor
  6529. );
  6530. };
  6531. const patchStaticNode = (n1, n2, container, isSVG) => {
  6532. if (n2.children !== n1.children) {
  6533. const anchor = hostNextSibling(n1.anchor);
  6534. removeStaticNode(n1);
  6535. [n2.el, n2.anchor] = hostInsertStaticContent(
  6536. n2.children,
  6537. container,
  6538. anchor,
  6539. isSVG
  6540. );
  6541. } else {
  6542. n2.el = n1.el;
  6543. n2.anchor = n1.anchor;
  6544. }
  6545. };
  6546. const moveStaticNode = ({el, anchor}, container, nextSibling) => {
  6547. let next;
  6548. while (el && el !== anchor) {
  6549. next = hostNextSibling(el);
  6550. hostInsert(el, container, nextSibling);
  6551. el = next;
  6552. }
  6553. hostInsert(anchor, container, nextSibling);
  6554. };
  6555. const removeStaticNode = ({el, anchor}) => {
  6556. let next;
  6557. while (el && el !== anchor) {
  6558. next = hostNextSibling(el);
  6559. hostRemove(el);
  6560. el = next;
  6561. }
  6562. hostRemove(anchor);
  6563. };
  6564. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6565. isSVG = isSVG || n2.type === "svg";
  6566. if (n1 == null) {
  6567. mountElement(
  6568. n2,
  6569. container,
  6570. anchor,
  6571. parentComponent,
  6572. parentSuspense,
  6573. isSVG,
  6574. slotScopeIds,
  6575. optimized
  6576. );
  6577. } else {
  6578. patchElement(
  6579. n1,
  6580. n2,
  6581. parentComponent,
  6582. parentSuspense,
  6583. isSVG,
  6584. slotScopeIds,
  6585. optimized
  6586. );
  6587. }
  6588. };
  6589. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6590. let el;
  6591. let vnodeHook;
  6592. const {type, props, shapeFlag, transition, dirs} = vnode;
  6593. el = vnode.el = hostCreateElement(
  6594. vnode.type,
  6595. isSVG,
  6596. props && props.is,
  6597. props
  6598. );
  6599. if (shapeFlag & 8) {
  6600. hostSetElementText(el, vnode.children);
  6601. } else if (shapeFlag & 16) {
  6602. mountChildren(
  6603. vnode.children,
  6604. el,
  6605. null,
  6606. parentComponent,
  6607. parentSuspense,
  6608. isSVG && type !== "foreignObject",
  6609. slotScopeIds,
  6610. optimized
  6611. );
  6612. }
  6613. if (dirs) {
  6614. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6615. }
  6616. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6617. if (props) {
  6618. for (const key in props) {
  6619. if (key !== "value" && !isReservedProp(key)) {
  6620. hostPatchProp(
  6621. el,
  6622. key,
  6623. null,
  6624. props[key],
  6625. isSVG,
  6626. vnode.children,
  6627. parentComponent,
  6628. parentSuspense,
  6629. unmountChildren
  6630. );
  6631. }
  6632. }
  6633. if ("value" in props) {
  6634. hostPatchProp(el, "value", null, props.value);
  6635. }
  6636. if (vnodeHook = props.onVnodeBeforeMount) {
  6637. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6638. }
  6639. }
  6640. {
  6641. Object.defineProperty(el, "__vnode", {
  6642. value: vnode,
  6643. enumerable: false
  6644. });
  6645. Object.defineProperty(el, "__vueParentComponent", {
  6646. value: parentComponent,
  6647. enumerable: false
  6648. });
  6649. }
  6650. if (dirs) {
  6651. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6652. }
  6653. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6654. if (needCallTransitionHooks) {
  6655. transition.beforeEnter(el);
  6656. }
  6657. hostInsert(el, container, anchor);
  6658. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6659. queuePostRenderEffect(() => {
  6660. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6661. needCallTransitionHooks && transition.enter(el);
  6662. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6663. }, parentSuspense);
  6664. }
  6665. };
  6666. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6667. if (scopeId) {
  6668. hostSetScopeId(el, scopeId);
  6669. }
  6670. if (slotScopeIds) {
  6671. for (let i = 0; i < slotScopeIds.length; i++) {
  6672. hostSetScopeId(el, slotScopeIds[i]);
  6673. }
  6674. }
  6675. if (parentComponent) {
  6676. let subTree = parentComponent.subTree;
  6677. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6678. subTree = filterSingleRoot(subTree.children) || subTree;
  6679. }
  6680. if (vnode === subTree) {
  6681. const parentVNode = parentComponent.vnode;
  6682. setScopeId(
  6683. el,
  6684. parentVNode,
  6685. parentVNode.scopeId,
  6686. parentVNode.slotScopeIds,
  6687. parentComponent.parent
  6688. );
  6689. }
  6690. }
  6691. };
  6692. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  6693. for (let i = start; i < children.length; i++) {
  6694. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6695. patch(
  6696. null,
  6697. child,
  6698. container,
  6699. anchor,
  6700. parentComponent,
  6701. parentSuspense,
  6702. isSVG,
  6703. slotScopeIds,
  6704. optimized
  6705. );
  6706. }
  6707. };
  6708. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6709. const el = n2.el = n1.el;
  6710. let {patchFlag, dynamicChildren, dirs} = n2;
  6711. patchFlag |= n1.patchFlag & 16;
  6712. const oldProps = n1.props || EMPTY_OBJ;
  6713. const newProps = n2.props || EMPTY_OBJ;
  6714. let vnodeHook;
  6715. parentComponent && toggleRecurse(parentComponent, false);
  6716. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6717. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6718. }
  6719. if (dirs) {
  6720. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6721. }
  6722. parentComponent && toggleRecurse(parentComponent, true);
  6723. if (isHmrUpdating) {
  6724. patchFlag = 0;
  6725. optimized = false;
  6726. dynamicChildren = null;
  6727. }
  6728. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  6729. if (dynamicChildren) {
  6730. patchBlockChildren(
  6731. n1.dynamicChildren,
  6732. dynamicChildren,
  6733. el,
  6734. parentComponent,
  6735. parentSuspense,
  6736. areChildrenSVG,
  6737. slotScopeIds
  6738. );
  6739. {
  6740. traverseStaticChildren(n1, n2);
  6741. }
  6742. } else if (!optimized) {
  6743. patchChildren(
  6744. n1,
  6745. n2,
  6746. el,
  6747. null,
  6748. parentComponent,
  6749. parentSuspense,
  6750. areChildrenSVG,
  6751. slotScopeIds,
  6752. false
  6753. );
  6754. }
  6755. if (patchFlag > 0) {
  6756. if (patchFlag & 16) {
  6757. patchProps(
  6758. el,
  6759. n2,
  6760. oldProps,
  6761. newProps,
  6762. parentComponent,
  6763. parentSuspense,
  6764. isSVG
  6765. );
  6766. } else {
  6767. if (patchFlag & 2) {
  6768. if (oldProps.class !== newProps.class) {
  6769. hostPatchProp(el, "class", null, newProps.class, isSVG);
  6770. }
  6771. }
  6772. if (patchFlag & 4) {
  6773. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  6774. }
  6775. if (patchFlag & 8) {
  6776. const propsToUpdate = n2.dynamicProps;
  6777. for (let i = 0; i < propsToUpdate.length; i++) {
  6778. const key = propsToUpdate[i];
  6779. const prev = oldProps[key];
  6780. const next = newProps[key];
  6781. if (next !== prev || key === "value") {
  6782. hostPatchProp(
  6783. el,
  6784. key,
  6785. prev,
  6786. next,
  6787. isSVG,
  6788. n1.children,
  6789. parentComponent,
  6790. parentSuspense,
  6791. unmountChildren
  6792. );
  6793. }
  6794. }
  6795. }
  6796. }
  6797. if (patchFlag & 1) {
  6798. if (n1.children !== n2.children) {
  6799. hostSetElementText(el, n2.children);
  6800. }
  6801. }
  6802. } else if (!optimized && dynamicChildren == null) {
  6803. patchProps(
  6804. el,
  6805. n2,
  6806. oldProps,
  6807. newProps,
  6808. parentComponent,
  6809. parentSuspense,
  6810. isSVG
  6811. );
  6812. }
  6813. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6814. queuePostRenderEffect(() => {
  6815. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6816. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6817. }, parentSuspense);
  6818. }
  6819. };
  6820. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  6821. for (let i = 0; i < newChildren.length; i++) {
  6822. const oldVNode = oldChildren[i];
  6823. const newVNode = newChildren[i];
  6824. const container = (
  6825. // oldVNode may be an errored async setup() component inside Suspense
  6826. // which will not have a mounted element
  6827. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6828. // of the Fragment itself so it can move its children.
  6829. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6830. // which also requires the correct parent container
  6831. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6832. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6833. // In other cases, the parent container is not actually used so we
  6834. // just pass the block element here to avoid a DOM parentNode call.
  6835. fallbackContainer
  6836. )
  6837. );
  6838. patch(
  6839. oldVNode,
  6840. newVNode,
  6841. container,
  6842. null,
  6843. parentComponent,
  6844. parentSuspense,
  6845. isSVG,
  6846. slotScopeIds,
  6847. true
  6848. );
  6849. }
  6850. };
  6851. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  6852. if (oldProps !== newProps) {
  6853. if (oldProps !== EMPTY_OBJ) {
  6854. for (const key in oldProps) {
  6855. if (!isReservedProp(key) && !(key in newProps)) {
  6856. hostPatchProp(
  6857. el,
  6858. key,
  6859. oldProps[key],
  6860. null,
  6861. isSVG,
  6862. vnode.children,
  6863. parentComponent,
  6864. parentSuspense,
  6865. unmountChildren
  6866. );
  6867. }
  6868. }
  6869. }
  6870. for (const key in newProps) {
  6871. if (isReservedProp(key))
  6872. continue;
  6873. const next = newProps[key];
  6874. const prev = oldProps[key];
  6875. if (next !== prev && key !== "value") {
  6876. hostPatchProp(
  6877. el,
  6878. key,
  6879. prev,
  6880. next,
  6881. isSVG,
  6882. vnode.children,
  6883. parentComponent,
  6884. parentSuspense,
  6885. unmountChildren
  6886. );
  6887. }
  6888. }
  6889. if ("value" in newProps) {
  6890. hostPatchProp(el, "value", oldProps.value, newProps.value);
  6891. }
  6892. }
  6893. };
  6894. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6895. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6896. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6897. let {patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds} = n2;
  6898. if (
  6899. // #5523 dev root fragment may inherit directives
  6900. isHmrUpdating || patchFlag & 2048
  6901. ) {
  6902. patchFlag = 0;
  6903. optimized = false;
  6904. dynamicChildren = null;
  6905. }
  6906. if (fragmentSlotScopeIds) {
  6907. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6908. }
  6909. if (n1 == null) {
  6910. hostInsert(fragmentStartAnchor, container, anchor);
  6911. hostInsert(fragmentEndAnchor, container, anchor);
  6912. mountChildren(
  6913. n2.children,
  6914. container,
  6915. fragmentEndAnchor,
  6916. parentComponent,
  6917. parentSuspense,
  6918. isSVG,
  6919. slotScopeIds,
  6920. optimized
  6921. );
  6922. } else {
  6923. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6924. // of renderSlot() with no valid children
  6925. n1.dynamicChildren) {
  6926. patchBlockChildren(
  6927. n1.dynamicChildren,
  6928. dynamicChildren,
  6929. container,
  6930. parentComponent,
  6931. parentSuspense,
  6932. isSVG,
  6933. slotScopeIds
  6934. );
  6935. {
  6936. traverseStaticChildren(n1, n2);
  6937. }
  6938. } else {
  6939. patchChildren(
  6940. n1,
  6941. n2,
  6942. container,
  6943. fragmentEndAnchor,
  6944. parentComponent,
  6945. parentSuspense,
  6946. isSVG,
  6947. slotScopeIds,
  6948. optimized
  6949. );
  6950. }
  6951. }
  6952. };
  6953. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6954. n2.slotScopeIds = slotScopeIds;
  6955. if (n1 == null) {
  6956. if (n2.shapeFlag & 512) {
  6957. parentComponent.ctx.activate(
  6958. n2,
  6959. container,
  6960. anchor,
  6961. isSVG,
  6962. optimized
  6963. );
  6964. } else {
  6965. mountComponent(
  6966. n2,
  6967. container,
  6968. anchor,
  6969. parentComponent,
  6970. parentSuspense,
  6971. isSVG,
  6972. optimized
  6973. );
  6974. }
  6975. } else {
  6976. updateComponent(n1, n2, optimized);
  6977. }
  6978. };
  6979. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  6980. const instance = (initialVNode.component = createComponentInstance(
  6981. initialVNode,
  6982. parentComponent,
  6983. parentSuspense
  6984. ));
  6985. if (instance.type.__hmrId) {
  6986. registerHMR(instance);
  6987. }
  6988. {
  6989. pushWarningContext(initialVNode);
  6990. startMeasure(instance, `mount`);
  6991. }
  6992. if (isKeepAlive(initialVNode)) {
  6993. instance.ctx.renderer = internals;
  6994. }
  6995. {
  6996. {
  6997. startMeasure(instance, `init`);
  6998. }
  6999. setupComponent(instance);
  7000. {
  7001. endMeasure(instance, `init`);
  7002. }
  7003. }
  7004. if (instance.asyncDep) {
  7005. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  7006. if (!initialVNode.el) {
  7007. const placeholder = instance.subTree = createVNode(Comment);
  7008. processCommentNode(null, placeholder, container, anchor);
  7009. }
  7010. return;
  7011. }
  7012. setupRenderEffect(
  7013. instance,
  7014. initialVNode,
  7015. container,
  7016. anchor,
  7017. parentSuspense,
  7018. isSVG,
  7019. optimized
  7020. );
  7021. {
  7022. popWarningContext();
  7023. endMeasure(instance, `mount`);
  7024. }
  7025. };
  7026. const updateComponent = (n1, n2, optimized) => {
  7027. const instance = n2.component = n1.component;
  7028. if (shouldUpdateComponent(n1, n2, optimized)) {
  7029. if (instance.asyncDep && !instance.asyncResolved) {
  7030. {
  7031. pushWarningContext(n2);
  7032. }
  7033. updateComponentPreRender(instance, n2, optimized);
  7034. {
  7035. popWarningContext();
  7036. }
  7037. return;
  7038. } else {
  7039. instance.next = n2;
  7040. invalidateJob(instance.update);
  7041. instance.update();
  7042. }
  7043. } else {
  7044. n2.el = n1.el;
  7045. instance.vnode = n2;
  7046. }
  7047. };
  7048. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  7049. const componentUpdateFn = () => {
  7050. if (!instance.isMounted) {
  7051. let vnodeHook;
  7052. const {el, props} = initialVNode;
  7053. const {bm, m, parent} = instance;
  7054. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7055. toggleRecurse(instance, false);
  7056. if (bm) {
  7057. invokeArrayFns(bm);
  7058. }
  7059. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7060. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7061. }
  7062. toggleRecurse(instance, true);
  7063. if (el && hydrateNode) {
  7064. const hydrateSubTree = () => {
  7065. {
  7066. startMeasure(instance, `render`);
  7067. }
  7068. instance.subTree = renderComponentRoot(instance);
  7069. {
  7070. endMeasure(instance, `render`);
  7071. }
  7072. {
  7073. startMeasure(instance, `hydrate`);
  7074. }
  7075. hydrateNode(
  7076. el,
  7077. instance.subTree,
  7078. instance,
  7079. parentSuspense,
  7080. null
  7081. );
  7082. {
  7083. endMeasure(instance, `hydrate`);
  7084. }
  7085. };
  7086. if (isAsyncWrapperVNode) {
  7087. initialVNode.type.__asyncLoader().then(
  7088. // note: we are moving the render call into an async callback,
  7089. // which means it won't track dependencies - but it's ok because
  7090. // a server-rendered async wrapper is already in resolved state
  7091. // and it will never need to change.
  7092. () => !instance.isUnmounted && hydrateSubTree()
  7093. );
  7094. } else {
  7095. hydrateSubTree();
  7096. }
  7097. } else {
  7098. {
  7099. startMeasure(instance, `render`);
  7100. }
  7101. const subTree = instance.subTree = renderComponentRoot(instance);
  7102. {
  7103. endMeasure(instance, `render`);
  7104. }
  7105. {
  7106. startMeasure(instance, `patch`);
  7107. }
  7108. patch(
  7109. null,
  7110. subTree,
  7111. container,
  7112. anchor,
  7113. instance,
  7114. parentSuspense,
  7115. isSVG
  7116. );
  7117. {
  7118. endMeasure(instance, `patch`);
  7119. }
  7120. initialVNode.el = subTree.el;
  7121. }
  7122. if (m) {
  7123. queuePostRenderEffect(m, parentSuspense);
  7124. }
  7125. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7126. const scopedInitialVNode = initialVNode;
  7127. queuePostRenderEffect(
  7128. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7129. parentSuspense
  7130. );
  7131. }
  7132. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7133. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7134. }
  7135. instance.isMounted = true;
  7136. {
  7137. devtoolsComponentAdded(instance);
  7138. }
  7139. initialVNode = container = anchor = null;
  7140. } else {
  7141. let {next, bu, u, parent, vnode} = instance;
  7142. let originNext = next;
  7143. let vnodeHook;
  7144. {
  7145. pushWarningContext(next || instance.vnode);
  7146. }
  7147. toggleRecurse(instance, false);
  7148. if (next) {
  7149. next.el = vnode.el;
  7150. updateComponentPreRender(instance, next, optimized);
  7151. } else {
  7152. next = vnode;
  7153. }
  7154. if (bu) {
  7155. invokeArrayFns(bu);
  7156. }
  7157. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7158. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7159. }
  7160. toggleRecurse(instance, true);
  7161. {
  7162. startMeasure(instance, `render`);
  7163. }
  7164. const nextTree = renderComponentRoot(instance);
  7165. {
  7166. endMeasure(instance, `render`);
  7167. }
  7168. const prevTree = instance.subTree;
  7169. instance.subTree = nextTree;
  7170. {
  7171. startMeasure(instance, `patch`);
  7172. }
  7173. patch(
  7174. prevTree,
  7175. nextTree,
  7176. // parent may have changed if it's in a teleport
  7177. hostParentNode(prevTree.el),
  7178. // anchor may have changed if it's in a fragment
  7179. getNextHostNode(prevTree),
  7180. instance,
  7181. parentSuspense,
  7182. isSVG
  7183. );
  7184. {
  7185. endMeasure(instance, `patch`);
  7186. }
  7187. next.el = nextTree.el;
  7188. if (originNext === null) {
  7189. updateHOCHostEl(instance, nextTree.el);
  7190. }
  7191. if (u) {
  7192. queuePostRenderEffect(u, parentSuspense);
  7193. }
  7194. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7195. queuePostRenderEffect(
  7196. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7197. parentSuspense
  7198. );
  7199. }
  7200. {
  7201. devtoolsComponentUpdated(instance);
  7202. }
  7203. {
  7204. popWarningContext();
  7205. }
  7206. }
  7207. };
  7208. const effect = instance.effect = new ReactiveEffect(
  7209. componentUpdateFn,
  7210. () => queueJob(update),
  7211. instance.scope
  7212. // track it in component's effect scope
  7213. );
  7214. const update = instance.update = () => effect.run();
  7215. update.id = instance.uid;
  7216. toggleRecurse(instance, true);
  7217. {
  7218. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7219. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7220. update.ownerInstance = instance;
  7221. }
  7222. update();
  7223. };
  7224. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7225. nextVNode.component = instance;
  7226. const prevProps = instance.vnode.props;
  7227. instance.vnode = nextVNode;
  7228. instance.next = null;
  7229. updateProps(instance, nextVNode.props, prevProps, optimized);
  7230. updateSlots(instance, nextVNode.children, optimized);
  7231. pauseTracking();
  7232. flushPreFlushCbs();
  7233. resetTracking();
  7234. };
  7235. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  7236. const c1 = n1 && n1.children;
  7237. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7238. const c2 = n2.children;
  7239. const {patchFlag, shapeFlag} = n2;
  7240. if (patchFlag > 0) {
  7241. if (patchFlag & 128) {
  7242. patchKeyedChildren(
  7243. c1,
  7244. c2,
  7245. container,
  7246. anchor,
  7247. parentComponent,
  7248. parentSuspense,
  7249. isSVG,
  7250. slotScopeIds,
  7251. optimized
  7252. );
  7253. return;
  7254. } else if (patchFlag & 256) {
  7255. patchUnkeyedChildren(
  7256. c1,
  7257. c2,
  7258. container,
  7259. anchor,
  7260. parentComponent,
  7261. parentSuspense,
  7262. isSVG,
  7263. slotScopeIds,
  7264. optimized
  7265. );
  7266. return;
  7267. }
  7268. }
  7269. if (shapeFlag & 8) {
  7270. if (prevShapeFlag & 16) {
  7271. unmountChildren(c1, parentComponent, parentSuspense);
  7272. }
  7273. if (c2 !== c1) {
  7274. hostSetElementText(container, c2);
  7275. }
  7276. } else {
  7277. if (prevShapeFlag & 16) {
  7278. if (shapeFlag & 16) {
  7279. patchKeyedChildren(
  7280. c1,
  7281. c2,
  7282. container,
  7283. anchor,
  7284. parentComponent,
  7285. parentSuspense,
  7286. isSVG,
  7287. slotScopeIds,
  7288. optimized
  7289. );
  7290. } else {
  7291. unmountChildren(c1, parentComponent, parentSuspense, true);
  7292. }
  7293. } else {
  7294. if (prevShapeFlag & 8) {
  7295. hostSetElementText(container, "");
  7296. }
  7297. if (shapeFlag & 16) {
  7298. mountChildren(
  7299. c2,
  7300. container,
  7301. anchor,
  7302. parentComponent,
  7303. parentSuspense,
  7304. isSVG,
  7305. slotScopeIds,
  7306. optimized
  7307. );
  7308. }
  7309. }
  7310. }
  7311. };
  7312. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7313. c1 = c1 || EMPTY_ARR;
  7314. c2 = c2 || EMPTY_ARR;
  7315. const oldLength = c1.length;
  7316. const newLength = c2.length;
  7317. const commonLength = Math.min(oldLength, newLength);
  7318. let i;
  7319. for (i = 0; i < commonLength; i++) {
  7320. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7321. patch(
  7322. c1[i],
  7323. nextChild,
  7324. container,
  7325. null,
  7326. parentComponent,
  7327. parentSuspense,
  7328. isSVG,
  7329. slotScopeIds,
  7330. optimized
  7331. );
  7332. }
  7333. if (oldLength > newLength) {
  7334. unmountChildren(
  7335. c1,
  7336. parentComponent,
  7337. parentSuspense,
  7338. true,
  7339. false,
  7340. commonLength
  7341. );
  7342. } else {
  7343. mountChildren(
  7344. c2,
  7345. container,
  7346. anchor,
  7347. parentComponent,
  7348. parentSuspense,
  7349. isSVG,
  7350. slotScopeIds,
  7351. optimized,
  7352. commonLength
  7353. );
  7354. }
  7355. };
  7356. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7357. let i = 0;
  7358. const l2 = c2.length;
  7359. let e1 = c1.length - 1;
  7360. let e2 = l2 - 1;
  7361. while (i <= e1 && i <= e2) {
  7362. const n1 = c1[i];
  7363. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7364. if (isSameVNodeType(n1, n2)) {
  7365. patch(
  7366. n1,
  7367. n2,
  7368. container,
  7369. null,
  7370. parentComponent,
  7371. parentSuspense,
  7372. isSVG,
  7373. slotScopeIds,
  7374. optimized
  7375. );
  7376. } else {
  7377. break;
  7378. }
  7379. i++;
  7380. }
  7381. while (i <= e1 && i <= e2) {
  7382. const n1 = c1[e1];
  7383. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7384. if (isSameVNodeType(n1, n2)) {
  7385. patch(
  7386. n1,
  7387. n2,
  7388. container,
  7389. null,
  7390. parentComponent,
  7391. parentSuspense,
  7392. isSVG,
  7393. slotScopeIds,
  7394. optimized
  7395. );
  7396. } else {
  7397. break;
  7398. }
  7399. e1--;
  7400. e2--;
  7401. }
  7402. if (i > e1) {
  7403. if (i <= e2) {
  7404. const nextPos = e2 + 1;
  7405. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7406. while (i <= e2) {
  7407. patch(
  7408. null,
  7409. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7410. container,
  7411. anchor,
  7412. parentComponent,
  7413. parentSuspense,
  7414. isSVG,
  7415. slotScopeIds,
  7416. optimized
  7417. );
  7418. i++;
  7419. }
  7420. }
  7421. } else if (i > e2) {
  7422. while (i <= e1) {
  7423. unmount(c1[i], parentComponent, parentSuspense, true);
  7424. i++;
  7425. }
  7426. } else {
  7427. const s1 = i;
  7428. const s2 = i;
  7429. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7430. for (i = s2; i <= e2; i++) {
  7431. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7432. if (nextChild.key != null) {
  7433. if (keyToNewIndexMap.has(nextChild.key)) {
  7434. warn(
  7435. `Duplicate keys found during update:`,
  7436. JSON.stringify(nextChild.key),
  7437. `Make sure keys are unique.`
  7438. );
  7439. }
  7440. keyToNewIndexMap.set(nextChild.key, i);
  7441. }
  7442. }
  7443. let j;
  7444. let patched = 0;
  7445. const toBePatched = e2 - s2 + 1;
  7446. let moved = false;
  7447. let maxNewIndexSoFar = 0;
  7448. const newIndexToOldIndexMap = new Array(toBePatched);
  7449. for (i = 0; i < toBePatched; i++)
  7450. newIndexToOldIndexMap[i] = 0;
  7451. for (i = s1; i <= e1; i++) {
  7452. const prevChild = c1[i];
  7453. if (patched >= toBePatched) {
  7454. unmount(prevChild, parentComponent, parentSuspense, true);
  7455. continue;
  7456. }
  7457. let newIndex;
  7458. if (prevChild.key != null) {
  7459. newIndex = keyToNewIndexMap.get(prevChild.key);
  7460. } else {
  7461. for (j = s2; j <= e2; j++) {
  7462. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7463. newIndex = j;
  7464. break;
  7465. }
  7466. }
  7467. }
  7468. if (newIndex === void 0) {
  7469. unmount(prevChild, parentComponent, parentSuspense, true);
  7470. } else {
  7471. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7472. if (newIndex >= maxNewIndexSoFar) {
  7473. maxNewIndexSoFar = newIndex;
  7474. } else {
  7475. moved = true;
  7476. }
  7477. patch(
  7478. prevChild,
  7479. c2[newIndex],
  7480. container,
  7481. null,
  7482. parentComponent,
  7483. parentSuspense,
  7484. isSVG,
  7485. slotScopeIds,
  7486. optimized
  7487. );
  7488. patched++;
  7489. }
  7490. }
  7491. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7492. j = increasingNewIndexSequence.length - 1;
  7493. for (i = toBePatched - 1; i >= 0; i--) {
  7494. const nextIndex = s2 + i;
  7495. const nextChild = c2[nextIndex];
  7496. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7497. if (newIndexToOldIndexMap[i] === 0) {
  7498. patch(
  7499. null,
  7500. nextChild,
  7501. container,
  7502. anchor,
  7503. parentComponent,
  7504. parentSuspense,
  7505. isSVG,
  7506. slotScopeIds,
  7507. optimized
  7508. );
  7509. } else if (moved) {
  7510. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7511. move(nextChild, container, anchor, 2);
  7512. } else {
  7513. j--;
  7514. }
  7515. }
  7516. }
  7517. }
  7518. };
  7519. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7520. const {el, type, transition, children, shapeFlag} = vnode;
  7521. if (shapeFlag & 6) {
  7522. move(vnode.component.subTree, container, anchor, moveType);
  7523. return;
  7524. }
  7525. if (shapeFlag & 128) {
  7526. vnode.suspense.move(container, anchor, moveType);
  7527. return;
  7528. }
  7529. if (shapeFlag & 64) {
  7530. type.move(vnode, container, anchor, internals);
  7531. return;
  7532. }
  7533. if (type === Fragment) {
  7534. hostInsert(el, container, anchor);
  7535. for (let i = 0; i < children.length; i++) {
  7536. move(children[i], container, anchor, moveType);
  7537. }
  7538. hostInsert(vnode.anchor, container, anchor);
  7539. return;
  7540. }
  7541. if (type === Static) {
  7542. moveStaticNode(vnode, container, anchor);
  7543. return;
  7544. }
  7545. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7546. if (needTransition2) {
  7547. if (moveType === 0) {
  7548. transition.beforeEnter(el);
  7549. hostInsert(el, container, anchor);
  7550. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7551. } else {
  7552. const {leave, delayLeave, afterLeave} = transition;
  7553. const remove2 = () => hostInsert(el, container, anchor);
  7554. const performLeave = () => {
  7555. leave(el, () => {
  7556. remove2();
  7557. afterLeave && afterLeave();
  7558. });
  7559. };
  7560. if (delayLeave) {
  7561. delayLeave(el, remove2, performLeave);
  7562. } else {
  7563. performLeave();
  7564. }
  7565. }
  7566. } else {
  7567. hostInsert(el, container, anchor);
  7568. }
  7569. };
  7570. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7571. const {
  7572. type,
  7573. props,
  7574. ref,
  7575. children,
  7576. dynamicChildren,
  7577. shapeFlag,
  7578. patchFlag,
  7579. dirs
  7580. } = vnode;
  7581. if (ref != null) {
  7582. setRef(ref, null, parentSuspense, vnode, true);
  7583. }
  7584. if (shapeFlag & 256) {
  7585. parentComponent.ctx.deactivate(vnode);
  7586. return;
  7587. }
  7588. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7589. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7590. let vnodeHook;
  7591. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7592. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7593. }
  7594. if (shapeFlag & 6) {
  7595. unmountComponent(vnode.component, parentSuspense, doRemove);
  7596. } else {
  7597. if (shapeFlag & 128) {
  7598. vnode.suspense.unmount(parentSuspense, doRemove);
  7599. return;
  7600. }
  7601. if (shouldInvokeDirs) {
  7602. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7603. }
  7604. if (shapeFlag & 64) {
  7605. vnode.type.remove(
  7606. vnode,
  7607. parentComponent,
  7608. parentSuspense,
  7609. optimized,
  7610. internals,
  7611. doRemove
  7612. );
  7613. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7614. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7615. unmountChildren(
  7616. dynamicChildren,
  7617. parentComponent,
  7618. parentSuspense,
  7619. false,
  7620. true
  7621. );
  7622. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7623. unmountChildren(children, parentComponent, parentSuspense);
  7624. }
  7625. if (doRemove) {
  7626. remove(vnode);
  7627. }
  7628. }
  7629. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7630. queuePostRenderEffect(() => {
  7631. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7632. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7633. }, parentSuspense);
  7634. }
  7635. };
  7636. const remove = (vnode) => {
  7637. const {type, el, anchor, transition} = vnode;
  7638. if (type === Fragment) {
  7639. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7640. vnode.children.forEach((child) => {
  7641. if (child.type === Comment) {
  7642. hostRemove(child.el);
  7643. } else {
  7644. remove(child);
  7645. }
  7646. });
  7647. } else {
  7648. removeFragment(el, anchor);
  7649. }
  7650. return;
  7651. }
  7652. if (type === Static) {
  7653. removeStaticNode(vnode);
  7654. return;
  7655. }
  7656. const performRemove = () => {
  7657. hostRemove(el);
  7658. if (transition && !transition.persisted && transition.afterLeave) {
  7659. transition.afterLeave();
  7660. }
  7661. };
  7662. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7663. const {leave, delayLeave} = transition;
  7664. const performLeave = () => leave(el, performRemove);
  7665. if (delayLeave) {
  7666. delayLeave(vnode.el, performRemove, performLeave);
  7667. } else {
  7668. performLeave();
  7669. }
  7670. } else {
  7671. performRemove();
  7672. }
  7673. };
  7674. const removeFragment = (cur, end) => {
  7675. let next;
  7676. while (cur !== end) {
  7677. next = hostNextSibling(cur);
  7678. hostRemove(cur);
  7679. cur = next;
  7680. }
  7681. hostRemove(end);
  7682. };
  7683. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7684. if (instance.type.__hmrId) {
  7685. unregisterHMR(instance);
  7686. }
  7687. const {bum, scope, update, subTree, um} = instance;
  7688. if (bum) {
  7689. invokeArrayFns(bum);
  7690. }
  7691. scope.stop();
  7692. if (update) {
  7693. update.active = false;
  7694. unmount(subTree, instance, parentSuspense, doRemove);
  7695. }
  7696. if (um) {
  7697. queuePostRenderEffect(um, parentSuspense);
  7698. }
  7699. queuePostRenderEffect(() => {
  7700. instance.isUnmounted = true;
  7701. }, parentSuspense);
  7702. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7703. parentSuspense.deps--;
  7704. if (parentSuspense.deps === 0) {
  7705. parentSuspense.resolve();
  7706. }
  7707. }
  7708. {
  7709. devtoolsComponentRemoved(instance);
  7710. }
  7711. };
  7712. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7713. for (let i = start; i < children.length; i++) {
  7714. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7715. }
  7716. };
  7717. const getNextHostNode = (vnode) => {
  7718. if (vnode.shapeFlag & 6) {
  7719. return getNextHostNode(vnode.component.subTree);
  7720. }
  7721. if (vnode.shapeFlag & 128) {
  7722. return vnode.suspense.next();
  7723. }
  7724. return hostNextSibling(vnode.anchor || vnode.el);
  7725. };
  7726. const render = (vnode, container, isSVG) => {
  7727. if (vnode == null) {
  7728. if (container._vnode) {
  7729. unmount(container._vnode, null, null, true);
  7730. }
  7731. } else {
  7732. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  7733. }
  7734. flushPreFlushCbs();
  7735. flushPostFlushCbs();
  7736. container._vnode = vnode;
  7737. };
  7738. const internals = {
  7739. p: patch,
  7740. um: unmount,
  7741. m: move,
  7742. r: remove,
  7743. mt: mountComponent,
  7744. mc: mountChildren,
  7745. pc: patchChildren,
  7746. pbc: patchBlockChildren,
  7747. n: getNextHostNode,
  7748. o: options
  7749. };
  7750. let hydrate;
  7751. let hydrateNode;
  7752. if (createHydrationFns) {
  7753. [hydrate, hydrateNode] = createHydrationFns(
  7754. internals
  7755. );
  7756. }
  7757. return {
  7758. render,
  7759. hydrate,
  7760. createApp: createAppAPI(render, hydrate)
  7761. };
  7762. }
  7763. function toggleRecurse({effect, update}, allowed) {
  7764. effect.allowRecurse = update.allowRecurse = allowed;
  7765. }
  7766. function needTransition(parentSuspense, transition) {
  7767. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  7768. }
  7769. function traverseStaticChildren(n1, n2, shallow = false) {
  7770. const ch1 = n1.children;
  7771. const ch2 = n2.children;
  7772. if (isArray(ch1) && isArray(ch2)) {
  7773. for (let i = 0; i < ch1.length; i++) {
  7774. const c1 = ch1[i];
  7775. let c2 = ch2[i];
  7776. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7777. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7778. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7779. c2.el = c1.el;
  7780. }
  7781. if (!shallow)
  7782. traverseStaticChildren(c1, c2);
  7783. }
  7784. if (c2.type === Text) {
  7785. c2.el = c1.el;
  7786. }
  7787. if (c2.type === Comment && !c2.el) {
  7788. c2.el = c1.el;
  7789. }
  7790. }
  7791. }
  7792. }
  7793. function getSequence(arr) {
  7794. const p = arr.slice();
  7795. const result = [0];
  7796. let i, j, u, v, c;
  7797. const len = arr.length;
  7798. for (i = 0; i < len; i++) {
  7799. const arrI = arr[i];
  7800. if (arrI !== 0) {
  7801. j = result[result.length - 1];
  7802. if (arr[j] < arrI) {
  7803. p[i] = j;
  7804. result.push(i);
  7805. continue;
  7806. }
  7807. u = 0;
  7808. v = result.length - 1;
  7809. while (u < v) {
  7810. c = u + v >> 1;
  7811. if (arr[result[c]] < arrI) {
  7812. u = c + 1;
  7813. } else {
  7814. v = c;
  7815. }
  7816. }
  7817. if (arrI < arr[result[u]]) {
  7818. if (u > 0) {
  7819. p[i] = result[u - 1];
  7820. }
  7821. result[u] = i;
  7822. }
  7823. }
  7824. }
  7825. u = result.length;
  7826. v = result[u - 1];
  7827. while (u-- > 0) {
  7828. result[u] = v;
  7829. v = p[v];
  7830. }
  7831. return result;
  7832. }
  7833. const isTeleport = (type) => type.__isTeleport;
  7834. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  7835. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  7836. const resolveTarget = (props, select) => {
  7837. const targetSelector = props && props.to;
  7838. if (isString(targetSelector)) {
  7839. if (!select) {
  7840. warn(
  7841. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  7842. );
  7843. return null;
  7844. } else {
  7845. const target = select(targetSelector);
  7846. if (!target) {
  7847. warn(
  7848. `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.`
  7849. );
  7850. }
  7851. return target;
  7852. }
  7853. } else {
  7854. if (!targetSelector && !isTeleportDisabled(props)) {
  7855. warn(`Invalid Teleport target: ${targetSelector}`);
  7856. }
  7857. return targetSelector;
  7858. }
  7859. };
  7860. const TeleportImpl = {
  7861. __isTeleport: true,
  7862. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  7863. const {
  7864. mc: mountChildren,
  7865. pc: patchChildren,
  7866. pbc: patchBlockChildren,
  7867. o: {insert, querySelector, createText, createComment}
  7868. } = internals;
  7869. const disabled = isTeleportDisabled(n2.props);
  7870. let {shapeFlag, children, dynamicChildren} = n2;
  7871. if (isHmrUpdating) {
  7872. optimized = false;
  7873. dynamicChildren = null;
  7874. }
  7875. if (n1 == null) {
  7876. const placeholder = n2.el = createComment("teleport start");
  7877. const mainAnchor = n2.anchor = createComment("teleport end");
  7878. insert(placeholder, container, anchor);
  7879. insert(mainAnchor, container, anchor);
  7880. const target = n2.target = resolveTarget(n2.props, querySelector);
  7881. const targetAnchor = n2.targetAnchor = createText("");
  7882. if (target) {
  7883. insert(targetAnchor, target);
  7884. isSVG = isSVG || isTargetSVG(target);
  7885. } else if (!disabled) {
  7886. warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
  7887. }
  7888. const mount = (container2, anchor2) => {
  7889. if (shapeFlag & 16) {
  7890. mountChildren(
  7891. children,
  7892. container2,
  7893. anchor2,
  7894. parentComponent,
  7895. parentSuspense,
  7896. isSVG,
  7897. slotScopeIds,
  7898. optimized
  7899. );
  7900. }
  7901. };
  7902. if (disabled) {
  7903. mount(container, mainAnchor);
  7904. } else if (target) {
  7905. mount(target, targetAnchor);
  7906. }
  7907. } else {
  7908. n2.el = n1.el;
  7909. const mainAnchor = n2.anchor = n1.anchor;
  7910. const target = n2.target = n1.target;
  7911. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  7912. const wasDisabled = isTeleportDisabled(n1.props);
  7913. const currentContainer = wasDisabled ? container : target;
  7914. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  7915. isSVG = isSVG || isTargetSVG(target);
  7916. if (dynamicChildren) {
  7917. patchBlockChildren(
  7918. n1.dynamicChildren,
  7919. dynamicChildren,
  7920. currentContainer,
  7921. parentComponent,
  7922. parentSuspense,
  7923. isSVG,
  7924. slotScopeIds
  7925. );
  7926. traverseStaticChildren(n1, n2, true);
  7927. } else if (!optimized) {
  7928. patchChildren(
  7929. n1,
  7930. n2,
  7931. currentContainer,
  7932. currentAnchor,
  7933. parentComponent,
  7934. parentSuspense,
  7935. isSVG,
  7936. slotScopeIds,
  7937. false
  7938. );
  7939. }
  7940. if (disabled) {
  7941. if (!wasDisabled) {
  7942. moveTeleport(
  7943. n2,
  7944. container,
  7945. mainAnchor,
  7946. internals,
  7947. 1
  7948. );
  7949. } else {
  7950. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  7951. n2.props.to = n1.props.to;
  7952. }
  7953. }
  7954. } else {
  7955. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  7956. const nextTarget = n2.target = resolveTarget(
  7957. n2.props,
  7958. querySelector
  7959. );
  7960. if (nextTarget) {
  7961. moveTeleport(
  7962. n2,
  7963. nextTarget,
  7964. null,
  7965. internals,
  7966. 0
  7967. );
  7968. } else {
  7969. warn(
  7970. "Invalid Teleport target on update:",
  7971. target,
  7972. `(${typeof target})`
  7973. );
  7974. }
  7975. } else if (wasDisabled) {
  7976. moveTeleport(
  7977. n2,
  7978. target,
  7979. targetAnchor,
  7980. internals,
  7981. 1
  7982. );
  7983. }
  7984. }
  7985. }
  7986. updateCssVars(n2);
  7987. },
  7988. remove(vnode, parentComponent, parentSuspense, optimized, {um: unmount, o: {remove: hostRemove}}, doRemove) {
  7989. const {shapeFlag, children, anchor, targetAnchor, target, props} = vnode;
  7990. if (target) {
  7991. hostRemove(targetAnchor);
  7992. }
  7993. doRemove && hostRemove(anchor);
  7994. if (shapeFlag & 16) {
  7995. const shouldRemove = doRemove || !isTeleportDisabled(props);
  7996. for (let i = 0; i < children.length; i++) {
  7997. const child = children[i];
  7998. unmount(
  7999. child,
  8000. parentComponent,
  8001. parentSuspense,
  8002. shouldRemove,
  8003. !!child.dynamicChildren
  8004. );
  8005. }
  8006. }
  8007. },
  8008. move: moveTeleport,
  8009. hydrate: hydrateTeleport
  8010. };
  8011. function moveTeleport(vnode, container, parentAnchor, {o: {insert}, m: move}, moveType = 2) {
  8012. if (moveType === 0) {
  8013. insert(vnode.targetAnchor, container, parentAnchor);
  8014. }
  8015. const {el, anchor, shapeFlag, children, props} = vnode;
  8016. const isReorder = moveType === 2;
  8017. if (isReorder) {
  8018. insert(el, container, parentAnchor);
  8019. }
  8020. if (!isReorder || isTeleportDisabled(props)) {
  8021. if (shapeFlag & 16) {
  8022. for (let i = 0; i < children.length; i++) {
  8023. move(
  8024. children[i],
  8025. container,
  8026. parentAnchor,
  8027. 2
  8028. );
  8029. }
  8030. }
  8031. }
  8032. if (isReorder) {
  8033. insert(anchor, container, parentAnchor);
  8034. }
  8035. }
  8036. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  8037. o: {nextSibling, parentNode, querySelector}
  8038. }, hydrateChildren) {
  8039. const target = vnode.target = resolveTarget(
  8040. vnode.props,
  8041. querySelector
  8042. );
  8043. if (target) {
  8044. const targetNode = target._lpa || target.firstChild;
  8045. if (vnode.shapeFlag & 16) {
  8046. if (isTeleportDisabled(vnode.props)) {
  8047. vnode.anchor = hydrateChildren(
  8048. nextSibling(node),
  8049. vnode,
  8050. parentNode(node),
  8051. parentComponent,
  8052. parentSuspense,
  8053. slotScopeIds,
  8054. optimized
  8055. );
  8056. vnode.targetAnchor = targetNode;
  8057. } else {
  8058. vnode.anchor = nextSibling(node);
  8059. let targetAnchor = targetNode;
  8060. while (targetAnchor) {
  8061. targetAnchor = nextSibling(targetAnchor);
  8062. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  8063. vnode.targetAnchor = targetAnchor;
  8064. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  8065. break;
  8066. }
  8067. }
  8068. hydrateChildren(
  8069. targetNode,
  8070. vnode,
  8071. target,
  8072. parentComponent,
  8073. parentSuspense,
  8074. slotScopeIds,
  8075. optimized
  8076. );
  8077. }
  8078. }
  8079. updateCssVars(vnode);
  8080. }
  8081. return vnode.anchor && nextSibling(vnode.anchor);
  8082. }
  8083. const Teleport = TeleportImpl;
  8084. function updateCssVars(vnode) {
  8085. const ctx = vnode.ctx;
  8086. if (ctx && ctx.ut) {
  8087. let node = vnode.children[0].el;
  8088. while (node && node !== vnode.targetAnchor) {
  8089. if (node.nodeType === 1)
  8090. node.setAttribute("data-v-owner", ctx.uid);
  8091. node = node.nextSibling;
  8092. }
  8093. ctx.ut();
  8094. }
  8095. }
  8096. const Fragment = Symbol.for("v-fgt");
  8097. const Text = Symbol.for("v-txt");
  8098. const Comment = Symbol.for("v-cmt");
  8099. const Static = Symbol.for("v-stc");
  8100. const blockStack = [];
  8101. let currentBlock = null;
  8102. function openBlock(disableTracking = false) {
  8103. blockStack.push(currentBlock = disableTracking ? null : []);
  8104. }
  8105. function closeBlock() {
  8106. blockStack.pop();
  8107. currentBlock = blockStack[blockStack.length - 1] || null;
  8108. }
  8109. let isBlockTreeEnabled = 1;
  8110. function setBlockTracking(value) {
  8111. isBlockTreeEnabled += value;
  8112. }
  8113. function setupBlock(vnode) {
  8114. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8115. closeBlock();
  8116. if (isBlockTreeEnabled > 0 && currentBlock) {
  8117. currentBlock.push(vnode);
  8118. }
  8119. return vnode;
  8120. }
  8121. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8122. return setupBlock(
  8123. createBaseVNode(
  8124. type,
  8125. props,
  8126. children,
  8127. patchFlag,
  8128. dynamicProps,
  8129. shapeFlag,
  8130. true
  8131. /* isBlock */
  8132. )
  8133. );
  8134. }
  8135. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8136. return setupBlock(
  8137. createVNode(
  8138. type,
  8139. props,
  8140. children,
  8141. patchFlag,
  8142. dynamicProps,
  8143. true
  8144. /* isBlock: prevent a block from tracking itself */
  8145. )
  8146. );
  8147. }
  8148. function isVNode(value) {
  8149. return value ? value.__v_isVNode === true : false;
  8150. }
  8151. function isSameVNodeType(n1, n2) {
  8152. if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  8153. n1.shapeFlag &= ~256;
  8154. n2.shapeFlag &= ~512;
  8155. return false;
  8156. }
  8157. return n1.type === n2.type && n1.key === n2.key;
  8158. }
  8159. let vnodeArgsTransformer;
  8160. function transformVNodeArgs(transformer) {
  8161. vnodeArgsTransformer = transformer;
  8162. }
  8163. const createVNodeWithArgsTransform = (...args) => {
  8164. return _createVNode(
  8165. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8166. );
  8167. };
  8168. const InternalObjectKey = `__vInternal`;
  8169. const normalizeKey = ({key}) => key != null ? key : null;
  8170. const normalizeRef = ({
  8171. ref,
  8172. ref_key,
  8173. ref_for
  8174. }) => {
  8175. if (typeof ref === "number") {
  8176. ref = "" + ref;
  8177. }
  8178. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? {
  8179. i: currentRenderingInstance,
  8180. r: ref,
  8181. k: ref_key,
  8182. f: !!ref_for
  8183. } : ref : null;
  8184. };
  8185. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8186. const vnode = {
  8187. __v_isVNode: true,
  8188. __v_skip: true,
  8189. type,
  8190. props,
  8191. key: props && normalizeKey(props),
  8192. ref: props && normalizeRef(props),
  8193. scopeId: currentScopeId,
  8194. slotScopeIds: null,
  8195. children,
  8196. component: null,
  8197. suspense: null,
  8198. ssContent: null,
  8199. ssFallback: null,
  8200. dirs: null,
  8201. transition: null,
  8202. el: null,
  8203. anchor: null,
  8204. target: null,
  8205. targetAnchor: null,
  8206. staticCount: 0,
  8207. shapeFlag,
  8208. patchFlag,
  8209. dynamicProps,
  8210. dynamicChildren: null,
  8211. appContext: null,
  8212. ctx: currentRenderingInstance
  8213. };
  8214. if (needFullChildrenNormalization) {
  8215. normalizeChildren(vnode, children);
  8216. if (shapeFlag & 128) {
  8217. type.normalize(vnode);
  8218. }
  8219. } else if (children) {
  8220. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8221. }
  8222. if (vnode.key !== vnode.key) {
  8223. warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8224. }
  8225. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8226. !isBlockNode && // has current parent block
  8227. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8228. // component nodes also should always be patched, because even if the
  8229. // component doesn't need to update, it needs to persist the instance on to
  8230. // the next vnode so that it can be properly unmounted later.
  8231. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8232. // vnode should not be considered dynamic due to handler caching.
  8233. vnode.patchFlag !== 32) {
  8234. currentBlock.push(vnode);
  8235. }
  8236. return vnode;
  8237. }
  8238. const createVNode = createVNodeWithArgsTransform;
  8239. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8240. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8241. if (!type) {
  8242. warn(`Invalid vnode type when creating vnode: ${type}.`);
  8243. }
  8244. type = Comment;
  8245. }
  8246. if (isVNode(type)) {
  8247. const cloned = cloneVNode(
  8248. type,
  8249. props,
  8250. true
  8251. /* mergeRef: true */
  8252. );
  8253. if (children) {
  8254. normalizeChildren(cloned, children);
  8255. }
  8256. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8257. if (cloned.shapeFlag & 6) {
  8258. currentBlock[currentBlock.indexOf(type)] = cloned;
  8259. } else {
  8260. currentBlock.push(cloned);
  8261. }
  8262. }
  8263. cloned.patchFlag |= -2;
  8264. return cloned;
  8265. }
  8266. if (isClassComponent(type)) {
  8267. type = type.__vccOpts;
  8268. }
  8269. if (props) {
  8270. props = guardReactiveProps(props);
  8271. let {class: klass, style} = props;
  8272. if (klass && !isString(klass)) {
  8273. props.class = normalizeClass(klass);
  8274. }
  8275. if (isObject(style)) {
  8276. if (isProxy(style) && !isArray(style)) {
  8277. style = extend({}, style);
  8278. }
  8279. props.style = normalizeStyle(style);
  8280. }
  8281. }
  8282. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8283. if (shapeFlag & 4 && isProxy(type)) {
  8284. type = toRaw(type);
  8285. warn(
  8286. `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\`.`,
  8287. `
  8288. Component that was made reactive: `,
  8289. type
  8290. );
  8291. }
  8292. return createBaseVNode(
  8293. type,
  8294. props,
  8295. children,
  8296. patchFlag,
  8297. dynamicProps,
  8298. shapeFlag,
  8299. isBlockNode,
  8300. true
  8301. );
  8302. }
  8303. function guardReactiveProps(props) {
  8304. if (!props)
  8305. return null;
  8306. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  8307. }
  8308. function cloneVNode(vnode, extraProps, mergeRef = false) {
  8309. const {props, ref, patchFlag, children} = vnode;
  8310. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8311. const cloned = {
  8312. __v_isVNode: true,
  8313. __v_skip: true,
  8314. type: vnode.type,
  8315. props: mergedProps,
  8316. key: mergedProps && normalizeKey(mergedProps),
  8317. ref: extraProps && extraProps.ref ? (
  8318. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8319. // if the vnode itself already has a ref, cloneVNode will need to merge
  8320. // the refs so the single vnode can be set on multiple refs
  8321. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8322. ) : ref,
  8323. scopeId: vnode.scopeId,
  8324. slotScopeIds: vnode.slotScopeIds,
  8325. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8326. target: vnode.target,
  8327. targetAnchor: vnode.targetAnchor,
  8328. staticCount: vnode.staticCount,
  8329. shapeFlag: vnode.shapeFlag,
  8330. // if the vnode is cloned with extra props, we can no longer assume its
  8331. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8332. // note: preserve flag for fragments since they use the flag for children
  8333. // fast paths only.
  8334. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8335. dynamicProps: vnode.dynamicProps,
  8336. dynamicChildren: vnode.dynamicChildren,
  8337. appContext: vnode.appContext,
  8338. dirs: vnode.dirs,
  8339. transition: vnode.transition,
  8340. // These should technically only be non-null on mounted VNodes. However,
  8341. // they *should* be copied for kept-alive vnodes. So we just always copy
  8342. // them since them being non-null during a mount doesn't affect the logic as
  8343. // they will simply be overwritten.
  8344. component: vnode.component,
  8345. suspense: vnode.suspense,
  8346. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8347. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8348. el: vnode.el,
  8349. anchor: vnode.anchor,
  8350. ctx: vnode.ctx,
  8351. ce: vnode.ce
  8352. };
  8353. return cloned;
  8354. }
  8355. function deepCloneVNode(vnode) {
  8356. const cloned = cloneVNode(vnode);
  8357. if (isArray(vnode.children)) {
  8358. cloned.children = vnode.children.map(deepCloneVNode);
  8359. }
  8360. return cloned;
  8361. }
  8362. function createTextVNode(text = " ", flag = 0) {
  8363. return createVNode(Text, null, text, flag);
  8364. }
  8365. function createStaticVNode(content, numberOfNodes) {
  8366. const vnode = createVNode(Static, null, content);
  8367. vnode.staticCount = numberOfNodes;
  8368. return vnode;
  8369. }
  8370. function createCommentVNode(text = "", asBlock = false) {
  8371. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8372. }
  8373. function normalizeVNode(child) {
  8374. if (child == null || typeof child === "boolean") {
  8375. return createVNode(Comment);
  8376. } else if (isArray(child)) {
  8377. return createVNode(
  8378. Fragment,
  8379. null,
  8380. // #3666, avoid reference pollution when reusing vnode
  8381. child.slice()
  8382. );
  8383. } else if (typeof child === "object") {
  8384. return cloneIfMounted(child);
  8385. } else {
  8386. return createVNode(Text, null, String(child));
  8387. }
  8388. }
  8389. function cloneIfMounted(child) {
  8390. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8391. }
  8392. function normalizeChildren(vnode, children) {
  8393. let type = 0;
  8394. const {shapeFlag} = vnode;
  8395. if (children == null) {
  8396. children = null;
  8397. } else if (isArray(children)) {
  8398. type = 16;
  8399. } else if (typeof children === "object") {
  8400. if (shapeFlag & (1 | 64)) {
  8401. const slot = children.default;
  8402. if (slot) {
  8403. slot._c && (slot._d = false);
  8404. normalizeChildren(vnode, slot());
  8405. slot._c && (slot._d = true);
  8406. }
  8407. return;
  8408. } else {
  8409. type = 32;
  8410. const slotFlag = children._;
  8411. if (!slotFlag && !(InternalObjectKey in children)) {
  8412. children._ctx = currentRenderingInstance;
  8413. } else if (slotFlag === 3 && currentRenderingInstance) {
  8414. if (currentRenderingInstance.slots._ === 1) {
  8415. children._ = 1;
  8416. } else {
  8417. children._ = 2;
  8418. vnode.patchFlag |= 1024;
  8419. }
  8420. }
  8421. }
  8422. } else if (isFunction(children)) {
  8423. children = {default: children, _ctx: currentRenderingInstance};
  8424. type = 32;
  8425. } else {
  8426. children = String(children);
  8427. if (shapeFlag & 64) {
  8428. type = 16;
  8429. children = [createTextVNode(children)];
  8430. } else {
  8431. type = 8;
  8432. }
  8433. }
  8434. vnode.children = children;
  8435. vnode.shapeFlag |= type;
  8436. }
  8437. function mergeProps(...args) {
  8438. const ret = {};
  8439. for (let i = 0; i < args.length; i++) {
  8440. const toMerge = args[i];
  8441. for (const key in toMerge) {
  8442. if (key === "class") {
  8443. if (ret.class !== toMerge.class) {
  8444. ret.class = normalizeClass([ret.class, toMerge.class]);
  8445. }
  8446. } else if (key === "style") {
  8447. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8448. } else if (isOn(key)) {
  8449. const existing = ret[key];
  8450. const incoming = toMerge[key];
  8451. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8452. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8453. }
  8454. } else if (key !== "") {
  8455. ret[key] = toMerge[key];
  8456. }
  8457. }
  8458. }
  8459. return ret;
  8460. }
  8461. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8462. callWithAsyncErrorHandling(hook, instance, 7, [
  8463. vnode,
  8464. prevVNode
  8465. ]);
  8466. }
  8467. const emptyAppContext = createAppContext();
  8468. let uid = 0;
  8469. function createComponentInstance(vnode, parent, suspense) {
  8470. const type = vnode.type;
  8471. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8472. const instance = {
  8473. uid: uid++,
  8474. vnode,
  8475. type,
  8476. parent,
  8477. appContext,
  8478. root: null,
  8479. // to be immediately set
  8480. next: null,
  8481. subTree: null,
  8482. // will be set synchronously right after creation
  8483. effect: null,
  8484. update: null,
  8485. // will be set synchronously right after creation
  8486. scope: new EffectScope(
  8487. true
  8488. /* detached */
  8489. ),
  8490. render: null,
  8491. proxy: null,
  8492. exposed: null,
  8493. exposeProxy: null,
  8494. withProxy: null,
  8495. provides: parent ? parent.provides : Object.create(appContext.provides),
  8496. accessCache: null,
  8497. renderCache: [],
  8498. // local resolved assets
  8499. components: null,
  8500. directives: null,
  8501. // resolved props and emits options
  8502. propsOptions: normalizePropsOptions(type, appContext),
  8503. emitsOptions: normalizeEmitsOptions(type, appContext),
  8504. // emit
  8505. emit: null,
  8506. // to be set immediately
  8507. emitted: null,
  8508. // props default value
  8509. propsDefaults: EMPTY_OBJ,
  8510. // inheritAttrs
  8511. inheritAttrs: type.inheritAttrs,
  8512. // state
  8513. ctx: EMPTY_OBJ,
  8514. data: EMPTY_OBJ,
  8515. props: EMPTY_OBJ,
  8516. attrs: EMPTY_OBJ,
  8517. slots: EMPTY_OBJ,
  8518. refs: EMPTY_OBJ,
  8519. setupState: EMPTY_OBJ,
  8520. setupContext: null,
  8521. attrsProxy: null,
  8522. slotsProxy: null,
  8523. // suspense related
  8524. suspense,
  8525. suspenseId: suspense ? suspense.pendingId : 0,
  8526. asyncDep: null,
  8527. asyncResolved: false,
  8528. // lifecycle hooks
  8529. // not using enums here because it results in computed properties
  8530. isMounted: false,
  8531. isUnmounted: false,
  8532. isDeactivated: false,
  8533. bc: null,
  8534. c: null,
  8535. bm: null,
  8536. m: null,
  8537. bu: null,
  8538. u: null,
  8539. um: null,
  8540. bum: null,
  8541. da: null,
  8542. a: null,
  8543. rtg: null,
  8544. rtc: null,
  8545. ec: null,
  8546. sp: null
  8547. };
  8548. {
  8549. instance.ctx = createDevRenderContext(instance);
  8550. }
  8551. instance.root = parent ? parent.root : instance;
  8552. instance.emit = emit.bind(null, instance);
  8553. if (vnode.ce) {
  8554. vnode.ce(instance);
  8555. }
  8556. return instance;
  8557. }
  8558. let currentInstance = null;
  8559. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8560. let internalSetCurrentInstance;
  8561. {
  8562. internalSetCurrentInstance = (i) => {
  8563. currentInstance = i;
  8564. };
  8565. }
  8566. const setCurrentInstance = (instance) => {
  8567. internalSetCurrentInstance(instance);
  8568. instance.scope.on();
  8569. };
  8570. const unsetCurrentInstance = () => {
  8571. currentInstance && currentInstance.scope.off();
  8572. internalSetCurrentInstance(null);
  8573. };
  8574. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  8575. function validateComponentName(name, config) {
  8576. const appIsNativeTag = config.isNativeTag || NO;
  8577. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  8578. warn(
  8579. "Do not use built-in or reserved HTML elements as component id: " + name
  8580. );
  8581. }
  8582. }
  8583. function isStatefulComponent(instance) {
  8584. return instance.vnode.shapeFlag & 4;
  8585. }
  8586. let isInSSRComponentSetup = false;
  8587. function setupComponent(instance, isSSR = false) {
  8588. isInSSRComponentSetup = isSSR;
  8589. const {props, children} = instance.vnode;
  8590. const isStateful = isStatefulComponent(instance);
  8591. initProps(instance, props, isStateful, isSSR);
  8592. initSlots(instance, children);
  8593. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  8594. isInSSRComponentSetup = false;
  8595. return setupResult;
  8596. }
  8597. function setupStatefulComponent(instance, isSSR) {
  8598. var _a;
  8599. const Component = instance.type;
  8600. {
  8601. if (Component.name) {
  8602. validateComponentName(Component.name, instance.appContext.config);
  8603. }
  8604. if (Component.components) {
  8605. const names = Object.keys(Component.components);
  8606. for (let i = 0; i < names.length; i++) {
  8607. validateComponentName(names[i], instance.appContext.config);
  8608. }
  8609. }
  8610. if (Component.directives) {
  8611. const names = Object.keys(Component.directives);
  8612. for (let i = 0; i < names.length; i++) {
  8613. validateDirectiveName(names[i]);
  8614. }
  8615. }
  8616. if (Component.compilerOptions && isRuntimeOnly()) {
  8617. warn(
  8618. `"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.`
  8619. );
  8620. }
  8621. }
  8622. instance.accessCache = /* @__PURE__ */ Object.create(null);
  8623. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  8624. {
  8625. exposePropsOnRenderContext(instance);
  8626. }
  8627. const {setup} = Component;
  8628. if (setup) {
  8629. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  8630. setCurrentInstance(instance);
  8631. pauseTracking();
  8632. const setupResult = callWithErrorHandling(
  8633. setup,
  8634. instance,
  8635. 0,
  8636. [shallowReadonly(instance.props), setupContext]
  8637. );
  8638. resetTracking();
  8639. unsetCurrentInstance();
  8640. if (isPromise(setupResult)) {
  8641. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  8642. if (isSSR) {
  8643. return setupResult.then((resolvedResult) => {
  8644. handleSetupResult(instance, resolvedResult, isSSR);
  8645. }).catch((e) => {
  8646. handleError(e, instance, 0);
  8647. });
  8648. } else {
  8649. instance.asyncDep = setupResult;
  8650. if (!instance.suspense) {
  8651. const name = (_a = Component.name) != null ? _a : "Anonymous";
  8652. warn(
  8653. `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.`
  8654. );
  8655. }
  8656. }
  8657. } else {
  8658. handleSetupResult(instance, setupResult, isSSR);
  8659. }
  8660. } else {
  8661. finishComponentSetup(instance, isSSR);
  8662. }
  8663. }
  8664. function handleSetupResult(instance, setupResult, isSSR) {
  8665. if (isFunction(setupResult)) {
  8666. {
  8667. instance.render = setupResult;
  8668. }
  8669. } else if (isObject(setupResult)) {
  8670. if (isVNode(setupResult)) {
  8671. warn(
  8672. `setup() should not return VNodes directly - return a render function instead.`
  8673. );
  8674. }
  8675. {
  8676. instance.devtoolsRawSetupState = setupResult;
  8677. }
  8678. instance.setupState = proxyRefs(setupResult);
  8679. {
  8680. exposeSetupStateOnRenderContext(instance);
  8681. }
  8682. } else if (setupResult !== void 0) {
  8683. warn(
  8684. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  8685. );
  8686. }
  8687. finishComponentSetup(instance, isSSR);
  8688. }
  8689. let compile$1;
  8690. let installWithProxy;
  8691. function registerRuntimeCompiler(_compile) {
  8692. compile$1 = _compile;
  8693. installWithProxy = (i) => {
  8694. if (i.render._rc) {
  8695. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  8696. }
  8697. };
  8698. }
  8699. const isRuntimeOnly = () => !compile$1;
  8700. function finishComponentSetup(instance, isSSR, skipOptions) {
  8701. const Component = instance.type;
  8702. if (!instance.render) {
  8703. if (!isSSR && compile$1 && !Component.render) {
  8704. const template = Component.template || resolveMergedOptions(instance).template;
  8705. if (template) {
  8706. {
  8707. startMeasure(instance, `compile`);
  8708. }
  8709. const {isCustomElement, compilerOptions} = instance.appContext.config;
  8710. const {delimiters, compilerOptions: componentCompilerOptions} = Component;
  8711. const finalCompilerOptions = extend(
  8712. extend(
  8713. {
  8714. isCustomElement,
  8715. delimiters
  8716. },
  8717. compilerOptions
  8718. ),
  8719. componentCompilerOptions
  8720. );
  8721. Component.render = compile$1(template, finalCompilerOptions);
  8722. {
  8723. endMeasure(instance, `compile`);
  8724. }
  8725. }
  8726. }
  8727. instance.render = Component.render || NOOP;
  8728. if (installWithProxy) {
  8729. installWithProxy(instance);
  8730. }
  8731. }
  8732. {
  8733. setCurrentInstance(instance);
  8734. pauseTracking();
  8735. try {
  8736. applyOptions(instance);
  8737. } finally {
  8738. resetTracking();
  8739. unsetCurrentInstance();
  8740. }
  8741. }
  8742. if (!Component.render && instance.render === NOOP && !isSSR) {
  8743. if (!compile$1 && Component.template) {
  8744. warn(
  8745. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.`)
  8746. /* should not happen */
  8747. );
  8748. } else {
  8749. warn(`Component is missing template or render function.`);
  8750. }
  8751. }
  8752. }
  8753. function getAttrsProxy(instance) {
  8754. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  8755. instance.attrs,
  8756. {
  8757. get(target, key) {
  8758. markAttrsAccessed();
  8759. track(instance, "get", "$attrs");
  8760. return target[key];
  8761. },
  8762. set() {
  8763. warn(`setupContext.attrs is readonly.`);
  8764. return false;
  8765. },
  8766. deleteProperty() {
  8767. warn(`setupContext.attrs is readonly.`);
  8768. return false;
  8769. }
  8770. }
  8771. ));
  8772. }
  8773. function getSlotsProxy(instance) {
  8774. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  8775. get(target, key) {
  8776. track(instance, "get", "$slots");
  8777. return target[key];
  8778. }
  8779. }));
  8780. }
  8781. function createSetupContext(instance) {
  8782. const expose = (exposed) => {
  8783. {
  8784. if (instance.exposed) {
  8785. warn(`expose() should be called only once per setup().`);
  8786. }
  8787. if (exposed != null) {
  8788. let exposedType = typeof exposed;
  8789. if (exposedType === "object") {
  8790. if (isArray(exposed)) {
  8791. exposedType = "array";
  8792. } else if (isRef(exposed)) {
  8793. exposedType = "ref";
  8794. }
  8795. }
  8796. if (exposedType !== "object") {
  8797. warn(
  8798. `expose() should be passed a plain object, received ${exposedType}.`
  8799. );
  8800. }
  8801. }
  8802. }
  8803. instance.exposed = exposed || {};
  8804. };
  8805. {
  8806. return Object.freeze({
  8807. get attrs() {
  8808. return getAttrsProxy(instance);
  8809. },
  8810. get slots() {
  8811. return getSlotsProxy(instance);
  8812. },
  8813. get emit() {
  8814. return (event, ...args) => instance.emit(event, ...args);
  8815. },
  8816. expose
  8817. });
  8818. }
  8819. }
  8820. function getExposeProxy(instance) {
  8821. if (instance.exposed) {
  8822. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  8823. get(target, key) {
  8824. if (key in target) {
  8825. return target[key];
  8826. } else if (key in publicPropertiesMap) {
  8827. return publicPropertiesMap[key](instance);
  8828. }
  8829. },
  8830. has(target, key) {
  8831. return key in target || key in publicPropertiesMap;
  8832. }
  8833. }));
  8834. }
  8835. }
  8836. const classifyRE = /(?:^|[-_])(\w)/g;
  8837. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  8838. function getComponentName(Component, includeInferred = true) {
  8839. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  8840. }
  8841. function formatComponentName(instance, Component, isRoot = false) {
  8842. let name = getComponentName(Component);
  8843. if (!name && Component.__file) {
  8844. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  8845. if (match) {
  8846. name = match[1];
  8847. }
  8848. }
  8849. if (!name && instance && instance.parent) {
  8850. const inferFromRegistry = (registry) => {
  8851. for (const key in registry) {
  8852. if (registry[key] === Component) {
  8853. return key;
  8854. }
  8855. }
  8856. };
  8857. name = inferFromRegistry(
  8858. instance.components || instance.parent.type.components
  8859. ) || inferFromRegistry(instance.appContext.components);
  8860. }
  8861. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  8862. }
  8863. function isClassComponent(value) {
  8864. return isFunction(value) && "__vccOpts" in value;
  8865. }
  8866. const computed = (getterOrOptions, debugOptions) => {
  8867. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  8868. };
  8869. function h(type, propsOrChildren, children) {
  8870. const l = arguments.length;
  8871. if (l === 2) {
  8872. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  8873. if (isVNode(propsOrChildren)) {
  8874. return createVNode(type, null, [propsOrChildren]);
  8875. }
  8876. return createVNode(type, propsOrChildren);
  8877. } else {
  8878. return createVNode(type, null, propsOrChildren);
  8879. }
  8880. } else {
  8881. if (l > 3) {
  8882. children = Array.prototype.slice.call(arguments, 2);
  8883. } else if (l === 3 && isVNode(children)) {
  8884. children = [children];
  8885. }
  8886. return createVNode(type, propsOrChildren, children);
  8887. }
  8888. }
  8889. const ssrContextKey = Symbol.for("v-scx");
  8890. const useSSRContext = () => {
  8891. {
  8892. warn(`useSSRContext() is not supported in the global build.`);
  8893. }
  8894. };
  8895. function initCustomFormatter() {
  8896. if (typeof window === "undefined") {
  8897. return;
  8898. }
  8899. const vueStyle = {style: "color:#3ba776"};
  8900. const numberStyle = {style: "color:#0b1bc9"};
  8901. const stringStyle = {style: "color:#b62e24"};
  8902. const keywordStyle = {style: "color:#9d288c"};
  8903. const formatter = {
  8904. header(obj) {
  8905. if (!isObject(obj)) {
  8906. return null;
  8907. }
  8908. if (obj.__isVue) {
  8909. return ["div", vueStyle, `VueInstance`];
  8910. } else if (isRef(obj)) {
  8911. return [
  8912. "div",
  8913. {},
  8914. ["span", vueStyle, genRefFlag(obj)],
  8915. "<",
  8916. formatValue(obj.value),
  8917. `>`
  8918. ];
  8919. } else if (isReactive(obj)) {
  8920. return [
  8921. "div",
  8922. {},
  8923. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  8924. "<",
  8925. formatValue(obj),
  8926. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  8927. ];
  8928. } else if (isReadonly(obj)) {
  8929. return [
  8930. "div",
  8931. {},
  8932. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  8933. "<",
  8934. formatValue(obj),
  8935. ">"
  8936. ];
  8937. }
  8938. return null;
  8939. },
  8940. hasBody(obj) {
  8941. return obj && obj.__isVue;
  8942. },
  8943. body(obj) {
  8944. if (obj && obj.__isVue) {
  8945. return [
  8946. "div",
  8947. {},
  8948. ...formatInstance(obj.$)
  8949. ];
  8950. }
  8951. }
  8952. };
  8953. function formatInstance(instance) {
  8954. const blocks = [];
  8955. if (instance.type.props && instance.props) {
  8956. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  8957. }
  8958. if (instance.setupState !== EMPTY_OBJ) {
  8959. blocks.push(createInstanceBlock("setup", instance.setupState));
  8960. }
  8961. if (instance.data !== EMPTY_OBJ) {
  8962. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  8963. }
  8964. const computed = extractKeys(instance, "computed");
  8965. if (computed) {
  8966. blocks.push(createInstanceBlock("computed", computed));
  8967. }
  8968. const injected = extractKeys(instance, "inject");
  8969. if (injected) {
  8970. blocks.push(createInstanceBlock("injected", injected));
  8971. }
  8972. blocks.push([
  8973. "div",
  8974. {},
  8975. [
  8976. "span",
  8977. {
  8978. style: keywordStyle.style + ";opacity:0.66"
  8979. },
  8980. "$ (internal): "
  8981. ],
  8982. ["object", {object: instance}]
  8983. ]);
  8984. return blocks;
  8985. }
  8986. function createInstanceBlock(type, target) {
  8987. target = extend({}, target);
  8988. if (!Object.keys(target).length) {
  8989. return ["span", {}];
  8990. }
  8991. return [
  8992. "div",
  8993. {style: "line-height:1.25em;margin-bottom:0.6em"},
  8994. [
  8995. "div",
  8996. {
  8997. style: "color:#476582"
  8998. },
  8999. type
  9000. ],
  9001. [
  9002. "div",
  9003. {
  9004. style: "padding-left:1.25em"
  9005. },
  9006. ...Object.keys(target).map((key) => {
  9007. return [
  9008. "div",
  9009. {},
  9010. ["span", keywordStyle, key + ": "],
  9011. formatValue(target[key], false)
  9012. ];
  9013. })
  9014. ]
  9015. ];
  9016. }
  9017. function formatValue(v, asRaw = true) {
  9018. if (typeof v === "number") {
  9019. return ["span", numberStyle, v];
  9020. } else if (typeof v === "string") {
  9021. return ["span", stringStyle, JSON.stringify(v)];
  9022. } else if (typeof v === "boolean") {
  9023. return ["span", keywordStyle, v];
  9024. } else if (isObject(v)) {
  9025. return ["object", {object: asRaw ? toRaw(v) : v}];
  9026. } else {
  9027. return ["span", stringStyle, String(v)];
  9028. }
  9029. }
  9030. function extractKeys(instance, type) {
  9031. const Comp = instance.type;
  9032. if (isFunction(Comp)) {
  9033. return;
  9034. }
  9035. const extracted = {};
  9036. for (const key in instance.ctx) {
  9037. if (isKeyOfType(Comp, key, type)) {
  9038. extracted[key] = instance.ctx[key];
  9039. }
  9040. }
  9041. return extracted;
  9042. }
  9043. function isKeyOfType(Comp, key, type) {
  9044. const opts = Comp[type];
  9045. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  9046. return true;
  9047. }
  9048. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9049. return true;
  9050. }
  9051. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  9052. return true;
  9053. }
  9054. }
  9055. function genRefFlag(v) {
  9056. if (isShallow(v)) {
  9057. return `ShallowRef`;
  9058. }
  9059. if (v.effect) {
  9060. return `ComputedRef`;
  9061. }
  9062. return `Ref`;
  9063. }
  9064. if (window.devtoolsFormatters) {
  9065. window.devtoolsFormatters.push(formatter);
  9066. } else {
  9067. window.devtoolsFormatters = [formatter];
  9068. }
  9069. }
  9070. function withMemo(memo, render, cache, index) {
  9071. const cached = cache[index];
  9072. if (cached && isMemoSame(cached, memo)) {
  9073. return cached;
  9074. }
  9075. const ret = render();
  9076. ret.memo = memo.slice();
  9077. return cache[index] = ret;
  9078. }
  9079. function isMemoSame(cached, memo) {
  9080. const prev = cached.memo;
  9081. if (prev.length != memo.length) {
  9082. return false;
  9083. }
  9084. for (let i = 0; i < prev.length; i++) {
  9085. if (hasChanged(prev[i], memo[i])) {
  9086. return false;
  9087. }
  9088. }
  9089. if (isBlockTreeEnabled > 0 && currentBlock) {
  9090. currentBlock.push(cached);
  9091. }
  9092. return true;
  9093. }
  9094. const version = "3.3.8";
  9095. const ssrUtils = null;
  9096. const resolveFilter = null;
  9097. const compatUtils = null;
  9098. const svgNS = "http://www.w3.org/2000/svg";
  9099. const doc = typeof document !== "undefined" ? document : null;
  9100. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9101. const nodeOps = {
  9102. insert: (child, parent, anchor) => {
  9103. parent.insertBefore(child, anchor || null);
  9104. },
  9105. remove: (child) => {
  9106. const parent = child.parentNode;
  9107. if (parent) {
  9108. parent.removeChild(child);
  9109. }
  9110. },
  9111. createElement: (tag, isSVG, is, props) => {
  9112. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? {is} : void 0);
  9113. if (tag === "select" && props && props.multiple != null) {
  9114. el.setAttribute("multiple", props.multiple);
  9115. }
  9116. return el;
  9117. },
  9118. createText: (text) => doc.createTextNode(text),
  9119. createComment: (text) => doc.createComment(text),
  9120. setText: (node, text) => {
  9121. node.nodeValue = text;
  9122. },
  9123. setElementText: (el, text) => {
  9124. el.textContent = text;
  9125. },
  9126. parentNode: (node) => node.parentNode,
  9127. nextSibling: (node) => node.nextSibling,
  9128. querySelector: (selector) => doc.querySelector(selector),
  9129. setScopeId(el, id) {
  9130. el.setAttribute(id, "");
  9131. },
  9132. // __UNSAFE__
  9133. // Reason: innerHTML.
  9134. // Static content here can only come from compiled templates.
  9135. // As long as the user only uses trusted templates, this is safe.
  9136. insertStaticContent(content, parent, anchor, isSVG, start, end) {
  9137. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9138. if (start && (start === end || start.nextSibling)) {
  9139. while (true) {
  9140. parent.insertBefore(start.cloneNode(true), anchor);
  9141. if (start === end || !(start = start.nextSibling))
  9142. break;
  9143. }
  9144. } else {
  9145. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  9146. const template = templateContainer.content;
  9147. if (isSVG) {
  9148. const wrapper = template.firstChild;
  9149. while (wrapper.firstChild) {
  9150. template.appendChild(wrapper.firstChild);
  9151. }
  9152. template.removeChild(wrapper);
  9153. }
  9154. parent.insertBefore(template, anchor);
  9155. }
  9156. return [
  9157. // first
  9158. before ? before.nextSibling : parent.firstChild,
  9159. // last
  9160. anchor ? anchor.previousSibling : parent.lastChild
  9161. ];
  9162. }
  9163. };
  9164. const TRANSITION$1 = "transition";
  9165. const ANIMATION = "animation";
  9166. const vtcKey = Symbol("_vtc");
  9167. const Transition = (props, {slots}) => h(BaseTransition, resolveTransitionProps(props), slots);
  9168. Transition.displayName = "Transition";
  9169. const DOMTransitionPropsValidators = {
  9170. name: String,
  9171. type: String,
  9172. css: {
  9173. type: Boolean,
  9174. default: true
  9175. },
  9176. duration: [String, Number, Object],
  9177. enterFromClass: String,
  9178. enterActiveClass: String,
  9179. enterToClass: String,
  9180. appearFromClass: String,
  9181. appearActiveClass: String,
  9182. appearToClass: String,
  9183. leaveFromClass: String,
  9184. leaveActiveClass: String,
  9185. leaveToClass: String
  9186. };
  9187. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9188. {},
  9189. BaseTransitionPropsValidators,
  9190. DOMTransitionPropsValidators
  9191. );
  9192. const callHook = (hook, args = []) => {
  9193. if (isArray(hook)) {
  9194. hook.forEach((h2) => h2(...args));
  9195. } else if (hook) {
  9196. hook(...args);
  9197. }
  9198. };
  9199. const hasExplicitCallback = (hook) => {
  9200. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9201. };
  9202. function resolveTransitionProps(rawProps) {
  9203. const baseProps = {};
  9204. for (const key in rawProps) {
  9205. if (!(key in DOMTransitionPropsValidators)) {
  9206. baseProps[key] = rawProps[key];
  9207. }
  9208. }
  9209. if (rawProps.css === false) {
  9210. return baseProps;
  9211. }
  9212. const {
  9213. name = "v",
  9214. type,
  9215. duration,
  9216. enterFromClass = `${name}-enter-from`,
  9217. enterActiveClass = `${name}-enter-active`,
  9218. enterToClass = `${name}-enter-to`,
  9219. appearFromClass = enterFromClass,
  9220. appearActiveClass = enterActiveClass,
  9221. appearToClass = enterToClass,
  9222. leaveFromClass = `${name}-leave-from`,
  9223. leaveActiveClass = `${name}-leave-active`,
  9224. leaveToClass = `${name}-leave-to`
  9225. } = rawProps;
  9226. const durations = normalizeDuration(duration);
  9227. const enterDuration = durations && durations[0];
  9228. const leaveDuration = durations && durations[1];
  9229. const {
  9230. onBeforeEnter,
  9231. onEnter,
  9232. onEnterCancelled,
  9233. onLeave,
  9234. onLeaveCancelled,
  9235. onBeforeAppear = onBeforeEnter,
  9236. onAppear = onEnter,
  9237. onAppearCancelled = onEnterCancelled
  9238. } = baseProps;
  9239. const finishEnter = (el, isAppear, done) => {
  9240. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9241. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9242. done && done();
  9243. };
  9244. const finishLeave = (el, done) => {
  9245. el._isLeaving = false;
  9246. removeTransitionClass(el, leaveFromClass);
  9247. removeTransitionClass(el, leaveToClass);
  9248. removeTransitionClass(el, leaveActiveClass);
  9249. done && done();
  9250. };
  9251. const makeEnterHook = (isAppear) => {
  9252. return (el, done) => {
  9253. const hook = isAppear ? onAppear : onEnter;
  9254. const resolve = () => finishEnter(el, isAppear, done);
  9255. callHook(hook, [el, resolve]);
  9256. nextFrame(() => {
  9257. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9258. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9259. if (!hasExplicitCallback(hook)) {
  9260. whenTransitionEnds(el, type, enterDuration, resolve);
  9261. }
  9262. });
  9263. };
  9264. };
  9265. return extend(baseProps, {
  9266. onBeforeEnter(el) {
  9267. callHook(onBeforeEnter, [el]);
  9268. addTransitionClass(el, enterFromClass);
  9269. addTransitionClass(el, enterActiveClass);
  9270. },
  9271. onBeforeAppear(el) {
  9272. callHook(onBeforeAppear, [el]);
  9273. addTransitionClass(el, appearFromClass);
  9274. addTransitionClass(el, appearActiveClass);
  9275. },
  9276. onEnter: makeEnterHook(false),
  9277. onAppear: makeEnterHook(true),
  9278. onLeave(el, done) {
  9279. el._isLeaving = true;
  9280. const resolve = () => finishLeave(el, done);
  9281. addTransitionClass(el, leaveFromClass);
  9282. forceReflow();
  9283. addTransitionClass(el, leaveActiveClass);
  9284. nextFrame(() => {
  9285. if (!el._isLeaving) {
  9286. return;
  9287. }
  9288. removeTransitionClass(el, leaveFromClass);
  9289. addTransitionClass(el, leaveToClass);
  9290. if (!hasExplicitCallback(onLeave)) {
  9291. whenTransitionEnds(el, type, leaveDuration, resolve);
  9292. }
  9293. });
  9294. callHook(onLeave, [el, resolve]);
  9295. },
  9296. onEnterCancelled(el) {
  9297. finishEnter(el, false);
  9298. callHook(onEnterCancelled, [el]);
  9299. },
  9300. onAppearCancelled(el) {
  9301. finishEnter(el, true);
  9302. callHook(onAppearCancelled, [el]);
  9303. },
  9304. onLeaveCancelled(el) {
  9305. finishLeave(el);
  9306. callHook(onLeaveCancelled, [el]);
  9307. }
  9308. });
  9309. }
  9310. function normalizeDuration(duration) {
  9311. if (duration == null) {
  9312. return null;
  9313. } else if (isObject(duration)) {
  9314. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9315. } else {
  9316. const n = NumberOf(duration);
  9317. return [n, n];
  9318. }
  9319. }
  9320. function NumberOf(val) {
  9321. const res = toNumber(val);
  9322. {
  9323. assertNumber(res, "<transition> explicit duration");
  9324. }
  9325. return res;
  9326. }
  9327. function addTransitionClass(el, cls) {
  9328. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9329. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  9330. }
  9331. function removeTransitionClass(el, cls) {
  9332. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9333. const _vtc = el[vtcKey];
  9334. if (_vtc) {
  9335. _vtc.delete(cls);
  9336. if (!_vtc.size) {
  9337. el[vtcKey] = void 0;
  9338. }
  9339. }
  9340. }
  9341. function nextFrame(cb) {
  9342. requestAnimationFrame(() => {
  9343. requestAnimationFrame(cb);
  9344. });
  9345. }
  9346. let endId = 0;
  9347. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9348. const id = el._endId = ++endId;
  9349. const resolveIfNotStale = () => {
  9350. if (id === el._endId) {
  9351. resolve();
  9352. }
  9353. };
  9354. if (explicitTimeout) {
  9355. return setTimeout(resolveIfNotStale, explicitTimeout);
  9356. }
  9357. const {type, timeout, propCount} = getTransitionInfo(el, expectedType);
  9358. if (!type) {
  9359. return resolve();
  9360. }
  9361. const endEvent = type + "end";
  9362. let ended = 0;
  9363. const end = () => {
  9364. el.removeEventListener(endEvent, onEnd);
  9365. resolveIfNotStale();
  9366. };
  9367. const onEnd = (e) => {
  9368. if (e.target === el && ++ended >= propCount) {
  9369. end();
  9370. }
  9371. };
  9372. setTimeout(() => {
  9373. if (ended < propCount) {
  9374. end();
  9375. }
  9376. }, timeout + 1);
  9377. el.addEventListener(endEvent, onEnd);
  9378. }
  9379. function getTransitionInfo(el, expectedType) {
  9380. const styles = window.getComputedStyle(el);
  9381. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9382. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9383. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9384. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9385. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9386. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9387. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9388. let type = null;
  9389. let timeout = 0;
  9390. let propCount = 0;
  9391. if (expectedType === TRANSITION$1) {
  9392. if (transitionTimeout > 0) {
  9393. type = TRANSITION$1;
  9394. timeout = transitionTimeout;
  9395. propCount = transitionDurations.length;
  9396. }
  9397. } else if (expectedType === ANIMATION) {
  9398. if (animationTimeout > 0) {
  9399. type = ANIMATION;
  9400. timeout = animationTimeout;
  9401. propCount = animationDurations.length;
  9402. }
  9403. } else {
  9404. timeout = Math.max(transitionTimeout, animationTimeout);
  9405. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9406. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9407. }
  9408. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9409. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9410. );
  9411. return {
  9412. type,
  9413. timeout,
  9414. propCount,
  9415. hasTransform
  9416. };
  9417. }
  9418. function getTimeout(delays, durations) {
  9419. while (delays.length < durations.length) {
  9420. delays = delays.concat(delays);
  9421. }
  9422. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9423. }
  9424. function toMs(s) {
  9425. if (s === "auto")
  9426. return 0;
  9427. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9428. }
  9429. function forceReflow() {
  9430. return document.body.offsetHeight;
  9431. }
  9432. function patchClass(el, value, isSVG) {
  9433. const transitionClasses = el[vtcKey];
  9434. if (transitionClasses) {
  9435. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9436. }
  9437. if (value == null) {
  9438. el.removeAttribute("class");
  9439. } else if (isSVG) {
  9440. el.setAttribute("class", value);
  9441. } else {
  9442. el.className = value;
  9443. }
  9444. }
  9445. const vShowOldKey = Symbol("_vod");
  9446. const vShow = {
  9447. beforeMount(el, {value}, {transition}) {
  9448. el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
  9449. if (transition && value) {
  9450. transition.beforeEnter(el);
  9451. } else {
  9452. setDisplay(el, value);
  9453. }
  9454. },
  9455. mounted(el, {value}, {transition}) {
  9456. if (transition && value) {
  9457. transition.enter(el);
  9458. }
  9459. },
  9460. updated(el, {value, oldValue}, {transition}) {
  9461. if (!value === !oldValue)
  9462. return;
  9463. if (transition) {
  9464. if (value) {
  9465. transition.beforeEnter(el);
  9466. setDisplay(el, true);
  9467. transition.enter(el);
  9468. } else {
  9469. transition.leave(el, () => {
  9470. setDisplay(el, false);
  9471. });
  9472. }
  9473. } else {
  9474. setDisplay(el, value);
  9475. }
  9476. },
  9477. beforeUnmount(el, {value}) {
  9478. setDisplay(el, value);
  9479. }
  9480. };
  9481. function setDisplay(el, value) {
  9482. el.style.display = value ? el[vShowOldKey] : "none";
  9483. }
  9484. function patchStyle(el, prev, next) {
  9485. const style = el.style;
  9486. const isCssString = isString(next);
  9487. if (next && !isCssString) {
  9488. if (prev && !isString(prev)) {
  9489. for (const key in prev) {
  9490. if (next[key] == null) {
  9491. setStyle(style, key, "");
  9492. }
  9493. }
  9494. }
  9495. for (const key in next) {
  9496. setStyle(style, key, next[key]);
  9497. }
  9498. } else {
  9499. const currentDisplay = style.display;
  9500. if (isCssString) {
  9501. if (prev !== next) {
  9502. style.cssText = next;
  9503. }
  9504. } else if (prev) {
  9505. el.removeAttribute("style");
  9506. }
  9507. if (vShowOldKey in el) {
  9508. style.display = currentDisplay;
  9509. }
  9510. }
  9511. }
  9512. const semicolonRE = /[^\\];\s*$/;
  9513. const importantRE = /\s*!important$/;
  9514. function setStyle(style, name, val) {
  9515. if (isArray(val)) {
  9516. val.forEach((v) => setStyle(style, name, v));
  9517. } else {
  9518. if (val == null)
  9519. val = "";
  9520. {
  9521. if (semicolonRE.test(val)) {
  9522. warn(
  9523. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  9524. );
  9525. }
  9526. }
  9527. if (name.startsWith("--")) {
  9528. style.setProperty(name, val);
  9529. } else {
  9530. const prefixed = autoPrefix(style, name);
  9531. if (importantRE.test(val)) {
  9532. style.setProperty(
  9533. hyphenate(prefixed),
  9534. val.replace(importantRE, ""),
  9535. "important"
  9536. );
  9537. } else {
  9538. style[prefixed] = val;
  9539. }
  9540. }
  9541. }
  9542. }
  9543. const prefixes = ["Webkit", "Moz", "ms"];
  9544. const prefixCache = {};
  9545. function autoPrefix(style, rawName) {
  9546. const cached = prefixCache[rawName];
  9547. if (cached) {
  9548. return cached;
  9549. }
  9550. let name = camelize(rawName);
  9551. if (name !== "filter" && name in style) {
  9552. return prefixCache[rawName] = name;
  9553. }
  9554. name = capitalize(name);
  9555. for (let i = 0; i < prefixes.length; i++) {
  9556. const prefixed = prefixes[i] + name;
  9557. if (prefixed in style) {
  9558. return prefixCache[rawName] = prefixed;
  9559. }
  9560. }
  9561. return rawName;
  9562. }
  9563. const xlinkNS = "http://www.w3.org/1999/xlink";
  9564. function patchAttr(el, key, value, isSVG, instance) {
  9565. if (isSVG && key.startsWith("xlink:")) {
  9566. if (value == null) {
  9567. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  9568. } else {
  9569. el.setAttributeNS(xlinkNS, key, value);
  9570. }
  9571. } else {
  9572. const isBoolean = isSpecialBooleanAttr(key);
  9573. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  9574. el.removeAttribute(key);
  9575. } else {
  9576. el.setAttribute(key, isBoolean ? "" : value);
  9577. }
  9578. }
  9579. }
  9580. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  9581. if (key === "innerHTML" || key === "textContent") {
  9582. if (prevChildren) {
  9583. unmountChildren(prevChildren, parentComponent, parentSuspense);
  9584. }
  9585. el[key] = value == null ? "" : value;
  9586. return;
  9587. }
  9588. const tag = el.tagName;
  9589. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  9590. !tag.includes("-")) {
  9591. el._value = value;
  9592. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  9593. const newValue = value == null ? "" : value;
  9594. if (oldValue !== newValue) {
  9595. el.value = newValue;
  9596. }
  9597. if (value == null) {
  9598. el.removeAttribute(key);
  9599. }
  9600. return;
  9601. }
  9602. let needRemove = false;
  9603. if (value === "" || value == null) {
  9604. const type = typeof el[key];
  9605. if (type === "boolean") {
  9606. value = includeBooleanAttr(value);
  9607. } else if (value == null && type === "string") {
  9608. value = "";
  9609. needRemove = true;
  9610. } else if (type === "number") {
  9611. value = 0;
  9612. needRemove = true;
  9613. }
  9614. }
  9615. try {
  9616. el[key] = value;
  9617. } catch (e) {
  9618. if (!needRemove) {
  9619. warn(
  9620. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  9621. e
  9622. );
  9623. }
  9624. }
  9625. needRemove && el.removeAttribute(key);
  9626. }
  9627. function addEventListener(el, event, handler, options) {
  9628. el.addEventListener(event, handler, options);
  9629. }
  9630. function removeEventListener(el, event, handler, options) {
  9631. el.removeEventListener(event, handler, options);
  9632. }
  9633. const veiKey = Symbol("_vei");
  9634. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  9635. const invokers = el[veiKey] || (el[veiKey] = {});
  9636. const existingInvoker = invokers[rawName];
  9637. if (nextValue && existingInvoker) {
  9638. existingInvoker.value = nextValue;
  9639. } else {
  9640. const [name, options] = parseName(rawName);
  9641. if (nextValue) {
  9642. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  9643. addEventListener(el, name, invoker, options);
  9644. } else if (existingInvoker) {
  9645. removeEventListener(el, name, existingInvoker, options);
  9646. invokers[rawName] = void 0;
  9647. }
  9648. }
  9649. }
  9650. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  9651. function parseName(name) {
  9652. let options;
  9653. if (optionsModifierRE.test(name)) {
  9654. options = {};
  9655. let m;
  9656. while (m = name.match(optionsModifierRE)) {
  9657. name = name.slice(0, name.length - m[0].length);
  9658. options[m[0].toLowerCase()] = true;
  9659. }
  9660. }
  9661. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  9662. return [event, options];
  9663. }
  9664. let cachedNow = 0;
  9665. const p = /* @__PURE__ */ Promise.resolve();
  9666. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  9667. function createInvoker(initialValue, instance) {
  9668. const invoker = (e) => {
  9669. if (!e._vts) {
  9670. e._vts = Date.now();
  9671. } else if (e._vts <= invoker.attached) {
  9672. return;
  9673. }
  9674. callWithAsyncErrorHandling(
  9675. patchStopImmediatePropagation(e, invoker.value),
  9676. instance,
  9677. 5,
  9678. [e]
  9679. );
  9680. };
  9681. invoker.value = initialValue;
  9682. invoker.attached = getNow();
  9683. return invoker;
  9684. }
  9685. function patchStopImmediatePropagation(e, value) {
  9686. if (isArray(value)) {
  9687. const originalStop = e.stopImmediatePropagation;
  9688. e.stopImmediatePropagation = () => {
  9689. originalStop.call(e);
  9690. e._stopped = true;
  9691. };
  9692. return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
  9693. } else {
  9694. return value;
  9695. }
  9696. }
  9697. const nativeOnRE = /^on[a-z]/;
  9698. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  9699. if (key === "class") {
  9700. patchClass(el, nextValue, isSVG);
  9701. } else if (key === "style") {
  9702. patchStyle(el, prevValue, nextValue);
  9703. } else if (isOn(key)) {
  9704. if (!isModelListener(key)) {
  9705. patchEvent(el, key, prevValue, nextValue, parentComponent);
  9706. }
  9707. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  9708. patchDOMProp(
  9709. el,
  9710. key,
  9711. nextValue,
  9712. prevChildren,
  9713. parentComponent,
  9714. parentSuspense,
  9715. unmountChildren
  9716. );
  9717. } else {
  9718. if (key === "true-value") {
  9719. el._trueValue = nextValue;
  9720. } else if (key === "false-value") {
  9721. el._falseValue = nextValue;
  9722. }
  9723. patchAttr(el, key, nextValue, isSVG);
  9724. }
  9725. };
  9726. function shouldSetAsProp(el, key, value, isSVG) {
  9727. if (isSVG) {
  9728. if (key === "innerHTML" || key === "textContent") {
  9729. return true;
  9730. }
  9731. if (key in el && nativeOnRE.test(key) && isFunction(value)) {
  9732. return true;
  9733. }
  9734. return false;
  9735. }
  9736. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  9737. return false;
  9738. }
  9739. if (key === "form") {
  9740. return false;
  9741. }
  9742. if (key === "list" && el.tagName === "INPUT") {
  9743. return false;
  9744. }
  9745. if (key === "type" && el.tagName === "TEXTAREA") {
  9746. return false;
  9747. }
  9748. if (nativeOnRE.test(key) && isString(value)) {
  9749. return false;
  9750. }
  9751. return key in el;
  9752. }
  9753. /*! #__NO_SIDE_EFFECTS__ */
  9754. // @__NO_SIDE_EFFECTS__
  9755. function defineCustomElement(options, hydrate2) {
  9756. const Comp = defineComponent(options);
  9757. class VueCustomElement extends VueElement {
  9758. constructor(initialProps) {
  9759. super(Comp, initialProps, hydrate2);
  9760. }
  9761. }
  9762. VueCustomElement.def = Comp;
  9763. return VueCustomElement;
  9764. }
  9765. /*! #__NO_SIDE_EFFECTS__ */
  9766. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
  9767. return /* @__PURE__ */ defineCustomElement(options, hydrate);
  9768. };
  9769. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  9770. };
  9771. class VueElement extends BaseClass {
  9772. constructor(_def, _props = {}, hydrate2) {
  9773. super();
  9774. this._def = _def;
  9775. this._props = _props;
  9776. /**
  9777. * @internal
  9778. */
  9779. this._instance = null;
  9780. this._connected = false;
  9781. this._resolved = false;
  9782. this._numberProps = null;
  9783. this._ob = null;
  9784. if (this.shadowRoot && hydrate2) {
  9785. hydrate2(this._createVNode(), this.shadowRoot);
  9786. } else {
  9787. if (this.shadowRoot) {
  9788. warn(
  9789. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  9790. );
  9791. }
  9792. this.attachShadow({mode: "open"});
  9793. if (!this._def.__asyncLoader) {
  9794. this._resolveProps(this._def);
  9795. }
  9796. }
  9797. }
  9798. connectedCallback() {
  9799. this._connected = true;
  9800. if (!this._instance) {
  9801. if (this._resolved) {
  9802. this._update();
  9803. } else {
  9804. this._resolveDef();
  9805. }
  9806. }
  9807. }
  9808. disconnectedCallback() {
  9809. this._connected = false;
  9810. if (this._ob) {
  9811. this._ob.disconnect();
  9812. this._ob = null;
  9813. }
  9814. nextTick(() => {
  9815. if (!this._connected) {
  9816. render(null, this.shadowRoot);
  9817. this._instance = null;
  9818. }
  9819. });
  9820. }
  9821. /**
  9822. * resolve inner component definition (handle possible async component)
  9823. */
  9824. _resolveDef() {
  9825. this._resolved = true;
  9826. for (let i = 0; i < this.attributes.length; i++) {
  9827. this._setAttr(this.attributes[i].name);
  9828. }
  9829. this._ob = new MutationObserver((mutations) => {
  9830. for (const m of mutations) {
  9831. this._setAttr(m.attributeName);
  9832. }
  9833. });
  9834. this._ob.observe(this, {attributes: true});
  9835. const resolve = (def, isAsync = false) => {
  9836. const {props, styles} = def;
  9837. let numberProps;
  9838. if (props && !isArray(props)) {
  9839. for (const key in props) {
  9840. const opt = props[key];
  9841. if (opt === Number || opt && opt.type === Number) {
  9842. if (key in this._props) {
  9843. this._props[key] = toNumber(this._props[key]);
  9844. }
  9845. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  9846. }
  9847. }
  9848. }
  9849. this._numberProps = numberProps;
  9850. if (isAsync) {
  9851. this._resolveProps(def);
  9852. }
  9853. this._applyStyles(styles);
  9854. this._update();
  9855. };
  9856. const asyncDef = this._def.__asyncLoader;
  9857. if (asyncDef) {
  9858. asyncDef().then((def) => resolve(def, true));
  9859. } else {
  9860. resolve(this._def);
  9861. }
  9862. }
  9863. _resolveProps(def) {
  9864. const {props} = def;
  9865. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  9866. for (const key of Object.keys(this)) {
  9867. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  9868. this._setProp(key, this[key], true, false);
  9869. }
  9870. }
  9871. for (const key of declaredPropKeys.map(camelize)) {
  9872. Object.defineProperty(this, key, {
  9873. get() {
  9874. return this._getProp(key);
  9875. },
  9876. set(val) {
  9877. this._setProp(key, val);
  9878. }
  9879. });
  9880. }
  9881. }
  9882. _setAttr(key) {
  9883. let value = this.getAttribute(key);
  9884. const camelKey = camelize(key);
  9885. if (this._numberProps && this._numberProps[camelKey]) {
  9886. value = toNumber(value);
  9887. }
  9888. this._setProp(camelKey, value, false);
  9889. }
  9890. /**
  9891. * @internal
  9892. */
  9893. _getProp(key) {
  9894. return this._props[key];
  9895. }
  9896. /**
  9897. * @internal
  9898. */
  9899. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  9900. if (val !== this._props[key]) {
  9901. this._props[key] = val;
  9902. if (shouldUpdate && this._instance) {
  9903. this._update();
  9904. }
  9905. if (shouldReflect) {
  9906. if (val === true) {
  9907. this.setAttribute(hyphenate(key), "");
  9908. } else if (typeof val === "string" || typeof val === "number") {
  9909. this.setAttribute(hyphenate(key), val + "");
  9910. } else if (!val) {
  9911. this.removeAttribute(hyphenate(key));
  9912. }
  9913. }
  9914. }
  9915. }
  9916. _update() {
  9917. render(this._createVNode(), this.shadowRoot);
  9918. }
  9919. _createVNode() {
  9920. const vnode = createVNode(this._def, extend({}, this._props));
  9921. if (!this._instance) {
  9922. vnode.ce = (instance) => {
  9923. this._instance = instance;
  9924. instance.isCE = true;
  9925. {
  9926. instance.ceReload = (newStyles) => {
  9927. if (this._styles) {
  9928. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  9929. this._styles.length = 0;
  9930. }
  9931. this._applyStyles(newStyles);
  9932. this._instance = null;
  9933. this._update();
  9934. };
  9935. }
  9936. const dispatch = (event, args) => {
  9937. this.dispatchEvent(
  9938. new CustomEvent(event, {
  9939. detail: args
  9940. })
  9941. );
  9942. };
  9943. instance.emit = (event, ...args) => {
  9944. dispatch(event, args);
  9945. if (hyphenate(event) !== event) {
  9946. dispatch(hyphenate(event), args);
  9947. }
  9948. };
  9949. let parent = this;
  9950. while (parent = parent && (parent.parentNode || parent.host)) {
  9951. if (parent instanceof VueElement) {
  9952. instance.parent = parent._instance;
  9953. instance.provides = parent._instance.provides;
  9954. break;
  9955. }
  9956. }
  9957. };
  9958. }
  9959. return vnode;
  9960. }
  9961. _applyStyles(styles) {
  9962. if (styles) {
  9963. styles.forEach((css) => {
  9964. const s = document.createElement("style");
  9965. s.textContent = css;
  9966. this.shadowRoot.appendChild(s);
  9967. {
  9968. (this._styles || (this._styles = [])).push(s);
  9969. }
  9970. });
  9971. }
  9972. }
  9973. }
  9974. function useCssModule(name = "$style") {
  9975. {
  9976. {
  9977. warn(`useCssModule() is not supported in the global build.`);
  9978. }
  9979. return EMPTY_OBJ;
  9980. }
  9981. }
  9982. function useCssVars(getter) {
  9983. const instance = getCurrentInstance();
  9984. if (!instance) {
  9985. warn(`useCssVars is called without current active component instance.`);
  9986. return;
  9987. }
  9988. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  9989. Array.from(
  9990. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  9991. ).forEach((node) => setVarsOnNode(node, vars));
  9992. };
  9993. const setVars = () => {
  9994. const vars = getter(instance.proxy);
  9995. setVarsOnVNode(instance.subTree, vars);
  9996. updateTeleports(vars);
  9997. };
  9998. watchPostEffect(setVars);
  9999. onMounted(() => {
  10000. const ob = new MutationObserver(setVars);
  10001. ob.observe(instance.subTree.el.parentNode, {childList: true});
  10002. onUnmounted(() => ob.disconnect());
  10003. });
  10004. }
  10005. function setVarsOnVNode(vnode, vars) {
  10006. if (vnode.shapeFlag & 128) {
  10007. const suspense = vnode.suspense;
  10008. vnode = suspense.activeBranch;
  10009. if (suspense.pendingBranch && !suspense.isHydrating) {
  10010. suspense.effects.push(() => {
  10011. setVarsOnVNode(suspense.activeBranch, vars);
  10012. });
  10013. }
  10014. }
  10015. while (vnode.component) {
  10016. vnode = vnode.component.subTree;
  10017. }
  10018. if (vnode.shapeFlag & 1 && vnode.el) {
  10019. setVarsOnNode(vnode.el, vars);
  10020. } else if (vnode.type === Fragment) {
  10021. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10022. } else if (vnode.type === Static) {
  10023. let {el, anchor} = vnode;
  10024. while (el) {
  10025. setVarsOnNode(el, vars);
  10026. if (el === anchor)
  10027. break;
  10028. el = el.nextSibling;
  10029. }
  10030. }
  10031. }
  10032. function setVarsOnNode(el, vars) {
  10033. if (el.nodeType === 1) {
  10034. const style = el.style;
  10035. for (const key in vars) {
  10036. style.setProperty(`--${key}`, vars[key]);
  10037. }
  10038. }
  10039. }
  10040. const positionMap = /* @__PURE__ */ new WeakMap();
  10041. const newPositionMap = /* @__PURE__ */ new WeakMap();
  10042. const moveCbKey = Symbol("_moveCb");
  10043. const enterCbKey = Symbol("_enterCb");
  10044. const TransitionGroupImpl = {
  10045. name: "TransitionGroup",
  10046. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  10047. tag: String,
  10048. moveClass: String
  10049. }),
  10050. setup(props, {slots}) {
  10051. const instance = getCurrentInstance();
  10052. const state = useTransitionState();
  10053. let prevChildren;
  10054. let children;
  10055. onUpdated(() => {
  10056. if (!prevChildren.length) {
  10057. return;
  10058. }
  10059. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  10060. if (!hasCSSTransform(
  10061. prevChildren[0].el,
  10062. instance.vnode.el,
  10063. moveClass
  10064. )) {
  10065. return;
  10066. }
  10067. prevChildren.forEach(callPendingCbs);
  10068. prevChildren.forEach(recordPosition);
  10069. const movedChildren = prevChildren.filter(applyTranslation);
  10070. forceReflow();
  10071. movedChildren.forEach((c) => {
  10072. const el = c.el;
  10073. const style = el.style;
  10074. addTransitionClass(el, moveClass);
  10075. style.transform = style.webkitTransform = style.transitionDuration = "";
  10076. const cb = el[moveCbKey] = (e) => {
  10077. if (e && e.target !== el) {
  10078. return;
  10079. }
  10080. if (!e || /transform$/.test(e.propertyName)) {
  10081. el.removeEventListener("transitionend", cb);
  10082. el[moveCbKey] = null;
  10083. removeTransitionClass(el, moveClass);
  10084. }
  10085. };
  10086. el.addEventListener("transitionend", cb);
  10087. });
  10088. });
  10089. return () => {
  10090. const rawProps = toRaw(props);
  10091. const cssTransitionProps = resolveTransitionProps(rawProps);
  10092. let tag = rawProps.tag || Fragment;
  10093. prevChildren = children;
  10094. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  10095. for (let i = 0; i < children.length; i++) {
  10096. const child = children[i];
  10097. if (child.key != null) {
  10098. setTransitionHooks(
  10099. child,
  10100. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10101. );
  10102. } else {
  10103. warn(`<TransitionGroup> children must be keyed.`);
  10104. }
  10105. }
  10106. if (prevChildren) {
  10107. for (let i = 0; i < prevChildren.length; i++) {
  10108. const child = prevChildren[i];
  10109. setTransitionHooks(
  10110. child,
  10111. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10112. );
  10113. positionMap.set(child, child.el.getBoundingClientRect());
  10114. }
  10115. }
  10116. return createVNode(tag, null, children);
  10117. };
  10118. }
  10119. };
  10120. const removeMode = (props) => delete props.mode;
  10121. /* @__PURE__ */
  10122. removeMode(TransitionGroupImpl.props);
  10123. const TransitionGroup = TransitionGroupImpl;
  10124. function callPendingCbs(c) {
  10125. const el = c.el;
  10126. if (el[moveCbKey]) {
  10127. el[moveCbKey]();
  10128. }
  10129. if (el[enterCbKey]) {
  10130. el[enterCbKey]();
  10131. }
  10132. }
  10133. function recordPosition(c) {
  10134. newPositionMap.set(c, c.el.getBoundingClientRect());
  10135. }
  10136. function applyTranslation(c) {
  10137. const oldPos = positionMap.get(c);
  10138. const newPos = newPositionMap.get(c);
  10139. const dx = oldPos.left - newPos.left;
  10140. const dy = oldPos.top - newPos.top;
  10141. if (dx || dy) {
  10142. const s = c.el.style;
  10143. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10144. s.transitionDuration = "0s";
  10145. return c;
  10146. }
  10147. }
  10148. function hasCSSTransform(el, root, moveClass) {
  10149. const clone = el.cloneNode();
  10150. const _vtc = el[vtcKey];
  10151. if (_vtc) {
  10152. _vtc.forEach((cls) => {
  10153. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10154. });
  10155. }
  10156. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10157. clone.style.display = "none";
  10158. const container = root.nodeType === 1 ? root : root.parentNode;
  10159. container.appendChild(clone);
  10160. const {hasTransform} = getTransitionInfo(clone);
  10161. container.removeChild(clone);
  10162. return hasTransform;
  10163. }
  10164. const getModelAssigner = (vnode) => {
  10165. const fn = vnode.props["onUpdate:modelValue"] || false;
  10166. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10167. };
  10168. function onCompositionStart(e) {
  10169. e.target.composing = true;
  10170. }
  10171. function onCompositionEnd(e) {
  10172. const target = e.target;
  10173. if (target.composing) {
  10174. target.composing = false;
  10175. target.dispatchEvent(new Event("input"));
  10176. }
  10177. }
  10178. const assignKey = Symbol("_assign");
  10179. const vModelText = {
  10180. created(el, {modifiers: {lazy, trim, number}}, vnode) {
  10181. el[assignKey] = getModelAssigner(vnode);
  10182. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10183. addEventListener(el, lazy ? "change" : "input", (e) => {
  10184. if (e.target.composing)
  10185. return;
  10186. let domValue = el.value;
  10187. if (trim) {
  10188. domValue = domValue.trim();
  10189. }
  10190. if (castToNumber) {
  10191. domValue = looseToNumber(domValue);
  10192. }
  10193. el[assignKey](domValue);
  10194. });
  10195. if (trim) {
  10196. addEventListener(el, "change", () => {
  10197. el.value = el.value.trim();
  10198. });
  10199. }
  10200. if (!lazy) {
  10201. addEventListener(el, "compositionstart", onCompositionStart);
  10202. addEventListener(el, "compositionend", onCompositionEnd);
  10203. addEventListener(el, "change", onCompositionEnd);
  10204. }
  10205. },
  10206. // set value on mounted so it's after min/max for type="range"
  10207. mounted(el, {value}) {
  10208. el.value = value == null ? "" : value;
  10209. },
  10210. beforeUpdate(el, {value, modifiers: {lazy, trim, number}}, vnode) {
  10211. el[assignKey] = getModelAssigner(vnode);
  10212. if (el.composing)
  10213. return;
  10214. if (document.activeElement === el && el.type !== "range") {
  10215. if (lazy) {
  10216. return;
  10217. }
  10218. if (trim && el.value.trim() === value) {
  10219. return;
  10220. }
  10221. if ((number || el.type === "number") && looseToNumber(el.value) === value) {
  10222. return;
  10223. }
  10224. }
  10225. const newValue = value == null ? "" : value;
  10226. if (el.value !== newValue) {
  10227. el.value = newValue;
  10228. }
  10229. }
  10230. };
  10231. const vModelCheckbox = {
  10232. // #4096 array checkboxes need to be deep traversed
  10233. deep: true,
  10234. created(el, _, vnode) {
  10235. el[assignKey] = getModelAssigner(vnode);
  10236. addEventListener(el, "change", () => {
  10237. const modelValue = el._modelValue;
  10238. const elementValue = getValue(el);
  10239. const checked = el.checked;
  10240. const assign = el[assignKey];
  10241. if (isArray(modelValue)) {
  10242. const index = looseIndexOf(modelValue, elementValue);
  10243. const found = index !== -1;
  10244. if (checked && !found) {
  10245. assign(modelValue.concat(elementValue));
  10246. } else if (!checked && found) {
  10247. const filtered = [...modelValue];
  10248. filtered.splice(index, 1);
  10249. assign(filtered);
  10250. }
  10251. } else if (isSet(modelValue)) {
  10252. const cloned = new Set(modelValue);
  10253. if (checked) {
  10254. cloned.add(elementValue);
  10255. } else {
  10256. cloned.delete(elementValue);
  10257. }
  10258. assign(cloned);
  10259. } else {
  10260. assign(getCheckboxValue(el, checked));
  10261. }
  10262. });
  10263. },
  10264. // set initial checked on mount to wait for true-value/false-value
  10265. mounted: setChecked,
  10266. beforeUpdate(el, binding, vnode) {
  10267. el[assignKey] = getModelAssigner(vnode);
  10268. setChecked(el, binding, vnode);
  10269. }
  10270. };
  10271. function setChecked(el, {value, oldValue}, vnode) {
  10272. el._modelValue = value;
  10273. if (isArray(value)) {
  10274. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10275. } else if (isSet(value)) {
  10276. el.checked = value.has(vnode.props.value);
  10277. } else if (value !== oldValue) {
  10278. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10279. }
  10280. }
  10281. const vModelRadio = {
  10282. created(el, {value}, vnode) {
  10283. el.checked = looseEqual(value, vnode.props.value);
  10284. el[assignKey] = getModelAssigner(vnode);
  10285. addEventListener(el, "change", () => {
  10286. el[assignKey](getValue(el));
  10287. });
  10288. },
  10289. beforeUpdate(el, {value, oldValue}, vnode) {
  10290. el[assignKey] = getModelAssigner(vnode);
  10291. if (value !== oldValue) {
  10292. el.checked = looseEqual(value, vnode.props.value);
  10293. }
  10294. }
  10295. };
  10296. const vModelSelect = {
  10297. // <select multiple> value need to be deep traversed
  10298. deep: true,
  10299. created(el, {value, modifiers: {number}}, vnode) {
  10300. const isSetModel = isSet(value);
  10301. addEventListener(el, "change", () => {
  10302. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10303. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10304. );
  10305. el[assignKey](
  10306. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10307. );
  10308. });
  10309. el[assignKey] = getModelAssigner(vnode);
  10310. },
  10311. // set value in mounted & updated because <select> relies on its children
  10312. // <option>s.
  10313. mounted(el, {value}) {
  10314. setSelected(el, value);
  10315. },
  10316. beforeUpdate(el, _binding, vnode) {
  10317. el[assignKey] = getModelAssigner(vnode);
  10318. },
  10319. updated(el, {value}) {
  10320. setSelected(el, value);
  10321. }
  10322. };
  10323. function setSelected(el, value) {
  10324. const isMultiple = el.multiple;
  10325. if (isMultiple && !isArray(value) && !isSet(value)) {
  10326. warn(
  10327. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10328. );
  10329. return;
  10330. }
  10331. for (let i = 0, l = el.options.length; i < l; i++) {
  10332. const option = el.options[i];
  10333. const optionValue = getValue(option);
  10334. if (isMultiple) {
  10335. if (isArray(value)) {
  10336. option.selected = looseIndexOf(value, optionValue) > -1;
  10337. } else {
  10338. option.selected = value.has(optionValue);
  10339. }
  10340. } else {
  10341. if (looseEqual(getValue(option), value)) {
  10342. if (el.selectedIndex !== i)
  10343. el.selectedIndex = i;
  10344. return;
  10345. }
  10346. }
  10347. }
  10348. if (!isMultiple && el.selectedIndex !== -1) {
  10349. el.selectedIndex = -1;
  10350. }
  10351. }
  10352. function getValue(el) {
  10353. return "_value" in el ? el._value : el.value;
  10354. }
  10355. function getCheckboxValue(el, checked) {
  10356. const key = checked ? "_trueValue" : "_falseValue";
  10357. return key in el ? el[key] : checked;
  10358. }
  10359. const vModelDynamic = {
  10360. created(el, binding, vnode) {
  10361. callModelHook(el, binding, vnode, null, "created");
  10362. },
  10363. mounted(el, binding, vnode) {
  10364. callModelHook(el, binding, vnode, null, "mounted");
  10365. },
  10366. beforeUpdate(el, binding, vnode, prevVNode) {
  10367. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10368. },
  10369. updated(el, binding, vnode, prevVNode) {
  10370. callModelHook(el, binding, vnode, prevVNode, "updated");
  10371. }
  10372. };
  10373. function resolveDynamicModel(tagName, type) {
  10374. switch (tagName) {
  10375. case "SELECT":
  10376. return vModelSelect;
  10377. case "TEXTAREA":
  10378. return vModelText;
  10379. default:
  10380. switch (type) {
  10381. case "checkbox":
  10382. return vModelCheckbox;
  10383. case "radio":
  10384. return vModelRadio;
  10385. default:
  10386. return vModelText;
  10387. }
  10388. }
  10389. }
  10390. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10391. const modelToUse = resolveDynamicModel(
  10392. el.tagName,
  10393. vnode.props && vnode.props.type
  10394. );
  10395. const fn = modelToUse[hook];
  10396. fn && fn(el, binding, vnode, prevVNode);
  10397. }
  10398. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10399. const modifierGuards = {
  10400. stop: (e) => e.stopPropagation(),
  10401. prevent: (e) => e.preventDefault(),
  10402. self: (e) => e.target !== e.currentTarget,
  10403. ctrl: (e) => !e.ctrlKey,
  10404. shift: (e) => !e.shiftKey,
  10405. alt: (e) => !e.altKey,
  10406. meta: (e) => !e.metaKey,
  10407. left: (e) => "button" in e && e.button !== 0,
  10408. middle: (e) => "button" in e && e.button !== 1,
  10409. right: (e) => "button" in e && e.button !== 2,
  10410. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  10411. };
  10412. const withModifiers = (fn, modifiers) => {
  10413. return (event, ...args) => {
  10414. for (let i = 0; i < modifiers.length; i++) {
  10415. const guard = modifierGuards[modifiers[i]];
  10416. if (guard && guard(event, modifiers))
  10417. return;
  10418. }
  10419. return fn(event, ...args);
  10420. };
  10421. };
  10422. const keyNames = {
  10423. esc: "escape",
  10424. space: " ",
  10425. up: "arrow-up",
  10426. left: "arrow-left",
  10427. right: "arrow-right",
  10428. down: "arrow-down",
  10429. delete: "backspace"
  10430. };
  10431. const withKeys = (fn, modifiers) => {
  10432. return (event) => {
  10433. if (!("key" in event)) {
  10434. return;
  10435. }
  10436. const eventKey = hyphenate(event.key);
  10437. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  10438. return fn(event);
  10439. }
  10440. };
  10441. };
  10442. const rendererOptions = /* @__PURE__ */ extend({patchProp}, nodeOps);
  10443. let renderer;
  10444. let enabledHydration = false;
  10445. function ensureRenderer() {
  10446. return renderer || (renderer = createRenderer(rendererOptions));
  10447. }
  10448. function ensureHydrationRenderer() {
  10449. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  10450. enabledHydration = true;
  10451. return renderer;
  10452. }
  10453. const render = (...args) => {
  10454. ensureRenderer().render(...args);
  10455. };
  10456. const hydrate = (...args) => {
  10457. ensureHydrationRenderer().hydrate(...args);
  10458. };
  10459. const createApp = (...args) => {
  10460. const app = ensureRenderer().createApp(...args);
  10461. {
  10462. injectNativeTagCheck(app);
  10463. injectCompilerOptionsCheck(app);
  10464. }
  10465. const {mount} = app;
  10466. app.mount = (containerOrSelector) => {
  10467. const container = normalizeContainer(containerOrSelector);
  10468. if (!container)
  10469. return;
  10470. const component = app._component;
  10471. if (!isFunction(component) && !component.render && !component.template) {
  10472. component.template = container.innerHTML;
  10473. }
  10474. container.innerHTML = "";
  10475. const proxy = mount(container, false, container instanceof SVGElement);
  10476. if (container instanceof Element) {
  10477. container.removeAttribute("v-cloak");
  10478. container.setAttribute("data-v-app", "");
  10479. }
  10480. return proxy;
  10481. };
  10482. return app;
  10483. };
  10484. const createSSRApp = (...args) => {
  10485. const app = ensureHydrationRenderer().createApp(...args);
  10486. {
  10487. injectNativeTagCheck(app);
  10488. injectCompilerOptionsCheck(app);
  10489. }
  10490. const {mount} = app;
  10491. app.mount = (containerOrSelector) => {
  10492. const container = normalizeContainer(containerOrSelector);
  10493. if (container) {
  10494. return mount(container, true, container instanceof SVGElement);
  10495. }
  10496. };
  10497. return app;
  10498. };
  10499. function injectNativeTagCheck(app) {
  10500. Object.defineProperty(app.config, "isNativeTag", {
  10501. value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  10502. writable: false
  10503. });
  10504. }
  10505. function injectCompilerOptionsCheck(app) {
  10506. if (isRuntimeOnly()) {
  10507. const isCustomElement = app.config.isCustomElement;
  10508. Object.defineProperty(app.config, "isCustomElement", {
  10509. get() {
  10510. return isCustomElement;
  10511. },
  10512. set() {
  10513. warn(
  10514. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  10515. );
  10516. }
  10517. });
  10518. const compilerOptions = app.config.compilerOptions;
  10519. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  10520. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  10521. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  10522. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  10523. Object.defineProperty(app.config, "compilerOptions", {
  10524. get() {
  10525. warn(msg);
  10526. return compilerOptions;
  10527. },
  10528. set() {
  10529. warn(msg);
  10530. }
  10531. });
  10532. }
  10533. }
  10534. function normalizeContainer(container) {
  10535. if (isString(container)) {
  10536. const res = document.querySelector(container);
  10537. if (!res) {
  10538. warn(
  10539. `Failed to mount app: mount target selector "${container}" returned null.`
  10540. );
  10541. }
  10542. return res;
  10543. }
  10544. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  10545. warn(
  10546. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  10547. );
  10548. }
  10549. return container;
  10550. }
  10551. const initDirectivesForSSR = NOOP;
  10552. function initDev() {
  10553. {
  10554. {
  10555. console.info(
  10556. `You are running a development build of Vue.
  10557. Make sure to use the production build (*.prod.js) when deploying for production.`
  10558. );
  10559. }
  10560. initCustomFormatter();
  10561. }
  10562. }
  10563. function defaultOnError(error) {
  10564. throw error;
  10565. }
  10566. function defaultOnWarn(msg) {
  10567. console.warn(`[Vue warn] ${msg.message}`);
  10568. }
  10569. function createCompilerError(code, loc, messages, additionalMessage) {
  10570. const msg = (messages || errorMessages)[code] + (additionalMessage || ``);
  10571. const error = new SyntaxError(String(msg));
  10572. error.code = code;
  10573. error.loc = loc;
  10574. return error;
  10575. }
  10576. const errorMessages = {
  10577. // parse errors
  10578. [0]: "Illegal comment.",
  10579. [1]: "CDATA section is allowed only in XML context.",
  10580. [2]: "Duplicate attribute.",
  10581. [3]: "End tag cannot have attributes.",
  10582. [4]: "Illegal '/' in tags.",
  10583. [5]: "Unexpected EOF in tag.",
  10584. [6]: "Unexpected EOF in CDATA section.",
  10585. [7]: "Unexpected EOF in comment.",
  10586. [8]: "Unexpected EOF in script.",
  10587. [9]: "Unexpected EOF in tag.",
  10588. [10]: "Incorrectly closed comment.",
  10589. [11]: "Incorrectly opened comment.",
  10590. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  10591. [13]: "Attribute value was expected.",
  10592. [14]: "End tag name was expected.",
  10593. [15]: "Whitespace was expected.",
  10594. [16]: "Unexpected '<!--' in comment.",
  10595. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  10596. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  10597. [19]: "Attribute name cannot start with '='.",
  10598. [21]: "'<?' is allowed only in XML context.",
  10599. [20]: `Unexpected null character.`,
  10600. [22]: "Illegal '/' in tags.",
  10601. // Vue-specific parse errors
  10602. [23]: "Invalid end tag.",
  10603. [24]: "Element is missing end tag.",
  10604. [25]: "Interpolation end sign was not found.",
  10605. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  10606. [26]: "Legal directive name was expected.",
  10607. // transform errors
  10608. [28]: `v-if/v-else-if is missing expression.`,
  10609. [29]: `v-if/else branches must use unique keys.`,
  10610. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  10611. [31]: `v-for is missing expression.`,
  10612. [32]: `v-for has invalid expression.`,
  10613. [33]: `<template v-for> key should be placed on the <template> tag.`,
  10614. [34]: `v-bind is missing expression.`,
  10615. [35]: `v-on is missing expression.`,
  10616. [36]: `Unexpected custom directive on <slot> outlet.`,
  10617. [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
  10618. [38]: `Duplicate slot names found. `,
  10619. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  10620. [40]: `v-slot can only be used on components or <template> tags.`,
  10621. [41]: `v-model is missing expression.`,
  10622. [42]: `v-model value must be a valid JavaScript member expression.`,
  10623. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  10624. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  10625. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  10626. [45]: `Error parsing JavaScript expression: `,
  10627. [46]: `<KeepAlive> expects exactly one child component.`,
  10628. // generic errors
  10629. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  10630. [48]: `ES module mode is not supported in this build of compiler.`,
  10631. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  10632. [50]: `"scopeId" option is only supported in module mode.`,
  10633. // deprecations
  10634. [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
  10635. [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
  10636. // just to fulfill types
  10637. [53]: ``
  10638. };
  10639. const FRAGMENT = Symbol(`Fragment`);
  10640. const TELEPORT = Symbol(`Teleport`);
  10641. const SUSPENSE = Symbol(`Suspense`);
  10642. const KEEP_ALIVE = Symbol(`KeepAlive`);
  10643. const BASE_TRANSITION = Symbol(`BaseTransition`);
  10644. const OPEN_BLOCK = Symbol(`openBlock`);
  10645. const CREATE_BLOCK = Symbol(`createBlock`);
  10646. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock`);
  10647. const CREATE_VNODE = Symbol(`createVNode`);
  10648. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode`);
  10649. const CREATE_COMMENT = Symbol(`createCommentVNode`);
  10650. const CREATE_TEXT = Symbol(`createTextVNode`);
  10651. const CREATE_STATIC = Symbol(`createStaticVNode`);
  10652. const RESOLVE_COMPONENT = Symbol(`resolveComponent`);
  10653. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  10654. `resolveDynamicComponent`
  10655. );
  10656. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective`);
  10657. const RESOLVE_FILTER = Symbol(`resolveFilter`);
  10658. const WITH_DIRECTIVES = Symbol(`withDirectives`);
  10659. const RENDER_LIST = Symbol(`renderList`);
  10660. const RENDER_SLOT = Symbol(`renderSlot`);
  10661. const CREATE_SLOTS = Symbol(`createSlots`);
  10662. const TO_DISPLAY_STRING = Symbol(`toDisplayString`);
  10663. const MERGE_PROPS = Symbol(`mergeProps`);
  10664. const NORMALIZE_CLASS = Symbol(`normalizeClass`);
  10665. const NORMALIZE_STYLE = Symbol(`normalizeStyle`);
  10666. const NORMALIZE_PROPS = Symbol(`normalizeProps`);
  10667. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps`);
  10668. const TO_HANDLERS = Symbol(`toHandlers`);
  10669. const CAMELIZE = Symbol(`camelize`);
  10670. const CAPITALIZE = Symbol(`capitalize`);
  10671. const TO_HANDLER_KEY = Symbol(`toHandlerKey`);
  10672. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking`);
  10673. const PUSH_SCOPE_ID = Symbol(`pushScopeId`);
  10674. const POP_SCOPE_ID = Symbol(`popScopeId`);
  10675. const WITH_CTX = Symbol(`withCtx`);
  10676. const UNREF = Symbol(`unref`);
  10677. const IS_REF = Symbol(`isRef`);
  10678. const WITH_MEMO = Symbol(`withMemo`);
  10679. const IS_MEMO_SAME = Symbol(`isMemoSame`);
  10680. const helperNameMap = {
  10681. [FRAGMENT]: `Fragment`,
  10682. [TELEPORT]: `Teleport`,
  10683. [SUSPENSE]: `Suspense`,
  10684. [KEEP_ALIVE]: `KeepAlive`,
  10685. [BASE_TRANSITION]: `BaseTransition`,
  10686. [OPEN_BLOCK]: `openBlock`,
  10687. [CREATE_BLOCK]: `createBlock`,
  10688. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  10689. [CREATE_VNODE]: `createVNode`,
  10690. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  10691. [CREATE_COMMENT]: `createCommentVNode`,
  10692. [CREATE_TEXT]: `createTextVNode`,
  10693. [CREATE_STATIC]: `createStaticVNode`,
  10694. [RESOLVE_COMPONENT]: `resolveComponent`,
  10695. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  10696. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  10697. [RESOLVE_FILTER]: `resolveFilter`,
  10698. [WITH_DIRECTIVES]: `withDirectives`,
  10699. [RENDER_LIST]: `renderList`,
  10700. [RENDER_SLOT]: `renderSlot`,
  10701. [CREATE_SLOTS]: `createSlots`,
  10702. [TO_DISPLAY_STRING]: `toDisplayString`,
  10703. [MERGE_PROPS]: `mergeProps`,
  10704. [NORMALIZE_CLASS]: `normalizeClass`,
  10705. [NORMALIZE_STYLE]: `normalizeStyle`,
  10706. [NORMALIZE_PROPS]: `normalizeProps`,
  10707. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  10708. [TO_HANDLERS]: `toHandlers`,
  10709. [CAMELIZE]: `camelize`,
  10710. [CAPITALIZE]: `capitalize`,
  10711. [TO_HANDLER_KEY]: `toHandlerKey`,
  10712. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  10713. [PUSH_SCOPE_ID]: `pushScopeId`,
  10714. [POP_SCOPE_ID]: `popScopeId`,
  10715. [WITH_CTX]: `withCtx`,
  10716. [UNREF]: `unref`,
  10717. [IS_REF]: `isRef`,
  10718. [WITH_MEMO]: `withMemo`,
  10719. [IS_MEMO_SAME]: `isMemoSame`
  10720. };
  10721. function registerRuntimeHelpers(helpers) {
  10722. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  10723. helperNameMap[s] = helpers[s];
  10724. });
  10725. }
  10726. const locStub = {
  10727. source: "",
  10728. start: {line: 1, column: 1, offset: 0},
  10729. end: {line: 1, column: 1, offset: 0}
  10730. };
  10731. function createRoot(children, loc = locStub) {
  10732. return {
  10733. type: 0,
  10734. children,
  10735. helpers: /* @__PURE__ */ new Set(),
  10736. components: [],
  10737. directives: [],
  10738. hoists: [],
  10739. imports: [],
  10740. cached: 0,
  10741. temps: 0,
  10742. codegenNode: void 0,
  10743. loc
  10744. };
  10745. }
  10746. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  10747. if (context) {
  10748. if (isBlock) {
  10749. context.helper(OPEN_BLOCK);
  10750. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  10751. } else {
  10752. context.helper(getVNodeHelper(context.inSSR, isComponent));
  10753. }
  10754. if (directives) {
  10755. context.helper(WITH_DIRECTIVES);
  10756. }
  10757. }
  10758. return {
  10759. type: 13,
  10760. tag,
  10761. props,
  10762. children,
  10763. patchFlag,
  10764. dynamicProps,
  10765. directives,
  10766. isBlock,
  10767. disableTracking,
  10768. isComponent,
  10769. loc
  10770. };
  10771. }
  10772. function createArrayExpression(elements, loc = locStub) {
  10773. return {
  10774. type: 17,
  10775. loc,
  10776. elements
  10777. };
  10778. }
  10779. function createObjectExpression(properties, loc = locStub) {
  10780. return {
  10781. type: 15,
  10782. loc,
  10783. properties
  10784. };
  10785. }
  10786. function createObjectProperty(key, value) {
  10787. return {
  10788. type: 16,
  10789. loc: locStub,
  10790. key: isString(key) ? createSimpleExpression(key, true) : key,
  10791. value
  10792. };
  10793. }
  10794. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  10795. return {
  10796. type: 4,
  10797. loc,
  10798. content,
  10799. isStatic,
  10800. constType: isStatic ? 3 : constType
  10801. };
  10802. }
  10803. function createCompoundExpression(children, loc = locStub) {
  10804. return {
  10805. type: 8,
  10806. loc,
  10807. children
  10808. };
  10809. }
  10810. function createCallExpression(callee, args = [], loc = locStub) {
  10811. return {
  10812. type: 14,
  10813. loc,
  10814. callee,
  10815. arguments: args
  10816. };
  10817. }
  10818. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  10819. return {
  10820. type: 18,
  10821. params,
  10822. returns,
  10823. newline,
  10824. isSlot,
  10825. loc
  10826. };
  10827. }
  10828. function createConditionalExpression(test, consequent, alternate, newline = true) {
  10829. return {
  10830. type: 19,
  10831. test,
  10832. consequent,
  10833. alternate,
  10834. newline,
  10835. loc: locStub
  10836. };
  10837. }
  10838. function createCacheExpression(index, value, isVNode = false) {
  10839. return {
  10840. type: 20,
  10841. index,
  10842. value,
  10843. isVNode,
  10844. loc: locStub
  10845. };
  10846. }
  10847. function createBlockStatement(body) {
  10848. return {
  10849. type: 21,
  10850. body,
  10851. loc: locStub
  10852. };
  10853. }
  10854. function getVNodeHelper(ssr, isComponent) {
  10855. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  10856. }
  10857. function getVNodeBlockHelper(ssr, isComponent) {
  10858. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  10859. }
  10860. function convertToBlock(node, {helper, removeHelper, inSSR}) {
  10861. if (!node.isBlock) {
  10862. node.isBlock = true;
  10863. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  10864. helper(OPEN_BLOCK);
  10865. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  10866. }
  10867. }
  10868. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  10869. const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
  10870. function isCoreComponent(tag) {
  10871. if (isBuiltInType(tag, "Teleport")) {
  10872. return TELEPORT;
  10873. } else if (isBuiltInType(tag, "Suspense")) {
  10874. return SUSPENSE;
  10875. } else if (isBuiltInType(tag, "KeepAlive")) {
  10876. return KEEP_ALIVE;
  10877. } else if (isBuiltInType(tag, "BaseTransition")) {
  10878. return BASE_TRANSITION;
  10879. }
  10880. }
  10881. const nonIdentifierRE = /^\d|[^\$\w]/;
  10882. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  10883. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  10884. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  10885. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  10886. const isMemberExpressionBrowser = (path) => {
  10887. path = path.trim().replace(whitespaceRE, (s) => s.trim());
  10888. let state = 0 /* inMemberExp */;
  10889. let stateStack = [];
  10890. let currentOpenBracketCount = 0;
  10891. let currentOpenParensCount = 0;
  10892. let currentStringType = null;
  10893. for (let i = 0; i < path.length; i++) {
  10894. const char = path.charAt(i);
  10895. switch (state) {
  10896. case 0 /* inMemberExp */
  10897. :
  10898. if (char === "[") {
  10899. stateStack.push(state);
  10900. state = 1 /* inBrackets */;
  10901. currentOpenBracketCount++;
  10902. } else if (char === "(") {
  10903. stateStack.push(state);
  10904. state = 2 /* inParens */;
  10905. currentOpenParensCount++;
  10906. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  10907. return false;
  10908. }
  10909. break;
  10910. case 1 /* inBrackets */
  10911. :
  10912. if (char === `'` || char === `"` || char === "`") {
  10913. stateStack.push(state);
  10914. state = 3 /* inString */;
  10915. currentStringType = char;
  10916. } else if (char === `[`) {
  10917. currentOpenBracketCount++;
  10918. } else if (char === `]`) {
  10919. if (!--currentOpenBracketCount) {
  10920. state = stateStack.pop();
  10921. }
  10922. }
  10923. break;
  10924. case 2 /* inParens */
  10925. :
  10926. if (char === `'` || char === `"` || char === "`") {
  10927. stateStack.push(state);
  10928. state = 3 /* inString */;
  10929. currentStringType = char;
  10930. } else if (char === `(`) {
  10931. currentOpenParensCount++;
  10932. } else if (char === `)`) {
  10933. if (i === path.length - 1) {
  10934. return false;
  10935. }
  10936. if (!--currentOpenParensCount) {
  10937. state = stateStack.pop();
  10938. }
  10939. }
  10940. break;
  10941. case 3 /* inString */
  10942. :
  10943. if (char === currentStringType) {
  10944. state = stateStack.pop();
  10945. currentStringType = null;
  10946. }
  10947. break;
  10948. }
  10949. }
  10950. return !currentOpenBracketCount && !currentOpenParensCount;
  10951. };
  10952. const isMemberExpression = isMemberExpressionBrowser;
  10953. function getInnerRange(loc, offset, length) {
  10954. const source = loc.source.slice(offset, offset + length);
  10955. const newLoc = {
  10956. source,
  10957. start: advancePositionWithClone(loc.start, loc.source, offset),
  10958. end: loc.end
  10959. };
  10960. if (length != null) {
  10961. newLoc.end = advancePositionWithClone(
  10962. loc.start,
  10963. loc.source,
  10964. offset + length
  10965. );
  10966. }
  10967. return newLoc;
  10968. }
  10969. function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
  10970. return advancePositionWithMutation(
  10971. extend({}, pos),
  10972. source,
  10973. numberOfCharacters
  10974. );
  10975. }
  10976. function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
  10977. let linesCount = 0;
  10978. let lastNewLinePos = -1;
  10979. for (let i = 0; i < numberOfCharacters; i++) {
  10980. if (source.charCodeAt(i) === 10) {
  10981. linesCount++;
  10982. lastNewLinePos = i;
  10983. }
  10984. }
  10985. pos.offset += numberOfCharacters;
  10986. pos.line += linesCount;
  10987. pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
  10988. return pos;
  10989. }
  10990. function assert(condition, msg) {
  10991. if (!condition) {
  10992. throw new Error(msg || `unexpected compiler condition`);
  10993. }
  10994. }
  10995. function findDir(node, name, allowEmpty = false) {
  10996. for (let i = 0; i < node.props.length; i++) {
  10997. const p = node.props[i];
  10998. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  10999. return p;
  11000. }
  11001. }
  11002. }
  11003. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  11004. for (let i = 0; i < node.props.length; i++) {
  11005. const p = node.props[i];
  11006. if (p.type === 6) {
  11007. if (dynamicOnly)
  11008. continue;
  11009. if (p.name === name && (p.value || allowEmpty)) {
  11010. return p;
  11011. }
  11012. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  11013. return p;
  11014. }
  11015. }
  11016. }
  11017. function isStaticArgOf(arg, name) {
  11018. return !!(arg && isStaticExp(arg) && arg.content === name);
  11019. }
  11020. function hasDynamicKeyVBind(node) {
  11021. return node.props.some(
  11022. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  11023. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  11024. !p.arg.isStatic)
  11025. // v-bind:[foo]
  11026. );
  11027. }
  11028. function isText$1(node) {
  11029. return node.type === 5 || node.type === 2;
  11030. }
  11031. function isVSlot(p) {
  11032. return p.type === 7 && p.name === "slot";
  11033. }
  11034. function isTemplateNode(node) {
  11035. return node.type === 1 && node.tagType === 3;
  11036. }
  11037. function isSlotOutlet(node) {
  11038. return node.type === 1 && node.tagType === 2;
  11039. }
  11040. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  11041. function getUnnormalizedProps(props, callPath = []) {
  11042. if (props && !isString(props) && props.type === 14) {
  11043. const callee = props.callee;
  11044. if (!isString(callee) && propsHelperSet.has(callee)) {
  11045. return getUnnormalizedProps(
  11046. props.arguments[0],
  11047. callPath.concat(props)
  11048. );
  11049. }
  11050. }
  11051. return [props, callPath];
  11052. }
  11053. function injectProp(node, prop, context) {
  11054. let propsWithInjection;
  11055. let props = node.type === 13 ? node.props : node.arguments[2];
  11056. let callPath = [];
  11057. let parentCall;
  11058. if (props && !isString(props) && props.type === 14) {
  11059. const ret = getUnnormalizedProps(props);
  11060. props = ret[0];
  11061. callPath = ret[1];
  11062. parentCall = callPath[callPath.length - 1];
  11063. }
  11064. if (props == null || isString(props)) {
  11065. propsWithInjection = createObjectExpression([prop]);
  11066. } else if (props.type === 14) {
  11067. const first = props.arguments[0];
  11068. if (!isString(first) && first.type === 15) {
  11069. if (!hasProp(prop, first)) {
  11070. first.properties.unshift(prop);
  11071. }
  11072. } else {
  11073. if (props.callee === TO_HANDLERS) {
  11074. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  11075. createObjectExpression([prop]),
  11076. props
  11077. ]);
  11078. } else {
  11079. props.arguments.unshift(createObjectExpression([prop]));
  11080. }
  11081. }
  11082. !propsWithInjection && (propsWithInjection = props);
  11083. } else if (props.type === 15) {
  11084. if (!hasProp(prop, props)) {
  11085. props.properties.unshift(prop);
  11086. }
  11087. propsWithInjection = props;
  11088. } else {
  11089. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  11090. createObjectExpression([prop]),
  11091. props
  11092. ]);
  11093. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  11094. parentCall = callPath[callPath.length - 2];
  11095. }
  11096. }
  11097. if (node.type === 13) {
  11098. if (parentCall) {
  11099. parentCall.arguments[0] = propsWithInjection;
  11100. } else {
  11101. node.props = propsWithInjection;
  11102. }
  11103. } else {
  11104. if (parentCall) {
  11105. parentCall.arguments[0] = propsWithInjection;
  11106. } else {
  11107. node.arguments[2] = propsWithInjection;
  11108. }
  11109. }
  11110. }
  11111. function hasProp(prop, props) {
  11112. let result = false;
  11113. if (prop.key.type === 4) {
  11114. const propKeyName = prop.key.content;
  11115. result = props.properties.some(
  11116. (p) => p.key.type === 4 && p.key.content === propKeyName
  11117. );
  11118. }
  11119. return result;
  11120. }
  11121. function toValidAssetId(name, type) {
  11122. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  11123. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  11124. })}`;
  11125. }
  11126. function getMemoedVNodeCall(node) {
  11127. if (node.type === 14 && node.callee === WITH_MEMO) {
  11128. return node.arguments[1].returns;
  11129. } else {
  11130. return node;
  11131. }
  11132. }
  11133. const decodeRE = /&(gt|lt|amp|apos|quot);/g;
  11134. const decodeMap = {
  11135. gt: ">",
  11136. lt: "<",
  11137. amp: "&",
  11138. apos: "'",
  11139. quot: '"'
  11140. };
  11141. const defaultParserOptions = {
  11142. delimiters: [`{{`, `}}`],
  11143. getNamespace: () => 0,
  11144. getTextMode: () => 0,
  11145. isVoidTag: NO,
  11146. isPreTag: NO,
  11147. isCustomElement: NO,
  11148. decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
  11149. onError: defaultOnError,
  11150. onWarn: defaultOnWarn,
  11151. comments: true
  11152. };
  11153. function baseParse(content, options = {}) {
  11154. const context = createParserContext(content, options);
  11155. const start = getCursor(context);
  11156. return createRoot(
  11157. parseChildren(context, 0, []),
  11158. getSelection(context, start)
  11159. );
  11160. }
  11161. function createParserContext(content, rawOptions) {
  11162. const options = extend({}, defaultParserOptions);
  11163. let key;
  11164. for (key in rawOptions) {
  11165. options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
  11166. }
  11167. return {
  11168. options,
  11169. column: 1,
  11170. line: 1,
  11171. offset: 0,
  11172. originalSource: content,
  11173. source: content,
  11174. inPre: false,
  11175. inVPre: false,
  11176. onWarn: options.onWarn
  11177. };
  11178. }
  11179. function parseChildren(context, mode, ancestors) {
  11180. const parent = last(ancestors);
  11181. const ns = parent ? parent.ns : 0;
  11182. const nodes = [];
  11183. while (!isEnd(context, mode, ancestors)) {
  11184. const s = context.source;
  11185. let node = void 0;
  11186. if (mode === 0 || mode === 1) {
  11187. if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
  11188. node = parseInterpolation(context, mode);
  11189. } else if (mode === 0 && s[0] === "<") {
  11190. if (s.length === 1) {
  11191. emitError(context, 5, 1);
  11192. } else if (s[1] === "!") {
  11193. if (startsWith(s, "<!--")) {
  11194. node = parseComment(context);
  11195. } else if (startsWith(s, "<!DOCTYPE")) {
  11196. node = parseBogusComment(context);
  11197. } else if (startsWith(s, "<![CDATA[")) {
  11198. if (ns !== 0) {
  11199. node = parseCDATA(context, ancestors);
  11200. } else {
  11201. emitError(context, 1);
  11202. node = parseBogusComment(context);
  11203. }
  11204. } else {
  11205. emitError(context, 11);
  11206. node = parseBogusComment(context);
  11207. }
  11208. } else if (s[1] === "/") {
  11209. if (s.length === 2) {
  11210. emitError(context, 5, 2);
  11211. } else if (s[2] === ">") {
  11212. emitError(context, 14, 2);
  11213. advanceBy(context, 3);
  11214. continue;
  11215. } else if (/[a-z]/i.test(s[2])) {
  11216. emitError(context, 23);
  11217. parseTag(context, 1 /* End */, parent);
  11218. continue;
  11219. } else {
  11220. emitError(
  11221. context,
  11222. 12,
  11223. 2
  11224. );
  11225. node = parseBogusComment(context);
  11226. }
  11227. } else if (/[a-z]/i.test(s[1])) {
  11228. node = parseElement(context, ancestors);
  11229. } else if (s[1] === "?") {
  11230. emitError(
  11231. context,
  11232. 21,
  11233. 1
  11234. );
  11235. node = parseBogusComment(context);
  11236. } else {
  11237. emitError(context, 12, 1);
  11238. }
  11239. }
  11240. }
  11241. if (!node) {
  11242. node = parseText(context, mode);
  11243. }
  11244. if (isArray(node)) {
  11245. for (let i = 0; i < node.length; i++) {
  11246. pushNode(nodes, node[i]);
  11247. }
  11248. } else {
  11249. pushNode(nodes, node);
  11250. }
  11251. }
  11252. let removedWhitespace = false;
  11253. if (mode !== 2 && mode !== 1) {
  11254. const shouldCondense = context.options.whitespace !== "preserve";
  11255. for (let i = 0; i < nodes.length; i++) {
  11256. const node = nodes[i];
  11257. if (node.type === 2) {
  11258. if (!context.inPre) {
  11259. if (!/[^\t\r\n\f ]/.test(node.content)) {
  11260. const prev = nodes[i - 1];
  11261. const next = nodes[i + 1];
  11262. if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
  11263. removedWhitespace = true;
  11264. nodes[i] = null;
  11265. } else {
  11266. node.content = " ";
  11267. }
  11268. } else if (shouldCondense) {
  11269. node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
  11270. }
  11271. } else {
  11272. node.content = node.content.replace(/\r\n/g, "\n");
  11273. }
  11274. } else if (node.type === 3 && !context.options.comments) {
  11275. removedWhitespace = true;
  11276. nodes[i] = null;
  11277. }
  11278. }
  11279. if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
  11280. const first = nodes[0];
  11281. if (first && first.type === 2) {
  11282. first.content = first.content.replace(/^\r?\n/, "");
  11283. }
  11284. }
  11285. }
  11286. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  11287. }
  11288. function pushNode(nodes, node) {
  11289. if (node.type === 2) {
  11290. const prev = last(nodes);
  11291. if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
  11292. prev.content += node.content;
  11293. prev.loc.end = node.loc.end;
  11294. prev.loc.source += node.loc.source;
  11295. return;
  11296. }
  11297. }
  11298. nodes.push(node);
  11299. }
  11300. function parseCDATA(context, ancestors) {
  11301. advanceBy(context, 9);
  11302. const nodes = parseChildren(context, 3, ancestors);
  11303. if (context.source.length === 0) {
  11304. emitError(context, 6);
  11305. } else {
  11306. advanceBy(context, 3);
  11307. }
  11308. return nodes;
  11309. }
  11310. function parseComment(context) {
  11311. const start = getCursor(context);
  11312. let content;
  11313. const match = /--(\!)?>/.exec(context.source);
  11314. if (!match) {
  11315. content = context.source.slice(4);
  11316. advanceBy(context, context.source.length);
  11317. emitError(context, 7);
  11318. } else {
  11319. if (match.index <= 3) {
  11320. emitError(context, 0);
  11321. }
  11322. if (match[1]) {
  11323. emitError(context, 10);
  11324. }
  11325. content = context.source.slice(4, match.index);
  11326. const s = context.source.slice(0, match.index);
  11327. let prevIndex = 1, nestedIndex = 0;
  11328. while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
  11329. advanceBy(context, nestedIndex - prevIndex + 1);
  11330. if (nestedIndex + 4 < s.length) {
  11331. emitError(context, 16);
  11332. }
  11333. prevIndex = nestedIndex + 1;
  11334. }
  11335. advanceBy(context, match.index + match[0].length - prevIndex + 1);
  11336. }
  11337. return {
  11338. type: 3,
  11339. content,
  11340. loc: getSelection(context, start)
  11341. };
  11342. }
  11343. function parseBogusComment(context) {
  11344. const start = getCursor(context);
  11345. const contentStart = context.source[1] === "?" ? 1 : 2;
  11346. let content;
  11347. const closeIndex = context.source.indexOf(">");
  11348. if (closeIndex === -1) {
  11349. content = context.source.slice(contentStart);
  11350. advanceBy(context, context.source.length);
  11351. } else {
  11352. content = context.source.slice(contentStart, closeIndex);
  11353. advanceBy(context, closeIndex + 1);
  11354. }
  11355. return {
  11356. type: 3,
  11357. content,
  11358. loc: getSelection(context, start)
  11359. };
  11360. }
  11361. function parseElement(context, ancestors) {
  11362. const wasInPre = context.inPre;
  11363. const wasInVPre = context.inVPre;
  11364. const parent = last(ancestors);
  11365. const element = parseTag(context, 0 /* Start */, parent);
  11366. const isPreBoundary = context.inPre && !wasInPre;
  11367. const isVPreBoundary = context.inVPre && !wasInVPre;
  11368. if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
  11369. if (isPreBoundary) {
  11370. context.inPre = false;
  11371. }
  11372. if (isVPreBoundary) {
  11373. context.inVPre = false;
  11374. }
  11375. return element;
  11376. }
  11377. ancestors.push(element);
  11378. const mode = context.options.getTextMode(element, parent);
  11379. const children = parseChildren(context, mode, ancestors);
  11380. ancestors.pop();
  11381. element.children = children;
  11382. if (startsWithEndTagOpen(context.source, element.tag)) {
  11383. parseTag(context, 1 /* End */, parent);
  11384. } else {
  11385. emitError(context, 24, 0, element.loc.start);
  11386. if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
  11387. const first = children[0];
  11388. if (first && startsWith(first.loc.source, "<!--")) {
  11389. emitError(context, 8);
  11390. }
  11391. }
  11392. }
  11393. element.loc = getSelection(context, element.loc.start);
  11394. if (isPreBoundary) {
  11395. context.inPre = false;
  11396. }
  11397. if (isVPreBoundary) {
  11398. context.inVPre = false;
  11399. }
  11400. return element;
  11401. }
  11402. const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
  11403. `if,else,else-if,for,slot`
  11404. );
  11405. function parseTag(context, type, parent) {
  11406. const start = getCursor(context);
  11407. const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
  11408. const tag = match[1];
  11409. const ns = context.options.getNamespace(tag, parent);
  11410. advanceBy(context, match[0].length);
  11411. advanceSpaces(context);
  11412. const cursor = getCursor(context);
  11413. const currentSource = context.source;
  11414. if (context.options.isPreTag(tag)) {
  11415. context.inPre = true;
  11416. }
  11417. let props = parseAttributes(context, type);
  11418. if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
  11419. context.inVPre = true;
  11420. extend(context, cursor);
  11421. context.source = currentSource;
  11422. props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
  11423. }
  11424. let isSelfClosing = false;
  11425. if (context.source.length === 0) {
  11426. emitError(context, 9);
  11427. } else {
  11428. isSelfClosing = startsWith(context.source, "/>");
  11429. if (type === 1 /* End */ && isSelfClosing) {
  11430. emitError(context, 4);
  11431. }
  11432. advanceBy(context, isSelfClosing ? 2 : 1);
  11433. }
  11434. if (type === 1 /* End */) {
  11435. return;
  11436. }
  11437. let tagType = 0;
  11438. if (!context.inVPre) {
  11439. if (tag === "slot") {
  11440. tagType = 2;
  11441. } else if (tag === "template") {
  11442. if (props.some(
  11443. (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
  11444. )) {
  11445. tagType = 3;
  11446. }
  11447. } else if (isComponent(tag, props, context)) {
  11448. tagType = 1;
  11449. }
  11450. }
  11451. return {
  11452. type: 1,
  11453. ns,
  11454. tag,
  11455. tagType,
  11456. props,
  11457. isSelfClosing,
  11458. children: [],
  11459. loc: getSelection(context, start),
  11460. codegenNode: void 0
  11461. // to be created during transform phase
  11462. };
  11463. }
  11464. function isComponent(tag, props, context) {
  11465. const options = context.options;
  11466. if (options.isCustomElement(tag)) {
  11467. return false;
  11468. }
  11469. if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
  11470. return true;
  11471. }
  11472. for (let i = 0; i < props.length; i++) {
  11473. const p = props[i];
  11474. if (p.type === 6) {
  11475. if (p.name === "is" && p.value) {
  11476. if (p.value.content.startsWith("vue:")) {
  11477. return true;
  11478. }
  11479. }
  11480. } else {
  11481. if (p.name === "is") {
  11482. return true;
  11483. } else if (
  11484. // :is on plain element - only treat as component in compat mode
  11485. p.name === "bind" && isStaticArgOf(p.arg, "is") && false
  11486. ) {
  11487. return true;
  11488. }
  11489. }
  11490. }
  11491. }
  11492. function parseAttributes(context, type) {
  11493. const props = [];
  11494. const attributeNames = /* @__PURE__ */ new Set();
  11495. while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
  11496. if (startsWith(context.source, "/")) {
  11497. emitError(context, 22);
  11498. advanceBy(context, 1);
  11499. advanceSpaces(context);
  11500. continue;
  11501. }
  11502. if (type === 1 /* End */) {
  11503. emitError(context, 3);
  11504. }
  11505. const attr = parseAttribute(context, attributeNames);
  11506. if (attr.type === 6 && attr.value && attr.name === "class") {
  11507. attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
  11508. }
  11509. if (type === 0 /* Start */) {
  11510. props.push(attr);
  11511. }
  11512. if (/^[^\t\r\n\f />]/.test(context.source)) {
  11513. emitError(context, 15);
  11514. }
  11515. advanceSpaces(context);
  11516. }
  11517. return props;
  11518. }
  11519. function parseAttribute(context, nameSet) {
  11520. var _a;
  11521. const start = getCursor(context);
  11522. const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
  11523. const name = match[0];
  11524. if (nameSet.has(name)) {
  11525. emitError(context, 2);
  11526. }
  11527. nameSet.add(name);
  11528. if (name[0] === "=") {
  11529. emitError(context, 19);
  11530. }
  11531. {
  11532. const pattern = /["'<]/g;
  11533. let m;
  11534. while (m = pattern.exec(name)) {
  11535. emitError(
  11536. context,
  11537. 17,
  11538. m.index
  11539. );
  11540. }
  11541. }
  11542. advanceBy(context, name.length);
  11543. let value = void 0;
  11544. if (/^[\t\r\n\f ]*=/.test(context.source)) {
  11545. advanceSpaces(context);
  11546. advanceBy(context, 1);
  11547. advanceSpaces(context);
  11548. value = parseAttributeValue(context);
  11549. if (!value) {
  11550. emitError(context, 13);
  11551. }
  11552. }
  11553. const loc = getSelection(context, start);
  11554. if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
  11555. const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
  11556. name
  11557. );
  11558. let isPropShorthand = startsWith(name, ".");
  11559. let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
  11560. let arg;
  11561. if (match2[2]) {
  11562. const isSlot = dirName === "slot";
  11563. const startOffset = name.lastIndexOf(
  11564. match2[2],
  11565. name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
  11566. );
  11567. const loc2 = getSelection(
  11568. context,
  11569. getNewPosition(context, start, startOffset),
  11570. getNewPosition(
  11571. context,
  11572. start,
  11573. startOffset + match2[2].length + (isSlot && match2[3] || "").length
  11574. )
  11575. );
  11576. let content = match2[2];
  11577. let isStatic = true;
  11578. if (content.startsWith("[")) {
  11579. isStatic = false;
  11580. if (!content.endsWith("]")) {
  11581. emitError(
  11582. context,
  11583. 27
  11584. );
  11585. content = content.slice(1);
  11586. } else {
  11587. content = content.slice(1, content.length - 1);
  11588. }
  11589. } else if (isSlot) {
  11590. content += match2[3] || "";
  11591. }
  11592. arg = {
  11593. type: 4,
  11594. content,
  11595. isStatic,
  11596. constType: isStatic ? 3 : 0,
  11597. loc: loc2
  11598. };
  11599. }
  11600. if (value && value.isQuoted) {
  11601. const valueLoc = value.loc;
  11602. valueLoc.start.offset++;
  11603. valueLoc.start.column++;
  11604. valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
  11605. valueLoc.source = valueLoc.source.slice(1, -1);
  11606. }
  11607. const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
  11608. if (isPropShorthand)
  11609. modifiers.push("prop");
  11610. return {
  11611. type: 7,
  11612. name: dirName,
  11613. exp: value && {
  11614. type: 4,
  11615. content: value.content,
  11616. isStatic: false,
  11617. // Treat as non-constant by default. This can be potentially set to
  11618. // other values by `transformExpression` to make it eligible for hoisting.
  11619. constType: 0,
  11620. loc: value.loc
  11621. },
  11622. arg,
  11623. modifiers,
  11624. loc
  11625. };
  11626. }
  11627. if (!context.inVPre && startsWith(name, "v-")) {
  11628. emitError(context, 26);
  11629. }
  11630. return {
  11631. type: 6,
  11632. name,
  11633. value: value && {
  11634. type: 2,
  11635. content: value.content,
  11636. loc: value.loc
  11637. },
  11638. loc
  11639. };
  11640. }
  11641. function parseAttributeValue(context) {
  11642. const start = getCursor(context);
  11643. let content;
  11644. const quote = context.source[0];
  11645. const isQuoted = quote === `"` || quote === `'`;
  11646. if (isQuoted) {
  11647. advanceBy(context, 1);
  11648. const endIndex = context.source.indexOf(quote);
  11649. if (endIndex === -1) {
  11650. content = parseTextData(
  11651. context,
  11652. context.source.length,
  11653. 4
  11654. );
  11655. } else {
  11656. content = parseTextData(context, endIndex, 4);
  11657. advanceBy(context, 1);
  11658. }
  11659. } else {
  11660. const match = /^[^\t\r\n\f >]+/.exec(context.source);
  11661. if (!match) {
  11662. return void 0;
  11663. }
  11664. const unexpectedChars = /["'<=`]/g;
  11665. let m;
  11666. while (m = unexpectedChars.exec(match[0])) {
  11667. emitError(
  11668. context,
  11669. 18,
  11670. m.index
  11671. );
  11672. }
  11673. content = parseTextData(context, match[0].length, 4);
  11674. }
  11675. return {content, isQuoted, loc: getSelection(context, start)};
  11676. }
  11677. function parseInterpolation(context, mode) {
  11678. const [open, close] = context.options.delimiters;
  11679. const closeIndex = context.source.indexOf(close, open.length);
  11680. if (closeIndex === -1) {
  11681. emitError(context, 25);
  11682. return void 0;
  11683. }
  11684. const start = getCursor(context);
  11685. advanceBy(context, open.length);
  11686. const innerStart = getCursor(context);
  11687. const innerEnd = getCursor(context);
  11688. const rawContentLength = closeIndex - open.length;
  11689. const rawContent = context.source.slice(0, rawContentLength);
  11690. const preTrimContent = parseTextData(context, rawContentLength, mode);
  11691. const content = preTrimContent.trim();
  11692. const startOffset = preTrimContent.indexOf(content);
  11693. if (startOffset > 0) {
  11694. advancePositionWithMutation(innerStart, rawContent, startOffset);
  11695. }
  11696. const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
  11697. advancePositionWithMutation(innerEnd, rawContent, endOffset);
  11698. advanceBy(context, close.length);
  11699. return {
  11700. type: 5,
  11701. content: {
  11702. type: 4,
  11703. isStatic: false,
  11704. // Set `isConstant` to false by default and will decide in transformExpression
  11705. constType: 0,
  11706. content,
  11707. loc: getSelection(context, innerStart, innerEnd)
  11708. },
  11709. loc: getSelection(context, start)
  11710. };
  11711. }
  11712. function parseText(context, mode) {
  11713. const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
  11714. let endIndex = context.source.length;
  11715. for (let i = 0; i < endTokens.length; i++) {
  11716. const index = context.source.indexOf(endTokens[i], 1);
  11717. if (index !== -1 && endIndex > index) {
  11718. endIndex = index;
  11719. }
  11720. }
  11721. const start = getCursor(context);
  11722. const content = parseTextData(context, endIndex, mode);
  11723. return {
  11724. type: 2,
  11725. content,
  11726. loc: getSelection(context, start)
  11727. };
  11728. }
  11729. function parseTextData(context, length, mode) {
  11730. const rawText = context.source.slice(0, length);
  11731. advanceBy(context, length);
  11732. if (mode === 2 || mode === 3 || !rawText.includes("&")) {
  11733. return rawText;
  11734. } else {
  11735. return context.options.decodeEntities(
  11736. rawText,
  11737. mode === 4
  11738. );
  11739. }
  11740. }
  11741. function getCursor(context) {
  11742. const {column, line, offset} = context;
  11743. return {column, line, offset};
  11744. }
  11745. function getSelection(context, start, end) {
  11746. end = end || getCursor(context);
  11747. return {
  11748. start,
  11749. end,
  11750. source: context.originalSource.slice(start.offset, end.offset)
  11751. };
  11752. }
  11753. function last(xs) {
  11754. return xs[xs.length - 1];
  11755. }
  11756. function startsWith(source, searchString) {
  11757. return source.startsWith(searchString);
  11758. }
  11759. function advanceBy(context, numberOfCharacters) {
  11760. const {source} = context;
  11761. advancePositionWithMutation(context, source, numberOfCharacters);
  11762. context.source = source.slice(numberOfCharacters);
  11763. }
  11764. function advanceSpaces(context) {
  11765. const match = /^[\t\r\n\f ]+/.exec(context.source);
  11766. if (match) {
  11767. advanceBy(context, match[0].length);
  11768. }
  11769. }
  11770. function getNewPosition(context, start, numberOfCharacters) {
  11771. return advancePositionWithClone(
  11772. start,
  11773. context.originalSource.slice(start.offset, numberOfCharacters),
  11774. numberOfCharacters
  11775. );
  11776. }
  11777. function emitError(context, code, offset, loc = getCursor(context)) {
  11778. if (offset) {
  11779. loc.offset += offset;
  11780. loc.column += offset;
  11781. }
  11782. context.options.onError(
  11783. createCompilerError(code, {
  11784. start: loc,
  11785. end: loc,
  11786. source: ""
  11787. })
  11788. );
  11789. }
  11790. function isEnd(context, mode, ancestors) {
  11791. const s = context.source;
  11792. switch (mode) {
  11793. case 0:
  11794. if (startsWith(s, "</")) {
  11795. for (let i = ancestors.length - 1; i >= 0; --i) {
  11796. if (startsWithEndTagOpen(s, ancestors[i].tag)) {
  11797. return true;
  11798. }
  11799. }
  11800. }
  11801. break;
  11802. case 1:
  11803. case 2: {
  11804. const parent = last(ancestors);
  11805. if (parent && startsWithEndTagOpen(s, parent.tag)) {
  11806. return true;
  11807. }
  11808. break;
  11809. }
  11810. case 3:
  11811. if (startsWith(s, "]]>")) {
  11812. return true;
  11813. }
  11814. break;
  11815. }
  11816. return !s;
  11817. }
  11818. function startsWithEndTagOpen(source, tag) {
  11819. return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
  11820. }
  11821. function hoistStatic(root, context) {
  11822. walk(
  11823. root,
  11824. context,
  11825. // Root node is unfortunately non-hoistable due to potential parent
  11826. // fallthrough attributes.
  11827. isSingleElementRoot(root, root.children[0])
  11828. );
  11829. }
  11830. function isSingleElementRoot(root, child) {
  11831. const {children} = root;
  11832. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  11833. }
  11834. function walk(node, context, doNotHoistNode = false) {
  11835. const {children} = node;
  11836. const originalCount = children.length;
  11837. let hoistedCount = 0;
  11838. for (let i = 0; i < children.length; i++) {
  11839. const child = children[i];
  11840. if (child.type === 1 && child.tagType === 0) {
  11841. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  11842. if (constantType > 0) {
  11843. if (constantType >= 2) {
  11844. child.codegenNode.patchFlag = -1 + (` /* HOISTED */`);
  11845. child.codegenNode = context.hoist(child.codegenNode);
  11846. hoistedCount++;
  11847. continue;
  11848. }
  11849. } else {
  11850. const codegenNode = child.codegenNode;
  11851. if (codegenNode.type === 13) {
  11852. const flag = getPatchFlag(codegenNode);
  11853. if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  11854. const props = getNodeProps(child);
  11855. if (props) {
  11856. codegenNode.props = context.hoist(props);
  11857. }
  11858. }
  11859. if (codegenNode.dynamicProps) {
  11860. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  11861. }
  11862. }
  11863. }
  11864. }
  11865. if (child.type === 1) {
  11866. const isComponent = child.tagType === 1;
  11867. if (isComponent) {
  11868. context.scopes.vSlot++;
  11869. }
  11870. walk(child, context);
  11871. if (isComponent) {
  11872. context.scopes.vSlot--;
  11873. }
  11874. } else if (child.type === 11) {
  11875. walk(child, context, child.children.length === 1);
  11876. } else if (child.type === 9) {
  11877. for (let i2 = 0; i2 < child.branches.length; i2++) {
  11878. walk(
  11879. child.branches[i2],
  11880. context,
  11881. child.branches[i2].children.length === 1
  11882. );
  11883. }
  11884. }
  11885. }
  11886. if (hoistedCount && context.transformHoist) {
  11887. context.transformHoist(children, context, node);
  11888. }
  11889. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  11890. const hoisted = context.hoist(
  11891. createArrayExpression(node.codegenNode.children)
  11892. );
  11893. if (context.hmr) {
  11894. hoisted.content = `[...${hoisted.content}]`;
  11895. }
  11896. node.codegenNode.children = hoisted;
  11897. }
  11898. }
  11899. function getConstantType(node, context) {
  11900. const {constantCache} = context;
  11901. switch (node.type) {
  11902. case 1:
  11903. if (node.tagType !== 0) {
  11904. return 0;
  11905. }
  11906. const cached = constantCache.get(node);
  11907. if (cached !== void 0) {
  11908. return cached;
  11909. }
  11910. const codegenNode = node.codegenNode;
  11911. if (codegenNode.type !== 13) {
  11912. return 0;
  11913. }
  11914. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
  11915. return 0;
  11916. }
  11917. const flag = getPatchFlag(codegenNode);
  11918. if (!flag) {
  11919. let returnType2 = 3;
  11920. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  11921. if (generatedPropsType === 0) {
  11922. constantCache.set(node, 0);
  11923. return 0;
  11924. }
  11925. if (generatedPropsType < returnType2) {
  11926. returnType2 = generatedPropsType;
  11927. }
  11928. for (let i = 0; i < node.children.length; i++) {
  11929. const childType = getConstantType(node.children[i], context);
  11930. if (childType === 0) {
  11931. constantCache.set(node, 0);
  11932. return 0;
  11933. }
  11934. if (childType < returnType2) {
  11935. returnType2 = childType;
  11936. }
  11937. }
  11938. if (returnType2 > 1) {
  11939. for (let i = 0; i < node.props.length; i++) {
  11940. const p = node.props[i];
  11941. if (p.type === 7 && p.name === "bind" && p.exp) {
  11942. const expType = getConstantType(p.exp, context);
  11943. if (expType === 0) {
  11944. constantCache.set(node, 0);
  11945. return 0;
  11946. }
  11947. if (expType < returnType2) {
  11948. returnType2 = expType;
  11949. }
  11950. }
  11951. }
  11952. }
  11953. if (codegenNode.isBlock) {
  11954. for (let i = 0; i < node.props.length; i++) {
  11955. const p = node.props[i];
  11956. if (p.type === 7) {
  11957. constantCache.set(node, 0);
  11958. return 0;
  11959. }
  11960. }
  11961. context.removeHelper(OPEN_BLOCK);
  11962. context.removeHelper(
  11963. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  11964. );
  11965. codegenNode.isBlock = false;
  11966. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  11967. }
  11968. constantCache.set(node, returnType2);
  11969. return returnType2;
  11970. } else {
  11971. constantCache.set(node, 0);
  11972. return 0;
  11973. }
  11974. case 2:
  11975. case 3:
  11976. return 3;
  11977. case 9:
  11978. case 11:
  11979. case 10:
  11980. return 0;
  11981. case 5:
  11982. case 12:
  11983. return getConstantType(node.content, context);
  11984. case 4:
  11985. return node.constType;
  11986. case 8:
  11987. let returnType = 3;
  11988. for (let i = 0; i < node.children.length; i++) {
  11989. const child = node.children[i];
  11990. if (isString(child) || isSymbol(child)) {
  11991. continue;
  11992. }
  11993. const childType = getConstantType(child, context);
  11994. if (childType === 0) {
  11995. return 0;
  11996. } else if (childType < returnType) {
  11997. returnType = childType;
  11998. }
  11999. }
  12000. return returnType;
  12001. default:
  12002. return 0;
  12003. }
  12004. }
  12005. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  12006. NORMALIZE_CLASS,
  12007. NORMALIZE_STYLE,
  12008. NORMALIZE_PROPS,
  12009. GUARD_REACTIVE_PROPS
  12010. ]);
  12011. function getConstantTypeOfHelperCall(value, context) {
  12012. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  12013. const arg = value.arguments[0];
  12014. if (arg.type === 4) {
  12015. return getConstantType(arg, context);
  12016. } else if (arg.type === 14) {
  12017. return getConstantTypeOfHelperCall(arg, context);
  12018. }
  12019. }
  12020. return 0;
  12021. }
  12022. function getGeneratedPropsConstantType(node, context) {
  12023. let returnType = 3;
  12024. const props = getNodeProps(node);
  12025. if (props && props.type === 15) {
  12026. const {properties} = props;
  12027. for (let i = 0; i < properties.length; i++) {
  12028. const {key, value} = properties[i];
  12029. const keyType = getConstantType(key, context);
  12030. if (keyType === 0) {
  12031. return keyType;
  12032. }
  12033. if (keyType < returnType) {
  12034. returnType = keyType;
  12035. }
  12036. let valueType;
  12037. if (value.type === 4) {
  12038. valueType = getConstantType(value, context);
  12039. } else if (value.type === 14) {
  12040. valueType = getConstantTypeOfHelperCall(value, context);
  12041. } else {
  12042. valueType = 0;
  12043. }
  12044. if (valueType === 0) {
  12045. return valueType;
  12046. }
  12047. if (valueType < returnType) {
  12048. returnType = valueType;
  12049. }
  12050. }
  12051. }
  12052. return returnType;
  12053. }
  12054. function getNodeProps(node) {
  12055. const codegenNode = node.codegenNode;
  12056. if (codegenNode.type === 13) {
  12057. return codegenNode.props;
  12058. }
  12059. }
  12060. function getPatchFlag(node) {
  12061. const flag = node.patchFlag;
  12062. return flag ? parseInt(flag, 10) : void 0;
  12063. }
  12064. function createTransformContext(root, {
  12065. filename = "",
  12066. prefixIdentifiers = false,
  12067. hoistStatic: hoistStatic2 = false,
  12068. hmr = false,
  12069. cacheHandlers = false,
  12070. nodeTransforms = [],
  12071. directiveTransforms = {},
  12072. transformHoist = null,
  12073. isBuiltInComponent = NOOP,
  12074. isCustomElement = NOOP,
  12075. expressionPlugins = [],
  12076. scopeId = null,
  12077. slotted = true,
  12078. ssr = false,
  12079. inSSR = false,
  12080. ssrCssVars = ``,
  12081. bindingMetadata = EMPTY_OBJ,
  12082. inline = false,
  12083. isTS = false,
  12084. onError = defaultOnError,
  12085. onWarn = defaultOnWarn,
  12086. compatConfig
  12087. }) {
  12088. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  12089. const context = {
  12090. // options
  12091. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  12092. prefixIdentifiers,
  12093. hoistStatic: hoistStatic2,
  12094. hmr,
  12095. cacheHandlers,
  12096. nodeTransforms,
  12097. directiveTransforms,
  12098. transformHoist,
  12099. isBuiltInComponent,
  12100. isCustomElement,
  12101. expressionPlugins,
  12102. scopeId,
  12103. slotted,
  12104. ssr,
  12105. inSSR,
  12106. ssrCssVars,
  12107. bindingMetadata,
  12108. inline,
  12109. isTS,
  12110. onError,
  12111. onWarn,
  12112. compatConfig,
  12113. // state
  12114. root,
  12115. helpers: /* @__PURE__ */ new Map(),
  12116. components: /* @__PURE__ */ new Set(),
  12117. directives: /* @__PURE__ */ new Set(),
  12118. hoists: [],
  12119. imports: [],
  12120. constantCache: /* @__PURE__ */ new WeakMap(),
  12121. temps: 0,
  12122. cached: 0,
  12123. identifiers: /* @__PURE__ */ Object.create(null),
  12124. scopes: {
  12125. vFor: 0,
  12126. vSlot: 0,
  12127. vPre: 0,
  12128. vOnce: 0
  12129. },
  12130. parent: null,
  12131. currentNode: root,
  12132. childIndex: 0,
  12133. inVOnce: false,
  12134. // methods
  12135. helper(name) {
  12136. const count = context.helpers.get(name) || 0;
  12137. context.helpers.set(name, count + 1);
  12138. return name;
  12139. },
  12140. removeHelper(name) {
  12141. const count = context.helpers.get(name);
  12142. if (count) {
  12143. const currentCount = count - 1;
  12144. if (!currentCount) {
  12145. context.helpers.delete(name);
  12146. } else {
  12147. context.helpers.set(name, currentCount);
  12148. }
  12149. }
  12150. },
  12151. helperString(name) {
  12152. return `_${helperNameMap[context.helper(name)]}`;
  12153. },
  12154. replaceNode(node) {
  12155. {
  12156. if (!context.currentNode) {
  12157. throw new Error(`Node being replaced is already removed.`);
  12158. }
  12159. if (!context.parent) {
  12160. throw new Error(`Cannot replace root node.`);
  12161. }
  12162. }
  12163. context.parent.children[context.childIndex] = context.currentNode = node;
  12164. },
  12165. removeNode(node) {
  12166. if (!context.parent) {
  12167. throw new Error(`Cannot remove root node.`);
  12168. }
  12169. const list = context.parent.children;
  12170. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  12171. if (removalIndex < 0) {
  12172. throw new Error(`node being removed is not a child of current parent`);
  12173. }
  12174. if (!node || node === context.currentNode) {
  12175. context.currentNode = null;
  12176. context.onNodeRemoved();
  12177. } else {
  12178. if (context.childIndex > removalIndex) {
  12179. context.childIndex--;
  12180. context.onNodeRemoved();
  12181. }
  12182. }
  12183. context.parent.children.splice(removalIndex, 1);
  12184. },
  12185. onNodeRemoved: () => {
  12186. },
  12187. addIdentifiers(exp) {
  12188. },
  12189. removeIdentifiers(exp) {
  12190. },
  12191. hoist(exp) {
  12192. if (isString(exp))
  12193. exp = createSimpleExpression(exp);
  12194. context.hoists.push(exp);
  12195. const identifier = createSimpleExpression(
  12196. `_hoisted_${context.hoists.length}`,
  12197. false,
  12198. exp.loc,
  12199. 2
  12200. );
  12201. identifier.hoisted = exp;
  12202. return identifier;
  12203. },
  12204. cache(exp, isVNode = false) {
  12205. return createCacheExpression(context.cached++, exp, isVNode);
  12206. }
  12207. };
  12208. return context;
  12209. }
  12210. function transform(root, options) {
  12211. const context = createTransformContext(root, options);
  12212. traverseNode(root, context);
  12213. if (options.hoistStatic) {
  12214. hoistStatic(root, context);
  12215. }
  12216. if (!options.ssr) {
  12217. createRootCodegen(root, context);
  12218. }
  12219. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  12220. root.components = [...context.components];
  12221. root.directives = [...context.directives];
  12222. root.imports = context.imports;
  12223. root.hoists = context.hoists;
  12224. root.temps = context.temps;
  12225. root.cached = context.cached;
  12226. }
  12227. function createRootCodegen(root, context) {
  12228. const {helper} = context;
  12229. const {children} = root;
  12230. if (children.length === 1) {
  12231. const child = children[0];
  12232. if (isSingleElementRoot(root, child) && child.codegenNode) {
  12233. const codegenNode = child.codegenNode;
  12234. if (codegenNode.type === 13) {
  12235. convertToBlock(codegenNode, context);
  12236. }
  12237. root.codegenNode = codegenNode;
  12238. } else {
  12239. root.codegenNode = child;
  12240. }
  12241. } else if (children.length > 1) {
  12242. let patchFlag = 64;
  12243. let patchFlagText = PatchFlagNames[64];
  12244. if (children.filter((c) => c.type !== 3).length === 1) {
  12245. patchFlag |= 2048;
  12246. patchFlagText += `, ${PatchFlagNames[2048]}`;
  12247. }
  12248. root.codegenNode = createVNodeCall(
  12249. context,
  12250. helper(FRAGMENT),
  12251. void 0,
  12252. root.children,
  12253. patchFlag + (` /* ${patchFlagText} */`),
  12254. void 0,
  12255. void 0,
  12256. true,
  12257. void 0,
  12258. false
  12259. /* isComponent */
  12260. );
  12261. } else ;
  12262. }
  12263. function traverseChildren(parent, context) {
  12264. let i = 0;
  12265. const nodeRemoved = () => {
  12266. i--;
  12267. };
  12268. for (; i < parent.children.length; i++) {
  12269. const child = parent.children[i];
  12270. if (isString(child))
  12271. continue;
  12272. context.parent = parent;
  12273. context.childIndex = i;
  12274. context.onNodeRemoved = nodeRemoved;
  12275. traverseNode(child, context);
  12276. }
  12277. }
  12278. function traverseNode(node, context) {
  12279. context.currentNode = node;
  12280. const {nodeTransforms} = context;
  12281. const exitFns = [];
  12282. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  12283. const onExit = nodeTransforms[i2](node, context);
  12284. if (onExit) {
  12285. if (isArray(onExit)) {
  12286. exitFns.push(...onExit);
  12287. } else {
  12288. exitFns.push(onExit);
  12289. }
  12290. }
  12291. if (!context.currentNode) {
  12292. return;
  12293. } else {
  12294. node = context.currentNode;
  12295. }
  12296. }
  12297. switch (node.type) {
  12298. case 3:
  12299. if (!context.ssr) {
  12300. context.helper(CREATE_COMMENT);
  12301. }
  12302. break;
  12303. case 5:
  12304. if (!context.ssr) {
  12305. context.helper(TO_DISPLAY_STRING);
  12306. }
  12307. break;
  12308. case 9:
  12309. for (let i2 = 0; i2 < node.branches.length; i2++) {
  12310. traverseNode(node.branches[i2], context);
  12311. }
  12312. break;
  12313. case 10:
  12314. case 11:
  12315. case 1:
  12316. case 0:
  12317. traverseChildren(node, context);
  12318. break;
  12319. }
  12320. context.currentNode = node;
  12321. let i = exitFns.length;
  12322. while (i--) {
  12323. exitFns[i]();
  12324. }
  12325. }
  12326. function createStructuralDirectiveTransform(name, fn) {
  12327. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  12328. return (node, context) => {
  12329. if (node.type === 1) {
  12330. const {props} = node;
  12331. if (node.tagType === 3 && props.some(isVSlot)) {
  12332. return;
  12333. }
  12334. const exitFns = [];
  12335. for (let i = 0; i < props.length; i++) {
  12336. const prop = props[i];
  12337. if (prop.type === 7 && matches(prop.name)) {
  12338. props.splice(i, 1);
  12339. i--;
  12340. const onExit = fn(node, prop, context);
  12341. if (onExit)
  12342. exitFns.push(onExit);
  12343. }
  12344. }
  12345. return exitFns;
  12346. }
  12347. };
  12348. }
  12349. const PURE_ANNOTATION = `/*#__PURE__*/`;
  12350. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  12351. function createCodegenContext(ast, {
  12352. mode = "function",
  12353. prefixIdentifiers = mode === "module",
  12354. sourceMap = false,
  12355. filename = `template.vue.html`,
  12356. scopeId = null,
  12357. optimizeImports = false,
  12358. runtimeGlobalName = `Vue`,
  12359. runtimeModuleName = `vue`,
  12360. ssrRuntimeModuleName = "vue/server-renderer",
  12361. ssr = false,
  12362. isTS = false,
  12363. inSSR = false
  12364. }) {
  12365. const context = {
  12366. mode,
  12367. prefixIdentifiers,
  12368. sourceMap,
  12369. filename,
  12370. scopeId,
  12371. optimizeImports,
  12372. runtimeGlobalName,
  12373. runtimeModuleName,
  12374. ssrRuntimeModuleName,
  12375. ssr,
  12376. isTS,
  12377. inSSR,
  12378. source: ast.loc.source,
  12379. code: ``,
  12380. column: 1,
  12381. line: 1,
  12382. offset: 0,
  12383. indentLevel: 0,
  12384. pure: false,
  12385. map: void 0,
  12386. helper(key) {
  12387. return `_${helperNameMap[key]}`;
  12388. },
  12389. push(code, node) {
  12390. context.code += code;
  12391. },
  12392. indent() {
  12393. newline(++context.indentLevel);
  12394. },
  12395. deindent(withoutNewLine = false) {
  12396. if (withoutNewLine) {
  12397. --context.indentLevel;
  12398. } else {
  12399. newline(--context.indentLevel);
  12400. }
  12401. },
  12402. newline() {
  12403. newline(context.indentLevel);
  12404. }
  12405. };
  12406. function newline(n) {
  12407. context.push("\n" + ` `.repeat(n));
  12408. }
  12409. return context;
  12410. }
  12411. function generate(ast, options = {}) {
  12412. const context = createCodegenContext(ast, options);
  12413. if (options.onContextCreated)
  12414. options.onContextCreated(context);
  12415. const {
  12416. mode,
  12417. push,
  12418. prefixIdentifiers,
  12419. indent,
  12420. deindent,
  12421. newline,
  12422. scopeId,
  12423. ssr
  12424. } = context;
  12425. const helpers = Array.from(ast.helpers);
  12426. const hasHelpers = helpers.length > 0;
  12427. const useWithBlock = !prefixIdentifiers && mode !== "module";
  12428. const isSetupInlined = false;
  12429. const preambleContext = isSetupInlined ? createCodegenContext(ast, options) : context;
  12430. {
  12431. genFunctionPreamble(ast, preambleContext);
  12432. }
  12433. const functionName = ssr ? `ssrRender` : `render`;
  12434. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  12435. const signature = args.join(", ");
  12436. {
  12437. push(`function ${functionName}(${signature}) {`);
  12438. }
  12439. indent();
  12440. if (useWithBlock) {
  12441. push(`with (_ctx) {`);
  12442. indent();
  12443. if (hasHelpers) {
  12444. push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
  12445. push(`
  12446. `);
  12447. newline();
  12448. }
  12449. }
  12450. if (ast.components.length) {
  12451. genAssets(ast.components, "component", context);
  12452. if (ast.directives.length || ast.temps > 0) {
  12453. newline();
  12454. }
  12455. }
  12456. if (ast.directives.length) {
  12457. genAssets(ast.directives, "directive", context);
  12458. if (ast.temps > 0) {
  12459. newline();
  12460. }
  12461. }
  12462. if (ast.temps > 0) {
  12463. push(`let `);
  12464. for (let i = 0; i < ast.temps; i++) {
  12465. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  12466. }
  12467. }
  12468. if (ast.components.length || ast.directives.length || ast.temps) {
  12469. push(`
  12470. `);
  12471. newline();
  12472. }
  12473. if (!ssr) {
  12474. push(`return `);
  12475. }
  12476. if (ast.codegenNode) {
  12477. genNode(ast.codegenNode, context);
  12478. } else {
  12479. push(`null`);
  12480. }
  12481. if (useWithBlock) {
  12482. deindent();
  12483. push(`}`);
  12484. }
  12485. deindent();
  12486. push(`}`);
  12487. return {
  12488. ast,
  12489. code: context.code,
  12490. preamble: isSetupInlined ? preambleContext.code : ``,
  12491. // SourceMapGenerator does have toJSON() method but it's not in the types
  12492. map: context.map ? context.map.toJSON() : void 0
  12493. };
  12494. }
  12495. function genFunctionPreamble(ast, context) {
  12496. const {
  12497. ssr,
  12498. prefixIdentifiers,
  12499. push,
  12500. newline,
  12501. runtimeModuleName,
  12502. runtimeGlobalName,
  12503. ssrRuntimeModuleName
  12504. } = context;
  12505. const VueBinding = runtimeGlobalName;
  12506. const helpers = Array.from(ast.helpers);
  12507. if (helpers.length > 0) {
  12508. {
  12509. push(`const _Vue = ${VueBinding}
  12510. `);
  12511. if (ast.hoists.length) {
  12512. const staticHelpers = [
  12513. CREATE_VNODE,
  12514. CREATE_ELEMENT_VNODE,
  12515. CREATE_COMMENT,
  12516. CREATE_TEXT,
  12517. CREATE_STATIC
  12518. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  12519. push(`const { ${staticHelpers} } = _Vue
  12520. `);
  12521. }
  12522. }
  12523. }
  12524. genHoists(ast.hoists, context);
  12525. newline();
  12526. push(`return `);
  12527. }
  12528. function genAssets(assets, type, {helper, push, newline, isTS}) {
  12529. const resolver = helper(
  12530. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  12531. );
  12532. for (let i = 0; i < assets.length; i++) {
  12533. let id = assets[i];
  12534. const maybeSelfReference = id.endsWith("__self");
  12535. if (maybeSelfReference) {
  12536. id = id.slice(0, -6);
  12537. }
  12538. push(
  12539. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  12540. );
  12541. if (i < assets.length - 1) {
  12542. newline();
  12543. }
  12544. }
  12545. }
  12546. function genHoists(hoists, context) {
  12547. if (!hoists.length) {
  12548. return;
  12549. }
  12550. context.pure = true;
  12551. const {push, newline, helper, scopeId, mode} = context;
  12552. newline();
  12553. for (let i = 0; i < hoists.length; i++) {
  12554. const exp = hoists[i];
  12555. if (exp) {
  12556. push(
  12557. `const _hoisted_${i + 1} = ${``}`
  12558. );
  12559. genNode(exp, context);
  12560. newline();
  12561. }
  12562. }
  12563. context.pure = false;
  12564. }
  12565. function isText(n) {
  12566. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  12567. }
  12568. function genNodeListAsArray(nodes, context) {
  12569. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  12570. context.push(`[`);
  12571. multilines && context.indent();
  12572. genNodeList(nodes, context, multilines);
  12573. multilines && context.deindent();
  12574. context.push(`]`);
  12575. }
  12576. function genNodeList(nodes, context, multilines = false, comma = true) {
  12577. const {push, newline} = context;
  12578. for (let i = 0; i < nodes.length; i++) {
  12579. const node = nodes[i];
  12580. if (isString(node)) {
  12581. push(node);
  12582. } else if (isArray(node)) {
  12583. genNodeListAsArray(node, context);
  12584. } else {
  12585. genNode(node, context);
  12586. }
  12587. if (i < nodes.length - 1) {
  12588. if (multilines) {
  12589. comma && push(",");
  12590. newline();
  12591. } else {
  12592. comma && push(", ");
  12593. }
  12594. }
  12595. }
  12596. }
  12597. function genNode(node, context) {
  12598. if (isString(node)) {
  12599. context.push(node);
  12600. return;
  12601. }
  12602. if (isSymbol(node)) {
  12603. context.push(context.helper(node));
  12604. return;
  12605. }
  12606. switch (node.type) {
  12607. case 1:
  12608. case 9:
  12609. case 11:
  12610. assert(
  12611. node.codegenNode != null,
  12612. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  12613. );
  12614. genNode(node.codegenNode, context);
  12615. break;
  12616. case 2:
  12617. genText(node, context);
  12618. break;
  12619. case 4:
  12620. genExpression(node, context);
  12621. break;
  12622. case 5:
  12623. genInterpolation(node, context);
  12624. break;
  12625. case 12:
  12626. genNode(node.codegenNode, context);
  12627. break;
  12628. case 8:
  12629. genCompoundExpression(node, context);
  12630. break;
  12631. case 3:
  12632. genComment(node, context);
  12633. break;
  12634. case 13:
  12635. genVNodeCall(node, context);
  12636. break;
  12637. case 14:
  12638. genCallExpression(node, context);
  12639. break;
  12640. case 15:
  12641. genObjectExpression(node, context);
  12642. break;
  12643. case 17:
  12644. genArrayExpression(node, context);
  12645. break;
  12646. case 18:
  12647. genFunctionExpression(node, context);
  12648. break;
  12649. case 19:
  12650. genConditionalExpression(node, context);
  12651. break;
  12652. case 20:
  12653. genCacheExpression(node, context);
  12654. break;
  12655. case 21:
  12656. genNodeList(node.body, context, true, false);
  12657. break;
  12658. case 22:
  12659. break;
  12660. case 23:
  12661. break;
  12662. case 24:
  12663. break;
  12664. case 25:
  12665. break;
  12666. case 26:
  12667. break;
  12668. case 10:
  12669. break;
  12670. default: {
  12671. assert(false, `unhandled codegen node type: ${node.type}`);
  12672. const exhaustiveCheck = node;
  12673. return exhaustiveCheck;
  12674. }
  12675. }
  12676. }
  12677. function genText(node, context) {
  12678. context.push(JSON.stringify(node.content), node);
  12679. }
  12680. function genExpression(node, context) {
  12681. const {content, isStatic} = node;
  12682. context.push(isStatic ? JSON.stringify(content) : content, node);
  12683. }
  12684. function genInterpolation(node, context) {
  12685. const {push, helper, pure} = context;
  12686. if (pure)
  12687. push(PURE_ANNOTATION);
  12688. push(`${helper(TO_DISPLAY_STRING)}(`);
  12689. genNode(node.content, context);
  12690. push(`)`);
  12691. }
  12692. function genCompoundExpression(node, context) {
  12693. for (let i = 0; i < node.children.length; i++) {
  12694. const child = node.children[i];
  12695. if (isString(child)) {
  12696. context.push(child);
  12697. } else {
  12698. genNode(child, context);
  12699. }
  12700. }
  12701. }
  12702. function genExpressionAsPropertyKey(node, context) {
  12703. const {push} = context;
  12704. if (node.type === 8) {
  12705. push(`[`);
  12706. genCompoundExpression(node, context);
  12707. push(`]`);
  12708. } else if (node.isStatic) {
  12709. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  12710. push(text, node);
  12711. } else {
  12712. push(`[${node.content}]`, node);
  12713. }
  12714. }
  12715. function genComment(node, context) {
  12716. const {push, helper, pure} = context;
  12717. if (pure) {
  12718. push(PURE_ANNOTATION);
  12719. }
  12720. push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
  12721. }
  12722. function genVNodeCall(node, context) {
  12723. const {push, helper, pure} = context;
  12724. const {
  12725. tag,
  12726. props,
  12727. children,
  12728. patchFlag,
  12729. dynamicProps,
  12730. directives,
  12731. isBlock,
  12732. disableTracking,
  12733. isComponent
  12734. } = node;
  12735. if (directives) {
  12736. push(helper(WITH_DIRECTIVES) + `(`);
  12737. }
  12738. if (isBlock) {
  12739. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  12740. }
  12741. if (pure) {
  12742. push(PURE_ANNOTATION);
  12743. }
  12744. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  12745. push(helper(callHelper) + `(`, node);
  12746. genNodeList(
  12747. genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
  12748. context
  12749. );
  12750. push(`)`);
  12751. if (isBlock) {
  12752. push(`)`);
  12753. }
  12754. if (directives) {
  12755. push(`, `);
  12756. genNode(directives, context);
  12757. push(`)`);
  12758. }
  12759. }
  12760. function genNullableArgs(args) {
  12761. let i = args.length;
  12762. while (i--) {
  12763. if (args[i] != null)
  12764. break;
  12765. }
  12766. return args.slice(0, i + 1).map((arg) => arg || `null`);
  12767. }
  12768. function genCallExpression(node, context) {
  12769. const {push, helper, pure} = context;
  12770. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  12771. if (pure) {
  12772. push(PURE_ANNOTATION);
  12773. }
  12774. push(callee + `(`, node);
  12775. genNodeList(node.arguments, context);
  12776. push(`)`);
  12777. }
  12778. function genObjectExpression(node, context) {
  12779. const {push, indent, deindent, newline} = context;
  12780. const {properties} = node;
  12781. if (!properties.length) {
  12782. push(`{}`, node);
  12783. return;
  12784. }
  12785. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  12786. push(multilines ? `{` : `{ `);
  12787. multilines && indent();
  12788. for (let i = 0; i < properties.length; i++) {
  12789. const {key, value} = properties[i];
  12790. genExpressionAsPropertyKey(key, context);
  12791. push(`: `);
  12792. genNode(value, context);
  12793. if (i < properties.length - 1) {
  12794. push(`,`);
  12795. newline();
  12796. }
  12797. }
  12798. multilines && deindent();
  12799. push(multilines ? `}` : ` }`);
  12800. }
  12801. function genArrayExpression(node, context) {
  12802. genNodeListAsArray(node.elements, context);
  12803. }
  12804. function genFunctionExpression(node, context) {
  12805. const {push, indent, deindent} = context;
  12806. const {params, returns, body, newline, isSlot} = node;
  12807. if (isSlot) {
  12808. push(`_${helperNameMap[WITH_CTX]}(`);
  12809. }
  12810. push(`(`, node);
  12811. if (isArray(params)) {
  12812. genNodeList(params, context);
  12813. } else if (params) {
  12814. genNode(params, context);
  12815. }
  12816. push(`) => `);
  12817. if (newline || body) {
  12818. push(`{`);
  12819. indent();
  12820. }
  12821. if (returns) {
  12822. if (newline) {
  12823. push(`return `);
  12824. }
  12825. if (isArray(returns)) {
  12826. genNodeListAsArray(returns, context);
  12827. } else {
  12828. genNode(returns, context);
  12829. }
  12830. } else if (body) {
  12831. genNode(body, context);
  12832. }
  12833. if (newline || body) {
  12834. deindent();
  12835. push(`}`);
  12836. }
  12837. if (isSlot) {
  12838. push(`)`);
  12839. }
  12840. }
  12841. function genConditionalExpression(node, context) {
  12842. const {test, consequent, alternate, newline: needNewline} = node;
  12843. const {push, indent, deindent, newline} = context;
  12844. if (test.type === 4) {
  12845. const needsParens = !isSimpleIdentifier(test.content);
  12846. needsParens && push(`(`);
  12847. genExpression(test, context);
  12848. needsParens && push(`)`);
  12849. } else {
  12850. push(`(`);
  12851. genNode(test, context);
  12852. push(`)`);
  12853. }
  12854. needNewline && indent();
  12855. context.indentLevel++;
  12856. needNewline || push(` `);
  12857. push(`? `);
  12858. genNode(consequent, context);
  12859. context.indentLevel--;
  12860. needNewline && newline();
  12861. needNewline || push(` `);
  12862. push(`: `);
  12863. const isNested = alternate.type === 19;
  12864. if (!isNested) {
  12865. context.indentLevel++;
  12866. }
  12867. genNode(alternate, context);
  12868. if (!isNested) {
  12869. context.indentLevel--;
  12870. }
  12871. needNewline && deindent(
  12872. true
  12873. /* without newline */
  12874. );
  12875. }
  12876. function genCacheExpression(node, context) {
  12877. const {push, helper, indent, deindent, newline} = context;
  12878. push(`_cache[${node.index}] || (`);
  12879. if (node.isVNode) {
  12880. indent();
  12881. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  12882. newline();
  12883. }
  12884. push(`_cache[${node.index}] = `);
  12885. genNode(node.value, context);
  12886. if (node.isVNode) {
  12887. push(`,`);
  12888. newline();
  12889. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  12890. newline();
  12891. push(`_cache[${node.index}]`);
  12892. deindent();
  12893. }
  12894. push(`)`);
  12895. }
  12896. const prohibitedKeywordRE = new RegExp(
  12897. "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
  12898. );
  12899. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  12900. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  12901. const exp = node.content;
  12902. if (!exp.trim()) {
  12903. return;
  12904. }
  12905. try {
  12906. new Function(
  12907. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  12908. );
  12909. } catch (e) {
  12910. let message = e.message;
  12911. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  12912. if (keywordMatch) {
  12913. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  12914. }
  12915. context.onError(
  12916. createCompilerError(
  12917. 45,
  12918. node.loc,
  12919. void 0,
  12920. message
  12921. )
  12922. );
  12923. }
  12924. }
  12925. const transformExpression = (node, context) => {
  12926. if (node.type === 5) {
  12927. node.content = processExpression(
  12928. node.content,
  12929. context
  12930. );
  12931. } else if (node.type === 1) {
  12932. for (let i = 0; i < node.props.length; i++) {
  12933. const dir = node.props[i];
  12934. if (dir.type === 7 && dir.name !== "for") {
  12935. const exp = dir.exp;
  12936. const arg = dir.arg;
  12937. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  12938. dir.exp = processExpression(
  12939. exp,
  12940. context,
  12941. // slot args must be processed as function params
  12942. dir.name === "slot"
  12943. );
  12944. }
  12945. if (arg && arg.type === 4 && !arg.isStatic) {
  12946. dir.arg = processExpression(arg, context);
  12947. }
  12948. }
  12949. }
  12950. }
  12951. };
  12952. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  12953. {
  12954. {
  12955. validateBrowserExpression(node, context, asParams, asRawStatements);
  12956. }
  12957. return node;
  12958. }
  12959. }
  12960. const transformIf = createStructuralDirectiveTransform(
  12961. /^(if|else|else-if)$/,
  12962. (node, dir, context) => {
  12963. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  12964. const siblings = context.parent.children;
  12965. let i = siblings.indexOf(ifNode);
  12966. let key = 0;
  12967. while (i-- >= 0) {
  12968. const sibling = siblings[i];
  12969. if (sibling && sibling.type === 9) {
  12970. key += sibling.branches.length;
  12971. }
  12972. }
  12973. return () => {
  12974. if (isRoot) {
  12975. ifNode.codegenNode = createCodegenNodeForBranch(
  12976. branch,
  12977. key,
  12978. context
  12979. );
  12980. } else {
  12981. const parentCondition = getParentCondition(ifNode.codegenNode);
  12982. parentCondition.alternate = createCodegenNodeForBranch(
  12983. branch,
  12984. key + ifNode.branches.length - 1,
  12985. context
  12986. );
  12987. }
  12988. };
  12989. });
  12990. }
  12991. );
  12992. function processIf(node, dir, context, processCodegen) {
  12993. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  12994. const loc = dir.exp ? dir.exp.loc : node.loc;
  12995. context.onError(
  12996. createCompilerError(28, dir.loc)
  12997. );
  12998. dir.exp = createSimpleExpression(`true`, false, loc);
  12999. }
  13000. if (dir.exp) {
  13001. validateBrowserExpression(dir.exp, context);
  13002. }
  13003. if (dir.name === "if") {
  13004. const branch = createIfBranch(node, dir);
  13005. const ifNode = {
  13006. type: 9,
  13007. loc: node.loc,
  13008. branches: [branch]
  13009. };
  13010. context.replaceNode(ifNode);
  13011. if (processCodegen) {
  13012. return processCodegen(ifNode, branch, true);
  13013. }
  13014. } else {
  13015. const siblings = context.parent.children;
  13016. const comments = [];
  13017. let i = siblings.indexOf(node);
  13018. while (i-- >= -1) {
  13019. const sibling = siblings[i];
  13020. if (sibling && sibling.type === 3) {
  13021. context.removeNode(sibling);
  13022. comments.unshift(sibling);
  13023. continue;
  13024. }
  13025. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  13026. context.removeNode(sibling);
  13027. continue;
  13028. }
  13029. if (sibling && sibling.type === 9) {
  13030. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  13031. context.onError(
  13032. createCompilerError(30, node.loc)
  13033. );
  13034. }
  13035. context.removeNode();
  13036. const branch = createIfBranch(node, dir);
  13037. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  13038. !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
  13039. branch.children = [...comments, ...branch.children];
  13040. }
  13041. {
  13042. const key = branch.userKey;
  13043. if (key) {
  13044. sibling.branches.forEach(({userKey}) => {
  13045. if (isSameKey(userKey, key)) {
  13046. context.onError(
  13047. createCompilerError(
  13048. 29,
  13049. branch.userKey.loc
  13050. )
  13051. );
  13052. }
  13053. });
  13054. }
  13055. }
  13056. sibling.branches.push(branch);
  13057. const onExit = processCodegen && processCodegen(sibling, branch, false);
  13058. traverseNode(branch, context);
  13059. if (onExit)
  13060. onExit();
  13061. context.currentNode = null;
  13062. } else {
  13063. context.onError(
  13064. createCompilerError(30, node.loc)
  13065. );
  13066. }
  13067. break;
  13068. }
  13069. }
  13070. }
  13071. function createIfBranch(node, dir) {
  13072. const isTemplateIf = node.tagType === 3;
  13073. return {
  13074. type: 10,
  13075. loc: node.loc,
  13076. condition: dir.name === "else" ? void 0 : dir.exp,
  13077. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  13078. userKey: findProp(node, `key`),
  13079. isTemplateIf
  13080. };
  13081. }
  13082. function createCodegenNodeForBranch(branch, keyIndex, context) {
  13083. if (branch.condition) {
  13084. return createConditionalExpression(
  13085. branch.condition,
  13086. createChildrenCodegenNode(branch, keyIndex, context),
  13087. // make sure to pass in asBlock: true so that the comment node call
  13088. // closes the current block.
  13089. createCallExpression(context.helper(CREATE_COMMENT), [
  13090. '"v-if"',
  13091. "true"
  13092. ])
  13093. );
  13094. } else {
  13095. return createChildrenCodegenNode(branch, keyIndex, context);
  13096. }
  13097. }
  13098. function createChildrenCodegenNode(branch, keyIndex, context) {
  13099. const {helper} = context;
  13100. const keyProperty = createObjectProperty(
  13101. `key`,
  13102. createSimpleExpression(
  13103. `${keyIndex}`,
  13104. false,
  13105. locStub,
  13106. 2
  13107. )
  13108. );
  13109. const {children} = branch;
  13110. const firstChild = children[0];
  13111. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  13112. if (needFragmentWrapper) {
  13113. if (children.length === 1 && firstChild.type === 11) {
  13114. const vnodeCall = firstChild.codegenNode;
  13115. injectProp(vnodeCall, keyProperty, context);
  13116. return vnodeCall;
  13117. } else {
  13118. let patchFlag = 64;
  13119. let patchFlagText = PatchFlagNames[64];
  13120. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  13121. patchFlag |= 2048;
  13122. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13123. }
  13124. return createVNodeCall(
  13125. context,
  13126. helper(FRAGMENT),
  13127. createObjectExpression([keyProperty]),
  13128. children,
  13129. patchFlag + (` /* ${patchFlagText} */`),
  13130. void 0,
  13131. void 0,
  13132. true,
  13133. false,
  13134. false,
  13135. branch.loc
  13136. );
  13137. }
  13138. } else {
  13139. const ret = firstChild.codegenNode;
  13140. const vnodeCall = getMemoedVNodeCall(ret);
  13141. if (vnodeCall.type === 13) {
  13142. convertToBlock(vnodeCall, context);
  13143. }
  13144. injectProp(vnodeCall, keyProperty, context);
  13145. return ret;
  13146. }
  13147. }
  13148. function isSameKey(a, b) {
  13149. if (!a || a.type !== b.type) {
  13150. return false;
  13151. }
  13152. if (a.type === 6) {
  13153. if (a.value.content !== b.value.content) {
  13154. return false;
  13155. }
  13156. } else {
  13157. const exp = a.exp;
  13158. const branchExp = b.exp;
  13159. if (exp.type !== branchExp.type) {
  13160. return false;
  13161. }
  13162. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  13163. return false;
  13164. }
  13165. }
  13166. return true;
  13167. }
  13168. function getParentCondition(node) {
  13169. while (true) {
  13170. if (node.type === 19) {
  13171. if (node.alternate.type === 19) {
  13172. node = node.alternate;
  13173. } else {
  13174. return node;
  13175. }
  13176. } else if (node.type === 20) {
  13177. node = node.value;
  13178. }
  13179. }
  13180. }
  13181. const transformFor = createStructuralDirectiveTransform(
  13182. "for",
  13183. (node, dir, context) => {
  13184. const {helper, removeHelper} = context;
  13185. return processFor(node, dir, context, (forNode) => {
  13186. const renderExp = createCallExpression(helper(RENDER_LIST), [
  13187. forNode.source
  13188. ]);
  13189. const isTemplate = isTemplateNode(node);
  13190. const memo = findDir(node, "memo");
  13191. const keyProp = findProp(node, `key`);
  13192. const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
  13193. const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
  13194. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  13195. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  13196. forNode.codegenNode = createVNodeCall(
  13197. context,
  13198. helper(FRAGMENT),
  13199. void 0,
  13200. renderExp,
  13201. fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */`),
  13202. void 0,
  13203. void 0,
  13204. true,
  13205. !isStableFragment,
  13206. false,
  13207. node.loc
  13208. );
  13209. return () => {
  13210. let childBlock;
  13211. const {children} = forNode;
  13212. if (isTemplate) {
  13213. node.children.some((c) => {
  13214. if (c.type === 1) {
  13215. const key = findProp(c, "key");
  13216. if (key) {
  13217. context.onError(
  13218. createCompilerError(
  13219. 33,
  13220. key.loc
  13221. )
  13222. );
  13223. return true;
  13224. }
  13225. }
  13226. });
  13227. }
  13228. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  13229. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  13230. if (slotOutlet) {
  13231. childBlock = slotOutlet.codegenNode;
  13232. if (isTemplate && keyProperty) {
  13233. injectProp(childBlock, keyProperty, context);
  13234. }
  13235. } else if (needFragmentWrapper) {
  13236. childBlock = createVNodeCall(
  13237. context,
  13238. helper(FRAGMENT),
  13239. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  13240. node.children,
  13241. 64 + (` /* ${PatchFlagNames[64]} */`),
  13242. void 0,
  13243. void 0,
  13244. true,
  13245. void 0,
  13246. false
  13247. /* isComponent */
  13248. );
  13249. } else {
  13250. childBlock = children[0].codegenNode;
  13251. if (isTemplate && keyProperty) {
  13252. injectProp(childBlock, keyProperty, context);
  13253. }
  13254. if (childBlock.isBlock !== !isStableFragment) {
  13255. if (childBlock.isBlock) {
  13256. removeHelper(OPEN_BLOCK);
  13257. removeHelper(
  13258. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  13259. );
  13260. } else {
  13261. removeHelper(
  13262. getVNodeHelper(context.inSSR, childBlock.isComponent)
  13263. );
  13264. }
  13265. }
  13266. childBlock.isBlock = !isStableFragment;
  13267. if (childBlock.isBlock) {
  13268. helper(OPEN_BLOCK);
  13269. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  13270. } else {
  13271. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  13272. }
  13273. }
  13274. if (memo) {
  13275. const loop = createFunctionExpression(
  13276. createForLoopParams(forNode.parseResult, [
  13277. createSimpleExpression(`_cached`)
  13278. ])
  13279. );
  13280. loop.body = createBlockStatement([
  13281. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  13282. createCompoundExpression([
  13283. `if (_cached`,
  13284. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  13285. ` && ${context.helperString(
  13286. IS_MEMO_SAME
  13287. )}(_cached, _memo)) return _cached`
  13288. ]),
  13289. createCompoundExpression([`const _item = `, childBlock]),
  13290. createSimpleExpression(`_item.memo = _memo`),
  13291. createSimpleExpression(`return _item`)
  13292. ]);
  13293. renderExp.arguments.push(
  13294. loop,
  13295. createSimpleExpression(`_cache`),
  13296. createSimpleExpression(String(context.cached++))
  13297. );
  13298. } else {
  13299. renderExp.arguments.push(
  13300. createFunctionExpression(
  13301. createForLoopParams(forNode.parseResult),
  13302. childBlock,
  13303. true
  13304. /* force newline */
  13305. )
  13306. );
  13307. }
  13308. };
  13309. });
  13310. }
  13311. );
  13312. function processFor(node, dir, context, processCodegen) {
  13313. if (!dir.exp) {
  13314. context.onError(
  13315. createCompilerError(31, dir.loc)
  13316. );
  13317. return;
  13318. }
  13319. const parseResult = parseForExpression(
  13320. // can only be simple expression because vFor transform is applied
  13321. // before expression transform.
  13322. dir.exp,
  13323. context
  13324. );
  13325. if (!parseResult) {
  13326. context.onError(
  13327. createCompilerError(32, dir.loc)
  13328. );
  13329. return;
  13330. }
  13331. const {addIdentifiers, removeIdentifiers, scopes} = context;
  13332. const {source, value, key, index} = parseResult;
  13333. const forNode = {
  13334. type: 11,
  13335. loc: dir.loc,
  13336. source,
  13337. valueAlias: value,
  13338. keyAlias: key,
  13339. objectIndexAlias: index,
  13340. parseResult,
  13341. children: isTemplateNode(node) ? node.children : [node]
  13342. };
  13343. context.replaceNode(forNode);
  13344. scopes.vFor++;
  13345. const onExit = processCodegen && processCodegen(forNode);
  13346. return () => {
  13347. scopes.vFor--;
  13348. if (onExit)
  13349. onExit();
  13350. };
  13351. }
  13352. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  13353. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  13354. const stripParensRE = /^\(|\)$/g;
  13355. function parseForExpression(input, context) {
  13356. const loc = input.loc;
  13357. const exp = input.content;
  13358. const inMatch = exp.match(forAliasRE);
  13359. if (!inMatch)
  13360. return;
  13361. const [, LHS, RHS] = inMatch;
  13362. const result = {
  13363. source: createAliasExpression(
  13364. loc,
  13365. RHS.trim(),
  13366. exp.indexOf(RHS, LHS.length)
  13367. ),
  13368. value: void 0,
  13369. key: void 0,
  13370. index: void 0
  13371. };
  13372. {
  13373. validateBrowserExpression(result.source, context);
  13374. }
  13375. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  13376. const trimmedOffset = LHS.indexOf(valueContent);
  13377. const iteratorMatch = valueContent.match(forIteratorRE);
  13378. if (iteratorMatch) {
  13379. valueContent = valueContent.replace(forIteratorRE, "").trim();
  13380. const keyContent = iteratorMatch[1].trim();
  13381. let keyOffset;
  13382. if (keyContent) {
  13383. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  13384. result.key = createAliasExpression(loc, keyContent, keyOffset);
  13385. {
  13386. validateBrowserExpression(
  13387. result.key,
  13388. context,
  13389. true
  13390. );
  13391. }
  13392. }
  13393. if (iteratorMatch[2]) {
  13394. const indexContent = iteratorMatch[2].trim();
  13395. if (indexContent) {
  13396. result.index = createAliasExpression(
  13397. loc,
  13398. indexContent,
  13399. exp.indexOf(
  13400. indexContent,
  13401. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  13402. )
  13403. );
  13404. {
  13405. validateBrowserExpression(
  13406. result.index,
  13407. context,
  13408. true
  13409. );
  13410. }
  13411. }
  13412. }
  13413. }
  13414. if (valueContent) {
  13415. result.value = createAliasExpression(loc, valueContent, trimmedOffset);
  13416. {
  13417. validateBrowserExpression(
  13418. result.value,
  13419. context,
  13420. true
  13421. );
  13422. }
  13423. }
  13424. return result;
  13425. }
  13426. function createAliasExpression(range, content, offset) {
  13427. return createSimpleExpression(
  13428. content,
  13429. false,
  13430. getInnerRange(range, offset, content.length)
  13431. );
  13432. }
  13433. function createForLoopParams({value, key, index}, memoArgs = []) {
  13434. return createParamsList([value, key, index, ...memoArgs]);
  13435. }
  13436. function createParamsList(args) {
  13437. let i = args.length;
  13438. while (i--) {
  13439. if (args[i])
  13440. break;
  13441. }
  13442. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  13443. }
  13444. const defaultFallback = createSimpleExpression(`undefined`, false);
  13445. const trackSlotScopes = (node, context) => {
  13446. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  13447. const vSlot = findDir(node, "slot");
  13448. if (vSlot) {
  13449. vSlot.exp;
  13450. context.scopes.vSlot++;
  13451. return () => {
  13452. context.scopes.vSlot--;
  13453. };
  13454. }
  13455. }
  13456. };
  13457. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  13458. props,
  13459. children,
  13460. false,
  13461. true,
  13462. children.length ? children[0].loc : loc
  13463. );
  13464. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  13465. context.helper(WITH_CTX);
  13466. const {children, loc} = node;
  13467. const slotsProperties = [];
  13468. const dynamicSlots = [];
  13469. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  13470. const onComponentSlot = findDir(node, "slot", true);
  13471. if (onComponentSlot) {
  13472. const {arg, exp} = onComponentSlot;
  13473. if (arg && !isStaticExp(arg)) {
  13474. hasDynamicSlots = true;
  13475. }
  13476. slotsProperties.push(
  13477. createObjectProperty(
  13478. arg || createSimpleExpression("default", true),
  13479. buildSlotFn(exp, void 0, children, loc)
  13480. )
  13481. );
  13482. }
  13483. let hasTemplateSlots = false;
  13484. let hasNamedDefaultSlot = false;
  13485. const implicitDefaultChildren = [];
  13486. const seenSlotNames = /* @__PURE__ */ new Set();
  13487. let conditionalBranchIndex = 0;
  13488. for (let i = 0; i < children.length; i++) {
  13489. const slotElement = children[i];
  13490. let slotDir;
  13491. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  13492. if (slotElement.type !== 3) {
  13493. implicitDefaultChildren.push(slotElement);
  13494. }
  13495. continue;
  13496. }
  13497. if (onComponentSlot) {
  13498. context.onError(
  13499. createCompilerError(37, slotDir.loc)
  13500. );
  13501. break;
  13502. }
  13503. hasTemplateSlots = true;
  13504. const {children: slotChildren, loc: slotLoc} = slotElement;
  13505. const {
  13506. arg: slotName = createSimpleExpression(`default`, true),
  13507. exp: slotProps,
  13508. loc: dirLoc
  13509. } = slotDir;
  13510. let staticSlotName;
  13511. if (isStaticExp(slotName)) {
  13512. staticSlotName = slotName ? slotName.content : `default`;
  13513. } else {
  13514. hasDynamicSlots = true;
  13515. }
  13516. const vFor = findDir(slotElement, "for");
  13517. const slotFunction = buildSlotFn(
  13518. slotProps,
  13519. vFor == null ? void 0 : vFor.exp,
  13520. slotChildren,
  13521. slotLoc
  13522. );
  13523. let vIf;
  13524. let vElse;
  13525. if (vIf = findDir(slotElement, "if")) {
  13526. hasDynamicSlots = true;
  13527. dynamicSlots.push(
  13528. createConditionalExpression(
  13529. vIf.exp,
  13530. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  13531. defaultFallback
  13532. )
  13533. );
  13534. } else if (vElse = findDir(
  13535. slotElement,
  13536. /^else(-if)?$/,
  13537. true
  13538. /* allowEmpty */
  13539. )) {
  13540. let j = i;
  13541. let prev;
  13542. while (j--) {
  13543. prev = children[j];
  13544. if (prev.type !== 3) {
  13545. break;
  13546. }
  13547. }
  13548. if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
  13549. children.splice(i, 1);
  13550. i--;
  13551. let conditional = dynamicSlots[dynamicSlots.length - 1];
  13552. while (conditional.alternate.type === 19) {
  13553. conditional = conditional.alternate;
  13554. }
  13555. conditional.alternate = vElse.exp ? createConditionalExpression(
  13556. vElse.exp,
  13557. buildDynamicSlot(
  13558. slotName,
  13559. slotFunction,
  13560. conditionalBranchIndex++
  13561. ),
  13562. defaultFallback
  13563. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  13564. } else {
  13565. context.onError(
  13566. createCompilerError(30, vElse.loc)
  13567. );
  13568. }
  13569. } else if (vFor) {
  13570. hasDynamicSlots = true;
  13571. const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
  13572. if (parseResult) {
  13573. dynamicSlots.push(
  13574. createCallExpression(context.helper(RENDER_LIST), [
  13575. parseResult.source,
  13576. createFunctionExpression(
  13577. createForLoopParams(parseResult),
  13578. buildDynamicSlot(slotName, slotFunction),
  13579. true
  13580. /* force newline */
  13581. )
  13582. ])
  13583. );
  13584. } else {
  13585. context.onError(
  13586. createCompilerError(32, vFor.loc)
  13587. );
  13588. }
  13589. } else {
  13590. if (staticSlotName) {
  13591. if (seenSlotNames.has(staticSlotName)) {
  13592. context.onError(
  13593. createCompilerError(
  13594. 38,
  13595. dirLoc
  13596. )
  13597. );
  13598. continue;
  13599. }
  13600. seenSlotNames.add(staticSlotName);
  13601. if (staticSlotName === "default") {
  13602. hasNamedDefaultSlot = true;
  13603. }
  13604. }
  13605. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  13606. }
  13607. }
  13608. if (!onComponentSlot) {
  13609. const buildDefaultSlotProperty = (props, children2) => {
  13610. const fn = buildSlotFn(props, void 0, children2, loc);
  13611. return createObjectProperty(`default`, fn);
  13612. };
  13613. if (!hasTemplateSlots) {
  13614. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  13615. } else if (implicitDefaultChildren.length && // #3766
  13616. // with whitespace: 'preserve', whitespaces between slots will end up in
  13617. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  13618. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  13619. if (hasNamedDefaultSlot) {
  13620. context.onError(
  13621. createCompilerError(
  13622. 39,
  13623. implicitDefaultChildren[0].loc
  13624. )
  13625. );
  13626. } else {
  13627. slotsProperties.push(
  13628. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  13629. );
  13630. }
  13631. }
  13632. }
  13633. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  13634. let slots = createObjectExpression(
  13635. slotsProperties.concat(
  13636. createObjectProperty(
  13637. `_`,
  13638. // 2 = compiled but dynamic = can skip normalization, but must run diff
  13639. // 1 = compiled and static = can skip normalization AND diff as optimized
  13640. createSimpleExpression(
  13641. slotFlag + (` /* ${slotFlagsText[slotFlag]} */`),
  13642. false
  13643. )
  13644. )
  13645. ),
  13646. loc
  13647. );
  13648. if (dynamicSlots.length) {
  13649. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  13650. slots,
  13651. createArrayExpression(dynamicSlots)
  13652. ]);
  13653. }
  13654. return {
  13655. slots,
  13656. hasDynamicSlots
  13657. };
  13658. }
  13659. function buildDynamicSlot(name, fn, index) {
  13660. const props = [
  13661. createObjectProperty(`name`, name),
  13662. createObjectProperty(`fn`, fn)
  13663. ];
  13664. if (index != null) {
  13665. props.push(
  13666. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  13667. );
  13668. }
  13669. return createObjectExpression(props);
  13670. }
  13671. function hasForwardedSlots(children) {
  13672. for (let i = 0; i < children.length; i++) {
  13673. const child = children[i];
  13674. switch (child.type) {
  13675. case 1:
  13676. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  13677. return true;
  13678. }
  13679. break;
  13680. case 9:
  13681. if (hasForwardedSlots(child.branches))
  13682. return true;
  13683. break;
  13684. case 10:
  13685. case 11:
  13686. if (hasForwardedSlots(child.children))
  13687. return true;
  13688. break;
  13689. }
  13690. }
  13691. return false;
  13692. }
  13693. function isNonWhitespaceContent(node) {
  13694. if (node.type !== 2 && node.type !== 12)
  13695. return true;
  13696. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  13697. }
  13698. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  13699. const transformElement = (node, context) => {
  13700. return function postTransformElement() {
  13701. node = context.currentNode;
  13702. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  13703. return;
  13704. }
  13705. const {tag, props} = node;
  13706. const isComponent = node.tagType === 1;
  13707. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  13708. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  13709. let vnodeProps;
  13710. let vnodeChildren;
  13711. let vnodePatchFlag;
  13712. let patchFlag = 0;
  13713. let vnodeDynamicProps;
  13714. let dynamicPropNames;
  13715. let vnodeDirectives;
  13716. let shouldUseBlock = (
  13717. // dynamic component may resolve to plain elements
  13718. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  13719. // updates inside get proper isSVG flag at runtime. (#639, #643)
  13720. // This is technically web-specific, but splitting the logic out of core
  13721. // leads to too much unnecessary complexity.
  13722. (tag === "svg" || tag === "foreignObject")
  13723. );
  13724. if (props.length > 0) {
  13725. const propsBuildResult = buildProps(
  13726. node,
  13727. context,
  13728. void 0,
  13729. isComponent,
  13730. isDynamicComponent
  13731. );
  13732. vnodeProps = propsBuildResult.props;
  13733. patchFlag = propsBuildResult.patchFlag;
  13734. dynamicPropNames = propsBuildResult.dynamicPropNames;
  13735. const directives = propsBuildResult.directives;
  13736. vnodeDirectives = directives && directives.length ? createArrayExpression(
  13737. directives.map((dir) => buildDirectiveArgs(dir, context))
  13738. ) : void 0;
  13739. if (propsBuildResult.shouldUseBlock) {
  13740. shouldUseBlock = true;
  13741. }
  13742. }
  13743. if (node.children.length > 0) {
  13744. if (vnodeTag === KEEP_ALIVE) {
  13745. shouldUseBlock = true;
  13746. patchFlag |= 1024;
  13747. if (node.children.length > 1) {
  13748. context.onError(
  13749. createCompilerError(46, {
  13750. start: node.children[0].loc.start,
  13751. end: node.children[node.children.length - 1].loc.end,
  13752. source: ""
  13753. })
  13754. );
  13755. }
  13756. }
  13757. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  13758. vnodeTag !== TELEPORT && // explained above.
  13759. vnodeTag !== KEEP_ALIVE;
  13760. if (shouldBuildAsSlots) {
  13761. const {slots, hasDynamicSlots} = buildSlots(node, context);
  13762. vnodeChildren = slots;
  13763. if (hasDynamicSlots) {
  13764. patchFlag |= 1024;
  13765. }
  13766. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  13767. const child = node.children[0];
  13768. const type = child.type;
  13769. const hasDynamicTextChild = type === 5 || type === 8;
  13770. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  13771. patchFlag |= 1;
  13772. }
  13773. if (hasDynamicTextChild || type === 2) {
  13774. vnodeChildren = child;
  13775. } else {
  13776. vnodeChildren = node.children;
  13777. }
  13778. } else {
  13779. vnodeChildren = node.children;
  13780. }
  13781. }
  13782. if (patchFlag !== 0) {
  13783. {
  13784. if (patchFlag < 0) {
  13785. vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  13786. } else {
  13787. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  13788. vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
  13789. }
  13790. }
  13791. if (dynamicPropNames && dynamicPropNames.length) {
  13792. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  13793. }
  13794. }
  13795. node.codegenNode = createVNodeCall(
  13796. context,
  13797. vnodeTag,
  13798. vnodeProps,
  13799. vnodeChildren,
  13800. vnodePatchFlag,
  13801. vnodeDynamicProps,
  13802. vnodeDirectives,
  13803. !!shouldUseBlock,
  13804. false,
  13805. isComponent,
  13806. node.loc
  13807. );
  13808. };
  13809. };
  13810. function resolveComponentType(node, context, ssr = false) {
  13811. let {tag} = node;
  13812. const isExplicitDynamic = isComponentTag(tag);
  13813. const isProp = findProp(node, "is");
  13814. if (isProp) {
  13815. if (isExplicitDynamic || false) {
  13816. const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
  13817. if (exp) {
  13818. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  13819. exp
  13820. ]);
  13821. }
  13822. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  13823. tag = isProp.value.content.slice(4);
  13824. }
  13825. }
  13826. const isDir = !isExplicitDynamic && findDir(node, "is");
  13827. if (isDir && isDir.exp) {
  13828. {
  13829. context.onWarn(
  13830. createCompilerError(52, isDir.loc)
  13831. );
  13832. }
  13833. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  13834. isDir.exp
  13835. ]);
  13836. }
  13837. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  13838. if (builtIn) {
  13839. if (!ssr)
  13840. context.helper(builtIn);
  13841. return builtIn;
  13842. }
  13843. context.helper(RESOLVE_COMPONENT);
  13844. context.components.add(tag);
  13845. return toValidAssetId(tag, `component`);
  13846. }
  13847. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  13848. const {tag, loc: elementLoc, children} = node;
  13849. let properties = [];
  13850. const mergeArgs = [];
  13851. const runtimeDirectives = [];
  13852. const hasChildren = children.length > 0;
  13853. let shouldUseBlock = false;
  13854. let patchFlag = 0;
  13855. let hasRef = false;
  13856. let hasClassBinding = false;
  13857. let hasStyleBinding = false;
  13858. let hasHydrationEventBinding = false;
  13859. let hasDynamicKeys = false;
  13860. let hasVnodeHook = false;
  13861. const dynamicPropNames = [];
  13862. const pushMergeArg = (arg) => {
  13863. if (properties.length) {
  13864. mergeArgs.push(
  13865. createObjectExpression(dedupeProperties(properties), elementLoc)
  13866. );
  13867. properties = [];
  13868. }
  13869. if (arg)
  13870. mergeArgs.push(arg);
  13871. };
  13872. const analyzePatchFlag = ({key, value}) => {
  13873. if (isStaticExp(key)) {
  13874. const name = key.content;
  13875. const isEventHandler = isOn(name);
  13876. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  13877. // dedicated fast path.
  13878. name.toLowerCase() !== "onclick" && // omit v-model handlers
  13879. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  13880. !isReservedProp(name)) {
  13881. hasHydrationEventBinding = true;
  13882. }
  13883. if (isEventHandler && isReservedProp(name)) {
  13884. hasVnodeHook = true;
  13885. }
  13886. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  13887. return;
  13888. }
  13889. if (name === "ref") {
  13890. hasRef = true;
  13891. } else if (name === "class") {
  13892. hasClassBinding = true;
  13893. } else if (name === "style") {
  13894. hasStyleBinding = true;
  13895. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  13896. dynamicPropNames.push(name);
  13897. }
  13898. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  13899. dynamicPropNames.push(name);
  13900. }
  13901. } else {
  13902. hasDynamicKeys = true;
  13903. }
  13904. };
  13905. for (let i = 0; i < props.length; i++) {
  13906. const prop = props[i];
  13907. if (prop.type === 6) {
  13908. const {loc, name, value} = prop;
  13909. let isStatic = true;
  13910. if (name === "ref") {
  13911. hasRef = true;
  13912. if (context.scopes.vFor > 0) {
  13913. properties.push(
  13914. createObjectProperty(
  13915. createSimpleExpression("ref_for", true),
  13916. createSimpleExpression("true")
  13917. )
  13918. );
  13919. }
  13920. }
  13921. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  13922. continue;
  13923. }
  13924. properties.push(
  13925. createObjectProperty(
  13926. createSimpleExpression(
  13927. name,
  13928. true,
  13929. getInnerRange(loc, 0, name.length)
  13930. ),
  13931. createSimpleExpression(
  13932. value ? value.content : "",
  13933. isStatic,
  13934. value ? value.loc : loc
  13935. )
  13936. )
  13937. );
  13938. } else {
  13939. const {name, arg, exp, loc} = prop;
  13940. const isVBind = name === "bind";
  13941. const isVOn = name === "on";
  13942. if (name === "slot") {
  13943. if (!isComponent) {
  13944. context.onError(
  13945. createCompilerError(40, loc)
  13946. );
  13947. }
  13948. continue;
  13949. }
  13950. if (name === "once" || name === "memo") {
  13951. continue;
  13952. }
  13953. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  13954. continue;
  13955. }
  13956. if (isVOn && ssr) {
  13957. continue;
  13958. }
  13959. if (
  13960. // #938: elements with dynamic keys should be forced into blocks
  13961. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  13962. // before children
  13963. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  13964. ) {
  13965. shouldUseBlock = true;
  13966. }
  13967. if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
  13968. properties.push(
  13969. createObjectProperty(
  13970. createSimpleExpression("ref_for", true),
  13971. createSimpleExpression("true")
  13972. )
  13973. );
  13974. }
  13975. if (!arg && (isVBind || isVOn)) {
  13976. hasDynamicKeys = true;
  13977. if (exp) {
  13978. if (isVBind) {
  13979. pushMergeArg();
  13980. mergeArgs.push(exp);
  13981. } else {
  13982. pushMergeArg({
  13983. type: 14,
  13984. loc,
  13985. callee: context.helper(TO_HANDLERS),
  13986. arguments: isComponent ? [exp] : [exp, `true`]
  13987. });
  13988. }
  13989. } else {
  13990. context.onError(
  13991. createCompilerError(
  13992. isVBind ? 34 : 35,
  13993. loc
  13994. )
  13995. );
  13996. }
  13997. continue;
  13998. }
  13999. const directiveTransform = context.directiveTransforms[name];
  14000. if (directiveTransform) {
  14001. const {props: props2, needRuntime} = directiveTransform(prop, node, context);
  14002. !ssr && props2.forEach(analyzePatchFlag);
  14003. if (isVOn && arg && !isStaticExp(arg)) {
  14004. pushMergeArg(createObjectExpression(props2, elementLoc));
  14005. } else {
  14006. properties.push(...props2);
  14007. }
  14008. if (needRuntime) {
  14009. runtimeDirectives.push(prop);
  14010. if (isSymbol(needRuntime)) {
  14011. directiveImportMap.set(prop, needRuntime);
  14012. }
  14013. }
  14014. } else if (!isBuiltInDirective(name)) {
  14015. runtimeDirectives.push(prop);
  14016. if (hasChildren) {
  14017. shouldUseBlock = true;
  14018. }
  14019. }
  14020. }
  14021. }
  14022. let propsExpression = void 0;
  14023. if (mergeArgs.length) {
  14024. pushMergeArg();
  14025. if (mergeArgs.length > 1) {
  14026. propsExpression = createCallExpression(
  14027. context.helper(MERGE_PROPS),
  14028. mergeArgs,
  14029. elementLoc
  14030. );
  14031. } else {
  14032. propsExpression = mergeArgs[0];
  14033. }
  14034. } else if (properties.length) {
  14035. propsExpression = createObjectExpression(
  14036. dedupeProperties(properties),
  14037. elementLoc
  14038. );
  14039. }
  14040. if (hasDynamicKeys) {
  14041. patchFlag |= 16;
  14042. } else {
  14043. if (hasClassBinding && !isComponent) {
  14044. patchFlag |= 2;
  14045. }
  14046. if (hasStyleBinding && !isComponent) {
  14047. patchFlag |= 4;
  14048. }
  14049. if (dynamicPropNames.length) {
  14050. patchFlag |= 8;
  14051. }
  14052. if (hasHydrationEventBinding) {
  14053. patchFlag |= 32;
  14054. }
  14055. }
  14056. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  14057. patchFlag |= 512;
  14058. }
  14059. if (!context.inSSR && propsExpression) {
  14060. switch (propsExpression.type) {
  14061. case 15:
  14062. let classKeyIndex = -1;
  14063. let styleKeyIndex = -1;
  14064. let hasDynamicKey = false;
  14065. for (let i = 0; i < propsExpression.properties.length; i++) {
  14066. const key = propsExpression.properties[i].key;
  14067. if (isStaticExp(key)) {
  14068. if (key.content === "class") {
  14069. classKeyIndex = i;
  14070. } else if (key.content === "style") {
  14071. styleKeyIndex = i;
  14072. }
  14073. } else if (!key.isHandlerKey) {
  14074. hasDynamicKey = true;
  14075. }
  14076. }
  14077. const classProp = propsExpression.properties[classKeyIndex];
  14078. const styleProp = propsExpression.properties[styleKeyIndex];
  14079. if (!hasDynamicKey) {
  14080. if (classProp && !isStaticExp(classProp.value)) {
  14081. classProp.value = createCallExpression(
  14082. context.helper(NORMALIZE_CLASS),
  14083. [classProp.value]
  14084. );
  14085. }
  14086. if (styleProp && // the static style is compiled into an object,
  14087. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  14088. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  14089. // v-bind:style with static literal object
  14090. styleProp.value.type === 17)) {
  14091. styleProp.value = createCallExpression(
  14092. context.helper(NORMALIZE_STYLE),
  14093. [styleProp.value]
  14094. );
  14095. }
  14096. } else {
  14097. propsExpression = createCallExpression(
  14098. context.helper(NORMALIZE_PROPS),
  14099. [propsExpression]
  14100. );
  14101. }
  14102. break;
  14103. case 14:
  14104. break;
  14105. default:
  14106. propsExpression = createCallExpression(
  14107. context.helper(NORMALIZE_PROPS),
  14108. [
  14109. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  14110. propsExpression
  14111. ])
  14112. ]
  14113. );
  14114. break;
  14115. }
  14116. }
  14117. return {
  14118. props: propsExpression,
  14119. directives: runtimeDirectives,
  14120. patchFlag,
  14121. dynamicPropNames,
  14122. shouldUseBlock
  14123. };
  14124. }
  14125. function dedupeProperties(properties) {
  14126. const knownProps = /* @__PURE__ */ new Map();
  14127. const deduped = [];
  14128. for (let i = 0; i < properties.length; i++) {
  14129. const prop = properties[i];
  14130. if (prop.key.type === 8 || !prop.key.isStatic) {
  14131. deduped.push(prop);
  14132. continue;
  14133. }
  14134. const name = prop.key.content;
  14135. const existing = knownProps.get(name);
  14136. if (existing) {
  14137. if (name === "style" || name === "class" || isOn(name)) {
  14138. mergeAsArray(existing, prop);
  14139. }
  14140. } else {
  14141. knownProps.set(name, prop);
  14142. deduped.push(prop);
  14143. }
  14144. }
  14145. return deduped;
  14146. }
  14147. function mergeAsArray(existing, incoming) {
  14148. if (existing.value.type === 17) {
  14149. existing.value.elements.push(incoming.value);
  14150. } else {
  14151. existing.value = createArrayExpression(
  14152. [existing.value, incoming.value],
  14153. existing.loc
  14154. );
  14155. }
  14156. }
  14157. function buildDirectiveArgs(dir, context) {
  14158. const dirArgs = [];
  14159. const runtime = directiveImportMap.get(dir);
  14160. if (runtime) {
  14161. dirArgs.push(context.helperString(runtime));
  14162. } else {
  14163. {
  14164. context.helper(RESOLVE_DIRECTIVE);
  14165. context.directives.add(dir.name);
  14166. dirArgs.push(toValidAssetId(dir.name, `directive`));
  14167. }
  14168. }
  14169. const {loc} = dir;
  14170. if (dir.exp)
  14171. dirArgs.push(dir.exp);
  14172. if (dir.arg) {
  14173. if (!dir.exp) {
  14174. dirArgs.push(`void 0`);
  14175. }
  14176. dirArgs.push(dir.arg);
  14177. }
  14178. if (Object.keys(dir.modifiers).length) {
  14179. if (!dir.arg) {
  14180. if (!dir.exp) {
  14181. dirArgs.push(`void 0`);
  14182. }
  14183. dirArgs.push(`void 0`);
  14184. }
  14185. const trueExpression = createSimpleExpression(`true`, false, loc);
  14186. dirArgs.push(
  14187. createObjectExpression(
  14188. dir.modifiers.map(
  14189. (modifier) => createObjectProperty(modifier, trueExpression)
  14190. ),
  14191. loc
  14192. )
  14193. );
  14194. }
  14195. return createArrayExpression(dirArgs, dir.loc);
  14196. }
  14197. function stringifyDynamicPropNames(props) {
  14198. let propsNamesString = `[`;
  14199. for (let i = 0, l = props.length; i < l; i++) {
  14200. propsNamesString += JSON.stringify(props[i]);
  14201. if (i < l - 1)
  14202. propsNamesString += ", ";
  14203. }
  14204. return propsNamesString + `]`;
  14205. }
  14206. function isComponentTag(tag) {
  14207. return tag === "component" || tag === "Component";
  14208. }
  14209. const transformSlotOutlet = (node, context) => {
  14210. if (isSlotOutlet(node)) {
  14211. const {children, loc} = node;
  14212. const {slotName, slotProps} = processSlotOutlet(node, context);
  14213. const slotArgs = [
  14214. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  14215. slotName,
  14216. "{}",
  14217. "undefined",
  14218. "true"
  14219. ];
  14220. let expectedLen = 2;
  14221. if (slotProps) {
  14222. slotArgs[2] = slotProps;
  14223. expectedLen = 3;
  14224. }
  14225. if (children.length) {
  14226. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  14227. expectedLen = 4;
  14228. }
  14229. if (context.scopeId && !context.slotted) {
  14230. expectedLen = 5;
  14231. }
  14232. slotArgs.splice(expectedLen);
  14233. node.codegenNode = createCallExpression(
  14234. context.helper(RENDER_SLOT),
  14235. slotArgs,
  14236. loc
  14237. );
  14238. }
  14239. };
  14240. function processSlotOutlet(node, context) {
  14241. let slotName = `"default"`;
  14242. let slotProps = void 0;
  14243. const nonNameProps = [];
  14244. for (let i = 0; i < node.props.length; i++) {
  14245. const p = node.props[i];
  14246. if (p.type === 6) {
  14247. if (p.value) {
  14248. if (p.name === "name") {
  14249. slotName = JSON.stringify(p.value.content);
  14250. } else {
  14251. p.name = camelize(p.name);
  14252. nonNameProps.push(p);
  14253. }
  14254. }
  14255. } else {
  14256. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  14257. if (p.exp)
  14258. slotName = p.exp;
  14259. } else {
  14260. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  14261. p.arg.content = camelize(p.arg.content);
  14262. }
  14263. nonNameProps.push(p);
  14264. }
  14265. }
  14266. }
  14267. if (nonNameProps.length > 0) {
  14268. const {props, directives} = buildProps(
  14269. node,
  14270. context,
  14271. nonNameProps,
  14272. false,
  14273. false
  14274. );
  14275. slotProps = props;
  14276. if (directives.length) {
  14277. context.onError(
  14278. createCompilerError(
  14279. 36,
  14280. directives[0].loc
  14281. )
  14282. );
  14283. }
  14284. }
  14285. return {
  14286. slotName,
  14287. slotProps
  14288. };
  14289. }
  14290. const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  14291. const transformOn$1 = (dir, node, context, augmentor) => {
  14292. const {loc, modifiers, arg} = dir;
  14293. if (!dir.exp && !modifiers.length) {
  14294. context.onError(createCompilerError(35, loc));
  14295. }
  14296. let eventName;
  14297. if (arg.type === 4) {
  14298. if (arg.isStatic) {
  14299. let rawName = arg.content;
  14300. if (rawName.startsWith("vnode")) {
  14301. context.onWarn(
  14302. createCompilerError(51, arg.loc)
  14303. );
  14304. }
  14305. if (rawName.startsWith("vue:")) {
  14306. rawName = `vnode-${rawName.slice(4)}`;
  14307. }
  14308. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  14309. // for non-element and vnode lifecycle event listeners, auto convert
  14310. // it to camelCase. See issue #2249
  14311. toHandlerKey(camelize(rawName))
  14312. ) : (
  14313. // preserve case for plain element listeners that have uppercase
  14314. // letters, as these may be custom elements' custom events
  14315. `on:${rawName}`
  14316. );
  14317. eventName = createSimpleExpression(eventString, true, arg.loc);
  14318. } else {
  14319. eventName = createCompoundExpression([
  14320. `${context.helperString(TO_HANDLER_KEY)}(`,
  14321. arg,
  14322. `)`
  14323. ]);
  14324. }
  14325. } else {
  14326. eventName = arg;
  14327. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  14328. eventName.children.push(`)`);
  14329. }
  14330. let exp = dir.exp;
  14331. if (exp && !exp.content.trim()) {
  14332. exp = void 0;
  14333. }
  14334. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  14335. if (exp) {
  14336. const isMemberExp = isMemberExpression(exp.content);
  14337. const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
  14338. const hasMultipleStatements = exp.content.includes(`;`);
  14339. {
  14340. validateBrowserExpression(
  14341. exp,
  14342. context,
  14343. false,
  14344. hasMultipleStatements
  14345. );
  14346. }
  14347. if (isInlineStatement || shouldCache && isMemberExp) {
  14348. exp = createCompoundExpression([
  14349. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  14350. exp,
  14351. hasMultipleStatements ? `}` : `)`
  14352. ]);
  14353. }
  14354. }
  14355. let ret = {
  14356. props: [
  14357. createObjectProperty(
  14358. eventName,
  14359. exp || createSimpleExpression(`() => {}`, false, loc)
  14360. )
  14361. ]
  14362. };
  14363. if (augmentor) {
  14364. ret = augmentor(ret);
  14365. }
  14366. if (shouldCache) {
  14367. ret.props[0].value = context.cache(ret.props[0].value);
  14368. }
  14369. ret.props.forEach((p) => p.key.isHandlerKey = true);
  14370. return ret;
  14371. };
  14372. const transformBind = (dir, _node, context) => {
  14373. const {exp, modifiers, loc} = dir;
  14374. const arg = dir.arg;
  14375. if (arg.type !== 4) {
  14376. arg.children.unshift(`(`);
  14377. arg.children.push(`) || ""`);
  14378. } else if (!arg.isStatic) {
  14379. arg.content = `${arg.content} || ""`;
  14380. }
  14381. if (modifiers.includes("camel")) {
  14382. if (arg.type === 4) {
  14383. if (arg.isStatic) {
  14384. arg.content = camelize(arg.content);
  14385. } else {
  14386. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  14387. }
  14388. } else {
  14389. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  14390. arg.children.push(`)`);
  14391. }
  14392. }
  14393. if (!context.inSSR) {
  14394. if (modifiers.includes("prop")) {
  14395. injectPrefix(arg, ".");
  14396. }
  14397. if (modifiers.includes("attr")) {
  14398. injectPrefix(arg, "^");
  14399. }
  14400. }
  14401. if (!exp || exp.type === 4 && !exp.content.trim()) {
  14402. context.onError(createCompilerError(34, loc));
  14403. return {
  14404. props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
  14405. };
  14406. }
  14407. return {
  14408. props: [createObjectProperty(arg, exp)]
  14409. };
  14410. };
  14411. const injectPrefix = (arg, prefix) => {
  14412. if (arg.type === 4) {
  14413. if (arg.isStatic) {
  14414. arg.content = prefix + arg.content;
  14415. } else {
  14416. arg.content = `\`${prefix}\${${arg.content}}\``;
  14417. }
  14418. } else {
  14419. arg.children.unshift(`'${prefix}' + (`);
  14420. arg.children.push(`)`);
  14421. }
  14422. };
  14423. const transformText = (node, context) => {
  14424. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  14425. return () => {
  14426. const children = node.children;
  14427. let currentContainer = void 0;
  14428. let hasText = false;
  14429. for (let i = 0; i < children.length; i++) {
  14430. const child = children[i];
  14431. if (isText$1(child)) {
  14432. hasText = true;
  14433. for (let j = i + 1; j < children.length; j++) {
  14434. const next = children[j];
  14435. if (isText$1(next)) {
  14436. if (!currentContainer) {
  14437. currentContainer = children[i] = createCompoundExpression(
  14438. [child],
  14439. child.loc
  14440. );
  14441. }
  14442. currentContainer.children.push(` + `, next);
  14443. children.splice(j, 1);
  14444. j--;
  14445. } else {
  14446. currentContainer = void 0;
  14447. break;
  14448. }
  14449. }
  14450. }
  14451. }
  14452. if (!hasText || // if this is a plain element with a single text child, leave it
  14453. // as-is since the runtime has dedicated fast path for this by directly
  14454. // setting textContent of the element.
  14455. // for component root it's always normalized anyway.
  14456. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  14457. // custom directives can potentially add DOM elements arbitrarily,
  14458. // we need to avoid setting textContent of the element at runtime
  14459. // to avoid accidentally overwriting the DOM elements added
  14460. // by the user through custom directives.
  14461. !node.props.find(
  14462. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  14463. ) && // in compat mode, <template> tags with no special directives
  14464. // will be rendered as a fragment so its children must be
  14465. // converted into vnodes.
  14466. true)) {
  14467. return;
  14468. }
  14469. for (let i = 0; i < children.length; i++) {
  14470. const child = children[i];
  14471. if (isText$1(child) || child.type === 8) {
  14472. const callArgs = [];
  14473. if (child.type !== 2 || child.content !== " ") {
  14474. callArgs.push(child);
  14475. }
  14476. if (!context.ssr && getConstantType(child, context) === 0) {
  14477. callArgs.push(
  14478. 1 + (` /* ${PatchFlagNames[1]} */`)
  14479. );
  14480. }
  14481. children[i] = {
  14482. type: 12,
  14483. content: child,
  14484. loc: child.loc,
  14485. codegenNode: createCallExpression(
  14486. context.helper(CREATE_TEXT),
  14487. callArgs
  14488. )
  14489. };
  14490. }
  14491. }
  14492. };
  14493. }
  14494. };
  14495. const seen$1 = /* @__PURE__ */ new WeakSet();
  14496. const transformOnce = (node, context) => {
  14497. if (node.type === 1 && findDir(node, "once", true)) {
  14498. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  14499. return;
  14500. }
  14501. seen$1.add(node);
  14502. context.inVOnce = true;
  14503. context.helper(SET_BLOCK_TRACKING);
  14504. return () => {
  14505. context.inVOnce = false;
  14506. const cur = context.currentNode;
  14507. if (cur.codegenNode) {
  14508. cur.codegenNode = context.cache(
  14509. cur.codegenNode,
  14510. true
  14511. /* isVNode */
  14512. );
  14513. }
  14514. };
  14515. }
  14516. };
  14517. const transformModel$1 = (dir, node, context) => {
  14518. const {exp, arg} = dir;
  14519. if (!exp) {
  14520. context.onError(
  14521. createCompilerError(41, dir.loc)
  14522. );
  14523. return createTransformProps();
  14524. }
  14525. const rawExp = exp.loc.source;
  14526. const expString = exp.type === 4 ? exp.content : rawExp;
  14527. const bindingType = context.bindingMetadata[rawExp];
  14528. if (bindingType === "props" || bindingType === "props-aliased") {
  14529. context.onError(createCompilerError(44, exp.loc));
  14530. return createTransformProps();
  14531. }
  14532. const maybeRef = false;
  14533. if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
  14534. context.onError(
  14535. createCompilerError(42, exp.loc)
  14536. );
  14537. return createTransformProps();
  14538. }
  14539. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  14540. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  14541. let assignmentExp;
  14542. const eventArg = context.isTS ? `($event: any)` : `$event`;
  14543. {
  14544. assignmentExp = createCompoundExpression([
  14545. `${eventArg} => ((`,
  14546. exp,
  14547. `) = $event)`
  14548. ]);
  14549. }
  14550. const props = [
  14551. // modelValue: foo
  14552. createObjectProperty(propName, dir.exp),
  14553. // "onUpdate:modelValue": $event => (foo = $event)
  14554. createObjectProperty(eventName, assignmentExp)
  14555. ];
  14556. if (dir.modifiers.length && node.tagType === 1) {
  14557. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  14558. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  14559. props.push(
  14560. createObjectProperty(
  14561. modifiersKey,
  14562. createSimpleExpression(
  14563. `{ ${modifiers} }`,
  14564. false,
  14565. dir.loc,
  14566. 2
  14567. )
  14568. )
  14569. );
  14570. }
  14571. return createTransformProps(props);
  14572. };
  14573. function createTransformProps(props = []) {
  14574. return {props};
  14575. }
  14576. const seen = /* @__PURE__ */ new WeakSet();
  14577. const transformMemo = (node, context) => {
  14578. if (node.type === 1) {
  14579. const dir = findDir(node, "memo");
  14580. if (!dir || seen.has(node)) {
  14581. return;
  14582. }
  14583. seen.add(node);
  14584. return () => {
  14585. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  14586. if (codegenNode && codegenNode.type === 13) {
  14587. if (node.tagType !== 1) {
  14588. convertToBlock(codegenNode, context);
  14589. }
  14590. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  14591. dir.exp,
  14592. createFunctionExpression(void 0, codegenNode),
  14593. `_cache`,
  14594. String(context.cached++)
  14595. ]);
  14596. }
  14597. };
  14598. }
  14599. };
  14600. function getBaseTransformPreset(prefixIdentifiers) {
  14601. return [
  14602. [
  14603. transformOnce,
  14604. transformIf,
  14605. transformMemo,
  14606. transformFor,
  14607. ...[],
  14608. ...[transformExpression],
  14609. transformSlotOutlet,
  14610. transformElement,
  14611. trackSlotScopes,
  14612. transformText
  14613. ],
  14614. {
  14615. on: transformOn$1,
  14616. bind: transformBind,
  14617. model: transformModel$1
  14618. }
  14619. ];
  14620. }
  14621. function baseCompile(template, options = {}) {
  14622. const onError = options.onError || defaultOnError;
  14623. const isModuleMode = options.mode === "module";
  14624. {
  14625. if (options.prefixIdentifiers === true) {
  14626. onError(createCompilerError(47));
  14627. } else if (isModuleMode) {
  14628. onError(createCompilerError(48));
  14629. }
  14630. }
  14631. const prefixIdentifiers = false;
  14632. if (options.cacheHandlers) {
  14633. onError(createCompilerError(49));
  14634. }
  14635. if (options.scopeId && !isModuleMode) {
  14636. onError(createCompilerError(50));
  14637. }
  14638. const ast = isString(template) ? baseParse(template, options) : template;
  14639. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  14640. transform(
  14641. ast,
  14642. extend({}, options, {
  14643. prefixIdentifiers,
  14644. nodeTransforms: [
  14645. ...nodeTransforms,
  14646. ...options.nodeTransforms || []
  14647. // user transforms
  14648. ],
  14649. directiveTransforms: extend(
  14650. {},
  14651. directiveTransforms,
  14652. options.directiveTransforms || {}
  14653. // user transforms
  14654. )
  14655. })
  14656. );
  14657. return generate(
  14658. ast,
  14659. extend({}, options, {
  14660. prefixIdentifiers
  14661. })
  14662. );
  14663. }
  14664. const noopDirectiveTransform = () => ({props: []});
  14665. const V_MODEL_RADIO = Symbol(`vModelRadio`);
  14666. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox`);
  14667. const V_MODEL_TEXT = Symbol(`vModelText`);
  14668. const V_MODEL_SELECT = Symbol(`vModelSelect`);
  14669. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic`);
  14670. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard`);
  14671. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard`);
  14672. const V_SHOW = Symbol(`vShow`);
  14673. const TRANSITION = Symbol(`Transition`);
  14674. const TRANSITION_GROUP = Symbol(`TransitionGroup`);
  14675. registerRuntimeHelpers({
  14676. [V_MODEL_RADIO]: `vModelRadio`,
  14677. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  14678. [V_MODEL_TEXT]: `vModelText`,
  14679. [V_MODEL_SELECT]: `vModelSelect`,
  14680. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  14681. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  14682. [V_ON_WITH_KEYS]: `withKeys`,
  14683. [V_SHOW]: `vShow`,
  14684. [TRANSITION]: `Transition`,
  14685. [TRANSITION_GROUP]: `TransitionGroup`
  14686. });
  14687. let decoder;
  14688. function decodeHtmlBrowser(raw, asAttr = false) {
  14689. if (!decoder) {
  14690. decoder = document.createElement("div");
  14691. }
  14692. if (asAttr) {
  14693. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  14694. return decoder.children[0].getAttribute("foo");
  14695. } else {
  14696. decoder.innerHTML = raw;
  14697. return decoder.textContent;
  14698. }
  14699. }
  14700. const isRawTextContainer = /* @__PURE__ */ makeMap(
  14701. "style,iframe,script,noscript",
  14702. true
  14703. );
  14704. const parserOptions = {
  14705. isVoidTag,
  14706. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  14707. isPreTag: (tag) => tag === "pre",
  14708. decodeEntities: decodeHtmlBrowser,
  14709. isBuiltInComponent: (tag) => {
  14710. if (isBuiltInType(tag, `Transition`)) {
  14711. return TRANSITION;
  14712. } else if (isBuiltInType(tag, `TransitionGroup`)) {
  14713. return TRANSITION_GROUP;
  14714. }
  14715. },
  14716. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  14717. getNamespace(tag, parent) {
  14718. let ns = parent ? parent.ns : 0;
  14719. if (parent && ns === 2) {
  14720. if (parent.tag === "annotation-xml") {
  14721. if (tag === "svg") {
  14722. return 1;
  14723. }
  14724. if (parent.props.some(
  14725. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  14726. )) {
  14727. ns = 0;
  14728. }
  14729. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  14730. ns = 0;
  14731. }
  14732. } else if (parent && ns === 1) {
  14733. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  14734. ns = 0;
  14735. }
  14736. }
  14737. if (ns === 0) {
  14738. if (tag === "svg") {
  14739. return 1;
  14740. }
  14741. if (tag === "math") {
  14742. return 2;
  14743. }
  14744. }
  14745. return ns;
  14746. },
  14747. // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
  14748. getTextMode({tag, ns}) {
  14749. if (ns === 0) {
  14750. if (tag === "textarea" || tag === "title") {
  14751. return 1;
  14752. }
  14753. if (isRawTextContainer(tag)) {
  14754. return 2;
  14755. }
  14756. }
  14757. return 0;
  14758. }
  14759. };
  14760. const transformStyle = (node) => {
  14761. if (node.type === 1) {
  14762. node.props.forEach((p, i) => {
  14763. if (p.type === 6 && p.name === "style" && p.value) {
  14764. node.props[i] = {
  14765. type: 7,
  14766. name: `bind`,
  14767. arg: createSimpleExpression(`style`, true, p.loc),
  14768. exp: parseInlineCSS(p.value.content, p.loc),
  14769. modifiers: [],
  14770. loc: p.loc
  14771. };
  14772. }
  14773. });
  14774. }
  14775. };
  14776. const parseInlineCSS = (cssText, loc) => {
  14777. const normalized = parseStringStyle(cssText);
  14778. return createSimpleExpression(
  14779. JSON.stringify(normalized),
  14780. false,
  14781. loc,
  14782. 3
  14783. );
  14784. };
  14785. function createDOMCompilerError(code, loc) {
  14786. return createCompilerError(
  14787. code,
  14788. loc,
  14789. DOMErrorMessages
  14790. );
  14791. }
  14792. const DOMErrorMessages = {
  14793. [53]: `v-html is missing expression.`,
  14794. [54]: `v-html will override element children.`,
  14795. [55]: `v-text is missing expression.`,
  14796. [56]: `v-text will override element children.`,
  14797. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  14798. [58]: `v-model argument is not supported on plain elements.`,
  14799. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  14800. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  14801. [61]: `v-show is missing expression.`,
  14802. [62]: `<Transition> expects exactly one child element or component.`,
  14803. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  14804. };
  14805. const transformVHtml = (dir, node, context) => {
  14806. const {exp, loc} = dir;
  14807. if (!exp) {
  14808. context.onError(
  14809. createDOMCompilerError(53, loc)
  14810. );
  14811. }
  14812. if (node.children.length) {
  14813. context.onError(
  14814. createDOMCompilerError(54, loc)
  14815. );
  14816. node.children.length = 0;
  14817. }
  14818. return {
  14819. props: [
  14820. createObjectProperty(
  14821. createSimpleExpression(`innerHTML`, true, loc),
  14822. exp || createSimpleExpression("", true)
  14823. )
  14824. ]
  14825. };
  14826. };
  14827. const transformVText = (dir, node, context) => {
  14828. const {exp, loc} = dir;
  14829. if (!exp) {
  14830. context.onError(
  14831. createDOMCompilerError(55, loc)
  14832. );
  14833. }
  14834. if (node.children.length) {
  14835. context.onError(
  14836. createDOMCompilerError(56, loc)
  14837. );
  14838. node.children.length = 0;
  14839. }
  14840. return {
  14841. props: [
  14842. createObjectProperty(
  14843. createSimpleExpression(`textContent`, true),
  14844. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  14845. context.helperString(TO_DISPLAY_STRING),
  14846. [exp],
  14847. loc
  14848. ) : createSimpleExpression("", true)
  14849. )
  14850. ]
  14851. };
  14852. };
  14853. const transformModel = (dir, node, context) => {
  14854. const baseResult = transformModel$1(dir, node, context);
  14855. if (!baseResult.props.length || node.tagType === 1) {
  14856. return baseResult;
  14857. }
  14858. if (dir.arg) {
  14859. context.onError(
  14860. createDOMCompilerError(
  14861. 58,
  14862. dir.arg.loc
  14863. )
  14864. );
  14865. }
  14866. function checkDuplicatedValue() {
  14867. const value = findProp(node, "value");
  14868. if (value) {
  14869. context.onError(
  14870. createDOMCompilerError(
  14871. 60,
  14872. value.loc
  14873. )
  14874. );
  14875. }
  14876. }
  14877. const {tag} = node;
  14878. const isCustomElement = context.isCustomElement(tag);
  14879. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  14880. let directiveToUse = V_MODEL_TEXT;
  14881. let isInvalidType = false;
  14882. if (tag === "input" || isCustomElement) {
  14883. const type = findProp(node, `type`);
  14884. if (type) {
  14885. if (type.type === 7) {
  14886. directiveToUse = V_MODEL_DYNAMIC;
  14887. } else if (type.value) {
  14888. switch (type.value.content) {
  14889. case "radio":
  14890. directiveToUse = V_MODEL_RADIO;
  14891. break;
  14892. case "checkbox":
  14893. directiveToUse = V_MODEL_CHECKBOX;
  14894. break;
  14895. case "file":
  14896. isInvalidType = true;
  14897. context.onError(
  14898. createDOMCompilerError(
  14899. 59,
  14900. dir.loc
  14901. )
  14902. );
  14903. break;
  14904. default:
  14905. checkDuplicatedValue();
  14906. break;
  14907. }
  14908. }
  14909. } else if (hasDynamicKeyVBind(node)) {
  14910. directiveToUse = V_MODEL_DYNAMIC;
  14911. } else {
  14912. checkDuplicatedValue();
  14913. }
  14914. } else if (tag === "select") {
  14915. directiveToUse = V_MODEL_SELECT;
  14916. } else {
  14917. checkDuplicatedValue();
  14918. }
  14919. if (!isInvalidType) {
  14920. baseResult.needRuntime = context.helper(directiveToUse);
  14921. }
  14922. } else {
  14923. context.onError(
  14924. createDOMCompilerError(
  14925. 57,
  14926. dir.loc
  14927. )
  14928. );
  14929. }
  14930. baseResult.props = baseResult.props.filter(
  14931. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  14932. );
  14933. return baseResult;
  14934. };
  14935. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  14936. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  14937. // event propagation management
  14938. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  14939. );
  14940. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  14941. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  14942. `onkeyup,onkeydown,onkeypress`,
  14943. true
  14944. );
  14945. const resolveModifiers = (key, modifiers, context, loc) => {
  14946. const keyModifiers = [];
  14947. const nonKeyModifiers = [];
  14948. const eventOptionModifiers = [];
  14949. for (let i = 0; i < modifiers.length; i++) {
  14950. const modifier = modifiers[i];
  14951. if (isEventOptionModifier(modifier)) {
  14952. eventOptionModifiers.push(modifier);
  14953. } else {
  14954. if (maybeKeyModifier(modifier)) {
  14955. if (isStaticExp(key)) {
  14956. if (isKeyboardEvent(key.content)) {
  14957. keyModifiers.push(modifier);
  14958. } else {
  14959. nonKeyModifiers.push(modifier);
  14960. }
  14961. } else {
  14962. keyModifiers.push(modifier);
  14963. nonKeyModifiers.push(modifier);
  14964. }
  14965. } else {
  14966. if (isNonKeyModifier(modifier)) {
  14967. nonKeyModifiers.push(modifier);
  14968. } else {
  14969. keyModifiers.push(modifier);
  14970. }
  14971. }
  14972. }
  14973. }
  14974. return {
  14975. keyModifiers,
  14976. nonKeyModifiers,
  14977. eventOptionModifiers
  14978. };
  14979. };
  14980. const transformClick = (key, event) => {
  14981. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  14982. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  14983. `(`,
  14984. key,
  14985. `) === "onClick" ? "${event}" : (`,
  14986. key,
  14987. `)`
  14988. ]) : key;
  14989. };
  14990. const transformOn = (dir, node, context) => {
  14991. return transformOn$1(dir, node, context, (baseResult) => {
  14992. const {modifiers} = dir;
  14993. if (!modifiers.length)
  14994. return baseResult;
  14995. let {key, value: handlerExp} = baseResult.props[0];
  14996. const {
  14997. keyModifiers,
  14998. nonKeyModifiers,
  14999. eventOptionModifiers
  15000. } = resolveModifiers(key, modifiers, context, dir.loc);
  15001. if (nonKeyModifiers.includes("right")) {
  15002. key = transformClick(key, `onContextmenu`);
  15003. }
  15004. if (nonKeyModifiers.includes("middle")) {
  15005. key = transformClick(key, `onMouseup`);
  15006. }
  15007. if (nonKeyModifiers.length) {
  15008. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  15009. handlerExp,
  15010. JSON.stringify(nonKeyModifiers)
  15011. ]);
  15012. }
  15013. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  15014. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  15015. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  15016. handlerExp,
  15017. JSON.stringify(keyModifiers)
  15018. ]);
  15019. }
  15020. if (eventOptionModifiers.length) {
  15021. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  15022. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  15023. }
  15024. return {
  15025. props: [createObjectProperty(key, handlerExp)]
  15026. };
  15027. });
  15028. };
  15029. const transformShow = (dir, node, context) => {
  15030. const {exp, loc} = dir;
  15031. if (!exp) {
  15032. context.onError(
  15033. createDOMCompilerError(61, loc)
  15034. );
  15035. }
  15036. return {
  15037. props: [],
  15038. needRuntime: context.helper(V_SHOW)
  15039. };
  15040. };
  15041. const transformTransition = (node, context) => {
  15042. if (node.type === 1 && node.tagType === 1) {
  15043. const component = context.isBuiltInComponent(node.tag);
  15044. if (component === TRANSITION) {
  15045. return () => {
  15046. if (!node.children.length) {
  15047. return;
  15048. }
  15049. if (hasMultipleChildren(node)) {
  15050. context.onError(
  15051. createDOMCompilerError(
  15052. 62,
  15053. {
  15054. start: node.children[0].loc.start,
  15055. end: node.children[node.children.length - 1].loc.end,
  15056. source: ""
  15057. }
  15058. )
  15059. );
  15060. }
  15061. const child = node.children[0];
  15062. if (child.type === 1) {
  15063. for (const p of child.props) {
  15064. if (p.type === 7 && p.name === "show") {
  15065. node.props.push({
  15066. type: 6,
  15067. name: "persisted",
  15068. value: void 0,
  15069. loc: node.loc
  15070. });
  15071. }
  15072. }
  15073. }
  15074. };
  15075. }
  15076. }
  15077. };
  15078. function hasMultipleChildren(node) {
  15079. const children = node.children = node.children.filter(
  15080. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  15081. );
  15082. const child = children[0];
  15083. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  15084. }
  15085. const ignoreSideEffectTags = (node, context) => {
  15086. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  15087. context.onError(
  15088. createDOMCompilerError(
  15089. 63,
  15090. node.loc
  15091. )
  15092. );
  15093. context.removeNode();
  15094. }
  15095. };
  15096. const DOMNodeTransforms = [
  15097. transformStyle,
  15098. ...[transformTransition]
  15099. ];
  15100. const DOMDirectiveTransforms = {
  15101. cloak: noopDirectiveTransform,
  15102. html: transformVHtml,
  15103. text: transformVText,
  15104. model: transformModel,
  15105. // override compiler-core
  15106. on: transformOn,
  15107. // override compiler-core
  15108. show: transformShow
  15109. };
  15110. function compile(template, options = {}) {
  15111. return baseCompile(
  15112. template,
  15113. extend({}, parserOptions, options, {
  15114. nodeTransforms: [
  15115. // ignore <script> and <tag>
  15116. // this is not put inside DOMNodeTransforms because that list is used
  15117. // by compiler-ssr to generate vnode fallback branches
  15118. ignoreSideEffectTags,
  15119. ...DOMNodeTransforms,
  15120. ...options.nodeTransforms || []
  15121. ],
  15122. directiveTransforms: extend(
  15123. {},
  15124. DOMDirectiveTransforms,
  15125. options.directiveTransforms || {}
  15126. ),
  15127. transformHoist: null
  15128. })
  15129. );
  15130. }
  15131. {
  15132. initDev();
  15133. }
  15134. const compileCache = /* @__PURE__ */ Object.create(null);
  15135. function compileToFunction(template, options) {
  15136. if (!isString(template)) {
  15137. if (template.nodeType) {
  15138. template = template.innerHTML;
  15139. } else {
  15140. warn(`invalid template option: `, template);
  15141. return NOOP;
  15142. }
  15143. }
  15144. const key = template;
  15145. const cached = compileCache[key];
  15146. if (cached) {
  15147. return cached;
  15148. }
  15149. if (template[0] === "#") {
  15150. const el = document.querySelector(template);
  15151. if (!el) {
  15152. warn(`Template element not found or is empty: ${template}`);
  15153. }
  15154. template = el ? el.innerHTML : ``;
  15155. }
  15156. const opts = extend(
  15157. {
  15158. hoistStatic: true,
  15159. onError: onError,
  15160. onWarn: (e) => onError(e, true)
  15161. },
  15162. options
  15163. );
  15164. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  15165. opts.isCustomElement = (tag) => !!customElements.get(tag);
  15166. }
  15167. const {code} = compile(template, opts);
  15168. function onError(err, asWarning = false) {
  15169. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  15170. const codeFrame = err.loc && generateCodeFrame(
  15171. template,
  15172. err.loc.start.offset,
  15173. err.loc.end.offset
  15174. );
  15175. warn(codeFrame ? `${message}
  15176. ${codeFrame}` : message);
  15177. }
  15178. const render = new Function(code)();
  15179. render._rc = true;
  15180. return compileCache[key] = render;
  15181. }
  15182. registerRuntimeCompiler(compileToFunction);
  15183. exports.BaseTransition = BaseTransition;
  15184. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  15185. exports.Comment = Comment;
  15186. exports.EffectScope = EffectScope;
  15187. exports.Fragment = Fragment;
  15188. exports.KeepAlive = KeepAlive;
  15189. exports.ReactiveEffect = ReactiveEffect;
  15190. exports.Static = Static;
  15191. exports.Suspense = Suspense;
  15192. exports.Teleport = Teleport;
  15193. exports.Text = Text;
  15194. exports.Transition = Transition;
  15195. exports.TransitionGroup = TransitionGroup;
  15196. exports.VueElement = VueElement;
  15197. exports.assertNumber = assertNumber;
  15198. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  15199. exports.callWithErrorHandling = callWithErrorHandling;
  15200. exports.camelize = camelize;
  15201. exports.capitalize = capitalize;
  15202. exports.cloneVNode = cloneVNode;
  15203. exports.compatUtils = compatUtils;
  15204. exports.compile = compileToFunction;
  15205. exports.computed = computed;
  15206. exports.createApp = createApp;
  15207. exports.createBlock = createBlock;
  15208. exports.createCommentVNode = createCommentVNode;
  15209. exports.createElementBlock = createElementBlock;
  15210. exports.createElementVNode = createBaseVNode;
  15211. exports.createHydrationRenderer = createHydrationRenderer;
  15212. exports.createPropsRestProxy = createPropsRestProxy;
  15213. exports.createRenderer = createRenderer;
  15214. exports.createSSRApp = createSSRApp;
  15215. exports.createSlots = createSlots;
  15216. exports.createStaticVNode = createStaticVNode;
  15217. exports.createTextVNode = createTextVNode;
  15218. exports.createVNode = createVNode;
  15219. exports.customRef = customRef;
  15220. exports.defineAsyncComponent = defineAsyncComponent;
  15221. exports.defineComponent = defineComponent;
  15222. exports.defineCustomElement = defineCustomElement;
  15223. exports.defineEmits = defineEmits;
  15224. exports.defineExpose = defineExpose;
  15225. exports.defineModel = defineModel;
  15226. exports.defineOptions = defineOptions;
  15227. exports.defineProps = defineProps;
  15228. exports.defineSSRCustomElement = defineSSRCustomElement;
  15229. exports.defineSlots = defineSlots;
  15230. exports.effect = effect;
  15231. exports.effectScope = effectScope;
  15232. exports.getCurrentInstance = getCurrentInstance;
  15233. exports.getCurrentScope = getCurrentScope;
  15234. exports.getTransitionRawChildren = getTransitionRawChildren;
  15235. exports.guardReactiveProps = guardReactiveProps;
  15236. exports.h = h;
  15237. exports.handleError = handleError;
  15238. exports.hasInjectionContext = hasInjectionContext;
  15239. exports.hydrate = hydrate;
  15240. exports.initCustomFormatter = initCustomFormatter;
  15241. exports.initDirectivesForSSR = initDirectivesForSSR;
  15242. exports.inject = inject;
  15243. exports.isMemoSame = isMemoSame;
  15244. exports.isProxy = isProxy;
  15245. exports.isReactive = isReactive;
  15246. exports.isReadonly = isReadonly;
  15247. exports.isRef = isRef;
  15248. exports.isRuntimeOnly = isRuntimeOnly;
  15249. exports.isShallow = isShallow;
  15250. exports.isVNode = isVNode;
  15251. exports.markRaw = markRaw;
  15252. exports.mergeDefaults = mergeDefaults;
  15253. exports.mergeModels = mergeModels;
  15254. exports.mergeProps = mergeProps;
  15255. exports.nextTick = nextTick;
  15256. exports.normalizeClass = normalizeClass;
  15257. exports.normalizeProps = normalizeProps;
  15258. exports.normalizeStyle = normalizeStyle;
  15259. exports.onActivated = onActivated;
  15260. exports.onBeforeMount = onBeforeMount;
  15261. exports.onBeforeUnmount = onBeforeUnmount;
  15262. exports.onBeforeUpdate = onBeforeUpdate;
  15263. exports.onDeactivated = onDeactivated;
  15264. exports.onErrorCaptured = onErrorCaptured;
  15265. exports.onMounted = onMounted;
  15266. exports.onRenderTracked = onRenderTracked;
  15267. exports.onRenderTriggered = onRenderTriggered;
  15268. exports.onScopeDispose = onScopeDispose;
  15269. exports.onServerPrefetch = onServerPrefetch;
  15270. exports.onUnmounted = onUnmounted;
  15271. exports.onUpdated = onUpdated;
  15272. exports.openBlock = openBlock;
  15273. exports.popScopeId = popScopeId;
  15274. exports.provide = provide;
  15275. exports.proxyRefs = proxyRefs;
  15276. exports.pushScopeId = pushScopeId;
  15277. exports.queuePostFlushCb = queuePostFlushCb;
  15278. exports.reactive = reactive;
  15279. exports.readonly = readonly;
  15280. exports.ref = ref;
  15281. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  15282. exports.render = render;
  15283. exports.renderList = renderList;
  15284. exports.renderSlot = renderSlot;
  15285. exports.resolveComponent = resolveComponent;
  15286. exports.resolveDirective = resolveDirective;
  15287. exports.resolveDynamicComponent = resolveDynamicComponent;
  15288. exports.resolveFilter = resolveFilter;
  15289. exports.resolveTransitionHooks = resolveTransitionHooks;
  15290. exports.setBlockTracking = setBlockTracking;
  15291. exports.setDevtoolsHook = setDevtoolsHook;
  15292. exports.setTransitionHooks = setTransitionHooks;
  15293. exports.shallowReactive = shallowReactive;
  15294. exports.shallowReadonly = shallowReadonly;
  15295. exports.shallowRef = shallowRef;
  15296. exports.ssrContextKey = ssrContextKey;
  15297. exports.ssrUtils = ssrUtils;
  15298. exports.stop = stop;
  15299. exports.toDisplayString = toDisplayString;
  15300. exports.toHandlerKey = toHandlerKey;
  15301. exports.toHandlers = toHandlers;
  15302. exports.toRaw = toRaw;
  15303. exports.toRef = toRef;
  15304. exports.toRefs = toRefs;
  15305. exports.toValue = toValue;
  15306. exports.transformVNodeArgs = transformVNodeArgs;
  15307. exports.triggerRef = triggerRef;
  15308. exports.unref = unref;
  15309. exports.useAttrs = useAttrs;
  15310. exports.useCssModule = useCssModule;
  15311. exports.useCssVars = useCssVars;
  15312. exports.useModel = useModel;
  15313. exports.useSSRContext = useSSRContext;
  15314. exports.useSlots = useSlots;
  15315. exports.useTransitionState = useTransitionState;
  15316. exports.vModelCheckbox = vModelCheckbox;
  15317. exports.vModelDynamic = vModelDynamic;
  15318. exports.vModelRadio = vModelRadio;
  15319. exports.vModelSelect = vModelSelect;
  15320. exports.vModelText = vModelText;
  15321. exports.vShow = vShow;
  15322. exports.version = version;
  15323. exports.warn = warn;
  15324. exports.watch = watch;
  15325. exports.watchEffect = watchEffect;
  15326. exports.watchPostEffect = watchPostEffect;
  15327. exports.watchSyncEffect = watchSyncEffect;
  15328. exports.withAsyncContext = withAsyncContext;
  15329. exports.withCtx = withCtx;
  15330. exports.withDefaults = withDefaults;
  15331. exports.withDirectives = withDirectives;
  15332. exports.withKeys = withKeys;
  15333. exports.withMemo = withMemo;
  15334. exports.withModifiers = withModifiers;
  15335. exports.withScopeId = withScopeId;
  15336. return exports;
  15337. })({});