uvue.runtime.esm.dev.js 322 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726
  1. function makeMap(str, expectsLowerCase) {
  2. var map = /* @__PURE__ */Object.create(null);
  3. var list = str.split(",");
  4. for (var i = 0; i < list.length; i++) {
  5. map[list[i]] = true;
  6. }
  7. return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
  8. }
  9. var EMPTY_OBJ = Object.freeze({});
  10. var EMPTY_ARR = Object.freeze([]);
  11. var NOOP = () => {};
  12. var NO = () => false;
  13. var isOn = key => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (
  14. // uppercase letter
  15. key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  16. var isModelListener = key => key.startsWith("onUpdate:");
  17. var extend$1 = Object.assign;
  18. var remove = (arr, el) => {
  19. var i = arr.indexOf(el);
  20. if (i > -1) {
  21. arr.splice(i, 1);
  22. }
  23. };
  24. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  25. var hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  26. var isArray = Array.isArray;
  27. var isMap = val => toTypeString(val) === "[object Map]";
  28. var isSet = val => toTypeString(val) === "[object Set]";
  29. var isRegExp = val => toTypeString(val) === "[object RegExp]";
  30. var isFunction = val => typeof val === "function";
  31. var isString = val => typeof val === "string";
  32. var isSymbol = val => typeof val === "symbol";
  33. var isObject = val => val !== null && typeof val === "object";
  34. var isPromise = val => {
  35. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  36. };
  37. var objectToString = Object.prototype.toString;
  38. var toTypeString = value => objectToString.call(value);
  39. var toRawType = value => {
  40. return toTypeString(value).slice(8, -1);
  41. };
  42. var isPlainObject = val => toTypeString(val) === "[object Object]";
  43. var isIntegerKey = key => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  44. var isReservedProp = /* @__PURE__ */makeMap(
  45. // the leading comma is intentional so empty string "" is also included
  46. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
  47. var isBuiltInDirective = /* @__PURE__ */makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
  48. var cacheStringFunction = fn => {
  49. var cache = /* @__PURE__ */Object.create(null);
  50. return str => {
  51. var hit = cache[str];
  52. return hit || (cache[str] = fn(str));
  53. };
  54. };
  55. var camelizeRE = /-(\w)/g;
  56. var camelize = cacheStringFunction(str => {
  57. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  58. });
  59. var hyphenateRE = /\B([A-Z])/g;
  60. var hyphenate = cacheStringFunction(str => str.replace(hyphenateRE, "-$1").toLowerCase());
  61. var capitalize = cacheStringFunction(str => {
  62. return str.charAt(0).toUpperCase() + str.slice(1);
  63. });
  64. var toHandlerKey = cacheStringFunction(str => {
  65. var s = str ? "on".concat(capitalize(str)) : "";
  66. return s;
  67. });
  68. var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  69. var invokeArrayFns = (fns, arg) => {
  70. for (var i = 0; i < fns.length; i++) {
  71. fns[i](arg);
  72. }
  73. };
  74. var def = (obj, key, value) => {
  75. Object.defineProperty(obj, key, {
  76. configurable: true,
  77. enumerable: false,
  78. value
  79. });
  80. };
  81. var looseToNumber = val => {
  82. var n = parseFloat(val);
  83. return isNaN(n) ? val : n;
  84. };
  85. var toNumber = val => {
  86. var n = isString(val) ? Number(val) : NaN;
  87. return isNaN(n) ? val : n;
  88. };
  89. var _globalThis;
  90. var getGlobalThis = () => {
  91. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  92. };
  93. var 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";
  94. var isGloballyAllowed = /* @__PURE__ */makeMap(GLOBALS_ALLOWED);
  95. var isGloballyWhitelisted = isGloballyAllowed;
  96. function normalizeStyle(value) {
  97. if (isArray(value)) {
  98. var res = {};
  99. for (var i = 0; i < value.length; i++) {
  100. var item = value[i];
  101. var normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  102. if (normalized) {
  103. for (var key in normalized) {
  104. res[key] = normalized[key];
  105. }
  106. }
  107. }
  108. return res;
  109. } else if (isString(value) || isObject(value)) {
  110. return value;
  111. }
  112. }
  113. var listDelimiterRE = /;(?![^(]*\))/g;
  114. var propertyDelimiterRE = /:([^]+)/;
  115. var styleCommentRE = /\/\*[^]*?\*\//g;
  116. function parseStringStyle(cssText) {
  117. var ret = {};
  118. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach(item => {
  119. if (item) {
  120. var tmp = item.split(propertyDelimiterRE);
  121. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  122. }
  123. });
  124. return ret;
  125. }
  126. function normalizeClass(value) {
  127. var res = "";
  128. if (isString(value)) {
  129. res = value;
  130. } else if (isArray(value)) {
  131. for (var i = 0; i < value.length; i++) {
  132. var normalized = normalizeClass(value[i]);
  133. if (normalized) {
  134. res += normalized + " ";
  135. }
  136. }
  137. } else if (isObject(value)) {
  138. for (var name in value) {
  139. if (value[name]) {
  140. res += name + " ";
  141. }
  142. }
  143. }
  144. return res.trim();
  145. }
  146. function normalizeProps(props) {
  147. if (!props) return null;
  148. var {
  149. class: klass,
  150. style
  151. } = props;
  152. if (klass && !isString(klass)) {
  153. props.class = normalizeClass(klass);
  154. }
  155. if (style) {
  156. props.style = normalizeStyle(style);
  157. }
  158. return props;
  159. }
  160. var toDisplayString = val => {
  161. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  162. };
  163. var replacer = (_key, val) => {
  164. if (val && val.__v_isRef) {
  165. return replacer(_key, val.value);
  166. } else if (isMap(val)) {
  167. return {
  168. ["Map(".concat(val.size, ")")]: [...val.entries()].reduce((entries, _ref, i) => {
  169. var [key, val2] = _ref;
  170. entries[stringifySymbol(key, i) + " =>"] = val2;
  171. return entries;
  172. }, {})
  173. };
  174. } else if (isSet(val)) {
  175. return {
  176. ["Set(".concat(val.size, ")")]: [...val.values()].map(v => stringifySymbol(v))
  177. };
  178. } else if (isSymbol(val)) {
  179. return stringifySymbol(val);
  180. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  181. return String(val);
  182. }
  183. return val;
  184. };
  185. var stringifySymbol = function (v) {
  186. var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  187. var _a;
  188. return isSymbol(v) ? "Symbol(".concat((_a = v.description) != null ? _a : i, ")") : v;
  189. };
  190. function warn$1(msg) {
  191. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
  192. args[_key2 - 1] = arguments[_key2];
  193. }
  194. console.warn("[Vue warn] ".concat(msg), ...args);
  195. }
  196. var activeEffectScope;
  197. class EffectScope {
  198. constructor() {
  199. var detached = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  200. this.detached = detached;
  201. /**
  202. * @internal
  203. */
  204. this._active = true;
  205. /**
  206. * @internal
  207. */
  208. this.effects = [];
  209. /**
  210. * @internal
  211. */
  212. this.cleanups = [];
  213. this.parent = activeEffectScope;
  214. if (!detached && activeEffectScope) {
  215. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  216. }
  217. }
  218. get active() {
  219. return this._active;
  220. }
  221. run(fn) {
  222. if (this._active) {
  223. var currentEffectScope = activeEffectScope;
  224. try {
  225. activeEffectScope = this;
  226. return fn();
  227. } finally {
  228. activeEffectScope = currentEffectScope;
  229. }
  230. } else {
  231. warn$1("cannot run an inactive effect scope.");
  232. }
  233. }
  234. /**
  235. * This should only be called on non-detached scopes
  236. * @internal
  237. */
  238. on() {
  239. activeEffectScope = this;
  240. }
  241. /**
  242. * This should only be called on non-detached scopes
  243. * @internal
  244. */
  245. off() {
  246. activeEffectScope = this.parent;
  247. }
  248. stop(fromParent) {
  249. if (this._active) {
  250. var i, l;
  251. for (i = 0, l = this.effects.length; i < l; i++) {
  252. this.effects[i].stop();
  253. }
  254. for (i = 0, l = this.cleanups.length; i < l; i++) {
  255. this.cleanups[i]();
  256. }
  257. if (this.scopes) {
  258. for (i = 0, l = this.scopes.length; i < l; i++) {
  259. this.scopes[i].stop(true);
  260. }
  261. }
  262. if (!this.detached && this.parent && !fromParent) {
  263. var last = this.parent.scopes.pop();
  264. if (last && last !== this) {
  265. this.parent.scopes[this.index] = last;
  266. last.index = this.index;
  267. }
  268. }
  269. this.parent = void 0;
  270. this._active = false;
  271. }
  272. }
  273. }
  274. function effectScope(detached) {
  275. return new EffectScope(detached);
  276. }
  277. function recordEffectScope(effect) {
  278. var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : activeEffectScope;
  279. if (scope && scope.active) {
  280. scope.effects.push(effect);
  281. }
  282. }
  283. function getCurrentScope() {
  284. return activeEffectScope;
  285. }
  286. function onScopeDispose(fn) {
  287. if (activeEffectScope) {
  288. activeEffectScope.cleanups.push(fn);
  289. } else {
  290. warn$1("onScopeDispose() is called when there is no active effect scope to be associated with.");
  291. }
  292. }
  293. var createDep = effects => {
  294. var dep = new Set(effects);
  295. dep.w = 0;
  296. dep.n = 0;
  297. return dep;
  298. };
  299. var wasTracked = dep => (dep.w & trackOpBit) > 0;
  300. var newTracked = dep => (dep.n & trackOpBit) > 0;
  301. var initDepMarkers = _ref2 => {
  302. var {
  303. deps
  304. } = _ref2;
  305. if (deps.length) {
  306. for (var i = 0; i < deps.length; i++) {
  307. deps[i].w |= trackOpBit;
  308. }
  309. }
  310. };
  311. var finalizeDepMarkers = effect => {
  312. var {
  313. deps
  314. } = effect;
  315. if (deps.length) {
  316. var ptr = 0;
  317. for (var i = 0; i < deps.length; i++) {
  318. var dep = deps[i];
  319. if (wasTracked(dep) && !newTracked(dep)) {
  320. dep.delete(effect);
  321. } else {
  322. deps[ptr++] = dep;
  323. }
  324. dep.w &= ~trackOpBit;
  325. dep.n &= ~trackOpBit;
  326. }
  327. deps.length = ptr;
  328. }
  329. };
  330. var targetMap = /* @__PURE__ */new WeakMap();
  331. var effectTrackDepth = 0;
  332. var trackOpBit = 1;
  333. var maxMarkerBits = 30;
  334. var activeEffect;
  335. var ITERATE_KEY = Symbol("iterate");
  336. var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  337. class ReactiveEffect {
  338. constructor(fn) {
  339. var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  340. var scope = arguments.length > 2 ? arguments[2] : undefined;
  341. this.fn = fn;
  342. this.scheduler = scheduler;
  343. this.active = true;
  344. this.deps = [];
  345. this.parent = void 0;
  346. recordEffectScope(this, scope);
  347. }
  348. run() {
  349. if (!this.active) {
  350. return this.fn();
  351. }
  352. var parent = activeEffect;
  353. var lastShouldTrack = shouldTrack;
  354. while (parent) {
  355. if (parent === this) {
  356. return;
  357. }
  358. parent = parent.parent;
  359. }
  360. try {
  361. this.parent = activeEffect;
  362. activeEffect = this;
  363. shouldTrack = true;
  364. trackOpBit = 1 << ++effectTrackDepth;
  365. if (effectTrackDepth <= maxMarkerBits) {
  366. initDepMarkers(this);
  367. } else {
  368. cleanupEffect(this);
  369. }
  370. return this.fn();
  371. } finally {
  372. if (effectTrackDepth <= maxMarkerBits) {
  373. finalizeDepMarkers(this);
  374. }
  375. trackOpBit = 1 << --effectTrackDepth;
  376. activeEffect = this.parent;
  377. shouldTrack = lastShouldTrack;
  378. this.parent = void 0;
  379. if (this.deferStop) {
  380. this.stop();
  381. }
  382. }
  383. }
  384. stop() {
  385. if (activeEffect === this) {
  386. this.deferStop = true;
  387. } else if (this.active) {
  388. cleanupEffect(this);
  389. if (this.onStop) {
  390. this.onStop();
  391. }
  392. this.active = false;
  393. }
  394. }
  395. }
  396. function cleanupEffect(effect2) {
  397. var {
  398. deps
  399. } = effect2;
  400. if (deps.length) {
  401. for (var i = 0; i < deps.length; i++) {
  402. deps[i].delete(effect2);
  403. }
  404. deps.length = 0;
  405. }
  406. }
  407. function effect(fn, options) {
  408. if (fn.effect instanceof ReactiveEffect) {
  409. fn = fn.effect.fn;
  410. }
  411. var _effect = new ReactiveEffect(fn);
  412. if (options) {
  413. extend$1(_effect, options);
  414. if (options.scope) recordEffectScope(_effect, options.scope);
  415. }
  416. if (!options || !options.lazy) {
  417. _effect.run();
  418. }
  419. var runner = _effect.run.bind(_effect);
  420. runner.effect = _effect;
  421. return runner;
  422. }
  423. function stop(runner) {
  424. runner.effect.stop();
  425. }
  426. var shouldTrack = true;
  427. var trackStack = [];
  428. function pauseTracking() {
  429. trackStack.push(shouldTrack);
  430. shouldTrack = false;
  431. }
  432. function resetTracking() {
  433. var last = trackStack.pop();
  434. shouldTrack = last === void 0 ? true : last;
  435. }
  436. function track(target, type, key) {
  437. if (shouldTrack && activeEffect) {
  438. var depsMap = targetMap.get(target);
  439. if (!depsMap) {
  440. targetMap.set(target, depsMap = /* @__PURE__ */new Map());
  441. }
  442. var dep = depsMap.get(key);
  443. if (!dep) {
  444. depsMap.set(key, dep = createDep());
  445. }
  446. var eventInfo = {
  447. effect: activeEffect,
  448. target,
  449. type,
  450. key
  451. };
  452. trackEffects(dep, eventInfo);
  453. }
  454. }
  455. function trackEffects(dep, debuggerEventExtraInfo) {
  456. var shouldTrack2 = false;
  457. if (effectTrackDepth <= maxMarkerBits) {
  458. if (!newTracked(dep)) {
  459. dep.n |= trackOpBit;
  460. shouldTrack2 = !wasTracked(dep);
  461. }
  462. } else {
  463. shouldTrack2 = !dep.has(activeEffect);
  464. }
  465. if (shouldTrack2) {
  466. dep.add(activeEffect);
  467. activeEffect.deps.push(dep);
  468. if (activeEffect.onTrack) {
  469. activeEffect.onTrack(extend$1({
  470. effect: activeEffect
  471. }, debuggerEventExtraInfo));
  472. }
  473. }
  474. }
  475. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  476. var depsMap = targetMap.get(target);
  477. if (!depsMap) {
  478. return;
  479. }
  480. var deps = [];
  481. if (type === "clear") {
  482. deps = [...depsMap.values()];
  483. } else if (key === "length" && isArray(target)) {
  484. var newLength = Number(newValue);
  485. depsMap.forEach((dep, key2) => {
  486. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  487. deps.push(dep);
  488. }
  489. });
  490. } else {
  491. if (key !== void 0) {
  492. deps.push(depsMap.get(key));
  493. }
  494. switch (type) {
  495. case "add":
  496. if (!isArray(target)) {
  497. deps.push(depsMap.get(ITERATE_KEY));
  498. if (isMap(target)) {
  499. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  500. }
  501. } else if (isIntegerKey(key)) {
  502. deps.push(depsMap.get("length"));
  503. }
  504. break;
  505. case "delete":
  506. if (!isArray(target)) {
  507. deps.push(depsMap.get(ITERATE_KEY));
  508. if (isMap(target)) {
  509. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  510. }
  511. }
  512. break;
  513. case "set":
  514. if (isMap(target)) {
  515. deps.push(depsMap.get(ITERATE_KEY));
  516. }
  517. break;
  518. }
  519. }
  520. var eventInfo = {
  521. target,
  522. type,
  523. key,
  524. newValue,
  525. oldValue,
  526. oldTarget
  527. };
  528. if (deps.length === 1) {
  529. if (deps[0]) {
  530. {
  531. triggerEffects(deps[0], eventInfo);
  532. }
  533. }
  534. } else {
  535. var effects = [];
  536. for (var dep of deps) {
  537. if (dep) {
  538. effects.push(...dep);
  539. }
  540. }
  541. {
  542. triggerEffects(createDep(effects), eventInfo);
  543. }
  544. }
  545. }
  546. function triggerEffects(dep, debuggerEventExtraInfo) {
  547. var effects = isArray(dep) ? dep : [...dep];
  548. for (var effect2 of effects) {
  549. if (effect2.computed) {
  550. triggerEffect(effect2, debuggerEventExtraInfo);
  551. }
  552. }
  553. for (var _effect2 of effects) {
  554. if (!_effect2.computed) {
  555. triggerEffect(_effect2, debuggerEventExtraInfo);
  556. }
  557. }
  558. }
  559. function triggerEffect(effect2, debuggerEventExtraInfo) {
  560. if (effect2 !== activeEffect || effect2.allowRecurse) {
  561. if (effect2.onTrigger) {
  562. effect2.onTrigger(extend$1({
  563. effect: effect2
  564. }, debuggerEventExtraInfo));
  565. }
  566. if (effect2.scheduler) {
  567. effect2.scheduler();
  568. } else {
  569. effect2.run();
  570. }
  571. }
  572. }
  573. function getDepFromReactive(object, key) {
  574. var _a;
  575. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  576. }
  577. var isNonTrackableKeys = /* @__PURE__ */makeMap("__proto__,__v_isRef,__isVue");
  578. var builtInSymbols = new Set( /* @__PURE__ */Object.getOwnPropertyNames(Symbol).filter(key => key !== "arguments" && key !== "caller").map(key => Symbol[key]).filter(isSymbol));
  579. var arrayInstrumentations = /* @__PURE__ */createArrayInstrumentations();
  580. function createArrayInstrumentations() {
  581. var instrumentations = {};
  582. ["includes", "indexOf", "lastIndexOf"].forEach(key => {
  583. instrumentations[key] = function () {
  584. var arr = toRaw(this);
  585. for (var i = 0, l = this.length; i < l; i++) {
  586. track(arr, "get", i + "");
  587. }
  588. for (var _len2 = arguments.length, args = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
  589. args[_key3] = arguments[_key3];
  590. }
  591. var res = arr[key](...args);
  592. if (res === -1 || res === false) {
  593. return arr[key](...args.map(toRaw));
  594. } else {
  595. return res;
  596. }
  597. };
  598. });
  599. ["push", "pop", "shift", "unshift", "splice"].forEach(key => {
  600. instrumentations[key] = function () {
  601. pauseTracking();
  602. for (var _len3 = arguments.length, args = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {
  603. args[_key4] = arguments[_key4];
  604. }
  605. var res = toRaw(this)[key].apply(this, args);
  606. resetTracking();
  607. return res;
  608. };
  609. });
  610. return instrumentations;
  611. }
  612. function hasOwnProperty(key) {
  613. var obj = toRaw(this);
  614. track(obj, "has", key);
  615. return obj.hasOwnProperty(key);
  616. }
  617. class BaseReactiveHandler {
  618. constructor() {
  619. var _isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  620. var _shallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  621. this._isReadonly = _isReadonly;
  622. this._shallow = _shallow;
  623. }
  624. get(target, key, receiver) {
  625. var isReadonly2 = this._isReadonly,
  626. shallow = this._shallow;
  627. if (key === "__v_isReactive") {
  628. return !isReadonly2;
  629. } else if (key === "__v_isReadonly") {
  630. return isReadonly2;
  631. } else if (key === "__v_isShallow") {
  632. return shallow;
  633. } else if (key === "__v_raw") {
  634. if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) ||
  635. // receiver is not the reactive proxy, but has the same prototype
  636. // this means the reciever is a user proxy of the reactive proxy
  637. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  638. return target;
  639. }
  640. return;
  641. }
  642. var targetIsArray = isArray(target);
  643. if (!isReadonly2) {
  644. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  645. return Reflect.get(arrayInstrumentations, key, receiver);
  646. }
  647. if (key === "hasOwnProperty") {
  648. return hasOwnProperty;
  649. }
  650. }
  651. var res = Reflect.get(target, key, receiver);
  652. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  653. return res;
  654. }
  655. if (!isReadonly2) {
  656. track(target, "get", key);
  657. }
  658. if (shallow) {
  659. return res;
  660. }
  661. if (isRef(res)) {
  662. return targetIsArray && isIntegerKey(key) ? res : res.value;
  663. }
  664. if (isObject(res)) {
  665. return isReadonly2 ? readonly(res) : reactive(res);
  666. }
  667. return res;
  668. }
  669. }
  670. class MutableReactiveHandler extends BaseReactiveHandler {
  671. constructor() {
  672. var shallow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  673. super(false, shallow);
  674. }
  675. set(target, key, value, receiver) {
  676. var oldValue = target[key];
  677. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  678. return false;
  679. }
  680. if (!this._shallow) {
  681. if (!isShallow$1(value) && !isReadonly(value)) {
  682. oldValue = toRaw(oldValue);
  683. value = toRaw(value);
  684. }
  685. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  686. oldValue.value = value;
  687. return true;
  688. }
  689. }
  690. var hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  691. var result = Reflect.set(target, key, value, receiver);
  692. if (target === toRaw(receiver)) {
  693. if (!hadKey) {
  694. trigger(target, "add", key, value);
  695. } else if (hasChanged(value, oldValue)) {
  696. trigger(target, "set", key, value, oldValue);
  697. }
  698. }
  699. return result;
  700. }
  701. deleteProperty(target, key) {
  702. var hadKey = hasOwn(target, key);
  703. var oldValue = target[key];
  704. var result = Reflect.deleteProperty(target, key);
  705. if (result && hadKey) {
  706. trigger(target, "delete", key, void 0, oldValue);
  707. }
  708. return result;
  709. }
  710. has(target, key) {
  711. var result = Reflect.has(target, key);
  712. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  713. track(target, "has", key);
  714. }
  715. return result;
  716. }
  717. ownKeys(target) {
  718. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  719. return Reflect.ownKeys(target);
  720. }
  721. }
  722. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  723. constructor() {
  724. var shallow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  725. super(true, shallow);
  726. }
  727. set(target, key) {
  728. {
  729. warn$1("Set operation on key \"".concat(String(key), "\" failed: target is readonly."), target);
  730. }
  731. return true;
  732. }
  733. deleteProperty(target, key) {
  734. {
  735. warn$1("Delete operation on key \"".concat(String(key), "\" failed: target is readonly."), target);
  736. }
  737. return true;
  738. }
  739. }
  740. var mutableHandlers = /* @__PURE__ */new MutableReactiveHandler();
  741. var readonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler();
  742. var shallowReactiveHandlers = /* @__PURE__ */new MutableReactiveHandler(true);
  743. var shallowReadonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler(true);
  744. var toShallow = value => value;
  745. var getProto = v => Reflect.getPrototypeOf(v);
  746. function get(target, key) {
  747. var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  748. var isShallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  749. target = target["__v_raw"];
  750. var rawTarget = toRaw(target);
  751. var rawKey = toRaw(key);
  752. if (!isReadonly) {
  753. if (hasChanged(key, rawKey)) {
  754. track(rawTarget, "get", key);
  755. }
  756. track(rawTarget, "get", rawKey);
  757. }
  758. var {
  759. has: has2
  760. } = getProto(rawTarget);
  761. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  762. if (has2.call(rawTarget, key)) {
  763. return wrap(target.get(key));
  764. } else if (has2.call(rawTarget, rawKey)) {
  765. return wrap(target.get(rawKey));
  766. } else if (target !== rawTarget) {
  767. target.get(key);
  768. }
  769. }
  770. function has(key) {
  771. var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  772. var target = this["__v_raw"];
  773. var rawTarget = toRaw(target);
  774. var rawKey = toRaw(key);
  775. if (!isReadonly) {
  776. if (hasChanged(key, rawKey)) {
  777. track(rawTarget, "has", key);
  778. }
  779. track(rawTarget, "has", rawKey);
  780. }
  781. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  782. }
  783. function size(target) {
  784. var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  785. target = target["__v_raw"];
  786. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  787. return Reflect.get(target, "size", target);
  788. }
  789. function add(value) {
  790. value = toRaw(value);
  791. var target = toRaw(this);
  792. var proto = getProto(target);
  793. var hadKey = proto.has.call(target, value);
  794. if (!hadKey) {
  795. target.add(value);
  796. trigger(target, "add", value, value);
  797. }
  798. return this;
  799. }
  800. function set(key, value) {
  801. value = toRaw(value);
  802. var target = toRaw(this);
  803. var {
  804. has: has2,
  805. get: get2
  806. } = getProto(target);
  807. var hadKey = has2.call(target, key);
  808. if (!hadKey) {
  809. key = toRaw(key);
  810. hadKey = has2.call(target, key);
  811. } else {
  812. checkIdentityKeys(target, has2, key);
  813. }
  814. var oldValue = get2.call(target, key);
  815. target.set(key, value);
  816. if (!hadKey) {
  817. trigger(target, "add", key, value);
  818. } else if (hasChanged(value, oldValue)) {
  819. trigger(target, "set", key, value, oldValue);
  820. }
  821. return this;
  822. }
  823. function deleteEntry(key) {
  824. var target = toRaw(this);
  825. var {
  826. has: has2,
  827. get: get2
  828. } = getProto(target);
  829. var hadKey = has2.call(target, key);
  830. if (!hadKey) {
  831. key = toRaw(key);
  832. hadKey = has2.call(target, key);
  833. } else {
  834. checkIdentityKeys(target, has2, key);
  835. }
  836. var oldValue = get2 ? get2.call(target, key) : void 0;
  837. var result = target.delete(key);
  838. if (hadKey) {
  839. trigger(target, "delete", key, void 0, oldValue);
  840. }
  841. return result;
  842. }
  843. function clear() {
  844. var target = toRaw(this);
  845. var hadItems = target.size !== 0;
  846. var oldTarget = isMap(target) ? new Map(target) : new Set(target);
  847. var result = target.clear();
  848. if (hadItems) {
  849. trigger(target, "clear", void 0, void 0, oldTarget);
  850. }
  851. return result;
  852. }
  853. function createForEach(isReadonly, isShallow) {
  854. return function forEach(callback, thisArg) {
  855. var observed = this;
  856. var target = observed["__v_raw"];
  857. var rawTarget = toRaw(target);
  858. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  859. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  860. return target.forEach((value, key) => {
  861. return callback.call(thisArg, wrap(value), wrap(key), observed);
  862. });
  863. };
  864. }
  865. function createIterableMethod(method, isReadonly, isShallow) {
  866. return function () {
  867. var target = this["__v_raw"];
  868. var rawTarget = toRaw(target);
  869. var targetIsMap = isMap(rawTarget);
  870. var isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  871. var isKeyOnly = method === "keys" && targetIsMap;
  872. var innerIterator = target[method](...arguments);
  873. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  874. !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  875. return {
  876. // iterator protocol
  877. next() {
  878. var {
  879. value,
  880. done
  881. } = innerIterator.next();
  882. return done ? {
  883. value,
  884. done
  885. } : {
  886. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  887. done
  888. };
  889. },
  890. // iterable protocol
  891. [Symbol.iterator]() {
  892. return this;
  893. }
  894. };
  895. };
  896. }
  897. function createReadonlyMethod(type) {
  898. return function () {
  899. {
  900. var key = (arguments.length <= 0 ? undefined : arguments[0]) ? "on key \"".concat(arguments.length <= 0 ? undefined : arguments[0], "\" ") : "";
  901. console.warn("".concat(capitalize(type), " operation ").concat(key, "failed: target is readonly."), toRaw(this));
  902. }
  903. return type === "delete" ? false : type === "clear" ? void 0 : this;
  904. };
  905. }
  906. function createInstrumentations() {
  907. var mutableInstrumentations2 = {
  908. get(key) {
  909. return get(this, key);
  910. },
  911. get size() {
  912. return size(this);
  913. },
  914. has,
  915. add,
  916. set,
  917. delete: deleteEntry,
  918. clear,
  919. forEach: createForEach(false, false)
  920. };
  921. var shallowInstrumentations2 = {
  922. get(key) {
  923. return get(this, key, false, true);
  924. },
  925. get size() {
  926. return size(this);
  927. },
  928. has,
  929. add,
  930. set,
  931. delete: deleteEntry,
  932. clear,
  933. forEach: createForEach(false, true)
  934. };
  935. var readonlyInstrumentations2 = {
  936. get(key) {
  937. return get(this, key, true);
  938. },
  939. get size() {
  940. return size(this, true);
  941. },
  942. has(key) {
  943. return has.call(this, key, true);
  944. },
  945. add: createReadonlyMethod("add"),
  946. set: createReadonlyMethod("set"),
  947. delete: createReadonlyMethod("delete"),
  948. clear: createReadonlyMethod("clear"),
  949. forEach: createForEach(true, false)
  950. };
  951. var shallowReadonlyInstrumentations2 = {
  952. get(key) {
  953. return get(this, key, true, true);
  954. },
  955. get size() {
  956. return size(this, true);
  957. },
  958. has(key) {
  959. return has.call(this, key, true);
  960. },
  961. add: createReadonlyMethod("add"),
  962. set: createReadonlyMethod("set"),
  963. delete: createReadonlyMethod("delete"),
  964. clear: createReadonlyMethod("clear"),
  965. forEach: createForEach(true, true)
  966. };
  967. var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  968. iteratorMethods.forEach(method => {
  969. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  970. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  971. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  972. shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
  973. });
  974. return [mutableInstrumentations2, readonlyInstrumentations2, shallowInstrumentations2, shallowReadonlyInstrumentations2];
  975. }
  976. var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */createInstrumentations();
  977. function createInstrumentationGetter(isReadonly, shallow) {
  978. var instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  979. return (target, key, receiver) => {
  980. if (key === "__v_isReactive") {
  981. return !isReadonly;
  982. } else if (key === "__v_isReadonly") {
  983. return isReadonly;
  984. } else if (key === "__v_raw") {
  985. return target;
  986. }
  987. return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
  988. };
  989. }
  990. var mutableCollectionHandlers = {
  991. get: /* @__PURE__ */createInstrumentationGetter(false, false)
  992. };
  993. var shallowCollectionHandlers = {
  994. get: /* @__PURE__ */createInstrumentationGetter(false, true)
  995. };
  996. var readonlyCollectionHandlers = {
  997. get: /* @__PURE__ */createInstrumentationGetter(true, false)
  998. };
  999. var shallowReadonlyCollectionHandlers = {
  1000. get: /* @__PURE__ */createInstrumentationGetter(true, true)
  1001. };
  1002. function checkIdentityKeys(target, has2, key) {
  1003. var rawKey = toRaw(key);
  1004. if (rawKey !== key && has2.call(target, rawKey)) {
  1005. var type = toRawType(target);
  1006. console.warn("Reactive ".concat(type, " contains both the raw and reactive versions of the same object").concat(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."));
  1007. }
  1008. }
  1009. var reactiveMap = /* @__PURE__ */new WeakMap();
  1010. var shallowReactiveMap = /* @__PURE__ */new WeakMap();
  1011. var readonlyMap = /* @__PURE__ */new WeakMap();
  1012. var shallowReadonlyMap = /* @__PURE__ */new WeakMap();
  1013. function targetTypeMap(rawType) {
  1014. switch (rawType) {
  1015. case "Object":
  1016. case "Array":
  1017. return 1 /* COMMON */;
  1018. case "Map":
  1019. case "Set":
  1020. case "WeakMap":
  1021. case "WeakSet":
  1022. return 2 /* COLLECTION */;
  1023. default:
  1024. return 0 /* INVALID */;
  1025. }
  1026. }
  1027. function getTargetType(value) {
  1028. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1029. }
  1030. function reactive(target) {
  1031. if (isReadonly(target)) {
  1032. return target;
  1033. }
  1034. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  1035. }
  1036. function shallowReactive(target) {
  1037. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  1038. }
  1039. function readonly(target) {
  1040. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  1041. }
  1042. function shallowReadonly(target) {
  1043. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  1044. }
  1045. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1046. if (!isObject(target)) {
  1047. {
  1048. console.warn("value cannot be made reactive: ".concat(String(target)));
  1049. }
  1050. return target;
  1051. }
  1052. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1053. return target;
  1054. }
  1055. var existingProxy = proxyMap.get(target);
  1056. if (existingProxy) {
  1057. return existingProxy;
  1058. }
  1059. var targetType = getTargetType(target);
  1060. if (targetType === 0 /* INVALID */) {
  1061. return target;
  1062. }
  1063. var proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
  1064. proxyMap.set(target, proxy);
  1065. return proxy;
  1066. }
  1067. function isReactive(value) {
  1068. if (isReadonly(value)) {
  1069. return isReactive(value["__v_raw"]);
  1070. }
  1071. return !!(value && value["__v_isReactive"]);
  1072. }
  1073. function isReadonly(value) {
  1074. return !!(value && value["__v_isReadonly"]);
  1075. }
  1076. function isShallow$1(value) {
  1077. return !!(value && value["__v_isShallow"]);
  1078. }
  1079. function isProxy(value) {
  1080. return isReactive(value) || isReadonly(value);
  1081. }
  1082. function toRaw(observed) {
  1083. var raw = observed && observed["__v_raw"];
  1084. return raw ? toRaw(raw) : observed;
  1085. }
  1086. function markRaw(value) {
  1087. def(value, "__v_skip", true);
  1088. return value;
  1089. }
  1090. var toReactive = value => isObject(value) ? reactive(value) : value;
  1091. var toReadonly = value => isObject(value) ? readonly(value) : value;
  1092. function trackRefValue(ref2) {
  1093. if (shouldTrack && activeEffect) {
  1094. ref2 = toRaw(ref2);
  1095. {
  1096. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  1097. target: ref2,
  1098. type: "get",
  1099. key: "value"
  1100. });
  1101. }
  1102. }
  1103. }
  1104. function triggerRefValue(ref2, newVal) {
  1105. ref2 = toRaw(ref2);
  1106. var dep = ref2.dep;
  1107. if (dep) {
  1108. {
  1109. triggerEffects(dep, {
  1110. target: ref2,
  1111. type: "set",
  1112. key: "value",
  1113. newValue: newVal
  1114. });
  1115. }
  1116. }
  1117. }
  1118. function isRef(r) {
  1119. return !!(r && r.__v_isRef === true);
  1120. }
  1121. function ref(value) {
  1122. return createRef(value, false);
  1123. }
  1124. function shallowRef(value) {
  1125. return createRef(value, true);
  1126. }
  1127. function createRef(rawValue, shallow) {
  1128. if (isRef(rawValue)) {
  1129. return rawValue;
  1130. }
  1131. return new RefImpl(rawValue, shallow);
  1132. }
  1133. class RefImpl {
  1134. constructor(value, __v_isShallow) {
  1135. this.__v_isShallow = __v_isShallow;
  1136. this.dep = void 0;
  1137. this.__v_isRef = true;
  1138. this._rawValue = __v_isShallow ? value : toRaw(value);
  1139. this._value = __v_isShallow ? value : toReactive(value);
  1140. }
  1141. get value() {
  1142. trackRefValue(this);
  1143. return this._value;
  1144. }
  1145. set value(newVal) {
  1146. var useDirectValue = this.__v_isShallow || isShallow$1(newVal) || isReadonly(newVal);
  1147. newVal = useDirectValue ? newVal : toRaw(newVal);
  1148. if (hasChanged(newVal, this._rawValue)) {
  1149. this._rawValue = newVal;
  1150. this._value = useDirectValue ? newVal : toReactive(newVal);
  1151. triggerRefValue(this, newVal);
  1152. }
  1153. }
  1154. }
  1155. function triggerRef(ref2) {
  1156. triggerRefValue(ref2, ref2.value);
  1157. }
  1158. function unref(ref2) {
  1159. return isRef(ref2) ? ref2.value : ref2;
  1160. }
  1161. var shallowUnwrapHandlers = {
  1162. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1163. set: (target, key, value, receiver) => {
  1164. var oldValue = target[key];
  1165. if (isRef(oldValue) && !isRef(value)) {
  1166. oldValue.value = value;
  1167. return true;
  1168. } else {
  1169. return Reflect.set(target, key, value, receiver);
  1170. }
  1171. }
  1172. };
  1173. function proxyRefs(objectWithRefs) {
  1174. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1175. }
  1176. class CustomRefImpl {
  1177. constructor(factory) {
  1178. this.dep = void 0;
  1179. this.__v_isRef = true;
  1180. var {
  1181. get,
  1182. set
  1183. } = factory(() => trackRefValue(this), () => triggerRefValue(this));
  1184. this._get = get;
  1185. this._set = set;
  1186. }
  1187. get value() {
  1188. return this._get();
  1189. }
  1190. set value(newVal) {
  1191. this._set(newVal);
  1192. }
  1193. }
  1194. function customRef(factory) {
  1195. return new CustomRefImpl(factory);
  1196. }
  1197. function toRefs(object) {
  1198. if (!isProxy(object)) {
  1199. console.warn("toRefs() expects a reactive object but received a plain one.");
  1200. }
  1201. var ret = isArray(object) ? new Array(object.length) : {};
  1202. for (var key in object) {
  1203. ret[key] = propertyToRef(object, key);
  1204. }
  1205. return ret;
  1206. }
  1207. class ObjectRefImpl {
  1208. constructor(_object, _key, _defaultValue) {
  1209. this._object = _object;
  1210. this._key = _key;
  1211. this._defaultValue = _defaultValue;
  1212. this.__v_isRef = true;
  1213. }
  1214. get value() {
  1215. var val = this._object[this._key];
  1216. return val === void 0 ? this._defaultValue : val;
  1217. }
  1218. set value(newVal) {
  1219. this._object[this._key] = newVal;
  1220. }
  1221. get dep() {
  1222. return getDepFromReactive(toRaw(this._object), this._key);
  1223. }
  1224. }
  1225. class GetterRefImpl {
  1226. constructor(_getter) {
  1227. this._getter = _getter;
  1228. this.__v_isRef = true;
  1229. this.__v_isReadonly = true;
  1230. }
  1231. get value() {
  1232. return this._getter();
  1233. }
  1234. }
  1235. function toRef(source, key, defaultValue) {
  1236. if (isRef(source)) {
  1237. return source;
  1238. } else if (isFunction(source)) {
  1239. return new GetterRefImpl(source);
  1240. } else if (isObject(source) && arguments.length > 1) {
  1241. return propertyToRef(source, key, defaultValue);
  1242. } else {
  1243. return ref(source);
  1244. }
  1245. }
  1246. function propertyToRef(source, key, defaultValue) {
  1247. var val = source[key];
  1248. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1249. }
  1250. class ComputedRefImpl {
  1251. constructor(getter, _setter, isReadonly, isSSR) {
  1252. this._setter = _setter;
  1253. this.dep = void 0;
  1254. this.__v_isRef = true;
  1255. this["__v_isReadonly"] = false;
  1256. this._dirty = true;
  1257. this.effect = new ReactiveEffect(getter, () => {
  1258. if (!this._dirty) {
  1259. this._dirty = true;
  1260. triggerRefValue(this);
  1261. }
  1262. });
  1263. this.effect.computed = this;
  1264. this.effect.active = this._cacheable = !isSSR;
  1265. this["__v_isReadonly"] = isReadonly;
  1266. }
  1267. get value() {
  1268. var self = toRaw(this);
  1269. trackRefValue(self);
  1270. if (self._dirty || !self._cacheable) {
  1271. self._dirty = false;
  1272. self._value = self.effect.run();
  1273. }
  1274. return self._value;
  1275. }
  1276. set value(newValue) {
  1277. this._setter(newValue);
  1278. }
  1279. }
  1280. function computed$1(getterOrOptions, debugOptions) {
  1281. var isSSR = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1282. var getter;
  1283. var setter;
  1284. var onlyGetter = isFunction(getterOrOptions);
  1285. if (onlyGetter) {
  1286. getter = getterOrOptions;
  1287. setter = () => {
  1288. console.warn("Write operation failed: computed value is readonly");
  1289. };
  1290. } else {
  1291. getter = getterOrOptions.get;
  1292. setter = getterOrOptions.set;
  1293. }
  1294. var cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1295. if (debugOptions && !isSSR) {
  1296. cRef.effect.onTrack = debugOptions.onTrack;
  1297. cRef.effect.onTrigger = debugOptions.onTrigger;
  1298. }
  1299. return cRef;
  1300. }
  1301. // lifecycle
  1302. // App and Page
  1303. var ON_SHOW = 'onShow';
  1304. var ON_HIDE = 'onHide';
  1305. //Page
  1306. var ON_LOAD = 'onLoad';
  1307. var ON_UNLOAD = 'onUnload';
  1308. // 百度特有
  1309. var ON_INIT = 'onInit';
  1310. // 微信特有
  1311. var ON_SAVE_EXIT_STATE = 'onSaveExitState';
  1312. var ON_BACK_PRESS = 'onBackPress';
  1313. var ON_PAGE_SCROLL = 'onPageScroll';
  1314. var ON_TAB_ITEM_TAP = 'onTabItemTap';
  1315. var ON_REACH_BOTTOM = 'onReachBottom';
  1316. var ON_PULL_DOWN_REFRESH = 'onPullDownRefresh';
  1317. var ON_SHARE_TIMELINE = 'onShareTimeline';
  1318. var ON_ADD_TO_FAVORITES = 'onAddToFavorites';
  1319. var ON_SHARE_APP_MESSAGE = 'onShareAppMessage';
  1320. // navigationBar
  1321. var ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap';
  1322. var ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = 'onNavigationBarSearchInputClicked';
  1323. var ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = 'onNavigationBarSearchInputChanged';
  1324. var ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = 'onNavigationBarSearchInputConfirmed';
  1325. var ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = 'onNavigationBarSearchInputFocusChanged';
  1326. var PAGE_HOOKS = [ON_INIT, ON_LOAD, ON_SHOW, ON_HIDE, ON_UNLOAD, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SHARE_TIMELINE, ON_SHARE_APP_MESSAGE, ON_ADD_TO_FAVORITES, ON_SAVE_EXIT_STATE, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED];
  1327. var PAGE_SYNC_HOOKS = [ON_LOAD, ON_SHOW];
  1328. function isRootImmediateHook(name) {
  1329. return PAGE_SYNC_HOOKS.indexOf(name) > -1;
  1330. }
  1331. function isRootHook(name) {
  1332. return PAGE_HOOKS.indexOf(name) > -1;
  1333. }
  1334. var stack = [];
  1335. function pushWarningContext(vnode) {
  1336. stack.push(vnode);
  1337. }
  1338. function popWarningContext() {
  1339. stack.pop();
  1340. }
  1341. function warn(msg) {
  1342. // avoid props formatting or warn handler tracking deps that might be mutated
  1343. // during patch, leading to infinite recursion.
  1344. pauseTracking();
  1345. var instance = stack.length ? stack[stack.length - 1].component : null;
  1346. var appWarnHandler = instance && instance.appContext.config.warnHandler;
  1347. var trace = getComponentTrace();
  1348. for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key5 = 1; _key5 < _len4; _key5++) {
  1349. args[_key5 - 1] = arguments[_key5];
  1350. }
  1351. if (appWarnHandler) {
  1352. callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [msg + args.join(''), instance && instance.proxy, trace.map(_ref3 => {
  1353. var {
  1354. vnode
  1355. } = _ref3;
  1356. return "at <".concat(formatComponentName(instance, vnode.type), ">");
  1357. }).join('\n'), trace]);
  1358. } else {
  1359. var warnArgs = ["[Vue warn]: ".concat(msg), ...args];
  1360. /* istanbul ignore if */
  1361. if (trace.length &&
  1362. // avoid spamming console during tests
  1363. !false) {
  1364. warnArgs.push("\n", ...formatTrace(trace));
  1365. }
  1366. console.warn(...warnArgs);
  1367. }
  1368. resetTracking();
  1369. }
  1370. function getComponentTrace() {
  1371. var currentVNode = stack[stack.length - 1];
  1372. if (!currentVNode) {
  1373. return [];
  1374. }
  1375. // we can't just use the stack because it will be incomplete during updates
  1376. // that did not start from the root. Re-construct the parent chain using
  1377. // instance parent pointers.
  1378. var normalizedStack = [];
  1379. while (currentVNode) {
  1380. var last = normalizedStack[0];
  1381. if (last && last.vnode === currentVNode) {
  1382. last.recurseCount++;
  1383. } else {
  1384. normalizedStack.push({
  1385. vnode: currentVNode,
  1386. recurseCount: 0
  1387. });
  1388. }
  1389. var parentInstance = currentVNode.component && currentVNode.component.parent;
  1390. currentVNode = parentInstance && parentInstance.vnode;
  1391. }
  1392. return normalizedStack;
  1393. }
  1394. /* istanbul ignore next */
  1395. function formatTrace(trace) {
  1396. var logs = [];
  1397. trace.forEach((entry, i) => {
  1398. logs.push(...(i === 0 ? [] : ["\n"]), ...formatTraceEntry(entry));
  1399. });
  1400. return logs;
  1401. }
  1402. function formatTraceEntry(_ref4) {
  1403. var {
  1404. vnode,
  1405. recurseCount
  1406. } = _ref4;
  1407. var postfix = recurseCount > 0 ? "... (".concat(recurseCount, " recursive calls)") : "";
  1408. var isRoot = vnode.component ? vnode.component.parent == null : false;
  1409. var open = " at <".concat(formatComponentName(vnode.component, vnode.type, isRoot));
  1410. var close = ">" + postfix;
  1411. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1412. }
  1413. /* istanbul ignore next */
  1414. function formatProps(props) {
  1415. var res = [];
  1416. var keys = Object.keys(props);
  1417. keys.slice(0, 3).forEach(key => {
  1418. res.push(...formatProp(key, props[key]));
  1419. });
  1420. if (keys.length > 3) {
  1421. res.push(" ...");
  1422. }
  1423. return res;
  1424. }
  1425. /* istanbul ignore next */
  1426. function formatProp(key, value, raw) {
  1427. if (isString(value)) {
  1428. value = JSON.stringify(value);
  1429. return raw ? value : ["".concat(key, "=").concat(value)];
  1430. } else if (typeof value === 'number' || typeof value === 'boolean' || value == null) {
  1431. return raw ? value : ["".concat(key, "=").concat(value)];
  1432. } else if (isRef(value)) {
  1433. value = formatProp(key, toRaw(value.value), true);
  1434. return raw ? value : ["".concat(key, "=Ref<"), value, ">"];
  1435. } else if (isFunction(value)) {
  1436. return ["".concat(key, "=fn").concat(value.name ? "<".concat(value.name, ">") : "")];
  1437. } else {
  1438. value = toRaw(value);
  1439. return raw ? value : ["".concat(key, "="), value];
  1440. }
  1441. }
  1442. /**
  1443. * @internal
  1444. */
  1445. function assertNumber(val, type) {
  1446. if (val === undefined) {
  1447. return;
  1448. } else if (typeof val !== 'number') {
  1449. warn("".concat(type, " is not a valid number - ") + "got ".concat(JSON.stringify(val), "."));
  1450. } else if (isNaN(val)) {
  1451. warn("".concat(type, " is NaN - ") + 'the duration expression might be incorrect.');
  1452. }
  1453. }
  1454. var ErrorTypeStrings = {
  1455. ["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
  1456. ["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
  1457. ["c" /* LifecycleHooks.CREATED */]: 'created hook',
  1458. ["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
  1459. ["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
  1460. ["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
  1461. ["u" /* LifecycleHooks.UPDATED */]: 'updated',
  1462. ["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
  1463. ["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
  1464. ["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
  1465. ["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
  1466. ["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
  1467. ["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
  1468. ["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
  1469. [0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
  1470. [1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
  1471. [2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
  1472. [3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
  1473. [4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
  1474. [5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
  1475. [6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
  1476. [7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
  1477. [8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
  1478. [9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
  1479. [10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
  1480. [11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
  1481. [12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
  1482. [13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
  1483. [14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' + 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
  1484. };
  1485. function callWithErrorHandling(fn, instance, type, args) {
  1486. var res;
  1487. try {
  1488. res = args ? fn(...args) : fn();
  1489. } catch (err) {
  1490. handleError(err, instance, type);
  1491. }
  1492. return res;
  1493. }
  1494. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1495. if (isFunction(fn)) {
  1496. var res = callWithErrorHandling(fn, instance, type, args);
  1497. if (res && isPromise(res)) {
  1498. res.catch(err => {
  1499. handleError(err, instance, type);
  1500. });
  1501. }
  1502. return res;
  1503. }
  1504. var values = [];
  1505. for (var i = 0; i < fn.length; i++) {
  1506. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1507. }
  1508. return values;
  1509. }
  1510. function handleError(err, instance, type) {
  1511. var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  1512. var contextVNode = instance ? instance.vnode : null;
  1513. if (instance) {
  1514. var cur = instance.parent;
  1515. // the exposed instance is the render proxy to keep it consistent with 2.x
  1516. var exposedInstance = instance.proxy;
  1517. // in production the hook receives only the error code
  1518. // fixed by xxxxxx
  1519. var errorInfo = ErrorTypeStrings[type] || type;
  1520. while (cur) {
  1521. var errorCapturedHooks = cur.ec;
  1522. if (errorCapturedHooks) {
  1523. for (var i = 0; i < errorCapturedHooks.length; i++) {
  1524. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1525. return;
  1526. }
  1527. }
  1528. }
  1529. cur = cur.parent;
  1530. }
  1531. // app-level handling
  1532. var appErrorHandler = instance.appContext.config.errorHandler;
  1533. if (appErrorHandler) {
  1534. callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
  1535. return;
  1536. }
  1537. }
  1538. logError(err, type, contextVNode, throwInDev);
  1539. }
  1540. function logError(err, type, contextVNode) {
  1541. var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  1542. {
  1543. var info = ErrorTypeStrings[type] || type; // fixed by xxxxxx
  1544. if (contextVNode) {
  1545. pushWarningContext(contextVNode);
  1546. }
  1547. warn("Unhandled error".concat(info ? " during execution of ".concat(info) : ""));
  1548. if (contextVNode) {
  1549. popWarningContext();
  1550. }
  1551. // crash in dev by default so it's more noticeable
  1552. if (throwInDev) {
  1553. throw err;
  1554. } else {
  1555. console.error(err);
  1556. }
  1557. }
  1558. }
  1559. var isFlushing = false;
  1560. var isFlushPending = false;
  1561. var queue = [];
  1562. var flushIndex = 0;
  1563. var pendingPostFlushCbs = [];
  1564. var activePostFlushCbs = null;
  1565. var postFlushIndex = 0;
  1566. var resolvedPromise = /*#__PURE__*/Promise.resolve();
  1567. var currentFlushPromise = null;
  1568. var RECURSION_LIMIT = 100;
  1569. function nextTick(fn) {
  1570. var instance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstance();
  1571. var promise = currentFlushPromise || resolvedPromise;
  1572. var current = currentFlushPromise === null || instance === null ? promise : promise.then(() => {
  1573. return new Promise(resolve => {
  1574. if (instance === null) {
  1575. resolve();
  1576. } else {
  1577. instance.$waitNativeRender(() => {
  1578. resolve();
  1579. });
  1580. }
  1581. });
  1582. });
  1583. return fn ? current.then(this ? fn.bind(this) : fn) : current;
  1584. }
  1585. // #2768
  1586. // Use binary-search to find a suitable position in the queue,
  1587. // so that the queue maintains the increasing order of job's id,
  1588. // which can prevent the job from being skipped and also can avoid repeated patching.
  1589. function findInsertionIndex(id) {
  1590. // the start index should be `flushIndex + 1`
  1591. var start = flushIndex + 1;
  1592. var end = queue.length;
  1593. while (start < end) {
  1594. var middle = start + end >>> 1;
  1595. var middleJobId = getId(queue[middle]);
  1596. middleJobId < id ? start = middle + 1 : end = middle;
  1597. }
  1598. return start;
  1599. }
  1600. function queueJob(job) {
  1601. // the dedupe search uses the startIndex argument of Array.includes()
  1602. // by default the search index includes the current job that is being run
  1603. // so it cannot recursively trigger itself again.
  1604. // if the job is a watch() callback, the search will start with a +1 index to
  1605. // allow it recursively trigger itself - it is the user's responsibility to
  1606. // ensure it doesn't end up in an infinite loop.
  1607. if (!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
  1608. if (job.id == null) {
  1609. queue.push(job);
  1610. } else {
  1611. queue.splice(findInsertionIndex(job.id), 0, job);
  1612. }
  1613. queueFlush();
  1614. }
  1615. }
  1616. function queueFlush() {
  1617. if (!isFlushing && !isFlushPending) {
  1618. isFlushPending = true;
  1619. currentFlushPromise = resolvedPromise.then(flushJobs);
  1620. }
  1621. }
  1622. function invalidateJob(job) {
  1623. var i = queue.indexOf(job);
  1624. if (i > flushIndex) {
  1625. queue.splice(i, 1);
  1626. }
  1627. }
  1628. function queuePostFlushCb(cb) {
  1629. if (!isArray(cb)) {
  1630. if (!activePostFlushCbs || !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
  1631. pendingPostFlushCbs.push(cb);
  1632. }
  1633. } else {
  1634. // if cb is an array, it is a component lifecycle hook which can only be
  1635. // triggered by a job, which is already deduped in the main queue, so
  1636. // we can skip duplicate check here to improve perf
  1637. pendingPostFlushCbs.push(...cb);
  1638. }
  1639. queueFlush();
  1640. }
  1641. function flushPreFlushCbs(seen) {
  1642. var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isFlushing ? flushIndex + 1 : 0;
  1643. {
  1644. seen = seen || new Map();
  1645. }
  1646. for (; i < queue.length; i++) {
  1647. var cb = queue[i];
  1648. if (cb && cb.pre) {
  1649. if (checkRecursiveUpdates(seen, cb)) {
  1650. continue;
  1651. }
  1652. queue.splice(i, 1);
  1653. i--;
  1654. cb();
  1655. }
  1656. }
  1657. }
  1658. function flushPostFlushCbs(seen) {
  1659. if (pendingPostFlushCbs.length) {
  1660. var deduped = [...new Set(pendingPostFlushCbs)];
  1661. pendingPostFlushCbs.length = 0;
  1662. // #1947 already has active queue, nested flushPostFlushCbs call
  1663. if (activePostFlushCbs) {
  1664. activePostFlushCbs.push(...deduped);
  1665. return;
  1666. }
  1667. activePostFlushCbs = deduped;
  1668. {
  1669. seen = seen || new Map();
  1670. }
  1671. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1672. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1673. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1674. continue;
  1675. }
  1676. activePostFlushCbs[postFlushIndex]();
  1677. }
  1678. activePostFlushCbs = null;
  1679. postFlushIndex = 0;
  1680. }
  1681. }
  1682. var getId = job => job.id == null ? Infinity : job.id;
  1683. var comparator = (a, b) => {
  1684. var diff = getId(a) - getId(b);
  1685. if (diff === 0) {
  1686. if (a.pre && !b.pre) return -1;
  1687. if (b.pre && !a.pre) return 1;
  1688. }
  1689. return diff;
  1690. };
  1691. function flushJobs(seen) {
  1692. isFlushPending = false;
  1693. isFlushing = true;
  1694. {
  1695. seen = seen || new Map();
  1696. }
  1697. // Sort queue before flush.
  1698. // This ensures that:
  1699. // 1. Components are updated from parent to child. (because parent is always
  1700. // created before the child so its render effect will have smaller
  1701. // priority number)
  1702. // 2. If a component is unmounted during a parent component's update,
  1703. // its update can be skipped.
  1704. queue.sort(comparator);
  1705. // conditional usage of checkRecursiveUpdate must be determined out of
  1706. // try ... catch block since Rollup by default de-optimizes treeshaking
  1707. // inside try-catch. This can leave all warning code unshaked. Although
  1708. // they would get eventually shaken by a minifier like terser, some minifiers
  1709. // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
  1710. var check = job => checkRecursiveUpdates(seen, job);
  1711. try {
  1712. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1713. var job = queue[flushIndex];
  1714. if (job && job.active !== false) {
  1715. if ("development" !== 'production' && check(job)) {
  1716. continue;
  1717. }
  1718. // console.log(`running:`, job.id)
  1719. callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
  1720. }
  1721. }
  1722. } finally {
  1723. flushIndex = 0;
  1724. queue.length = 0;
  1725. flushPostFlushCbs(seen);
  1726. isFlushing = false;
  1727. currentFlushPromise = null;
  1728. // some postFlushCb queued jobs!
  1729. // keep flushing until it drains.
  1730. if (queue.length || pendingPostFlushCbs.length) {
  1731. flushJobs(seen);
  1732. }
  1733. }
  1734. }
  1735. function checkRecursiveUpdates(seen, fn) {
  1736. if (!seen.has(fn)) {
  1737. seen.set(fn, 1);
  1738. } else {
  1739. var count = seen.get(fn);
  1740. if (count > RECURSION_LIMIT) {
  1741. var instance = fn.ownerInstance;
  1742. var componentName = instance && getComponentName(instance.type);
  1743. warn("Maximum recursive updates exceeded".concat(componentName ? " in component <".concat(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.");
  1744. return true;
  1745. } else {
  1746. seen.set(fn, count + 1);
  1747. }
  1748. }
  1749. }
  1750. /* eslint-disable no-restricted-globals */
  1751. var isHmrUpdating = false;
  1752. var hmrDirtyComponents = new Set();
  1753. // Expose the HMR runtime on the global object
  1754. // This makes it entirely tree-shakable without polluting the exports and makes
  1755. // it easier to be used in toolings like vue-loader
  1756. // Note: for a component to be eligible for HMR it also needs the __hmrId option
  1757. // to be set so that its instances can be registered / removed.
  1758. {
  1759. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1760. createRecord: tryWrap(createRecord),
  1761. rerender: tryWrap(rerender),
  1762. reload: tryWrap(reload)
  1763. };
  1764. }
  1765. var map = new Map();
  1766. function registerHMR(instance) {
  1767. var id = instance.type.__hmrId;
  1768. var record = map.get(id);
  1769. if (!record) {
  1770. createRecord(id, instance.type);
  1771. record = map.get(id);
  1772. }
  1773. record.instances.add(instance);
  1774. }
  1775. function unregisterHMR(instance) {
  1776. map.get(instance.type.__hmrId).instances.delete(instance);
  1777. }
  1778. function createRecord(id, initialDef) {
  1779. if (map.has(id)) {
  1780. return false;
  1781. }
  1782. map.set(id, {
  1783. initialDef: normalizeClassComponent(initialDef),
  1784. instances: new Set()
  1785. });
  1786. return true;
  1787. }
  1788. function normalizeClassComponent(component) {
  1789. return isClassComponent(component) ? component.__vccOpts : component;
  1790. }
  1791. function rerender(id, newRender) {
  1792. var record = map.get(id);
  1793. if (!record) {
  1794. return;
  1795. }
  1796. // update initial record (for not-yet-rendered component)
  1797. record.initialDef.render = newRender;
  1798. [...record.instances].forEach(instance => {
  1799. if (newRender) {
  1800. instance.render = newRender;
  1801. normalizeClassComponent(instance.type).render = newRender;
  1802. }
  1803. instance.renderCache = [];
  1804. // this flag forces child components with slot content to update
  1805. isHmrUpdating = true;
  1806. instance.update();
  1807. isHmrUpdating = false;
  1808. });
  1809. }
  1810. function reload(id, newComp) {
  1811. var record = map.get(id);
  1812. if (!record) return;
  1813. newComp = normalizeClassComponent(newComp);
  1814. // update initial def (for not-yet-rendered components)
  1815. updateComponentDef(record.initialDef, newComp);
  1816. // create a snapshot which avoids the set being mutated during updates
  1817. var instances = [...record.instances];
  1818. for (var instance of instances) {
  1819. var oldComp = normalizeClassComponent(instance.type);
  1820. if (!hmrDirtyComponents.has(oldComp)) {
  1821. // 1. Update existing comp definition to match new one
  1822. if (oldComp !== record.initialDef) {
  1823. updateComponentDef(oldComp, newComp);
  1824. }
  1825. // 2. mark definition dirty. This forces the renderer to replace the
  1826. // component on patch.
  1827. hmrDirtyComponents.add(oldComp);
  1828. }
  1829. // 3. invalidate options resolution cache
  1830. instance.appContext.optionsCache.delete(instance.type);
  1831. // 4. actually update
  1832. if (instance.ceReload) {
  1833. // custom element
  1834. hmrDirtyComponents.add(oldComp);
  1835. instance.ceReload(newComp.styles);
  1836. hmrDirtyComponents.delete(oldComp);
  1837. } else if (instance.parent) {
  1838. // 4. Force the parent instance to re-render. This will cause all updated
  1839. // components to be unmounted and re-mounted. Queue the update so that we
  1840. // don't end up forcing the same parent to re-render multiple times.
  1841. queueJob(instance.parent.update);
  1842. } else if (instance.appContext.reload) {
  1843. // root instance mounted via createApp() has a reload method
  1844. instance.appContext.reload();
  1845. } else if (typeof window !== 'undefined') {
  1846. // root instance inside tree created via raw render(). Force reload.
  1847. window.location.reload();
  1848. } else {
  1849. console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
  1850. }
  1851. }
  1852. // 5. make sure to cleanup dirty hmr components after update
  1853. queuePostFlushCb(() => {
  1854. for (var _instance of instances) {
  1855. hmrDirtyComponents.delete(normalizeClassComponent(_instance.type));
  1856. }
  1857. });
  1858. }
  1859. function updateComponentDef(oldComp, newComp) {
  1860. extend$1(oldComp, newComp);
  1861. for (var key in oldComp) {
  1862. if (key !== '__file' && !(key in newComp)) {
  1863. delete oldComp[key];
  1864. }
  1865. }
  1866. }
  1867. function tryWrap(fn) {
  1868. return (id, arg) => {
  1869. try {
  1870. return fn(id, arg);
  1871. } catch (e) {
  1872. console.error(e);
  1873. console.warn("[HMR] Something went wrong during Vue component hot-reload. " + "Full reload required.");
  1874. }
  1875. };
  1876. }
  1877. var devtools;
  1878. var buffer = [];
  1879. var devtoolsNotInstalled = false;
  1880. function emit$1(event) {
  1881. for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {
  1882. args[_key6 - 1] = arguments[_key6];
  1883. }
  1884. if (devtools) {
  1885. devtools.emit(event, ...args);
  1886. } else if (!devtoolsNotInstalled) {
  1887. buffer.push({
  1888. event,
  1889. args
  1890. });
  1891. }
  1892. }
  1893. function setDevtoolsHook(hook, target) {
  1894. var _a, _b;
  1895. devtools = hook;
  1896. if (devtools) {
  1897. devtools.enabled = true;
  1898. buffer.forEach(_ref5 => {
  1899. var {
  1900. event,
  1901. args
  1902. } = _ref5;
  1903. return devtools.emit(event, ...args);
  1904. });
  1905. buffer = [];
  1906. } else if (
  1907. // handle late devtools injection - only do this if we are in an actual
  1908. // browser environment to avoid the timer handle stalling test runner exit
  1909. // (#4815)
  1910. typeof window !== 'undefined' &&
  1911. // some envs mock window but not fully
  1912. window.HTMLElement &&
  1913. // also exclude jsdom
  1914. !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
  1915. var replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1916. replay.push(newHook => {
  1917. setDevtoolsHook(newHook, target);
  1918. });
  1919. // clear buffer after 3s - the user probably doesn't have devtools installed
  1920. // at all, and keeping the buffer will cause memory leaks (#4738)
  1921. setTimeout(() => {
  1922. if (!devtools) {
  1923. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1924. devtoolsNotInstalled = true;
  1925. buffer = [];
  1926. }
  1927. }, 3000);
  1928. } else {
  1929. // non-browser env, assume not installed
  1930. devtoolsNotInstalled = true;
  1931. buffer = [];
  1932. }
  1933. }
  1934. function devtoolsInitApp(app, version) {
  1935. emit$1("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
  1936. Fragment,
  1937. Text,
  1938. Comment,
  1939. Static
  1940. });
  1941. }
  1942. function devtoolsUnmountApp(app) {
  1943. emit$1("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
  1944. }
  1945. var devtoolsComponentAdded = /*#__PURE__*/createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
  1946. var devtoolsComponentUpdated = /*#__PURE__*/createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
  1947. var _devtoolsComponentRemoved = /*#__PURE__*/createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
  1948. var devtoolsComponentRemoved = component => {
  1949. if (devtools && typeof devtools.cleanupBuffer === 'function' &&
  1950. // remove the component if it wasn't buffered
  1951. !devtools.cleanupBuffer(component)) {
  1952. _devtoolsComponentRemoved(component);
  1953. }
  1954. };
  1955. function createDevtoolsComponentHook(hook) {
  1956. return component => {
  1957. emit$1(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
  1958. };
  1959. }
  1960. var devtoolsPerfStart = /*#__PURE__*/createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
  1961. var devtoolsPerfEnd = /*#__PURE__*/createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
  1962. function createDevtoolsPerformanceHook(hook) {
  1963. return (component, type, time) => {
  1964. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  1965. };
  1966. }
  1967. function devtoolsComponentEmit(component, event, params) {
  1968. emit$1("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
  1969. }
  1970. function emit(instance, event) {
  1971. if (instance.isUnmounted) return;
  1972. var props = instance.vnode.props || EMPTY_OBJ;
  1973. for (var _len6 = arguments.length, rawArgs = new Array(_len6 > 2 ? _len6 - 2 : 0), _key7 = 2; _key7 < _len6; _key7++) {
  1974. rawArgs[_key7 - 2] = arguments[_key7];
  1975. }
  1976. {
  1977. var {
  1978. emitsOptions,
  1979. propsOptions: [propsOptions]
  1980. } = instance;
  1981. if (emitsOptions) {
  1982. if (!(event in emitsOptions) && !false) {
  1983. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  1984. warn("Component emitted event \"".concat(event, "\" but it is neither declared in ") + "the emits option nor as an \"".concat(toHandlerKey(event), "\" prop."));
  1985. }
  1986. } else {
  1987. var validator = emitsOptions[event];
  1988. if (isFunction(validator)) {
  1989. var isValid = validator(...rawArgs);
  1990. if (!isValid) {
  1991. warn("Invalid event arguments: event validation failed for event \"".concat(event, "\"."));
  1992. }
  1993. }
  1994. }
  1995. }
  1996. }
  1997. var args = rawArgs;
  1998. var isModelListener = event.startsWith('update:');
  1999. // for v-model update:xxx events, apply modifiers on args
  2000. var modelArg = isModelListener && event.slice(7);
  2001. if (modelArg && modelArg in props) {
  2002. var modifiersKey = "".concat(modelArg === 'modelValue' ? 'model' : modelArg, "Modifiers");
  2003. var {
  2004. number,
  2005. trim
  2006. } = props[modifiersKey] || EMPTY_OBJ;
  2007. if (trim) {
  2008. args = rawArgs.map(a => isString(a) ? a.trim() : a);
  2009. }
  2010. if (number) {
  2011. args = rawArgs.map(looseToNumber);
  2012. }
  2013. }
  2014. {
  2015. devtoolsComponentEmit(instance, event, args);
  2016. }
  2017. {
  2018. var lowerCaseEvent = event.toLowerCase();
  2019. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2020. warn("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") + "".concat(formatComponentName(instance, instance.type), " but the handler is registered for \"").concat(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 \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
  2021. }
  2022. }
  2023. var handlerName;
  2024. var handler = props[handlerName = toHandlerKey(event)] ||
  2025. // also try camelCase event handler (#2249)
  2026. props[handlerName = toHandlerKey(camelize(event))];
  2027. // for v-model update:xxx events, also trigger kebab-case equivalent
  2028. // for props passed via kebab-case
  2029. if (!handler && isModelListener) {
  2030. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2031. }
  2032. if (handler) {
  2033. callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
  2034. }
  2035. var onceHandler = props[handlerName + "Once"];
  2036. if (onceHandler) {
  2037. if (!instance.emitted) {
  2038. instance.emitted = {};
  2039. } else if (instance.emitted[handlerName]) {
  2040. return;
  2041. }
  2042. instance.emitted[handlerName] = true;
  2043. callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
  2044. }
  2045. }
  2046. function normalizeEmitsOptions(comp, appContext) {
  2047. var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2048. var cache = appContext.emitsCache;
  2049. var cached = cache.get(comp);
  2050. if (cached !== undefined) {
  2051. return cached;
  2052. }
  2053. var raw = comp.emits;
  2054. var normalized = {};
  2055. // apply mixin/extends props
  2056. var hasExtends = false;
  2057. if (!isFunction(comp)) {
  2058. var extendEmits = raw => {
  2059. var normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
  2060. if (normalizedFromExtend) {
  2061. hasExtends = true;
  2062. extend$1(normalized, normalizedFromExtend);
  2063. }
  2064. };
  2065. if (!asMixin && appContext.mixins.length) {
  2066. appContext.mixins.forEach(extendEmits);
  2067. }
  2068. if (comp.extends) {
  2069. extendEmits(comp.extends);
  2070. }
  2071. if (comp.mixins) {
  2072. comp.mixins.forEach(extendEmits);
  2073. }
  2074. }
  2075. if (!raw && !hasExtends) {
  2076. if (isObject(comp)) {
  2077. cache.set(comp, null);
  2078. }
  2079. return null;
  2080. }
  2081. if (isArray(raw)) {
  2082. raw.forEach(key => normalized[key] = null);
  2083. } else {
  2084. extend$1(normalized, raw);
  2085. }
  2086. if (isObject(comp)) {
  2087. cache.set(comp, normalized);
  2088. }
  2089. return normalized;
  2090. }
  2091. // Check if an incoming prop key is a declared emit event listener.
  2092. // e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
  2093. // both considered matched listeners.
  2094. function isEmitListener(options, key) {
  2095. if (!options || !isOn(key)) {
  2096. return false;
  2097. }
  2098. key = key.slice(2).replace(/Once$/, '');
  2099. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2100. }
  2101. /**
  2102. * mark the current rendering instance for asset resolution (e.g.
  2103. * resolveComponent, resolveDirective) during render
  2104. */
  2105. var currentRenderingInstance = null;
  2106. var currentScopeId = null;
  2107. /**
  2108. * Note: rendering calls maybe nested. The function returns the parent rendering
  2109. * instance if present, which should be restored after the render is done:
  2110. *
  2111. * ```js
  2112. * const prev = setCurrentRenderingInstance(i)
  2113. * // ...render
  2114. * setCurrentRenderingInstance(prev)
  2115. * ```
  2116. */
  2117. function setCurrentRenderingInstance(instance) {
  2118. var prev = currentRenderingInstance;
  2119. currentRenderingInstance = instance;
  2120. currentScopeId = instance && instance.type.__scopeId || null;
  2121. return prev;
  2122. }
  2123. /**
  2124. * Set scope id when creating hoisted vnodes.
  2125. * @private compiler helper
  2126. */
  2127. function pushScopeId(id) {
  2128. currentScopeId = id;
  2129. }
  2130. /**
  2131. * Technically we no longer need this after 3.0.8 but we need to keep the same
  2132. * API for backwards compat w/ code generated by compilers.
  2133. * @private
  2134. */
  2135. function popScopeId() {
  2136. currentScopeId = null;
  2137. }
  2138. /**
  2139. * Only for backwards compat
  2140. * @private
  2141. */
  2142. var withScopeId = _id => withCtx;
  2143. /**
  2144. * Wrap a slot function to memoize current rendering instance
  2145. * @private compiler helper
  2146. */
  2147. function withCtx(fn) {
  2148. var ctx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentRenderingInstance;
  2149. var isNonScopedSlot // false only
  2150. = arguments.length > 2 ? arguments[2] : undefined;
  2151. if (!ctx) return fn;
  2152. // already normalized
  2153. if (fn._n) {
  2154. return fn;
  2155. }
  2156. var renderFnWithContext = function () {
  2157. // If a user calls a compiled slot inside a template expression (#1745), it
  2158. // can mess up block tracking, so by default we disable block tracking and
  2159. // force bail out when invoking a compiled slot (indicated by the ._d flag).
  2160. // This isn't necessary if rendering a compiled `<slot>`, so we flip the
  2161. // ._d flag off when invoking the wrapped fn inside `renderSlot`.
  2162. if (renderFnWithContext._d) {
  2163. setBlockTracking(-1);
  2164. }
  2165. var prevInstance = setCurrentRenderingInstance(ctx);
  2166. var res;
  2167. try {
  2168. res = fn(...arguments);
  2169. } finally {
  2170. setCurrentRenderingInstance(prevInstance);
  2171. if (renderFnWithContext._d) {
  2172. setBlockTracking(1);
  2173. }
  2174. }
  2175. {
  2176. devtoolsComponentUpdated(ctx);
  2177. }
  2178. return res;
  2179. };
  2180. // mark normalized to avoid duplicated wrapping
  2181. renderFnWithContext._n = true;
  2182. // mark this as compiled by default
  2183. // this is used in vnode.ts -> normalizeChildren() to set the slot
  2184. // rendering flag.
  2185. renderFnWithContext._c = true;
  2186. // disable block tracking by default
  2187. renderFnWithContext._d = true;
  2188. return renderFnWithContext;
  2189. }
  2190. /**
  2191. * dev only flag to track whether $attrs was used during render.
  2192. * If $attrs was used during render then the warning for failed attrs
  2193. * fallthrough can be suppressed.
  2194. */
  2195. var accessedAttrs = false;
  2196. function markAttrsAccessed() {
  2197. accessedAttrs = true;
  2198. }
  2199. function renderComponentRoot(instance) {
  2200. var {
  2201. type: Component,
  2202. vnode,
  2203. proxy,
  2204. withProxy,
  2205. props,
  2206. propsOptions: [propsOptions],
  2207. slots,
  2208. attrs,
  2209. emit,
  2210. render,
  2211. renderCache,
  2212. data,
  2213. setupState,
  2214. ctx,
  2215. inheritAttrs
  2216. } = instance;
  2217. var result;
  2218. var fallthroughAttrs;
  2219. var prev = setCurrentRenderingInstance(instance);
  2220. {
  2221. accessedAttrs = false;
  2222. }
  2223. try {
  2224. if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
  2225. // withProxy is a proxy with a different `has` trap only for
  2226. // runtime-compiled render functions using `with` block.
  2227. var proxyToUse = withProxy || proxy;
  2228. result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
  2229. fallthroughAttrs = attrs;
  2230. } else {
  2231. // functional
  2232. var _render = Component;
  2233. // in dev, mark attrs accessed if optional props (attrs === props)
  2234. if ("development" !== 'production' && attrs === props) {
  2235. markAttrsAccessed();
  2236. }
  2237. result = normalizeVNode(_render.length > 1 ? _render(props, "development" !== 'production' ? {
  2238. get attrs() {
  2239. markAttrsAccessed();
  2240. return attrs;
  2241. },
  2242. slots,
  2243. emit
  2244. } : {
  2245. attrs,
  2246. slots,
  2247. emit
  2248. }) : _render(props, null /* we know it doesn't need it */));
  2249. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2250. }
  2251. } catch (err) {
  2252. blockStack.length = 0;
  2253. handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
  2254. result = createVNode(Comment);
  2255. }
  2256. // attr merging
  2257. // in dev mode, comments are preserved, and it's possible for a template
  2258. // to have comments along side the root element which makes it a fragment
  2259. var root = result;
  2260. var setRoot = undefined;
  2261. if (result.patchFlag > 0 && result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
  2262. [root, setRoot] = getChildRoot(result);
  2263. }
  2264. if (fallthroughAttrs && inheritAttrs !== false) {
  2265. var keys = Object.keys(fallthroughAttrs);
  2266. var {
  2267. shapeFlag
  2268. } = root;
  2269. if (keys.length) {
  2270. if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
  2271. if (propsOptions && keys.some(isModelListener)) {
  2272. // If a v-model listener (onUpdate:xxx) has a corresponding declared
  2273. // prop, it indicates this component expects to handle v-model and
  2274. // it should not fallthrough.
  2275. // related: #1543, #1643, #1989
  2276. fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
  2277. }
  2278. root = cloneVNode(root, fallthroughAttrs);
  2279. } else if (!accessedAttrs && root.type !== Comment) {
  2280. var allAttrs = Object.keys(attrs);
  2281. var eventAttrs = [];
  2282. var extraAttrs = [];
  2283. for (var i = 0, l = allAttrs.length; i < l; i++) {
  2284. var key = allAttrs[i];
  2285. if (isOn(key)) {
  2286. // ignore v-model handlers when they fail to fallthrough
  2287. if (!isModelListener(key)) {
  2288. // remove `on`, lowercase first letter to reflect event casing
  2289. // accurately
  2290. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2291. }
  2292. } else {
  2293. extraAttrs.push(key);
  2294. }
  2295. }
  2296. if (extraAttrs.length) {
  2297. warn("Extraneous non-props attributes (" + "".concat(extraAttrs.join(', '), ") ") + "were passed to component but could not be automatically inherited " + "because component renders fragment or text root nodes.");
  2298. }
  2299. if (eventAttrs.length) {
  2300. warn("Extraneous non-emits event listeners (" + "".concat(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.");
  2301. }
  2302. }
  2303. }
  2304. }
  2305. // inherit directives
  2306. if (vnode.dirs) {
  2307. if (!isElementRoot(root)) {
  2308. warn("Runtime directive used on component with non-element root node. " + "The directives will not function as intended.");
  2309. }
  2310. // clone before mutating since the root may be a hoisted vnode
  2311. root = cloneVNode(root);
  2312. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2313. }
  2314. // inherit transition data
  2315. if (vnode.transition) {
  2316. if (!isElementRoot(root)) {
  2317. warn("Component inside <Transition> renders non-element root node " + "that cannot be animated.");
  2318. }
  2319. root.transition = vnode.transition;
  2320. }
  2321. if (setRoot) {
  2322. setRoot(root);
  2323. } else {
  2324. result = root;
  2325. }
  2326. setCurrentRenderingInstance(prev);
  2327. return result;
  2328. }
  2329. /**
  2330. * dev only
  2331. * In dev mode, template root level comments are rendered, which turns the
  2332. * template into a fragment root, but we need to locate the single element
  2333. * root for attrs and scope id processing.
  2334. */
  2335. var getChildRoot = vnode => {
  2336. var rawChildren = vnode.children;
  2337. var dynamicChildren = vnode.dynamicChildren;
  2338. var childRoot = filterSingleRoot(rawChildren);
  2339. if (!childRoot) {
  2340. return [vnode, undefined];
  2341. }
  2342. var index = rawChildren.indexOf(childRoot);
  2343. var dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2344. var setRoot = updatedRoot => {
  2345. rawChildren[index] = updatedRoot;
  2346. if (dynamicChildren) {
  2347. if (dynamicIndex > -1) {
  2348. dynamicChildren[dynamicIndex] = updatedRoot;
  2349. } else if (updatedRoot.patchFlag > 0) {
  2350. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2351. }
  2352. }
  2353. };
  2354. return [normalizeVNode(childRoot), setRoot];
  2355. };
  2356. function filterSingleRoot(children) {
  2357. var singleRoot;
  2358. for (var i = 0; i < children.length; i++) {
  2359. var child = children[i];
  2360. if (isVNode(child)) {
  2361. // ignore user comment
  2362. if (child.type !== Comment || child.children === 'v-if') {
  2363. if (singleRoot) {
  2364. // has more than 1 non-comment child, return now
  2365. return;
  2366. } else {
  2367. singleRoot = child;
  2368. }
  2369. }
  2370. } else {
  2371. return;
  2372. }
  2373. }
  2374. return singleRoot;
  2375. }
  2376. var getFunctionalFallthrough = attrs => {
  2377. var res;
  2378. for (var key in attrs) {
  2379. if (key === 'class' || key === 'style' || isOn(key)) {
  2380. (res || (res = {}))[key] = attrs[key];
  2381. }
  2382. }
  2383. return res;
  2384. };
  2385. var filterModelListeners = (attrs, props) => {
  2386. var res = {};
  2387. for (var key in attrs) {
  2388. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2389. res[key] = attrs[key];
  2390. }
  2391. }
  2392. return res;
  2393. };
  2394. var isElementRoot = vnode => {
  2395. return vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) || vnode.type === Comment // potential v-if branch switch
  2396. ;
  2397. };
  2398. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2399. var {
  2400. props: prevProps,
  2401. children: prevChildren,
  2402. component
  2403. } = prevVNode;
  2404. var {
  2405. props: nextProps,
  2406. children: nextChildren,
  2407. patchFlag
  2408. } = nextVNode;
  2409. var emits = component.emitsOptions;
  2410. // Parent component's render function was hot-updated. Since this may have
  2411. // caused the child component's slots content to have changed, we need to
  2412. // force the child to update as well.
  2413. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2414. return true;
  2415. }
  2416. // force child update for runtime directive or transition on component vnode.
  2417. if (nextVNode.dirs || nextVNode.transition) {
  2418. return true;
  2419. }
  2420. if (optimized && patchFlag >= 0) {
  2421. if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
  2422. // slot content that references values that might have changed,
  2423. // e.g. in a v-for
  2424. return true;
  2425. }
  2426. if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
  2427. if (!prevProps) {
  2428. return !!nextProps;
  2429. }
  2430. // presence of this flag indicates props are always non-null
  2431. return hasPropsChanged(prevProps, nextProps, emits);
  2432. } else if (patchFlag & 8 /* PatchFlags.PROPS */) {
  2433. var dynamicProps = nextVNode.dynamicProps;
  2434. for (var i = 0; i < dynamicProps.length; i++) {
  2435. var key = dynamicProps[i];
  2436. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2437. return true;
  2438. }
  2439. }
  2440. }
  2441. } else {
  2442. // this path is only taken by manually written render functions
  2443. // so presence of any children leads to a forced update
  2444. if (prevChildren || nextChildren) {
  2445. if (!nextChildren || !nextChildren.$stable) {
  2446. return true;
  2447. }
  2448. }
  2449. if (prevProps === nextProps) {
  2450. return false;
  2451. }
  2452. if (!prevProps) {
  2453. return !!nextProps;
  2454. }
  2455. if (!nextProps) {
  2456. return true;
  2457. }
  2458. return hasPropsChanged(prevProps, nextProps, emits);
  2459. }
  2460. return false;
  2461. }
  2462. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2463. var nextKeys = Object.keys(nextProps);
  2464. if (nextKeys.length !== Object.keys(prevProps).length) {
  2465. return true;
  2466. }
  2467. for (var i = 0; i < nextKeys.length; i++) {
  2468. var key = nextKeys[i];
  2469. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2470. return true;
  2471. }
  2472. }
  2473. return false;
  2474. }
  2475. function updateHOCHostEl(_ref6, el // HostNode
  2476. ) {
  2477. var {
  2478. vnode,
  2479. parent
  2480. } = _ref6;
  2481. while (parent && parent.subTree === vnode) {
  2482. (vnode = parent.vnode).el = el;
  2483. parent = parent.parent;
  2484. }
  2485. }
  2486. var isSuspense = type => type.__isSuspense;
  2487. // Suspense exposes a component-like API, and is treated like a component
  2488. // in the compiler, but internally it's a special built-in type that hooks
  2489. // directly into the renderer.
  2490. var SuspenseImpl = {
  2491. name: 'Suspense',
  2492. // In order to make Suspense tree-shakable, we need to avoid importing it
  2493. // directly in the renderer. The renderer checks for the __isSuspense flag
  2494. // on a vnode's type and calls the `process` method, passing in renderer
  2495. // internals.
  2496. __isSuspense: true,
  2497. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized,
  2498. // platform-specific impl passed from renderer
  2499. rendererInternals) {
  2500. if (n1 == null) {
  2501. mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals);
  2502. } else {
  2503. patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, rendererInternals);
  2504. }
  2505. },
  2506. hydrate: hydrateSuspense,
  2507. create: createSuspenseBoundary,
  2508. normalize: normalizeSuspenseChildren
  2509. };
  2510. // Force-casted public typing for h and TSX props inference
  2511. var Suspense = SuspenseImpl;
  2512. function triggerEvent(vnode, name) {
  2513. var eventListener = vnode.props && vnode.props[name];
  2514. if (isFunction(eventListener)) {
  2515. eventListener();
  2516. }
  2517. }
  2518. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2519. var {
  2520. p: patch,
  2521. o: {
  2522. createElement
  2523. }
  2524. } = rendererInternals;
  2525. // @ts-expect-error fixed by xxxxxx
  2526. var hiddenContainer = createElement('div');
  2527. var suspense = vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals);
  2528. // start mounting the content subtree in an off-dom container
  2529. patch(null, suspense.pendingBranch = vnode.ssContent, hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds);
  2530. // now check if we have encountered any async deps
  2531. if (suspense.deps > 0) {
  2532. // has async
  2533. // invoke @fallback event
  2534. triggerEvent(vnode, 'onPending');
  2535. triggerEvent(vnode, 'onFallback');
  2536. // mount the fallback tree
  2537. patch(null, vnode.ssFallback, container, anchor, parentComponent, null,
  2538. // fallback tree will not have suspense context
  2539. isSVG, slotScopeIds);
  2540. setActiveBranch(suspense, vnode.ssFallback);
  2541. } else {
  2542. // Suspense has no async deps. Just resolve.
  2543. suspense.resolve();
  2544. }
  2545. }
  2546. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, _ref7) {
  2547. var {
  2548. p: patch,
  2549. um: unmount,
  2550. o: {
  2551. createElement
  2552. }
  2553. } = _ref7;
  2554. var suspense = n2.suspense = n1.suspense;
  2555. suspense.vnode = n2;
  2556. n2.el = n1.el;
  2557. var newBranch = n2.ssContent;
  2558. var newFallback = n2.ssFallback;
  2559. var {
  2560. activeBranch,
  2561. pendingBranch,
  2562. isInFallback,
  2563. isHydrating
  2564. } = suspense;
  2565. if (pendingBranch) {
  2566. suspense.pendingBranch = newBranch;
  2567. if (isSameVNodeType(newBranch, pendingBranch)) {
  2568. // same root type but content may have changed.
  2569. patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2570. if (suspense.deps <= 0) {
  2571. suspense.resolve();
  2572. } else if (isInFallback) {
  2573. patch(activeBranch, newFallback, container, anchor, parentComponent, null,
  2574. // fallback tree will not have suspense context
  2575. isSVG, slotScopeIds, optimized);
  2576. setActiveBranch(suspense, newFallback);
  2577. }
  2578. } else {
  2579. // toggled before pending tree is resolved
  2580. suspense.pendingId++;
  2581. if (isHydrating) {
  2582. // if toggled before hydration is finished, the current DOM tree is
  2583. // no longer valid. set it as the active branch so it will be unmounted
  2584. // when resolved
  2585. suspense.isHydrating = false;
  2586. suspense.activeBranch = pendingBranch;
  2587. } else {
  2588. unmount(pendingBranch, parentComponent, suspense);
  2589. }
  2590. // increment pending ID. this is used to invalidate async callbacks
  2591. // reset suspense state
  2592. suspense.deps = 0;
  2593. // discard effects from pending branch
  2594. suspense.effects.length = 0;
  2595. // discard previous container
  2596. // @ts-expect-error fixed by xxxxxx
  2597. suspense.hiddenContainer = createElement('div');
  2598. if (isInFallback) {
  2599. // already in fallback state
  2600. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2601. if (suspense.deps <= 0) {
  2602. suspense.resolve();
  2603. } else {
  2604. patch(activeBranch, newFallback, container, anchor, parentComponent, null,
  2605. // fallback tree will not have suspense context
  2606. isSVG, slotScopeIds, optimized);
  2607. setActiveBranch(suspense, newFallback);
  2608. }
  2609. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2610. // toggled "back" to current active branch
  2611. patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2612. // force resolve
  2613. suspense.resolve(true);
  2614. } else {
  2615. // switched to a 3rd branch
  2616. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2617. if (suspense.deps <= 0) {
  2618. suspense.resolve();
  2619. }
  2620. }
  2621. }
  2622. } else {
  2623. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2624. // root did not change, just normal patch
  2625. patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2626. setActiveBranch(suspense, newBranch);
  2627. } else {
  2628. // root node toggled
  2629. // invoke @pending event
  2630. triggerEvent(n2, 'onPending');
  2631. // mount pending branch in off-dom container
  2632. suspense.pendingBranch = newBranch;
  2633. suspense.pendingId++;
  2634. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2635. if (suspense.deps <= 0) {
  2636. // incoming branch has no async deps, resolve now.
  2637. suspense.resolve();
  2638. } else {
  2639. var {
  2640. timeout,
  2641. pendingId
  2642. } = suspense;
  2643. if (timeout > 0) {
  2644. setTimeout(() => {
  2645. if (suspense.pendingId === pendingId) {
  2646. suspense.fallback(newFallback);
  2647. }
  2648. }, timeout);
  2649. } else if (timeout === 0) {
  2650. suspense.fallback(newFallback);
  2651. }
  2652. }
  2653. }
  2654. }
  2655. }
  2656. var hasWarned = false;
  2657. function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals) {
  2658. var isHydrating = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
  2659. /* istanbul ignore if */
  2660. if (!hasWarned) {
  2661. hasWarned = true;
  2662. // @ts-ignore `console.info` cannot be null error
  2663. console[console.info ? 'info' : 'log']("<Suspense> is an experimental feature and its API will likely change.");
  2664. }
  2665. var {
  2666. p: patch,
  2667. m: move,
  2668. um: unmount,
  2669. n: next,
  2670. o: {
  2671. parentNode,
  2672. remove
  2673. }
  2674. } = rendererInternals;
  2675. var timeout = vnode.props ? toNumber(vnode.props.timeout) : undefined;
  2676. {
  2677. assertNumber(timeout, "Suspense timeout");
  2678. }
  2679. var suspense = {
  2680. vnode,
  2681. parent,
  2682. parentComponent,
  2683. isSVG,
  2684. container,
  2685. hiddenContainer,
  2686. anchor,
  2687. deps: 0,
  2688. pendingId: 0,
  2689. timeout: typeof timeout === 'number' ? timeout : -1,
  2690. activeBranch: null,
  2691. pendingBranch: null,
  2692. isInFallback: true,
  2693. isHydrating,
  2694. isUnmounted: false,
  2695. effects: [],
  2696. resolve() {
  2697. var resume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2698. {
  2699. if (!resume && !suspense.pendingBranch) {
  2700. throw new Error("suspense.resolve() is called without a pending branch.");
  2701. }
  2702. if (suspense.isUnmounted) {
  2703. throw new Error("suspense.resolve() is called on an already unmounted suspense boundary.");
  2704. }
  2705. }
  2706. var {
  2707. vnode,
  2708. activeBranch,
  2709. pendingBranch,
  2710. pendingId,
  2711. effects,
  2712. parentComponent,
  2713. container
  2714. } = suspense;
  2715. if (suspense.isHydrating) {
  2716. suspense.isHydrating = false;
  2717. } else if (!resume) {
  2718. var delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === 'out-in';
  2719. if (delayEnter) {
  2720. activeBranch.transition.afterLeave = () => {
  2721. if (pendingId === suspense.pendingId) {
  2722. move(pendingBranch, container, _anchor, 0 /* MoveType.ENTER */);
  2723. }
  2724. };
  2725. }
  2726. // this is initial anchor on mount
  2727. var {
  2728. anchor: _anchor
  2729. } = suspense;
  2730. // unmount current active tree
  2731. if (activeBranch) {
  2732. // if the fallback tree was mounted, it may have been moved
  2733. // as part of a parent suspense. get the latest anchor for insertion
  2734. _anchor = next(activeBranch);
  2735. unmount(activeBranch, parentComponent, suspense, true);
  2736. }
  2737. if (!delayEnter) {
  2738. // move content from off-dom container to actual container
  2739. move(pendingBranch, container, _anchor, 0 /* MoveType.ENTER */);
  2740. }
  2741. }
  2742. setActiveBranch(suspense, pendingBranch);
  2743. suspense.pendingBranch = null;
  2744. suspense.isInFallback = false;
  2745. // flush buffered effects
  2746. // check if there is a pending parent suspense
  2747. var parent = suspense.parent;
  2748. var hasUnresolvedAncestor = false;
  2749. while (parent) {
  2750. if (parent.pendingBranch) {
  2751. // found a pending parent suspense, merge buffered post jobs
  2752. // into that parent
  2753. parent.effects.push(...effects);
  2754. hasUnresolvedAncestor = true;
  2755. break;
  2756. }
  2757. parent = parent.parent;
  2758. }
  2759. // no pending parent suspense, flush all jobs
  2760. if (!hasUnresolvedAncestor) {
  2761. queuePostFlushCb(effects);
  2762. }
  2763. suspense.effects = [];
  2764. // invoke @resolve event
  2765. triggerEvent(vnode, 'onResolve');
  2766. },
  2767. fallback(fallbackVNode) {
  2768. if (!suspense.pendingBranch) {
  2769. return;
  2770. }
  2771. var {
  2772. vnode,
  2773. activeBranch,
  2774. parentComponent,
  2775. container,
  2776. isSVG
  2777. } = suspense;
  2778. // invoke @fallback event
  2779. triggerEvent(vnode, 'onFallback');
  2780. var anchor = next(activeBranch);
  2781. var mountFallback = () => {
  2782. if (!suspense.isInFallback) {
  2783. return;
  2784. }
  2785. // mount the fallback tree
  2786. patch(null, fallbackVNode, container, anchor, parentComponent, null,
  2787. // fallback tree will not have suspense context
  2788. isSVG, slotScopeIds, optimized);
  2789. setActiveBranch(suspense, fallbackVNode);
  2790. };
  2791. var delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
  2792. if (delayEnter) {
  2793. activeBranch.transition.afterLeave = mountFallback;
  2794. }
  2795. suspense.isInFallback = true;
  2796. // unmount current active branch
  2797. unmount(activeBranch, parentComponent, null,
  2798. // no suspense so unmount hooks fire now
  2799. true // shouldRemove
  2800. );
  2801. if (!delayEnter) {
  2802. mountFallback();
  2803. }
  2804. },
  2805. move(container, anchor, type) {
  2806. suspense.activeBranch && move(suspense.activeBranch, container, anchor, type);
  2807. suspense.container = container;
  2808. },
  2809. next() {
  2810. return suspense.activeBranch && next(suspense.activeBranch);
  2811. },
  2812. registerDep(instance, setupRenderEffect) {
  2813. var isInPendingSuspense = !!suspense.pendingBranch;
  2814. if (isInPendingSuspense) {
  2815. suspense.deps++;
  2816. }
  2817. var hydratedEl = instance.vnode.el;
  2818. instance.asyncDep.catch(err => {
  2819. handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
  2820. }).then(asyncSetupResult => {
  2821. // retry when the setup() promise resolves.
  2822. // component may have been unmounted before resolve.
  2823. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2824. return;
  2825. }
  2826. // retry from this component
  2827. instance.asyncResolved = true;
  2828. var {
  2829. vnode
  2830. } = instance;
  2831. {
  2832. pushWarningContext(vnode);
  2833. }
  2834. handleSetupResult(instance, asyncSetupResult, false);
  2835. if (hydratedEl) {
  2836. // vnode may have been replaced if an update happened before the
  2837. // async dep is resolved.
  2838. vnode.el = hydratedEl;
  2839. }
  2840. var placeholder = !hydratedEl && instance.subTree.el;
  2841. setupRenderEffect(instance, vnode,
  2842. // component may have been moved before resolve.
  2843. // if this is not a hydration, instance.subTree will be the comment
  2844. // placeholder.
  2845. parentNode(hydratedEl || instance.subTree.el),
  2846. // anchor will not be used if this is hydration, so only need to
  2847. // consider the comment placeholder case.
  2848. hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);
  2849. if (placeholder) {
  2850. remove(placeholder);
  2851. }
  2852. updateHOCHostEl(instance, vnode.el);
  2853. {
  2854. popWarningContext();
  2855. }
  2856. // only decrease deps count if suspense is not already resolved
  2857. if (isInPendingSuspense && --suspense.deps === 0) {
  2858. suspense.resolve();
  2859. }
  2860. });
  2861. },
  2862. unmount(parentSuspense, doRemove) {
  2863. suspense.isUnmounted = true;
  2864. if (suspense.activeBranch) {
  2865. unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
  2866. }
  2867. if (suspense.pendingBranch) {
  2868. unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
  2869. }
  2870. }
  2871. };
  2872. return suspense;
  2873. }
  2874. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  2875. /* eslint-disable no-restricted-globals */
  2876. var suspense = vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, slotScopeIds, optimized, rendererInternals, true /* hydrating */);
  2877. // there are two possible scenarios for server-rendered suspense:
  2878. // - success: ssr content should be fully resolved
  2879. // - failure: ssr content should be the fallback branch.
  2880. // however, on the client we don't really know if it has failed or not
  2881. // attempt to hydrate the DOM assuming it has succeeded, but we still
  2882. // need to construct a suspense boundary first
  2883. var result = hydrateNode(node, suspense.pendingBranch = vnode.ssContent, parentComponent, suspense, slotScopeIds, optimized);
  2884. if (suspense.deps === 0) {
  2885. suspense.resolve();
  2886. }
  2887. return result;
  2888. /* eslint-enable no-restricted-globals */
  2889. }
  2890. function normalizeSuspenseChildren(vnode) {
  2891. var {
  2892. shapeFlag,
  2893. children
  2894. } = vnode;
  2895. var isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
  2896. vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
  2897. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  2898. }
  2899. function normalizeSuspenseSlot(s) {
  2900. var block;
  2901. if (isFunction(s)) {
  2902. var trackBlock = isBlockTreeEnabled && s._c;
  2903. if (trackBlock) {
  2904. // disableTracking: false
  2905. // allow block tracking for compiled slots
  2906. // (see ./componentRenderContext.ts)
  2907. s._d = false;
  2908. openBlock();
  2909. }
  2910. s = s();
  2911. if (trackBlock) {
  2912. s._d = true;
  2913. block = currentBlock;
  2914. closeBlock();
  2915. }
  2916. }
  2917. if (isArray(s)) {
  2918. var singleChild = filterSingleRoot(s);
  2919. if (!singleChild) {
  2920. warn("<Suspense> slots expect a single root node.");
  2921. }
  2922. s = singleChild;
  2923. }
  2924. s = normalizeVNode(s);
  2925. if (block && !s.dynamicChildren) {
  2926. s.dynamicChildren = block.filter(c => c !== s);
  2927. }
  2928. return s;
  2929. }
  2930. function queueEffectWithSuspense(fn, suspense) {
  2931. if (suspense && suspense.pendingBranch) {
  2932. if (isArray(fn)) {
  2933. suspense.effects.push(...fn);
  2934. } else {
  2935. suspense.effects.push(fn);
  2936. }
  2937. } else {
  2938. queuePostFlushCb(fn);
  2939. }
  2940. }
  2941. function setActiveBranch(suspense, branch) {
  2942. suspense.activeBranch = branch;
  2943. var {
  2944. vnode,
  2945. parentComponent
  2946. } = suspense;
  2947. var el = vnode.el = branch.el;
  2948. // in case suspense is the root node of a component,
  2949. // recursively update the HOC el
  2950. if (parentComponent && parentComponent.subTree === vnode) {
  2951. parentComponent.vnode.el = el;
  2952. updateHOCHostEl(parentComponent, el);
  2953. }
  2954. }
  2955. function provide(key, value) {
  2956. if (!currentInstance) {
  2957. {
  2958. warn("provide() can only be used inside setup().");
  2959. }
  2960. } else {
  2961. var provides = currentInstance.provides;
  2962. // by default an instance inherits its parent's provides object
  2963. // but when it needs to provide values of its own, it creates its
  2964. // own provides object using parent provides object as prototype.
  2965. // this way in `inject` we can simply look up injections from direct
  2966. // parent and let the prototype chain do the work.
  2967. var parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2968. if (parentProvides === provides) {
  2969. provides = currentInstance.provides = Object.create(parentProvides);
  2970. }
  2971. // TS doesn't allow symbol as index type
  2972. provides[key] = value;
  2973. // 当实例为 App 时,同步到全局 provide
  2974. if (currentInstance.type.mpType === 'app') {
  2975. currentInstance.appContext.app.provide(key, value);
  2976. }
  2977. }
  2978. }
  2979. function inject(key, defaultValue) {
  2980. var treatDefaultAsFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2981. // fallback to `currentRenderingInstance` so that this can be called in
  2982. // a functional component
  2983. var instance = currentInstance || currentRenderingInstance;
  2984. if (instance) {
  2985. // #2400
  2986. // to support `app.use` plugins,
  2987. // fallback to appContext's `provides` if the instance is at root
  2988. var provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
  2989. if (provides && key in provides) {
  2990. // TS doesn't allow symbol as index type
  2991. return provides[key];
  2992. } else if (arguments.length > 1) {
  2993. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
  2994. } else {
  2995. warn("injection \"".concat(String(key), "\" not found."));
  2996. }
  2997. } else {
  2998. warn("inject() can only be used inside setup() or functional components.");
  2999. }
  3000. }
  3001. // Simple effect.
  3002. function watchEffect(effect, options) {
  3003. return doWatch(effect, null, options);
  3004. }
  3005. function watchPostEffect(effect, options) {
  3006. return doWatch(effect, null, Object.assign(Object.assign({}, options), {
  3007. flush: 'post'
  3008. }));
  3009. }
  3010. function watchSyncEffect(effect, options) {
  3011. return doWatch(effect, null, Object.assign(Object.assign({}, options), {
  3012. flush: 'sync'
  3013. }));
  3014. }
  3015. // initial value for watchers to trigger on undefined initial values
  3016. var INITIAL_WATCHER_VALUE = {};
  3017. // implementation
  3018. function watch(source, cb, options) {
  3019. if (!isFunction(cb)) {
  3020. warn("`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.");
  3021. }
  3022. return doWatch(source, cb, options);
  3023. }
  3024. function doWatch(source, cb) {
  3025. var {
  3026. immediate,
  3027. deep,
  3028. flush,
  3029. onTrack,
  3030. onTrigger
  3031. } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_OBJ;
  3032. if (!cb) {
  3033. if (immediate !== undefined) {
  3034. warn("watch() \"immediate\" option is only respected when using the " + "watch(source, callback, options?) signature.");
  3035. }
  3036. if (deep !== undefined) {
  3037. warn("watch() \"deep\" option is only respected when using the " + "watch(source, callback, options?) signature.");
  3038. }
  3039. }
  3040. var warnInvalidSource = s => {
  3041. warn("Invalid watch source: ", s, "A watch source can only be a getter/effect function, a ref, " + "a reactive object, or an array of these types.");
  3042. };
  3043. var instance = getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null;
  3044. // const instance = currentInstance
  3045. var getter;
  3046. var forceTrigger = false;
  3047. var isMultiSource = false;
  3048. if (isRef(source)) {
  3049. getter = () => source.value;
  3050. forceTrigger = isShallow$1(source);
  3051. } else if (isReactive(source)) {
  3052. getter = () => source;
  3053. deep = true;
  3054. } else if (isArray(source)) {
  3055. isMultiSource = true;
  3056. forceTrigger = source.some(s => isReactive(s) || isShallow$1(s));
  3057. getter = () => source.map(s => {
  3058. if (isRef(s)) {
  3059. return s.value;
  3060. } else if (isReactive(s)) {
  3061. return traverse(s);
  3062. } else if (isFunction(s)) {
  3063. return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
  3064. } else {
  3065. warnInvalidSource(s);
  3066. }
  3067. });
  3068. } else if (isFunction(source)) {
  3069. if (cb) {
  3070. // getter with cb
  3071. getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
  3072. } else {
  3073. // no cb -> simple effect
  3074. getter = () => {
  3075. if (instance && instance.isUnmounted) {
  3076. return;
  3077. }
  3078. if (cleanup) {
  3079. cleanup();
  3080. }
  3081. return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
  3082. };
  3083. }
  3084. } else {
  3085. getter = NOOP;
  3086. warnInvalidSource(source);
  3087. }
  3088. if (cb && deep) {
  3089. var baseGetter = getter;
  3090. getter = () => traverse(baseGetter());
  3091. }
  3092. var cleanup;
  3093. var onCleanup = fn => {
  3094. cleanup = effect.onStop = () => {
  3095. callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
  3096. };
  3097. };
  3098. var oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3099. var job = () => {
  3100. if (!effect.active) {
  3101. return;
  3102. }
  3103. if (cb) {
  3104. // watch(source, cb)
  3105. var newValue = effect.run();
  3106. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  3107. // cleanup before running cb again
  3108. if (cleanup) {
  3109. cleanup();
  3110. }
  3111. callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [newValue,
  3112. // pass undefined as the old value when it's changed for the first time
  3113. oldValue === INITIAL_WATCHER_VALUE ? undefined : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, onCleanup]);
  3114. oldValue = newValue;
  3115. }
  3116. } else {
  3117. // watchEffect
  3118. effect.run();
  3119. }
  3120. };
  3121. // important: mark the job as a watcher callback so that scheduler knows
  3122. // it is allowed to self-trigger (#1727)
  3123. job.allowRecurse = !!cb;
  3124. var scheduler;
  3125. if (flush === 'sync') {
  3126. scheduler = job; // the scheduler function gets called directly
  3127. } else if (flush === 'post') {
  3128. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3129. } else {
  3130. // default: 'pre'
  3131. job.pre = true;
  3132. if (instance) job.id = instance.uid;
  3133. scheduler = () => queueJob(job);
  3134. }
  3135. var effect = new ReactiveEffect(getter, scheduler);
  3136. {
  3137. effect.onTrack = onTrack;
  3138. effect.onTrigger = onTrigger;
  3139. }
  3140. // initial run
  3141. if (cb) {
  3142. if (immediate) {
  3143. job();
  3144. } else {
  3145. oldValue = effect.run();
  3146. }
  3147. } else if (flush === 'post') {
  3148. queuePostRenderEffect(effect.run.bind(effect), instance && instance.suspense);
  3149. } else {
  3150. effect.run();
  3151. }
  3152. var unwatch = () => {
  3153. effect.stop();
  3154. if (instance && instance.scope) {
  3155. remove(instance.scope.effects, effect);
  3156. }
  3157. };
  3158. return unwatch;
  3159. }
  3160. // this.$watch
  3161. function instanceWatch(source, value, options) {
  3162. var publicThis = this.proxy;
  3163. var getter = isString(source) ? source.includes('.') ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3164. var cb;
  3165. if (isFunction(value)) {
  3166. cb = value;
  3167. } else {
  3168. cb = value.handler;
  3169. options = value;
  3170. }
  3171. var cur = currentInstance;
  3172. setCurrentInstance(this);
  3173. var res = doWatch(getter, cb.bind(publicThis), options);
  3174. if (cur) {
  3175. setCurrentInstance(cur);
  3176. } else {
  3177. unsetCurrentInstance();
  3178. }
  3179. return res;
  3180. }
  3181. function createPathGetter(ctx, path) {
  3182. var segments = path.split('.');
  3183. return () => {
  3184. var cur = ctx;
  3185. for (var i = 0; i < segments.length && cur; i++) {
  3186. cur = cur[segments[i]];
  3187. }
  3188. return cur;
  3189. };
  3190. }
  3191. function traverse(value, seen) {
  3192. if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
  3193. return value;
  3194. }
  3195. seen = seen || new Set();
  3196. if (seen.has(value)) {
  3197. return value;
  3198. }
  3199. seen.add(value);
  3200. if (isRef(value)) {
  3201. traverse(value.value, seen);
  3202. } else if (isArray(value)) {
  3203. for (var i = 0; i < value.length; i++) {
  3204. traverse(value[i], seen);
  3205. }
  3206. } else if (isSet(value) || isMap(value)) {
  3207. value.forEach(v => {
  3208. traverse(v, seen);
  3209. });
  3210. } else if (isPlainObject(value)) {
  3211. for (var key in value) {
  3212. traverse(value[key], seen);
  3213. }
  3214. }
  3215. return value;
  3216. }
  3217. function useTransitionState() {
  3218. var state = {
  3219. isMounted: false,
  3220. isLeaving: false,
  3221. isUnmounting: false,
  3222. leavingVNodes: new Map()
  3223. };
  3224. onMounted(() => {
  3225. state.isMounted = true;
  3226. });
  3227. onBeforeUnmount(() => {
  3228. state.isUnmounting = true;
  3229. });
  3230. return state;
  3231. }
  3232. var TransitionHookValidator = [Function, Array];
  3233. var BaseTransitionPropsValidators = {
  3234. mode: String,
  3235. appear: Boolean,
  3236. persisted: Boolean,
  3237. // enter
  3238. onBeforeEnter: TransitionHookValidator,
  3239. onEnter: TransitionHookValidator,
  3240. onAfterEnter: TransitionHookValidator,
  3241. onEnterCancelled: TransitionHookValidator,
  3242. // leave
  3243. onBeforeLeave: TransitionHookValidator,
  3244. onLeave: TransitionHookValidator,
  3245. onAfterLeave: TransitionHookValidator,
  3246. onLeaveCancelled: TransitionHookValidator,
  3247. // appear
  3248. onBeforeAppear: TransitionHookValidator,
  3249. onAppear: TransitionHookValidator,
  3250. onAfterAppear: TransitionHookValidator,
  3251. onAppearCancelled: TransitionHookValidator
  3252. };
  3253. var BaseTransitionImpl = {
  3254. name: "BaseTransition",
  3255. props: BaseTransitionPropsValidators,
  3256. setup(props, _ref8) {
  3257. var {
  3258. slots
  3259. } = _ref8;
  3260. var instance = getCurrentInstance();
  3261. var state = useTransitionState();
  3262. var prevTransitionKey;
  3263. return () => {
  3264. var children = slots.default && getTransitionRawChildren(slots.default(), true);
  3265. if (!children || !children.length) {
  3266. return;
  3267. }
  3268. var child = children[0];
  3269. if (children.length > 1) {
  3270. var hasFound = false;
  3271. // locate first non-comment child
  3272. for (var c of children) {
  3273. if (c.type !== Comment) {
  3274. if (hasFound) {
  3275. // warn more than one non-comment child
  3276. warn('<transition> can only be used on a single element or component. ' + 'Use <transition-group> for lists.');
  3277. break;
  3278. }
  3279. child = c;
  3280. hasFound = true;
  3281. }
  3282. }
  3283. }
  3284. // there's no need to track reactivity for these props so use the raw
  3285. // props for a bit better perf
  3286. var rawProps = toRaw(props);
  3287. var {
  3288. mode
  3289. } = rawProps;
  3290. // check mode
  3291. if (mode && mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
  3292. warn("invalid <transition> mode: ".concat(mode));
  3293. }
  3294. if (state.isLeaving) {
  3295. return emptyPlaceholder(child);
  3296. }
  3297. // in the case of <transition><keep-alive/></transition>, we need to
  3298. // compare the type of the kept-alive children.
  3299. var innerChild = getKeepAliveChild(child);
  3300. if (!innerChild) {
  3301. return emptyPlaceholder(child);
  3302. }
  3303. var enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);
  3304. setTransitionHooks(innerChild, enterHooks);
  3305. var oldChild = instance.subTree;
  3306. var oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3307. var transitionKeyChanged = false;
  3308. var {
  3309. getTransitionKey
  3310. } = innerChild.type;
  3311. if (getTransitionKey) {
  3312. var key = getTransitionKey();
  3313. if (prevTransitionKey === undefined) {
  3314. prevTransitionKey = key;
  3315. } else if (key !== prevTransitionKey) {
  3316. prevTransitionKey = key;
  3317. transitionKeyChanged = true;
  3318. }
  3319. }
  3320. // handle mode
  3321. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  3322. var leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
  3323. // update old tree's hooks in case of dynamic transition
  3324. setTransitionHooks(oldInnerChild, leavingHooks);
  3325. // switching between different views
  3326. if (mode === 'out-in') {
  3327. state.isLeaving = true;
  3328. // return placeholder node and queue update when leave finishes
  3329. leavingHooks.afterLeave = () => {
  3330. state.isLeaving = false;
  3331. // #6835
  3332. // it also needs to be updated when active is undefined
  3333. if (instance.update.active !== false) {
  3334. instance.update();
  3335. }
  3336. };
  3337. return emptyPlaceholder(child);
  3338. } else if (mode === 'in-out' && innerChild.type !== Comment) {
  3339. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3340. var leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
  3341. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3342. // early removal callback
  3343. el._leaveCb = () => {
  3344. earlyRemove();
  3345. el._leaveCb = undefined;
  3346. delete enterHooks.delayedLeave;
  3347. };
  3348. enterHooks.delayedLeave = delayedLeave;
  3349. };
  3350. }
  3351. }
  3352. return child;
  3353. };
  3354. }
  3355. };
  3356. // export the public type for h/tsx inference
  3357. // also to avoid inline import() in generated d.ts files
  3358. var BaseTransition = BaseTransitionImpl;
  3359. function getLeavingNodesForType(state, vnode) {
  3360. var {
  3361. leavingVNodes
  3362. } = state;
  3363. var leavingVNodesCache = leavingVNodes.get(vnode.type);
  3364. if (!leavingVNodesCache) {
  3365. leavingVNodesCache = Object.create(null);
  3366. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3367. }
  3368. return leavingVNodesCache;
  3369. }
  3370. // The transition hooks are attached to the vnode as vnode.transition
  3371. // and will be called at appropriate timing in the renderer.
  3372. function resolveTransitionHooks(vnode, props, state, instance) {
  3373. var {
  3374. appear,
  3375. mode,
  3376. persisted = false,
  3377. onBeforeEnter,
  3378. onEnter,
  3379. onAfterEnter,
  3380. onEnterCancelled,
  3381. onBeforeLeave,
  3382. onLeave,
  3383. onAfterLeave,
  3384. onLeaveCancelled,
  3385. onBeforeAppear,
  3386. onAppear,
  3387. onAfterAppear,
  3388. onAppearCancelled
  3389. } = props;
  3390. var key = String(vnode.key);
  3391. var leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3392. var callHook = (hook, args) => {
  3393. hook && callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
  3394. };
  3395. var callAsyncHook = (hook, args) => {
  3396. var done = args[1];
  3397. callHook(hook, args);
  3398. if (isArray(hook)) {
  3399. if (hook.every(hook => hook.length <= 1)) done();
  3400. } else if (hook.length <= 1) {
  3401. done();
  3402. }
  3403. };
  3404. var hooks = {
  3405. mode,
  3406. persisted,
  3407. beforeEnter(el) {
  3408. var hook = onBeforeEnter;
  3409. if (!state.isMounted) {
  3410. if (appear) {
  3411. hook = onBeforeAppear || onBeforeEnter;
  3412. } else {
  3413. return;
  3414. }
  3415. }
  3416. // for same element (v-show)
  3417. if (el._leaveCb) {
  3418. el._leaveCb(true /* cancelled */);
  3419. }
  3420. // for toggled element with same key (v-if)
  3421. var leavingVNode = leavingVNodesCache[key];
  3422. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  3423. // force early removal (not cancelled)
  3424. leavingVNode.el._leaveCb();
  3425. }
  3426. callHook(hook, [el]);
  3427. },
  3428. enter(el) {
  3429. var hook = onEnter;
  3430. var afterHook = onAfterEnter;
  3431. var cancelHook = onEnterCancelled;
  3432. if (!state.isMounted) {
  3433. if (appear) {
  3434. hook = onAppear || onEnter;
  3435. afterHook = onAfterAppear || onAfterEnter;
  3436. cancelHook = onAppearCancelled || onEnterCancelled;
  3437. } else {
  3438. return;
  3439. }
  3440. }
  3441. var called = false;
  3442. var done = el._enterCb = cancelled => {
  3443. if (called) return;
  3444. called = true;
  3445. if (cancelled) {
  3446. callHook(cancelHook, [el]);
  3447. } else {
  3448. callHook(afterHook, [el]);
  3449. }
  3450. if (hooks.delayedLeave) {
  3451. hooks.delayedLeave();
  3452. }
  3453. el._enterCb = undefined;
  3454. };
  3455. if (hook) {
  3456. callAsyncHook(hook, [el, done]);
  3457. } else {
  3458. done();
  3459. }
  3460. },
  3461. leave(el, remove) {
  3462. var key = String(vnode.key);
  3463. if (el._enterCb) {
  3464. el._enterCb(true /* cancelled */);
  3465. }
  3466. if (state.isUnmounting) {
  3467. return remove();
  3468. }
  3469. callHook(onBeforeLeave, [el]);
  3470. var called = false;
  3471. var done = el._leaveCb = cancelled => {
  3472. if (called) return;
  3473. called = true;
  3474. remove();
  3475. if (cancelled) {
  3476. callHook(onLeaveCancelled, [el]);
  3477. } else {
  3478. callHook(onAfterLeave, [el]);
  3479. }
  3480. el._leaveCb = undefined;
  3481. if (leavingVNodesCache[key] === vnode) {
  3482. delete leavingVNodesCache[key];
  3483. }
  3484. };
  3485. leavingVNodesCache[key] = vnode;
  3486. if (onLeave) {
  3487. callAsyncHook(onLeave, [el, done]);
  3488. } else {
  3489. done();
  3490. }
  3491. },
  3492. clone(vnode) {
  3493. return resolveTransitionHooks(vnode, props, state, instance);
  3494. }
  3495. };
  3496. return hooks;
  3497. }
  3498. // the placeholder really only handles one special case: KeepAlive
  3499. // in the case of a KeepAlive in a leave phase we need to return a KeepAlive
  3500. // placeholder with empty content to avoid the KeepAlive instance from being
  3501. // unmounted.
  3502. function emptyPlaceholder(vnode) {
  3503. if (isKeepAlive(vnode)) {
  3504. vnode = cloneVNode(vnode);
  3505. vnode.children = null;
  3506. return vnode;
  3507. }
  3508. }
  3509. function getKeepAliveChild(vnode) {
  3510. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : undefined : vnode;
  3511. }
  3512. function setTransitionHooks(vnode, hooks) {
  3513. if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
  3514. setTransitionHooks(vnode.component.subTree, hooks);
  3515. } else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  3516. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3517. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3518. } else {
  3519. vnode.transition = hooks;
  3520. }
  3521. }
  3522. function getTransitionRawChildren(children) {
  3523. var keepComment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3524. var parentKey = arguments.length > 2 ? arguments[2] : undefined;
  3525. var ret = [];
  3526. var keyedFragmentCount = 0;
  3527. for (var i = 0; i < children.length; i++) {
  3528. var child = children[i];
  3529. // #5360 inherit parent key in case of <template v-for>
  3530. var key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3531. // handle fragment children case, e.g. v-for
  3532. if (child.type === Fragment) {
  3533. if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) keyedFragmentCount++;
  3534. ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
  3535. }
  3536. // comment placeholders should be skipped, e.g. v-if
  3537. else if (keepComment || child.type !== Comment) {
  3538. ret.push(key != null ? cloneVNode(child, {
  3539. key
  3540. }) : child);
  3541. }
  3542. }
  3543. // #1126 if a transition children list contains multiple sub fragments, these
  3544. // fragments will be merged into a flat children array. Since each v-for
  3545. // fragment may contain different static bindings inside, we need to de-op
  3546. // these children to force full diffs to ensure correct behavior.
  3547. if (keyedFragmentCount > 1) {
  3548. for (var _i = 0; _i < ret.length; _i++) {
  3549. ret[_i].patchFlag = -2 /* PatchFlags.BAIL */;
  3550. }
  3551. }
  3552. return ret;
  3553. }
  3554. // implementation, close to no-op
  3555. function defineComponent(options) {
  3556. return isFunction(options) ? {
  3557. setup: options,
  3558. name: options.name
  3559. } : options;
  3560. }
  3561. var isAsyncWrapper = i => !!i.type.__asyncLoader;
  3562. function defineAsyncComponent(source) {
  3563. if (isFunction(source)) {
  3564. source = {
  3565. loader: source
  3566. };
  3567. }
  3568. var {
  3569. loader,
  3570. loadingComponent,
  3571. errorComponent,
  3572. delay = 200,
  3573. timeout,
  3574. // undefined = never times out
  3575. suspensible = true,
  3576. onError: userOnError
  3577. } = source;
  3578. var pendingRequest = null;
  3579. var resolvedComp;
  3580. var retries = 0;
  3581. var retry = () => {
  3582. retries++;
  3583. pendingRequest = null;
  3584. return load();
  3585. };
  3586. var load = () => {
  3587. var thisRequest;
  3588. return pendingRequest || (thisRequest = pendingRequest = loader().catch(err => {
  3589. err = err instanceof Error ? err : new Error(String(err));
  3590. if (userOnError) {
  3591. return new Promise((resolve, reject) => {
  3592. var userRetry = () => resolve(retry());
  3593. var userFail = () => reject(err);
  3594. userOnError(err, userRetry, userFail, retries + 1);
  3595. });
  3596. } else {
  3597. throw err;
  3598. }
  3599. }).then(comp => {
  3600. if (thisRequest !== pendingRequest && pendingRequest) {
  3601. return pendingRequest;
  3602. }
  3603. if (!comp) {
  3604. warn("Async component loader resolved to undefined. " + "If you are using retry(), make sure to return its return value.");
  3605. }
  3606. // interop module default
  3607. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  3608. comp = comp.default;
  3609. }
  3610. if (comp && !isObject(comp) && !isFunction(comp)) {
  3611. throw new Error("Invalid async component load result: ".concat(comp));
  3612. }
  3613. resolvedComp = comp;
  3614. return comp;
  3615. }));
  3616. };
  3617. return defineComponent({
  3618. name: 'AsyncComponentWrapper',
  3619. __asyncLoader: load,
  3620. get __asyncResolved() {
  3621. return resolvedComp;
  3622. },
  3623. setup() {
  3624. var instance = currentInstance;
  3625. // already resolved
  3626. if (resolvedComp) {
  3627. return () => createInnerComp(resolvedComp, instance);
  3628. }
  3629. var onError = err => {
  3630. pendingRequest = null;
  3631. handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
  3632. };
  3633. // suspense-controlled or SSR.
  3634. if (suspensible && instance.suspense || false) {
  3635. return load().then(comp => {
  3636. return () => createInnerComp(comp, instance);
  3637. }).catch(err => {
  3638. onError(err);
  3639. return () => errorComponent ? createVNode(errorComponent, {
  3640. error: err
  3641. }) : null;
  3642. });
  3643. }
  3644. var loaded = ref(false);
  3645. var error = ref();
  3646. var delayed = ref(!!delay);
  3647. if (delay) {
  3648. setTimeout(() => {
  3649. delayed.value = false;
  3650. }, delay);
  3651. }
  3652. if (timeout != null) {
  3653. setTimeout(() => {
  3654. if (!loaded.value && !error.value) {
  3655. var err = new Error("Async component timed out after ".concat(timeout, "ms."));
  3656. onError(err);
  3657. error.value = err;
  3658. }
  3659. }, timeout);
  3660. }
  3661. load().then(() => {
  3662. loaded.value = true;
  3663. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3664. // parent is keep-alive, force update so the loaded component's
  3665. // name is taken into account
  3666. queueJob(instance.parent.update);
  3667. }
  3668. }).catch(err => {
  3669. onError(err);
  3670. error.value = err;
  3671. });
  3672. return () => {
  3673. if (loaded.value && resolvedComp) {
  3674. return createInnerComp(resolvedComp, instance);
  3675. } else if (error.value && errorComponent) {
  3676. return createVNode(errorComponent, {
  3677. error: error.value
  3678. });
  3679. } else if (loadingComponent && !delayed.value) {
  3680. return createVNode(loadingComponent);
  3681. }
  3682. };
  3683. }
  3684. });
  3685. }
  3686. function createInnerComp(comp, parent) {
  3687. var {
  3688. ref,
  3689. props,
  3690. children,
  3691. ce
  3692. } = parent.vnode;
  3693. var vnode = createVNode(comp, props, children);
  3694. // ensure inner component inherits the async wrapper's ref owner
  3695. vnode.ref = ref;
  3696. // pass the custom element callback on to the inner comp
  3697. // and remove it from the async wrapper
  3698. vnode.ce = ce;
  3699. delete parent.vnode.ce;
  3700. return vnode;
  3701. }
  3702. var isKeepAlive = vnode => vnode.type.__isKeepAlive;
  3703. var KeepAliveImpl = {
  3704. name: "KeepAlive",
  3705. // Marker for special handling inside the renderer. We are not using a ===
  3706. // check directly on KeepAlive in the renderer, because importing it directly
  3707. // would prevent it from being tree-shaken.
  3708. __isKeepAlive: true,
  3709. props: {
  3710. include: [String, RegExp, Array],
  3711. exclude: [String, RegExp, Array],
  3712. max: [String, Number]
  3713. },
  3714. setup(props, _ref9) {
  3715. var {
  3716. slots
  3717. } = _ref9;
  3718. var instance = getCurrentInstance();
  3719. // KeepAlive communicates with the instantiated renderer via the
  3720. // ctx where the renderer passes in its internals,
  3721. // and the KeepAlive instance exposes activate/deactivate implementations.
  3722. // The whole point of this is to avoid importing KeepAlive directly in the
  3723. // renderer to facilitate tree-shaking.
  3724. var sharedContext = instance.ctx;
  3725. var cache = new Map();
  3726. var keys = new Set();
  3727. var current = null;
  3728. {
  3729. instance.__v_cache = cache;
  3730. }
  3731. var parentSuspense = instance.suspense;
  3732. var {
  3733. renderer: {
  3734. p: patch,
  3735. m: move,
  3736. um: _unmount,
  3737. o: {
  3738. createElement
  3739. }
  3740. }
  3741. } = sharedContext;
  3742. // @ts-expect-error fixed by xxxxxx
  3743. var storageContainer = createElement('div');
  3744. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3745. var instance = vnode.component;
  3746. move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
  3747. // in case props have changed
  3748. patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
  3749. queuePostRenderEffect(() => {
  3750. instance.isDeactivated = false;
  3751. if (instance.a) {
  3752. invokeArrayFns(instance.a);
  3753. }
  3754. var vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3755. if (vnodeHook) {
  3756. invokeVNodeHook(vnodeHook, instance.parent, vnode);
  3757. }
  3758. }, parentSuspense);
  3759. {
  3760. // Update components tree
  3761. devtoolsComponentAdded(instance);
  3762. }
  3763. };
  3764. sharedContext.deactivate = vnode => {
  3765. var instance = vnode.component;
  3766. move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
  3767. queuePostRenderEffect(() => {
  3768. if (instance.da) {
  3769. invokeArrayFns(instance.da);
  3770. }
  3771. var vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3772. if (vnodeHook) {
  3773. invokeVNodeHook(vnodeHook, instance.parent, vnode);
  3774. }
  3775. instance.isDeactivated = true;
  3776. }, parentSuspense);
  3777. {
  3778. // Update components tree
  3779. devtoolsComponentAdded(instance);
  3780. }
  3781. };
  3782. function unmount(vnode) {
  3783. // reset the shapeFlag so it can be properly unmounted
  3784. resetShapeFlag(vnode);
  3785. _unmount(vnode, instance, parentSuspense, true);
  3786. }
  3787. function pruneCache(filter) {
  3788. cache.forEach((vnode, key) => {
  3789. var name = getComponentName(vnode.type);
  3790. if (name && (!filter || !filter(name))) {
  3791. pruneCacheEntry(key);
  3792. }
  3793. });
  3794. }
  3795. function pruneCacheEntry(key) {
  3796. var cached = cache.get(key);
  3797. if (!current || !isSameVNodeType(cached, current)) {
  3798. unmount(cached);
  3799. } else if (current) {
  3800. // current active instance should no longer be kept-alive.
  3801. // we can't unmount it now but it might be later, so reset its flag now.
  3802. resetShapeFlag(current);
  3803. }
  3804. cache.delete(key);
  3805. keys.delete(key);
  3806. }
  3807. // prune cache on include/exclude prop change
  3808. watch(() => [props.include, props.exclude], _ref10 => {
  3809. var [include, exclude] = _ref10;
  3810. include && pruneCache(name => matches(include, name));
  3811. exclude && pruneCache(name => !matches(exclude, name));
  3812. },
  3813. // prune post-render after `current` has been updated
  3814. {
  3815. flush: 'post',
  3816. deep: true
  3817. });
  3818. // cache sub tree after render
  3819. var pendingCacheKey = null;
  3820. var cacheSubtree = () => {
  3821. // fix #1621, the pendingCacheKey could be 0
  3822. if (pendingCacheKey != null) {
  3823. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3824. }
  3825. };
  3826. onMounted(cacheSubtree);
  3827. onUpdated(cacheSubtree);
  3828. onBeforeUnmount(() => {
  3829. cache.forEach(cached => {
  3830. var {
  3831. subTree,
  3832. suspense
  3833. } = instance;
  3834. var vnode = getInnerChild(subTree);
  3835. if (cached.type === vnode.type && cached.key === vnode.key) {
  3836. // current instance will be unmounted as part of keep-alive's unmount
  3837. resetShapeFlag(vnode);
  3838. // but invoke its deactivated hook here
  3839. var da = vnode.component.da;
  3840. da && queuePostRenderEffect(da, suspense);
  3841. return;
  3842. }
  3843. unmount(cached);
  3844. });
  3845. });
  3846. return () => {
  3847. pendingCacheKey = null;
  3848. if (!slots.default) {
  3849. return null;
  3850. }
  3851. var children = slots.default();
  3852. var rawVNode = children[0];
  3853. if (children.length > 1) {
  3854. {
  3855. warn("KeepAlive should contain exactly one component child.");
  3856. }
  3857. current = null;
  3858. return children;
  3859. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) && !(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */)) {
  3860. current = null;
  3861. return rawVNode;
  3862. }
  3863. var vnode = getInnerChild(rawVNode);
  3864. var comp = vnode.type;
  3865. // for async components, name check should be based in its loaded
  3866. // inner component if available
  3867. var name = getComponentName(isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp);
  3868. var {
  3869. include,
  3870. exclude,
  3871. max
  3872. } = props;
  3873. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  3874. current = vnode;
  3875. return rawVNode;
  3876. }
  3877. var key = vnode.key == null ? comp : vnode.key;
  3878. var cachedVNode = cache.get(key);
  3879. // clone vnode if it's reused because we are going to mutate it
  3880. if (vnode.el) {
  3881. vnode = cloneVNode(vnode);
  3882. if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  3883. rawVNode.ssContent = vnode;
  3884. }
  3885. }
  3886. // #1513 it's possible for the returned vnode to be cloned due to attr
  3887. // fallthrough or scopeId, so the vnode here may not be the final vnode
  3888. // that is mounted. Instead of caching it directly, we store the pending
  3889. // key and cache `instance.subTree` (the normalized vnode) in
  3890. // beforeMount/beforeUpdate hooks.
  3891. pendingCacheKey = key;
  3892. if (cachedVNode) {
  3893. // copy over mounted state
  3894. vnode.el = cachedVNode.el;
  3895. vnode.component = cachedVNode.component;
  3896. if (vnode.transition) {
  3897. // recursively update transition hooks on subTree
  3898. setTransitionHooks(vnode, vnode.transition);
  3899. }
  3900. // avoid vnode being mounted as fresh
  3901. vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
  3902. // make this key the freshest
  3903. keys.delete(key);
  3904. keys.add(key);
  3905. } else {
  3906. keys.add(key);
  3907. // prune oldest entry
  3908. if (max && keys.size > parseInt(max, 10)) {
  3909. pruneCacheEntry(keys.values().next().value);
  3910. }
  3911. }
  3912. // avoid vnode being unmounted
  3913. vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
  3914. current = vnode;
  3915. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3916. };
  3917. }
  3918. };
  3919. // export the public type for h/tsx inference
  3920. // also to avoid inline import() in generated d.ts files
  3921. var KeepAlive = KeepAliveImpl;
  3922. function matches(pattern, name) {
  3923. if (isArray(pattern)) {
  3924. return pattern.some(p => matches(p, name));
  3925. } else if (isString(pattern)) {
  3926. return pattern.split(',').includes(name);
  3927. } else if (isRegExp(pattern)) {
  3928. return pattern.test(name);
  3929. }
  3930. /* istanbul ignore next */
  3931. return false;
  3932. }
  3933. function onActivated(hook, target) {
  3934. registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
  3935. }
  3936. function onDeactivated(hook, target) {
  3937. registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
  3938. }
  3939. function registerKeepAliveHook(hook, type) {
  3940. var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
  3941. // cache the deactivate branch check wrapper for injected hooks so the same
  3942. // hook can be properly deduped by the scheduler. "__wdc" stands for "with
  3943. // deactivation check".
  3944. var wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3945. // only fire the hook if the target instance is NOT in a deactivated branch.
  3946. var current = target;
  3947. while (current) {
  3948. if (current.isDeactivated) {
  3949. return;
  3950. }
  3951. current = current.parent;
  3952. }
  3953. return hook();
  3954. });
  3955. injectHook(type, wrappedHook, target);
  3956. // In addition to registering it on the target instance, we walk up the parent
  3957. // chain and register it on all ancestor instances that are keep-alive roots.
  3958. // This avoids the need to walk the entire component tree when invoking these
  3959. // hooks, and more importantly, avoids the need to track child components in
  3960. // arrays.
  3961. if (target) {
  3962. var current = target.parent;
  3963. while (current && current.parent) {
  3964. if (isKeepAlive(current.parent.vnode)) {
  3965. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3966. }
  3967. current = current.parent;
  3968. }
  3969. }
  3970. }
  3971. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3972. // injectHook wraps the original for error handling, so make sure to remove
  3973. // the wrapped version.
  3974. var injected = injectHook(type, hook, keepAliveRoot, true /* prepend */);
  3975. onUnmounted(() => {
  3976. remove(keepAliveRoot[type], injected);
  3977. }, target);
  3978. }
  3979. function resetShapeFlag(vnode) {
  3980. // bitwise operations to remove keep alive flags
  3981. vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
  3982. vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
  3983. }
  3984. function getInnerChild(vnode) {
  3985. return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
  3986. }
  3987. function injectHook(type, hook) {
  3988. var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
  3989. var prepend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3990. if (target) {
  3991. // fixed by xxxxxx
  3992. if (isRootHook(type) && target !== target.root) {
  3993. target = target.root;
  3994. if (isRootImmediateHook(type)) {
  3995. // 作用域应该是组件还是页面?目前绑定的是页面
  3996. var proxy = target.proxy;
  3997. callWithAsyncErrorHandling(hook.bind(proxy), target, type, ON_LOAD === type ? [proxy.$page.options] : []);
  3998. }
  3999. }
  4000. var hooks = target[type] || (target[type] = []);
  4001. // cache the error handling wrapper for injected hooks so the same hook
  4002. // can be properly deduped by the scheduler. "__weh" stands for "with error
  4003. // handling".
  4004. var wrappedHook = hook.__weh || (hook.__weh = function () {
  4005. if (target.isUnmounted) {
  4006. return;
  4007. }
  4008. // disable tracking inside all lifecycle hooks
  4009. // since they can potentially be called inside effects.
  4010. pauseTracking();
  4011. // Set currentInstance during hook invocation.
  4012. // This assumes the hook does not synchronously trigger other hooks, which
  4013. // can only be false when the user does something really funky.
  4014. setCurrentInstance(target);
  4015. for (var _len7 = arguments.length, args = new Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {
  4016. args[_key8] = arguments[_key8];
  4017. }
  4018. var res = callWithAsyncErrorHandling(hook, target, type, args);
  4019. unsetCurrentInstance();
  4020. resetTracking();
  4021. return res;
  4022. });
  4023. if (prepend) {
  4024. hooks.unshift(wrappedHook);
  4025. } else {
  4026. hooks.push(wrappedHook);
  4027. }
  4028. return wrappedHook;
  4029. } else {
  4030. // fixed by xxxxxx
  4031. var apiName = toHandlerKey((ErrorTypeStrings[type] || type.replace(/^on/, '')).replace(/ hook$/, ''));
  4032. warn("".concat(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."));
  4033. }
  4034. }
  4035. var createHook = lifecycle => function (hook) {
  4036. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
  4037. return (
  4038. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4039. (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) && injectHook(lifecycle, function () {
  4040. return hook(...arguments);
  4041. }, target)
  4042. );
  4043. };
  4044. var onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
  4045. var onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
  4046. var onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
  4047. var onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
  4048. var onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
  4049. var onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
  4050. var onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
  4051. var onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
  4052. var onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
  4053. function onErrorCaptured(hook) {
  4054. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
  4055. injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
  4056. }
  4057. /**
  4058. Runtime helper for applying directives to a vnode. Example usage:
  4059. const comp = resolveComponent('comp')
  4060. const foo = resolveDirective('foo')
  4061. const bar = resolveDirective('bar')
  4062. return withDirectives(h(comp), [
  4063. [foo, this.x],
  4064. [bar, this.y]
  4065. ])
  4066. */
  4067. function validateDirectiveName(name) {
  4068. if (isBuiltInDirective(name)) {
  4069. warn('Do not use built-in directive ids as custom directive id: ' + name);
  4070. }
  4071. }
  4072. /**
  4073. * Adds directives to a VNode.
  4074. */
  4075. function withDirectives(vnode, directives) {
  4076. var internalInstance = currentRenderingInstance;
  4077. if (internalInstance === null) {
  4078. warn("withDirectives can only be used inside render functions.");
  4079. return vnode;
  4080. }
  4081. var instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  4082. var bindings = vnode.dirs || (vnode.dirs = []);
  4083. for (var i = 0; i < directives.length; i++) {
  4084. var [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  4085. if (dir) {
  4086. if (isFunction(dir)) {
  4087. dir = {
  4088. mounted: dir,
  4089. updated: dir
  4090. };
  4091. }
  4092. if (dir.deep) {
  4093. traverse(value);
  4094. }
  4095. bindings.push({
  4096. dir,
  4097. instance,
  4098. value,
  4099. oldValue: void 0,
  4100. arg,
  4101. modifiers
  4102. });
  4103. }
  4104. }
  4105. return vnode;
  4106. }
  4107. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  4108. var bindings = vnode.dirs;
  4109. var oldBindings = prevVNode && prevVNode.dirs;
  4110. for (var i = 0; i < bindings.length; i++) {
  4111. var binding = bindings[i];
  4112. if (oldBindings) {
  4113. binding.oldValue = oldBindings[i].value;
  4114. }
  4115. var hook = binding.dir[name];
  4116. if (hook) {
  4117. // disable tracking inside all lifecycle hooks
  4118. // since they can potentially be called inside effects.
  4119. pauseTracking();
  4120. callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [vnode.el, binding, vnode, prevVNode]);
  4121. resetTracking();
  4122. }
  4123. }
  4124. }
  4125. var COMPONENTS = 'components';
  4126. var DIRECTIVES = 'directives';
  4127. /**
  4128. * @private
  4129. */
  4130. function resolveComponent(name, maybeSelfReference) {
  4131. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4132. }
  4133. var NULL_DYNAMIC_COMPONENT = Symbol();
  4134. /**
  4135. * @private
  4136. */
  4137. function resolveDynamicComponent(component) {
  4138. if (isString(component)) {
  4139. return resolveAsset(COMPONENTS, component, false) || component;
  4140. } else {
  4141. // invalid types will fallthrough to createVNode and raise warning
  4142. return component || NULL_DYNAMIC_COMPONENT;
  4143. }
  4144. }
  4145. /**
  4146. * @private
  4147. */
  4148. function resolveDirective(name) {
  4149. return resolveAsset(DIRECTIVES, name);
  4150. }
  4151. // implementation
  4152. function resolveAsset(type, name) {
  4153. var warnMissing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  4154. var maybeSelfReference = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  4155. var instance = currentRenderingInstance || currentInstance;
  4156. if (instance) {
  4157. var Component = instance.type;
  4158. // explicit self name has highest priority
  4159. if (type === COMPONENTS) {
  4160. var selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
  4161. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4162. return Component;
  4163. }
  4164. }
  4165. var res =
  4166. // local registration
  4167. // check instance[type] first which is resolved for options API
  4168. resolve(instance[type] || Component[type], name) ||
  4169. // global registration
  4170. resolve(instance.appContext[type], name);
  4171. if (!res && maybeSelfReference) {
  4172. // fallback to implicit self-reference
  4173. return Component;
  4174. }
  4175. if (warnMissing && !res) {
  4176. var extra = type === COMPONENTS ? "\nIf this is a native custom element, make sure to exclude it from " + "component resolution via compilerOptions.isCustomElement." : "";
  4177. warn("Failed to resolve ".concat(type.slice(0, -1), ": ").concat(name).concat(extra));
  4178. }
  4179. return res;
  4180. } else {
  4181. warn("resolve".concat(capitalize(type.slice(0, -1)), " ") + "can only be used in render() or setup().");
  4182. }
  4183. }
  4184. function resolve(registry, name) {
  4185. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4186. }
  4187. /**
  4188. * Actual implementation
  4189. */
  4190. function renderList(source, renderItem, cache, index) {
  4191. var ret;
  4192. var cached = cache && cache[index];
  4193. if (isArray(source) || isString(source)) {
  4194. ret = new Array(source.length);
  4195. for (var i = 0, l = source.length; i < l; i++) {
  4196. ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
  4197. }
  4198. } else if (typeof source === 'number') {
  4199. if (!Number.isInteger(source)) {
  4200. warn("The v-for range expect an integer value but got ".concat(source, "."));
  4201. }
  4202. ret = new Array(source);
  4203. for (var _i2 = 0; _i2 < source; _i2++) {
  4204. ret[_i2] = renderItem(_i2 + 1, _i2, undefined, cached && cached[_i2]);
  4205. }
  4206. } else if (isObject(source)) {
  4207. if (source[Symbol.iterator]) {
  4208. ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
  4209. } else {
  4210. var keys = Object.keys(source);
  4211. ret = new Array(keys.length);
  4212. for (var _i3 = 0, _l = keys.length; _i3 < _l; _i3++) {
  4213. var key = keys[_i3];
  4214. ret[_i3] = renderItem(source[key], key, _i3, cached && cached[_i3]);
  4215. }
  4216. }
  4217. } else {
  4218. ret = [];
  4219. }
  4220. if (cache) {
  4221. cache[index] = ret;
  4222. }
  4223. return ret;
  4224. }
  4225. /**
  4226. * Compiler runtime helper for creating dynamic slots object
  4227. * @private
  4228. */
  4229. function createSlots(slots, dynamicSlots) {
  4230. var _loop = function (i) {
  4231. var slot = dynamicSlots[i];
  4232. // array of dynamic slot generated by <template v-for="..." #[...]>
  4233. if (isArray(slot)) {
  4234. for (var j = 0; j < slot.length; j++) {
  4235. slots[slot[j].name] = slot[j].fn;
  4236. }
  4237. } else if (slot) {
  4238. // conditional single slot generated by <template v-if="..." #foo>
  4239. slots[slot.name] = slot.key ? function () {
  4240. var res = slot.fn(...arguments);
  4241. // attach branch key so each conditional branch is considered a
  4242. // different fragment
  4243. if (res) res.key = slot.key;
  4244. return res;
  4245. } : slot.fn;
  4246. }
  4247. };
  4248. for (var i = 0; i < dynamicSlots.length; i++) {
  4249. _loop(i);
  4250. }
  4251. return slots;
  4252. }
  4253. /**
  4254. * Compiler runtime helper for rendering `<slot/>`
  4255. * @private
  4256. */
  4257. function renderSlot(slots, name) {
  4258. var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4259. var
  4260. // this is not a user-facing function, so the fallback is always generated by
  4261. // the compiler and guaranteed to be a function returning an array
  4262. fallback = arguments.length > 3 ? arguments[3] : undefined;
  4263. var noSlotted = arguments.length > 4 ? arguments[4] : undefined;
  4264. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4265. if (name !== 'default') props.name = name;
  4266. return createVNode('slot', props, fallback && fallback());
  4267. }
  4268. var slot = slots[name];
  4269. if (slot && slot.length > 1) {
  4270. warn("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.");
  4271. slot = () => [];
  4272. }
  4273. // a compiled slot disables block tracking by default to avoid manual
  4274. // invocation interfering with template-based block tracking, but in
  4275. // `renderSlot` we can be sure that it's template-based so we can force
  4276. // enable it.
  4277. if (slot && slot._c) {
  4278. slot._d = false;
  4279. }
  4280. openBlock();
  4281. var validSlotContent = slot && ensureValidVNode(slot(props));
  4282. var rendered = createBlock(Fragment, {
  4283. key: props.key ||
  4284. // slot content array of a dynamic conditional slot may have a branch
  4285. // key attached in the `createSlots` helper, respect that
  4286. validSlotContent && validSlotContent.key || "_".concat(name)
  4287. }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */ ? 64 /* PatchFlags.STABLE_FRAGMENT */ : -2 /* PatchFlags.BAIL */);
  4288. if (!noSlotted && rendered.scopeId) {
  4289. rendered.slotScopeIds = [rendered.scopeId + '-s'];
  4290. }
  4291. if (slot && slot._c) {
  4292. slot._d = true;
  4293. }
  4294. return rendered;
  4295. }
  4296. function ensureValidVNode(vnodes) {
  4297. return vnodes.some(child => {
  4298. if (!isVNode(child)) return true;
  4299. if (child.type === Comment) return false;
  4300. if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
  4301. return true;
  4302. }) ? vnodes : null;
  4303. }
  4304. /**
  4305. * For prefixing keys in v-on="obj" with "on"
  4306. * @private
  4307. */
  4308. function toHandlers(obj, preserveCaseIfNecessary) {
  4309. var ret = {};
  4310. if (!isObject(obj)) {
  4311. warn("v-on with no argument expects an object value.");
  4312. return ret;
  4313. }
  4314. for (var key in obj) {
  4315. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? "on:".concat(key) : toHandlerKey(key)] = obj[key];
  4316. }
  4317. return ret;
  4318. }
  4319. /**
  4320. * #2437 In Vue 3, functional components do not have a public instance proxy but
  4321. * they exist in the internal parent chain. For code that relies on traversing
  4322. * public $parent chains, skip functional ones and go to the parent instead.
  4323. */
  4324. var getPublicInstance = i => {
  4325. if (!i) return null;
  4326. if (isStatefulComponent(i)) return getExposeProxy(i) || i.proxy;
  4327. return getPublicInstance(i.parent);
  4328. };
  4329. var publicPropertiesMap =
  4330. // Move PURE marker to new line to workaround compiler discarding it
  4331. // due to type annotation
  4332. /*#__PURE__*/
  4333. extend$1(Object.create(null), {
  4334. $: i => i,
  4335. $el: i => i.vnode.el,
  4336. $data: i => i.data,
  4337. $props: i => shallowReadonly(i.props),
  4338. $attrs: i => shallowReadonly(i.attrs),
  4339. $slots: i => shallowReadonly(i.slots),
  4340. $refs: i => shallowReadonly(i.refs),
  4341. $parent: i => getPublicInstance(i.parent),
  4342. $root: i => getPublicInstance(i.root),
  4343. $emit: i => i.emit,
  4344. $options: i => resolveMergedOptions(i),
  4345. $forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
  4346. $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
  4347. $watch: i => instanceWatch.bind(i)
  4348. });
  4349. var isReservedPrefix = key => key === '_' || key === '$';
  4350. var hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4351. var PublicInstanceProxyHandlers = {
  4352. get(_ref11, key) {
  4353. var {
  4354. _: instance
  4355. } = _ref11;
  4356. var {
  4357. ctx,
  4358. setupState,
  4359. data,
  4360. props,
  4361. accessCache,
  4362. type,
  4363. appContext
  4364. } = instance;
  4365. // for internal formatters to know that this is a Vue instance
  4366. if (key === '__isVue') {
  4367. return true;
  4368. }
  4369. // data / props / ctx
  4370. // This getter gets called for every property access on the render context
  4371. // during render and is a major hotspot. The most expensive part of this
  4372. // is the multiple hasOwn() calls. It's much faster to do a simple property
  4373. // access on a plain object, so we use an accessCache object (with null
  4374. // prototype) to memoize what access type a key corresponds to.
  4375. var normalizedProps;
  4376. if (key[0] !== '$') {
  4377. var n = accessCache[key];
  4378. if (n !== undefined) {
  4379. switch (n) {
  4380. case 1 /* AccessTypes.SETUP */:
  4381. return setupState[key];
  4382. case 2 /* AccessTypes.DATA */:
  4383. return data[key];
  4384. case 4 /* AccessTypes.CONTEXT */:
  4385. return ctx[key];
  4386. case 3 /* AccessTypes.PROPS */:
  4387. return props[key];
  4388. // default: just fallthrough
  4389. }
  4390. } else if (hasSetupBinding(setupState, key)) {
  4391. accessCache[key] = 1 /* AccessTypes.SETUP */;
  4392. return setupState[key];
  4393. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4394. accessCache[key] = 2 /* AccessTypes.DATA */;
  4395. return data[key];
  4396. } else if (
  4397. // only cache other properties when instance has declared (thus stable)
  4398. // props
  4399. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) {
  4400. accessCache[key] = 3 /* AccessTypes.PROPS */;
  4401. return props[key];
  4402. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4403. accessCache[key] = 4 /* AccessTypes.CONTEXT */;
  4404. return ctx[key];
  4405. } else if (shouldCacheAccess) {
  4406. accessCache[key] = 0 /* AccessTypes.OTHER */;
  4407. }
  4408. }
  4409. var publicGetter = publicPropertiesMap[key];
  4410. var cssModule, globalProperties;
  4411. // public $xxx properties
  4412. if (publicGetter) {
  4413. if (key === '$attrs') {
  4414. track(instance, "get" /* TrackOpTypes.GET */, key);
  4415. markAttrsAccessed();
  4416. }
  4417. return publicGetter(instance);
  4418. } else if (
  4419. // css module (injected by vue-loader)
  4420. (cssModule = type.__cssModules) && (cssModule = cssModule[key])) {
  4421. return cssModule;
  4422. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4423. // user may set custom properties to `this` that start with `$`
  4424. accessCache[key] = 4 /* AccessTypes.CONTEXT */;
  4425. return ctx[key];
  4426. } else if (
  4427. // global properties
  4428. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) {
  4429. {
  4430. return globalProperties[key];
  4431. }
  4432. } else if (currentRenderingInstance && (!isString(key) ||
  4433. // #1091 avoid internal isRef/isVNode checks on component instance leading
  4434. // to infinite warning loop
  4435. key.indexOf('__v') !== 0)) {
  4436. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4437. warn("Property ".concat(JSON.stringify(key), " must be accessed via $data because it starts with a reserved ") + "character (\"$\" or \"_\") and is not proxied on the render context.");
  4438. } else if (instance === currentRenderingInstance) {
  4439. warn("Property ".concat(JSON.stringify(key), " was accessed during render ") + "but is not defined on instance.");
  4440. }
  4441. }
  4442. },
  4443. set(_ref12, key, value) {
  4444. var {
  4445. _: instance
  4446. } = _ref12;
  4447. var {
  4448. data,
  4449. setupState,
  4450. ctx
  4451. } = instance;
  4452. if (hasSetupBinding(setupState, key)) {
  4453. setupState[key] = value;
  4454. return true;
  4455. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4456. warn("Cannot mutate <script setup> binding \"".concat(key, "\" from Options API."));
  4457. return false;
  4458. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4459. data[key] = value;
  4460. return true;
  4461. } else if (hasOwn(instance.props, key)) {
  4462. warn("Attempting to mutate prop \"".concat(key, "\". Props are readonly."));
  4463. return false;
  4464. }
  4465. if (key[0] === '$' && key.slice(1) in instance) {
  4466. warn("Attempting to mutate public property \"".concat(key, "\". ") + "Properties starting with $ are reserved and readonly.");
  4467. return false;
  4468. } else {
  4469. if (key in instance.appContext.config.globalProperties) {
  4470. Object.defineProperty(ctx, key, {
  4471. enumerable: true,
  4472. configurable: true,
  4473. value
  4474. });
  4475. } else {
  4476. ctx[key] = value;
  4477. }
  4478. }
  4479. return true;
  4480. },
  4481. has(_ref13, key) {
  4482. var {
  4483. _: {
  4484. data,
  4485. setupState,
  4486. accessCache,
  4487. ctx,
  4488. appContext,
  4489. propsOptions
  4490. }
  4491. } = _ref13;
  4492. var normalizedProps;
  4493. 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);
  4494. },
  4495. defineProperty(target, key, descriptor) {
  4496. if (descriptor.get != null) {
  4497. // invalidate key cache of a getter based property #5417
  4498. target._.accessCache[key] = 0;
  4499. } else if (hasOwn(descriptor, 'value')) {
  4500. this.set(target, key, descriptor.value, null);
  4501. }
  4502. return Reflect.defineProperty(target, key, descriptor);
  4503. }
  4504. };
  4505. {
  4506. PublicInstanceProxyHandlers.ownKeys = target => {
  4507. warn("Avoid app logic that relies on enumerating keys on a component instance. " + "The keys will be empty in production mode to avoid performance overhead.");
  4508. return Reflect.ownKeys(target);
  4509. };
  4510. }
  4511. var RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/extend$1({}, PublicInstanceProxyHandlers, {
  4512. get(target, key) {
  4513. // fast path for unscopables when using `with` block
  4514. if (key === Symbol.unscopables) {
  4515. return;
  4516. }
  4517. return PublicInstanceProxyHandlers.get(target, key, target);
  4518. },
  4519. has(_, key) {
  4520. var has = key[0] !== '_' && !isGloballyWhitelisted(key);
  4521. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4522. warn("Property ".concat(JSON.stringify(key), " should not start with _ which is a reserved prefix for Vue internals."));
  4523. }
  4524. return has;
  4525. }
  4526. });
  4527. // dev only
  4528. // In dev mode, the proxy target exposes the same properties as seen on `this`
  4529. // for easier console inspection. In prod mode it will be an empty object so
  4530. // these properties definitions can be skipped.
  4531. function createDevRenderContext(instance) {
  4532. var target = {};
  4533. // expose internal instance for proxy handlers
  4534. Object.defineProperty(target, "_", {
  4535. configurable: true,
  4536. enumerable: false,
  4537. get: () => instance
  4538. });
  4539. // expose public properties
  4540. Object.keys(publicPropertiesMap).forEach(key => {
  4541. Object.defineProperty(target, key, {
  4542. configurable: true,
  4543. enumerable: false,
  4544. get: () => publicPropertiesMap[key](instance),
  4545. // intercepted by the proxy so no need for implementation,
  4546. // but needed to prevent set errors
  4547. set: NOOP
  4548. });
  4549. });
  4550. return target;
  4551. }
  4552. // dev only
  4553. function exposePropsOnRenderContext(instance) {
  4554. var {
  4555. ctx,
  4556. propsOptions: [propsOptions]
  4557. } = instance;
  4558. if (propsOptions) {
  4559. Object.keys(propsOptions).forEach(key => {
  4560. Object.defineProperty(ctx, key, {
  4561. enumerable: true,
  4562. configurable: true,
  4563. get: () => instance.props[key],
  4564. set: NOOP
  4565. });
  4566. });
  4567. }
  4568. }
  4569. // dev only
  4570. function exposeSetupStateOnRenderContext(instance) {
  4571. var {
  4572. ctx,
  4573. setupState
  4574. } = instance;
  4575. Object.keys(toRaw(setupState)).forEach(key => {
  4576. if (!setupState.__isScriptSetup) {
  4577. if (isReservedPrefix(key[0])) {
  4578. warn("setup() return property ".concat(JSON.stringify(key), " should not start with \"$\" or \"_\" ") + "which are reserved prefixes for Vue internals.");
  4579. return;
  4580. }
  4581. Object.defineProperty(ctx, key, {
  4582. enumerable: true,
  4583. configurable: true,
  4584. get: () => setupState[key],
  4585. set: NOOP
  4586. });
  4587. }
  4588. });
  4589. }
  4590. function createDuplicateChecker() {
  4591. var cache = Object.create(null);
  4592. return (type, key) => {
  4593. if (cache[key]) {
  4594. warn("".concat(type, " property \"").concat(key, "\" is already defined in ").concat(cache[key], "."));
  4595. } else {
  4596. cache[key] = type;
  4597. }
  4598. };
  4599. }
  4600. var shouldCacheAccess = true;
  4601. function applyOptions(instance) {
  4602. var options = resolveMergedOptions(instance);
  4603. var publicThis = instance.proxy;
  4604. var ctx = instance.ctx;
  4605. // do not cache property access on public proxy during state initialization
  4606. shouldCacheAccess = false;
  4607. // call beforeCreate first before accessing other options since
  4608. // the hook may mutate resolved options (#2791)
  4609. if (options.beforeCreate) {
  4610. callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
  4611. }
  4612. var {
  4613. // state
  4614. data: dataOptions,
  4615. computed: computedOptions,
  4616. methods,
  4617. watch: watchOptions,
  4618. provide: provideOptions,
  4619. inject: injectOptions,
  4620. // lifecycle
  4621. created,
  4622. beforeMount,
  4623. mounted,
  4624. beforeUpdate,
  4625. updated,
  4626. activated,
  4627. deactivated,
  4628. beforeDestroy,
  4629. beforeUnmount,
  4630. destroyed,
  4631. unmounted,
  4632. render,
  4633. renderTracked,
  4634. renderTriggered,
  4635. errorCaptured,
  4636. serverPrefetch,
  4637. // public API
  4638. expose,
  4639. inheritAttrs,
  4640. // assets
  4641. components,
  4642. directives,
  4643. filters
  4644. } = options;
  4645. var checkDuplicateProperties = createDuplicateChecker();
  4646. {
  4647. var [propsOptions] = instance.propsOptions;
  4648. if (propsOptions) {
  4649. for (var key in propsOptions) {
  4650. checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
  4651. }
  4652. }
  4653. }
  4654. // options initialization order (to be consistent with Vue 2):
  4655. // - props (already done outside of this function)
  4656. // - inject
  4657. // - methods
  4658. // - data (deferred since it relies on `this` access)
  4659. // - computed
  4660. // - watch (deferred since it relies on `this` access)
  4661. if (injectOptions) {
  4662. resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
  4663. }
  4664. if (methods) {
  4665. for (var _key9 in methods) {
  4666. var methodHandler = methods[_key9];
  4667. if (isFunction(methodHandler)) {
  4668. // In dev mode, we use the `createRenderContext` function to define
  4669. // methods to the proxy target, and those are read-only but
  4670. // reconfigurable, so it needs to be redefined here
  4671. {
  4672. Object.defineProperty(ctx, _key9, {
  4673. value: methodHandler.bind(publicThis),
  4674. configurable: true,
  4675. enumerable: true,
  4676. writable: true
  4677. });
  4678. }
  4679. {
  4680. checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, _key9);
  4681. }
  4682. } else {
  4683. warn("Method \"".concat(_key9, "\" has type \"").concat(typeof methodHandler, "\" in the component definition. ") + "Did you reference the function correctly?");
  4684. }
  4685. }
  4686. }
  4687. if (dataOptions) {
  4688. (function () {
  4689. if (!isFunction(dataOptions)) {
  4690. warn("The data option must be a function. " + "Plain object usage is no longer supported.");
  4691. }
  4692. var data = dataOptions.call(publicThis, publicThis);
  4693. if (isPromise(data)) {
  4694. warn("data() returned a Promise - note data() cannot be async; If you " + "intend to perform data fetching before component renders, use " + "async setup() + <Suspense>.");
  4695. }
  4696. if (!isObject(data)) {
  4697. warn("data() should return an object.");
  4698. } else {
  4699. instance.data = reactive(data);
  4700. {
  4701. var _loop2 = function (_key10) {
  4702. checkDuplicateProperties("Data" /* OptionTypes.DATA */, _key10);
  4703. // expose data on ctx during dev
  4704. if (!isReservedPrefix(_key10[0])) {
  4705. Object.defineProperty(ctx, _key10, {
  4706. configurable: true,
  4707. enumerable: true,
  4708. get: () => data[_key10],
  4709. set: NOOP
  4710. });
  4711. }
  4712. };
  4713. for (var _key10 in data) {
  4714. _loop2(_key10);
  4715. }
  4716. }
  4717. }
  4718. })();
  4719. }
  4720. // state initialization complete at this point - start caching access
  4721. shouldCacheAccess = true;
  4722. if (computedOptions) {
  4723. var _loop3 = function (_key11) {
  4724. var opt = computedOptions[_key11];
  4725. var get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4726. if (get === NOOP) {
  4727. warn("Computed property \"".concat(_key11, "\" has no getter."));
  4728. }
  4729. var set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4730. warn("Write operation failed: computed property \"".concat(_key11, "\" is readonly."));
  4731. };
  4732. var c = computed({
  4733. get,
  4734. set
  4735. });
  4736. Object.defineProperty(ctx, _key11, {
  4737. enumerable: true,
  4738. configurable: true,
  4739. get: () => c.value,
  4740. set: v => c.value = v
  4741. });
  4742. {
  4743. checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, _key11);
  4744. }
  4745. };
  4746. for (var _key11 in computedOptions) {
  4747. _loop3(_key11);
  4748. }
  4749. }
  4750. if (watchOptions) {
  4751. for (var _key12 in watchOptions) {
  4752. createWatcher(watchOptions[_key12], ctx, publicThis, _key12);
  4753. }
  4754. }
  4755. if (provideOptions) {
  4756. var provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4757. Reflect.ownKeys(provides).forEach(key => {
  4758. provide(key, provides[key]);
  4759. });
  4760. }
  4761. if (created) {
  4762. callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
  4763. }
  4764. function registerLifecycleHook(register, hook) {
  4765. if (isArray(hook)) {
  4766. hook.forEach(_hook => register(_hook.bind(publicThis)));
  4767. } else if (hook) {
  4768. register(hook.bind(publicThis));
  4769. }
  4770. }
  4771. registerLifecycleHook(onBeforeMount, beforeMount);
  4772. registerLifecycleHook(onMounted, mounted);
  4773. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4774. registerLifecycleHook(onUpdated, updated);
  4775. registerLifecycleHook(onActivated, activated);
  4776. registerLifecycleHook(onDeactivated, deactivated);
  4777. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4778. registerLifecycleHook(onRenderTracked, renderTracked);
  4779. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4780. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4781. registerLifecycleHook(onUnmounted, unmounted);
  4782. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4783. if (isArray(expose)) {
  4784. if (expose.length) {
  4785. var exposed = instance.exposed || (instance.exposed = {});
  4786. expose.forEach(key => {
  4787. Object.defineProperty(exposed, key, {
  4788. get: () => publicThis[key],
  4789. set: val => publicThis[key] = val
  4790. });
  4791. });
  4792. } else if (!instance.exposed) {
  4793. instance.exposed = {};
  4794. }
  4795. }
  4796. // options that are handled when creating the instance but also need to be
  4797. // applied from mixins
  4798. if (render && instance.render === NOOP) {
  4799. instance.render = render;
  4800. }
  4801. if (inheritAttrs != null) {
  4802. instance.inheritAttrs = inheritAttrs;
  4803. }
  4804. // asset options.
  4805. if (components) instance.components = components;
  4806. if (directives) instance.directives = directives;
  4807. // fixed by xxxxxx
  4808. var customApplyOptions = instance.appContext.config.globalProperties.$applyOptions;
  4809. if (customApplyOptions) {
  4810. customApplyOptions(options, instance, publicThis);
  4811. }
  4812. }
  4813. function resolveInjections(injectOptions, ctx) {
  4814. var checkDuplicateProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : NOOP;
  4815. var unwrapRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  4816. if (isArray(injectOptions)) {
  4817. injectOptions = normalizeInject(injectOptions);
  4818. }
  4819. var _loop4 = function (key) {
  4820. var opt = injectOptions[key];
  4821. var injected = void 0;
  4822. if (isObject(opt)) {
  4823. if ('default' in opt) {
  4824. injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
  4825. } else {
  4826. injected = inject(opt.from || key);
  4827. }
  4828. } else {
  4829. injected = inject(opt);
  4830. }
  4831. if (isRef(injected)) {
  4832. // TODO remove the check in 3.3
  4833. if (unwrapRef) {
  4834. Object.defineProperty(ctx, key, {
  4835. enumerable: true,
  4836. configurable: true,
  4837. get: () => injected.value,
  4838. set: v => injected.value = v
  4839. });
  4840. } else {
  4841. {
  4842. warn("injected property \"".concat(key, "\" is a ref and will be auto-unwrapped ") + "and no longer needs `.value` in the next minor release. " + "To opt-in to the new behavior now, " + "set `app.config.unwrapInjectedRef = true` (this config is " + "temporary and will not be needed in the future.)");
  4843. }
  4844. ctx[key] = injected;
  4845. }
  4846. } else {
  4847. ctx[key] = injected;
  4848. }
  4849. {
  4850. checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
  4851. }
  4852. };
  4853. for (var key in injectOptions) {
  4854. _loop4(key);
  4855. }
  4856. }
  4857. function callHook(hook, instance, type) {
  4858. callWithAsyncErrorHandling(isArray(hook) ? hook.map(h => h.bind(instance.proxy)) : hook.bind(instance.proxy), instance, type);
  4859. }
  4860. function createWatcher(raw, ctx, publicThis, key) {
  4861. var getter = key.includes('.') ? createPathGetter(publicThis, key) : () => publicThis[key];
  4862. if (isString(raw)) {
  4863. var handler = ctx[raw];
  4864. if (isFunction(handler)) {
  4865. watch(getter, handler);
  4866. } else {
  4867. warn("Invalid watch handler specified by key \"".concat(raw, "\""), handler);
  4868. }
  4869. } else if (isFunction(raw)) {
  4870. watch(getter, raw.bind(publicThis));
  4871. } else if (isObject(raw)) {
  4872. if (isArray(raw)) {
  4873. raw.forEach(r => createWatcher(r, ctx, publicThis, key));
  4874. } else {
  4875. var _handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4876. if (isFunction(_handler)) {
  4877. watch(getter, _handler, raw);
  4878. } else {
  4879. warn("Invalid watch handler specified by key \"".concat(raw.handler, "\""), _handler);
  4880. }
  4881. }
  4882. } else {
  4883. warn("Invalid watch option: \"".concat(key, "\""), raw);
  4884. }
  4885. }
  4886. /**
  4887. * Resolve merged options and cache it on the component.
  4888. * This is done only once per-component since the merging does not involve
  4889. * instances.
  4890. */
  4891. function resolveMergedOptions(instance) {
  4892. var base = instance.type;
  4893. var {
  4894. mixins,
  4895. extends: extendsOptions
  4896. } = base;
  4897. var {
  4898. mixins: globalMixins,
  4899. optionsCache: cache,
  4900. config: {
  4901. optionMergeStrategies
  4902. }
  4903. } = instance.appContext;
  4904. var cached = cache.get(base);
  4905. var resolved;
  4906. if (cached) {
  4907. resolved = cached;
  4908. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4909. {
  4910. resolved = base;
  4911. }
  4912. } else {
  4913. resolved = {};
  4914. if (globalMixins.length) {
  4915. globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
  4916. }
  4917. mergeOptions(resolved, base, optionMergeStrategies);
  4918. }
  4919. if (isObject(base)) {
  4920. cache.set(base, resolved);
  4921. }
  4922. return resolved;
  4923. }
  4924. function mergeOptions(to, from, strats) {
  4925. var asMixin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  4926. var {
  4927. mixins,
  4928. extends: extendsOptions
  4929. } = from;
  4930. if (extendsOptions) {
  4931. mergeOptions(to, extendsOptions, strats, true);
  4932. }
  4933. if (mixins) {
  4934. mixins.forEach(m => mergeOptions(to, m, strats, true));
  4935. }
  4936. for (var key in from) {
  4937. if (asMixin && key === 'expose') {
  4938. warn("\"expose\" option is ignored when declared in mixins or extends. " + "It should only be declared in the base component itself.");
  4939. } else {
  4940. var strat = internalOptionMergeStrats[key] || strats && strats[key];
  4941. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4942. }
  4943. }
  4944. return to;
  4945. }
  4946. var internalOptionMergeStrats = {
  4947. data: mergeDataFn,
  4948. props: mergeObjectOptions,
  4949. emits: mergeObjectOptions,
  4950. // objects
  4951. methods: mergeObjectOptions,
  4952. computed: mergeObjectOptions,
  4953. // lifecycle
  4954. beforeCreate: mergeAsArray,
  4955. created: mergeAsArray,
  4956. beforeMount: mergeAsArray,
  4957. mounted: mergeAsArray,
  4958. beforeUpdate: mergeAsArray,
  4959. updated: mergeAsArray,
  4960. beforeDestroy: mergeAsArray,
  4961. beforeUnmount: mergeAsArray,
  4962. destroyed: mergeAsArray,
  4963. unmounted: mergeAsArray,
  4964. activated: mergeAsArray,
  4965. deactivated: mergeAsArray,
  4966. errorCaptured: mergeAsArray,
  4967. serverPrefetch: mergeAsArray,
  4968. // assets
  4969. components: mergeObjectOptions,
  4970. directives: mergeObjectOptions,
  4971. // watch
  4972. watch: mergeWatchOptions,
  4973. // provide / inject
  4974. provide: mergeDataFn,
  4975. inject: mergeInject
  4976. };
  4977. function mergeDataFn(to, from) {
  4978. if (!from) {
  4979. return to;
  4980. }
  4981. if (!to) {
  4982. return from;
  4983. }
  4984. return function mergedDataFn() {
  4985. return extend$1(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
  4986. };
  4987. }
  4988. function mergeInject(to, from) {
  4989. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4990. }
  4991. function normalizeInject(raw) {
  4992. if (isArray(raw)) {
  4993. var res = {};
  4994. for (var i = 0; i < raw.length; i++) {
  4995. res[raw[i]] = raw[i];
  4996. }
  4997. return res;
  4998. }
  4999. return raw;
  5000. }
  5001. function mergeAsArray(to, from) {
  5002. return to ? [...new Set([].concat(to, from))] : from;
  5003. }
  5004. function mergeObjectOptions(to, from) {
  5005. return to ? extend$1(extend$1(Object.create(null), to), from) : from;
  5006. }
  5007. function mergeWatchOptions(to, from) {
  5008. if (!to) return from;
  5009. if (!from) return to;
  5010. var merged = extend$1(Object.create(null), to);
  5011. for (var key in from) {
  5012. merged[key] = mergeAsArray(to[key], from[key]);
  5013. }
  5014. return merged;
  5015. }
  5016. function initProps(instance, rawProps, isStateful) {
  5017. var isSSR = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5018. var props = {};
  5019. var attrs = {};
  5020. def(attrs, InternalObjectKey, 1);
  5021. instance.propsDefaults = Object.create(null);
  5022. setFullProps(instance, rawProps, props, attrs);
  5023. // ensure all declared prop keys are present
  5024. for (var key in instance.propsOptions[0]) {
  5025. if (!(key in props)) {
  5026. props[key] = undefined;
  5027. }
  5028. }
  5029. // validation
  5030. {
  5031. validateProps(rawProps || {}, props, instance);
  5032. }
  5033. if (isStateful) {
  5034. // stateful
  5035. instance.props = isSSR ? props : shallowReactive(props);
  5036. } else {
  5037. if (!instance.type.props) {
  5038. // functional w/ optional props, props === attrs
  5039. instance.props = attrs;
  5040. } else {
  5041. // functional w/ declared props
  5042. instance.props = props;
  5043. }
  5044. }
  5045. instance.attrs = attrs;
  5046. }
  5047. function isInHmrContext(instance) {
  5048. while (instance) {
  5049. if (instance.type.__hmrId) return true;
  5050. instance = instance.parent;
  5051. }
  5052. }
  5053. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5054. var {
  5055. props,
  5056. attrs,
  5057. vnode: {
  5058. patchFlag
  5059. }
  5060. } = instance;
  5061. var rawCurrentProps = toRaw(props);
  5062. var [options] = instance.propsOptions;
  5063. var hasAttrsChanged = false;
  5064. if (
  5065. // always force full diff in dev
  5066. // - #1942 if hmr is enabled with sfc component
  5067. // - vite#872 non-sfc component used by sfc component
  5068. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
  5069. if (patchFlag & 8 /* PatchFlags.PROPS */) {
  5070. // Compiler-generated props & no keys change, just set the updated
  5071. // the props.
  5072. var propsToUpdate = instance.vnode.dynamicProps;
  5073. for (var i = 0; i < propsToUpdate.length; i++) {
  5074. var key = propsToUpdate[i];
  5075. // skip if the prop key is a declared emit event listener
  5076. if (isEmitListener(instance.emitsOptions, key)) {
  5077. continue;
  5078. }
  5079. // PROPS flag guarantees rawProps to be non-null
  5080. var value = rawProps[key];
  5081. if (options) {
  5082. // attr / props separation was done on init and will be consistent
  5083. // in this code path, so just check if attrs have it.
  5084. if (hasOwn(attrs, key)) {
  5085. if (value !== attrs[key]) {
  5086. attrs[key] = value;
  5087. hasAttrsChanged = true;
  5088. }
  5089. } else {
  5090. var camelizedKey = camelize(key);
  5091. props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
  5092. }
  5093. } else {
  5094. if (value !== attrs[key]) {
  5095. attrs[key] = value;
  5096. hasAttrsChanged = true;
  5097. }
  5098. }
  5099. }
  5100. }
  5101. } else {
  5102. // full props update.
  5103. if (setFullProps(instance, rawProps, props, attrs)) {
  5104. hasAttrsChanged = true;
  5105. }
  5106. // in case of dynamic props, check if we need to delete keys from
  5107. // the props object
  5108. var kebabKey;
  5109. for (var _key13 in rawCurrentProps) {
  5110. if (!rawProps ||
  5111. // for camelCase
  5112. !hasOwn(rawProps, _key13) && (
  5113. // it's possible the original props was passed in as kebab-case
  5114. // and converted to camelCase (#955)
  5115. (kebabKey = hyphenate(_key13)) === _key13 || !hasOwn(rawProps, kebabKey))) {
  5116. if (options) {
  5117. if (rawPrevProps && (
  5118. // for camelCase
  5119. rawPrevProps[_key13] !== undefined ||
  5120. // for kebab-case
  5121. rawPrevProps[kebabKey] !== undefined)) {
  5122. props[_key13] = resolvePropValue(options, rawCurrentProps, _key13, undefined, instance, true /* isAbsent */);
  5123. }
  5124. } else {
  5125. delete props[_key13];
  5126. }
  5127. }
  5128. }
  5129. // in the case of functional component w/o props declaration, props and
  5130. // attrs point to the same object so it should already have been updated.
  5131. if (attrs !== rawCurrentProps) {
  5132. for (var _key14 in attrs) {
  5133. if (!rawProps || !hasOwn(rawProps, _key14) && !false) {
  5134. delete attrs[_key14];
  5135. hasAttrsChanged = true;
  5136. }
  5137. }
  5138. }
  5139. }
  5140. // trigger updates for $attrs in case it's used in component slots
  5141. if (hasAttrsChanged) {
  5142. trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
  5143. }
  5144. {
  5145. validateProps(rawProps || {}, props, instance);
  5146. }
  5147. }
  5148. function setFullProps(instance, rawProps, props, attrs) {
  5149. var [options, needCastKeys] = instance.propsOptions;
  5150. var hasAttrsChanged = false;
  5151. var rawCastValues;
  5152. if (rawProps) {
  5153. for (var key in rawProps) {
  5154. // key, ref are reserved and never passed down
  5155. if (isReservedProp(key)) {
  5156. continue;
  5157. }
  5158. var value = rawProps[key];
  5159. // prop option names are camelized during normalization, so to support
  5160. // kebab -> camel conversion here we need to camelize the key.
  5161. var camelKey = void 0;
  5162. if (options && hasOwn(options, camelKey = camelize(key))) {
  5163. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5164. props[camelKey] = value;
  5165. } else {
  5166. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5167. }
  5168. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5169. if (!(key in attrs) || value !== attrs[key]) {
  5170. attrs[key] = value;
  5171. hasAttrsChanged = true;
  5172. }
  5173. }
  5174. }
  5175. }
  5176. if (needCastKeys) {
  5177. var rawCurrentProps = toRaw(props);
  5178. var castValues = rawCastValues || EMPTY_OBJ;
  5179. for (var i = 0; i < needCastKeys.length; i++) {
  5180. var _key15 = needCastKeys[i];
  5181. props[_key15] = resolvePropValue(options, rawCurrentProps, _key15, castValues[_key15], instance, !hasOwn(castValues, _key15));
  5182. }
  5183. }
  5184. return hasAttrsChanged;
  5185. }
  5186. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5187. var opt = options[key];
  5188. if (opt != null) {
  5189. var hasDefault = hasOwn(opt, 'default');
  5190. // default values
  5191. if (hasDefault && value === undefined) {
  5192. var defaultValue = opt.default;
  5193. if (opt.type !== Function && isFunction(defaultValue)) {
  5194. var {
  5195. propsDefaults
  5196. } = instance;
  5197. if (key in propsDefaults) {
  5198. value = propsDefaults[key];
  5199. } else {
  5200. setCurrentInstance(instance);
  5201. value = propsDefaults[key] = defaultValue.call(null, props);
  5202. unsetCurrentInstance();
  5203. }
  5204. } else {
  5205. value = defaultValue;
  5206. }
  5207. }
  5208. // boolean casting
  5209. if (opt[0 /* BooleanFlags.shouldCast */]) {
  5210. if (isAbsent && !hasDefault) {
  5211. value = false;
  5212. } else if (opt[1 /* BooleanFlags.shouldCastTrue */] && (value === '' || value === hyphenate(key))) {
  5213. value = true;
  5214. }
  5215. }
  5216. }
  5217. return value;
  5218. }
  5219. function normalizePropsOptions(comp, appContext) {
  5220. var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  5221. var cache = appContext.propsCache;
  5222. var cached = cache.get(comp);
  5223. if (cached) {
  5224. return cached;
  5225. }
  5226. var raw = comp.props;
  5227. var normalized = {};
  5228. var needCastKeys = [];
  5229. // apply mixin/extends props
  5230. var hasExtends = false;
  5231. if (!isFunction(comp)) {
  5232. var extendProps = raw => {
  5233. hasExtends = true;
  5234. var [props, keys] = normalizePropsOptions(raw, appContext, true);
  5235. extend$1(normalized, props);
  5236. if (keys) needCastKeys.push(...keys);
  5237. };
  5238. if (!asMixin && appContext.mixins.length) {
  5239. appContext.mixins.forEach(extendProps);
  5240. }
  5241. if (comp.extends) {
  5242. extendProps(comp.extends);
  5243. }
  5244. if (comp.mixins) {
  5245. comp.mixins.forEach(extendProps);
  5246. }
  5247. }
  5248. if (!raw && !hasExtends) {
  5249. if (isObject(comp)) {
  5250. cache.set(comp, EMPTY_ARR);
  5251. }
  5252. return EMPTY_ARR;
  5253. }
  5254. if (isArray(raw)) {
  5255. for (var i = 0; i < raw.length; i++) {
  5256. if (!isString(raw[i])) {
  5257. warn("props must be strings when using array syntax.", raw[i]);
  5258. }
  5259. var normalizedKey = camelize(raw[i]);
  5260. if (validatePropName(normalizedKey)) {
  5261. normalized[normalizedKey] = EMPTY_OBJ;
  5262. }
  5263. }
  5264. } else if (raw) {
  5265. if (!isObject(raw)) {
  5266. warn("invalid props options", raw);
  5267. }
  5268. for (var key in raw) {
  5269. var _normalizedKey = camelize(key);
  5270. if (validatePropName(_normalizedKey)) {
  5271. var opt = raw[key];
  5272. var prop = normalized[_normalizedKey] = isArray(opt) || isFunction(opt) ? {
  5273. type: opt
  5274. } : Object.assign({}, opt);
  5275. if (prop) {
  5276. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5277. var stringIndex = getTypeIndex(String, prop.type);
  5278. prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
  5279. prop[1 /* BooleanFlags.shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5280. // if the prop needs boolean casting or default value
  5281. if (booleanIndex > -1 || hasOwn(prop, 'default')) {
  5282. needCastKeys.push(_normalizedKey);
  5283. }
  5284. }
  5285. }
  5286. }
  5287. }
  5288. var res = [normalized, needCastKeys];
  5289. if (isObject(comp)) {
  5290. cache.set(comp, res);
  5291. }
  5292. return res;
  5293. }
  5294. function validatePropName(key) {
  5295. if (key[0] !== '$') {
  5296. return true;
  5297. } else {
  5298. warn("Invalid prop name: \"".concat(key, "\" is a reserved property."));
  5299. }
  5300. return false;
  5301. }
  5302. // use function string name to check type constructors
  5303. // so that it works across vms / iframes.
  5304. function getType(ctor) {
  5305. var match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  5306. return match ? match[2] : ctor === null ? 'null' : '';
  5307. }
  5308. function isSameType(a, b) {
  5309. return getType(a) === getType(b);
  5310. }
  5311. function getTypeIndex(type, expectedTypes) {
  5312. if (isArray(expectedTypes)) {
  5313. return expectedTypes.findIndex(t => isSameType(t, type));
  5314. } else if (isFunction(expectedTypes)) {
  5315. return isSameType(expectedTypes, type) ? 0 : -1;
  5316. }
  5317. return -1;
  5318. }
  5319. /**
  5320. * dev only
  5321. */
  5322. function validateProps(rawProps, props, instance) {
  5323. var resolvedValues = toRaw(props);
  5324. var options = instance.propsOptions[0];
  5325. for (var key in options) {
  5326. var opt = options[key];
  5327. if (opt == null) continue;
  5328. validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
  5329. }
  5330. }
  5331. /**
  5332. * dev only
  5333. */
  5334. function validateProp(name, value, prop, isAbsent) {
  5335. var {
  5336. type,
  5337. required,
  5338. validator
  5339. } = prop;
  5340. // required!
  5341. if (required && isAbsent) {
  5342. warn('Missing required prop: "' + name + '"');
  5343. return;
  5344. }
  5345. // missing but optional
  5346. if (value == null && !prop.required) {
  5347. return;
  5348. }
  5349. // type check
  5350. if (type != null && type !== true) {
  5351. var isValid = false;
  5352. var types = isArray(type) ? type : [type];
  5353. var expectedTypes = [];
  5354. // value is valid as long as one of the specified types match
  5355. for (var i = 0; i < types.length && !isValid; i++) {
  5356. var {
  5357. valid,
  5358. expectedType
  5359. } = assertType(value, types[i]);
  5360. expectedTypes.push(expectedType || '');
  5361. isValid = valid;
  5362. }
  5363. if (!isValid) {
  5364. warn(getInvalidTypeMessage(name, value, expectedTypes));
  5365. return;
  5366. }
  5367. }
  5368. // custom validator
  5369. if (validator && !validator(value)) {
  5370. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  5371. }
  5372. }
  5373. var isSimpleType = /*#__PURE__*/makeMap('String,Number,Boolean,Function,Symbol,BigInt');
  5374. /**
  5375. * dev only
  5376. */
  5377. function assertType(value, type) {
  5378. var valid;
  5379. var expectedType = getType(type);
  5380. if (isSimpleType(expectedType)) {
  5381. var t = typeof value;
  5382. valid = t === expectedType.toLowerCase();
  5383. // for primitive wrapper objects
  5384. if (!valid && t === 'object') {
  5385. valid = value instanceof type;
  5386. }
  5387. } else if (expectedType === 'Object') {
  5388. valid = isObject(value);
  5389. } else if (expectedType === 'Array') {
  5390. valid = isArray(value);
  5391. } else if (expectedType === 'null') {
  5392. valid = value === null;
  5393. } else {
  5394. valid = value instanceof type;
  5395. }
  5396. return {
  5397. valid,
  5398. expectedType
  5399. };
  5400. }
  5401. /**
  5402. * dev only
  5403. */
  5404. function getInvalidTypeMessage(name, value, expectedTypes) {
  5405. var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") + " Expected ".concat(expectedTypes.map(capitalize).join(' | '));
  5406. var expectedType = expectedTypes[0];
  5407. var receivedType = toRawType(value);
  5408. var expectedValue = styleValue(value, expectedType);
  5409. var receivedValue = styleValue(value, receivedType);
  5410. // check if we need to specify expected value
  5411. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5412. message += " with value ".concat(expectedValue);
  5413. }
  5414. message += ", got ".concat(receivedType, " ");
  5415. // check if we need to specify received value
  5416. if (isExplicable(receivedType)) {
  5417. message += "with value ".concat(receivedValue, ".");
  5418. }
  5419. return message;
  5420. }
  5421. /**
  5422. * dev only
  5423. */
  5424. function styleValue(value, type) {
  5425. if (type === 'String') {
  5426. return "\"".concat(value, "\"");
  5427. } else if (type === 'Number') {
  5428. return "".concat(Number(value));
  5429. } else {
  5430. return "".concat(value);
  5431. }
  5432. }
  5433. /**
  5434. * dev only
  5435. */
  5436. function isExplicable(type) {
  5437. var explicitTypes = ['string', 'number', 'boolean'];
  5438. return explicitTypes.some(elem => type.toLowerCase() === elem);
  5439. }
  5440. /**
  5441. * dev only
  5442. */
  5443. function isBoolean() {
  5444. for (var _len8 = arguments.length, args = new Array(_len8), _key16 = 0; _key16 < _len8; _key16++) {
  5445. args[_key16] = arguments[_key16];
  5446. }
  5447. return args.some(elem => elem.toLowerCase() === 'boolean');
  5448. }
  5449. var isInternalKey = key => key[0] === '_' || key === '$stable';
  5450. var normalizeSlotValue = value => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5451. var normalizeSlot = (key, rawSlot, ctx) => {
  5452. if (rawSlot._n) {
  5453. // already normalized - #5353
  5454. return rawSlot;
  5455. }
  5456. var normalized = withCtx(function () {
  5457. if ("development" !== 'production' && currentInstance) {
  5458. warn("Slot \"".concat(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.");
  5459. }
  5460. return normalizeSlotValue(rawSlot(...arguments));
  5461. }, ctx);
  5462. normalized._c = false;
  5463. return normalized;
  5464. };
  5465. var normalizeObjectSlots = (rawSlots, slots, instance) => {
  5466. var ctx = rawSlots._ctx;
  5467. for (var key in rawSlots) {
  5468. if (isInternalKey(key)) continue;
  5469. var value = rawSlots[key];
  5470. if (isFunction(value)) {
  5471. slots[key] = normalizeSlot(key, value, ctx);
  5472. } else if (value != null) {
  5473. (function () {
  5474. {
  5475. warn("Non-function value encountered for slot \"".concat(key, "\". ") + "Prefer function slots for better performance.");
  5476. }
  5477. var normalized = normalizeSlotValue(value);
  5478. slots[key] = () => normalized;
  5479. })();
  5480. }
  5481. }
  5482. };
  5483. var normalizeVNodeSlots = (instance, children) => {
  5484. if (!isKeepAlive(instance.vnode) && !false) {
  5485. warn("Non-function value encountered for default slot. " + "Prefer function slots for better performance.");
  5486. }
  5487. var normalized = normalizeSlotValue(children);
  5488. instance.slots.default = () => normalized;
  5489. };
  5490. var initSlots = (instance, children) => {
  5491. if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
  5492. var type = children._;
  5493. if (type) {
  5494. // users can get the shallow readonly version of the slots object through `this.$slots`,
  5495. // we should avoid the proxy object polluting the slots of the internal instance
  5496. instance.slots = toRaw(children);
  5497. // make compiler marker non-enumerable
  5498. def(children, '_', type);
  5499. } else {
  5500. normalizeObjectSlots(children, instance.slots = {});
  5501. }
  5502. } else {
  5503. instance.slots = {};
  5504. if (children) {
  5505. normalizeVNodeSlots(instance, children);
  5506. }
  5507. }
  5508. def(instance.slots, InternalObjectKey, 1);
  5509. };
  5510. var updateSlots = (instance, children, optimized) => {
  5511. var {
  5512. vnode,
  5513. slots
  5514. } = instance;
  5515. var needDeletionCheck = true;
  5516. var deletionComparisonTarget = EMPTY_OBJ;
  5517. if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
  5518. var type = children._;
  5519. if (type) {
  5520. // compiled slots.
  5521. if (isHmrUpdating) {
  5522. // Parent was HMR updated so slot content may have changed.
  5523. // force update slots and mark instance for hmr as well
  5524. extend$1(slots, children);
  5525. } else if (optimized && type === 1 /* SlotFlags.STABLE */) {
  5526. // compiled AND stable.
  5527. // no need to update, and skip stale slots removal.
  5528. needDeletionCheck = false;
  5529. } else {
  5530. // compiled but dynamic (v-if/v-for on slots) - update slots, but skip
  5531. // normalization.
  5532. extend$1(slots, children);
  5533. // #2893
  5534. // when rendering the optimized slots by manually written render function,
  5535. // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
  5536. // i.e. let the `renderSlot` create the bailed Fragment
  5537. if (!optimized && type === 1 /* SlotFlags.STABLE */) {
  5538. delete slots._;
  5539. }
  5540. }
  5541. } else {
  5542. needDeletionCheck = !children.$stable;
  5543. normalizeObjectSlots(children, slots);
  5544. }
  5545. deletionComparisonTarget = children;
  5546. } else if (children) {
  5547. // non slot object children (direct value) passed to a component
  5548. normalizeVNodeSlots(instance, children);
  5549. deletionComparisonTarget = {
  5550. default: 1
  5551. };
  5552. }
  5553. // delete stale slots
  5554. if (needDeletionCheck) {
  5555. for (var key in slots) {
  5556. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  5557. delete slots[key];
  5558. }
  5559. }
  5560. }
  5561. };
  5562. function createAppContext() {
  5563. return {
  5564. app: null,
  5565. config: {
  5566. isNativeTag: NO,
  5567. performance: false,
  5568. globalProperties: {},
  5569. optionMergeStrategies: {},
  5570. errorHandler: undefined,
  5571. warnHandler: undefined,
  5572. compilerOptions: {}
  5573. },
  5574. mixins: [],
  5575. components: {},
  5576. directives: {},
  5577. provides: Object.create(null),
  5578. optionsCache: new WeakMap(),
  5579. propsCache: new WeakMap(),
  5580. emitsCache: new WeakMap()
  5581. };
  5582. }
  5583. var uid$1 = 0;
  5584. function createAppAPI(render, hydrate) {
  5585. return function createApp(rootComponent) {
  5586. var rootProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  5587. if (!isFunction(rootComponent)) {
  5588. rootComponent = Object.assign({}, rootComponent);
  5589. }
  5590. if (rootProps != null && !isObject(rootProps)) {
  5591. warn("root props passed to app.mount() must be an object.");
  5592. rootProps = null;
  5593. }
  5594. var context = createAppContext();
  5595. var installedPlugins = new Set();
  5596. var isMounted = false;
  5597. var app = context.app = {
  5598. _uid: uid$1++,
  5599. _component: rootComponent,
  5600. _props: rootProps,
  5601. _container: null,
  5602. _context: context,
  5603. _instance: null,
  5604. version,
  5605. get config() {
  5606. return context.config;
  5607. },
  5608. set config(v) {
  5609. {
  5610. warn("app.config cannot be replaced. Modify individual options instead.");
  5611. }
  5612. },
  5613. use(plugin) {
  5614. for (var _len9 = arguments.length, options = new Array(_len9 > 1 ? _len9 - 1 : 0), _key17 = 1; _key17 < _len9; _key17++) {
  5615. options[_key17 - 1] = arguments[_key17];
  5616. }
  5617. if (installedPlugins.has(plugin)) {
  5618. warn("Plugin has already been applied to target app.");
  5619. } else if (plugin && isFunction(plugin.install)) {
  5620. installedPlugins.add(plugin);
  5621. plugin.install(app, ...options);
  5622. } else if (isFunction(plugin)) {
  5623. installedPlugins.add(plugin);
  5624. plugin(app, ...options);
  5625. } else {
  5626. warn("A plugin must either be a function or an object with an \"install\" " + "function.");
  5627. }
  5628. return app;
  5629. },
  5630. mixin(mixin) {
  5631. {
  5632. if (!context.mixins.includes(mixin)) {
  5633. context.mixins.push(mixin);
  5634. } else {
  5635. warn('Mixin has already been applied to target app' + (mixin.name ? ": ".concat(mixin.name) : ''));
  5636. }
  5637. }
  5638. return app;
  5639. },
  5640. component(name, component) {
  5641. {
  5642. validateComponentName(name, context.config);
  5643. }
  5644. if (!component) {
  5645. return context.components[name];
  5646. }
  5647. if (context.components[name]) {
  5648. warn("Component \"".concat(name, "\" has already been registered in target app."));
  5649. }
  5650. context.components[name] = component;
  5651. return app;
  5652. },
  5653. directive(name, directive) {
  5654. {
  5655. validateDirectiveName(name);
  5656. }
  5657. if (!directive) {
  5658. return context.directives[name];
  5659. }
  5660. if (context.directives[name]) {
  5661. warn("Directive \"".concat(name, "\" has already been registered in target app."));
  5662. }
  5663. context.directives[name] = directive;
  5664. return app;
  5665. },
  5666. mount(rootContainer, isHydrate, isSVG) {
  5667. if (!isMounted) {
  5668. // #5571
  5669. if (rootContainer.__vue_app__) {
  5670. warn("There is already an app instance mounted on the host container.\n" + " If you want to mount another app on the same host container," + " you need to unmount the previous app by calling `app.unmount()` first.");
  5671. }
  5672. var vnode = createVNode(rootComponent, rootProps);
  5673. // store app context on the root VNode.
  5674. // this will be set on the root instance on initial mount.
  5675. vnode.appContext = context;
  5676. // HMR root reload
  5677. {
  5678. context.reload = () => {
  5679. render(cloneVNode(vnode), rootContainer, isSVG);
  5680. };
  5681. }
  5682. if (isHydrate && hydrate) {
  5683. hydrate(vnode, rootContainer);
  5684. } else {
  5685. render(vnode, rootContainer, isSVG);
  5686. }
  5687. isMounted = true;
  5688. app._container = rootContainer;
  5689. rootContainer.__vue_app__ = app;
  5690. // fixed by xxxxxx (始终暴露,因为 onError 要访问)
  5691. app._instance = vnode.component;
  5692. {
  5693. devtoolsInitApp(app, version);
  5694. }
  5695. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5696. } else {
  5697. warn("App has already been mounted.\n" + "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)`");
  5698. }
  5699. },
  5700. unmount() {
  5701. if (isMounted) {
  5702. render(null, app._container);
  5703. {
  5704. app._instance = null;
  5705. devtoolsUnmountApp(app);
  5706. }
  5707. delete app._container.__vue_app__;
  5708. } else {
  5709. warn("Cannot unmount an app that is not mounted.");
  5710. }
  5711. },
  5712. provide(key, value) {
  5713. if (key in context.provides) {
  5714. warn("App already provides property with key \"".concat(String(key), "\". ") + "It will be overwritten with the new value.");
  5715. }
  5716. context.provides[key] = value;
  5717. return app;
  5718. }
  5719. };
  5720. return app;
  5721. };
  5722. }
  5723. /**
  5724. * Function for handling a template ref
  5725. */
  5726. function setRef(rawRef, oldRawRef, parentSuspense, vnode) {
  5727. var isUnmount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5728. if (isArray(rawRef)) {
  5729. rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
  5730. return;
  5731. }
  5732. if (isAsyncWrapper(vnode) && !isUnmount) {
  5733. // when mounting async components, nothing needs to be done,
  5734. // because the template ref is forwarded to inner component
  5735. return;
  5736. }
  5737. var refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && !vnode.component.type.rootElement // fixed by xxxxxx 非 x 项目或者非内置组件
  5738. ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  5739. var value = isUnmount ? null : refValue;
  5740. var {
  5741. i: owner,
  5742. r: ref
  5743. } = rawRef;
  5744. if (!owner) {
  5745. warn("Missing ref owner context. ref cannot be used on hoisted vnodes. " + "A vnode with ref must be created inside the render function.");
  5746. return;
  5747. }
  5748. var oldRef = oldRawRef && oldRawRef.r;
  5749. var refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  5750. var setupState = owner.setupState;
  5751. // dynamic ref changed. unset old ref
  5752. if (oldRef != null && oldRef !== ref) {
  5753. if (isString(oldRef)) {
  5754. refs[oldRef] = null;
  5755. if (hasOwn(setupState, oldRef)) {
  5756. setupState[oldRef] = null;
  5757. }
  5758. } else if (isRef(oldRef)) {
  5759. oldRef.value = null;
  5760. }
  5761. }
  5762. if (isFunction(ref)) {
  5763. callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
  5764. } else {
  5765. var _isString = isString(ref);
  5766. var _isRef = isRef(ref);
  5767. if (_isString || _isRef) {
  5768. var doSet = () => {
  5769. if (rawRef.f) {
  5770. var existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  5771. if (isUnmount) {
  5772. isArray(existing) && remove(existing, refValue);
  5773. } else {
  5774. if (!isArray(existing)) {
  5775. if (_isString) {
  5776. refs[ref] = [refValue];
  5777. if (hasOwn(setupState, ref)) {
  5778. setupState[ref] = refs[ref];
  5779. }
  5780. } else {
  5781. ref.value = [refValue];
  5782. if (rawRef.k) refs[rawRef.k] = ref.value;
  5783. }
  5784. } else if (!existing.includes(refValue)) {
  5785. existing.push(refValue);
  5786. }
  5787. }
  5788. } else if (_isString) {
  5789. refs[ref] = value;
  5790. if (hasOwn(setupState, ref)) {
  5791. setupState[ref] = value;
  5792. }
  5793. } else if (_isRef) {
  5794. ref.value = value;
  5795. if (rawRef.k) refs[rawRef.k] = value;
  5796. } else {
  5797. warn('Invalid template ref type:', ref, "(".concat(typeof ref, ")"));
  5798. }
  5799. };
  5800. if (value) {
  5801. doSet.id = -1;
  5802. queuePostRenderEffect(doSet, parentSuspense);
  5803. } else {
  5804. doSet();
  5805. }
  5806. } else {
  5807. warn('Invalid template ref type:', ref, "(".concat(typeof ref, ")"));
  5808. }
  5809. }
  5810. }
  5811. var hasMismatch = false;
  5812. var isSVGContainer = container => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
  5813. var isComment = node => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
  5814. // Note: hydration is DOM-specific
  5815. // But we have to place it in core due to tight coupling with core - splitting
  5816. // it out creates a ton of unnecessary complexity.
  5817. // Hydration also depends on some renderer internal logic which needs to be
  5818. // passed in via arguments.
  5819. function createHydrationFunctions(rendererInternals) {
  5820. var {
  5821. mt: mountComponent,
  5822. p: patch,
  5823. o: {
  5824. patchProp,
  5825. createText,
  5826. nextSibling,
  5827. parentNode,
  5828. remove,
  5829. insert,
  5830. createComment
  5831. }
  5832. } = rendererInternals;
  5833. var hydrate = (vnode, container) => {
  5834. if (!container.hasChildNodes()) {
  5835. warn("Attempting to hydrate existing markup but container is empty. " + "Performing full mount instead.");
  5836. patch(null, vnode, container);
  5837. flushPostFlushCbs();
  5838. container._vnode = vnode;
  5839. return;
  5840. }
  5841. hasMismatch = false;
  5842. hydrateNode(container.firstChild, vnode, null, null, null);
  5843. flushPostFlushCbs();
  5844. container._vnode = vnode;
  5845. if (hasMismatch && !false) {
  5846. // this error should show up in production
  5847. console.error("Hydration completed but contains mismatches.");
  5848. }
  5849. };
  5850. var hydrateNode = function (node, vnode, parentComponent, parentSuspense, slotScopeIds) {
  5851. var optimized = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  5852. var isFragmentStart = isComment(node) && node.data === '[';
  5853. var onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
  5854. var {
  5855. type,
  5856. ref,
  5857. shapeFlag,
  5858. patchFlag
  5859. } = vnode;
  5860. var domType = node.nodeType;
  5861. vnode.el = node;
  5862. if (patchFlag === -2 /* PatchFlags.BAIL */) {
  5863. optimized = false;
  5864. vnode.dynamicChildren = null;
  5865. }
  5866. var nextNode = null;
  5867. switch (type) {
  5868. case Text:
  5869. if (domType !== 3 /* DOMNodeTypes.TEXT */) {
  5870. // #5728 empty text node inside a slot can cause hydration failure
  5871. // because the server rendered HTML won't contain a text node
  5872. if (vnode.children === '') {
  5873. // @ts-expect-error fixed by xxxxxx
  5874. insert(vnode.el = createText(''), parentNode(node), node);
  5875. nextNode = node;
  5876. } else {
  5877. nextNode = onMismatch();
  5878. }
  5879. } else {
  5880. if (node.data !== vnode.children) {
  5881. hasMismatch = true;
  5882. warn("Hydration text mismatch:" + "\n- Client: ".concat(JSON.stringify(node.data)) + "\n- Server: ".concat(JSON.stringify(vnode.children)));
  5883. node.data = vnode.children;
  5884. }
  5885. nextNode = nextSibling(node);
  5886. }
  5887. break;
  5888. case Comment:
  5889. if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
  5890. nextNode = onMismatch();
  5891. } else {
  5892. nextNode = nextSibling(node);
  5893. }
  5894. break;
  5895. case Static:
  5896. if (isFragmentStart) {
  5897. // entire template is static but SSRed as a fragment
  5898. node = nextSibling(node);
  5899. domType = node.nodeType;
  5900. }
  5901. if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
  5902. // determine anchor, adopt content
  5903. nextNode = node;
  5904. // if the static vnode has its content stripped during build,
  5905. // adopt it from the server-rendered HTML.
  5906. var needToAdoptContent = !vnode.children.length;
  5907. for (var i = 0; i < vnode.staticCount; i++) {
  5908. if (needToAdoptContent) vnode.children += nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5909. if (i === vnode.staticCount - 1) {
  5910. vnode.anchor = nextNode;
  5911. }
  5912. nextNode = nextSibling(nextNode);
  5913. }
  5914. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5915. } else {
  5916. onMismatch();
  5917. }
  5918. break;
  5919. case Fragment:
  5920. if (!isFragmentStart) {
  5921. nextNode = onMismatch();
  5922. } else {
  5923. nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  5924. }
  5925. break;
  5926. default:
  5927. if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
  5928. if (domType !== 1 /* DOMNodeTypes.ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  5929. nextNode = onMismatch();
  5930. } else {
  5931. nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  5932. }
  5933. } else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  5934. // when setting up the render effect, if the initial vnode already
  5935. // has .el set, the component will perform hydration instead of mount
  5936. // on its sub-tree.
  5937. vnode.slotScopeIds = slotScopeIds;
  5938. var container = parentNode(node);
  5939. mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);
  5940. // component may be async, so in the case of fragments we cannot rely
  5941. // on component's rendered output to determine the end of the fragment
  5942. // instead, we do a lookahead to find the end anchor node.
  5943. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  5944. // #4293 teleport as component root
  5945. if (nextNode && isComment(nextNode) && nextNode.data === 'teleport end') {
  5946. nextNode = nextSibling(nextNode);
  5947. }
  5948. // #3787
  5949. // if component is async, it may get moved / unmounted before its
  5950. // inner component is loaded, so we need to give it a placeholder
  5951. // vnode that matches its adopted DOM.
  5952. if (isAsyncWrapper(vnode)) {
  5953. var subTree;
  5954. if (isFragmentStart) {
  5955. subTree = createVNode(Fragment);
  5956. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5957. } else {
  5958. subTree = node.nodeType === 3 ? createTextVNode('') : createVNode('div');
  5959. }
  5960. subTree.el = node;
  5961. vnode.component.subTree = subTree;
  5962. }
  5963. } else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  5964. if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
  5965. nextNode = onMismatch();
  5966. } else {
  5967. nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
  5968. }
  5969. } else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  5970. nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
  5971. } else {
  5972. warn('Invalid HostVNode type:', type, "(".concat(typeof type, ")"));
  5973. }
  5974. }
  5975. if (ref != null) {
  5976. setRef(ref, null, parentSuspense, vnode);
  5977. }
  5978. return nextNode;
  5979. };
  5980. var hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5981. optimized = optimized || !!vnode.dynamicChildren;
  5982. var {
  5983. type,
  5984. props,
  5985. patchFlag,
  5986. shapeFlag,
  5987. dirs
  5988. } = vnode;
  5989. // #4006 for form elements with non-string v-model value bindings
  5990. // e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
  5991. var forcePatchValue = type === 'input' && dirs || type === 'option';
  5992. // skip props & children if this is hoisted static nodes
  5993. // #5405 in dev, always hydrate children for HMR
  5994. {
  5995. if (dirs) {
  5996. invokeDirectiveHook(vnode, null, parentComponent, 'created');
  5997. }
  5998. // props
  5999. if (props) {
  6000. if (forcePatchValue || !optimized || patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
  6001. for (var key in props) {
  6002. if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) {
  6003. patchProp(el, key, null, props[key], false, undefined, parentComponent);
  6004. }
  6005. }
  6006. } else if (props.onClick) {
  6007. // Fast path for click listeners (which is most often) to avoid
  6008. // iterating through props.
  6009. patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
  6010. }
  6011. }
  6012. // vnode / directive hooks
  6013. var vnodeHooks;
  6014. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6015. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6016. }
  6017. if (dirs) {
  6018. invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
  6019. }
  6020. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  6021. queueEffectWithSuspense(() => {
  6022. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6023. dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
  6024. }, parentSuspense);
  6025. }
  6026. // children
  6027. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
  6028. // skip if element has innerHTML / textContent
  6029. !(props && (props.innerHTML || props.textContent))) {
  6030. var next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
  6031. var _hasWarned = false;
  6032. while (next) {
  6033. hasMismatch = true;
  6034. if (!_hasWarned) {
  6035. warn("Hydration children mismatch in <".concat(vnode.type, ">: ") + "server rendered element contains more child nodes than client vdom.");
  6036. _hasWarned = true;
  6037. }
  6038. // The SSRed DOM contains more nodes than it should. Remove them.
  6039. var cur = next;
  6040. next = next.nextSibling;
  6041. remove(cur);
  6042. }
  6043. } else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  6044. if (el.textContent !== vnode.children) {
  6045. hasMismatch = true;
  6046. warn("Hydration text content mismatch in <".concat(vnode.type, ">:\n") + "- Client: ".concat(el.textContent, "\n") + "- Server: ".concat(vnode.children));
  6047. el.textContent = vnode.children;
  6048. }
  6049. }
  6050. }
  6051. return el.nextSibling;
  6052. };
  6053. var hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6054. optimized = optimized || !!parentVNode.dynamicChildren;
  6055. var children = parentVNode.children;
  6056. var l = children.length;
  6057. var hasWarned = false;
  6058. for (var i = 0; i < l; i++) {
  6059. var vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6060. if (node) {
  6061. node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  6062. } else if (vnode.type === Text && !vnode.children) {
  6063. continue;
  6064. } else {
  6065. hasMismatch = true;
  6066. if (!hasWarned) {
  6067. warn("Hydration children mismatch in <".concat(container.tagName.toLowerCase(), ">: ") + "server rendered element contains fewer child nodes than client vdom.");
  6068. hasWarned = true;
  6069. }
  6070. // the SSRed DOM didn't contain enough nodes. Mount the missing ones.
  6071. patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
  6072. }
  6073. }
  6074. return node;
  6075. };
  6076. var hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6077. var {
  6078. slotScopeIds: fragmentSlotScopeIds
  6079. } = vnode;
  6080. if (fragmentSlotScopeIds) {
  6081. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6082. }
  6083. var container = parentNode(node);
  6084. var next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
  6085. if (next && isComment(next) && next.data === ']') {
  6086. return nextSibling(vnode.anchor = next);
  6087. } else {
  6088. // fragment didn't hydrate successfully, since we didn't get a end anchor
  6089. // back. This should have led to node/children mismatch warnings.
  6090. hasMismatch = true;
  6091. // since the anchor is missing, we need to create one and insert it
  6092. // @ts-expect-error fixed by xxxxxx
  6093. insert(vnode.anchor = createComment("]"), container, next);
  6094. return next;
  6095. }
  6096. };
  6097. var handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6098. hasMismatch = true;
  6099. warn("Hydration node mismatch:\n- Client vnode:", vnode.type, "\n- Server rendered DOM:", node, node.nodeType === 3 /* DOMNodeTypes.TEXT */ ? "(text)" : isComment(node) && node.data === '[' ? "(start of fragment)" : "");
  6100. vnode.el = null;
  6101. if (isFragment) {
  6102. // remove excessive fragment nodes
  6103. var end = locateClosingAsyncAnchor(node);
  6104. while (true) {
  6105. var _next = nextSibling(node);
  6106. if (_next && _next !== end) {
  6107. remove(_next);
  6108. } else {
  6109. break;
  6110. }
  6111. }
  6112. }
  6113. var next = nextSibling(node);
  6114. var container = parentNode(node);
  6115. remove(node);
  6116. patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
  6117. return next;
  6118. };
  6119. var locateClosingAsyncAnchor = node => {
  6120. var match = 0;
  6121. while (node) {
  6122. node = nextSibling(node);
  6123. if (node && isComment(node)) {
  6124. if (node.data === '[') match++;
  6125. if (node.data === ']') {
  6126. if (match === 0) {
  6127. return nextSibling(node);
  6128. } else {
  6129. match--;
  6130. }
  6131. }
  6132. }
  6133. }
  6134. return node;
  6135. };
  6136. return [hydrate, hydrateNode];
  6137. }
  6138. /* eslint-disable no-restricted-globals */
  6139. var supported;
  6140. var perf;
  6141. function startMeasure(instance, type) {
  6142. if (instance.appContext.config.performance && isSupported()) {
  6143. perf.mark("vue-".concat(type, "-").concat(instance.uid));
  6144. }
  6145. {
  6146. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6147. }
  6148. }
  6149. function endMeasure(instance, type) {
  6150. if (instance.appContext.config.performance && isSupported()) {
  6151. var startTag = "vue-".concat(type, "-").concat(instance.uid);
  6152. var endTag = startTag + ":end";
  6153. perf.mark(endTag);
  6154. perf.measure("<".concat(formatComponentName(instance, instance.type), "> ").concat(type), startTag, endTag);
  6155. perf.clearMarks(startTag);
  6156. perf.clearMarks(endTag);
  6157. }
  6158. {
  6159. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6160. }
  6161. }
  6162. function isSupported() {
  6163. if (supported !== undefined) {
  6164. return supported;
  6165. }
  6166. if (typeof window !== 'undefined' && window.performance) {
  6167. supported = true;
  6168. perf = window.performance;
  6169. } else {
  6170. supported = false;
  6171. }
  6172. return supported;
  6173. }
  6174. /**
  6175. * This is only called in esm-bundler builds.
  6176. * It is called when a renderer is created, in `baseCreateRenderer` so that
  6177. * importing runtime-core is side-effects free.
  6178. *
  6179. * istanbul-ignore-next
  6180. */
  6181. function initFeatureFlags() {
  6182. var needWarn = [];
  6183. if (needWarn.length) {
  6184. var multi = needWarn.length > 1;
  6185. console.warn("Feature flag".concat(multi ? "s" : "", " ").concat(needWarn.join(', '), " ").concat(multi ? "are" : "is", " not explicitly defined. You are running the esm-bundler build of Vue, ") + "which expects these compile-time feature flags to be globally injected " + "via the bundler config in order to get better tree-shaking in the " + "production bundle.\n\n" + "For more details, see https://link.vuejs.org/feature-flags.");
  6186. }
  6187. }
  6188. var queuePostRenderEffect = queueEffectWithSuspense;
  6189. /**
  6190. * The createRenderer function accepts two generic arguments:
  6191. * HostNode and HostElement, corresponding to Node and Element types in the
  6192. * host environment. For example, for runtime-dom, HostNode would be the DOM
  6193. * `Node` interface and HostElement would be the DOM `Element` interface.
  6194. *
  6195. * Custom renderers can pass in the platform specific types like this:
  6196. *
  6197. * ``` js
  6198. * const { render, createApp } = createRenderer<Node, Element>({
  6199. * patchProp,
  6200. * ...nodeOps
  6201. * })
  6202. * ```
  6203. */
  6204. function createRenderer(options) {
  6205. return baseCreateRenderer(options);
  6206. }
  6207. // Separate API for creating hydration-enabled renderer.
  6208. // Hydration logic is only used when calling this function, making it
  6209. // tree-shakable.
  6210. function createHydrationRenderer(options) {
  6211. return baseCreateRenderer(options, createHydrationFunctions);
  6212. }
  6213. // implementation
  6214. function baseCreateRenderer(options, createHydrationFns) {
  6215. // compile-time feature flags check
  6216. {
  6217. initFeatureFlags();
  6218. }
  6219. var target = getGlobalThis();
  6220. target.__VUE__ = true;
  6221. {
  6222. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6223. }
  6224. var {
  6225. insert: hostInsert,
  6226. remove: hostRemove,
  6227. patchProp: hostPatchProp,
  6228. forcePatchProp: hostForcePatchProp,
  6229. // fixed by xxxxxx
  6230. createElement: hostCreateElement,
  6231. createText: hostCreateText,
  6232. createComment: hostCreateComment,
  6233. setText: hostSetText,
  6234. setElementText: hostSetElementText,
  6235. parentNode: hostParentNode,
  6236. nextSibling: hostNextSibling,
  6237. setScopeId: hostSetScopeId = NOOP,
  6238. insertStaticContent: hostInsertStaticContent
  6239. } = options;
  6240. // Note: functions inside this closure should use `const xxx = () => {}`
  6241. // style in order to prevent being inlined by minifiers.
  6242. var patch = function (n1, n2, container) {
  6243. var anchor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  6244. var parentComponent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  6245. var parentSuspense = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  6246. var isSVG = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  6247. var slotScopeIds = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  6248. var optimized = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : isHmrUpdating ? false : !!n2.dynamicChildren;
  6249. if (n1 === n2) {
  6250. return;
  6251. }
  6252. // patching & not same type, unmount old tree
  6253. if (n1 && !isSameVNodeType(n1, n2)) {
  6254. anchor = getNextHostNode(n1);
  6255. unmount(n1, parentComponent, parentSuspense, true);
  6256. n1 = null;
  6257. }
  6258. if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
  6259. optimized = false;
  6260. n2.dynamicChildren = null;
  6261. }
  6262. var {
  6263. type,
  6264. ref,
  6265. shapeFlag
  6266. } = n2;
  6267. switch (type) {
  6268. case Text:
  6269. processText(n1, n2, container, anchor);
  6270. break;
  6271. case Comment:
  6272. processCommentNode(n1, n2, container, anchor);
  6273. break;
  6274. case Static:
  6275. if (n1 == null) {
  6276. mountStaticNode(n2, container, anchor, isSVG);
  6277. } else {
  6278. patchStaticNode(n1, n2, container, isSVG);
  6279. }
  6280. break;
  6281. case Fragment:
  6282. processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6283. break;
  6284. default:
  6285. if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
  6286. processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6287. } else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  6288. processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6289. } else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  6290. type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
  6291. } else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  6292. type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
  6293. } else {
  6294. warn('Invalid VNode type:', type, "(".concat(typeof type, ")"));
  6295. }
  6296. }
  6297. // set ref
  6298. if (ref != null && parentComponent) {
  6299. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6300. }
  6301. };
  6302. var processText = (n1, n2, container, anchor) => {
  6303. if (n1 == null) {
  6304. hostInsert(n2.el = hostCreateText(n2.children, container),
  6305. // fixed by xxxxxx
  6306. container, anchor);
  6307. } else {
  6308. var el = n2.el = n1.el;
  6309. if (n2.children !== n1.children) {
  6310. hostSetText(el, n2.children);
  6311. }
  6312. }
  6313. };
  6314. var processCommentNode = (n1, n2, container, anchor) => {
  6315. if (n1 == null) {
  6316. hostInsert(n2.el = hostCreateComment(n2.children || '', container),
  6317. // fixed by xxxxxx
  6318. container, anchor);
  6319. } else {
  6320. // there's no support for dynamic comments
  6321. n2.el = n1.el;
  6322. }
  6323. };
  6324. var mountStaticNode = (n2, container, anchor, isSVG) => {
  6325. [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG, n2.el, n2.anchor);
  6326. };
  6327. /**
  6328. * Dev / HMR only
  6329. */
  6330. var patchStaticNode = (n1, n2, container, isSVG) => {
  6331. // static nodes are only patched during dev for HMR
  6332. if (n2.children !== n1.children) {
  6333. var anchor = hostNextSibling(n1.anchor);
  6334. // remove existing
  6335. removeStaticNode(n1);
  6336. [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
  6337. } else {
  6338. n2.el = n1.el;
  6339. n2.anchor = n1.anchor;
  6340. }
  6341. };
  6342. var moveStaticNode = (_ref14, container, nextSibling) => {
  6343. var {
  6344. el,
  6345. anchor
  6346. } = _ref14;
  6347. var next;
  6348. while (el && el !== anchor) {
  6349. next = hostNextSibling(el);
  6350. hostInsert(el, container, nextSibling);
  6351. el = next;
  6352. }
  6353. hostInsert(anchor, container, nextSibling);
  6354. };
  6355. var removeStaticNode = _ref15 => {
  6356. var {
  6357. el,
  6358. anchor
  6359. } = _ref15;
  6360. var next;
  6361. while (el && el !== anchor) {
  6362. next = hostNextSibling(el);
  6363. hostRemove(el);
  6364. el = next;
  6365. }
  6366. hostRemove(anchor);
  6367. };
  6368. var processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6369. isSVG = isSVG || n2.type === 'svg';
  6370. if (n1 == null) {
  6371. mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6372. } else {
  6373. patchElement(n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6374. }
  6375. };
  6376. var mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6377. var el;
  6378. var vnodeHook;
  6379. var {
  6380. type,
  6381. props,
  6382. shapeFlag,
  6383. transition,
  6384. dirs
  6385. } = vnode;
  6386. el = vnode.el = hostCreateElement(vnode.type,
  6387. // fixed by xxxxxx
  6388. container);
  6389. // mount children first, since some props may rely on child content
  6390. // being already rendered, e.g. `<select value>`
  6391. if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  6392. hostSetElementText(el, vnode.children);
  6393. } else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6394. mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
  6395. }
  6396. if (dirs) {
  6397. invokeDirectiveHook(vnode, null, parentComponent, 'created');
  6398. }
  6399. // scopeId
  6400. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6401. // props
  6402. if (props) {
  6403. for (var key in props) {
  6404. if (key !== 'value' && !isReservedProp(key)) {
  6405. hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  6406. // fixed by xxxxxx
  6407. vnode.hostInstance);
  6408. }
  6409. }
  6410. /**
  6411. * Special case for setting value on DOM elements:
  6412. * - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
  6413. * - it needs to be forced (#1471)
  6414. * #2353 proposes adding another renderer option to configure this, but
  6415. * the properties affects are so finite it is worth special casing it
  6416. * here to reduce the complexity. (Special casing it also should not
  6417. * affect non-DOM renderers)
  6418. */
  6419. if ('value' in props) {
  6420. // fixed by xxxxxx
  6421. hostPatchProp(el, 'value', null, props.value, false, [], parentComponent, null, undefined,
  6422. // fixed by xxxxxx
  6423. vnode.hostInstance);
  6424. }
  6425. if (vnodeHook = props.onVnodeBeforeMount) {
  6426. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6427. }
  6428. }
  6429. {
  6430. Object.defineProperty(el, '__vnode', {
  6431. value: vnode,
  6432. enumerable: false
  6433. });
  6434. Object.defineProperty(el, '__vueParentComponent', {
  6435. value: parentComponent,
  6436. enumerable: false
  6437. });
  6438. }
  6439. if (dirs) {
  6440. invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
  6441. }
  6442. // #1583 For inside suspense + suspense not resolved case, enter hook should call when suspense resolved
  6443. // #1689 For inside suspense + suspense resolved case, just call it
  6444. var needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  6445. if (needCallTransitionHooks) {
  6446. transition.beforeEnter(el);
  6447. }
  6448. hostInsert(el, container, anchor);
  6449. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6450. queuePostRenderEffect(() => {
  6451. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6452. needCallTransitionHooks && transition.enter(el);
  6453. dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
  6454. }, parentSuspense);
  6455. }
  6456. };
  6457. var setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6458. if (scopeId) {
  6459. hostSetScopeId(el, scopeId);
  6460. }
  6461. if (slotScopeIds) {
  6462. for (var i = 0; i < slotScopeIds.length; i++) {
  6463. hostSetScopeId(el, slotScopeIds[i]);
  6464. }
  6465. }
  6466. if (parentComponent) {
  6467. var subTree = parentComponent.subTree;
  6468. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
  6469. subTree = filterSingleRoot(subTree.children) || subTree;
  6470. }
  6471. if (vnode === subTree) {
  6472. var parentVNode = parentComponent.vnode;
  6473. setScopeId(el, parentVNode, parentVNode.scopeId, parentVNode.slotScopeIds, parentComponent.parent);
  6474. }
  6475. }
  6476. };
  6477. var mountChildren = function (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) {
  6478. var start = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
  6479. for (var i = start; i < children.length; i++) {
  6480. var child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6481. patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6482. }
  6483. };
  6484. var patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6485. var el = n2.el = n1.el;
  6486. var {
  6487. patchFlag,
  6488. dynamicChildren,
  6489. dirs
  6490. } = n2;
  6491. // #1426 take the old vnode's patch flag into account since user may clone a
  6492. // compiler-generated vnode, which de-opts to FULL_PROPS
  6493. patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
  6494. var oldProps = n1.props || EMPTY_OBJ;
  6495. var newProps = n2.props || EMPTY_OBJ;
  6496. var vnodeHook;
  6497. // disable recurse in beforeUpdate hooks
  6498. parentComponent && toggleRecurse(parentComponent, false);
  6499. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6500. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6501. }
  6502. if (dirs) {
  6503. invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
  6504. }
  6505. parentComponent && toggleRecurse(parentComponent, true);
  6506. if (isHmrUpdating) {
  6507. // HMR updated, force full diff
  6508. patchFlag = 0;
  6509. optimized = false;
  6510. dynamicChildren = null;
  6511. }
  6512. var areChildrenSVG = isSVG && n2.type !== 'foreignObject';
  6513. if (dynamicChildren) {
  6514. patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
  6515. if (parentComponent && parentComponent.type.__hmrId) {
  6516. traverseStaticChildren(n1, n2);
  6517. }
  6518. } else if (!optimized) {
  6519. // full diff
  6520. patchChildren(n1, n2, el, null, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds, false);
  6521. }
  6522. if (patchFlag > 0) {
  6523. // the presence of a patchFlag means this element's render code was
  6524. // generated by the compiler and can take the fast path.
  6525. // in this path old node and new node are guaranteed to have the same shape
  6526. // (i.e. at the exact same position in the source template)
  6527. if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
  6528. // element props contain dynamic keys, full diff needed
  6529. patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
  6530. } else {
  6531. // class
  6532. // this flag is matched when the element has dynamic class bindings.
  6533. if (patchFlag & 2 /* PatchFlags.CLASS */) {
  6534. if (oldProps.class !== newProps.class) {
  6535. // fixed by xxxxxx
  6536. hostPatchProp(el, 'class', null, newProps.class, isSVG, [], parentComponent, null, undefined,
  6537. // fixed by xxxxxx
  6538. n2.hostInstance);
  6539. }
  6540. }
  6541. // style
  6542. // this flag is matched when the element has dynamic style bindings
  6543. if (patchFlag & 4 /* PatchFlags.STYLE */) {
  6544. // fixed by xxxxxx
  6545. hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG, [], parentComponent, null, undefined,
  6546. // fixed by xxxxxx
  6547. n2.hostInstance);
  6548. }
  6549. // props
  6550. // This flag is matched when the element has dynamic prop/attr bindings
  6551. // other than class and style. The keys of dynamic prop/attrs are saved for
  6552. // faster iteration.
  6553. // Note dynamic keys like :[foo]="bar" will cause this optimization to
  6554. // bail out and go through a full diff because we need to unset the old key
  6555. if (patchFlag & 8 /* PatchFlags.PROPS */) {
  6556. // if the flag is present then dynamicProps must be non-null
  6557. var propsToUpdate = n2.dynamicProps;
  6558. for (var i = 0; i < propsToUpdate.length; i++) {
  6559. var key = propsToUpdate[i];
  6560. var prev = oldProps[key];
  6561. var next = newProps[key];
  6562. // #1471 force patch value
  6563. if (next !== prev || key === 'value' || hostForcePatchProp && hostForcePatchProp(el, key) // fixed by xxxxxx
  6564. ) {
  6565. hostPatchProp(el, key, prev, next, isSVG, n1.children, parentComponent, parentSuspense, unmountChildren,
  6566. // fixed by xxxxxx
  6567. n2.hostInstance);
  6568. }
  6569. }
  6570. }
  6571. }
  6572. // text
  6573. // This flag is matched when the element has only dynamic text children.
  6574. if (patchFlag & 1 /* PatchFlags.TEXT */) {
  6575. if (n1.children !== n2.children) {
  6576. hostSetElementText(el, n2.children);
  6577. }
  6578. }
  6579. } else if (!optimized && dynamicChildren == null) {
  6580. // unoptimized, full diff
  6581. patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
  6582. }
  6583. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6584. queuePostRenderEffect(() => {
  6585. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6586. dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated');
  6587. }, parentSuspense);
  6588. }
  6589. };
  6590. // The fast path for blocks.
  6591. var patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  6592. for (var i = 0; i < newChildren.length; i++) {
  6593. var oldVNode = oldChildren[i];
  6594. var newVNode = newChildren[i];
  6595. // Determine the container (parent element) for the patch.
  6596. var container =
  6597. // oldVNode may be an errored async setup() component inside Suspense
  6598. // which will not have a mounted element
  6599. oldVNode.el && (
  6600. // - In the case of a Fragment, we need to provide the actual parent
  6601. // of the Fragment itself so it can move its children.
  6602. oldVNode.type === Fragment ||
  6603. // - In the case of different nodes, there is going to be a replacement
  6604. // which also requires the correct parent container
  6605. !isSameVNodeType(oldVNode, newVNode) ||
  6606. // - In the case of a component, it could contain anything.
  6607. oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */)) ? hostParentNode(oldVNode.el) :
  6608. // In other cases, the parent container is not actually used so we
  6609. // just pass the block element here to avoid a DOM parentNode call.
  6610. fallbackContainer;
  6611. patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, true);
  6612. }
  6613. };
  6614. var patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  6615. if (oldProps !== newProps) {
  6616. if (oldProps !== EMPTY_OBJ) {
  6617. for (var key in oldProps) {
  6618. if (!isReservedProp(key) && !(key in newProps)) {
  6619. hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  6620. // fixed by xxxxxx
  6621. vnode.hostInstance);
  6622. }
  6623. }
  6624. }
  6625. for (var _key18 in newProps) {
  6626. // empty string is not valid prop
  6627. if (isReservedProp(_key18)) continue;
  6628. var next = newProps[_key18];
  6629. var prev = oldProps[_key18];
  6630. // defer patching value
  6631. if (next !== prev && _key18 !== 'value' || hostForcePatchProp && hostForcePatchProp(el, _key18) // fixed by xxxxxx
  6632. ) {
  6633. hostPatchProp(el, _key18, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  6634. // fixed by xxxxxx
  6635. vnode.hostInstance);
  6636. }
  6637. }
  6638. if ('value' in newProps) {
  6639. // fixed by xxxxxx
  6640. hostPatchProp(el, 'value', oldProps.value, newProps.value, false, [], parentComponent, null, undefined,
  6641. // fixed by xxxxxx
  6642. vnode.hostInstance);
  6643. }
  6644. }
  6645. };
  6646. var processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6647. var fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateComment('', container); // fixed by xxxxxx
  6648. var fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateComment('', container); // fixed by xxxxxx
  6649. var {
  6650. patchFlag,
  6651. dynamicChildren,
  6652. slotScopeIds: fragmentSlotScopeIds
  6653. } = n2;
  6654. if (
  6655. // #5523 dev root fragment may inherit directives
  6656. isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
  6657. // HMR updated / Dev root fragment (w/ comments), force full diff
  6658. patchFlag = 0;
  6659. optimized = false;
  6660. dynamicChildren = null;
  6661. }
  6662. // check if this is a slot fragment with :slotted scope ids
  6663. if (fragmentSlotScopeIds) {
  6664. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6665. }
  6666. if (n1 == null) {
  6667. hostInsert(fragmentStartAnchor, container, anchor);
  6668. hostInsert(fragmentEndAnchor, container, anchor);
  6669. // a fragment can only have array children
  6670. // since they are either generated by the compiler, or implicitly created
  6671. // from arrays.
  6672. mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6673. } else {
  6674. if (patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ && dynamicChildren &&
  6675. // #2715 the previous fragment could've been a BAILed one as a result
  6676. // of renderSlot() with no valid children
  6677. n1.dynamicChildren) {
  6678. // a stable fragment (template root or <template v-for>) doesn't need to
  6679. // patch children order, but it may contain dynamicChildren.
  6680. patchBlockChildren(n1.dynamicChildren, dynamicChildren, container, parentComponent, parentSuspense, isSVG, slotScopeIds);
  6681. if (parentComponent && parentComponent.type.__hmrId) {
  6682. traverseStaticChildren(n1, n2);
  6683. } else if (
  6684. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  6685. // get moved around. Make sure all root level vnodes inherit el.
  6686. // #2134 or if it's a component root, it may also get moved around
  6687. // as the component is being moved.
  6688. n2.key != null || parentComponent && n2 === parentComponent.subTree) {
  6689. traverseStaticChildren(n1, n2, true /* shallow */);
  6690. }
  6691. } else {
  6692. // keyed / unkeyed, or manual fragments.
  6693. // for keyed & unkeyed, since they are compiler generated from v-for,
  6694. // each child is guaranteed to be a block so the fragment will never
  6695. // have dynamicChildren.
  6696. patchChildren(n1, n2, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6697. }
  6698. }
  6699. };
  6700. var processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6701. n2.slotScopeIds = slotScopeIds;
  6702. if (n1 == null) {
  6703. if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
  6704. parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
  6705. } else {
  6706. mountComponent(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
  6707. }
  6708. } else {
  6709. updateComponent(n1, n2, optimized);
  6710. }
  6711. };
  6712. var mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  6713. var instance = initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense);
  6714. if (instance.type.__hmrId) {
  6715. registerHMR(instance);
  6716. }
  6717. {
  6718. pushWarningContext(initialVNode);
  6719. startMeasure(instance, "mount");
  6720. }
  6721. // inject renderer internals for keepAlive
  6722. if (isKeepAlive(initialVNode)) {
  6723. instance.ctx.renderer = internals;
  6724. }
  6725. // resolve props and slots for setup context
  6726. {
  6727. {
  6728. startMeasure(instance, "init");
  6729. }
  6730. setupComponent(instance);
  6731. {
  6732. endMeasure(instance, "init");
  6733. }
  6734. }
  6735. // setup() is async. This component relies on async logic to be resolved
  6736. // before proceeding
  6737. if (instance.asyncDep) {
  6738. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  6739. // Give it a placeholder if this is not hydration
  6740. // TODO handle self-defined fallback
  6741. if (!initialVNode.el) {
  6742. var placeholder = instance.subTree = createVNode(Comment);
  6743. processCommentNode(null, placeholder, container, anchor);
  6744. }
  6745. return;
  6746. }
  6747. setupRenderEffect(instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized);
  6748. {
  6749. popWarningContext();
  6750. endMeasure(instance, "mount");
  6751. }
  6752. };
  6753. var updateComponent = (n1, n2, optimized) => {
  6754. var instance = n2.component = n1.component;
  6755. if (shouldUpdateComponent(n1, n2, optimized)) {
  6756. if (instance.asyncDep && !instance.asyncResolved) {
  6757. // async & still pending - just update props and slots
  6758. // since the component's reactive effect for render isn't set-up yet
  6759. {
  6760. pushWarningContext(n2);
  6761. }
  6762. updateComponentPreRender(instance, n2, optimized);
  6763. {
  6764. popWarningContext();
  6765. }
  6766. return;
  6767. } else {
  6768. // normal update
  6769. instance.next = n2;
  6770. // in case the child component is also queued, remove it to avoid
  6771. // double updating the same child component in the same flush.
  6772. invalidateJob(instance.update);
  6773. // instance.update is the reactive effect.
  6774. instance.update();
  6775. }
  6776. } else {
  6777. // no update needed. just copy over properties
  6778. n2.el = n1.el;
  6779. instance.vnode = n2;
  6780. }
  6781. };
  6782. var setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  6783. var componentUpdateFn = () => {
  6784. if (!instance.isMounted) {
  6785. var vnodeHook;
  6786. var {
  6787. el,
  6788. props
  6789. } = initialVNode;
  6790. var {
  6791. bm,
  6792. m,
  6793. parent
  6794. } = instance;
  6795. var isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6796. toggleRecurse(instance, false);
  6797. // beforeMount hook
  6798. if (bm) {
  6799. invokeArrayFns(bm);
  6800. }
  6801. // onVnodeBeforeMount
  6802. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6803. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6804. }
  6805. toggleRecurse(instance, true);
  6806. if (el && hydrateNode) {
  6807. // vnode has adopted host node - perform hydration instead of mount.
  6808. var hydrateSubTree = () => {
  6809. {
  6810. startMeasure(instance, "render");
  6811. }
  6812. instance.subTree = renderComponentRoot(instance);
  6813. {
  6814. endMeasure(instance, "render");
  6815. }
  6816. {
  6817. startMeasure(instance, "hydrate");
  6818. }
  6819. hydrateNode(el, instance.subTree, instance, parentSuspense, null);
  6820. {
  6821. endMeasure(instance, "hydrate");
  6822. }
  6823. };
  6824. if (isAsyncWrapperVNode) {
  6825. initialVNode.type.__asyncLoader().then(
  6826. // note: we are moving the render call into an async callback,
  6827. // which means it won't track dependencies - but it's ok because
  6828. // a server-rendered async wrapper is already in resolved state
  6829. // and it will never need to change.
  6830. () => !instance.isUnmounted && hydrateSubTree());
  6831. } else {
  6832. hydrateSubTree();
  6833. }
  6834. } else {
  6835. {
  6836. startMeasure(instance, "render");
  6837. }
  6838. var subTree = instance.subTree = renderComponentRoot(instance);
  6839. {
  6840. endMeasure(instance, "render");
  6841. }
  6842. {
  6843. startMeasure(instance, "patch");
  6844. }
  6845. patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
  6846. {
  6847. endMeasure(instance, "patch");
  6848. }
  6849. initialVNode.el = subTree.el;
  6850. }
  6851. // mounted hook
  6852. if (m) {
  6853. queuePostRenderEffect(m, parentSuspense);
  6854. }
  6855. // onVnodeMounted
  6856. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  6857. var scopedInitialVNode = initialVNode;
  6858. queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), parentSuspense);
  6859. }
  6860. // activated hook for keep-alive roots.
  6861. // #1742 activated hook must be accessed after first render
  6862. // since the hook may be injected by a child keep-alive
  6863. if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
  6864. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  6865. }
  6866. instance.isMounted = true;
  6867. {
  6868. devtoolsComponentAdded(instance);
  6869. }
  6870. // #2458: deference mount-only object parameters to prevent memleaks
  6871. initialVNode = container = anchor = null;
  6872. } else {
  6873. // updateComponent
  6874. // This is triggered by mutation of component's own state (next: null)
  6875. // OR parent calling processComponent (next: VNode)
  6876. var {
  6877. next,
  6878. bu,
  6879. u,
  6880. parent: _parent,
  6881. vnode
  6882. } = instance;
  6883. var originNext = next;
  6884. var _vnodeHook;
  6885. {
  6886. pushWarningContext(next || instance.vnode);
  6887. }
  6888. // Disallow component effect recursion during pre-lifecycle hooks.
  6889. toggleRecurse(instance, false);
  6890. if (next) {
  6891. next.el = vnode.el;
  6892. updateComponentPreRender(instance, next, optimized);
  6893. } else {
  6894. next = vnode;
  6895. }
  6896. // beforeUpdate hook
  6897. if (bu) {
  6898. invokeArrayFns(bu);
  6899. }
  6900. // onVnodeBeforeUpdate
  6901. if (_vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  6902. invokeVNodeHook(_vnodeHook, _parent, next, vnode);
  6903. }
  6904. toggleRecurse(instance, true);
  6905. // render
  6906. {
  6907. startMeasure(instance, "render");
  6908. }
  6909. var nextTree = renderComponentRoot(instance);
  6910. {
  6911. endMeasure(instance, "render");
  6912. }
  6913. var prevTree = instance.subTree;
  6914. instance.subTree = nextTree;
  6915. {
  6916. startMeasure(instance, "patch");
  6917. }
  6918. patch(prevTree, nextTree,
  6919. // parent may have changed if it's in a teleport
  6920. hostParentNode(prevTree.el),
  6921. // anchor may have changed if it's in a fragment
  6922. getNextHostNode(prevTree), instance, parentSuspense, isSVG);
  6923. {
  6924. endMeasure(instance, "patch");
  6925. }
  6926. next.el = nextTree.el;
  6927. if (originNext === null) {
  6928. // self-triggered update. In case of HOC, update parent component
  6929. // vnode el. HOC is indicated by parent instance's subTree pointing
  6930. // to child component's vnode
  6931. updateHOCHostEl(instance, nextTree.el);
  6932. }
  6933. // updated hook
  6934. if (u) {
  6935. queuePostRenderEffect(u, parentSuspense);
  6936. }
  6937. // onVnodeUpdated
  6938. if (_vnodeHook = next.props && next.props.onVnodeUpdated) {
  6939. queuePostRenderEffect(() => invokeVNodeHook(_vnodeHook, _parent, next, vnode), parentSuspense);
  6940. }
  6941. {
  6942. devtoolsComponentUpdated(instance);
  6943. }
  6944. {
  6945. popWarningContext();
  6946. }
  6947. }
  6948. };
  6949. // create reactive effect for rendering
  6950. var effect = instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
  6951. );
  6952. var update = instance.update = () => effect.run();
  6953. update.id = instance.uid;
  6954. // allowRecurse
  6955. // #1801, #2043 component render effects should allow recursive updates
  6956. toggleRecurse(instance, true);
  6957. {
  6958. effect.onTrack = instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0;
  6959. effect.onTrigger = instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0;
  6960. update.ownerInstance = instance;
  6961. }
  6962. update();
  6963. };
  6964. var updateComponentPreRender = (instance, nextVNode, optimized) => {
  6965. nextVNode.component = instance;
  6966. var prevProps = instance.vnode.props;
  6967. instance.vnode = nextVNode;
  6968. instance.next = null;
  6969. updateProps(instance, nextVNode.props, prevProps, optimized);
  6970. updateSlots(instance, nextVNode.children, optimized);
  6971. pauseTracking();
  6972. // props update may have triggered pre-flush watchers.
  6973. // flush them before the render update.
  6974. flushPreFlushCbs();
  6975. resetTracking();
  6976. };
  6977. var patchChildren = function (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds) {
  6978. var optimized = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
  6979. var c1 = n1 && n1.children;
  6980. var prevShapeFlag = n1 ? n1.shapeFlag : 0;
  6981. var c2 = n2.children;
  6982. var {
  6983. patchFlag,
  6984. shapeFlag
  6985. } = n2;
  6986. // fast path
  6987. if (patchFlag > 0) {
  6988. if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
  6989. // this could be either fully-keyed or mixed (some keyed some not)
  6990. // presence of patchFlag means children are guaranteed to be arrays
  6991. patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6992. return;
  6993. } else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
  6994. // unkeyed
  6995. patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6996. return;
  6997. }
  6998. }
  6999. // children has 3 possibilities: text, array or no children.
  7000. if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  7001. // text children fast path
  7002. if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7003. unmountChildren(c1, parentComponent, parentSuspense);
  7004. }
  7005. if (c2 !== c1) {
  7006. hostSetElementText(container, c2);
  7007. }
  7008. } else {
  7009. if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7010. // prev children was array
  7011. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7012. // two arrays, cannot assume anything, do full diff
  7013. patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7014. } else {
  7015. // no new children, just unmount old
  7016. unmountChildren(c1, parentComponent, parentSuspense, true);
  7017. }
  7018. } else {
  7019. // prev children was text OR null
  7020. // new children is array OR null
  7021. if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  7022. hostSetElementText(container, '');
  7023. }
  7024. // mount new if array
  7025. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7026. mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7027. }
  7028. }
  7029. }
  7030. };
  7031. var patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7032. c1 = c1 || EMPTY_ARR;
  7033. c2 = c2 || EMPTY_ARR;
  7034. var oldLength = c1.length;
  7035. var newLength = c2.length;
  7036. var commonLength = Math.min(oldLength, newLength);
  7037. var i;
  7038. for (i = 0; i < commonLength; i++) {
  7039. var nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7040. patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7041. }
  7042. if (oldLength > newLength) {
  7043. // remove old
  7044. unmountChildren(c1, parentComponent, parentSuspense, true, false, commonLength);
  7045. } else {
  7046. // mount new
  7047. mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, commonLength);
  7048. }
  7049. };
  7050. // can be all-keyed or mixed
  7051. var patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7052. var i = 0;
  7053. var l2 = c2.length;
  7054. var e1 = c1.length - 1; // prev ending index
  7055. var e2 = l2 - 1; // next ending index
  7056. // 1. sync from start
  7057. // (a b) c
  7058. // (a b) d e
  7059. while (i <= e1 && i <= e2) {
  7060. var n1 = c1[i];
  7061. var n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7062. if (isSameVNodeType(n1, n2)) {
  7063. patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7064. } else {
  7065. break;
  7066. }
  7067. i++;
  7068. }
  7069. // 2. sync from end
  7070. // a (b c)
  7071. // d e (b c)
  7072. while (i <= e1 && i <= e2) {
  7073. var _n = c1[e1];
  7074. var _n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7075. if (isSameVNodeType(_n, _n2)) {
  7076. patch(_n, _n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7077. } else {
  7078. break;
  7079. }
  7080. e1--;
  7081. e2--;
  7082. }
  7083. // 3. common sequence + mount
  7084. // (a b)
  7085. // (a b) c
  7086. // i = 2, e1 = 1, e2 = 2
  7087. // (a b)
  7088. // c (a b)
  7089. // i = 0, e1 = -1, e2 = 0
  7090. if (i > e1) {
  7091. if (i <= e2) {
  7092. var nextPos = e2 + 1;
  7093. var anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7094. while (i <= e2) {
  7095. patch(null, c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7096. i++;
  7097. }
  7098. }
  7099. }
  7100. // 4. common sequence + unmount
  7101. // (a b) c
  7102. // (a b)
  7103. // i = 2, e1 = 2, e2 = 1
  7104. // a (b c)
  7105. // (b c)
  7106. // i = 0, e1 = 0, e2 = -1
  7107. else if (i > e2) {
  7108. while (i <= e1) {
  7109. unmount(c1[i], parentComponent, parentSuspense, true);
  7110. i++;
  7111. }
  7112. }
  7113. // 5. unknown sequence
  7114. // [i ... e1 + 1]: a b [c d e] f g
  7115. // [i ... e2 + 1]: a b [e d c h] f g
  7116. // i = 2, e1 = 4, e2 = 5
  7117. else {
  7118. var s1 = i; // prev starting index
  7119. var s2 = i; // next starting index
  7120. // 5.1 build key:index map for newChildren
  7121. var keyToNewIndexMap = new Map();
  7122. for (i = s2; i <= e2; i++) {
  7123. var nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7124. if (nextChild.key != null) {
  7125. if (keyToNewIndexMap.has(nextChild.key)) {
  7126. warn("Duplicate keys found during update:", JSON.stringify(nextChild.key), "Make sure keys are unique.");
  7127. }
  7128. keyToNewIndexMap.set(nextChild.key, i);
  7129. }
  7130. }
  7131. // 5.2 loop through old children left to be patched and try to patch
  7132. // matching nodes & remove nodes that are no longer present
  7133. var j;
  7134. var patched = 0;
  7135. var toBePatched = e2 - s2 + 1;
  7136. var moved = false;
  7137. // used to track whether any node has moved
  7138. var maxNewIndexSoFar = 0;
  7139. // works as Map<newIndex, oldIndex>
  7140. // Note that oldIndex is offset by +1
  7141. // and oldIndex = 0 is a special value indicating the new node has
  7142. // no corresponding old node.
  7143. // used for determining longest stable subsequence
  7144. var newIndexToOldIndexMap = new Array(toBePatched);
  7145. for (i = 0; i < toBePatched; i++) {
  7146. newIndexToOldIndexMap[i] = 0;
  7147. }
  7148. for (i = s1; i <= e1; i++) {
  7149. var prevChild = c1[i];
  7150. if (patched >= toBePatched) {
  7151. // all new children have been patched so this can only be a removal
  7152. unmount(prevChild, parentComponent, parentSuspense, true);
  7153. continue;
  7154. }
  7155. var newIndex = void 0;
  7156. if (prevChild.key != null) {
  7157. newIndex = keyToNewIndexMap.get(prevChild.key);
  7158. } else {
  7159. // key-less node, try to locate a key-less node of the same type
  7160. for (j = s2; j <= e2; j++) {
  7161. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7162. newIndex = j;
  7163. break;
  7164. }
  7165. }
  7166. }
  7167. if (newIndex === undefined) {
  7168. unmount(prevChild, parentComponent, parentSuspense, true);
  7169. } else {
  7170. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7171. if (newIndex >= maxNewIndexSoFar) {
  7172. maxNewIndexSoFar = newIndex;
  7173. } else {
  7174. moved = true;
  7175. }
  7176. patch(prevChild, c2[newIndex], container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7177. patched++;
  7178. }
  7179. }
  7180. // 5.3 move and mount
  7181. // generate longest stable subsequence only when nodes have moved
  7182. var increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7183. j = increasingNewIndexSequence.length - 1;
  7184. // looping backwards so that we can use last patched node as anchor
  7185. for (i = toBePatched - 1; i >= 0; i--) {
  7186. var nextIndex = s2 + i;
  7187. var _nextChild = c2[nextIndex];
  7188. var _anchor2 = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7189. if (newIndexToOldIndexMap[i] === 0) {
  7190. // mount new
  7191. patch(null, _nextChild, container, _anchor2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7192. } else if (moved) {
  7193. // move if:
  7194. // There is no stable subsequence (e.g. a reverse)
  7195. // OR current node is not among the stable sequence
  7196. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7197. move(_nextChild, container, _anchor2, 2 /* MoveType.REORDER */);
  7198. } else {
  7199. j--;
  7200. }
  7201. }
  7202. }
  7203. }
  7204. };
  7205. var move = function (vnode, container, anchor, moveType) {
  7206. var parentSuspense = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  7207. var {
  7208. el,
  7209. type,
  7210. transition,
  7211. children,
  7212. shapeFlag
  7213. } = vnode;
  7214. if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  7215. move(vnode.component.subTree, container, anchor, moveType);
  7216. return;
  7217. }
  7218. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  7219. vnode.suspense.move(container, anchor, moveType);
  7220. return;
  7221. }
  7222. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  7223. type.move(vnode, container, anchor, internals);
  7224. return;
  7225. }
  7226. if (type === Fragment) {
  7227. hostInsert(el, container, anchor);
  7228. for (var i = 0; i < children.length; i++) {
  7229. move(children[i], container, anchor, moveType);
  7230. }
  7231. hostInsert(vnode.anchor, container, anchor);
  7232. return;
  7233. }
  7234. if (type === Static) {
  7235. moveStaticNode(vnode, container, anchor);
  7236. return;
  7237. }
  7238. // single nodes
  7239. var needTransition = moveType !== 2 /* MoveType.REORDER */ && shapeFlag & 1 /* ShapeFlags.ELEMENT */ && transition;
  7240. if (needTransition) {
  7241. if (moveType === 0 /* MoveType.ENTER */) {
  7242. transition.beforeEnter(el);
  7243. hostInsert(el, container, anchor);
  7244. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7245. } else {
  7246. var {
  7247. leave,
  7248. delayLeave,
  7249. afterLeave
  7250. } = transition;
  7251. var _remove = () => hostInsert(el, container, anchor);
  7252. var performLeave = () => {
  7253. leave(el, () => {
  7254. _remove();
  7255. afterLeave && afterLeave();
  7256. });
  7257. };
  7258. if (delayLeave) {
  7259. delayLeave(el, _remove, performLeave);
  7260. } else {
  7261. performLeave();
  7262. }
  7263. }
  7264. } else {
  7265. hostInsert(el, container, anchor);
  7266. }
  7267. };
  7268. var unmount = function (vnode, parentComponent, parentSuspense) {
  7269. var doRemove = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  7270. var optimized = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7271. var {
  7272. type,
  7273. props,
  7274. ref,
  7275. children,
  7276. dynamicChildren,
  7277. shapeFlag,
  7278. patchFlag,
  7279. dirs
  7280. } = vnode;
  7281. // unset ref
  7282. if (ref != null) {
  7283. setRef(ref, null, parentSuspense, vnode, true);
  7284. }
  7285. if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
  7286. parentComponent.ctx.deactivate(vnode);
  7287. return;
  7288. }
  7289. var shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
  7290. var shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7291. var vnodeHook;
  7292. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7293. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7294. }
  7295. if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  7296. unmountComponent(vnode.component, parentSuspense, doRemove);
  7297. } else {
  7298. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  7299. vnode.suspense.unmount(parentSuspense, doRemove);
  7300. return;
  7301. }
  7302. if (shouldInvokeDirs) {
  7303. invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
  7304. }
  7305. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  7306. vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
  7307. } else if (dynamicChildren && (
  7308. // #1153: fast path should not be taken for non-stable (v-for) fragments
  7309. type !== Fragment || patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */)) {
  7310. // fast path for block nodes: only need to unmount dynamic children.
  7311. unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
  7312. } else if (type === Fragment && patchFlag & (128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */) || !optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7313. unmountChildren(children, parentComponent, parentSuspense);
  7314. }
  7315. if (doRemove) {
  7316. remove(vnode);
  7317. }
  7318. }
  7319. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7320. queuePostRenderEffect(() => {
  7321. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7322. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, 'unmounted');
  7323. }, parentSuspense);
  7324. }
  7325. };
  7326. var remove = vnode => {
  7327. var {
  7328. type,
  7329. el,
  7330. anchor,
  7331. transition
  7332. } = vnode;
  7333. if (type === Fragment) {
  7334. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ && transition && !transition.persisted) {
  7335. vnode.children.forEach(child => {
  7336. if (child.type === Comment) {
  7337. hostRemove(child.el);
  7338. } else {
  7339. remove(child);
  7340. }
  7341. });
  7342. } else {
  7343. removeFragment(el, anchor);
  7344. }
  7345. return;
  7346. }
  7347. if (type === Static) {
  7348. removeStaticNode(vnode);
  7349. return;
  7350. }
  7351. var performRemove = () => {
  7352. hostRemove(el);
  7353. if (transition && !transition.persisted && transition.afterLeave) {
  7354. transition.afterLeave();
  7355. }
  7356. };
  7357. if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && transition && !transition.persisted) {
  7358. var {
  7359. leave,
  7360. delayLeave
  7361. } = transition;
  7362. var performLeave = () => leave(el, performRemove);
  7363. if (delayLeave) {
  7364. delayLeave(vnode.el, performRemove, performLeave);
  7365. } else {
  7366. performLeave();
  7367. }
  7368. } else {
  7369. performRemove();
  7370. }
  7371. };
  7372. var removeFragment = (cur, end) => {
  7373. // For fragments, directly remove all contained DOM nodes.
  7374. // (fragment child nodes cannot have transition)
  7375. var next;
  7376. while (cur !== end) {
  7377. next = hostNextSibling(cur);
  7378. hostRemove(cur);
  7379. cur = next;
  7380. }
  7381. hostRemove(end);
  7382. };
  7383. var unmountComponent = (instance, parentSuspense, doRemove) => {
  7384. if (instance.type.__hmrId) {
  7385. unregisterHMR(instance);
  7386. }
  7387. var {
  7388. bum,
  7389. scope,
  7390. update,
  7391. subTree,
  7392. um
  7393. } = instance;
  7394. // beforeUnmount hook
  7395. if (bum) {
  7396. invokeArrayFns(bum);
  7397. }
  7398. // stop effects in component scope
  7399. scope.stop();
  7400. // update may be null if a component is unmounted before its async
  7401. // setup has resolved.
  7402. if (update) {
  7403. // so that scheduler will no longer invoke it
  7404. update.active = false;
  7405. unmount(subTree, instance, parentSuspense, doRemove);
  7406. }
  7407. // unmounted hook
  7408. if (um) {
  7409. queuePostRenderEffect(um, parentSuspense);
  7410. }
  7411. queuePostRenderEffect(() => {
  7412. instance.isUnmounted = true;
  7413. }, parentSuspense);
  7414. // A component with async dep inside a pending suspense is unmounted before
  7415. // its async dep resolves. This should remove the dep from the suspense, and
  7416. // cause the suspense to resolve immediately if that was the last dep.
  7417. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7418. parentSuspense.deps--;
  7419. if (parentSuspense.deps === 0) {
  7420. parentSuspense.resolve();
  7421. }
  7422. }
  7423. {
  7424. devtoolsComponentRemoved(instance);
  7425. }
  7426. };
  7427. var unmountChildren = function (children, parentComponent, parentSuspense) {
  7428. var doRemove = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  7429. var optimized = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7430. var start = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  7431. for (var i = start; i < children.length; i++) {
  7432. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7433. }
  7434. };
  7435. var getNextHostNode = vnode => {
  7436. if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  7437. return getNextHostNode(vnode.component.subTree);
  7438. }
  7439. if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  7440. return vnode.suspense.next();
  7441. }
  7442. return hostNextSibling(vnode.anchor || vnode.el);
  7443. };
  7444. var render = (vnode, container, isSVG) => {
  7445. if (vnode == null) {
  7446. if (container._vnode) {
  7447. unmount(container._vnode, null, null, true);
  7448. }
  7449. } else {
  7450. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  7451. }
  7452. flushPreFlushCbs();
  7453. flushPostFlushCbs();
  7454. container._vnode = vnode;
  7455. };
  7456. var internals = {
  7457. p: patch,
  7458. um: unmount,
  7459. m: move,
  7460. r: remove,
  7461. mt: mountComponent,
  7462. mc: mountChildren,
  7463. pc: patchChildren,
  7464. pbc: patchBlockChildren,
  7465. n: getNextHostNode,
  7466. o: options
  7467. };
  7468. var hydrate;
  7469. var hydrateNode;
  7470. if (createHydrationFns) {
  7471. [hydrate, hydrateNode] = createHydrationFns(internals);
  7472. }
  7473. return {
  7474. render,
  7475. hydrate,
  7476. createApp: createAppAPI(render, hydrate)
  7477. };
  7478. }
  7479. function toggleRecurse(_ref16, allowed) {
  7480. var {
  7481. effect,
  7482. update
  7483. } = _ref16;
  7484. effect.allowRecurse = update.allowRecurse = allowed;
  7485. }
  7486. /**
  7487. * #1156
  7488. * When a component is HMR-enabled, we need to make sure that all static nodes
  7489. * inside a block also inherit the DOM element from the previous tree so that
  7490. * HMR updates (which are full updates) can retrieve the element for patching.
  7491. *
  7492. * #2080
  7493. * Inside keyed `template` fragment static children, if a fragment is moved,
  7494. * the children will always be moved. Therefore, in order to ensure correct move
  7495. * position, el should be inherited from previous nodes.
  7496. */
  7497. function traverseStaticChildren(n1, n2) {
  7498. var shallow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7499. var ch1 = n1.children;
  7500. var ch2 = n2.children;
  7501. if (isArray(ch1) && isArray(ch2)) {
  7502. for (var i = 0; i < ch1.length; i++) {
  7503. // this is only called in the optimized path so array children are
  7504. // guaranteed to be vnodes
  7505. var c1 = ch1[i];
  7506. var c2 = ch2[i];
  7507. if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
  7508. if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
  7509. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7510. c2.el = c1.el;
  7511. }
  7512. if (!shallow) traverseStaticChildren(c1, c2);
  7513. }
  7514. // #6852 also inherit for text nodes
  7515. if (c2.type === Text) {
  7516. c2.el = c1.el;
  7517. }
  7518. // also inherit for comment nodes, but not placeholders (e.g. v-if which
  7519. // would have received .el during block patch)
  7520. if (c2.type === Comment && !c2.el) {
  7521. c2.el = c1.el;
  7522. }
  7523. }
  7524. }
  7525. }
  7526. // https://en.wikipedia.org/wiki/Longest_increasing_subsequence
  7527. function getSequence(arr) {
  7528. var p = arr.slice();
  7529. var result = [0];
  7530. var i, j, u, v, c;
  7531. var len = arr.length;
  7532. for (i = 0; i < len; i++) {
  7533. var arrI = arr[i];
  7534. if (arrI !== 0) {
  7535. j = result[result.length - 1];
  7536. if (arr[j] < arrI) {
  7537. p[i] = j;
  7538. result.push(i);
  7539. continue;
  7540. }
  7541. u = 0;
  7542. v = result.length - 1;
  7543. while (u < v) {
  7544. c = u + v >> 1;
  7545. if (arr[result[c]] < arrI) {
  7546. u = c + 1;
  7547. } else {
  7548. v = c;
  7549. }
  7550. }
  7551. if (arrI < arr[result[u]]) {
  7552. if (u > 0) {
  7553. p[i] = result[u - 1];
  7554. }
  7555. result[u] = i;
  7556. }
  7557. }
  7558. }
  7559. u = result.length;
  7560. v = result[u - 1];
  7561. while (u-- > 0) {
  7562. result[u] = v;
  7563. v = p[v];
  7564. }
  7565. return result;
  7566. }
  7567. var isTeleport = type => type.__isTeleport;
  7568. var isTeleportDisabled = props => props && (props.disabled || props.disabled === '');
  7569. var isTargetSVG = target => typeof SVGElement !== 'undefined' && target instanceof SVGElement;
  7570. var resolveTarget = (props, select) => {
  7571. var targetSelector = props && props.to;
  7572. if (isString(targetSelector)) {
  7573. if (!select) {
  7574. warn("Current renderer does not support string target for Teleports. " + "(missing querySelector renderer option)");
  7575. return null;
  7576. } else {
  7577. var target = select(targetSelector);
  7578. if (!target) {
  7579. warn("Failed to locate Teleport target with selector \"".concat(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.");
  7580. }
  7581. return target;
  7582. }
  7583. } else {
  7584. if (!targetSelector && !isTeleportDisabled(props)) {
  7585. warn("Invalid Teleport target: ".concat(targetSelector));
  7586. }
  7587. return targetSelector;
  7588. }
  7589. };
  7590. var TeleportImpl = {
  7591. __isTeleport: true,
  7592. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  7593. var {
  7594. mc: mountChildren,
  7595. pc: patchChildren,
  7596. pbc: patchBlockChildren,
  7597. o: {
  7598. insert,
  7599. querySelector,
  7600. createText,
  7601. createComment
  7602. }
  7603. } = internals;
  7604. var disabled = isTeleportDisabled(n2.props);
  7605. var {
  7606. shapeFlag,
  7607. children,
  7608. dynamicChildren
  7609. } = n2;
  7610. // #3302
  7611. // HMR updated, force full diff
  7612. if (isHmrUpdating) {
  7613. optimized = false;
  7614. dynamicChildren = null;
  7615. }
  7616. if (n1 == null) {
  7617. // insert anchors in the main view
  7618. var placeholder = n2.el =
  7619. // @ts-expect-error fixed by xxxxxx
  7620. createComment('teleport start');
  7621. var mainAnchor = n2.anchor =
  7622. // @ts-expect-error fixed by xxxxxx
  7623. createComment('teleport end');
  7624. insert(placeholder, container, anchor);
  7625. insert(mainAnchor, container, anchor);
  7626. var target = n2.target = resolveTarget(n2.props, querySelector);
  7627. // @ts-expect-error fixed by xxxxxx
  7628. var targetAnchor = n2.targetAnchor = createText('');
  7629. if (target) {
  7630. insert(targetAnchor, target);
  7631. // #2652 we could be teleporting from a non-SVG tree into an SVG tree
  7632. isSVG = isSVG || isTargetSVG(target);
  7633. } else if (!disabled) {
  7634. warn('Invalid Teleport target on mount:', target, "(".concat(typeof target, ")"));
  7635. }
  7636. var mount = (container, anchor) => {
  7637. // Teleport *always* has Array children. This is enforced in both the
  7638. // compiler and vnode children normalization.
  7639. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7640. mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  7641. }
  7642. };
  7643. if (disabled) {
  7644. mount(container, mainAnchor);
  7645. } else if (target) {
  7646. mount(target, targetAnchor);
  7647. }
  7648. } else {
  7649. // update content
  7650. n2.el = n1.el;
  7651. var _mainAnchor = n2.anchor = n1.anchor;
  7652. var _target = n2.target = n1.target;
  7653. var _targetAnchor = n2.targetAnchor = n1.targetAnchor;
  7654. var wasDisabled = isTeleportDisabled(n1.props);
  7655. var currentContainer = wasDisabled ? container : _target;
  7656. var currentAnchor = wasDisabled ? _mainAnchor : _targetAnchor;
  7657. isSVG = isSVG || isTargetSVG(_target);
  7658. if (dynamicChildren) {
  7659. // fast path when the teleport happens to be a block root
  7660. patchBlockChildren(n1.dynamicChildren, dynamicChildren, currentContainer, parentComponent, parentSuspense, isSVG, slotScopeIds);
  7661. // even in block tree mode we need to make sure all root-level nodes
  7662. // in the teleport inherit previous DOM references so that they can
  7663. // be moved in future patches.
  7664. traverseStaticChildren(n1, n2, true);
  7665. } else if (!optimized) {
  7666. patchChildren(n1, n2, currentContainer, currentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, false);
  7667. }
  7668. if (disabled) {
  7669. if (!wasDisabled) {
  7670. // enabled -> disabled
  7671. // move into main container
  7672. moveTeleport(n2, container, _mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
  7673. }
  7674. } else {
  7675. // target changed
  7676. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  7677. var nextTarget = n2.target = resolveTarget(n2.props, querySelector);
  7678. if (nextTarget) {
  7679. moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
  7680. } else {
  7681. warn('Invalid Teleport target on update:', _target, "(".concat(typeof _target, ")"));
  7682. }
  7683. } else if (wasDisabled) {
  7684. // disabled -> enabled
  7685. // move into teleport target
  7686. moveTeleport(n2, _target, _targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
  7687. }
  7688. }
  7689. }
  7690. updateCssVars(n2);
  7691. },
  7692. remove(vnode, parentComponent, parentSuspense, optimized, _ref17, doRemove) {
  7693. var {
  7694. um: unmount,
  7695. o: {
  7696. remove: hostRemove
  7697. }
  7698. } = _ref17;
  7699. var {
  7700. shapeFlag,
  7701. children,
  7702. anchor,
  7703. targetAnchor,
  7704. target,
  7705. props
  7706. } = vnode;
  7707. if (target) {
  7708. hostRemove(targetAnchor);
  7709. }
  7710. // an unmounted teleport should always remove its children if not disabled
  7711. if (doRemove || !isTeleportDisabled(props)) {
  7712. hostRemove(anchor);
  7713. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7714. for (var i = 0; i < children.length; i++) {
  7715. var child = children[i];
  7716. unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
  7717. }
  7718. }
  7719. }
  7720. },
  7721. move: moveTeleport,
  7722. hydrate: hydrateTeleport
  7723. };
  7724. function moveTeleport(vnode, container, parentAnchor, _ref18) {
  7725. var {
  7726. o: {
  7727. insert
  7728. },
  7729. m: move
  7730. } = _ref18;
  7731. var moveType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  7732. // move target anchor if this is a target change.
  7733. if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
  7734. insert(vnode.targetAnchor, container, parentAnchor);
  7735. }
  7736. var {
  7737. el,
  7738. anchor,
  7739. shapeFlag,
  7740. children,
  7741. props
  7742. } = vnode;
  7743. var isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
  7744. // move main view anchor if this is a re-order.
  7745. if (isReorder) {
  7746. insert(el, container, parentAnchor);
  7747. }
  7748. // if this is a re-order and teleport is enabled (content is in target)
  7749. // do not move children. So the opposite is: only move children if this
  7750. // is not a reorder, or the teleport is disabled
  7751. if (!isReorder || isTeleportDisabled(props)) {
  7752. // Teleport has either Array children or no children.
  7753. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7754. for (var i = 0; i < children.length; i++) {
  7755. move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
  7756. }
  7757. }
  7758. }
  7759. // move main view anchor if this is a re-order.
  7760. if (isReorder) {
  7761. insert(anchor, container, parentAnchor);
  7762. }
  7763. }
  7764. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, _ref19, hydrateChildren) {
  7765. var {
  7766. o: {
  7767. nextSibling,
  7768. parentNode,
  7769. querySelector
  7770. }
  7771. } = _ref19;
  7772. var target = vnode.target = resolveTarget(vnode.props, querySelector);
  7773. if (target) {
  7774. // if multiple teleports rendered to the same target element, we need to
  7775. // pick up from where the last teleport finished instead of the first node
  7776. var targetNode = target._lpa || target.firstChild;
  7777. if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  7778. if (isTeleportDisabled(vnode.props)) {
  7779. vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
  7780. vnode.targetAnchor = targetNode;
  7781. } else {
  7782. vnode.anchor = nextSibling(node);
  7783. // lookahead until we find the target anchor
  7784. // we cannot rely on return value of hydrateChildren() because there
  7785. // could be nested teleports
  7786. var targetAnchor = targetNode;
  7787. while (targetAnchor) {
  7788. targetAnchor = nextSibling(targetAnchor);
  7789. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === 'teleport anchor') {
  7790. vnode.targetAnchor = targetAnchor;
  7791. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  7792. break;
  7793. }
  7794. }
  7795. hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
  7796. }
  7797. }
  7798. updateCssVars(vnode);
  7799. }
  7800. return vnode.anchor && nextSibling(vnode.anchor);
  7801. }
  7802. // Force-casted public typing for h and TSX props inference
  7803. var Teleport = TeleportImpl;
  7804. function updateCssVars(vnode) {
  7805. // presence of .ut method indicates owner component uses css vars.
  7806. // code path here can assume browser environment.
  7807. var ctx = vnode.ctx;
  7808. if (ctx && ctx.ut) {
  7809. var node = vnode.children[0].el;
  7810. while (node !== vnode.targetAnchor) {
  7811. if (node.nodeType === 1) node.setAttribute('data-v-owner', ctx.uid);
  7812. node = node.nextSibling;
  7813. }
  7814. ctx.ut();
  7815. }
  7816. }
  7817. var Fragment = Symbol('Fragment');
  7818. var Text = Symbol('Text');
  7819. var Comment = Symbol('Comment');
  7820. var Static = Symbol('Static');
  7821. // Since v-if and v-for are the two possible ways node structure can dynamically
  7822. // change, once we consider v-if branches and each v-for fragment a block, we
  7823. // can divide a template into nested blocks, and within each block the node
  7824. // structure would be stable. This allows us to skip most children diffing
  7825. // and only worry about the dynamic nodes (indicated by patch flags).
  7826. var blockStack = [];
  7827. var currentBlock = null;
  7828. /**
  7829. * Open a block.
  7830. * This must be called before `createBlock`. It cannot be part of `createBlock`
  7831. * because the children of the block are evaluated before `createBlock` itself
  7832. * is called. The generated code typically looks like this:
  7833. *
  7834. * ```js
  7835. * function render() {
  7836. * return (openBlock(),createBlock('div', null, [...]))
  7837. * }
  7838. * ```
  7839. * disableTracking is true when creating a v-for fragment block, since a v-for
  7840. * fragment always diffs its children.
  7841. *
  7842. * @private
  7843. */
  7844. function openBlock() {
  7845. var disableTracking = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7846. blockStack.push(currentBlock = disableTracking ? null : []);
  7847. }
  7848. function closeBlock() {
  7849. blockStack.pop();
  7850. currentBlock = blockStack[blockStack.length - 1] || null;
  7851. }
  7852. // Whether we should be tracking dynamic child nodes inside a block.
  7853. // Only tracks when this value is > 0
  7854. // We are not using a simple boolean because this value may need to be
  7855. // incremented/decremented by nested usage of v-once (see below)
  7856. var isBlockTreeEnabled = 1;
  7857. /**
  7858. * Block tracking sometimes needs to be disabled, for example during the
  7859. * creation of a tree that needs to be cached by v-once. The compiler generates
  7860. * code like this:
  7861. *
  7862. * ``` js
  7863. * _cache[1] || (
  7864. * setBlockTracking(-1),
  7865. * _cache[1] = createVNode(...),
  7866. * setBlockTracking(1),
  7867. * _cache[1]
  7868. * )
  7869. * ```
  7870. *
  7871. * @private
  7872. */
  7873. function setBlockTracking(value) {
  7874. isBlockTreeEnabled += value;
  7875. }
  7876. function setupBlock(vnode) {
  7877. // save current block children on the block vnode
  7878. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  7879. // close block
  7880. closeBlock();
  7881. // a block is always going to be patched, so track it as a child of its
  7882. // parent block
  7883. if (isBlockTreeEnabled > 0 && currentBlock) {
  7884. currentBlock.push(vnode);
  7885. }
  7886. return vnode;
  7887. }
  7888. /**
  7889. * @private
  7890. */
  7891. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  7892. return setupBlock(createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, true /* isBlock */));
  7893. }
  7894. /**
  7895. * Create a block root vnode. Takes the same exact arguments as `createVNode`.
  7896. * A block root keeps track of dynamic nodes within the block in the
  7897. * `dynamicChildren` array.
  7898. *
  7899. * @private
  7900. */
  7901. function createBlock(type, props, children, patchFlag, dynamicProps) {
  7902. return setupBlock(createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */));
  7903. }
  7904. function isVNode(value) {
  7905. return value ? value.__v_isVNode === true : false;
  7906. }
  7907. function isSameVNodeType(n1, n2) {
  7908. if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && hmrDirtyComponents.has(n2.type)) {
  7909. // #7042, ensure the vnode being unmounted during HMR
  7910. // bitwise operations to remove keep alive flags
  7911. n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
  7912. n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
  7913. // HMR only: if the component has been hot-updated, force a reload.
  7914. return false;
  7915. }
  7916. return n1.type === n2.type && n1.key === n2.key;
  7917. }
  7918. var vnodeArgsTransformer;
  7919. /**
  7920. * Internal API for registering an arguments transform for createVNode
  7921. * used for creating stubs in the test-utils
  7922. * It is *internal* but needs to be exposed for test-utils to pick up proper
  7923. * typings
  7924. */
  7925. function transformVNodeArgs(transformer) {
  7926. vnodeArgsTransformer = transformer;
  7927. }
  7928. var createVNodeWithArgsTransform = function () {
  7929. for (var _len10 = arguments.length, args = new Array(_len10), _key19 = 0; _key19 < _len10; _key19++) {
  7930. args[_key19] = arguments[_key19];
  7931. }
  7932. return _createVNode(...(vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args));
  7933. };
  7934. var InternalObjectKey = "__vInternal";
  7935. var normalizeKey = _ref20 => {
  7936. var {
  7937. key
  7938. } = _ref20;
  7939. return key != null ? key : null;
  7940. };
  7941. var normalizeRef = _ref21 => {
  7942. var {
  7943. ref,
  7944. ref_key,
  7945. ref_for
  7946. } = _ref21;
  7947. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? {
  7948. i: currentRenderingInstance,
  7949. r: ref,
  7950. k: ref_key,
  7951. f: !!ref_for
  7952. } : ref : null;
  7953. };
  7954. function createBaseVNode(type) {
  7955. var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  7956. var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  7957. var patchFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  7958. var dynamicProps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  7959. var shapeFlag = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : type === Fragment ? 0 : 1;
  7960. var isBlockNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  7961. var needFullChildrenNormalization = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
  7962. var vnode = {
  7963. __v_isVNode: true,
  7964. __v_skip: true,
  7965. type,
  7966. props,
  7967. key: props && normalizeKey(props),
  7968. ref: props && normalizeRef(props),
  7969. scopeId: currentScopeId,
  7970. slotScopeIds: null,
  7971. children,
  7972. component: null,
  7973. suspense: null,
  7974. ssContent: null,
  7975. ssFallback: null,
  7976. dirs: null,
  7977. transition: null,
  7978. el: null,
  7979. anchor: null,
  7980. target: null,
  7981. targetAnchor: null,
  7982. staticCount: 0,
  7983. shapeFlag,
  7984. patchFlag,
  7985. dynamicProps,
  7986. dynamicChildren: null,
  7987. appContext: null,
  7988. // fixed by xxxxxx
  7989. hostInstance: currentRenderingInstance,
  7990. ctx: currentRenderingInstance
  7991. };
  7992. if (needFullChildrenNormalization) {
  7993. normalizeChildren(vnode, children);
  7994. // normalize suspense children
  7995. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  7996. type.normalize(vnode);
  7997. }
  7998. } else if (children) {
  7999. // compiled element vnode - if children is passed, only possible types are
  8000. // string or Array.
  8001. vnode.shapeFlag |= isString(children) ? 8 /* ShapeFlags.TEXT_CHILDREN */ : 16 /* ShapeFlags.ARRAY_CHILDREN */;
  8002. }
  8003. // validate key
  8004. if (vnode.key !== vnode.key) {
  8005. warn("VNode created with invalid key (NaN). VNode type:", vnode.type);
  8006. }
  8007. // track vnode for block tree
  8008. if (isBlockTreeEnabled > 0 &&
  8009. // avoid a block node from tracking itself
  8010. !isBlockNode &&
  8011. // has current parent block
  8012. currentBlock && (
  8013. // presence of a patch flag indicates this node needs patching on updates.
  8014. // component nodes also should always be patched, because even if the
  8015. // component doesn't need to update, it needs to persist the instance on to
  8016. // the next vnode so that it can be properly unmounted later.
  8017. vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
  8018. // the EVENTS flag is only for hydration and if it is the only flag, the
  8019. // vnode should not be considered dynamic due to handler caching.
  8020. vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
  8021. currentBlock.push(vnode);
  8022. }
  8023. return vnode;
  8024. }
  8025. var createVNode = createVNodeWithArgsTransform;
  8026. function _createVNode(type) {
  8027. var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  8028. var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  8029. var patchFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  8030. var dynamicProps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  8031. var isBlockNode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  8032. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8033. if (!type) {
  8034. warn("Invalid vnode type when creating vnode: ".concat(type, "."));
  8035. }
  8036. type = Comment;
  8037. }
  8038. if (isVNode(type)) {
  8039. // createVNode receiving an existing vnode. This happens in cases like
  8040. // <component :is="vnode"/>
  8041. // #2078 make sure to merge refs during the clone instead of overwriting it
  8042. var cloned = cloneVNode(type, props, true /* mergeRef: true */);
  8043. if (children) {
  8044. normalizeChildren(cloned, children);
  8045. }
  8046. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8047. if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  8048. currentBlock[currentBlock.indexOf(type)] = cloned;
  8049. } else {
  8050. currentBlock.push(cloned);
  8051. }
  8052. }
  8053. cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
  8054. return cloned;
  8055. }
  8056. // class component normalization.
  8057. if (isClassComponent(type)) {
  8058. type = type.__vccOpts;
  8059. }
  8060. // class & style normalization.
  8061. if (props) {
  8062. // for reactive or proxy objects, we need to clone it to enable mutation.
  8063. props = guardReactiveProps(props);
  8064. var {
  8065. class: klass,
  8066. style
  8067. } = props;
  8068. if (klass && !isString(klass)) {
  8069. props.class = normalizeClass(klass);
  8070. }
  8071. if (isObject(style)) {
  8072. // reactive state objects need to be cloned since they are likely to be
  8073. // mutated
  8074. if (isProxy(style) && !isArray(style)) {
  8075. style = extend$1({}, style);
  8076. }
  8077. props.style = normalizeStyle(style);
  8078. }
  8079. }
  8080. // encode the vnode type information into a bitmap
  8081. var shapeFlag = isString(type) ? 1 /* ShapeFlags.ELEMENT */ : isSuspense(type) ? 128 /* ShapeFlags.SUSPENSE */ : isTeleport(type) ? 64 /* ShapeFlags.TELEPORT */ : isObject(type) ? 4 /* ShapeFlags.STATEFUL_COMPONENT */ : isFunction(type) ? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */ : 0;
  8082. if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
  8083. type = toRaw(type);
  8084. warn("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`.", "\nComponent that was made reactive: ", type);
  8085. }
  8086. return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
  8087. }
  8088. function guardReactiveProps(props) {
  8089. if (!props) return null;
  8090. return isProxy(props) || InternalObjectKey in props ? extend$1({}, props) : props;
  8091. }
  8092. function cloneVNode(vnode, extraProps) {
  8093. var mergeRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  8094. // This is intentionally NOT using spread or extend to avoid the runtime
  8095. // key enumeration cost.
  8096. var {
  8097. props,
  8098. ref,
  8099. patchFlag,
  8100. children
  8101. } = vnode;
  8102. var mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8103. var cloned = {
  8104. __v_isVNode: true,
  8105. __v_skip: true,
  8106. type: vnode.type,
  8107. props: mergedProps,
  8108. key: mergedProps && normalizeKey(mergedProps),
  8109. ref: extraProps && extraProps.ref ?
  8110. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8111. // if the vnode itself already has a ref, cloneVNode will need to merge
  8112. // the refs so the single vnode can be set on multiple refs
  8113. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,
  8114. scopeId: vnode.scopeId,
  8115. slotScopeIds: vnode.slotScopeIds,
  8116. children: patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children) ? children.map(deepCloneVNode) : children,
  8117. target: vnode.target,
  8118. targetAnchor: vnode.targetAnchor,
  8119. staticCount: vnode.staticCount,
  8120. shapeFlag: vnode.shapeFlag,
  8121. // if the vnode is cloned with extra props, we can no longer assume its
  8122. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8123. // note: preserve flag for fragments since they use the flag for children
  8124. // fast paths only.
  8125. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 // hoisted node
  8126. ? 16 /* PatchFlags.FULL_PROPS */ : patchFlag | 16 /* PatchFlags.FULL_PROPS */ : patchFlag,
  8127. dynamicProps: vnode.dynamicProps,
  8128. dynamicChildren: vnode.dynamicChildren,
  8129. appContext: vnode.appContext,
  8130. // fixed by xxxxxx
  8131. hostInstance: vnode.hostInstance,
  8132. dirs: vnode.dirs,
  8133. transition: vnode.transition,
  8134. // These should technically only be non-null on mounted VNodes. However,
  8135. // they *should* be copied for kept-alive vnodes. So we just always copy
  8136. // them since them being non-null during a mount doesn't affect the logic as
  8137. // they will simply be overwritten.
  8138. component: vnode.component,
  8139. suspense: vnode.suspense,
  8140. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8141. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8142. el: vnode.el,
  8143. anchor: vnode.anchor,
  8144. ctx: vnode.ctx,
  8145. ce: vnode.ce
  8146. };
  8147. return cloned;
  8148. }
  8149. /**
  8150. * Dev only, for HMR of hoisted vnodes reused in v-for
  8151. * https://github.com/vitejs/vite/issues/2022
  8152. */
  8153. function deepCloneVNode(vnode) {
  8154. var cloned = cloneVNode(vnode);
  8155. if (isArray(vnode.children)) {
  8156. cloned.children = vnode.children.map(deepCloneVNode);
  8157. }
  8158. return cloned;
  8159. }
  8160. /**
  8161. * @private
  8162. */
  8163. function createTextVNode() {
  8164. var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ' ';
  8165. var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  8166. return createVNode(Text, null, text, flag);
  8167. }
  8168. /**
  8169. * @private
  8170. */
  8171. function createStaticVNode(content, numberOfNodes) {
  8172. // A static vnode can contain multiple stringified elements, and the number
  8173. // of elements is necessary for hydration.
  8174. var vnode = createVNode(Static, null, content);
  8175. vnode.staticCount = numberOfNodes;
  8176. return vnode;
  8177. }
  8178. /**
  8179. * @private
  8180. */
  8181. function createCommentVNode() {
  8182. var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  8183. var asBlock = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8184. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8185. }
  8186. function normalizeVNode(child) {
  8187. if (child == null || typeof child === 'boolean') {
  8188. // empty placeholder
  8189. return createVNode(Comment);
  8190. } else if (isArray(child)) {
  8191. // fragment
  8192. return createVNode(Fragment, null,
  8193. // #3666, avoid reference pollution when reusing vnode
  8194. child.slice());
  8195. } else if (typeof child === 'object') {
  8196. // already vnode, this should be the most common since compiled templates
  8197. // always produce all-vnode children arrays
  8198. return cloneIfMounted(child);
  8199. } else {
  8200. // strings and numbers
  8201. return createVNode(Text, null, String(child));
  8202. }
  8203. }
  8204. // optimized normalization for template-compiled render fns
  8205. function cloneIfMounted(child) {
  8206. return child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */ || child.memo ? child : cloneVNode(child);
  8207. }
  8208. function normalizeChildren(vnode, children) {
  8209. var type = 0;
  8210. var {
  8211. shapeFlag
  8212. } = vnode;
  8213. if (children == null) {
  8214. children = null;
  8215. } else if (isArray(children)) {
  8216. type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
  8217. } else if (typeof children === 'object') {
  8218. if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
  8219. // Normalize slot to plain children for plain element and Teleport
  8220. var slot = children.default;
  8221. if (slot) {
  8222. // _c marker is added by withCtx() indicating this is a compiled slot
  8223. slot._c && (slot._d = false);
  8224. normalizeChildren(vnode, slot());
  8225. slot._c && (slot._d = true);
  8226. }
  8227. return;
  8228. } else {
  8229. type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
  8230. var slotFlag = children._;
  8231. if (!slotFlag && !(InternalObjectKey in children)) {
  8232. children._ctx = currentRenderingInstance;
  8233. } else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
  8234. // a child component receives forwarded slots from the parent.
  8235. // its slot type is determined by its parent's slot type.
  8236. if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
  8237. children._ = 1 /* SlotFlags.STABLE */;
  8238. } else {
  8239. children._ = 2 /* SlotFlags.DYNAMIC */;
  8240. vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
  8241. }
  8242. }
  8243. }
  8244. } else if (isFunction(children)) {
  8245. children = {
  8246. default: children,
  8247. _ctx: currentRenderingInstance
  8248. };
  8249. type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
  8250. } else {
  8251. children = String(children);
  8252. // force teleport children to array so it can be moved around
  8253. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  8254. type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
  8255. children = [createTextVNode(children)];
  8256. } else {
  8257. type = 8 /* ShapeFlags.TEXT_CHILDREN */;
  8258. }
  8259. }
  8260. vnode.children = children;
  8261. vnode.shapeFlag |= type;
  8262. }
  8263. function mergeProps() {
  8264. var ret = {};
  8265. for (var i = 0; i < arguments.length; i++) {
  8266. var toMerge = i < 0 || arguments.length <= i ? undefined : arguments[i];
  8267. for (var key in toMerge) {
  8268. if (key === 'class') {
  8269. if (ret.class !== toMerge.class) {
  8270. ret.class = normalizeClass([ret.class, toMerge.class]);
  8271. }
  8272. } else if (key === 'style') {
  8273. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8274. } else if (isOn(key)) {
  8275. var existing = ret[key];
  8276. var incoming = toMerge[key];
  8277. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8278. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8279. }
  8280. } else if (key !== '') {
  8281. ret[key] = toMerge[key];
  8282. }
  8283. }
  8284. }
  8285. return ret;
  8286. }
  8287. function invokeVNodeHook(hook, instance, vnode) {
  8288. var prevVNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  8289. callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [vnode, prevVNode]);
  8290. }
  8291. var emptyAppContext = createAppContext();
  8292. var uid = 0;
  8293. function createComponentInstance(vnode, parent, suspense) {
  8294. var type = vnode.type;
  8295. // inherit parent app context - or - if root, adopt from root vnode
  8296. var appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8297. var instance = {
  8298. uid: uid++,
  8299. vnode,
  8300. type,
  8301. parent,
  8302. appContext,
  8303. root: null,
  8304. next: null,
  8305. subTree: null,
  8306. effect: null,
  8307. update: null,
  8308. scope: new EffectScope(true /* detached */),
  8309. render: null,
  8310. proxy: null,
  8311. exposed: null,
  8312. exposeProxy: null,
  8313. withProxy: null,
  8314. provides: parent ? parent.provides : Object.create(appContext.provides),
  8315. accessCache: null,
  8316. renderCache: [],
  8317. // local resolved assets
  8318. components: null,
  8319. directives: null,
  8320. // resolved props and emits options
  8321. propsOptions: normalizePropsOptions(type, appContext),
  8322. emitsOptions: normalizeEmitsOptions(type, appContext),
  8323. // emit
  8324. emit: null,
  8325. emitted: null,
  8326. // props default value
  8327. propsDefaults: EMPTY_OBJ,
  8328. // inheritAttrs
  8329. inheritAttrs: type.inheritAttrs,
  8330. // state
  8331. ctx: EMPTY_OBJ,
  8332. data: EMPTY_OBJ,
  8333. props: EMPTY_OBJ,
  8334. attrs: EMPTY_OBJ,
  8335. slots: EMPTY_OBJ,
  8336. refs: EMPTY_OBJ,
  8337. setupState: EMPTY_OBJ,
  8338. setupContext: null,
  8339. // suspense related
  8340. suspense,
  8341. suspenseId: suspense ? suspense.pendingId : 0,
  8342. asyncDep: null,
  8343. asyncResolved: false,
  8344. // lifecycle hooks
  8345. // not using enums here because it results in computed properties
  8346. isMounted: false,
  8347. isUnmounted: false,
  8348. isDeactivated: false,
  8349. bc: null,
  8350. c: null,
  8351. bm: null,
  8352. m: null,
  8353. bu: null,
  8354. u: null,
  8355. um: null,
  8356. bum: null,
  8357. da: null,
  8358. a: null,
  8359. rtg: null,
  8360. rtc: null,
  8361. ec: null,
  8362. sp: null,
  8363. $waitNativeRender(fn) {
  8364. // TODO use native
  8365. setTimeout(fn, 150);
  8366. }
  8367. };
  8368. {
  8369. instance.ctx = createDevRenderContext(instance);
  8370. }
  8371. instance.root = parent ? parent.root : instance;
  8372. instance.emit = emit.bind(null, instance);
  8373. // apply custom element special handling
  8374. if (vnode.ce) {
  8375. vnode.ce(instance);
  8376. }
  8377. return instance;
  8378. }
  8379. var currentInstance = null;
  8380. var getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8381. var setCurrentInstance = instance => {
  8382. currentInstance = instance;
  8383. instance.scope.on();
  8384. };
  8385. var unsetCurrentInstance = () => {
  8386. currentInstance && currentInstance.scope.off();
  8387. currentInstance = null;
  8388. };
  8389. var isBuiltInTag = /*#__PURE__*/makeMap('slot,component');
  8390. function validateComponentName(name, config) {
  8391. var appIsNativeTag = config.isNativeTag || NO;
  8392. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  8393. warn('Do not use built-in or reserved HTML elements as component id: ' + name);
  8394. }
  8395. }
  8396. function isStatefulComponent(instance) {
  8397. return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
  8398. }
  8399. var isInSSRComponentSetup = false;
  8400. function setupComponent(instance) {
  8401. var isSSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8402. isInSSRComponentSetup = isSSR;
  8403. var {
  8404. props,
  8405. children
  8406. } = instance.vnode;
  8407. var isStateful = isStatefulComponent(instance);
  8408. initProps(instance, props, isStateful, isSSR);
  8409. initSlots(instance, children);
  8410. var setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : undefined;
  8411. isInSSRComponentSetup = false;
  8412. return setupResult;
  8413. }
  8414. function setupStatefulComponent(instance, isSSR) {
  8415. var _a;
  8416. var Component = instance.type;
  8417. {
  8418. if (Component.name) {
  8419. validateComponentName(Component.name, instance.appContext.config);
  8420. }
  8421. if (Component.components) {
  8422. var names = Object.keys(Component.components);
  8423. for (var i = 0; i < names.length; i++) {
  8424. validateComponentName(names[i], instance.appContext.config);
  8425. }
  8426. }
  8427. if (Component.directives) {
  8428. var _names = Object.keys(Component.directives);
  8429. for (var _i4 = 0; _i4 < _names.length; _i4++) {
  8430. validateDirectiveName(_names[_i4]);
  8431. }
  8432. }
  8433. if (Component.compilerOptions && isRuntimeOnly()) {
  8434. warn("\"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.");
  8435. }
  8436. }
  8437. // 0. create render proxy property access cache
  8438. instance.accessCache = Object.create(null);
  8439. // 1. create public instance / render proxy
  8440. // also mark it raw so it's never observed
  8441. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  8442. {
  8443. exposePropsOnRenderContext(instance);
  8444. }
  8445. // 2. call setup()
  8446. var {
  8447. setup
  8448. } = Component;
  8449. if (setup) {
  8450. var setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  8451. setCurrentInstance(instance);
  8452. pauseTracking();
  8453. var setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [shallowReadonly(instance.props), setupContext]);
  8454. resetTracking();
  8455. unsetCurrentInstance();
  8456. if (isPromise(setupResult)) {
  8457. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  8458. if (isSSR) {
  8459. // return the promise so server-renderer can wait on it
  8460. return setupResult.then(resolvedResult => {
  8461. handleSetupResult(instance, resolvedResult, isSSR);
  8462. }).catch(e => {
  8463. handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
  8464. });
  8465. } else {
  8466. // async setup returned Promise.
  8467. // bail here and wait for re-entry.
  8468. instance.asyncDep = setupResult;
  8469. if (!instance.suspense) {
  8470. var name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
  8471. warn("Component <".concat(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.");
  8472. }
  8473. }
  8474. } else {
  8475. handleSetupResult(instance, setupResult, isSSR);
  8476. }
  8477. } else {
  8478. finishComponentSetup(instance, isSSR);
  8479. }
  8480. }
  8481. function handleSetupResult(instance, setupResult, isSSR) {
  8482. if (isFunction(setupResult)) {
  8483. // setup returned an inline render function
  8484. {
  8485. instance.render = setupResult;
  8486. }
  8487. } else if (isObject(setupResult)) {
  8488. if (isVNode(setupResult)) {
  8489. warn("setup() should not return VNodes directly - " + "return a render function instead.");
  8490. }
  8491. // setup returned bindings.
  8492. // assuming a render function compiled from template is present.
  8493. {
  8494. instance.devtoolsRawSetupState = setupResult;
  8495. }
  8496. instance.setupState = proxyRefs(setupResult);
  8497. {
  8498. exposeSetupStateOnRenderContext(instance);
  8499. }
  8500. } else if (setupResult !== undefined) {
  8501. warn("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
  8502. }
  8503. finishComponentSetup(instance, isSSR);
  8504. }
  8505. var compile;
  8506. var installWithProxy;
  8507. /**
  8508. * For runtime-dom to register the compiler.
  8509. * Note the exported method uses any to avoid d.ts relying on the compiler types.
  8510. */
  8511. function registerRuntimeCompiler(_compile) {
  8512. compile = _compile;
  8513. installWithProxy = i => {
  8514. if (i.render._rc) {
  8515. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  8516. }
  8517. };
  8518. }
  8519. // dev only
  8520. var isRuntimeOnly = () => !compile;
  8521. function finishComponentSetup(instance, isSSR, skipOptions) {
  8522. var Component = instance.type;
  8523. // template / render function normalization
  8524. // could be already set when returned from setup()
  8525. if (!instance.render) {
  8526. // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
  8527. // is done by server-renderer
  8528. if (!isSSR && compile && !Component.render) {
  8529. var template = Component.template || resolveMergedOptions(instance).template;
  8530. if (template) {
  8531. {
  8532. startMeasure(instance, "compile");
  8533. }
  8534. var {
  8535. isCustomElement,
  8536. compilerOptions
  8537. } = instance.appContext.config;
  8538. var {
  8539. delimiters,
  8540. compilerOptions: componentCompilerOptions
  8541. } = Component;
  8542. var finalCompilerOptions = extend$1(extend$1({
  8543. isCustomElement,
  8544. delimiters
  8545. }, compilerOptions), componentCompilerOptions);
  8546. Component.render = compile(template, finalCompilerOptions);
  8547. {
  8548. endMeasure(instance, "compile");
  8549. }
  8550. }
  8551. }
  8552. instance.render = Component.render || NOOP;
  8553. // for runtime-compiled render functions using `with` blocks, the render
  8554. // proxy used needs a different `has` handler which is more performant and
  8555. // also only allows a whitelist of globals to fallthrough.
  8556. if (installWithProxy) {
  8557. installWithProxy(instance);
  8558. }
  8559. }
  8560. // support for 2.x options
  8561. {
  8562. setCurrentInstance(instance);
  8563. pauseTracking();
  8564. applyOptions(instance);
  8565. resetTracking();
  8566. unsetCurrentInstance();
  8567. }
  8568. // warn missing template/render
  8569. // the runtime compilation of template in SSR is done by server-render
  8570. if (!Component.render && instance.render === NOOP && !isSSR) {
  8571. /* istanbul ignore if */
  8572. if (!compile && Component.template) {
  8573. warn("Component provided template option but " + "runtime compilation is not supported in this build of Vue." + " Configure your bundler to alias \"vue\" to \"vue/dist/vue.esm-bundler.js\"." /* should not happen */);
  8574. } else {
  8575. warn("Component is missing template or render function.");
  8576. }
  8577. }
  8578. }
  8579. function createAttrsProxy(instance) {
  8580. return new Proxy(instance.attrs, {
  8581. get(target, key) {
  8582. markAttrsAccessed();
  8583. track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
  8584. return target[key];
  8585. },
  8586. set() {
  8587. warn("setupContext.attrs is readonly.");
  8588. return false;
  8589. },
  8590. deleteProperty() {
  8591. warn("setupContext.attrs is readonly.");
  8592. return false;
  8593. }
  8594. });
  8595. }
  8596. function createSetupContext(instance) {
  8597. var expose = exposed => {
  8598. {
  8599. if (instance.exposed) {
  8600. warn("expose() should be called only once per setup().");
  8601. }
  8602. if (exposed != null) {
  8603. var exposedType = typeof exposed;
  8604. if (exposedType === 'object') {
  8605. if (isArray(exposed)) {
  8606. exposedType = 'array';
  8607. } else if (isRef(exposed)) {
  8608. exposedType = 'ref';
  8609. }
  8610. }
  8611. if (exposedType !== 'object') {
  8612. warn("expose() should be passed a plain object, received ".concat(exposedType, "."));
  8613. }
  8614. }
  8615. }
  8616. instance.exposed = exposed || {};
  8617. };
  8618. var attrs;
  8619. {
  8620. // We use getters in dev in case libs like test-utils overwrite instance
  8621. // properties (overwrites should not be done in prod)
  8622. return Object.freeze({
  8623. get attrs() {
  8624. return attrs || (attrs = createAttrsProxy(instance));
  8625. },
  8626. get slots() {
  8627. return shallowReadonly(instance.slots);
  8628. },
  8629. get emit() {
  8630. return function (event) {
  8631. for (var _len11 = arguments.length, args = new Array(_len11 > 1 ? _len11 - 1 : 0), _key20 = 1; _key20 < _len11; _key20++) {
  8632. args[_key20 - 1] = arguments[_key20];
  8633. }
  8634. return instance.emit(event, ...args);
  8635. };
  8636. },
  8637. expose
  8638. });
  8639. }
  8640. }
  8641. function getExposeProxy(instance) {
  8642. if (instance.exposed) {
  8643. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  8644. get(target, key) {
  8645. if (key in target) {
  8646. return target[key];
  8647. } else if (key in publicPropertiesMap) {
  8648. return publicPropertiesMap[key](instance);
  8649. }
  8650. },
  8651. has(target, key) {
  8652. return key in target || key in publicPropertiesMap;
  8653. }
  8654. }));
  8655. }
  8656. }
  8657. var classifyRE = /(?:^|[-_])(\w)/g;
  8658. var classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
  8659. function getComponentName(Component) {
  8660. var includeInferred = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  8661. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  8662. }
  8663. /* istanbul ignore next */
  8664. function formatComponentName(instance, Component) {
  8665. var isRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  8666. var name = getComponentName(Component);
  8667. if (!name && Component.__file) {
  8668. var match = Component.__file.match(/([^/\\]+)\.\w+$/);
  8669. if (match) {
  8670. name = match[1];
  8671. }
  8672. }
  8673. if (!name && instance && instance.parent) {
  8674. // try to infer the name based on reverse resolution
  8675. var inferFromRegistry = registry => {
  8676. for (var key in registry) {
  8677. if (registry[key] === Component) {
  8678. return key;
  8679. }
  8680. }
  8681. };
  8682. name = inferFromRegistry(instance.components || instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
  8683. }
  8684. return name ? classify(name) : isRoot ? "App" : "Anonymous";
  8685. }
  8686. function isClassComponent(value) {
  8687. return isFunction(value) && '__vccOpts' in value;
  8688. }
  8689. var computed = (getterOrOptions, debugOptions) => {
  8690. // @ts-ignore
  8691. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  8692. };
  8693. // dev only
  8694. var warnRuntimeUsage = method => warn("".concat(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.");
  8695. // implementation
  8696. function defineProps() {
  8697. {
  8698. warnRuntimeUsage("defineProps");
  8699. }
  8700. return null;
  8701. }
  8702. // implementation
  8703. function defineEmits() {
  8704. {
  8705. warnRuntimeUsage("defineEmits");
  8706. }
  8707. return null;
  8708. }
  8709. /**
  8710. * Vue `<script setup>` compiler macro for declaring a component's exposed
  8711. * instance properties when it is accessed by a parent component via template
  8712. * refs.
  8713. *
  8714. * `<script setup>` components are closed by default - i.e. variables inside
  8715. * the `<script setup>` scope is not exposed to parent unless explicitly exposed
  8716. * via `defineExpose`.
  8717. *
  8718. * This is only usable inside `<script setup>`, is compiled away in the
  8719. * output and should **not** be actually called at runtime.
  8720. */
  8721. function defineExpose(exposed) {
  8722. {
  8723. warnRuntimeUsage("defineExpose");
  8724. }
  8725. }
  8726. /**
  8727. * Vue `<script setup>` compiler macro for providing props default values when
  8728. * using type-based `defineProps` declaration.
  8729. *
  8730. * Example usage:
  8731. * ```ts
  8732. * withDefaults(defineProps<{
  8733. * size?: number
  8734. * labels?: string[]
  8735. * }>(), {
  8736. * size: 3,
  8737. * labels: () => ['default label']
  8738. * })
  8739. * ```
  8740. *
  8741. * This is only usable inside `<script setup>`, is compiled away in the output
  8742. * and should **not** be actually called at runtime.
  8743. */
  8744. function withDefaults(props, defaults) {
  8745. {
  8746. warnRuntimeUsage("withDefaults");
  8747. }
  8748. return null;
  8749. }
  8750. function useSlots() {
  8751. return getContext().slots;
  8752. }
  8753. function useAttrs() {
  8754. return getContext().attrs;
  8755. }
  8756. function getContext() {
  8757. var i = getCurrentInstance();
  8758. if (!i) {
  8759. warn("useContext() called without active instance.");
  8760. }
  8761. return i.setupContext || (i.setupContext = createSetupContext(i));
  8762. }
  8763. /**
  8764. * Runtime helper for merging default declarations. Imported by compiled code
  8765. * only.
  8766. * @internal
  8767. */
  8768. function mergeDefaults(raw, defaults) {
  8769. var props = isArray(raw) ? raw.reduce((normalized, p) => (normalized[p] = {}, normalized), {}) : raw;
  8770. for (var key in defaults) {
  8771. var opt = props[key];
  8772. if (opt) {
  8773. if (isArray(opt) || isFunction(opt)) {
  8774. props[key] = {
  8775. type: opt,
  8776. default: defaults[key]
  8777. };
  8778. } else {
  8779. opt.default = defaults[key];
  8780. }
  8781. } else if (opt === null) {
  8782. props[key] = {
  8783. default: defaults[key]
  8784. };
  8785. } else {
  8786. warn("props default key \"".concat(key, "\" has no corresponding declaration."));
  8787. }
  8788. }
  8789. return props;
  8790. }
  8791. /**
  8792. * Used to create a proxy for the rest element when destructuring props with
  8793. * defineProps().
  8794. * @internal
  8795. */
  8796. function createPropsRestProxy(props, excludedKeys) {
  8797. var ret = {};
  8798. var _loop5 = function (key) {
  8799. if (!excludedKeys.includes(key)) {
  8800. Object.defineProperty(ret, key, {
  8801. enumerable: true,
  8802. get: () => props[key]
  8803. });
  8804. }
  8805. };
  8806. for (var key in props) {
  8807. _loop5(key);
  8808. }
  8809. return ret;
  8810. }
  8811. /**
  8812. * `<script setup>` helper for persisting the current instance context over
  8813. * async/await flows.
  8814. *
  8815. * `@vue/compiler-sfc` converts the following:
  8816. *
  8817. * ```ts
  8818. * const x = await foo()
  8819. * ```
  8820. *
  8821. * into:
  8822. *
  8823. * ```ts
  8824. * let __temp, __restore
  8825. * const x = (([__temp, __restore] = withAsyncContext(() => foo())),__temp=await __temp,__restore(),__temp)
  8826. * ```
  8827. * @internal
  8828. */
  8829. function withAsyncContext(getAwaitable) {
  8830. var ctx = getCurrentInstance();
  8831. if (!ctx) {
  8832. warn("withAsyncContext called without active current instance. " + "This is likely a bug.");
  8833. }
  8834. var awaitable = getAwaitable();
  8835. unsetCurrentInstance();
  8836. if (isPromise(awaitable)) {
  8837. awaitable = awaitable.catch(e => {
  8838. setCurrentInstance(ctx);
  8839. throw e;
  8840. });
  8841. }
  8842. return [awaitable, () => setCurrentInstance(ctx)];
  8843. }
  8844. // Actual implementation
  8845. function h(type, propsOrChildren, children) {
  8846. var l = arguments.length;
  8847. if (l === 2) {
  8848. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  8849. // single vnode without props
  8850. if (isVNode(propsOrChildren)) {
  8851. return createVNode(type, null, [propsOrChildren]);
  8852. }
  8853. // props without children
  8854. return createVNode(type, propsOrChildren);
  8855. } else {
  8856. // omit props
  8857. return createVNode(type, null, propsOrChildren);
  8858. }
  8859. } else {
  8860. if (l > 3) {
  8861. children = Array.prototype.slice.call(arguments, 2);
  8862. } else if (l === 3 && isVNode(children)) {
  8863. children = [children];
  8864. }
  8865. return createVNode(type, propsOrChildren, children);
  8866. }
  8867. }
  8868. var ssrContextKey = Symbol("ssrContext");
  8869. var useSSRContext = () => {
  8870. {
  8871. var ctx = inject(ssrContextKey);
  8872. if (!ctx) {
  8873. warn("Server rendering context not provided. Make sure to only call " + "useSSRContext() conditionally in the server build.");
  8874. }
  8875. return ctx;
  8876. }
  8877. };
  8878. function isShallow(value) {
  8879. return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
  8880. }
  8881. function initCustomFormatter() {
  8882. /* eslint-disable no-restricted-globals */
  8883. if (typeof window === 'undefined') {
  8884. return;
  8885. }
  8886. var vueStyle = {
  8887. style: 'color:#3ba776'
  8888. };
  8889. var numberStyle = {
  8890. style: 'color:#0b1bc9'
  8891. };
  8892. var stringStyle = {
  8893. style: 'color:#b62e24'
  8894. };
  8895. var keywordStyle = {
  8896. style: 'color:#9d288c'
  8897. };
  8898. // custom formatter for Chrome
  8899. // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
  8900. var formatter = {
  8901. header(obj) {
  8902. // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
  8903. if (!isObject(obj)) {
  8904. return null;
  8905. }
  8906. if (obj.__isVue) {
  8907. return ['div', vueStyle, "VueInstance"];
  8908. } else if (isRef(obj)) {
  8909. return ['div', {}, ['span', vueStyle, genRefFlag(obj)], '<', formatValue(obj.value), ">"];
  8910. } else if (isReactive(obj)) {
  8911. return ['div', {}, ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'], '<', formatValue(obj), ">".concat(isReadonly(obj) ? " (readonly)" : "")];
  8912. } else if (isReadonly(obj)) {
  8913. return ['div', {}, ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'], '<', formatValue(obj), '>'];
  8914. }
  8915. return null;
  8916. },
  8917. hasBody(obj) {
  8918. return obj && obj.__isVue;
  8919. },
  8920. body(obj) {
  8921. if (obj && obj.__isVue) {
  8922. return ['div', {}, ...formatInstance(obj.$)];
  8923. }
  8924. }
  8925. };
  8926. function formatInstance(instance) {
  8927. var blocks = [];
  8928. if (instance.type.props && instance.props) {
  8929. blocks.push(createInstanceBlock('props', toRaw(instance.props)));
  8930. }
  8931. if (instance.setupState !== EMPTY_OBJ) {
  8932. blocks.push(createInstanceBlock('setup', instance.setupState));
  8933. }
  8934. if (instance.data !== EMPTY_OBJ) {
  8935. blocks.push(createInstanceBlock('data', toRaw(instance.data)));
  8936. }
  8937. var computed = extractKeys(instance, 'computed');
  8938. if (computed) {
  8939. blocks.push(createInstanceBlock('computed', computed));
  8940. }
  8941. var injected = extractKeys(instance, 'inject');
  8942. if (injected) {
  8943. blocks.push(createInstanceBlock('injected', injected));
  8944. }
  8945. blocks.push(['div', {}, ['span', {
  8946. style: keywordStyle.style + ';opacity:0.66'
  8947. }, '$ (internal): '], ['object', {
  8948. object: instance
  8949. }]]);
  8950. return blocks;
  8951. }
  8952. function createInstanceBlock(type, target) {
  8953. target = extend$1({}, target);
  8954. if (!Object.keys(target).length) {
  8955. return ['span', {}];
  8956. }
  8957. return ['div', {
  8958. style: 'line-height:1.25em;margin-bottom:0.6em'
  8959. }, ['div', {
  8960. style: 'color:#476582'
  8961. }, type], ['div', {
  8962. style: 'padding-left:1.25em'
  8963. }, ...Object.keys(target).map(key => {
  8964. return ['div', {}, ['span', keywordStyle, key + ': '], formatValue(target[key], false)];
  8965. })]];
  8966. }
  8967. function formatValue(v) {
  8968. var asRaw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  8969. if (typeof v === 'number') {
  8970. return ['span', numberStyle, v];
  8971. } else if (typeof v === 'string') {
  8972. return ['span', stringStyle, JSON.stringify(v)];
  8973. } else if (typeof v === 'boolean') {
  8974. return ['span', keywordStyle, v];
  8975. } else if (isObject(v)) {
  8976. return ['object', {
  8977. object: asRaw ? toRaw(v) : v
  8978. }];
  8979. } else {
  8980. return ['span', stringStyle, String(v)];
  8981. }
  8982. }
  8983. function extractKeys(instance, type) {
  8984. var Comp = instance.type;
  8985. if (isFunction(Comp)) {
  8986. return;
  8987. }
  8988. var extracted = {};
  8989. for (var key in instance.ctx) {
  8990. if (isKeyOfType(Comp, key, type)) {
  8991. extracted[key] = instance.ctx[key];
  8992. }
  8993. }
  8994. return extracted;
  8995. }
  8996. function isKeyOfType(Comp, key, type) {
  8997. var opts = Comp[type];
  8998. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  8999. return true;
  9000. }
  9001. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9002. return true;
  9003. }
  9004. if (Comp.mixins && Comp.mixins.some(m => isKeyOfType(m, key, type))) {
  9005. return true;
  9006. }
  9007. }
  9008. function genRefFlag(v) {
  9009. if (isShallow(v)) {
  9010. return "ShallowRef";
  9011. }
  9012. if (v.effect) {
  9013. return "ComputedRef";
  9014. }
  9015. return "Ref";
  9016. }
  9017. if (window.devtoolsFormatters) {
  9018. window.devtoolsFormatters.push(formatter);
  9019. } else {
  9020. window.devtoolsFormatters = [formatter];
  9021. }
  9022. }
  9023. function withMemo(memo, render, cache, index) {
  9024. var cached = cache[index];
  9025. if (cached && isMemoSame(cached, memo)) {
  9026. return cached;
  9027. }
  9028. var ret = render();
  9029. // shallow clone
  9030. ret.memo = memo.slice();
  9031. return cache[index] = ret;
  9032. }
  9033. function isMemoSame(cached, memo) {
  9034. var prev = cached.memo;
  9035. if (prev.length != memo.length) {
  9036. return false;
  9037. }
  9038. for (var i = 0; i < prev.length; i++) {
  9039. if (hasChanged(prev[i], memo[i])) {
  9040. return false;
  9041. }
  9042. }
  9043. // make sure to let parent block track it when returning cached
  9044. if (isBlockTreeEnabled > 0 && currentBlock) {
  9045. currentBlock.push(cached);
  9046. }
  9047. return true;
  9048. }
  9049. // Core API ------------------------------------------------------------------
  9050. var version = "3.2.47";
  9051. /**
  9052. * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
  9053. * @internal
  9054. */
  9055. var ssrUtils = null;
  9056. /**
  9057. * @internal only exposed in compat builds
  9058. */
  9059. var resolveFilter = null;
  9060. /**
  9061. * @internal only exposed in compat builds.
  9062. */
  9063. var compatUtils = null;
  9064. // 样式相关
  9065. var NODE_EXT_STYLES = 'styles'; // node 中存储的可用样式表
  9066. var NODE_EXT_CLASS_STYLE = 'classStyle'; // node 中存储的 classStyle
  9067. var NODE_EXT_STYLE = 'style'; // node 中存储的 style
  9068. function setNodeExtraData(el, name, value) {
  9069. el.ext.set(name, value);
  9070. }
  9071. function getNodeExtraData(el, name) {
  9072. return el.ext.get(name);
  9073. }
  9074. function getExtraStyles(el) {
  9075. return getNodeExtraData(el, NODE_EXT_STYLES);
  9076. }
  9077. function setExtraStyles(el, styles) {
  9078. setNodeExtraData(el, NODE_EXT_STYLES, styles);
  9079. }
  9080. function getExtraClassStyle(el) {
  9081. return getNodeExtraData(el, NODE_EXT_CLASS_STYLE);
  9082. }
  9083. function setExtraClassStyle(el, classStyle) {
  9084. setNodeExtraData(el, NODE_EXT_CLASS_STYLE, classStyle);
  9085. }
  9086. function getExtraStyle(el) {
  9087. return getNodeExtraData(el, NODE_EXT_STYLE);
  9088. }
  9089. function setExtraStyle(el, style) {
  9090. setNodeExtraData(el, NODE_EXT_STYLE, style);
  9091. }
  9092. function isCommentNode(node) {
  9093. return node.nodeName == '#comment';
  9094. }
  9095. function each(obj) {
  9096. return Object.keys(obj);
  9097. }
  9098. function useCssStyles(componentStyles) {
  9099. var normalized = {};
  9100. if (!isArray(componentStyles)) {
  9101. return normalized;
  9102. }
  9103. componentStyles.forEach(componentStyle => {
  9104. each(componentStyle).forEach(className => {
  9105. var parentStyles = componentStyle[className];
  9106. var normalizedStyles = normalized[className] || (normalized[className] = {});
  9107. each(parentStyles).forEach(parentSelector => {
  9108. var parentStyle = parentStyles[parentSelector];
  9109. var normalizedStyle = normalizedStyles[parentSelector] || (normalizedStyles[parentSelector] = {});
  9110. each(parentStyle).forEach(name => {
  9111. if (name[0] === '!') {
  9112. // 如果以包含important属性,则移除非important
  9113. normalizedStyle[name] = parentStyle[name];
  9114. delete normalizedStyle[name.slice(1)];
  9115. } else {
  9116. // 当前属性非important,且不存在同名important属性
  9117. if (!hasOwn(normalizedStyle, '!' + name)) {
  9118. normalizedStyle[name] = parentStyle[name];
  9119. }
  9120. }
  9121. });
  9122. });
  9123. });
  9124. });
  9125. return normalized;
  9126. }
  9127. function hasClass(calssName, el) {
  9128. var classList = el && el.classList;
  9129. return classList && classList.includes(calssName);
  9130. }
  9131. var TYPE_RE = /[+~> ]$/;
  9132. var PROPERTY_PARENT_NODE = 'parentNode';
  9133. var PROPERTY_PREVIOUS_SIBLING = 'previousSibling';
  9134. function isMatchParentSelector(parentSelector, el) {
  9135. var classArray = parentSelector.split('.');
  9136. for (var i = classArray.length - 1; i > 0; i--) {
  9137. var item = classArray[i];
  9138. var type = item[item.length - 1];
  9139. var className = item.replace(TYPE_RE, '');
  9140. if (type === '~' || type === ' ') {
  9141. var property = type === '~' ? PROPERTY_PREVIOUS_SIBLING : PROPERTY_PARENT_NODE;
  9142. while (el) {
  9143. el = el[property];
  9144. if (hasClass(className, el)) {
  9145. break;
  9146. }
  9147. }
  9148. if (!el) {
  9149. return false;
  9150. }
  9151. } else {
  9152. if (type === '>') {
  9153. el = el && el[PROPERTY_PARENT_NODE];
  9154. } else if (type === '+') {
  9155. el = el && el[PROPERTY_PREVIOUS_SIBLING];
  9156. }
  9157. if (!hasClass(className, el)) {
  9158. return false;
  9159. }
  9160. }
  9161. }
  9162. return true;
  9163. }
  9164. var WEIGHT_IMPORTANT = 1000;
  9165. function parseClassName(_ref22, parentStyles, el) {
  9166. var {
  9167. styles,
  9168. weights
  9169. } = _ref22;
  9170. each(parentStyles).forEach(parentSelector => {
  9171. if (parentSelector && el) {
  9172. if (!isMatchParentSelector(parentSelector, el)) {
  9173. return;
  9174. }
  9175. }
  9176. var classWeight = parentSelector.split('.').length;
  9177. var style = parentStyles[parentSelector];
  9178. each(style).forEach(name => {
  9179. var value = style[name];
  9180. var isImportant = name[0] === '!';
  9181. if (isImportant) {
  9182. name = name.slice(1);
  9183. }
  9184. var oldWeight = weights[name] || 0;
  9185. var weight = classWeight + (isImportant ? WEIGHT_IMPORTANT : 0);
  9186. if (weight >= oldWeight) {
  9187. weights[name] = weight;
  9188. styles.set(name, value);
  9189. }
  9190. });
  9191. });
  9192. }
  9193. function parseClassListWithStyleSheet(classList, stylesheet) {
  9194. var el = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  9195. var context = {
  9196. styles: new Map(),
  9197. weights: {}
  9198. };
  9199. classList.forEach(className => {
  9200. var parentStyles = stylesheet && stylesheet[className];
  9201. if (parentStyles) {
  9202. parseClassName(context, parentStyles, el);
  9203. }
  9204. });
  9205. return context;
  9206. }
  9207. function parseClassStyles(el) {
  9208. var styles = getExtraStyles(el);
  9209. return parseClassListWithStyleSheet(el.classList, styles, el);
  9210. }
  9211. function parseClassList(classList, instance) {
  9212. var el = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  9213. return parseClassListWithStyleSheet(classList, parseStyleSheet(instance), el);
  9214. }
  9215. function parseStyleSheet(_ref23) {
  9216. var {
  9217. type,
  9218. appContext,
  9219. root
  9220. } = _ref23;
  9221. var component = type;
  9222. if (!component.__styles) {
  9223. var __globalStyles = appContext.provides.__globalStyles;
  9224. // nvue 和 vue 混合开发时,__globalStyles注入的是未处理过的
  9225. if (appContext && isArray(__globalStyles)) {
  9226. appContext.provides.__globalStyles = useCssStyles(__globalStyles);
  9227. }
  9228. var styles = [];
  9229. if (appContext && __globalStyles) {
  9230. // 全局样式,包括 app.css 以及 page.css
  9231. styles.push(__globalStyles);
  9232. }
  9233. // 合并页面样式
  9234. // TODO 添加额外缓存
  9235. var page = root.type;
  9236. if (component !== page && isArray(page.styles)) {
  9237. styles.push(...page.styles);
  9238. }
  9239. if (isArray(component.styles)) {
  9240. styles.push(...component.styles);
  9241. }
  9242. component.__styles = useCssStyles(styles);
  9243. }
  9244. return component.__styles;
  9245. }
  9246. function extend(a, b) {
  9247. b.forEach((value, key) => {
  9248. a.set(key, value);
  9249. });
  9250. return a;
  9251. }
  9252. function toStyle(el, classStyle, classStyleWeights) {
  9253. var res = extend(new Map(), classStyle);
  9254. var style = getExtraStyle(el);
  9255. if (style != null) {
  9256. style.forEach((value, key) => {
  9257. var weight = classStyleWeights[key];
  9258. // TODO: 目前只计算了 class 中 important 的权重,会存在 style class 同时设置 important 时,class 优先级更高的问题
  9259. if (weight == null || weight < WEIGHT_IMPORTANT) {
  9260. res.set(key, value);
  9261. }
  9262. });
  9263. }
  9264. return res;
  9265. }
  9266. function patchClass(el, pre, next) {
  9267. var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9268. if (!instance) {
  9269. return;
  9270. }
  9271. var classList = next ? next.split(' ') : [];
  9272. el.classList = classList;
  9273. setExtraStyles(el, parseStyleSheet(instance));
  9274. // TODO 如果当前元素是组件根节点(非页面)
  9275. updateClassStyles(el);
  9276. }
  9277. function updateClassStyles(el) {
  9278. if (el.parentNode == null || isCommentNode(el)) {
  9279. return;
  9280. }
  9281. if (getExtraClassStyle(el) == null) {
  9282. setExtraClassStyle(el, new Map());
  9283. }
  9284. var oldClassStyle = getExtraClassStyle(el);
  9285. // reset previous class style to empty string
  9286. oldClassStyle.forEach((_value, key) => {
  9287. oldClassStyle.set(key, '');
  9288. });
  9289. var parseClassStylesResult = parseClassStyles(el);
  9290. parseClassStylesResult.styles.forEach((value, key) => {
  9291. oldClassStyle.set(key, value);
  9292. });
  9293. var styles = toStyle(el, oldClassStyle, parseClassStylesResult.weights);
  9294. if (styles.size == 0) {
  9295. return;
  9296. }
  9297. // TODO validateStyles
  9298. // validateStyles(el, oldClassStyle)
  9299. el.updateStyle(styles);
  9300. }
  9301. var rootPage = null;
  9302. var rootDocument = null;
  9303. function getDocument() {
  9304. if (!rootPage) {
  9305. rootPage = __pageManager.createPage('', '', new Map());
  9306. }
  9307. if (!rootDocument) {
  9308. rootDocument = rootPage.document;
  9309. }
  9310. return rootDocument;
  9311. }
  9312. /**
  9313. * 判断是否在document中
  9314. * @param el
  9315. * @returns
  9316. */
  9317. function isInDocument(parent) {
  9318. return !!parent.pageId;
  9319. }
  9320. var nodeOps = {
  9321. insert: (el, parent, anchor) => {
  9322. if (!anchor) {
  9323. parent.appendChild(el);
  9324. } else {
  9325. parent.insertBefore(el, anchor);
  9326. }
  9327. // 判断是不是首次被完整插入DOM树中
  9328. // vue 插入节点的顺序是,先子后父,所以等待父真正被完整插入document时,再遍历一遍子节点校正父子选择器样式
  9329. if (isInDocument(parent)) {
  9330. updateClassStyles(el);
  9331. updateChildrenClassStyle(el);
  9332. }
  9333. },
  9334. remove: child => {
  9335. var parent = child.parentNode;
  9336. if (parent) {
  9337. parent.removeChild(child);
  9338. }
  9339. },
  9340. createElement: (tag, container) => {
  9341. return getDocument().createElement(tag);
  9342. },
  9343. createText: (text, container) => {
  9344. var textNode = getDocument().createElement('text');
  9345. textNode.setAttribute('value', text);
  9346. return textNode;
  9347. },
  9348. createComment: (text, container) => {
  9349. return getDocument().createComment(text);
  9350. },
  9351. setText: (node, text) => {
  9352. node.setAttribute('value', text);
  9353. },
  9354. setElementText: (el, text) => {
  9355. el.setAttribute('value', text);
  9356. },
  9357. parentNode: node => node.parentNode,
  9358. nextSibling: node => node.nextSibling
  9359. };
  9360. // patchClass 先子后父,所以插入父的时候 updateChildrenClassStyle
  9361. function updateChildrenClassStyle(el) {
  9362. if (el !== null) {
  9363. el.childNodes.forEach(child => {
  9364. updateClassStyles(child);
  9365. updateChildrenClassStyle(child);
  9366. });
  9367. }
  9368. }
  9369. function patchAttr(el, key, value) {
  9370. var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9371. if (instance) {
  9372. [key, value] = transformAttr(el, key, value, instance);
  9373. }
  9374. el.setAnyAttribute(key, value);
  9375. }
  9376. var ATTR_HOVER_CLASS = 'hoverClass';
  9377. var ATTR_PLACEHOLDER_CLASS = 'placeholderClass';
  9378. var ATTR_PLACEHOLDER_STYLE = 'placeholderStyle';
  9379. var ATTR_INDICATOR_CLASS = 'indicatorClass';
  9380. var ATTR_INDICATOR_STYLE = 'indicatorStyle';
  9381. var ATTR_MASK_CLASS = 'maskClass';
  9382. var ATTR_MASK_STYLE = 'maskStyle';
  9383. var CLASS_AND_STYLES = {
  9384. view: {
  9385. class: [ATTR_HOVER_CLASS],
  9386. style: []
  9387. },
  9388. button: {
  9389. class: [ATTR_HOVER_CLASS],
  9390. style: []
  9391. },
  9392. navigator: {
  9393. class: [ATTR_HOVER_CLASS],
  9394. style: []
  9395. },
  9396. 'u-input': {
  9397. class: [ATTR_PLACEHOLDER_CLASS],
  9398. style: [ATTR_PLACEHOLDER_STYLE]
  9399. },
  9400. 'u-textarea': {
  9401. class: [ATTR_PLACEHOLDER_CLASS],
  9402. style: [ATTR_PLACEHOLDER_STYLE]
  9403. },
  9404. 'picker-view': {
  9405. class: [ATTR_INDICATOR_CLASS, ATTR_MASK_CLASS],
  9406. style: [ATTR_INDICATOR_STYLE, ATTR_MASK_STYLE]
  9407. }
  9408. };
  9409. function transformAttr(el, key, value, instance) {
  9410. if (!value) {
  9411. return [key, value];
  9412. }
  9413. var opts = CLASS_AND_STYLES[el.tagName.toLowerCase()];
  9414. if (opts) {
  9415. var camelized = camelize(key);
  9416. if (opts['class'].indexOf(camelized) > -1) {
  9417. return [camelized, parseClassList([value], instance, el)];
  9418. }
  9419. if (opts['style'].indexOf(key) > -1) {
  9420. if (isString(value)) {
  9421. return [camelized, parseStringStyle(value)];
  9422. }
  9423. return [camelized, normalizeStyle(value)];
  9424. }
  9425. }
  9426. return [key, value];
  9427. }
  9428. function addEventListener(el, event, handler, options) {
  9429. el.addEventListener(event, handler);
  9430. }
  9431. function removeEventListener(el, event) {
  9432. el.removeEventListener(event);
  9433. }
  9434. function patchEvent(el, rawName, prevValue, nextValue) {
  9435. var instance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  9436. // vei = vue event invokers
  9437. var invokers = el._vei || (el._vei = {});
  9438. var existingInvoker = invokers[rawName];
  9439. if (nextValue && existingInvoker) {
  9440. // patch
  9441. existingInvoker.value = nextValue;
  9442. } else {
  9443. var [name, options] = parseName(rawName);
  9444. if (nextValue) {
  9445. // add
  9446. var invoker = invokers[rawName] = createInvoker(nextValue, instance);
  9447. addEventListener(el, name, invoker);
  9448. } else if (existingInvoker) {
  9449. // remove
  9450. removeEventListener(el, name);
  9451. invokers[rawName] = undefined;
  9452. }
  9453. }
  9454. }
  9455. var optionsModifierRE = /(?:Once|Passive|Capture)$/;
  9456. function formatEventName(name) {
  9457. if (name === 'on-post-message') {
  9458. return 'onPostMessage';
  9459. }
  9460. return name;
  9461. }
  9462. function parseName(name) {
  9463. var options;
  9464. if (optionsModifierRE.test(name)) {
  9465. options = {};
  9466. var m;
  9467. while (m = name.match(optionsModifierRE)) {
  9468. name = name.slice(0, name.length - m[0].length);
  9469. options[m[0].toLowerCase()] = true;
  9470. }
  9471. }
  9472. var event = name[2] === ':' ? name.slice(3) : name.slice(2);
  9473. return [formatEventName(hyphenate(event)), options];
  9474. }
  9475. function createInvoker(initialValue, instance) {
  9476. var invoker = e => {
  9477. callWithAsyncErrorHandling(invoker.value, instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
  9478. };
  9479. invoker.value = initialValue;
  9480. var modifiers = new Set();
  9481. // 合并 modifiers
  9482. if (isArray(invoker.value)) {
  9483. invoker.value.forEach(v => {
  9484. if (v.modifiers) {
  9485. v.modifiers.forEach(m => {
  9486. modifiers.add(m);
  9487. });
  9488. }
  9489. });
  9490. } else {
  9491. if (invoker.value.modifiers) {
  9492. invoker.value.modifiers.forEach(m => {
  9493. modifiers.add(m);
  9494. });
  9495. }
  9496. }
  9497. invoker.modifiers = [...modifiers];
  9498. return invoker;
  9499. }
  9500. function patchStyle(el, prev, next) {
  9501. if (!next) {
  9502. // TODO remove styles
  9503. // el.setStyles({})
  9504. return;
  9505. }
  9506. if (isString(next)) {
  9507. next = parseStringStyle(next);
  9508. }
  9509. var batchedStyles = new Map();
  9510. var isPrevObj = prev && !isString(prev);
  9511. if (isPrevObj) {
  9512. for (var key in prev) {
  9513. if (next[key] == null) {
  9514. batchedStyles.set(camelize(key), '');
  9515. }
  9516. }
  9517. for (var _key21 in next) {
  9518. var value = next[_key21];
  9519. batchedStyles.set(camelize(_key21), value);
  9520. }
  9521. } else {
  9522. for (var _key22 in next) {
  9523. batchedStyles.set(camelize(_key22), next[_key22]);
  9524. }
  9525. setExtraStyle(el, batchedStyles);
  9526. }
  9527. // TODO validateStyles(el, batchedStyles)
  9528. el.updateStyle(batchedStyles);
  9529. }
  9530. var vModelTags = ['u-input', 'u-textarea'];
  9531. var patchProp = function (el, key, prevValue, nextValue) {
  9532. var isSVG = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9533. var prevChildren = arguments.length > 5 ? arguments[5] : undefined;
  9534. var parentComponent = arguments.length > 6 ? arguments[6] : undefined;
  9535. var parentSuspense = arguments.length > 7 ? arguments[7] : undefined;
  9536. var unmountChildren = arguments.length > 8 ? arguments[8] : undefined;
  9537. var hostInstance = arguments.length > 9 ? arguments[9] : undefined;
  9538. if (key === 'class') {
  9539. patchClass(el, prevValue, nextValue, hostInstance || parentComponent);
  9540. } else if (key === 'style') {
  9541. patchStyle(el, prevValue, nextValue);
  9542. } else if (isOn(key)) {
  9543. // ignore v-model listeners
  9544. if (!isModelListener(key)) {
  9545. patchEvent(el, key, prevValue, nextValue, parentComponent);
  9546. }
  9547. } else if (key === 'modelValue' && vModelTags.includes(el.tagName.toLocaleLowerCase())) {
  9548. // v-model 时,原生 input 和 textarea 接收的是 value
  9549. el.setAnyAttribute('modelValue', nextValue);
  9550. el.setAnyAttribute('value', nextValue);
  9551. } else {
  9552. patchAttr(el, key, nextValue, parentComponent);
  9553. }
  9554. };
  9555. function useCssModule() {
  9556. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '$style';
  9557. /* istanbul ignore else */
  9558. {
  9559. var instance = getCurrentInstance();
  9560. if (!instance) {
  9561. warn("useCssModule must be called inside setup()");
  9562. return EMPTY_OBJ;
  9563. }
  9564. var modules = instance.type.__cssModules;
  9565. if (!modules) {
  9566. warn("Current instance does not have CSS modules injected.");
  9567. return EMPTY_OBJ;
  9568. }
  9569. var mod = modules[name];
  9570. if (!mod) {
  9571. warn("Current instance does not have CSS module named \"".concat(name, "\"."));
  9572. return EMPTY_OBJ;
  9573. }
  9574. return mod;
  9575. }
  9576. }
  9577. /**
  9578. * Runtime helper for SFC's CSS variable injection feature.
  9579. * @private
  9580. */
  9581. function useCssVars(getter) {
  9582. var instance = getCurrentInstance();
  9583. /* istanbul ignore next */
  9584. if (!instance) {
  9585. warn("useCssVars is called without current active component instance.");
  9586. return;
  9587. }
  9588. var setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
  9589. onMounted(() => watchEffect(setVars, {
  9590. flush: 'post'
  9591. }));
  9592. onUpdated(setVars);
  9593. }
  9594. function setVarsOnVNode(vnode, vars) {
  9595. if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  9596. var suspense = vnode.suspense;
  9597. vnode = suspense.activeBranch;
  9598. if (suspense.pendingBranch && !suspense.isHydrating) {
  9599. suspense.effects.push(() => {
  9600. setVarsOnVNode(suspense.activeBranch, vars);
  9601. });
  9602. }
  9603. }
  9604. // drill down HOCs until it's a non-component vnode
  9605. while (vnode.component) {
  9606. vnode = vnode.component.subTree;
  9607. }
  9608. if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
  9609. var style = vnode.el.style;
  9610. for (var key in vars) {
  9611. style.setProperty("--".concat(key), vars[key]);
  9612. }
  9613. } else if (vnode.type === Fragment) {
  9614. vnode.children.forEach(c => setVarsOnVNode(c, vars));
  9615. }
  9616. }
  9617. var systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
  9618. var modifierGuards = {
  9619. stop: e => e.stopPropagation(),
  9620. prevent: e => e.preventDefault(),
  9621. self: e => e.target !== e.currentTarget,
  9622. ctrl: e => !e.ctrlKey,
  9623. shift: e => !e.shiftKey,
  9624. alt: e => !e.altKey,
  9625. meta: e => !e.metaKey,
  9626. left: e => 'button' in e && e.button !== 0,
  9627. middle: e => 'button' in e && e.button !== 1,
  9628. right: e => 'button' in e && e.button !== 2,
  9629. exact: (e, modifiers) => systemModifiers.some(m => e["".concat(m, "Key")] && !modifiers.includes(m))
  9630. };
  9631. /**
  9632. * @private
  9633. */
  9634. var withModifiers = (fn, modifiers) => {
  9635. return function (event) {
  9636. for (var i = 0; i < modifiers.length; i++) {
  9637. var guard = modifierGuards[modifiers[i]];
  9638. if (guard && guard(event, modifiers)) return;
  9639. }
  9640. for (var _len12 = arguments.length, args = new Array(_len12 > 1 ? _len12 - 1 : 0), _key23 = 1; _key23 < _len12; _key23++) {
  9641. args[_key23 - 1] = arguments[_key23];
  9642. }
  9643. return fn(event, ...args);
  9644. };
  9645. };
  9646. /**
  9647. * @private
  9648. */
  9649. var withKeys = (fn, modifiers) => {
  9650. return event => {
  9651. if (!('key' in event)) {
  9652. return;
  9653. }
  9654. var eventKey = hyphenate(event.key);
  9655. if (modifiers.some(k => k === eventKey)) {
  9656. return fn(event);
  9657. }
  9658. };
  9659. };
  9660. var rendererOptions = extend$1({
  9661. patchProp
  9662. }, nodeOps);
  9663. // lazy create the renderer - this makes core renderer logic tree-shakable
  9664. // in case the user only imports reactivity utilities from Vue.
  9665. var renderer;
  9666. function ensureRenderer() {
  9667. return renderer || (renderer = createRenderer(rendererOptions));
  9668. }
  9669. // use explicit type casts here to avoid import() calls in rolled-up d.ts
  9670. var render = function () {
  9671. ensureRenderer().render(...arguments);
  9672. };
  9673. var createApp = function () {
  9674. var app = ensureRenderer().createApp(...arguments);
  9675. var {
  9676. mount
  9677. } = app;
  9678. app.mount = container => {
  9679. if (container === '#app') {
  9680. container = getDocument().body;
  9681. }
  9682. return mount(container);
  9683. };
  9684. return app;
  9685. };
  9686. export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hyphenate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow$1 as isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, parseClassList, parseClassStyles, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssStyles, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };