vue.esm-browser.js 523 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335
  1. /**
  2. * vue v3.5.19
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. /*! #__NO_SIDE_EFFECTS__ */
  7. // @__NO_SIDE_EFFECTS__
  8. function makeMap(str) {
  9. const map = /* @__PURE__ */ Object.create(null);
  10. for (const key of str.split(",")) map[key] = 1;
  11. return (val) => val in map;
  12. }
  13. const EMPTY_OBJ = Object.freeze({}) ;
  14. const EMPTY_ARR = Object.freeze([]) ;
  15. const NOOP = () => {
  16. };
  17. const NO = () => false;
  18. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  19. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  20. const isModelListener = (key) => key.startsWith("onUpdate:");
  21. const extend = Object.assign;
  22. const remove = (arr, el) => {
  23. const i = arr.indexOf(el);
  24. if (i > -1) {
  25. arr.splice(i, 1);
  26. }
  27. };
  28. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  29. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  30. const isArray = Array.isArray;
  31. const isMap = (val) => toTypeString(val) === "[object Map]";
  32. const isSet = (val) => toTypeString(val) === "[object Set]";
  33. const isDate = (val) => toTypeString(val) === "[object Date]";
  34. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  35. const isFunction = (val) => typeof val === "function";
  36. const isString = (val) => typeof val === "string";
  37. const isSymbol = (val) => typeof val === "symbol";
  38. const isObject = (val) => val !== null && typeof val === "object";
  39. const isPromise = (val) => {
  40. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  41. };
  42. const objectToString = Object.prototype.toString;
  43. const toTypeString = (value) => objectToString.call(value);
  44. const toRawType = (value) => {
  45. return toTypeString(value).slice(8, -1);
  46. };
  47. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  48. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  49. const isReservedProp = /* @__PURE__ */ makeMap(
  50. // the leading comma is intentional so empty string "" is also included
  51. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  52. );
  53. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  54. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  55. );
  56. const cacheStringFunction = (fn) => {
  57. const cache = /* @__PURE__ */ Object.create(null);
  58. return ((str) => {
  59. const hit = cache[str];
  60. return hit || (cache[str] = fn(str));
  61. });
  62. };
  63. const camelizeRE = /-(\w)/g;
  64. const camelize = cacheStringFunction(
  65. (str) => {
  66. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  67. }
  68. );
  69. const hyphenateRE = /\B([A-Z])/g;
  70. const hyphenate = cacheStringFunction(
  71. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  72. );
  73. const capitalize = cacheStringFunction((str) => {
  74. return str.charAt(0).toUpperCase() + str.slice(1);
  75. });
  76. const toHandlerKey = cacheStringFunction(
  77. (str) => {
  78. const s = str ? `on${capitalize(str)}` : ``;
  79. return s;
  80. }
  81. );
  82. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  83. const invokeArrayFns = (fns, ...arg) => {
  84. for (let i = 0; i < fns.length; i++) {
  85. fns[i](...arg);
  86. }
  87. };
  88. const def = (obj, key, value, writable = false) => {
  89. Object.defineProperty(obj, key, {
  90. configurable: true,
  91. enumerable: false,
  92. writable,
  93. value
  94. });
  95. };
  96. const looseToNumber = (val) => {
  97. const n = parseFloat(val);
  98. return isNaN(n) ? val : n;
  99. };
  100. const toNumber = (val) => {
  101. const n = isString(val) ? Number(val) : NaN;
  102. return isNaN(n) ? val : n;
  103. };
  104. let _globalThis;
  105. const getGlobalThis = () => {
  106. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  107. };
  108. function genCacheKey(source, options) {
  109. return source + JSON.stringify(
  110. options,
  111. (_, val) => typeof val === "function" ? val.toString() : val
  112. );
  113. }
  114. const PatchFlagNames = {
  115. [1]: `TEXT`,
  116. [2]: `CLASS`,
  117. [4]: `STYLE`,
  118. [8]: `PROPS`,
  119. [16]: `FULL_PROPS`,
  120. [32]: `NEED_HYDRATION`,
  121. [64]: `STABLE_FRAGMENT`,
  122. [128]: `KEYED_FRAGMENT`,
  123. [256]: `UNKEYED_FRAGMENT`,
  124. [512]: `NEED_PATCH`,
  125. [1024]: `DYNAMIC_SLOTS`,
  126. [2048]: `DEV_ROOT_FRAGMENT`,
  127. [-1]: `CACHED`,
  128. [-2]: `BAIL`
  129. };
  130. const slotFlagsText = {
  131. [1]: "STABLE",
  132. [2]: "DYNAMIC",
  133. [3]: "FORWARDED"
  134. };
  135. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  136. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  137. const range = 2;
  138. function generateCodeFrame(source, start = 0, end = source.length) {
  139. start = Math.max(0, Math.min(start, source.length));
  140. end = Math.max(0, Math.min(end, source.length));
  141. if (start > end) return "";
  142. let lines = source.split(/(\r?\n)/);
  143. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  144. lines = lines.filter((_, idx) => idx % 2 === 0);
  145. let count = 0;
  146. const res = [];
  147. for (let i = 0; i < lines.length; i++) {
  148. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  149. if (count >= start) {
  150. for (let j = i - range; j <= i + range || end > count; j++) {
  151. if (j < 0 || j >= lines.length) continue;
  152. const line = j + 1;
  153. res.push(
  154. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  155. );
  156. const lineLength = lines[j].length;
  157. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  158. if (j === i) {
  159. const pad = start - (count - (lineLength + newLineSeqLength));
  160. const length = Math.max(
  161. 1,
  162. end > count ? lineLength - pad : end - start
  163. );
  164. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  165. } else if (j > i) {
  166. if (end > count) {
  167. const length = Math.max(Math.min(end - count, lineLength), 1);
  168. res.push(` | ` + "^".repeat(length));
  169. }
  170. count += lineLength + newLineSeqLength;
  171. }
  172. }
  173. break;
  174. }
  175. }
  176. return res.join("\n");
  177. }
  178. function normalizeStyle(value) {
  179. if (isArray(value)) {
  180. const res = {};
  181. for (let i = 0; i < value.length; i++) {
  182. const item = value[i];
  183. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  184. if (normalized) {
  185. for (const key in normalized) {
  186. res[key] = normalized[key];
  187. }
  188. }
  189. }
  190. return res;
  191. } else if (isString(value) || isObject(value)) {
  192. return value;
  193. }
  194. }
  195. const listDelimiterRE = /;(?![^(]*\))/g;
  196. const propertyDelimiterRE = /:([^]+)/;
  197. const styleCommentRE = /\/\*[^]*?\*\//g;
  198. function parseStringStyle(cssText) {
  199. const ret = {};
  200. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  201. if (item) {
  202. const tmp = item.split(propertyDelimiterRE);
  203. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  204. }
  205. });
  206. return ret;
  207. }
  208. function stringifyStyle(styles) {
  209. if (!styles) return "";
  210. if (isString(styles)) return styles;
  211. let ret = "";
  212. for (const key in styles) {
  213. const value = styles[key];
  214. if (isString(value) || typeof value === "number") {
  215. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  216. ret += `${normalizedKey}:${value};`;
  217. }
  218. }
  219. return ret;
  220. }
  221. function normalizeClass(value) {
  222. let res = "";
  223. if (isString(value)) {
  224. res = value;
  225. } else if (isArray(value)) {
  226. for (let i = 0; i < value.length; i++) {
  227. const normalized = normalizeClass(value[i]);
  228. if (normalized) {
  229. res += normalized + " ";
  230. }
  231. }
  232. } else if (isObject(value)) {
  233. for (const name in value) {
  234. if (value[name]) {
  235. res += name + " ";
  236. }
  237. }
  238. }
  239. return res.trim();
  240. }
  241. function normalizeProps(props) {
  242. if (!props) return null;
  243. let { class: klass, style } = props;
  244. if (klass && !isString(klass)) {
  245. props.class = normalizeClass(klass);
  246. }
  247. if (style) {
  248. props.style = normalizeStyle(style);
  249. }
  250. return props;
  251. }
  252. const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  253. const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  254. const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
  255. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  256. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  257. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  258. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  259. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  260. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  261. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  262. const isBooleanAttr = /* @__PURE__ */ makeMap(
  263. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  264. );
  265. function includeBooleanAttr(value) {
  266. return !!value || value === "";
  267. }
  268. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  269. `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
  270. );
  271. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  272. `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
  273. );
  274. function isRenderableAttrValue(value) {
  275. if (value == null) {
  276. return false;
  277. }
  278. const type = typeof value;
  279. return type === "string" || type === "number" || type === "boolean";
  280. }
  281. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  282. function getEscapedCssVarName(key, doubleEscape) {
  283. return key.replace(
  284. cssVarNameEscapeSymbolsRE,
  285. (s) => `\\${s}`
  286. );
  287. }
  288. function looseCompareArrays(a, b) {
  289. if (a.length !== b.length) return false;
  290. let equal = true;
  291. for (let i = 0; equal && i < a.length; i++) {
  292. equal = looseEqual(a[i], b[i]);
  293. }
  294. return equal;
  295. }
  296. function looseEqual(a, b) {
  297. if (a === b) return true;
  298. let aValidType = isDate(a);
  299. let bValidType = isDate(b);
  300. if (aValidType || bValidType) {
  301. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  302. }
  303. aValidType = isSymbol(a);
  304. bValidType = isSymbol(b);
  305. if (aValidType || bValidType) {
  306. return a === b;
  307. }
  308. aValidType = isArray(a);
  309. bValidType = isArray(b);
  310. if (aValidType || bValidType) {
  311. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  312. }
  313. aValidType = isObject(a);
  314. bValidType = isObject(b);
  315. if (aValidType || bValidType) {
  316. if (!aValidType || !bValidType) {
  317. return false;
  318. }
  319. const aKeysCount = Object.keys(a).length;
  320. const bKeysCount = Object.keys(b).length;
  321. if (aKeysCount !== bKeysCount) {
  322. return false;
  323. }
  324. for (const key in a) {
  325. const aHasKey = a.hasOwnProperty(key);
  326. const bHasKey = b.hasOwnProperty(key);
  327. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  328. return false;
  329. }
  330. }
  331. }
  332. return String(a) === String(b);
  333. }
  334. function looseIndexOf(arr, val) {
  335. return arr.findIndex((item) => looseEqual(item, val));
  336. }
  337. const isRef$1 = (val) => {
  338. return !!(val && val["__v_isRef"] === true);
  339. };
  340. const toDisplayString = (val) => {
  341. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  342. };
  343. const replacer = (_key, val) => {
  344. if (isRef$1(val)) {
  345. return replacer(_key, val.value);
  346. } else if (isMap(val)) {
  347. return {
  348. [`Map(${val.size})`]: [...val.entries()].reduce(
  349. (entries, [key, val2], i) => {
  350. entries[stringifySymbol(key, i) + " =>"] = val2;
  351. return entries;
  352. },
  353. {}
  354. )
  355. };
  356. } else if (isSet(val)) {
  357. return {
  358. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  359. };
  360. } else if (isSymbol(val)) {
  361. return stringifySymbol(val);
  362. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  363. return String(val);
  364. }
  365. return val;
  366. };
  367. const stringifySymbol = (v, i = "") => {
  368. var _a;
  369. return (
  370. // Symbol.description in es2019+ so we need to cast here to pass
  371. // the lib: es2016 check
  372. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  373. );
  374. };
  375. function normalizeCssVarValue(value) {
  376. if (value == null) {
  377. return "initial";
  378. }
  379. if (typeof value === "string") {
  380. return value === "" ? " " : value;
  381. }
  382. if (typeof value !== "number" || !Number.isFinite(value)) {
  383. {
  384. console.warn(
  385. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  386. value
  387. );
  388. }
  389. }
  390. return String(value);
  391. }
  392. function warn$2(msg, ...args) {
  393. console.warn(`[Vue warn] ${msg}`, ...args);
  394. }
  395. let activeEffectScope;
  396. class EffectScope {
  397. constructor(detached = false) {
  398. this.detached = detached;
  399. /**
  400. * @internal
  401. */
  402. this._active = true;
  403. /**
  404. * @internal track `on` calls, allow `on` call multiple times
  405. */
  406. this._on = 0;
  407. /**
  408. * @internal
  409. */
  410. this.effects = [];
  411. /**
  412. * @internal
  413. */
  414. this.cleanups = [];
  415. this._isPaused = false;
  416. this.parent = activeEffectScope;
  417. if (!detached && activeEffectScope) {
  418. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  419. this
  420. ) - 1;
  421. }
  422. }
  423. get active() {
  424. return this._active;
  425. }
  426. pause() {
  427. if (this._active) {
  428. this._isPaused = true;
  429. let i, l;
  430. if (this.scopes) {
  431. for (i = 0, l = this.scopes.length; i < l; i++) {
  432. this.scopes[i].pause();
  433. }
  434. }
  435. for (i = 0, l = this.effects.length; i < l; i++) {
  436. this.effects[i].pause();
  437. }
  438. }
  439. }
  440. /**
  441. * Resumes the effect scope, including all child scopes and effects.
  442. */
  443. resume() {
  444. if (this._active) {
  445. if (this._isPaused) {
  446. this._isPaused = false;
  447. let i, l;
  448. if (this.scopes) {
  449. for (i = 0, l = this.scopes.length; i < l; i++) {
  450. this.scopes[i].resume();
  451. }
  452. }
  453. for (i = 0, l = this.effects.length; i < l; i++) {
  454. this.effects[i].resume();
  455. }
  456. }
  457. }
  458. }
  459. run(fn) {
  460. if (this._active) {
  461. const currentEffectScope = activeEffectScope;
  462. try {
  463. activeEffectScope = this;
  464. return fn();
  465. } finally {
  466. activeEffectScope = currentEffectScope;
  467. }
  468. } else {
  469. warn$2(`cannot run an inactive effect scope.`);
  470. }
  471. }
  472. /**
  473. * This should only be called on non-detached scopes
  474. * @internal
  475. */
  476. on() {
  477. if (++this._on === 1) {
  478. this.prevScope = activeEffectScope;
  479. activeEffectScope = this;
  480. }
  481. }
  482. /**
  483. * This should only be called on non-detached scopes
  484. * @internal
  485. */
  486. off() {
  487. if (this._on > 0 && --this._on === 0) {
  488. activeEffectScope = this.prevScope;
  489. this.prevScope = void 0;
  490. }
  491. }
  492. stop(fromParent) {
  493. if (this._active) {
  494. this._active = false;
  495. let i, l;
  496. for (i = 0, l = this.effects.length; i < l; i++) {
  497. this.effects[i].stop();
  498. }
  499. this.effects.length = 0;
  500. for (i = 0, l = this.cleanups.length; i < l; i++) {
  501. this.cleanups[i]();
  502. }
  503. this.cleanups.length = 0;
  504. if (this.scopes) {
  505. for (i = 0, l = this.scopes.length; i < l; i++) {
  506. this.scopes[i].stop(true);
  507. }
  508. this.scopes.length = 0;
  509. }
  510. if (!this.detached && this.parent && !fromParent) {
  511. const last = this.parent.scopes.pop();
  512. if (last && last !== this) {
  513. this.parent.scopes[this.index] = last;
  514. last.index = this.index;
  515. }
  516. }
  517. this.parent = void 0;
  518. }
  519. }
  520. }
  521. function effectScope(detached) {
  522. return new EffectScope(detached);
  523. }
  524. function getCurrentScope() {
  525. return activeEffectScope;
  526. }
  527. function onScopeDispose(fn, failSilently = false) {
  528. if (activeEffectScope) {
  529. activeEffectScope.cleanups.push(fn);
  530. } else if (!failSilently) {
  531. warn$2(
  532. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  533. );
  534. }
  535. }
  536. let activeSub;
  537. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  538. class ReactiveEffect {
  539. constructor(fn) {
  540. this.fn = fn;
  541. /**
  542. * @internal
  543. */
  544. this.deps = void 0;
  545. /**
  546. * @internal
  547. */
  548. this.depsTail = void 0;
  549. /**
  550. * @internal
  551. */
  552. this.flags = 1 | 4;
  553. /**
  554. * @internal
  555. */
  556. this.next = void 0;
  557. /**
  558. * @internal
  559. */
  560. this.cleanup = void 0;
  561. this.scheduler = void 0;
  562. if (activeEffectScope && activeEffectScope.active) {
  563. activeEffectScope.effects.push(this);
  564. }
  565. }
  566. pause() {
  567. this.flags |= 64;
  568. }
  569. resume() {
  570. if (this.flags & 64) {
  571. this.flags &= -65;
  572. if (pausedQueueEffects.has(this)) {
  573. pausedQueueEffects.delete(this);
  574. this.trigger();
  575. }
  576. }
  577. }
  578. /**
  579. * @internal
  580. */
  581. notify() {
  582. if (this.flags & 2 && !(this.flags & 32)) {
  583. return;
  584. }
  585. if (!(this.flags & 8)) {
  586. batch(this);
  587. }
  588. }
  589. run() {
  590. if (!(this.flags & 1)) {
  591. return this.fn();
  592. }
  593. this.flags |= 2;
  594. cleanupEffect(this);
  595. prepareDeps(this);
  596. const prevEffect = activeSub;
  597. const prevShouldTrack = shouldTrack;
  598. activeSub = this;
  599. shouldTrack = true;
  600. try {
  601. return this.fn();
  602. } finally {
  603. if (activeSub !== this) {
  604. warn$2(
  605. "Active effect was not restored correctly - this is likely a Vue internal bug."
  606. );
  607. }
  608. cleanupDeps(this);
  609. activeSub = prevEffect;
  610. shouldTrack = prevShouldTrack;
  611. this.flags &= -3;
  612. }
  613. }
  614. stop() {
  615. if (this.flags & 1) {
  616. for (let link = this.deps; link; link = link.nextDep) {
  617. removeSub(link);
  618. }
  619. this.deps = this.depsTail = void 0;
  620. cleanupEffect(this);
  621. this.onStop && this.onStop();
  622. this.flags &= -2;
  623. }
  624. }
  625. trigger() {
  626. if (this.flags & 64) {
  627. pausedQueueEffects.add(this);
  628. } else if (this.scheduler) {
  629. this.scheduler();
  630. } else {
  631. this.runIfDirty();
  632. }
  633. }
  634. /**
  635. * @internal
  636. */
  637. runIfDirty() {
  638. if (isDirty(this)) {
  639. this.run();
  640. }
  641. }
  642. get dirty() {
  643. return isDirty(this);
  644. }
  645. }
  646. let batchDepth = 0;
  647. let batchedSub;
  648. let batchedComputed;
  649. function batch(sub, isComputed = false) {
  650. sub.flags |= 8;
  651. if (isComputed) {
  652. sub.next = batchedComputed;
  653. batchedComputed = sub;
  654. return;
  655. }
  656. sub.next = batchedSub;
  657. batchedSub = sub;
  658. }
  659. function startBatch() {
  660. batchDepth++;
  661. }
  662. function endBatch() {
  663. if (--batchDepth > 0) {
  664. return;
  665. }
  666. if (batchedComputed) {
  667. let e = batchedComputed;
  668. batchedComputed = void 0;
  669. while (e) {
  670. const next = e.next;
  671. e.next = void 0;
  672. e.flags &= -9;
  673. e = next;
  674. }
  675. }
  676. let error;
  677. while (batchedSub) {
  678. let e = batchedSub;
  679. batchedSub = void 0;
  680. while (e) {
  681. const next = e.next;
  682. e.next = void 0;
  683. e.flags &= -9;
  684. if (e.flags & 1) {
  685. try {
  686. ;
  687. e.trigger();
  688. } catch (err) {
  689. if (!error) error = err;
  690. }
  691. }
  692. e = next;
  693. }
  694. }
  695. if (error) throw error;
  696. }
  697. function prepareDeps(sub) {
  698. for (let link = sub.deps; link; link = link.nextDep) {
  699. link.version = -1;
  700. link.prevActiveLink = link.dep.activeLink;
  701. link.dep.activeLink = link;
  702. }
  703. }
  704. function cleanupDeps(sub) {
  705. let head;
  706. let tail = sub.depsTail;
  707. let link = tail;
  708. while (link) {
  709. const prev = link.prevDep;
  710. if (link.version === -1) {
  711. if (link === tail) tail = prev;
  712. removeSub(link);
  713. removeDep(link);
  714. } else {
  715. head = link;
  716. }
  717. link.dep.activeLink = link.prevActiveLink;
  718. link.prevActiveLink = void 0;
  719. link = prev;
  720. }
  721. sub.deps = head;
  722. sub.depsTail = tail;
  723. }
  724. function isDirty(sub) {
  725. for (let link = sub.deps; link; link = link.nextDep) {
  726. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  727. return true;
  728. }
  729. }
  730. if (sub._dirty) {
  731. return true;
  732. }
  733. return false;
  734. }
  735. function refreshComputed(computed) {
  736. if (computed.flags & 4 && !(computed.flags & 16)) {
  737. return;
  738. }
  739. computed.flags &= -17;
  740. if (computed.globalVersion === globalVersion) {
  741. return;
  742. }
  743. computed.globalVersion = globalVersion;
  744. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  745. return;
  746. }
  747. computed.flags |= 2;
  748. const dep = computed.dep;
  749. const prevSub = activeSub;
  750. const prevShouldTrack = shouldTrack;
  751. activeSub = computed;
  752. shouldTrack = true;
  753. try {
  754. prepareDeps(computed);
  755. const value = computed.fn(computed._value);
  756. if (dep.version === 0 || hasChanged(value, computed._value)) {
  757. computed.flags |= 128;
  758. computed._value = value;
  759. dep.version++;
  760. }
  761. } catch (err) {
  762. dep.version++;
  763. throw err;
  764. } finally {
  765. activeSub = prevSub;
  766. shouldTrack = prevShouldTrack;
  767. cleanupDeps(computed);
  768. computed.flags &= -3;
  769. }
  770. }
  771. function removeSub(link, soft = false) {
  772. const { dep, prevSub, nextSub } = link;
  773. if (prevSub) {
  774. prevSub.nextSub = nextSub;
  775. link.prevSub = void 0;
  776. }
  777. if (nextSub) {
  778. nextSub.prevSub = prevSub;
  779. link.nextSub = void 0;
  780. }
  781. if (dep.subsHead === link) {
  782. dep.subsHead = nextSub;
  783. }
  784. if (dep.subs === link) {
  785. dep.subs = prevSub;
  786. if (!prevSub && dep.computed) {
  787. dep.computed.flags &= -5;
  788. for (let l = dep.computed.deps; l; l = l.nextDep) {
  789. removeSub(l, true);
  790. }
  791. }
  792. }
  793. if (!soft && !--dep.sc && dep.map) {
  794. dep.map.delete(dep.key);
  795. }
  796. }
  797. function removeDep(link) {
  798. const { prevDep, nextDep } = link;
  799. if (prevDep) {
  800. prevDep.nextDep = nextDep;
  801. link.prevDep = void 0;
  802. }
  803. if (nextDep) {
  804. nextDep.prevDep = prevDep;
  805. link.nextDep = void 0;
  806. }
  807. }
  808. function effect(fn, options) {
  809. if (fn.effect instanceof ReactiveEffect) {
  810. fn = fn.effect.fn;
  811. }
  812. const e = new ReactiveEffect(fn);
  813. if (options) {
  814. extend(e, options);
  815. }
  816. try {
  817. e.run();
  818. } catch (err) {
  819. e.stop();
  820. throw err;
  821. }
  822. const runner = e.run.bind(e);
  823. runner.effect = e;
  824. return runner;
  825. }
  826. function stop(runner) {
  827. runner.effect.stop();
  828. }
  829. let shouldTrack = true;
  830. const trackStack = [];
  831. function pauseTracking() {
  832. trackStack.push(shouldTrack);
  833. shouldTrack = false;
  834. }
  835. function resetTracking() {
  836. const last = trackStack.pop();
  837. shouldTrack = last === void 0 ? true : last;
  838. }
  839. function cleanupEffect(e) {
  840. const { cleanup } = e;
  841. e.cleanup = void 0;
  842. if (cleanup) {
  843. const prevSub = activeSub;
  844. activeSub = void 0;
  845. try {
  846. cleanup();
  847. } finally {
  848. activeSub = prevSub;
  849. }
  850. }
  851. }
  852. let globalVersion = 0;
  853. class Link {
  854. constructor(sub, dep) {
  855. this.sub = sub;
  856. this.dep = dep;
  857. this.version = dep.version;
  858. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  859. }
  860. }
  861. class Dep {
  862. // TODO isolatedDeclarations "__v_skip"
  863. constructor(computed) {
  864. this.computed = computed;
  865. this.version = 0;
  866. /**
  867. * Link between this dep and the current active effect
  868. */
  869. this.activeLink = void 0;
  870. /**
  871. * Doubly linked list representing the subscribing effects (tail)
  872. */
  873. this.subs = void 0;
  874. /**
  875. * For object property deps cleanup
  876. */
  877. this.map = void 0;
  878. this.key = void 0;
  879. /**
  880. * Subscriber counter
  881. */
  882. this.sc = 0;
  883. /**
  884. * @internal
  885. */
  886. this.__v_skip = true;
  887. {
  888. this.subsHead = void 0;
  889. }
  890. }
  891. track(debugInfo) {
  892. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  893. return;
  894. }
  895. let link = this.activeLink;
  896. if (link === void 0 || link.sub !== activeSub) {
  897. link = this.activeLink = new Link(activeSub, this);
  898. if (!activeSub.deps) {
  899. activeSub.deps = activeSub.depsTail = link;
  900. } else {
  901. link.prevDep = activeSub.depsTail;
  902. activeSub.depsTail.nextDep = link;
  903. activeSub.depsTail = link;
  904. }
  905. addSub(link);
  906. } else if (link.version === -1) {
  907. link.version = this.version;
  908. if (link.nextDep) {
  909. const next = link.nextDep;
  910. next.prevDep = link.prevDep;
  911. if (link.prevDep) {
  912. link.prevDep.nextDep = next;
  913. }
  914. link.prevDep = activeSub.depsTail;
  915. link.nextDep = void 0;
  916. activeSub.depsTail.nextDep = link;
  917. activeSub.depsTail = link;
  918. if (activeSub.deps === link) {
  919. activeSub.deps = next;
  920. }
  921. }
  922. }
  923. if (activeSub.onTrack) {
  924. activeSub.onTrack(
  925. extend(
  926. {
  927. effect: activeSub
  928. },
  929. debugInfo
  930. )
  931. );
  932. }
  933. return link;
  934. }
  935. trigger(debugInfo) {
  936. this.version++;
  937. globalVersion++;
  938. this.notify(debugInfo);
  939. }
  940. notify(debugInfo) {
  941. startBatch();
  942. try {
  943. if (true) {
  944. for (let head = this.subsHead; head; head = head.nextSub) {
  945. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  946. head.sub.onTrigger(
  947. extend(
  948. {
  949. effect: head.sub
  950. },
  951. debugInfo
  952. )
  953. );
  954. }
  955. }
  956. }
  957. for (let link = this.subs; link; link = link.prevSub) {
  958. if (link.sub.notify()) {
  959. ;
  960. link.sub.dep.notify();
  961. }
  962. }
  963. } finally {
  964. endBatch();
  965. }
  966. }
  967. }
  968. function addSub(link) {
  969. link.dep.sc++;
  970. if (link.sub.flags & 4) {
  971. const computed = link.dep.computed;
  972. if (computed && !link.dep.subs) {
  973. computed.flags |= 4 | 16;
  974. for (let l = computed.deps; l; l = l.nextDep) {
  975. addSub(l);
  976. }
  977. }
  978. const currentTail = link.dep.subs;
  979. if (currentTail !== link) {
  980. link.prevSub = currentTail;
  981. if (currentTail) currentTail.nextSub = link;
  982. }
  983. if (link.dep.subsHead === void 0) {
  984. link.dep.subsHead = link;
  985. }
  986. link.dep.subs = link;
  987. }
  988. }
  989. const targetMap = /* @__PURE__ */ new WeakMap();
  990. const ITERATE_KEY = Symbol(
  991. "Object iterate"
  992. );
  993. const MAP_KEY_ITERATE_KEY = Symbol(
  994. "Map keys iterate"
  995. );
  996. const ARRAY_ITERATE_KEY = Symbol(
  997. "Array iterate"
  998. );
  999. function track(target, type, key) {
  1000. if (shouldTrack && activeSub) {
  1001. let depsMap = targetMap.get(target);
  1002. if (!depsMap) {
  1003. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  1004. }
  1005. let dep = depsMap.get(key);
  1006. if (!dep) {
  1007. depsMap.set(key, dep = new Dep());
  1008. dep.map = depsMap;
  1009. dep.key = key;
  1010. }
  1011. {
  1012. dep.track({
  1013. target,
  1014. type,
  1015. key
  1016. });
  1017. }
  1018. }
  1019. }
  1020. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  1021. const depsMap = targetMap.get(target);
  1022. if (!depsMap) {
  1023. globalVersion++;
  1024. return;
  1025. }
  1026. const run = (dep) => {
  1027. if (dep) {
  1028. {
  1029. dep.trigger({
  1030. target,
  1031. type,
  1032. key,
  1033. newValue,
  1034. oldValue,
  1035. oldTarget
  1036. });
  1037. }
  1038. }
  1039. };
  1040. startBatch();
  1041. if (type === "clear") {
  1042. depsMap.forEach(run);
  1043. } else {
  1044. const targetIsArray = isArray(target);
  1045. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1046. if (targetIsArray && key === "length") {
  1047. const newLength = Number(newValue);
  1048. depsMap.forEach((dep, key2) => {
  1049. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1050. run(dep);
  1051. }
  1052. });
  1053. } else {
  1054. if (key !== void 0 || depsMap.has(void 0)) {
  1055. run(depsMap.get(key));
  1056. }
  1057. if (isArrayIndex) {
  1058. run(depsMap.get(ARRAY_ITERATE_KEY));
  1059. }
  1060. switch (type) {
  1061. case "add":
  1062. if (!targetIsArray) {
  1063. run(depsMap.get(ITERATE_KEY));
  1064. if (isMap(target)) {
  1065. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1066. }
  1067. } else if (isArrayIndex) {
  1068. run(depsMap.get("length"));
  1069. }
  1070. break;
  1071. case "delete":
  1072. if (!targetIsArray) {
  1073. run(depsMap.get(ITERATE_KEY));
  1074. if (isMap(target)) {
  1075. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1076. }
  1077. }
  1078. break;
  1079. case "set":
  1080. if (isMap(target)) {
  1081. run(depsMap.get(ITERATE_KEY));
  1082. }
  1083. break;
  1084. }
  1085. }
  1086. }
  1087. endBatch();
  1088. }
  1089. function getDepFromReactive(object, key) {
  1090. const depMap = targetMap.get(object);
  1091. return depMap && depMap.get(key);
  1092. }
  1093. function reactiveReadArray(array) {
  1094. const raw = toRaw(array);
  1095. if (raw === array) return raw;
  1096. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1097. return isShallow(array) ? raw : raw.map(toReactive);
  1098. }
  1099. function shallowReadArray(arr) {
  1100. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1101. return arr;
  1102. }
  1103. const arrayInstrumentations = {
  1104. __proto__: null,
  1105. [Symbol.iterator]() {
  1106. return iterator(this, Symbol.iterator, toReactive);
  1107. },
  1108. concat(...args) {
  1109. return reactiveReadArray(this).concat(
  1110. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1111. );
  1112. },
  1113. entries() {
  1114. return iterator(this, "entries", (value) => {
  1115. value[1] = toReactive(value[1]);
  1116. return value;
  1117. });
  1118. },
  1119. every(fn, thisArg) {
  1120. return apply(this, "every", fn, thisArg, void 0, arguments);
  1121. },
  1122. filter(fn, thisArg) {
  1123. return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
  1124. },
  1125. find(fn, thisArg) {
  1126. return apply(this, "find", fn, thisArg, toReactive, arguments);
  1127. },
  1128. findIndex(fn, thisArg) {
  1129. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1130. },
  1131. findLast(fn, thisArg) {
  1132. return apply(this, "findLast", fn, thisArg, toReactive, arguments);
  1133. },
  1134. findLastIndex(fn, thisArg) {
  1135. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1136. },
  1137. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1138. forEach(fn, thisArg) {
  1139. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1140. },
  1141. includes(...args) {
  1142. return searchProxy(this, "includes", args);
  1143. },
  1144. indexOf(...args) {
  1145. return searchProxy(this, "indexOf", args);
  1146. },
  1147. join(separator) {
  1148. return reactiveReadArray(this).join(separator);
  1149. },
  1150. // keys() iterator only reads `length`, no optimisation required
  1151. lastIndexOf(...args) {
  1152. return searchProxy(this, "lastIndexOf", args);
  1153. },
  1154. map(fn, thisArg) {
  1155. return apply(this, "map", fn, thisArg, void 0, arguments);
  1156. },
  1157. pop() {
  1158. return noTracking(this, "pop");
  1159. },
  1160. push(...args) {
  1161. return noTracking(this, "push", args);
  1162. },
  1163. reduce(fn, ...args) {
  1164. return reduce(this, "reduce", fn, args);
  1165. },
  1166. reduceRight(fn, ...args) {
  1167. return reduce(this, "reduceRight", fn, args);
  1168. },
  1169. shift() {
  1170. return noTracking(this, "shift");
  1171. },
  1172. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1173. some(fn, thisArg) {
  1174. return apply(this, "some", fn, thisArg, void 0, arguments);
  1175. },
  1176. splice(...args) {
  1177. return noTracking(this, "splice", args);
  1178. },
  1179. toReversed() {
  1180. return reactiveReadArray(this).toReversed();
  1181. },
  1182. toSorted(comparer) {
  1183. return reactiveReadArray(this).toSorted(comparer);
  1184. },
  1185. toSpliced(...args) {
  1186. return reactiveReadArray(this).toSpliced(...args);
  1187. },
  1188. unshift(...args) {
  1189. return noTracking(this, "unshift", args);
  1190. },
  1191. values() {
  1192. return iterator(this, "values", toReactive);
  1193. }
  1194. };
  1195. function iterator(self, method, wrapValue) {
  1196. const arr = shallowReadArray(self);
  1197. const iter = arr[method]();
  1198. if (arr !== self && !isShallow(self)) {
  1199. iter._next = iter.next;
  1200. iter.next = () => {
  1201. const result = iter._next();
  1202. if (result.value) {
  1203. result.value = wrapValue(result.value);
  1204. }
  1205. return result;
  1206. };
  1207. }
  1208. return iter;
  1209. }
  1210. const arrayProto = Array.prototype;
  1211. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1212. const arr = shallowReadArray(self);
  1213. const needsWrap = arr !== self && !isShallow(self);
  1214. const methodFn = arr[method];
  1215. if (methodFn !== arrayProto[method]) {
  1216. const result2 = methodFn.apply(self, args);
  1217. return needsWrap ? toReactive(result2) : result2;
  1218. }
  1219. let wrappedFn = fn;
  1220. if (arr !== self) {
  1221. if (needsWrap) {
  1222. wrappedFn = function(item, index) {
  1223. return fn.call(this, toReactive(item), index, self);
  1224. };
  1225. } else if (fn.length > 2) {
  1226. wrappedFn = function(item, index) {
  1227. return fn.call(this, item, index, self);
  1228. };
  1229. }
  1230. }
  1231. const result = methodFn.call(arr, wrappedFn, thisArg);
  1232. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1233. }
  1234. function reduce(self, method, fn, args) {
  1235. const arr = shallowReadArray(self);
  1236. let wrappedFn = fn;
  1237. if (arr !== self) {
  1238. if (!isShallow(self)) {
  1239. wrappedFn = function(acc, item, index) {
  1240. return fn.call(this, acc, toReactive(item), index, self);
  1241. };
  1242. } else if (fn.length > 3) {
  1243. wrappedFn = function(acc, item, index) {
  1244. return fn.call(this, acc, item, index, self);
  1245. };
  1246. }
  1247. }
  1248. return arr[method](wrappedFn, ...args);
  1249. }
  1250. function searchProxy(self, method, args) {
  1251. const arr = toRaw(self);
  1252. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1253. const res = arr[method](...args);
  1254. if ((res === -1 || res === false) && isProxy(args[0])) {
  1255. args[0] = toRaw(args[0]);
  1256. return arr[method](...args);
  1257. }
  1258. return res;
  1259. }
  1260. function noTracking(self, method, args = []) {
  1261. pauseTracking();
  1262. startBatch();
  1263. const res = toRaw(self)[method].apply(self, args);
  1264. endBatch();
  1265. resetTracking();
  1266. return res;
  1267. }
  1268. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1269. const builtInSymbols = new Set(
  1270. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1271. );
  1272. function hasOwnProperty(key) {
  1273. if (!isSymbol(key)) key = String(key);
  1274. const obj = toRaw(this);
  1275. track(obj, "has", key);
  1276. return obj.hasOwnProperty(key);
  1277. }
  1278. class BaseReactiveHandler {
  1279. constructor(_isReadonly = false, _isShallow = false) {
  1280. this._isReadonly = _isReadonly;
  1281. this._isShallow = _isShallow;
  1282. }
  1283. get(target, key, receiver) {
  1284. if (key === "__v_skip") return target["__v_skip"];
  1285. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1286. if (key === "__v_isReactive") {
  1287. return !isReadonly2;
  1288. } else if (key === "__v_isReadonly") {
  1289. return isReadonly2;
  1290. } else if (key === "__v_isShallow") {
  1291. return isShallow2;
  1292. } else if (key === "__v_raw") {
  1293. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1294. // this means the receiver is a user proxy of the reactive proxy
  1295. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1296. return target;
  1297. }
  1298. return;
  1299. }
  1300. const targetIsArray = isArray(target);
  1301. if (!isReadonly2) {
  1302. let fn;
  1303. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1304. return fn;
  1305. }
  1306. if (key === "hasOwnProperty") {
  1307. return hasOwnProperty;
  1308. }
  1309. }
  1310. const res = Reflect.get(
  1311. target,
  1312. key,
  1313. // if this is a proxy wrapping a ref, return methods using the raw ref
  1314. // as receiver so that we don't have to call `toRaw` on the ref in all
  1315. // its class methods
  1316. isRef(target) ? target : receiver
  1317. );
  1318. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1319. return res;
  1320. }
  1321. if (!isReadonly2) {
  1322. track(target, "get", key);
  1323. }
  1324. if (isShallow2) {
  1325. return res;
  1326. }
  1327. if (isRef(res)) {
  1328. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1329. }
  1330. if (isObject(res)) {
  1331. return isReadonly2 ? readonly(res) : reactive(res);
  1332. }
  1333. return res;
  1334. }
  1335. }
  1336. class MutableReactiveHandler extends BaseReactiveHandler {
  1337. constructor(isShallow2 = false) {
  1338. super(false, isShallow2);
  1339. }
  1340. set(target, key, value, receiver) {
  1341. let oldValue = target[key];
  1342. if (!this._isShallow) {
  1343. const isOldValueReadonly = isReadonly(oldValue);
  1344. if (!isShallow(value) && !isReadonly(value)) {
  1345. oldValue = toRaw(oldValue);
  1346. value = toRaw(value);
  1347. }
  1348. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  1349. if (isOldValueReadonly) {
  1350. {
  1351. warn$2(
  1352. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1353. target[key]
  1354. );
  1355. }
  1356. return true;
  1357. } else {
  1358. oldValue.value = value;
  1359. return true;
  1360. }
  1361. }
  1362. }
  1363. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  1364. const result = Reflect.set(
  1365. target,
  1366. key,
  1367. value,
  1368. isRef(target) ? target : receiver
  1369. );
  1370. if (target === toRaw(receiver)) {
  1371. if (!hadKey) {
  1372. trigger(target, "add", key, value);
  1373. } else if (hasChanged(value, oldValue)) {
  1374. trigger(target, "set", key, value, oldValue);
  1375. }
  1376. }
  1377. return result;
  1378. }
  1379. deleteProperty(target, key) {
  1380. const hadKey = hasOwn(target, key);
  1381. const oldValue = target[key];
  1382. const result = Reflect.deleteProperty(target, key);
  1383. if (result && hadKey) {
  1384. trigger(target, "delete", key, void 0, oldValue);
  1385. }
  1386. return result;
  1387. }
  1388. has(target, key) {
  1389. const result = Reflect.has(target, key);
  1390. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1391. track(target, "has", key);
  1392. }
  1393. return result;
  1394. }
  1395. ownKeys(target) {
  1396. track(
  1397. target,
  1398. "iterate",
  1399. isArray(target) ? "length" : ITERATE_KEY
  1400. );
  1401. return Reflect.ownKeys(target);
  1402. }
  1403. }
  1404. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1405. constructor(isShallow2 = false) {
  1406. super(true, isShallow2);
  1407. }
  1408. set(target, key) {
  1409. {
  1410. warn$2(
  1411. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1412. target
  1413. );
  1414. }
  1415. return true;
  1416. }
  1417. deleteProperty(target, key) {
  1418. {
  1419. warn$2(
  1420. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1421. target
  1422. );
  1423. }
  1424. return true;
  1425. }
  1426. }
  1427. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1428. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1429. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1430. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1431. const toShallow = (value) => value;
  1432. const getProto = (v) => Reflect.getPrototypeOf(v);
  1433. function createIterableMethod(method, isReadonly2, isShallow2) {
  1434. return function(...args) {
  1435. const target = this["__v_raw"];
  1436. const rawTarget = toRaw(target);
  1437. const targetIsMap = isMap(rawTarget);
  1438. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1439. const isKeyOnly = method === "keys" && targetIsMap;
  1440. const innerIterator = target[method](...args);
  1441. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1442. !isReadonly2 && track(
  1443. rawTarget,
  1444. "iterate",
  1445. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1446. );
  1447. return {
  1448. // iterator protocol
  1449. next() {
  1450. const { value, done } = innerIterator.next();
  1451. return done ? { value, done } : {
  1452. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1453. done
  1454. };
  1455. },
  1456. // iterable protocol
  1457. [Symbol.iterator]() {
  1458. return this;
  1459. }
  1460. };
  1461. };
  1462. }
  1463. function createReadonlyMethod(type) {
  1464. return function(...args) {
  1465. {
  1466. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1467. warn$2(
  1468. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1469. toRaw(this)
  1470. );
  1471. }
  1472. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1473. };
  1474. }
  1475. function createInstrumentations(readonly, shallow) {
  1476. const instrumentations = {
  1477. get(key) {
  1478. const target = this["__v_raw"];
  1479. const rawTarget = toRaw(target);
  1480. const rawKey = toRaw(key);
  1481. if (!readonly) {
  1482. if (hasChanged(key, rawKey)) {
  1483. track(rawTarget, "get", key);
  1484. }
  1485. track(rawTarget, "get", rawKey);
  1486. }
  1487. const { has } = getProto(rawTarget);
  1488. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1489. if (has.call(rawTarget, key)) {
  1490. return wrap(target.get(key));
  1491. } else if (has.call(rawTarget, rawKey)) {
  1492. return wrap(target.get(rawKey));
  1493. } else if (target !== rawTarget) {
  1494. target.get(key);
  1495. }
  1496. },
  1497. get size() {
  1498. const target = this["__v_raw"];
  1499. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1500. return Reflect.get(target, "size", target);
  1501. },
  1502. has(key) {
  1503. const target = this["__v_raw"];
  1504. const rawTarget = toRaw(target);
  1505. const rawKey = toRaw(key);
  1506. if (!readonly) {
  1507. if (hasChanged(key, rawKey)) {
  1508. track(rawTarget, "has", key);
  1509. }
  1510. track(rawTarget, "has", rawKey);
  1511. }
  1512. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1513. },
  1514. forEach(callback, thisArg) {
  1515. const observed = this;
  1516. const target = observed["__v_raw"];
  1517. const rawTarget = toRaw(target);
  1518. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1519. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1520. return target.forEach((value, key) => {
  1521. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1522. });
  1523. }
  1524. };
  1525. extend(
  1526. instrumentations,
  1527. readonly ? {
  1528. add: createReadonlyMethod("add"),
  1529. set: createReadonlyMethod("set"),
  1530. delete: createReadonlyMethod("delete"),
  1531. clear: createReadonlyMethod("clear")
  1532. } : {
  1533. add(value) {
  1534. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1535. value = toRaw(value);
  1536. }
  1537. const target = toRaw(this);
  1538. const proto = getProto(target);
  1539. const hadKey = proto.has.call(target, value);
  1540. if (!hadKey) {
  1541. target.add(value);
  1542. trigger(target, "add", value, value);
  1543. }
  1544. return this;
  1545. },
  1546. set(key, value) {
  1547. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1548. value = toRaw(value);
  1549. }
  1550. const target = toRaw(this);
  1551. const { has, get } = getProto(target);
  1552. let hadKey = has.call(target, key);
  1553. if (!hadKey) {
  1554. key = toRaw(key);
  1555. hadKey = has.call(target, key);
  1556. } else {
  1557. checkIdentityKeys(target, has, key);
  1558. }
  1559. const oldValue = get.call(target, key);
  1560. target.set(key, value);
  1561. if (!hadKey) {
  1562. trigger(target, "add", key, value);
  1563. } else if (hasChanged(value, oldValue)) {
  1564. trigger(target, "set", key, value, oldValue);
  1565. }
  1566. return this;
  1567. },
  1568. delete(key) {
  1569. const target = toRaw(this);
  1570. const { has, get } = getProto(target);
  1571. let hadKey = has.call(target, key);
  1572. if (!hadKey) {
  1573. key = toRaw(key);
  1574. hadKey = has.call(target, key);
  1575. } else {
  1576. checkIdentityKeys(target, has, key);
  1577. }
  1578. const oldValue = get ? get.call(target, key) : void 0;
  1579. const result = target.delete(key);
  1580. if (hadKey) {
  1581. trigger(target, "delete", key, void 0, oldValue);
  1582. }
  1583. return result;
  1584. },
  1585. clear() {
  1586. const target = toRaw(this);
  1587. const hadItems = target.size !== 0;
  1588. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1589. const result = target.clear();
  1590. if (hadItems) {
  1591. trigger(
  1592. target,
  1593. "clear",
  1594. void 0,
  1595. void 0,
  1596. oldTarget
  1597. );
  1598. }
  1599. return result;
  1600. }
  1601. }
  1602. );
  1603. const iteratorMethods = [
  1604. "keys",
  1605. "values",
  1606. "entries",
  1607. Symbol.iterator
  1608. ];
  1609. iteratorMethods.forEach((method) => {
  1610. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1611. });
  1612. return instrumentations;
  1613. }
  1614. function createInstrumentationGetter(isReadonly2, shallow) {
  1615. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1616. return (target, key, receiver) => {
  1617. if (key === "__v_isReactive") {
  1618. return !isReadonly2;
  1619. } else if (key === "__v_isReadonly") {
  1620. return isReadonly2;
  1621. } else if (key === "__v_raw") {
  1622. return target;
  1623. }
  1624. return Reflect.get(
  1625. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1626. key,
  1627. receiver
  1628. );
  1629. };
  1630. }
  1631. const mutableCollectionHandlers = {
  1632. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1633. };
  1634. const shallowCollectionHandlers = {
  1635. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1636. };
  1637. const readonlyCollectionHandlers = {
  1638. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1639. };
  1640. const shallowReadonlyCollectionHandlers = {
  1641. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1642. };
  1643. function checkIdentityKeys(target, has, key) {
  1644. const rawKey = toRaw(key);
  1645. if (rawKey !== key && has.call(target, rawKey)) {
  1646. const type = toRawType(target);
  1647. warn$2(
  1648. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1649. );
  1650. }
  1651. }
  1652. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1653. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1654. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1655. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1656. function targetTypeMap(rawType) {
  1657. switch (rawType) {
  1658. case "Object":
  1659. case "Array":
  1660. return 1 /* COMMON */;
  1661. case "Map":
  1662. case "Set":
  1663. case "WeakMap":
  1664. case "WeakSet":
  1665. return 2 /* COLLECTION */;
  1666. default:
  1667. return 0 /* INVALID */;
  1668. }
  1669. }
  1670. function getTargetType(value) {
  1671. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1672. }
  1673. function reactive(target) {
  1674. if (isReadonly(target)) {
  1675. return target;
  1676. }
  1677. return createReactiveObject(
  1678. target,
  1679. false,
  1680. mutableHandlers,
  1681. mutableCollectionHandlers,
  1682. reactiveMap
  1683. );
  1684. }
  1685. function shallowReactive(target) {
  1686. return createReactiveObject(
  1687. target,
  1688. false,
  1689. shallowReactiveHandlers,
  1690. shallowCollectionHandlers,
  1691. shallowReactiveMap
  1692. );
  1693. }
  1694. function readonly(target) {
  1695. return createReactiveObject(
  1696. target,
  1697. true,
  1698. readonlyHandlers,
  1699. readonlyCollectionHandlers,
  1700. readonlyMap
  1701. );
  1702. }
  1703. function shallowReadonly(target) {
  1704. return createReactiveObject(
  1705. target,
  1706. true,
  1707. shallowReadonlyHandlers,
  1708. shallowReadonlyCollectionHandlers,
  1709. shallowReadonlyMap
  1710. );
  1711. }
  1712. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1713. if (!isObject(target)) {
  1714. {
  1715. warn$2(
  1716. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1717. target
  1718. )}`
  1719. );
  1720. }
  1721. return target;
  1722. }
  1723. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1724. return target;
  1725. }
  1726. const targetType = getTargetType(target);
  1727. if (targetType === 0 /* INVALID */) {
  1728. return target;
  1729. }
  1730. const existingProxy = proxyMap.get(target);
  1731. if (existingProxy) {
  1732. return existingProxy;
  1733. }
  1734. const proxy = new Proxy(
  1735. target,
  1736. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1737. );
  1738. proxyMap.set(target, proxy);
  1739. return proxy;
  1740. }
  1741. function isReactive(value) {
  1742. if (isReadonly(value)) {
  1743. return isReactive(value["__v_raw"]);
  1744. }
  1745. return !!(value && value["__v_isReactive"]);
  1746. }
  1747. function isReadonly(value) {
  1748. return !!(value && value["__v_isReadonly"]);
  1749. }
  1750. function isShallow(value) {
  1751. return !!(value && value["__v_isShallow"]);
  1752. }
  1753. function isProxy(value) {
  1754. return value ? !!value["__v_raw"] : false;
  1755. }
  1756. function toRaw(observed) {
  1757. const raw = observed && observed["__v_raw"];
  1758. return raw ? toRaw(raw) : observed;
  1759. }
  1760. function markRaw(value) {
  1761. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1762. def(value, "__v_skip", true);
  1763. }
  1764. return value;
  1765. }
  1766. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1767. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1768. function isRef(r) {
  1769. return r ? r["__v_isRef"] === true : false;
  1770. }
  1771. function ref(value) {
  1772. return createRef(value, false);
  1773. }
  1774. function shallowRef(value) {
  1775. return createRef(value, true);
  1776. }
  1777. function createRef(rawValue, shallow) {
  1778. if (isRef(rawValue)) {
  1779. return rawValue;
  1780. }
  1781. return new RefImpl(rawValue, shallow);
  1782. }
  1783. class RefImpl {
  1784. constructor(value, isShallow2) {
  1785. this.dep = new Dep();
  1786. this["__v_isRef"] = true;
  1787. this["__v_isShallow"] = false;
  1788. this._rawValue = isShallow2 ? value : toRaw(value);
  1789. this._value = isShallow2 ? value : toReactive(value);
  1790. this["__v_isShallow"] = isShallow2;
  1791. }
  1792. get value() {
  1793. {
  1794. this.dep.track({
  1795. target: this,
  1796. type: "get",
  1797. key: "value"
  1798. });
  1799. }
  1800. return this._value;
  1801. }
  1802. set value(newValue) {
  1803. const oldValue = this._rawValue;
  1804. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1805. newValue = useDirectValue ? newValue : toRaw(newValue);
  1806. if (hasChanged(newValue, oldValue)) {
  1807. this._rawValue = newValue;
  1808. this._value = useDirectValue ? newValue : toReactive(newValue);
  1809. {
  1810. this.dep.trigger({
  1811. target: this,
  1812. type: "set",
  1813. key: "value",
  1814. newValue,
  1815. oldValue
  1816. });
  1817. }
  1818. }
  1819. }
  1820. }
  1821. function triggerRef(ref2) {
  1822. if (ref2.dep) {
  1823. {
  1824. ref2.dep.trigger({
  1825. target: ref2,
  1826. type: "set",
  1827. key: "value",
  1828. newValue: ref2._value
  1829. });
  1830. }
  1831. }
  1832. }
  1833. function unref(ref2) {
  1834. return isRef(ref2) ? ref2.value : ref2;
  1835. }
  1836. function toValue(source) {
  1837. return isFunction(source) ? source() : unref(source);
  1838. }
  1839. const shallowUnwrapHandlers = {
  1840. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1841. set: (target, key, value, receiver) => {
  1842. const oldValue = target[key];
  1843. if (isRef(oldValue) && !isRef(value)) {
  1844. oldValue.value = value;
  1845. return true;
  1846. } else {
  1847. return Reflect.set(target, key, value, receiver);
  1848. }
  1849. }
  1850. };
  1851. function proxyRefs(objectWithRefs) {
  1852. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1853. }
  1854. class CustomRefImpl {
  1855. constructor(factory) {
  1856. this["__v_isRef"] = true;
  1857. this._value = void 0;
  1858. const dep = this.dep = new Dep();
  1859. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1860. this._get = get;
  1861. this._set = set;
  1862. }
  1863. get value() {
  1864. return this._value = this._get();
  1865. }
  1866. set value(newVal) {
  1867. this._set(newVal);
  1868. }
  1869. }
  1870. function customRef(factory) {
  1871. return new CustomRefImpl(factory);
  1872. }
  1873. function toRefs(object) {
  1874. if (!isProxy(object)) {
  1875. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1876. }
  1877. const ret = isArray(object) ? new Array(object.length) : {};
  1878. for (const key in object) {
  1879. ret[key] = propertyToRef(object, key);
  1880. }
  1881. return ret;
  1882. }
  1883. class ObjectRefImpl {
  1884. constructor(_object, _key, _defaultValue) {
  1885. this._object = _object;
  1886. this._key = _key;
  1887. this._defaultValue = _defaultValue;
  1888. this["__v_isRef"] = true;
  1889. this._value = void 0;
  1890. }
  1891. get value() {
  1892. const val = this._object[this._key];
  1893. return this._value = val === void 0 ? this._defaultValue : val;
  1894. }
  1895. set value(newVal) {
  1896. this._object[this._key] = newVal;
  1897. }
  1898. get dep() {
  1899. return getDepFromReactive(toRaw(this._object), this._key);
  1900. }
  1901. }
  1902. class GetterRefImpl {
  1903. constructor(_getter) {
  1904. this._getter = _getter;
  1905. this["__v_isRef"] = true;
  1906. this["__v_isReadonly"] = true;
  1907. this._value = void 0;
  1908. }
  1909. get value() {
  1910. return this._value = this._getter();
  1911. }
  1912. }
  1913. function toRef(source, key, defaultValue) {
  1914. if (isRef(source)) {
  1915. return source;
  1916. } else if (isFunction(source)) {
  1917. return new GetterRefImpl(source);
  1918. } else if (isObject(source) && arguments.length > 1) {
  1919. return propertyToRef(source, key, defaultValue);
  1920. } else {
  1921. return ref(source);
  1922. }
  1923. }
  1924. function propertyToRef(source, key, defaultValue) {
  1925. const val = source[key];
  1926. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1927. }
  1928. class ComputedRefImpl {
  1929. constructor(fn, setter, isSSR) {
  1930. this.fn = fn;
  1931. this.setter = setter;
  1932. /**
  1933. * @internal
  1934. */
  1935. this._value = void 0;
  1936. /**
  1937. * @internal
  1938. */
  1939. this.dep = new Dep(this);
  1940. /**
  1941. * @internal
  1942. */
  1943. this.__v_isRef = true;
  1944. // TODO isolatedDeclarations "__v_isReadonly"
  1945. // A computed is also a subscriber that tracks other deps
  1946. /**
  1947. * @internal
  1948. */
  1949. this.deps = void 0;
  1950. /**
  1951. * @internal
  1952. */
  1953. this.depsTail = void 0;
  1954. /**
  1955. * @internal
  1956. */
  1957. this.flags = 16;
  1958. /**
  1959. * @internal
  1960. */
  1961. this.globalVersion = globalVersion - 1;
  1962. /**
  1963. * @internal
  1964. */
  1965. this.next = void 0;
  1966. // for backwards compat
  1967. this.effect = this;
  1968. this["__v_isReadonly"] = !setter;
  1969. this.isSSR = isSSR;
  1970. }
  1971. /**
  1972. * @internal
  1973. */
  1974. notify() {
  1975. this.flags |= 16;
  1976. if (!(this.flags & 8) && // avoid infinite self recursion
  1977. activeSub !== this) {
  1978. batch(this, true);
  1979. return true;
  1980. }
  1981. }
  1982. get value() {
  1983. const link = this.dep.track({
  1984. target: this,
  1985. type: "get",
  1986. key: "value"
  1987. }) ;
  1988. refreshComputed(this);
  1989. if (link) {
  1990. link.version = this.dep.version;
  1991. }
  1992. return this._value;
  1993. }
  1994. set value(newValue) {
  1995. if (this.setter) {
  1996. this.setter(newValue);
  1997. } else {
  1998. warn$2("Write operation failed: computed value is readonly");
  1999. }
  2000. }
  2001. }
  2002. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2003. let getter;
  2004. let setter;
  2005. if (isFunction(getterOrOptions)) {
  2006. getter = getterOrOptions;
  2007. } else {
  2008. getter = getterOrOptions.get;
  2009. setter = getterOrOptions.set;
  2010. }
  2011. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  2012. if (debugOptions && !isSSR) {
  2013. cRef.onTrack = debugOptions.onTrack;
  2014. cRef.onTrigger = debugOptions.onTrigger;
  2015. }
  2016. return cRef;
  2017. }
  2018. const TrackOpTypes = {
  2019. "GET": "get",
  2020. "HAS": "has",
  2021. "ITERATE": "iterate"
  2022. };
  2023. const TriggerOpTypes = {
  2024. "SET": "set",
  2025. "ADD": "add",
  2026. "DELETE": "delete",
  2027. "CLEAR": "clear"
  2028. };
  2029. const INITIAL_WATCHER_VALUE = {};
  2030. const cleanupMap = /* @__PURE__ */ new WeakMap();
  2031. let activeWatcher = void 0;
  2032. function getCurrentWatcher() {
  2033. return activeWatcher;
  2034. }
  2035. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2036. if (owner) {
  2037. let cleanups = cleanupMap.get(owner);
  2038. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2039. cleanups.push(cleanupFn);
  2040. } else if (!failSilently) {
  2041. warn$2(
  2042. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2043. );
  2044. }
  2045. }
  2046. function watch$1(source, cb, options = EMPTY_OBJ) {
  2047. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2048. const warnInvalidSource = (s) => {
  2049. (options.onWarn || warn$2)(
  2050. `Invalid watch source: `,
  2051. s,
  2052. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2053. );
  2054. };
  2055. const reactiveGetter = (source2) => {
  2056. if (deep) return source2;
  2057. if (isShallow(source2) || deep === false || deep === 0)
  2058. return traverse(source2, 1);
  2059. return traverse(source2);
  2060. };
  2061. let effect;
  2062. let getter;
  2063. let cleanup;
  2064. let boundCleanup;
  2065. let forceTrigger = false;
  2066. let isMultiSource = false;
  2067. if (isRef(source)) {
  2068. getter = () => source.value;
  2069. forceTrigger = isShallow(source);
  2070. } else if (isReactive(source)) {
  2071. getter = () => reactiveGetter(source);
  2072. forceTrigger = true;
  2073. } else if (isArray(source)) {
  2074. isMultiSource = true;
  2075. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2076. getter = () => source.map((s) => {
  2077. if (isRef(s)) {
  2078. return s.value;
  2079. } else if (isReactive(s)) {
  2080. return reactiveGetter(s);
  2081. } else if (isFunction(s)) {
  2082. return call ? call(s, 2) : s();
  2083. } else {
  2084. warnInvalidSource(s);
  2085. }
  2086. });
  2087. } else if (isFunction(source)) {
  2088. if (cb) {
  2089. getter = call ? () => call(source, 2) : source;
  2090. } else {
  2091. getter = () => {
  2092. if (cleanup) {
  2093. pauseTracking();
  2094. try {
  2095. cleanup();
  2096. } finally {
  2097. resetTracking();
  2098. }
  2099. }
  2100. const currentEffect = activeWatcher;
  2101. activeWatcher = effect;
  2102. try {
  2103. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2104. } finally {
  2105. activeWatcher = currentEffect;
  2106. }
  2107. };
  2108. }
  2109. } else {
  2110. getter = NOOP;
  2111. warnInvalidSource(source);
  2112. }
  2113. if (cb && deep) {
  2114. const baseGetter = getter;
  2115. const depth = deep === true ? Infinity : deep;
  2116. getter = () => traverse(baseGetter(), depth);
  2117. }
  2118. const scope = getCurrentScope();
  2119. const watchHandle = () => {
  2120. effect.stop();
  2121. if (scope && scope.active) {
  2122. remove(scope.effects, effect);
  2123. }
  2124. };
  2125. if (once && cb) {
  2126. const _cb = cb;
  2127. cb = (...args) => {
  2128. _cb(...args);
  2129. watchHandle();
  2130. };
  2131. }
  2132. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2133. const job = (immediateFirstRun) => {
  2134. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2135. return;
  2136. }
  2137. if (cb) {
  2138. const newValue = effect.run();
  2139. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2140. if (cleanup) {
  2141. cleanup();
  2142. }
  2143. const currentWatcher = activeWatcher;
  2144. activeWatcher = effect;
  2145. try {
  2146. const args = [
  2147. newValue,
  2148. // pass undefined as the old value when it's changed for the first time
  2149. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2150. boundCleanup
  2151. ];
  2152. oldValue = newValue;
  2153. call ? call(cb, 3, args) : (
  2154. // @ts-expect-error
  2155. cb(...args)
  2156. );
  2157. } finally {
  2158. activeWatcher = currentWatcher;
  2159. }
  2160. }
  2161. } else {
  2162. effect.run();
  2163. }
  2164. };
  2165. if (augmentJob) {
  2166. augmentJob(job);
  2167. }
  2168. effect = new ReactiveEffect(getter);
  2169. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2170. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2171. cleanup = effect.onStop = () => {
  2172. const cleanups = cleanupMap.get(effect);
  2173. if (cleanups) {
  2174. if (call) {
  2175. call(cleanups, 4);
  2176. } else {
  2177. for (const cleanup2 of cleanups) cleanup2();
  2178. }
  2179. cleanupMap.delete(effect);
  2180. }
  2181. };
  2182. {
  2183. effect.onTrack = options.onTrack;
  2184. effect.onTrigger = options.onTrigger;
  2185. }
  2186. if (cb) {
  2187. if (immediate) {
  2188. job(true);
  2189. } else {
  2190. oldValue = effect.run();
  2191. }
  2192. } else if (scheduler) {
  2193. scheduler(job.bind(null, true), true);
  2194. } else {
  2195. effect.run();
  2196. }
  2197. watchHandle.pause = effect.pause.bind(effect);
  2198. watchHandle.resume = effect.resume.bind(effect);
  2199. watchHandle.stop = watchHandle;
  2200. return watchHandle;
  2201. }
  2202. function traverse(value, depth = Infinity, seen) {
  2203. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2204. return value;
  2205. }
  2206. seen = seen || /* @__PURE__ */ new Set();
  2207. if (seen.has(value)) {
  2208. return value;
  2209. }
  2210. seen.add(value);
  2211. depth--;
  2212. if (isRef(value)) {
  2213. traverse(value.value, depth, seen);
  2214. } else if (isArray(value)) {
  2215. for (let i = 0; i < value.length; i++) {
  2216. traverse(value[i], depth, seen);
  2217. }
  2218. } else if (isSet(value) || isMap(value)) {
  2219. value.forEach((v) => {
  2220. traverse(v, depth, seen);
  2221. });
  2222. } else if (isPlainObject(value)) {
  2223. for (const key in value) {
  2224. traverse(value[key], depth, seen);
  2225. }
  2226. for (const key of Object.getOwnPropertySymbols(value)) {
  2227. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2228. traverse(value[key], depth, seen);
  2229. }
  2230. }
  2231. }
  2232. return value;
  2233. }
  2234. const stack$1 = [];
  2235. function pushWarningContext(vnode) {
  2236. stack$1.push(vnode);
  2237. }
  2238. function popWarningContext() {
  2239. stack$1.pop();
  2240. }
  2241. let isWarning = false;
  2242. function warn$1(msg, ...args) {
  2243. if (isWarning) return;
  2244. isWarning = true;
  2245. pauseTracking();
  2246. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2247. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2248. const trace = getComponentTrace();
  2249. if (appWarnHandler) {
  2250. callWithErrorHandling(
  2251. appWarnHandler,
  2252. instance,
  2253. 11,
  2254. [
  2255. // eslint-disable-next-line no-restricted-syntax
  2256. msg + args.map((a) => {
  2257. var _a, _b;
  2258. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2259. }).join(""),
  2260. instance && instance.proxy,
  2261. trace.map(
  2262. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2263. ).join("\n"),
  2264. trace
  2265. ]
  2266. );
  2267. } else {
  2268. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2269. if (trace.length && // avoid spamming console during tests
  2270. true) {
  2271. warnArgs.push(`
  2272. `, ...formatTrace(trace));
  2273. }
  2274. console.warn(...warnArgs);
  2275. }
  2276. resetTracking();
  2277. isWarning = false;
  2278. }
  2279. function getComponentTrace() {
  2280. let currentVNode = stack$1[stack$1.length - 1];
  2281. if (!currentVNode) {
  2282. return [];
  2283. }
  2284. const normalizedStack = [];
  2285. while (currentVNode) {
  2286. const last = normalizedStack[0];
  2287. if (last && last.vnode === currentVNode) {
  2288. last.recurseCount++;
  2289. } else {
  2290. normalizedStack.push({
  2291. vnode: currentVNode,
  2292. recurseCount: 0
  2293. });
  2294. }
  2295. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2296. currentVNode = parentInstance && parentInstance.vnode;
  2297. }
  2298. return normalizedStack;
  2299. }
  2300. function formatTrace(trace) {
  2301. const logs = [];
  2302. trace.forEach((entry, i) => {
  2303. logs.push(...i === 0 ? [] : [`
  2304. `], ...formatTraceEntry(entry));
  2305. });
  2306. return logs;
  2307. }
  2308. function formatTraceEntry({ vnode, recurseCount }) {
  2309. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2310. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2311. const open = ` at <${formatComponentName(
  2312. vnode.component,
  2313. vnode.type,
  2314. isRoot
  2315. )}`;
  2316. const close = `>` + postfix;
  2317. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2318. }
  2319. function formatProps(props) {
  2320. const res = [];
  2321. const keys = Object.keys(props);
  2322. keys.slice(0, 3).forEach((key) => {
  2323. res.push(...formatProp(key, props[key]));
  2324. });
  2325. if (keys.length > 3) {
  2326. res.push(` ...`);
  2327. }
  2328. return res;
  2329. }
  2330. function formatProp(key, value, raw) {
  2331. if (isString(value)) {
  2332. value = JSON.stringify(value);
  2333. return raw ? value : [`${key}=${value}`];
  2334. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2335. return raw ? value : [`${key}=${value}`];
  2336. } else if (isRef(value)) {
  2337. value = formatProp(key, toRaw(value.value), true);
  2338. return raw ? value : [`${key}=Ref<`, value, `>`];
  2339. } else if (isFunction(value)) {
  2340. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2341. } else {
  2342. value = toRaw(value);
  2343. return raw ? value : [`${key}=`, value];
  2344. }
  2345. }
  2346. function assertNumber(val, type) {
  2347. if (val === void 0) {
  2348. return;
  2349. } else if (typeof val !== "number") {
  2350. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2351. } else if (isNaN(val)) {
  2352. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2353. }
  2354. }
  2355. const ErrorCodes = {
  2356. "SETUP_FUNCTION": 0,
  2357. "0": "SETUP_FUNCTION",
  2358. "RENDER_FUNCTION": 1,
  2359. "1": "RENDER_FUNCTION",
  2360. "NATIVE_EVENT_HANDLER": 5,
  2361. "5": "NATIVE_EVENT_HANDLER",
  2362. "COMPONENT_EVENT_HANDLER": 6,
  2363. "6": "COMPONENT_EVENT_HANDLER",
  2364. "VNODE_HOOK": 7,
  2365. "7": "VNODE_HOOK",
  2366. "DIRECTIVE_HOOK": 8,
  2367. "8": "DIRECTIVE_HOOK",
  2368. "TRANSITION_HOOK": 9,
  2369. "9": "TRANSITION_HOOK",
  2370. "APP_ERROR_HANDLER": 10,
  2371. "10": "APP_ERROR_HANDLER",
  2372. "APP_WARN_HANDLER": 11,
  2373. "11": "APP_WARN_HANDLER",
  2374. "FUNCTION_REF": 12,
  2375. "12": "FUNCTION_REF",
  2376. "ASYNC_COMPONENT_LOADER": 13,
  2377. "13": "ASYNC_COMPONENT_LOADER",
  2378. "SCHEDULER": 14,
  2379. "14": "SCHEDULER",
  2380. "COMPONENT_UPDATE": 15,
  2381. "15": "COMPONENT_UPDATE",
  2382. "APP_UNMOUNT_CLEANUP": 16,
  2383. "16": "APP_UNMOUNT_CLEANUP"
  2384. };
  2385. const ErrorTypeStrings$1 = {
  2386. ["sp"]: "serverPrefetch hook",
  2387. ["bc"]: "beforeCreate hook",
  2388. ["c"]: "created hook",
  2389. ["bm"]: "beforeMount hook",
  2390. ["m"]: "mounted hook",
  2391. ["bu"]: "beforeUpdate hook",
  2392. ["u"]: "updated",
  2393. ["bum"]: "beforeUnmount hook",
  2394. ["um"]: "unmounted hook",
  2395. ["a"]: "activated hook",
  2396. ["da"]: "deactivated hook",
  2397. ["ec"]: "errorCaptured hook",
  2398. ["rtc"]: "renderTracked hook",
  2399. ["rtg"]: "renderTriggered hook",
  2400. [0]: "setup function",
  2401. [1]: "render function",
  2402. [2]: "watcher getter",
  2403. [3]: "watcher callback",
  2404. [4]: "watcher cleanup function",
  2405. [5]: "native event handler",
  2406. [6]: "component event handler",
  2407. [7]: "vnode hook",
  2408. [8]: "directive hook",
  2409. [9]: "transition hook",
  2410. [10]: "app errorHandler",
  2411. [11]: "app warnHandler",
  2412. [12]: "ref function",
  2413. [13]: "async component loader",
  2414. [14]: "scheduler flush",
  2415. [15]: "component update",
  2416. [16]: "app unmount cleanup function"
  2417. };
  2418. function callWithErrorHandling(fn, instance, type, args) {
  2419. try {
  2420. return args ? fn(...args) : fn();
  2421. } catch (err) {
  2422. handleError(err, instance, type);
  2423. }
  2424. }
  2425. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2426. if (isFunction(fn)) {
  2427. const res = callWithErrorHandling(fn, instance, type, args);
  2428. if (res && isPromise(res)) {
  2429. res.catch((err) => {
  2430. handleError(err, instance, type);
  2431. });
  2432. }
  2433. return res;
  2434. }
  2435. if (isArray(fn)) {
  2436. const values = [];
  2437. for (let i = 0; i < fn.length; i++) {
  2438. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2439. }
  2440. return values;
  2441. } else {
  2442. warn$1(
  2443. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2444. );
  2445. }
  2446. }
  2447. function handleError(err, instance, type, throwInDev = true) {
  2448. const contextVNode = instance ? instance.vnode : null;
  2449. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2450. if (instance) {
  2451. let cur = instance.parent;
  2452. const exposedInstance = instance.proxy;
  2453. const errorInfo = ErrorTypeStrings$1[type] ;
  2454. while (cur) {
  2455. const errorCapturedHooks = cur.ec;
  2456. if (errorCapturedHooks) {
  2457. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2458. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2459. return;
  2460. }
  2461. }
  2462. }
  2463. cur = cur.parent;
  2464. }
  2465. if (errorHandler) {
  2466. pauseTracking();
  2467. callWithErrorHandling(errorHandler, null, 10, [
  2468. err,
  2469. exposedInstance,
  2470. errorInfo
  2471. ]);
  2472. resetTracking();
  2473. return;
  2474. }
  2475. }
  2476. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2477. }
  2478. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2479. {
  2480. const info = ErrorTypeStrings$1[type];
  2481. if (contextVNode) {
  2482. pushWarningContext(contextVNode);
  2483. }
  2484. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2485. if (contextVNode) {
  2486. popWarningContext();
  2487. }
  2488. if (throwInDev) {
  2489. throw err;
  2490. } else {
  2491. console.error(err);
  2492. }
  2493. }
  2494. }
  2495. const queue = [];
  2496. let flushIndex = -1;
  2497. const pendingPostFlushCbs = [];
  2498. let activePostFlushCbs = null;
  2499. let postFlushIndex = 0;
  2500. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2501. let currentFlushPromise = null;
  2502. const RECURSION_LIMIT = 100;
  2503. function nextTick(fn) {
  2504. const p = currentFlushPromise || resolvedPromise;
  2505. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2506. }
  2507. function findInsertionIndex(id) {
  2508. let start = flushIndex + 1;
  2509. let end = queue.length;
  2510. while (start < end) {
  2511. const middle = start + end >>> 1;
  2512. const middleJob = queue[middle];
  2513. const middleJobId = getId(middleJob);
  2514. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2515. start = middle + 1;
  2516. } else {
  2517. end = middle;
  2518. }
  2519. }
  2520. return start;
  2521. }
  2522. function queueJob(job) {
  2523. if (!(job.flags & 1)) {
  2524. const jobId = getId(job);
  2525. const lastJob = queue[queue.length - 1];
  2526. if (!lastJob || // fast path when the job id is larger than the tail
  2527. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2528. queue.push(job);
  2529. } else {
  2530. queue.splice(findInsertionIndex(jobId), 0, job);
  2531. }
  2532. job.flags |= 1;
  2533. queueFlush();
  2534. }
  2535. }
  2536. function queueFlush() {
  2537. if (!currentFlushPromise) {
  2538. currentFlushPromise = resolvedPromise.then(flushJobs);
  2539. }
  2540. }
  2541. function queuePostFlushCb(cb) {
  2542. if (!isArray(cb)) {
  2543. if (activePostFlushCbs && cb.id === -1) {
  2544. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2545. } else if (!(cb.flags & 1)) {
  2546. pendingPostFlushCbs.push(cb);
  2547. cb.flags |= 1;
  2548. }
  2549. } else {
  2550. pendingPostFlushCbs.push(...cb);
  2551. }
  2552. queueFlush();
  2553. }
  2554. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2555. {
  2556. seen = seen || /* @__PURE__ */ new Map();
  2557. }
  2558. for (; i < queue.length; i++) {
  2559. const cb = queue[i];
  2560. if (cb && cb.flags & 2) {
  2561. if (instance && cb.id !== instance.uid) {
  2562. continue;
  2563. }
  2564. if (checkRecursiveUpdates(seen, cb)) {
  2565. continue;
  2566. }
  2567. queue.splice(i, 1);
  2568. i--;
  2569. if (cb.flags & 4) {
  2570. cb.flags &= -2;
  2571. }
  2572. cb();
  2573. if (!(cb.flags & 4)) {
  2574. cb.flags &= -2;
  2575. }
  2576. }
  2577. }
  2578. }
  2579. function flushPostFlushCbs(seen) {
  2580. if (pendingPostFlushCbs.length) {
  2581. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2582. (a, b) => getId(a) - getId(b)
  2583. );
  2584. pendingPostFlushCbs.length = 0;
  2585. if (activePostFlushCbs) {
  2586. activePostFlushCbs.push(...deduped);
  2587. return;
  2588. }
  2589. activePostFlushCbs = deduped;
  2590. {
  2591. seen = seen || /* @__PURE__ */ new Map();
  2592. }
  2593. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2594. const cb = activePostFlushCbs[postFlushIndex];
  2595. if (checkRecursiveUpdates(seen, cb)) {
  2596. continue;
  2597. }
  2598. if (cb.flags & 4) {
  2599. cb.flags &= -2;
  2600. }
  2601. if (!(cb.flags & 8)) cb();
  2602. cb.flags &= -2;
  2603. }
  2604. activePostFlushCbs = null;
  2605. postFlushIndex = 0;
  2606. }
  2607. }
  2608. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2609. function flushJobs(seen) {
  2610. {
  2611. seen = seen || /* @__PURE__ */ new Map();
  2612. }
  2613. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2614. try {
  2615. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2616. const job = queue[flushIndex];
  2617. if (job && !(job.flags & 8)) {
  2618. if (check(job)) {
  2619. continue;
  2620. }
  2621. if (job.flags & 4) {
  2622. job.flags &= ~1;
  2623. }
  2624. callWithErrorHandling(
  2625. job,
  2626. job.i,
  2627. job.i ? 15 : 14
  2628. );
  2629. if (!(job.flags & 4)) {
  2630. job.flags &= ~1;
  2631. }
  2632. }
  2633. }
  2634. } finally {
  2635. for (; flushIndex < queue.length; flushIndex++) {
  2636. const job = queue[flushIndex];
  2637. if (job) {
  2638. job.flags &= -2;
  2639. }
  2640. }
  2641. flushIndex = -1;
  2642. queue.length = 0;
  2643. flushPostFlushCbs(seen);
  2644. currentFlushPromise = null;
  2645. if (queue.length || pendingPostFlushCbs.length) {
  2646. flushJobs(seen);
  2647. }
  2648. }
  2649. }
  2650. function checkRecursiveUpdates(seen, fn) {
  2651. const count = seen.get(fn) || 0;
  2652. if (count > RECURSION_LIMIT) {
  2653. const instance = fn.i;
  2654. const componentName = instance && getComponentName(instance.type);
  2655. handleError(
  2656. `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
  2657. null,
  2658. 10
  2659. );
  2660. return true;
  2661. }
  2662. seen.set(fn, count + 1);
  2663. return false;
  2664. }
  2665. let isHmrUpdating = false;
  2666. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2667. {
  2668. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2669. createRecord: tryWrap(createRecord),
  2670. rerender: tryWrap(rerender),
  2671. reload: tryWrap(reload)
  2672. };
  2673. }
  2674. const map = /* @__PURE__ */ new Map();
  2675. function registerHMR(instance) {
  2676. const id = instance.type.__hmrId;
  2677. let record = map.get(id);
  2678. if (!record) {
  2679. createRecord(id, instance.type);
  2680. record = map.get(id);
  2681. }
  2682. record.instances.add(instance);
  2683. }
  2684. function unregisterHMR(instance) {
  2685. map.get(instance.type.__hmrId).instances.delete(instance);
  2686. }
  2687. function createRecord(id, initialDef) {
  2688. if (map.has(id)) {
  2689. return false;
  2690. }
  2691. map.set(id, {
  2692. initialDef: normalizeClassComponent(initialDef),
  2693. instances: /* @__PURE__ */ new Set()
  2694. });
  2695. return true;
  2696. }
  2697. function normalizeClassComponent(component) {
  2698. return isClassComponent(component) ? component.__vccOpts : component;
  2699. }
  2700. function rerender(id, newRender) {
  2701. const record = map.get(id);
  2702. if (!record) {
  2703. return;
  2704. }
  2705. record.initialDef.render = newRender;
  2706. [...record.instances].forEach((instance) => {
  2707. if (newRender) {
  2708. instance.render = newRender;
  2709. normalizeClassComponent(instance.type).render = newRender;
  2710. }
  2711. instance.renderCache = [];
  2712. isHmrUpdating = true;
  2713. if (!(instance.job.flags & 8)) {
  2714. instance.update();
  2715. }
  2716. isHmrUpdating = false;
  2717. });
  2718. }
  2719. function reload(id, newComp) {
  2720. const record = map.get(id);
  2721. if (!record) return;
  2722. newComp = normalizeClassComponent(newComp);
  2723. updateComponentDef(record.initialDef, newComp);
  2724. const instances = [...record.instances];
  2725. for (let i = 0; i < instances.length; i++) {
  2726. const instance = instances[i];
  2727. const oldComp = normalizeClassComponent(instance.type);
  2728. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2729. if (!dirtyInstances) {
  2730. if (oldComp !== record.initialDef) {
  2731. updateComponentDef(oldComp, newComp);
  2732. }
  2733. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2734. }
  2735. dirtyInstances.add(instance);
  2736. instance.appContext.propsCache.delete(instance.type);
  2737. instance.appContext.emitsCache.delete(instance.type);
  2738. instance.appContext.optionsCache.delete(instance.type);
  2739. if (instance.ceReload) {
  2740. dirtyInstances.add(instance);
  2741. instance.ceReload(newComp.styles);
  2742. dirtyInstances.delete(instance);
  2743. } else if (instance.parent) {
  2744. queueJob(() => {
  2745. isHmrUpdating = true;
  2746. instance.parent.update();
  2747. isHmrUpdating = false;
  2748. dirtyInstances.delete(instance);
  2749. });
  2750. } else if (instance.appContext.reload) {
  2751. instance.appContext.reload();
  2752. } else if (typeof window !== "undefined") {
  2753. window.location.reload();
  2754. } else {
  2755. console.warn(
  2756. "[HMR] Root or manually mounted instance modified. Full reload required."
  2757. );
  2758. }
  2759. if (instance.root.ce && instance !== instance.root) {
  2760. instance.root.ce._removeChildStyle(oldComp);
  2761. }
  2762. }
  2763. queuePostFlushCb(() => {
  2764. hmrDirtyComponents.clear();
  2765. });
  2766. }
  2767. function updateComponentDef(oldComp, newComp) {
  2768. extend(oldComp, newComp);
  2769. for (const key in oldComp) {
  2770. if (key !== "__file" && !(key in newComp)) {
  2771. delete oldComp[key];
  2772. }
  2773. }
  2774. }
  2775. function tryWrap(fn) {
  2776. return (id, arg) => {
  2777. try {
  2778. return fn(id, arg);
  2779. } catch (e) {
  2780. console.error(e);
  2781. console.warn(
  2782. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2783. );
  2784. }
  2785. };
  2786. }
  2787. let devtools$1;
  2788. let buffer = [];
  2789. let devtoolsNotInstalled = false;
  2790. function emit$1(event, ...args) {
  2791. if (devtools$1) {
  2792. devtools$1.emit(event, ...args);
  2793. } else if (!devtoolsNotInstalled) {
  2794. buffer.push({ event, args });
  2795. }
  2796. }
  2797. function setDevtoolsHook$1(hook, target) {
  2798. var _a, _b;
  2799. devtools$1 = hook;
  2800. if (devtools$1) {
  2801. devtools$1.enabled = true;
  2802. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2803. buffer = [];
  2804. } else if (
  2805. // handle late devtools injection - only do this if we are in an actual
  2806. // browser environment to avoid the timer handle stalling test runner exit
  2807. // (#4815)
  2808. typeof window !== "undefined" && // some envs mock window but not fully
  2809. window.HTMLElement && // also exclude jsdom
  2810. // eslint-disable-next-line no-restricted-syntax
  2811. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2812. ) {
  2813. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2814. replay.push((newHook) => {
  2815. setDevtoolsHook$1(newHook, target);
  2816. });
  2817. setTimeout(() => {
  2818. if (!devtools$1) {
  2819. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2820. devtoolsNotInstalled = true;
  2821. buffer = [];
  2822. }
  2823. }, 3e3);
  2824. } else {
  2825. devtoolsNotInstalled = true;
  2826. buffer = [];
  2827. }
  2828. }
  2829. function devtoolsInitApp(app, version) {
  2830. emit$1("app:init" /* APP_INIT */, app, version, {
  2831. Fragment,
  2832. Text,
  2833. Comment,
  2834. Static
  2835. });
  2836. }
  2837. function devtoolsUnmountApp(app) {
  2838. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2839. }
  2840. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2841. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2842. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2843. "component:removed" /* COMPONENT_REMOVED */
  2844. );
  2845. const devtoolsComponentRemoved = (component) => {
  2846. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2847. !devtools$1.cleanupBuffer(component)) {
  2848. _devtoolsComponentRemoved(component);
  2849. }
  2850. };
  2851. /*! #__NO_SIDE_EFFECTS__ */
  2852. // @__NO_SIDE_EFFECTS__
  2853. function createDevtoolsComponentHook(hook) {
  2854. return (component) => {
  2855. emit$1(
  2856. hook,
  2857. component.appContext.app,
  2858. component.uid,
  2859. component.parent ? component.parent.uid : void 0,
  2860. component
  2861. );
  2862. };
  2863. }
  2864. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2865. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2866. function createDevtoolsPerformanceHook(hook) {
  2867. return (component, type, time) => {
  2868. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2869. };
  2870. }
  2871. function devtoolsComponentEmit(component, event, params) {
  2872. emit$1(
  2873. "component:emit" /* COMPONENT_EMIT */,
  2874. component.appContext.app,
  2875. component,
  2876. event,
  2877. params
  2878. );
  2879. }
  2880. let currentRenderingInstance = null;
  2881. let currentScopeId = null;
  2882. function setCurrentRenderingInstance(instance) {
  2883. const prev = currentRenderingInstance;
  2884. currentRenderingInstance = instance;
  2885. currentScopeId = instance && instance.type.__scopeId || null;
  2886. return prev;
  2887. }
  2888. function pushScopeId(id) {
  2889. currentScopeId = id;
  2890. }
  2891. function popScopeId() {
  2892. currentScopeId = null;
  2893. }
  2894. const withScopeId = (_id) => withCtx;
  2895. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2896. if (!ctx) return fn;
  2897. if (fn._n) {
  2898. return fn;
  2899. }
  2900. const renderFnWithContext = (...args) => {
  2901. if (renderFnWithContext._d) {
  2902. setBlockTracking(-1);
  2903. }
  2904. const prevInstance = setCurrentRenderingInstance(ctx);
  2905. let res;
  2906. try {
  2907. res = fn(...args);
  2908. } finally {
  2909. setCurrentRenderingInstance(prevInstance);
  2910. if (renderFnWithContext._d) {
  2911. setBlockTracking(1);
  2912. }
  2913. }
  2914. {
  2915. devtoolsComponentUpdated(ctx);
  2916. }
  2917. return res;
  2918. };
  2919. renderFnWithContext._n = true;
  2920. renderFnWithContext._c = true;
  2921. renderFnWithContext._d = true;
  2922. return renderFnWithContext;
  2923. }
  2924. function validateDirectiveName(name) {
  2925. if (isBuiltInDirective(name)) {
  2926. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2927. }
  2928. }
  2929. function withDirectives(vnode, directives) {
  2930. if (currentRenderingInstance === null) {
  2931. warn$1(`withDirectives can only be used inside render functions.`);
  2932. return vnode;
  2933. }
  2934. const instance = getComponentPublicInstance(currentRenderingInstance);
  2935. const bindings = vnode.dirs || (vnode.dirs = []);
  2936. for (let i = 0; i < directives.length; i++) {
  2937. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2938. if (dir) {
  2939. if (isFunction(dir)) {
  2940. dir = {
  2941. mounted: dir,
  2942. updated: dir
  2943. };
  2944. }
  2945. if (dir.deep) {
  2946. traverse(value);
  2947. }
  2948. bindings.push({
  2949. dir,
  2950. instance,
  2951. value,
  2952. oldValue: void 0,
  2953. arg,
  2954. modifiers
  2955. });
  2956. }
  2957. }
  2958. return vnode;
  2959. }
  2960. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2961. const bindings = vnode.dirs;
  2962. const oldBindings = prevVNode && prevVNode.dirs;
  2963. for (let i = 0; i < bindings.length; i++) {
  2964. const binding = bindings[i];
  2965. if (oldBindings) {
  2966. binding.oldValue = oldBindings[i].value;
  2967. }
  2968. let hook = binding.dir[name];
  2969. if (hook) {
  2970. pauseTracking();
  2971. callWithAsyncErrorHandling(hook, instance, 8, [
  2972. vnode.el,
  2973. binding,
  2974. vnode,
  2975. prevVNode
  2976. ]);
  2977. resetTracking();
  2978. }
  2979. }
  2980. }
  2981. const TeleportEndKey = Symbol("_vte");
  2982. const isTeleport = (type) => type.__isTeleport;
  2983. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  2984. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  2985. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  2986. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  2987. const resolveTarget = (props, select) => {
  2988. const targetSelector = props && props.to;
  2989. if (isString(targetSelector)) {
  2990. if (!select) {
  2991. warn$1(
  2992. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  2993. );
  2994. return null;
  2995. } else {
  2996. const target = select(targetSelector);
  2997. if (!target && !isTeleportDisabled(props)) {
  2998. warn$1(
  2999. `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
  3000. );
  3001. }
  3002. return target;
  3003. }
  3004. } else {
  3005. if (!targetSelector && !isTeleportDisabled(props)) {
  3006. warn$1(`Invalid Teleport target: ${targetSelector}`);
  3007. }
  3008. return targetSelector;
  3009. }
  3010. };
  3011. const TeleportImpl = {
  3012. name: "Teleport",
  3013. __isTeleport: true,
  3014. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  3015. const {
  3016. mc: mountChildren,
  3017. pc: patchChildren,
  3018. pbc: patchBlockChildren,
  3019. o: { insert, querySelector, createText, createComment }
  3020. } = internals;
  3021. const disabled = isTeleportDisabled(n2.props);
  3022. let { shapeFlag, children, dynamicChildren } = n2;
  3023. if (isHmrUpdating) {
  3024. optimized = false;
  3025. dynamicChildren = null;
  3026. }
  3027. if (n1 == null) {
  3028. const placeholder = n2.el = createComment("teleport start") ;
  3029. const mainAnchor = n2.anchor = createComment("teleport end") ;
  3030. insert(placeholder, container, anchor);
  3031. insert(mainAnchor, container, anchor);
  3032. const mount = (container2, anchor2) => {
  3033. if (shapeFlag & 16) {
  3034. if (parentComponent && parentComponent.isCE) {
  3035. parentComponent.ce._teleportTarget = container2;
  3036. }
  3037. mountChildren(
  3038. children,
  3039. container2,
  3040. anchor2,
  3041. parentComponent,
  3042. parentSuspense,
  3043. namespace,
  3044. slotScopeIds,
  3045. optimized
  3046. );
  3047. }
  3048. };
  3049. const mountToTarget = () => {
  3050. const target = n2.target = resolveTarget(n2.props, querySelector);
  3051. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  3052. if (target) {
  3053. if (namespace !== "svg" && isTargetSVG(target)) {
  3054. namespace = "svg";
  3055. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3056. namespace = "mathml";
  3057. }
  3058. if (!disabled) {
  3059. mount(target, targetAnchor);
  3060. updateCssVars(n2, false);
  3061. }
  3062. } else if (!disabled) {
  3063. warn$1(
  3064. "Invalid Teleport target on mount:",
  3065. target,
  3066. `(${typeof target})`
  3067. );
  3068. }
  3069. };
  3070. if (disabled) {
  3071. mount(container, mainAnchor);
  3072. updateCssVars(n2, true);
  3073. }
  3074. if (isTeleportDeferred(n2.props)) {
  3075. n2.el.__isMounted = false;
  3076. queuePostRenderEffect(() => {
  3077. mountToTarget();
  3078. delete n2.el.__isMounted;
  3079. }, parentSuspense);
  3080. } else {
  3081. mountToTarget();
  3082. }
  3083. } else {
  3084. if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
  3085. queuePostRenderEffect(() => {
  3086. TeleportImpl.process(
  3087. n1,
  3088. n2,
  3089. container,
  3090. anchor,
  3091. parentComponent,
  3092. parentSuspense,
  3093. namespace,
  3094. slotScopeIds,
  3095. optimized,
  3096. internals
  3097. );
  3098. }, parentSuspense);
  3099. return;
  3100. }
  3101. n2.el = n1.el;
  3102. n2.targetStart = n1.targetStart;
  3103. const mainAnchor = n2.anchor = n1.anchor;
  3104. const target = n2.target = n1.target;
  3105. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3106. const wasDisabled = isTeleportDisabled(n1.props);
  3107. const currentContainer = wasDisabled ? container : target;
  3108. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3109. if (namespace === "svg" || isTargetSVG(target)) {
  3110. namespace = "svg";
  3111. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3112. namespace = "mathml";
  3113. }
  3114. if (dynamicChildren) {
  3115. patchBlockChildren(
  3116. n1.dynamicChildren,
  3117. dynamicChildren,
  3118. currentContainer,
  3119. parentComponent,
  3120. parentSuspense,
  3121. namespace,
  3122. slotScopeIds
  3123. );
  3124. traverseStaticChildren(n1, n2, false);
  3125. } else if (!optimized) {
  3126. patchChildren(
  3127. n1,
  3128. n2,
  3129. currentContainer,
  3130. currentAnchor,
  3131. parentComponent,
  3132. parentSuspense,
  3133. namespace,
  3134. slotScopeIds,
  3135. false
  3136. );
  3137. }
  3138. if (disabled) {
  3139. if (!wasDisabled) {
  3140. moveTeleport(
  3141. n2,
  3142. container,
  3143. mainAnchor,
  3144. internals,
  3145. 1
  3146. );
  3147. } else {
  3148. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3149. n2.props.to = n1.props.to;
  3150. }
  3151. }
  3152. } else {
  3153. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3154. const nextTarget = n2.target = resolveTarget(
  3155. n2.props,
  3156. querySelector
  3157. );
  3158. if (nextTarget) {
  3159. moveTeleport(
  3160. n2,
  3161. nextTarget,
  3162. null,
  3163. internals,
  3164. 0
  3165. );
  3166. } else {
  3167. warn$1(
  3168. "Invalid Teleport target on update:",
  3169. target,
  3170. `(${typeof target})`
  3171. );
  3172. }
  3173. } else if (wasDisabled) {
  3174. moveTeleport(
  3175. n2,
  3176. target,
  3177. targetAnchor,
  3178. internals,
  3179. 1
  3180. );
  3181. }
  3182. }
  3183. updateCssVars(n2, disabled);
  3184. }
  3185. },
  3186. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3187. const {
  3188. shapeFlag,
  3189. children,
  3190. anchor,
  3191. targetStart,
  3192. targetAnchor,
  3193. target,
  3194. props
  3195. } = vnode;
  3196. if (target) {
  3197. hostRemove(targetStart);
  3198. hostRemove(targetAnchor);
  3199. }
  3200. doRemove && hostRemove(anchor);
  3201. if (shapeFlag & 16) {
  3202. const shouldRemove = doRemove || !isTeleportDisabled(props);
  3203. for (let i = 0; i < children.length; i++) {
  3204. const child = children[i];
  3205. unmount(
  3206. child,
  3207. parentComponent,
  3208. parentSuspense,
  3209. shouldRemove,
  3210. !!child.dynamicChildren
  3211. );
  3212. }
  3213. }
  3214. },
  3215. move: moveTeleport,
  3216. hydrate: hydrateTeleport
  3217. };
  3218. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3219. if (moveType === 0) {
  3220. insert(vnode.targetAnchor, container, parentAnchor);
  3221. }
  3222. const { el, anchor, shapeFlag, children, props } = vnode;
  3223. const isReorder = moveType === 2;
  3224. if (isReorder) {
  3225. insert(el, container, parentAnchor);
  3226. }
  3227. if (!isReorder || isTeleportDisabled(props)) {
  3228. if (shapeFlag & 16) {
  3229. for (let i = 0; i < children.length; i++) {
  3230. move(
  3231. children[i],
  3232. container,
  3233. parentAnchor,
  3234. 2
  3235. );
  3236. }
  3237. }
  3238. }
  3239. if (isReorder) {
  3240. insert(anchor, container, parentAnchor);
  3241. }
  3242. }
  3243. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3244. o: { nextSibling, parentNode, querySelector, insert, createText }
  3245. }, hydrateChildren) {
  3246. const target = vnode.target = resolveTarget(
  3247. vnode.props,
  3248. querySelector
  3249. );
  3250. if (target) {
  3251. const disabled = isTeleportDisabled(vnode.props);
  3252. const targetNode = target._lpa || target.firstChild;
  3253. if (vnode.shapeFlag & 16) {
  3254. if (disabled) {
  3255. vnode.anchor = hydrateChildren(
  3256. nextSibling(node),
  3257. vnode,
  3258. parentNode(node),
  3259. parentComponent,
  3260. parentSuspense,
  3261. slotScopeIds,
  3262. optimized
  3263. );
  3264. vnode.targetStart = targetNode;
  3265. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  3266. } else {
  3267. vnode.anchor = nextSibling(node);
  3268. let targetAnchor = targetNode;
  3269. while (targetAnchor) {
  3270. if (targetAnchor && targetAnchor.nodeType === 8) {
  3271. if (targetAnchor.data === "teleport start anchor") {
  3272. vnode.targetStart = targetAnchor;
  3273. } else if (targetAnchor.data === "teleport anchor") {
  3274. vnode.targetAnchor = targetAnchor;
  3275. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3276. break;
  3277. }
  3278. }
  3279. targetAnchor = nextSibling(targetAnchor);
  3280. }
  3281. if (!vnode.targetAnchor) {
  3282. prepareAnchor(target, vnode, createText, insert);
  3283. }
  3284. hydrateChildren(
  3285. targetNode && nextSibling(targetNode),
  3286. vnode,
  3287. target,
  3288. parentComponent,
  3289. parentSuspense,
  3290. slotScopeIds,
  3291. optimized
  3292. );
  3293. }
  3294. }
  3295. updateCssVars(vnode, disabled);
  3296. }
  3297. return vnode.anchor && nextSibling(vnode.anchor);
  3298. }
  3299. const Teleport = TeleportImpl;
  3300. function updateCssVars(vnode, isDisabled) {
  3301. const ctx = vnode.ctx;
  3302. if (ctx && ctx.ut) {
  3303. let node, anchor;
  3304. if (isDisabled) {
  3305. node = vnode.el;
  3306. anchor = vnode.anchor;
  3307. } else {
  3308. node = vnode.targetStart;
  3309. anchor = vnode.targetAnchor;
  3310. }
  3311. while (node && node !== anchor) {
  3312. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3313. node = node.nextSibling;
  3314. }
  3315. ctx.ut();
  3316. }
  3317. }
  3318. function prepareAnchor(target, vnode, createText, insert) {
  3319. const targetStart = vnode.targetStart = createText("");
  3320. const targetAnchor = vnode.targetAnchor = createText("");
  3321. targetStart[TeleportEndKey] = targetAnchor;
  3322. if (target) {
  3323. insert(targetStart, target);
  3324. insert(targetAnchor, target);
  3325. }
  3326. return targetAnchor;
  3327. }
  3328. const leaveCbKey = Symbol("_leaveCb");
  3329. const enterCbKey$1 = Symbol("_enterCb");
  3330. function useTransitionState() {
  3331. const state = {
  3332. isMounted: false,
  3333. isLeaving: false,
  3334. isUnmounting: false,
  3335. leavingVNodes: /* @__PURE__ */ new Map()
  3336. };
  3337. onMounted(() => {
  3338. state.isMounted = true;
  3339. });
  3340. onBeforeUnmount(() => {
  3341. state.isUnmounting = true;
  3342. });
  3343. return state;
  3344. }
  3345. const TransitionHookValidator = [Function, Array];
  3346. const BaseTransitionPropsValidators = {
  3347. mode: String,
  3348. appear: Boolean,
  3349. persisted: Boolean,
  3350. // enter
  3351. onBeforeEnter: TransitionHookValidator,
  3352. onEnter: TransitionHookValidator,
  3353. onAfterEnter: TransitionHookValidator,
  3354. onEnterCancelled: TransitionHookValidator,
  3355. // leave
  3356. onBeforeLeave: TransitionHookValidator,
  3357. onLeave: TransitionHookValidator,
  3358. onAfterLeave: TransitionHookValidator,
  3359. onLeaveCancelled: TransitionHookValidator,
  3360. // appear
  3361. onBeforeAppear: TransitionHookValidator,
  3362. onAppear: TransitionHookValidator,
  3363. onAfterAppear: TransitionHookValidator,
  3364. onAppearCancelled: TransitionHookValidator
  3365. };
  3366. const recursiveGetSubtree = (instance) => {
  3367. const subTree = instance.subTree;
  3368. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3369. };
  3370. const BaseTransitionImpl = {
  3371. name: `BaseTransition`,
  3372. props: BaseTransitionPropsValidators,
  3373. setup(props, { slots }) {
  3374. const instance = getCurrentInstance();
  3375. const state = useTransitionState();
  3376. return () => {
  3377. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3378. if (!children || !children.length) {
  3379. return;
  3380. }
  3381. const child = findNonCommentChild(children);
  3382. const rawProps = toRaw(props);
  3383. const { mode } = rawProps;
  3384. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3385. warn$1(`invalid <transition> mode: ${mode}`);
  3386. }
  3387. if (state.isLeaving) {
  3388. return emptyPlaceholder(child);
  3389. }
  3390. const innerChild = getInnerChild$1(child);
  3391. if (!innerChild) {
  3392. return emptyPlaceholder(child);
  3393. }
  3394. let enterHooks = resolveTransitionHooks(
  3395. innerChild,
  3396. rawProps,
  3397. state,
  3398. instance,
  3399. // #11061, ensure enterHooks is fresh after clone
  3400. (hooks) => enterHooks = hooks
  3401. );
  3402. if (innerChild.type !== Comment) {
  3403. setTransitionHooks(innerChild, enterHooks);
  3404. }
  3405. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3406. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3407. let leavingHooks = resolveTransitionHooks(
  3408. oldInnerChild,
  3409. rawProps,
  3410. state,
  3411. instance
  3412. );
  3413. setTransitionHooks(oldInnerChild, leavingHooks);
  3414. if (mode === "out-in" && innerChild.type !== Comment) {
  3415. state.isLeaving = true;
  3416. leavingHooks.afterLeave = () => {
  3417. state.isLeaving = false;
  3418. if (!(instance.job.flags & 8)) {
  3419. instance.update();
  3420. }
  3421. delete leavingHooks.afterLeave;
  3422. oldInnerChild = void 0;
  3423. };
  3424. return emptyPlaceholder(child);
  3425. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3426. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3427. const leavingVNodesCache = getLeavingNodesForType(
  3428. state,
  3429. oldInnerChild
  3430. );
  3431. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3432. el[leaveCbKey] = () => {
  3433. earlyRemove();
  3434. el[leaveCbKey] = void 0;
  3435. delete enterHooks.delayedLeave;
  3436. oldInnerChild = void 0;
  3437. };
  3438. enterHooks.delayedLeave = () => {
  3439. delayedLeave();
  3440. delete enterHooks.delayedLeave;
  3441. oldInnerChild = void 0;
  3442. };
  3443. };
  3444. } else {
  3445. oldInnerChild = void 0;
  3446. }
  3447. } else if (oldInnerChild) {
  3448. oldInnerChild = void 0;
  3449. }
  3450. return child;
  3451. };
  3452. }
  3453. };
  3454. function findNonCommentChild(children) {
  3455. let child = children[0];
  3456. if (children.length > 1) {
  3457. let hasFound = false;
  3458. for (const c of children) {
  3459. if (c.type !== Comment) {
  3460. if (hasFound) {
  3461. warn$1(
  3462. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3463. );
  3464. break;
  3465. }
  3466. child = c;
  3467. hasFound = true;
  3468. }
  3469. }
  3470. }
  3471. return child;
  3472. }
  3473. const BaseTransition = BaseTransitionImpl;
  3474. function getLeavingNodesForType(state, vnode) {
  3475. const { leavingVNodes } = state;
  3476. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3477. if (!leavingVNodesCache) {
  3478. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3479. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3480. }
  3481. return leavingVNodesCache;
  3482. }
  3483. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3484. const {
  3485. appear,
  3486. mode,
  3487. persisted = false,
  3488. onBeforeEnter,
  3489. onEnter,
  3490. onAfterEnter,
  3491. onEnterCancelled,
  3492. onBeforeLeave,
  3493. onLeave,
  3494. onAfterLeave,
  3495. onLeaveCancelled,
  3496. onBeforeAppear,
  3497. onAppear,
  3498. onAfterAppear,
  3499. onAppearCancelled
  3500. } = props;
  3501. const key = String(vnode.key);
  3502. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3503. const callHook = (hook, args) => {
  3504. hook && callWithAsyncErrorHandling(
  3505. hook,
  3506. instance,
  3507. 9,
  3508. args
  3509. );
  3510. };
  3511. const callAsyncHook = (hook, args) => {
  3512. const done = args[1];
  3513. callHook(hook, args);
  3514. if (isArray(hook)) {
  3515. if (hook.every((hook2) => hook2.length <= 1)) done();
  3516. } else if (hook.length <= 1) {
  3517. done();
  3518. }
  3519. };
  3520. const hooks = {
  3521. mode,
  3522. persisted,
  3523. beforeEnter(el) {
  3524. let hook = onBeforeEnter;
  3525. if (!state.isMounted) {
  3526. if (appear) {
  3527. hook = onBeforeAppear || onBeforeEnter;
  3528. } else {
  3529. return;
  3530. }
  3531. }
  3532. if (el[leaveCbKey]) {
  3533. el[leaveCbKey](
  3534. true
  3535. /* cancelled */
  3536. );
  3537. }
  3538. const leavingVNode = leavingVNodesCache[key];
  3539. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3540. leavingVNode.el[leaveCbKey]();
  3541. }
  3542. callHook(hook, [el]);
  3543. },
  3544. enter(el) {
  3545. let hook = onEnter;
  3546. let afterHook = onAfterEnter;
  3547. let cancelHook = onEnterCancelled;
  3548. if (!state.isMounted) {
  3549. if (appear) {
  3550. hook = onAppear || onEnter;
  3551. afterHook = onAfterAppear || onAfterEnter;
  3552. cancelHook = onAppearCancelled || onEnterCancelled;
  3553. } else {
  3554. return;
  3555. }
  3556. }
  3557. let called = false;
  3558. const done = el[enterCbKey$1] = (cancelled) => {
  3559. if (called) return;
  3560. called = true;
  3561. if (cancelled) {
  3562. callHook(cancelHook, [el]);
  3563. } else {
  3564. callHook(afterHook, [el]);
  3565. }
  3566. if (hooks.delayedLeave) {
  3567. hooks.delayedLeave();
  3568. }
  3569. el[enterCbKey$1] = void 0;
  3570. };
  3571. if (hook) {
  3572. callAsyncHook(hook, [el, done]);
  3573. } else {
  3574. done();
  3575. }
  3576. },
  3577. leave(el, remove) {
  3578. const key2 = String(vnode.key);
  3579. if (el[enterCbKey$1]) {
  3580. el[enterCbKey$1](
  3581. true
  3582. /* cancelled */
  3583. );
  3584. }
  3585. if (state.isUnmounting) {
  3586. return remove();
  3587. }
  3588. callHook(onBeforeLeave, [el]);
  3589. let called = false;
  3590. const done = el[leaveCbKey] = (cancelled) => {
  3591. if (called) return;
  3592. called = true;
  3593. remove();
  3594. if (cancelled) {
  3595. callHook(onLeaveCancelled, [el]);
  3596. } else {
  3597. callHook(onAfterLeave, [el]);
  3598. }
  3599. el[leaveCbKey] = void 0;
  3600. if (leavingVNodesCache[key2] === vnode) {
  3601. delete leavingVNodesCache[key2];
  3602. }
  3603. };
  3604. leavingVNodesCache[key2] = vnode;
  3605. if (onLeave) {
  3606. callAsyncHook(onLeave, [el, done]);
  3607. } else {
  3608. done();
  3609. }
  3610. },
  3611. clone(vnode2) {
  3612. const hooks2 = resolveTransitionHooks(
  3613. vnode2,
  3614. props,
  3615. state,
  3616. instance,
  3617. postClone
  3618. );
  3619. if (postClone) postClone(hooks2);
  3620. return hooks2;
  3621. }
  3622. };
  3623. return hooks;
  3624. }
  3625. function emptyPlaceholder(vnode) {
  3626. if (isKeepAlive(vnode)) {
  3627. vnode = cloneVNode(vnode);
  3628. vnode.children = null;
  3629. return vnode;
  3630. }
  3631. }
  3632. function getInnerChild$1(vnode) {
  3633. if (!isKeepAlive(vnode)) {
  3634. if (isTeleport(vnode.type) && vnode.children) {
  3635. return findNonCommentChild(vnode.children);
  3636. }
  3637. return vnode;
  3638. }
  3639. if (vnode.component) {
  3640. return vnode.component.subTree;
  3641. }
  3642. const { shapeFlag, children } = vnode;
  3643. if (children) {
  3644. if (shapeFlag & 16) {
  3645. return children[0];
  3646. }
  3647. if (shapeFlag & 32 && isFunction(children.default)) {
  3648. return children.default();
  3649. }
  3650. }
  3651. }
  3652. function setTransitionHooks(vnode, hooks) {
  3653. if (vnode.shapeFlag & 6 && vnode.component) {
  3654. vnode.transition = hooks;
  3655. setTransitionHooks(vnode.component.subTree, hooks);
  3656. } else if (vnode.shapeFlag & 128) {
  3657. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3658. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3659. } else {
  3660. vnode.transition = hooks;
  3661. }
  3662. }
  3663. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3664. let ret = [];
  3665. let keyedFragmentCount = 0;
  3666. for (let i = 0; i < children.length; i++) {
  3667. let child = children[i];
  3668. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3669. if (child.type === Fragment) {
  3670. if (child.patchFlag & 128) keyedFragmentCount++;
  3671. ret = ret.concat(
  3672. getTransitionRawChildren(child.children, keepComment, key)
  3673. );
  3674. } else if (keepComment || child.type !== Comment) {
  3675. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3676. }
  3677. }
  3678. if (keyedFragmentCount > 1) {
  3679. for (let i = 0; i < ret.length; i++) {
  3680. ret[i].patchFlag = -2;
  3681. }
  3682. }
  3683. return ret;
  3684. }
  3685. /*! #__NO_SIDE_EFFECTS__ */
  3686. // @__NO_SIDE_EFFECTS__
  3687. function defineComponent(options, extraOptions) {
  3688. return isFunction(options) ? (
  3689. // #8236: extend call and options.name access are considered side-effects
  3690. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3691. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3692. ) : options;
  3693. }
  3694. function useId() {
  3695. const i = getCurrentInstance();
  3696. if (i) {
  3697. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3698. } else {
  3699. warn$1(
  3700. `useId() is called when there is no active component instance to be associated with.`
  3701. );
  3702. }
  3703. return "";
  3704. }
  3705. function markAsyncBoundary(instance) {
  3706. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3707. }
  3708. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3709. function useTemplateRef(key) {
  3710. const i = getCurrentInstance();
  3711. const r = shallowRef(null);
  3712. if (i) {
  3713. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3714. let desc;
  3715. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  3716. warn$1(`useTemplateRef('${key}') already exists.`);
  3717. } else {
  3718. Object.defineProperty(refs, key, {
  3719. enumerable: true,
  3720. get: () => r.value,
  3721. set: (val) => r.value = val
  3722. });
  3723. }
  3724. } else {
  3725. warn$1(
  3726. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3727. );
  3728. }
  3729. const ret = readonly(r) ;
  3730. {
  3731. knownTemplateRefs.add(ret);
  3732. }
  3733. return ret;
  3734. }
  3735. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3736. if (isArray(rawRef)) {
  3737. rawRef.forEach(
  3738. (r, i) => setRef(
  3739. r,
  3740. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3741. parentSuspense,
  3742. vnode,
  3743. isUnmount
  3744. )
  3745. );
  3746. return;
  3747. }
  3748. if (isAsyncWrapper(vnode) && !isUnmount) {
  3749. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  3750. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  3751. }
  3752. return;
  3753. }
  3754. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3755. const value = isUnmount ? null : refValue;
  3756. const { i: owner, r: ref } = rawRef;
  3757. if (!owner) {
  3758. warn$1(
  3759. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3760. );
  3761. return;
  3762. }
  3763. const oldRef = oldRawRef && oldRawRef.r;
  3764. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3765. const setupState = owner.setupState;
  3766. const rawSetupState = toRaw(setupState);
  3767. const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
  3768. {
  3769. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3770. warn$1(
  3771. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3772. );
  3773. }
  3774. if (knownTemplateRefs.has(rawSetupState[key])) {
  3775. return false;
  3776. }
  3777. }
  3778. return hasOwn(rawSetupState, key);
  3779. };
  3780. const canSetRef = (ref2) => {
  3781. return !knownTemplateRefs.has(ref2);
  3782. };
  3783. if (oldRef != null && oldRef !== ref) {
  3784. if (isString(oldRef)) {
  3785. refs[oldRef] = null;
  3786. if (canSetSetupRef(oldRef)) {
  3787. setupState[oldRef] = null;
  3788. }
  3789. } else if (isRef(oldRef)) {
  3790. if (canSetRef(oldRef)) {
  3791. oldRef.value = null;
  3792. }
  3793. const oldRawRefAtom = oldRawRef;
  3794. if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
  3795. }
  3796. }
  3797. if (isFunction(ref)) {
  3798. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3799. } else {
  3800. const _isString = isString(ref);
  3801. const _isRef = isRef(ref);
  3802. if (_isString || _isRef) {
  3803. const doSet = () => {
  3804. if (rawRef.f) {
  3805. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
  3806. if (isUnmount) {
  3807. isArray(existing) && remove(existing, refValue);
  3808. } else {
  3809. if (!isArray(existing)) {
  3810. if (_isString) {
  3811. refs[ref] = [refValue];
  3812. if (canSetSetupRef(ref)) {
  3813. setupState[ref] = refs[ref];
  3814. }
  3815. } else {
  3816. const newVal = [refValue];
  3817. if (canSetRef(ref)) {
  3818. ref.value = newVal;
  3819. }
  3820. if (rawRef.k) refs[rawRef.k] = newVal;
  3821. }
  3822. } else if (!existing.includes(refValue)) {
  3823. existing.push(refValue);
  3824. }
  3825. }
  3826. } else if (_isString) {
  3827. refs[ref] = value;
  3828. if (canSetSetupRef(ref)) {
  3829. setupState[ref] = value;
  3830. }
  3831. } else if (_isRef) {
  3832. if (canSetRef(ref)) {
  3833. ref.value = value;
  3834. }
  3835. if (rawRef.k) refs[rawRef.k] = value;
  3836. } else {
  3837. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3838. }
  3839. };
  3840. if (value) {
  3841. doSet.id = -1;
  3842. queuePostRenderEffect(doSet, parentSuspense);
  3843. } else {
  3844. doSet();
  3845. }
  3846. } else {
  3847. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3848. }
  3849. }
  3850. }
  3851. let hasLoggedMismatchError = false;
  3852. const logMismatchError = () => {
  3853. if (hasLoggedMismatchError) {
  3854. return;
  3855. }
  3856. console.error("Hydration completed but contains mismatches.");
  3857. hasLoggedMismatchError = true;
  3858. };
  3859. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  3860. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  3861. const getContainerType = (container) => {
  3862. if (container.nodeType !== 1) return void 0;
  3863. if (isSVGContainer(container)) return "svg";
  3864. if (isMathMLContainer(container)) return "mathml";
  3865. return void 0;
  3866. };
  3867. const isComment = (node) => node.nodeType === 8;
  3868. function createHydrationFunctions(rendererInternals) {
  3869. const {
  3870. mt: mountComponent,
  3871. p: patch,
  3872. o: {
  3873. patchProp,
  3874. createText,
  3875. nextSibling,
  3876. parentNode,
  3877. remove,
  3878. insert,
  3879. createComment
  3880. }
  3881. } = rendererInternals;
  3882. const hydrate = (vnode, container) => {
  3883. if (!container.hasChildNodes()) {
  3884. warn$1(
  3885. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  3886. );
  3887. patch(null, vnode, container);
  3888. flushPostFlushCbs();
  3889. container._vnode = vnode;
  3890. return;
  3891. }
  3892. hydrateNode(container.firstChild, vnode, null, null, null);
  3893. flushPostFlushCbs();
  3894. container._vnode = vnode;
  3895. };
  3896. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3897. optimized = optimized || !!vnode.dynamicChildren;
  3898. const isFragmentStart = isComment(node) && node.data === "[";
  3899. const onMismatch = () => handleMismatch(
  3900. node,
  3901. vnode,
  3902. parentComponent,
  3903. parentSuspense,
  3904. slotScopeIds,
  3905. isFragmentStart
  3906. );
  3907. const { type, ref, shapeFlag, patchFlag } = vnode;
  3908. let domType = node.nodeType;
  3909. vnode.el = node;
  3910. {
  3911. def(node, "__vnode", vnode, true);
  3912. def(node, "__vueParentComponent", parentComponent, true);
  3913. }
  3914. if (patchFlag === -2) {
  3915. optimized = false;
  3916. vnode.dynamicChildren = null;
  3917. }
  3918. let nextNode = null;
  3919. switch (type) {
  3920. case Text:
  3921. if (domType !== 3) {
  3922. if (vnode.children === "") {
  3923. insert(vnode.el = createText(""), parentNode(node), node);
  3924. nextNode = node;
  3925. } else {
  3926. nextNode = onMismatch();
  3927. }
  3928. } else {
  3929. if (node.data !== vnode.children) {
  3930. warn$1(
  3931. `Hydration text mismatch in`,
  3932. node.parentNode,
  3933. `
  3934. - rendered on server: ${JSON.stringify(
  3935. node.data
  3936. )}
  3937. - expected on client: ${JSON.stringify(vnode.children)}`
  3938. );
  3939. logMismatchError();
  3940. node.data = vnode.children;
  3941. }
  3942. nextNode = nextSibling(node);
  3943. }
  3944. break;
  3945. case Comment:
  3946. if (isTemplateNode(node)) {
  3947. nextNode = nextSibling(node);
  3948. replaceNode(
  3949. vnode.el = node.content.firstChild,
  3950. node,
  3951. parentComponent
  3952. );
  3953. } else if (domType !== 8 || isFragmentStart) {
  3954. nextNode = onMismatch();
  3955. } else {
  3956. nextNode = nextSibling(node);
  3957. }
  3958. break;
  3959. case Static:
  3960. if (isFragmentStart) {
  3961. node = nextSibling(node);
  3962. domType = node.nodeType;
  3963. }
  3964. if (domType === 1 || domType === 3) {
  3965. nextNode = node;
  3966. const needToAdoptContent = !vnode.children.length;
  3967. for (let i = 0; i < vnode.staticCount; i++) {
  3968. if (needToAdoptContent)
  3969. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  3970. if (i === vnode.staticCount - 1) {
  3971. vnode.anchor = nextNode;
  3972. }
  3973. nextNode = nextSibling(nextNode);
  3974. }
  3975. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3976. } else {
  3977. onMismatch();
  3978. }
  3979. break;
  3980. case Fragment:
  3981. if (!isFragmentStart) {
  3982. nextNode = onMismatch();
  3983. } else {
  3984. nextNode = hydrateFragment(
  3985. node,
  3986. vnode,
  3987. parentComponent,
  3988. parentSuspense,
  3989. slotScopeIds,
  3990. optimized
  3991. );
  3992. }
  3993. break;
  3994. default:
  3995. if (shapeFlag & 1) {
  3996. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  3997. nextNode = onMismatch();
  3998. } else {
  3999. nextNode = hydrateElement(
  4000. node,
  4001. vnode,
  4002. parentComponent,
  4003. parentSuspense,
  4004. slotScopeIds,
  4005. optimized
  4006. );
  4007. }
  4008. } else if (shapeFlag & 6) {
  4009. vnode.slotScopeIds = slotScopeIds;
  4010. const container = parentNode(node);
  4011. if (isFragmentStart) {
  4012. nextNode = locateClosingAnchor(node);
  4013. } else if (isComment(node) && node.data === "teleport start") {
  4014. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  4015. } else {
  4016. nextNode = nextSibling(node);
  4017. }
  4018. mountComponent(
  4019. vnode,
  4020. container,
  4021. null,
  4022. parentComponent,
  4023. parentSuspense,
  4024. getContainerType(container),
  4025. optimized
  4026. );
  4027. if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
  4028. let subTree;
  4029. if (isFragmentStart) {
  4030. subTree = createVNode(Fragment);
  4031. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4032. } else {
  4033. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  4034. }
  4035. subTree.el = node;
  4036. vnode.component.subTree = subTree;
  4037. }
  4038. } else if (shapeFlag & 64) {
  4039. if (domType !== 8) {
  4040. nextNode = onMismatch();
  4041. } else {
  4042. nextNode = vnode.type.hydrate(
  4043. node,
  4044. vnode,
  4045. parentComponent,
  4046. parentSuspense,
  4047. slotScopeIds,
  4048. optimized,
  4049. rendererInternals,
  4050. hydrateChildren
  4051. );
  4052. }
  4053. } else if (shapeFlag & 128) {
  4054. nextNode = vnode.type.hydrate(
  4055. node,
  4056. vnode,
  4057. parentComponent,
  4058. parentSuspense,
  4059. getContainerType(parentNode(node)),
  4060. slotScopeIds,
  4061. optimized,
  4062. rendererInternals,
  4063. hydrateNode
  4064. );
  4065. } else {
  4066. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4067. }
  4068. }
  4069. if (ref != null) {
  4070. setRef(ref, null, parentSuspense, vnode);
  4071. }
  4072. return nextNode;
  4073. };
  4074. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4075. optimized = optimized || !!vnode.dynamicChildren;
  4076. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  4077. const forcePatch = type === "input" || type === "option";
  4078. {
  4079. if (dirs) {
  4080. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4081. }
  4082. let needCallTransitionHooks = false;
  4083. if (isTemplateNode(el)) {
  4084. needCallTransitionHooks = needTransition(
  4085. null,
  4086. // no need check parentSuspense in hydration
  4087. transition
  4088. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4089. const content = el.content.firstChild;
  4090. if (needCallTransitionHooks) {
  4091. const cls = content.getAttribute("class");
  4092. if (cls) content.$cls = cls;
  4093. transition.beforeEnter(content);
  4094. }
  4095. replaceNode(content, el, parentComponent);
  4096. vnode.el = el = content;
  4097. }
  4098. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4099. !(props && (props.innerHTML || props.textContent))) {
  4100. let next = hydrateChildren(
  4101. el.firstChild,
  4102. vnode,
  4103. el,
  4104. parentComponent,
  4105. parentSuspense,
  4106. slotScopeIds,
  4107. optimized
  4108. );
  4109. let hasWarned = false;
  4110. while (next) {
  4111. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4112. if (!hasWarned) {
  4113. warn$1(
  4114. `Hydration children mismatch on`,
  4115. el,
  4116. `
  4117. Server rendered element contains more child nodes than client vdom.`
  4118. );
  4119. hasWarned = true;
  4120. }
  4121. logMismatchError();
  4122. }
  4123. const cur = next;
  4124. next = next.nextSibling;
  4125. remove(cur);
  4126. }
  4127. } else if (shapeFlag & 8) {
  4128. let clientText = vnode.children;
  4129. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4130. clientText = clientText.slice(1);
  4131. }
  4132. if (el.textContent !== clientText) {
  4133. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4134. warn$1(
  4135. `Hydration text content mismatch on`,
  4136. el,
  4137. `
  4138. - rendered on server: ${el.textContent}
  4139. - expected on client: ${vnode.children}`
  4140. );
  4141. logMismatchError();
  4142. }
  4143. el.textContent = vnode.children;
  4144. }
  4145. }
  4146. if (props) {
  4147. {
  4148. const isCustomElement = el.tagName.includes("-");
  4149. for (const key in props) {
  4150. if (// #11189 skip if this node has directives that have created hooks
  4151. // as it could have mutated the DOM in any possible way
  4152. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4153. logMismatchError();
  4154. }
  4155. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4156. key[0] === "." || isCustomElement) {
  4157. patchProp(el, key, null, props[key], void 0, parentComponent);
  4158. }
  4159. }
  4160. }
  4161. }
  4162. let vnodeHooks;
  4163. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4164. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4165. }
  4166. if (dirs) {
  4167. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4168. }
  4169. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4170. queueEffectWithSuspense(() => {
  4171. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4172. needCallTransitionHooks && transition.enter(el);
  4173. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4174. }, parentSuspense);
  4175. }
  4176. }
  4177. return el.nextSibling;
  4178. };
  4179. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4180. optimized = optimized || !!parentVNode.dynamicChildren;
  4181. const children = parentVNode.children;
  4182. const l = children.length;
  4183. let hasWarned = false;
  4184. for (let i = 0; i < l; i++) {
  4185. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4186. const isText = vnode.type === Text;
  4187. if (node) {
  4188. if (isText && !optimized) {
  4189. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4190. insert(
  4191. createText(
  4192. node.data.slice(vnode.children.length)
  4193. ),
  4194. container,
  4195. nextSibling(node)
  4196. );
  4197. node.data = vnode.children;
  4198. }
  4199. }
  4200. node = hydrateNode(
  4201. node,
  4202. vnode,
  4203. parentComponent,
  4204. parentSuspense,
  4205. slotScopeIds,
  4206. optimized
  4207. );
  4208. } else if (isText && !vnode.children) {
  4209. insert(vnode.el = createText(""), container);
  4210. } else {
  4211. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4212. if (!hasWarned) {
  4213. warn$1(
  4214. `Hydration children mismatch on`,
  4215. container,
  4216. `
  4217. Server rendered element contains fewer child nodes than client vdom.`
  4218. );
  4219. hasWarned = true;
  4220. }
  4221. logMismatchError();
  4222. }
  4223. patch(
  4224. null,
  4225. vnode,
  4226. container,
  4227. null,
  4228. parentComponent,
  4229. parentSuspense,
  4230. getContainerType(container),
  4231. slotScopeIds
  4232. );
  4233. }
  4234. }
  4235. return node;
  4236. };
  4237. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4238. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4239. if (fragmentSlotScopeIds) {
  4240. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4241. }
  4242. const container = parentNode(node);
  4243. const next = hydrateChildren(
  4244. nextSibling(node),
  4245. vnode,
  4246. container,
  4247. parentComponent,
  4248. parentSuspense,
  4249. slotScopeIds,
  4250. optimized
  4251. );
  4252. if (next && isComment(next) && next.data === "]") {
  4253. return nextSibling(vnode.anchor = next);
  4254. } else {
  4255. logMismatchError();
  4256. insert(vnode.anchor = createComment(`]`), container, next);
  4257. return next;
  4258. }
  4259. };
  4260. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4261. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4262. warn$1(
  4263. `Hydration node mismatch:
  4264. - rendered on server:`,
  4265. node,
  4266. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4267. `
  4268. - expected on client:`,
  4269. vnode.type
  4270. );
  4271. logMismatchError();
  4272. }
  4273. vnode.el = null;
  4274. if (isFragment) {
  4275. const end = locateClosingAnchor(node);
  4276. while (true) {
  4277. const next2 = nextSibling(node);
  4278. if (next2 && next2 !== end) {
  4279. remove(next2);
  4280. } else {
  4281. break;
  4282. }
  4283. }
  4284. }
  4285. const next = nextSibling(node);
  4286. const container = parentNode(node);
  4287. remove(node);
  4288. patch(
  4289. null,
  4290. vnode,
  4291. container,
  4292. next,
  4293. parentComponent,
  4294. parentSuspense,
  4295. getContainerType(container),
  4296. slotScopeIds
  4297. );
  4298. if (parentComponent) {
  4299. parentComponent.vnode.el = vnode.el;
  4300. updateHOCHostEl(parentComponent, vnode.el);
  4301. }
  4302. return next;
  4303. };
  4304. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4305. let match = 0;
  4306. while (node) {
  4307. node = nextSibling(node);
  4308. if (node && isComment(node)) {
  4309. if (node.data === open) match++;
  4310. if (node.data === close) {
  4311. if (match === 0) {
  4312. return nextSibling(node);
  4313. } else {
  4314. match--;
  4315. }
  4316. }
  4317. }
  4318. }
  4319. return node;
  4320. };
  4321. const replaceNode = (newNode, oldNode, parentComponent) => {
  4322. const parentNode2 = oldNode.parentNode;
  4323. if (parentNode2) {
  4324. parentNode2.replaceChild(newNode, oldNode);
  4325. }
  4326. let parent = parentComponent;
  4327. while (parent) {
  4328. if (parent.vnode.el === oldNode) {
  4329. parent.vnode.el = parent.subTree.el = newNode;
  4330. }
  4331. parent = parent.parent;
  4332. }
  4333. };
  4334. const isTemplateNode = (node) => {
  4335. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4336. };
  4337. return [hydrate, hydrateNode];
  4338. }
  4339. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4340. let mismatchType;
  4341. let mismatchKey;
  4342. let actual;
  4343. let expected;
  4344. if (key === "class") {
  4345. if (el.$cls) {
  4346. actual = el.$cls;
  4347. delete el.$cls;
  4348. } else {
  4349. actual = el.getAttribute("class");
  4350. }
  4351. expected = normalizeClass(clientValue);
  4352. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4353. mismatchType = 2 /* CLASS */;
  4354. mismatchKey = `class`;
  4355. }
  4356. } else if (key === "style") {
  4357. actual = el.getAttribute("style") || "";
  4358. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4359. const actualMap = toStyleMap(actual);
  4360. const expectedMap = toStyleMap(expected);
  4361. if (vnode.dirs) {
  4362. for (const { dir, value } of vnode.dirs) {
  4363. if (dir.name === "show" && !value) {
  4364. expectedMap.set("display", "none");
  4365. }
  4366. }
  4367. }
  4368. if (instance) {
  4369. resolveCssVars(instance, vnode, expectedMap);
  4370. }
  4371. if (!isMapEqual(actualMap, expectedMap)) {
  4372. mismatchType = 3 /* STYLE */;
  4373. mismatchKey = "style";
  4374. }
  4375. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4376. if (isBooleanAttr(key)) {
  4377. actual = el.hasAttribute(key);
  4378. expected = includeBooleanAttr(clientValue);
  4379. } else if (clientValue == null) {
  4380. actual = el.hasAttribute(key);
  4381. expected = false;
  4382. } else {
  4383. if (el.hasAttribute(key)) {
  4384. actual = el.getAttribute(key);
  4385. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4386. actual = el.value;
  4387. } else {
  4388. actual = false;
  4389. }
  4390. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4391. }
  4392. if (actual !== expected) {
  4393. mismatchType = 4 /* ATTRIBUTE */;
  4394. mismatchKey = key;
  4395. }
  4396. }
  4397. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4398. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4399. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4400. const postSegment = `
  4401. - rendered on server: ${format(actual)}
  4402. - expected on client: ${format(expected)}
  4403. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4404. You should fix the source of the mismatch.`;
  4405. {
  4406. warn$1(preSegment, el, postSegment);
  4407. }
  4408. return true;
  4409. }
  4410. return false;
  4411. }
  4412. function toClassSet(str) {
  4413. return new Set(str.trim().split(/\s+/));
  4414. }
  4415. function isSetEqual(a, b) {
  4416. if (a.size !== b.size) {
  4417. return false;
  4418. }
  4419. for (const s of a) {
  4420. if (!b.has(s)) {
  4421. return false;
  4422. }
  4423. }
  4424. return true;
  4425. }
  4426. function toStyleMap(str) {
  4427. const styleMap = /* @__PURE__ */ new Map();
  4428. for (const item of str.split(";")) {
  4429. let [key, value] = item.split(":");
  4430. key = key.trim();
  4431. value = value && value.trim();
  4432. if (key && value) {
  4433. styleMap.set(key, value);
  4434. }
  4435. }
  4436. return styleMap;
  4437. }
  4438. function isMapEqual(a, b) {
  4439. if (a.size !== b.size) {
  4440. return false;
  4441. }
  4442. for (const [key, value] of a) {
  4443. if (value !== b.get(key)) {
  4444. return false;
  4445. }
  4446. }
  4447. return true;
  4448. }
  4449. function resolveCssVars(instance, vnode, expectedMap) {
  4450. const root = instance.subTree;
  4451. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4452. const cssVars = instance.getCssVars();
  4453. for (const key in cssVars) {
  4454. const value = normalizeCssVarValue(cssVars[key]);
  4455. expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
  4456. }
  4457. }
  4458. if (vnode === root && instance.parent) {
  4459. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4460. }
  4461. }
  4462. const allowMismatchAttr = "data-allow-mismatch";
  4463. const MismatchTypeString = {
  4464. [0 /* TEXT */]: "text",
  4465. [1 /* CHILDREN */]: "children",
  4466. [2 /* CLASS */]: "class",
  4467. [3 /* STYLE */]: "style",
  4468. [4 /* ATTRIBUTE */]: "attribute"
  4469. };
  4470. function isMismatchAllowed(el, allowedType) {
  4471. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4472. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4473. el = el.parentElement;
  4474. }
  4475. }
  4476. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4477. if (allowedAttr == null) {
  4478. return false;
  4479. } else if (allowedAttr === "") {
  4480. return true;
  4481. } else {
  4482. const list = allowedAttr.split(",");
  4483. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4484. return true;
  4485. }
  4486. return list.includes(MismatchTypeString[allowedType]);
  4487. }
  4488. }
  4489. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4490. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4491. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4492. const id = requestIdleCallback(hydrate, { timeout });
  4493. return () => cancelIdleCallback(id);
  4494. };
  4495. function elementIsVisibleInViewport(el) {
  4496. const { top, left, bottom, right } = el.getBoundingClientRect();
  4497. const { innerHeight, innerWidth } = window;
  4498. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4499. }
  4500. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4501. const ob = new IntersectionObserver((entries) => {
  4502. for (const e of entries) {
  4503. if (!e.isIntersecting) continue;
  4504. ob.disconnect();
  4505. hydrate();
  4506. break;
  4507. }
  4508. }, opts);
  4509. forEach((el) => {
  4510. if (!(el instanceof Element)) return;
  4511. if (elementIsVisibleInViewport(el)) {
  4512. hydrate();
  4513. ob.disconnect();
  4514. return false;
  4515. }
  4516. ob.observe(el);
  4517. });
  4518. return () => ob.disconnect();
  4519. };
  4520. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4521. if (query) {
  4522. const mql = matchMedia(query);
  4523. if (mql.matches) {
  4524. hydrate();
  4525. } else {
  4526. mql.addEventListener("change", hydrate, { once: true });
  4527. return () => mql.removeEventListener("change", hydrate);
  4528. }
  4529. }
  4530. };
  4531. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4532. if (isString(interactions)) interactions = [interactions];
  4533. let hasHydrated = false;
  4534. const doHydrate = (e) => {
  4535. if (!hasHydrated) {
  4536. hasHydrated = true;
  4537. teardown();
  4538. hydrate();
  4539. e.target.dispatchEvent(new e.constructor(e.type, e));
  4540. }
  4541. };
  4542. const teardown = () => {
  4543. forEach((el) => {
  4544. for (const i of interactions) {
  4545. el.removeEventListener(i, doHydrate);
  4546. }
  4547. });
  4548. };
  4549. forEach((el) => {
  4550. for (const i of interactions) {
  4551. el.addEventListener(i, doHydrate, { once: true });
  4552. }
  4553. });
  4554. return teardown;
  4555. };
  4556. function forEachElement(node, cb) {
  4557. if (isComment(node) && node.data === "[") {
  4558. let depth = 1;
  4559. let next = node.nextSibling;
  4560. while (next) {
  4561. if (next.nodeType === 1) {
  4562. const result = cb(next);
  4563. if (result === false) {
  4564. break;
  4565. }
  4566. } else if (isComment(next)) {
  4567. if (next.data === "]") {
  4568. if (--depth === 0) break;
  4569. } else if (next.data === "[") {
  4570. depth++;
  4571. }
  4572. }
  4573. next = next.nextSibling;
  4574. }
  4575. } else {
  4576. cb(node);
  4577. }
  4578. }
  4579. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4580. /*! #__NO_SIDE_EFFECTS__ */
  4581. // @__NO_SIDE_EFFECTS__
  4582. function defineAsyncComponent(source) {
  4583. if (isFunction(source)) {
  4584. source = { loader: source };
  4585. }
  4586. const {
  4587. loader,
  4588. loadingComponent,
  4589. errorComponent,
  4590. delay = 200,
  4591. hydrate: hydrateStrategy,
  4592. timeout,
  4593. // undefined = never times out
  4594. suspensible = true,
  4595. onError: userOnError
  4596. } = source;
  4597. let pendingRequest = null;
  4598. let resolvedComp;
  4599. let retries = 0;
  4600. const retry = () => {
  4601. retries++;
  4602. pendingRequest = null;
  4603. return load();
  4604. };
  4605. const load = () => {
  4606. let thisRequest;
  4607. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4608. err = err instanceof Error ? err : new Error(String(err));
  4609. if (userOnError) {
  4610. return new Promise((resolve, reject) => {
  4611. const userRetry = () => resolve(retry());
  4612. const userFail = () => reject(err);
  4613. userOnError(err, userRetry, userFail, retries + 1);
  4614. });
  4615. } else {
  4616. throw err;
  4617. }
  4618. }).then((comp) => {
  4619. if (thisRequest !== pendingRequest && pendingRequest) {
  4620. return pendingRequest;
  4621. }
  4622. if (!comp) {
  4623. warn$1(
  4624. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4625. );
  4626. }
  4627. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4628. comp = comp.default;
  4629. }
  4630. if (comp && !isObject(comp) && !isFunction(comp)) {
  4631. throw new Error(`Invalid async component load result: ${comp}`);
  4632. }
  4633. resolvedComp = comp;
  4634. return comp;
  4635. }));
  4636. };
  4637. return defineComponent({
  4638. name: "AsyncComponentWrapper",
  4639. __asyncLoader: load,
  4640. __asyncHydrate(el, instance, hydrate) {
  4641. let patched = false;
  4642. (instance.bu || (instance.bu = [])).push(() => patched = true);
  4643. const performHydrate = () => {
  4644. if (patched) {
  4645. {
  4646. warn$1(
  4647. `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
  4648. );
  4649. }
  4650. return;
  4651. }
  4652. hydrate();
  4653. };
  4654. const doHydrate = hydrateStrategy ? () => {
  4655. const teardown = hydrateStrategy(
  4656. performHydrate,
  4657. (cb) => forEachElement(el, cb)
  4658. );
  4659. if (teardown) {
  4660. (instance.bum || (instance.bum = [])).push(teardown);
  4661. }
  4662. } : performHydrate;
  4663. if (resolvedComp) {
  4664. doHydrate();
  4665. } else {
  4666. load().then(() => !instance.isUnmounted && doHydrate());
  4667. }
  4668. },
  4669. get __asyncResolved() {
  4670. return resolvedComp;
  4671. },
  4672. setup() {
  4673. const instance = currentInstance;
  4674. markAsyncBoundary(instance);
  4675. if (resolvedComp) {
  4676. return () => createInnerComp(resolvedComp, instance);
  4677. }
  4678. const onError = (err) => {
  4679. pendingRequest = null;
  4680. handleError(
  4681. err,
  4682. instance,
  4683. 13,
  4684. !errorComponent
  4685. );
  4686. };
  4687. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  4688. return load().then((comp) => {
  4689. return () => createInnerComp(comp, instance);
  4690. }).catch((err) => {
  4691. onError(err);
  4692. return () => errorComponent ? createVNode(errorComponent, {
  4693. error: err
  4694. }) : null;
  4695. });
  4696. }
  4697. const loaded = ref(false);
  4698. const error = ref();
  4699. const delayed = ref(!!delay);
  4700. if (delay) {
  4701. setTimeout(() => {
  4702. delayed.value = false;
  4703. }, delay);
  4704. }
  4705. if (timeout != null) {
  4706. setTimeout(() => {
  4707. if (!loaded.value && !error.value) {
  4708. const err = new Error(
  4709. `Async component timed out after ${timeout}ms.`
  4710. );
  4711. onError(err);
  4712. error.value = err;
  4713. }
  4714. }, timeout);
  4715. }
  4716. load().then(() => {
  4717. loaded.value = true;
  4718. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4719. instance.parent.update();
  4720. }
  4721. }).catch((err) => {
  4722. onError(err);
  4723. error.value = err;
  4724. });
  4725. return () => {
  4726. if (loaded.value && resolvedComp) {
  4727. return createInnerComp(resolvedComp, instance);
  4728. } else if (error.value && errorComponent) {
  4729. return createVNode(errorComponent, {
  4730. error: error.value
  4731. });
  4732. } else if (loadingComponent && !delayed.value) {
  4733. return createVNode(loadingComponent);
  4734. }
  4735. };
  4736. }
  4737. });
  4738. }
  4739. function createInnerComp(comp, parent) {
  4740. const { ref: ref2, props, children, ce } = parent.vnode;
  4741. const vnode = createVNode(comp, props, children);
  4742. vnode.ref = ref2;
  4743. vnode.ce = ce;
  4744. delete parent.vnode.ce;
  4745. return vnode;
  4746. }
  4747. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4748. const KeepAliveImpl = {
  4749. name: `KeepAlive`,
  4750. // Marker for special handling inside the renderer. We are not using a ===
  4751. // check directly on KeepAlive in the renderer, because importing it directly
  4752. // would prevent it from being tree-shaken.
  4753. __isKeepAlive: true,
  4754. props: {
  4755. include: [String, RegExp, Array],
  4756. exclude: [String, RegExp, Array],
  4757. max: [String, Number]
  4758. },
  4759. setup(props, { slots }) {
  4760. const instance = getCurrentInstance();
  4761. const sharedContext = instance.ctx;
  4762. if (!sharedContext.renderer) {
  4763. return () => {
  4764. const children = slots.default && slots.default();
  4765. return children && children.length === 1 ? children[0] : children;
  4766. };
  4767. }
  4768. const cache = /* @__PURE__ */ new Map();
  4769. const keys = /* @__PURE__ */ new Set();
  4770. let current = null;
  4771. {
  4772. instance.__v_cache = cache;
  4773. }
  4774. const parentSuspense = instance.suspense;
  4775. const {
  4776. renderer: {
  4777. p: patch,
  4778. m: move,
  4779. um: _unmount,
  4780. o: { createElement }
  4781. }
  4782. } = sharedContext;
  4783. const storageContainer = createElement("div");
  4784. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4785. const instance2 = vnode.component;
  4786. move(vnode, container, anchor, 0, parentSuspense);
  4787. patch(
  4788. instance2.vnode,
  4789. vnode,
  4790. container,
  4791. anchor,
  4792. instance2,
  4793. parentSuspense,
  4794. namespace,
  4795. vnode.slotScopeIds,
  4796. optimized
  4797. );
  4798. queuePostRenderEffect(() => {
  4799. instance2.isDeactivated = false;
  4800. if (instance2.a) {
  4801. invokeArrayFns(instance2.a);
  4802. }
  4803. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4804. if (vnodeHook) {
  4805. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4806. }
  4807. }, parentSuspense);
  4808. {
  4809. devtoolsComponentAdded(instance2);
  4810. }
  4811. };
  4812. sharedContext.deactivate = (vnode) => {
  4813. const instance2 = vnode.component;
  4814. invalidateMount(instance2.m);
  4815. invalidateMount(instance2.a);
  4816. move(vnode, storageContainer, null, 1, parentSuspense);
  4817. queuePostRenderEffect(() => {
  4818. if (instance2.da) {
  4819. invokeArrayFns(instance2.da);
  4820. }
  4821. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4822. if (vnodeHook) {
  4823. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4824. }
  4825. instance2.isDeactivated = true;
  4826. }, parentSuspense);
  4827. {
  4828. devtoolsComponentAdded(instance2);
  4829. }
  4830. {
  4831. instance2.__keepAliveStorageContainer = storageContainer;
  4832. }
  4833. };
  4834. function unmount(vnode) {
  4835. resetShapeFlag(vnode);
  4836. _unmount(vnode, instance, parentSuspense, true);
  4837. }
  4838. function pruneCache(filter) {
  4839. cache.forEach((vnode, key) => {
  4840. const name = getComponentName(vnode.type);
  4841. if (name && !filter(name)) {
  4842. pruneCacheEntry(key);
  4843. }
  4844. });
  4845. }
  4846. function pruneCacheEntry(key) {
  4847. const cached = cache.get(key);
  4848. if (cached && (!current || !isSameVNodeType(cached, current))) {
  4849. unmount(cached);
  4850. } else if (current) {
  4851. resetShapeFlag(current);
  4852. }
  4853. cache.delete(key);
  4854. keys.delete(key);
  4855. }
  4856. watch(
  4857. () => [props.include, props.exclude],
  4858. ([include, exclude]) => {
  4859. include && pruneCache((name) => matches(include, name));
  4860. exclude && pruneCache((name) => !matches(exclude, name));
  4861. },
  4862. // prune post-render after `current` has been updated
  4863. { flush: "post", deep: true }
  4864. );
  4865. let pendingCacheKey = null;
  4866. const cacheSubtree = () => {
  4867. if (pendingCacheKey != null) {
  4868. if (isSuspense(instance.subTree.type)) {
  4869. queuePostRenderEffect(() => {
  4870. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4871. }, instance.subTree.suspense);
  4872. } else {
  4873. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4874. }
  4875. }
  4876. };
  4877. onMounted(cacheSubtree);
  4878. onUpdated(cacheSubtree);
  4879. onBeforeUnmount(() => {
  4880. cache.forEach((cached) => {
  4881. const { subTree, suspense } = instance;
  4882. const vnode = getInnerChild(subTree);
  4883. if (cached.type === vnode.type && cached.key === vnode.key) {
  4884. resetShapeFlag(vnode);
  4885. const da = vnode.component.da;
  4886. da && queuePostRenderEffect(da, suspense);
  4887. return;
  4888. }
  4889. unmount(cached);
  4890. });
  4891. });
  4892. return () => {
  4893. pendingCacheKey = null;
  4894. if (!slots.default) {
  4895. return current = null;
  4896. }
  4897. const children = slots.default();
  4898. const rawVNode = children[0];
  4899. if (children.length > 1) {
  4900. {
  4901. warn$1(`KeepAlive should contain exactly one component child.`);
  4902. }
  4903. current = null;
  4904. return children;
  4905. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4906. current = null;
  4907. return rawVNode;
  4908. }
  4909. let vnode = getInnerChild(rawVNode);
  4910. if (vnode.type === Comment) {
  4911. current = null;
  4912. return vnode;
  4913. }
  4914. const comp = vnode.type;
  4915. const name = getComponentName(
  4916. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4917. );
  4918. const { include, exclude, max } = props;
  4919. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4920. vnode.shapeFlag &= -257;
  4921. current = vnode;
  4922. return rawVNode;
  4923. }
  4924. const key = vnode.key == null ? comp : vnode.key;
  4925. const cachedVNode = cache.get(key);
  4926. if (vnode.el) {
  4927. vnode = cloneVNode(vnode);
  4928. if (rawVNode.shapeFlag & 128) {
  4929. rawVNode.ssContent = vnode;
  4930. }
  4931. }
  4932. pendingCacheKey = key;
  4933. if (cachedVNode) {
  4934. vnode.el = cachedVNode.el;
  4935. vnode.component = cachedVNode.component;
  4936. if (vnode.transition) {
  4937. setTransitionHooks(vnode, vnode.transition);
  4938. }
  4939. vnode.shapeFlag |= 512;
  4940. keys.delete(key);
  4941. keys.add(key);
  4942. } else {
  4943. keys.add(key);
  4944. if (max && keys.size > parseInt(max, 10)) {
  4945. pruneCacheEntry(keys.values().next().value);
  4946. }
  4947. }
  4948. vnode.shapeFlag |= 256;
  4949. current = vnode;
  4950. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4951. };
  4952. }
  4953. };
  4954. const KeepAlive = KeepAliveImpl;
  4955. function matches(pattern, name) {
  4956. if (isArray(pattern)) {
  4957. return pattern.some((p) => matches(p, name));
  4958. } else if (isString(pattern)) {
  4959. return pattern.split(",").includes(name);
  4960. } else if (isRegExp(pattern)) {
  4961. pattern.lastIndex = 0;
  4962. return pattern.test(name);
  4963. }
  4964. return false;
  4965. }
  4966. function onActivated(hook, target) {
  4967. registerKeepAliveHook(hook, "a", target);
  4968. }
  4969. function onDeactivated(hook, target) {
  4970. registerKeepAliveHook(hook, "da", target);
  4971. }
  4972. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4973. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4974. let current = target;
  4975. while (current) {
  4976. if (current.isDeactivated) {
  4977. return;
  4978. }
  4979. current = current.parent;
  4980. }
  4981. return hook();
  4982. });
  4983. injectHook(type, wrappedHook, target);
  4984. if (target) {
  4985. let current = target.parent;
  4986. while (current && current.parent) {
  4987. if (isKeepAlive(current.parent.vnode)) {
  4988. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4989. }
  4990. current = current.parent;
  4991. }
  4992. }
  4993. }
  4994. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4995. const injected = injectHook(
  4996. type,
  4997. hook,
  4998. keepAliveRoot,
  4999. true
  5000. /* prepend */
  5001. );
  5002. onUnmounted(() => {
  5003. remove(keepAliveRoot[type], injected);
  5004. }, target);
  5005. }
  5006. function resetShapeFlag(vnode) {
  5007. vnode.shapeFlag &= -257;
  5008. vnode.shapeFlag &= -513;
  5009. }
  5010. function getInnerChild(vnode) {
  5011. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  5012. }
  5013. function injectHook(type, hook, target = currentInstance, prepend = false) {
  5014. if (target) {
  5015. const hooks = target[type] || (target[type] = []);
  5016. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  5017. pauseTracking();
  5018. const reset = setCurrentInstance(target);
  5019. const res = callWithAsyncErrorHandling(hook, target, type, args);
  5020. reset();
  5021. resetTracking();
  5022. return res;
  5023. });
  5024. if (prepend) {
  5025. hooks.unshift(wrappedHook);
  5026. } else {
  5027. hooks.push(wrappedHook);
  5028. }
  5029. return wrappedHook;
  5030. } else {
  5031. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  5032. warn$1(
  5033. `${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.` )
  5034. );
  5035. }
  5036. }
  5037. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  5038. if (!isInSSRComponentSetup || lifecycle === "sp") {
  5039. injectHook(lifecycle, (...args) => hook(...args), target);
  5040. }
  5041. };
  5042. const onBeforeMount = createHook("bm");
  5043. const onMounted = createHook("m");
  5044. const onBeforeUpdate = createHook(
  5045. "bu"
  5046. );
  5047. const onUpdated = createHook("u");
  5048. const onBeforeUnmount = createHook(
  5049. "bum"
  5050. );
  5051. const onUnmounted = createHook("um");
  5052. const onServerPrefetch = createHook(
  5053. "sp"
  5054. );
  5055. const onRenderTriggered = createHook("rtg");
  5056. const onRenderTracked = createHook("rtc");
  5057. function onErrorCaptured(hook, target = currentInstance) {
  5058. injectHook("ec", hook, target);
  5059. }
  5060. const COMPONENTS = "components";
  5061. const DIRECTIVES = "directives";
  5062. function resolveComponent(name, maybeSelfReference) {
  5063. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  5064. }
  5065. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  5066. function resolveDynamicComponent(component) {
  5067. if (isString(component)) {
  5068. return resolveAsset(COMPONENTS, component, false) || component;
  5069. } else {
  5070. return component || NULL_DYNAMIC_COMPONENT;
  5071. }
  5072. }
  5073. function resolveDirective(name) {
  5074. return resolveAsset(DIRECTIVES, name);
  5075. }
  5076. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5077. const instance = currentRenderingInstance || currentInstance;
  5078. if (instance) {
  5079. const Component = instance.type;
  5080. if (type === COMPONENTS) {
  5081. const selfName = getComponentName(
  5082. Component,
  5083. false
  5084. );
  5085. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5086. return Component;
  5087. }
  5088. }
  5089. const res = (
  5090. // local registration
  5091. // check instance[type] first which is resolved for options API
  5092. resolve(instance[type] || Component[type], name) || // global registration
  5093. resolve(instance.appContext[type], name)
  5094. );
  5095. if (!res && maybeSelfReference) {
  5096. return Component;
  5097. }
  5098. if (warnMissing && !res) {
  5099. const extra = type === COMPONENTS ? `
  5100. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5101. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5102. }
  5103. return res;
  5104. } else {
  5105. warn$1(
  5106. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5107. );
  5108. }
  5109. }
  5110. function resolve(registry, name) {
  5111. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5112. }
  5113. function renderList(source, renderItem, cache, index) {
  5114. let ret;
  5115. const cached = cache && cache[index];
  5116. const sourceIsArray = isArray(source);
  5117. if (sourceIsArray || isString(source)) {
  5118. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5119. let needsWrap = false;
  5120. let isReadonlySource = false;
  5121. if (sourceIsReactiveArray) {
  5122. needsWrap = !isShallow(source);
  5123. isReadonlySource = isReadonly(source);
  5124. source = shallowReadArray(source);
  5125. }
  5126. ret = new Array(source.length);
  5127. for (let i = 0, l = source.length; i < l; i++) {
  5128. ret[i] = renderItem(
  5129. needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
  5130. i,
  5131. void 0,
  5132. cached && cached[i]
  5133. );
  5134. }
  5135. } else if (typeof source === "number") {
  5136. if (!Number.isInteger(source)) {
  5137. warn$1(`The v-for range expect an integer value but got ${source}.`);
  5138. }
  5139. ret = new Array(source);
  5140. for (let i = 0; i < source; i++) {
  5141. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5142. }
  5143. } else if (isObject(source)) {
  5144. if (source[Symbol.iterator]) {
  5145. ret = Array.from(
  5146. source,
  5147. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5148. );
  5149. } else {
  5150. const keys = Object.keys(source);
  5151. ret = new Array(keys.length);
  5152. for (let i = 0, l = keys.length; i < l; i++) {
  5153. const key = keys[i];
  5154. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5155. }
  5156. }
  5157. } else {
  5158. ret = [];
  5159. }
  5160. if (cache) {
  5161. cache[index] = ret;
  5162. }
  5163. return ret;
  5164. }
  5165. function createSlots(slots, dynamicSlots) {
  5166. for (let i = 0; i < dynamicSlots.length; i++) {
  5167. const slot = dynamicSlots[i];
  5168. if (isArray(slot)) {
  5169. for (let j = 0; j < slot.length; j++) {
  5170. slots[slot[j].name] = slot[j].fn;
  5171. }
  5172. } else if (slot) {
  5173. slots[slot.name] = slot.key ? (...args) => {
  5174. const res = slot.fn(...args);
  5175. if (res) res.key = slot.key;
  5176. return res;
  5177. } : slot.fn;
  5178. }
  5179. }
  5180. return slots;
  5181. }
  5182. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5183. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5184. if (name !== "default") props.name = name;
  5185. return openBlock(), createBlock(
  5186. Fragment,
  5187. null,
  5188. [createVNode("slot", props, fallback && fallback())],
  5189. 64
  5190. );
  5191. }
  5192. let slot = slots[name];
  5193. if (slot && slot.length > 1) {
  5194. warn$1(
  5195. `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.`
  5196. );
  5197. slot = () => [];
  5198. }
  5199. if (slot && slot._c) {
  5200. slot._d = false;
  5201. }
  5202. openBlock();
  5203. const validSlotContent = slot && ensureValidVNode(slot(props));
  5204. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5205. // key attached in the `createSlots` helper, respect that
  5206. validSlotContent && validSlotContent.key;
  5207. const rendered = createBlock(
  5208. Fragment,
  5209. {
  5210. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5211. (!validSlotContent && fallback ? "_fb" : "")
  5212. },
  5213. validSlotContent || (fallback ? fallback() : []),
  5214. validSlotContent && slots._ === 1 ? 64 : -2
  5215. );
  5216. if (!noSlotted && rendered.scopeId) {
  5217. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5218. }
  5219. if (slot && slot._c) {
  5220. slot._d = true;
  5221. }
  5222. return rendered;
  5223. }
  5224. function ensureValidVNode(vnodes) {
  5225. return vnodes.some((child) => {
  5226. if (!isVNode(child)) return true;
  5227. if (child.type === Comment) return false;
  5228. if (child.type === Fragment && !ensureValidVNode(child.children))
  5229. return false;
  5230. return true;
  5231. }) ? vnodes : null;
  5232. }
  5233. function toHandlers(obj, preserveCaseIfNecessary) {
  5234. const ret = {};
  5235. if (!isObject(obj)) {
  5236. warn$1(`v-on with no argument expects an object value.`);
  5237. return ret;
  5238. }
  5239. for (const key in obj) {
  5240. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5241. }
  5242. return ret;
  5243. }
  5244. const getPublicInstance = (i) => {
  5245. if (!i) return null;
  5246. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5247. return getPublicInstance(i.parent);
  5248. };
  5249. const publicPropertiesMap = (
  5250. // Move PURE marker to new line to workaround compiler discarding it
  5251. // due to type annotation
  5252. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5253. $: (i) => i,
  5254. $el: (i) => i.vnode.el,
  5255. $data: (i) => i.data,
  5256. $props: (i) => shallowReadonly(i.props) ,
  5257. $attrs: (i) => shallowReadonly(i.attrs) ,
  5258. $slots: (i) => shallowReadonly(i.slots) ,
  5259. $refs: (i) => shallowReadonly(i.refs) ,
  5260. $parent: (i) => getPublicInstance(i.parent),
  5261. $root: (i) => getPublicInstance(i.root),
  5262. $host: (i) => i.ce,
  5263. $emit: (i) => i.emit,
  5264. $options: (i) => resolveMergedOptions(i) ,
  5265. $forceUpdate: (i) => i.f || (i.f = () => {
  5266. queueJob(i.update);
  5267. }),
  5268. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5269. $watch: (i) => instanceWatch.bind(i)
  5270. })
  5271. );
  5272. const isReservedPrefix = (key) => key === "_" || key === "$";
  5273. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5274. const PublicInstanceProxyHandlers = {
  5275. get({ _: instance }, key) {
  5276. if (key === "__v_skip") {
  5277. return true;
  5278. }
  5279. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5280. if (key === "__isVue") {
  5281. return true;
  5282. }
  5283. let normalizedProps;
  5284. if (key[0] !== "$") {
  5285. const n = accessCache[key];
  5286. if (n !== void 0) {
  5287. switch (n) {
  5288. case 1 /* SETUP */:
  5289. return setupState[key];
  5290. case 2 /* DATA */:
  5291. return data[key];
  5292. case 4 /* CONTEXT */:
  5293. return ctx[key];
  5294. case 3 /* PROPS */:
  5295. return props[key];
  5296. }
  5297. } else if (hasSetupBinding(setupState, key)) {
  5298. accessCache[key] = 1 /* SETUP */;
  5299. return setupState[key];
  5300. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5301. accessCache[key] = 2 /* DATA */;
  5302. return data[key];
  5303. } else if (
  5304. // only cache other properties when instance has declared (thus stable)
  5305. // props
  5306. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  5307. ) {
  5308. accessCache[key] = 3 /* PROPS */;
  5309. return props[key];
  5310. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5311. accessCache[key] = 4 /* CONTEXT */;
  5312. return ctx[key];
  5313. } else if (shouldCacheAccess) {
  5314. accessCache[key] = 0 /* OTHER */;
  5315. }
  5316. }
  5317. const publicGetter = publicPropertiesMap[key];
  5318. let cssModule, globalProperties;
  5319. if (publicGetter) {
  5320. if (key === "$attrs") {
  5321. track(instance.attrs, "get", "");
  5322. markAttrsAccessed();
  5323. } else if (key === "$slots") {
  5324. track(instance, "get", key);
  5325. }
  5326. return publicGetter(instance);
  5327. } else if (
  5328. // css module (injected by vue-loader)
  5329. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5330. ) {
  5331. return cssModule;
  5332. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5333. accessCache[key] = 4 /* CONTEXT */;
  5334. return ctx[key];
  5335. } else if (
  5336. // global properties
  5337. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5338. ) {
  5339. {
  5340. return globalProperties[key];
  5341. }
  5342. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5343. // to infinite warning loop
  5344. key.indexOf("__v") !== 0)) {
  5345. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5346. warn$1(
  5347. `Property ${JSON.stringify(
  5348. key
  5349. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5350. );
  5351. } else if (instance === currentRenderingInstance) {
  5352. warn$1(
  5353. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5354. );
  5355. }
  5356. }
  5357. },
  5358. set({ _: instance }, key, value) {
  5359. const { data, setupState, ctx } = instance;
  5360. if (hasSetupBinding(setupState, key)) {
  5361. setupState[key] = value;
  5362. return true;
  5363. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5364. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5365. return false;
  5366. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5367. data[key] = value;
  5368. return true;
  5369. } else if (hasOwn(instance.props, key)) {
  5370. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5371. return false;
  5372. }
  5373. if (key[0] === "$" && key.slice(1) in instance) {
  5374. warn$1(
  5375. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5376. );
  5377. return false;
  5378. } else {
  5379. if (key in instance.appContext.config.globalProperties) {
  5380. Object.defineProperty(ctx, key, {
  5381. enumerable: true,
  5382. configurable: true,
  5383. value
  5384. });
  5385. } else {
  5386. ctx[key] = value;
  5387. }
  5388. }
  5389. return true;
  5390. },
  5391. has({
  5392. _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
  5393. }, key) {
  5394. let normalizedProps, cssModules;
  5395. return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
  5396. },
  5397. defineProperty(target, key, descriptor) {
  5398. if (descriptor.get != null) {
  5399. target._.accessCache[key] = 0;
  5400. } else if (hasOwn(descriptor, "value")) {
  5401. this.set(target, key, descriptor.value, null);
  5402. }
  5403. return Reflect.defineProperty(target, key, descriptor);
  5404. }
  5405. };
  5406. {
  5407. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5408. warn$1(
  5409. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5410. );
  5411. return Reflect.ownKeys(target);
  5412. };
  5413. }
  5414. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5415. get(target, key) {
  5416. if (key === Symbol.unscopables) {
  5417. return;
  5418. }
  5419. return PublicInstanceProxyHandlers.get(target, key, target);
  5420. },
  5421. has(_, key) {
  5422. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5423. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5424. warn$1(
  5425. `Property ${JSON.stringify(
  5426. key
  5427. )} should not start with _ which is a reserved prefix for Vue internals.`
  5428. );
  5429. }
  5430. return has;
  5431. }
  5432. });
  5433. function createDevRenderContext(instance) {
  5434. const target = {};
  5435. Object.defineProperty(target, `_`, {
  5436. configurable: true,
  5437. enumerable: false,
  5438. get: () => instance
  5439. });
  5440. Object.keys(publicPropertiesMap).forEach((key) => {
  5441. Object.defineProperty(target, key, {
  5442. configurable: true,
  5443. enumerable: false,
  5444. get: () => publicPropertiesMap[key](instance),
  5445. // intercepted by the proxy so no need for implementation,
  5446. // but needed to prevent set errors
  5447. set: NOOP
  5448. });
  5449. });
  5450. return target;
  5451. }
  5452. function exposePropsOnRenderContext(instance) {
  5453. const {
  5454. ctx,
  5455. propsOptions: [propsOptions]
  5456. } = instance;
  5457. if (propsOptions) {
  5458. Object.keys(propsOptions).forEach((key) => {
  5459. Object.defineProperty(ctx, key, {
  5460. enumerable: true,
  5461. configurable: true,
  5462. get: () => instance.props[key],
  5463. set: NOOP
  5464. });
  5465. });
  5466. }
  5467. }
  5468. function exposeSetupStateOnRenderContext(instance) {
  5469. const { ctx, setupState } = instance;
  5470. Object.keys(toRaw(setupState)).forEach((key) => {
  5471. if (!setupState.__isScriptSetup) {
  5472. if (isReservedPrefix(key[0])) {
  5473. warn$1(
  5474. `setup() return property ${JSON.stringify(
  5475. key
  5476. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5477. );
  5478. return;
  5479. }
  5480. Object.defineProperty(ctx, key, {
  5481. enumerable: true,
  5482. configurable: true,
  5483. get: () => setupState[key],
  5484. set: NOOP
  5485. });
  5486. }
  5487. });
  5488. }
  5489. const warnRuntimeUsage = (method) => warn$1(
  5490. `${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.`
  5491. );
  5492. function defineProps() {
  5493. {
  5494. warnRuntimeUsage(`defineProps`);
  5495. }
  5496. return null;
  5497. }
  5498. function defineEmits() {
  5499. {
  5500. warnRuntimeUsage(`defineEmits`);
  5501. }
  5502. return null;
  5503. }
  5504. function defineExpose(exposed) {
  5505. {
  5506. warnRuntimeUsage(`defineExpose`);
  5507. }
  5508. }
  5509. function defineOptions(options) {
  5510. {
  5511. warnRuntimeUsage(`defineOptions`);
  5512. }
  5513. }
  5514. function defineSlots() {
  5515. {
  5516. warnRuntimeUsage(`defineSlots`);
  5517. }
  5518. return null;
  5519. }
  5520. function defineModel() {
  5521. {
  5522. warnRuntimeUsage("defineModel");
  5523. }
  5524. }
  5525. function withDefaults(props, defaults) {
  5526. {
  5527. warnRuntimeUsage(`withDefaults`);
  5528. }
  5529. return null;
  5530. }
  5531. function useSlots() {
  5532. return getContext("useSlots").slots;
  5533. }
  5534. function useAttrs() {
  5535. return getContext("useAttrs").attrs;
  5536. }
  5537. function getContext(calledFunctionName) {
  5538. const i = getCurrentInstance();
  5539. if (!i) {
  5540. warn$1(`${calledFunctionName}() called without active instance.`);
  5541. }
  5542. return i.setupContext || (i.setupContext = createSetupContext(i));
  5543. }
  5544. function normalizePropsOrEmits(props) {
  5545. return isArray(props) ? props.reduce(
  5546. (normalized, p) => (normalized[p] = null, normalized),
  5547. {}
  5548. ) : props;
  5549. }
  5550. function mergeDefaults(raw, defaults) {
  5551. const props = normalizePropsOrEmits(raw);
  5552. for (const key in defaults) {
  5553. if (key.startsWith("__skip")) continue;
  5554. let opt = props[key];
  5555. if (opt) {
  5556. if (isArray(opt) || isFunction(opt)) {
  5557. opt = props[key] = { type: opt, default: defaults[key] };
  5558. } else {
  5559. opt.default = defaults[key];
  5560. }
  5561. } else if (opt === null) {
  5562. opt = props[key] = { default: defaults[key] };
  5563. } else {
  5564. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5565. }
  5566. if (opt && defaults[`__skip_${key}`]) {
  5567. opt.skipFactory = true;
  5568. }
  5569. }
  5570. return props;
  5571. }
  5572. function mergeModels(a, b) {
  5573. if (!a || !b) return a || b;
  5574. if (isArray(a) && isArray(b)) return a.concat(b);
  5575. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5576. }
  5577. function createPropsRestProxy(props, excludedKeys) {
  5578. const ret = {};
  5579. for (const key in props) {
  5580. if (!excludedKeys.includes(key)) {
  5581. Object.defineProperty(ret, key, {
  5582. enumerable: true,
  5583. get: () => props[key]
  5584. });
  5585. }
  5586. }
  5587. return ret;
  5588. }
  5589. function withAsyncContext(getAwaitable) {
  5590. const ctx = getCurrentInstance();
  5591. if (!ctx) {
  5592. warn$1(
  5593. `withAsyncContext called without active current instance. This is likely a bug.`
  5594. );
  5595. }
  5596. let awaitable = getAwaitable();
  5597. unsetCurrentInstance();
  5598. if (isPromise(awaitable)) {
  5599. awaitable = awaitable.catch((e) => {
  5600. setCurrentInstance(ctx);
  5601. throw e;
  5602. });
  5603. }
  5604. return [awaitable, () => setCurrentInstance(ctx)];
  5605. }
  5606. function createDuplicateChecker() {
  5607. const cache = /* @__PURE__ */ Object.create(null);
  5608. return (type, key) => {
  5609. if (cache[key]) {
  5610. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5611. } else {
  5612. cache[key] = type;
  5613. }
  5614. };
  5615. }
  5616. let shouldCacheAccess = true;
  5617. function applyOptions(instance) {
  5618. const options = resolveMergedOptions(instance);
  5619. const publicThis = instance.proxy;
  5620. const ctx = instance.ctx;
  5621. shouldCacheAccess = false;
  5622. if (options.beforeCreate) {
  5623. callHook$1(options.beforeCreate, instance, "bc");
  5624. }
  5625. const {
  5626. // state
  5627. data: dataOptions,
  5628. computed: computedOptions,
  5629. methods,
  5630. watch: watchOptions,
  5631. provide: provideOptions,
  5632. inject: injectOptions,
  5633. // lifecycle
  5634. created,
  5635. beforeMount,
  5636. mounted,
  5637. beforeUpdate,
  5638. updated,
  5639. activated,
  5640. deactivated,
  5641. beforeDestroy,
  5642. beforeUnmount,
  5643. destroyed,
  5644. unmounted,
  5645. render,
  5646. renderTracked,
  5647. renderTriggered,
  5648. errorCaptured,
  5649. serverPrefetch,
  5650. // public API
  5651. expose,
  5652. inheritAttrs,
  5653. // assets
  5654. components,
  5655. directives,
  5656. filters
  5657. } = options;
  5658. const checkDuplicateProperties = createDuplicateChecker() ;
  5659. {
  5660. const [propsOptions] = instance.propsOptions;
  5661. if (propsOptions) {
  5662. for (const key in propsOptions) {
  5663. checkDuplicateProperties("Props" /* PROPS */, key);
  5664. }
  5665. }
  5666. }
  5667. if (injectOptions) {
  5668. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5669. }
  5670. if (methods) {
  5671. for (const key in methods) {
  5672. const methodHandler = methods[key];
  5673. if (isFunction(methodHandler)) {
  5674. {
  5675. Object.defineProperty(ctx, key, {
  5676. value: methodHandler.bind(publicThis),
  5677. configurable: true,
  5678. enumerable: true,
  5679. writable: true
  5680. });
  5681. }
  5682. {
  5683. checkDuplicateProperties("Methods" /* METHODS */, key);
  5684. }
  5685. } else {
  5686. warn$1(
  5687. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5688. );
  5689. }
  5690. }
  5691. }
  5692. if (dataOptions) {
  5693. if (!isFunction(dataOptions)) {
  5694. warn$1(
  5695. `The data option must be a function. Plain object usage is no longer supported.`
  5696. );
  5697. }
  5698. const data = dataOptions.call(publicThis, publicThis);
  5699. if (isPromise(data)) {
  5700. warn$1(
  5701. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5702. );
  5703. }
  5704. if (!isObject(data)) {
  5705. warn$1(`data() should return an object.`);
  5706. } else {
  5707. instance.data = reactive(data);
  5708. {
  5709. for (const key in data) {
  5710. checkDuplicateProperties("Data" /* DATA */, key);
  5711. if (!isReservedPrefix(key[0])) {
  5712. Object.defineProperty(ctx, key, {
  5713. configurable: true,
  5714. enumerable: true,
  5715. get: () => data[key],
  5716. set: NOOP
  5717. });
  5718. }
  5719. }
  5720. }
  5721. }
  5722. }
  5723. shouldCacheAccess = true;
  5724. if (computedOptions) {
  5725. for (const key in computedOptions) {
  5726. const opt = computedOptions[key];
  5727. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5728. if (get === NOOP) {
  5729. warn$1(`Computed property "${key}" has no getter.`);
  5730. }
  5731. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5732. warn$1(
  5733. `Write operation failed: computed property "${key}" is readonly.`
  5734. );
  5735. } ;
  5736. const c = computed({
  5737. get,
  5738. set
  5739. });
  5740. Object.defineProperty(ctx, key, {
  5741. enumerable: true,
  5742. configurable: true,
  5743. get: () => c.value,
  5744. set: (v) => c.value = v
  5745. });
  5746. {
  5747. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5748. }
  5749. }
  5750. }
  5751. if (watchOptions) {
  5752. for (const key in watchOptions) {
  5753. createWatcher(watchOptions[key], ctx, publicThis, key);
  5754. }
  5755. }
  5756. if (provideOptions) {
  5757. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5758. Reflect.ownKeys(provides).forEach((key) => {
  5759. provide(key, provides[key]);
  5760. });
  5761. }
  5762. if (created) {
  5763. callHook$1(created, instance, "c");
  5764. }
  5765. function registerLifecycleHook(register, hook) {
  5766. if (isArray(hook)) {
  5767. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5768. } else if (hook) {
  5769. register(hook.bind(publicThis));
  5770. }
  5771. }
  5772. registerLifecycleHook(onBeforeMount, beforeMount);
  5773. registerLifecycleHook(onMounted, mounted);
  5774. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5775. registerLifecycleHook(onUpdated, updated);
  5776. registerLifecycleHook(onActivated, activated);
  5777. registerLifecycleHook(onDeactivated, deactivated);
  5778. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5779. registerLifecycleHook(onRenderTracked, renderTracked);
  5780. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5781. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5782. registerLifecycleHook(onUnmounted, unmounted);
  5783. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5784. if (isArray(expose)) {
  5785. if (expose.length) {
  5786. const exposed = instance.exposed || (instance.exposed = {});
  5787. expose.forEach((key) => {
  5788. Object.defineProperty(exposed, key, {
  5789. get: () => publicThis[key],
  5790. set: (val) => publicThis[key] = val,
  5791. enumerable: true
  5792. });
  5793. });
  5794. } else if (!instance.exposed) {
  5795. instance.exposed = {};
  5796. }
  5797. }
  5798. if (render && instance.render === NOOP) {
  5799. instance.render = render;
  5800. }
  5801. if (inheritAttrs != null) {
  5802. instance.inheritAttrs = inheritAttrs;
  5803. }
  5804. if (components) instance.components = components;
  5805. if (directives) instance.directives = directives;
  5806. if (serverPrefetch) {
  5807. markAsyncBoundary(instance);
  5808. }
  5809. }
  5810. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5811. if (isArray(injectOptions)) {
  5812. injectOptions = normalizeInject(injectOptions);
  5813. }
  5814. for (const key in injectOptions) {
  5815. const opt = injectOptions[key];
  5816. let injected;
  5817. if (isObject(opt)) {
  5818. if ("default" in opt) {
  5819. injected = inject(
  5820. opt.from || key,
  5821. opt.default,
  5822. true
  5823. );
  5824. } else {
  5825. injected = inject(opt.from || key);
  5826. }
  5827. } else {
  5828. injected = inject(opt);
  5829. }
  5830. if (isRef(injected)) {
  5831. Object.defineProperty(ctx, key, {
  5832. enumerable: true,
  5833. configurable: true,
  5834. get: () => injected.value,
  5835. set: (v) => injected.value = v
  5836. });
  5837. } else {
  5838. ctx[key] = injected;
  5839. }
  5840. {
  5841. checkDuplicateProperties("Inject" /* INJECT */, key);
  5842. }
  5843. }
  5844. }
  5845. function callHook$1(hook, instance, type) {
  5846. callWithAsyncErrorHandling(
  5847. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5848. instance,
  5849. type
  5850. );
  5851. }
  5852. function createWatcher(raw, ctx, publicThis, key) {
  5853. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5854. if (isString(raw)) {
  5855. const handler = ctx[raw];
  5856. if (isFunction(handler)) {
  5857. {
  5858. watch(getter, handler);
  5859. }
  5860. } else {
  5861. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5862. }
  5863. } else if (isFunction(raw)) {
  5864. {
  5865. watch(getter, raw.bind(publicThis));
  5866. }
  5867. } else if (isObject(raw)) {
  5868. if (isArray(raw)) {
  5869. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5870. } else {
  5871. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5872. if (isFunction(handler)) {
  5873. watch(getter, handler, raw);
  5874. } else {
  5875. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5876. }
  5877. }
  5878. } else {
  5879. warn$1(`Invalid watch option: "${key}"`, raw);
  5880. }
  5881. }
  5882. function resolveMergedOptions(instance) {
  5883. const base = instance.type;
  5884. const { mixins, extends: extendsOptions } = base;
  5885. const {
  5886. mixins: globalMixins,
  5887. optionsCache: cache,
  5888. config: { optionMergeStrategies }
  5889. } = instance.appContext;
  5890. const cached = cache.get(base);
  5891. let resolved;
  5892. if (cached) {
  5893. resolved = cached;
  5894. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5895. {
  5896. resolved = base;
  5897. }
  5898. } else {
  5899. resolved = {};
  5900. if (globalMixins.length) {
  5901. globalMixins.forEach(
  5902. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5903. );
  5904. }
  5905. mergeOptions(resolved, base, optionMergeStrategies);
  5906. }
  5907. if (isObject(base)) {
  5908. cache.set(base, resolved);
  5909. }
  5910. return resolved;
  5911. }
  5912. function mergeOptions(to, from, strats, asMixin = false) {
  5913. const { mixins, extends: extendsOptions } = from;
  5914. if (extendsOptions) {
  5915. mergeOptions(to, extendsOptions, strats, true);
  5916. }
  5917. if (mixins) {
  5918. mixins.forEach(
  5919. (m) => mergeOptions(to, m, strats, true)
  5920. );
  5921. }
  5922. for (const key in from) {
  5923. if (asMixin && key === "expose") {
  5924. warn$1(
  5925. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5926. );
  5927. } else {
  5928. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5929. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5930. }
  5931. }
  5932. return to;
  5933. }
  5934. const internalOptionMergeStrats = {
  5935. data: mergeDataFn,
  5936. props: mergeEmitsOrPropsOptions,
  5937. emits: mergeEmitsOrPropsOptions,
  5938. // objects
  5939. methods: mergeObjectOptions,
  5940. computed: mergeObjectOptions,
  5941. // lifecycle
  5942. beforeCreate: mergeAsArray$1,
  5943. created: mergeAsArray$1,
  5944. beforeMount: mergeAsArray$1,
  5945. mounted: mergeAsArray$1,
  5946. beforeUpdate: mergeAsArray$1,
  5947. updated: mergeAsArray$1,
  5948. beforeDestroy: mergeAsArray$1,
  5949. beforeUnmount: mergeAsArray$1,
  5950. destroyed: mergeAsArray$1,
  5951. unmounted: mergeAsArray$1,
  5952. activated: mergeAsArray$1,
  5953. deactivated: mergeAsArray$1,
  5954. errorCaptured: mergeAsArray$1,
  5955. serverPrefetch: mergeAsArray$1,
  5956. // assets
  5957. components: mergeObjectOptions,
  5958. directives: mergeObjectOptions,
  5959. // watch
  5960. watch: mergeWatchOptions,
  5961. // provide / inject
  5962. provide: mergeDataFn,
  5963. inject: mergeInject
  5964. };
  5965. function mergeDataFn(to, from) {
  5966. if (!from) {
  5967. return to;
  5968. }
  5969. if (!to) {
  5970. return from;
  5971. }
  5972. return function mergedDataFn() {
  5973. return (extend)(
  5974. isFunction(to) ? to.call(this, this) : to,
  5975. isFunction(from) ? from.call(this, this) : from
  5976. );
  5977. };
  5978. }
  5979. function mergeInject(to, from) {
  5980. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5981. }
  5982. function normalizeInject(raw) {
  5983. if (isArray(raw)) {
  5984. const res = {};
  5985. for (let i = 0; i < raw.length; i++) {
  5986. res[raw[i]] = raw[i];
  5987. }
  5988. return res;
  5989. }
  5990. return raw;
  5991. }
  5992. function mergeAsArray$1(to, from) {
  5993. return to ? [...new Set([].concat(to, from))] : from;
  5994. }
  5995. function mergeObjectOptions(to, from) {
  5996. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5997. }
  5998. function mergeEmitsOrPropsOptions(to, from) {
  5999. if (to) {
  6000. if (isArray(to) && isArray(from)) {
  6001. return [.../* @__PURE__ */ new Set([...to, ...from])];
  6002. }
  6003. return extend(
  6004. /* @__PURE__ */ Object.create(null),
  6005. normalizePropsOrEmits(to),
  6006. normalizePropsOrEmits(from != null ? from : {})
  6007. );
  6008. } else {
  6009. return from;
  6010. }
  6011. }
  6012. function mergeWatchOptions(to, from) {
  6013. if (!to) return from;
  6014. if (!from) return to;
  6015. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  6016. for (const key in from) {
  6017. merged[key] = mergeAsArray$1(to[key], from[key]);
  6018. }
  6019. return merged;
  6020. }
  6021. function createAppContext() {
  6022. return {
  6023. app: null,
  6024. config: {
  6025. isNativeTag: NO,
  6026. performance: false,
  6027. globalProperties: {},
  6028. optionMergeStrategies: {},
  6029. errorHandler: void 0,
  6030. warnHandler: void 0,
  6031. compilerOptions: {}
  6032. },
  6033. mixins: [],
  6034. components: {},
  6035. directives: {},
  6036. provides: /* @__PURE__ */ Object.create(null),
  6037. optionsCache: /* @__PURE__ */ new WeakMap(),
  6038. propsCache: /* @__PURE__ */ new WeakMap(),
  6039. emitsCache: /* @__PURE__ */ new WeakMap()
  6040. };
  6041. }
  6042. let uid$1 = 0;
  6043. function createAppAPI(render, hydrate) {
  6044. return function createApp(rootComponent, rootProps = null) {
  6045. if (!isFunction(rootComponent)) {
  6046. rootComponent = extend({}, rootComponent);
  6047. }
  6048. if (rootProps != null && !isObject(rootProps)) {
  6049. warn$1(`root props passed to app.mount() must be an object.`);
  6050. rootProps = null;
  6051. }
  6052. const context = createAppContext();
  6053. const installedPlugins = /* @__PURE__ */ new WeakSet();
  6054. const pluginCleanupFns = [];
  6055. let isMounted = false;
  6056. const app = context.app = {
  6057. _uid: uid$1++,
  6058. _component: rootComponent,
  6059. _props: rootProps,
  6060. _container: null,
  6061. _context: context,
  6062. _instance: null,
  6063. version,
  6064. get config() {
  6065. return context.config;
  6066. },
  6067. set config(v) {
  6068. {
  6069. warn$1(
  6070. `app.config cannot be replaced. Modify individual options instead.`
  6071. );
  6072. }
  6073. },
  6074. use(plugin, ...options) {
  6075. if (installedPlugins.has(plugin)) {
  6076. warn$1(`Plugin has already been applied to target app.`);
  6077. } else if (plugin && isFunction(plugin.install)) {
  6078. installedPlugins.add(plugin);
  6079. plugin.install(app, ...options);
  6080. } else if (isFunction(plugin)) {
  6081. installedPlugins.add(plugin);
  6082. plugin(app, ...options);
  6083. } else {
  6084. warn$1(
  6085. `A plugin must either be a function or an object with an "install" function.`
  6086. );
  6087. }
  6088. return app;
  6089. },
  6090. mixin(mixin) {
  6091. {
  6092. if (!context.mixins.includes(mixin)) {
  6093. context.mixins.push(mixin);
  6094. } else {
  6095. warn$1(
  6096. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6097. );
  6098. }
  6099. }
  6100. return app;
  6101. },
  6102. component(name, component) {
  6103. {
  6104. validateComponentName(name, context.config);
  6105. }
  6106. if (!component) {
  6107. return context.components[name];
  6108. }
  6109. if (context.components[name]) {
  6110. warn$1(`Component "${name}" has already been registered in target app.`);
  6111. }
  6112. context.components[name] = component;
  6113. return app;
  6114. },
  6115. directive(name, directive) {
  6116. {
  6117. validateDirectiveName(name);
  6118. }
  6119. if (!directive) {
  6120. return context.directives[name];
  6121. }
  6122. if (context.directives[name]) {
  6123. warn$1(`Directive "${name}" has already been registered in target app.`);
  6124. }
  6125. context.directives[name] = directive;
  6126. return app;
  6127. },
  6128. mount(rootContainer, isHydrate, namespace) {
  6129. if (!isMounted) {
  6130. if (rootContainer.__vue_app__) {
  6131. warn$1(
  6132. `There is already an app instance mounted on the host container.
  6133. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6134. );
  6135. }
  6136. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6137. vnode.appContext = context;
  6138. if (namespace === true) {
  6139. namespace = "svg";
  6140. } else if (namespace === false) {
  6141. namespace = void 0;
  6142. }
  6143. {
  6144. context.reload = () => {
  6145. const cloned = cloneVNode(vnode);
  6146. cloned.el = null;
  6147. render(cloned, rootContainer, namespace);
  6148. };
  6149. }
  6150. if (isHydrate && hydrate) {
  6151. hydrate(vnode, rootContainer);
  6152. } else {
  6153. render(vnode, rootContainer, namespace);
  6154. }
  6155. isMounted = true;
  6156. app._container = rootContainer;
  6157. rootContainer.__vue_app__ = app;
  6158. {
  6159. app._instance = vnode.component;
  6160. devtoolsInitApp(app, version);
  6161. }
  6162. return getComponentPublicInstance(vnode.component);
  6163. } else {
  6164. warn$1(
  6165. `App has already been mounted.
  6166. 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)\``
  6167. );
  6168. }
  6169. },
  6170. onUnmount(cleanupFn) {
  6171. if (typeof cleanupFn !== "function") {
  6172. warn$1(
  6173. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6174. );
  6175. }
  6176. pluginCleanupFns.push(cleanupFn);
  6177. },
  6178. unmount() {
  6179. if (isMounted) {
  6180. callWithAsyncErrorHandling(
  6181. pluginCleanupFns,
  6182. app._instance,
  6183. 16
  6184. );
  6185. render(null, app._container);
  6186. {
  6187. app._instance = null;
  6188. devtoolsUnmountApp(app);
  6189. }
  6190. delete app._container.__vue_app__;
  6191. } else {
  6192. warn$1(`Cannot unmount an app that is not mounted.`);
  6193. }
  6194. },
  6195. provide(key, value) {
  6196. if (key in context.provides) {
  6197. if (hasOwn(context.provides, key)) {
  6198. warn$1(
  6199. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6200. );
  6201. } else {
  6202. warn$1(
  6203. `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
  6204. );
  6205. }
  6206. }
  6207. context.provides[key] = value;
  6208. return app;
  6209. },
  6210. runWithContext(fn) {
  6211. const lastApp = currentApp;
  6212. currentApp = app;
  6213. try {
  6214. return fn();
  6215. } finally {
  6216. currentApp = lastApp;
  6217. }
  6218. }
  6219. };
  6220. return app;
  6221. };
  6222. }
  6223. let currentApp = null;
  6224. function provide(key, value) {
  6225. if (!currentInstance) {
  6226. {
  6227. warn$1(`provide() can only be used inside setup().`);
  6228. }
  6229. } else {
  6230. let provides = currentInstance.provides;
  6231. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  6232. if (parentProvides === provides) {
  6233. provides = currentInstance.provides = Object.create(parentProvides);
  6234. }
  6235. provides[key] = value;
  6236. }
  6237. }
  6238. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  6239. const instance = getCurrentInstance();
  6240. if (instance || currentApp) {
  6241. let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  6242. if (provides && key in provides) {
  6243. return provides[key];
  6244. } else if (arguments.length > 1) {
  6245. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  6246. } else {
  6247. warn$1(`injection "${String(key)}" not found.`);
  6248. }
  6249. } else {
  6250. warn$1(`inject() can only be used inside setup() or functional components.`);
  6251. }
  6252. }
  6253. function hasInjectionContext() {
  6254. return !!(getCurrentInstance() || currentApp);
  6255. }
  6256. const internalObjectProto = {};
  6257. const createInternalObject = () => Object.create(internalObjectProto);
  6258. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  6259. function initProps(instance, rawProps, isStateful, isSSR = false) {
  6260. const props = {};
  6261. const attrs = createInternalObject();
  6262. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  6263. setFullProps(instance, rawProps, props, attrs);
  6264. for (const key in instance.propsOptions[0]) {
  6265. if (!(key in props)) {
  6266. props[key] = void 0;
  6267. }
  6268. }
  6269. {
  6270. validateProps(rawProps || {}, props, instance);
  6271. }
  6272. if (isStateful) {
  6273. instance.props = isSSR ? props : shallowReactive(props);
  6274. } else {
  6275. if (!instance.type.props) {
  6276. instance.props = attrs;
  6277. } else {
  6278. instance.props = props;
  6279. }
  6280. }
  6281. instance.attrs = attrs;
  6282. }
  6283. function isInHmrContext(instance) {
  6284. while (instance) {
  6285. if (instance.type.__hmrId) return true;
  6286. instance = instance.parent;
  6287. }
  6288. }
  6289. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  6290. const {
  6291. props,
  6292. attrs,
  6293. vnode: { patchFlag }
  6294. } = instance;
  6295. const rawCurrentProps = toRaw(props);
  6296. const [options] = instance.propsOptions;
  6297. let hasAttrsChanged = false;
  6298. if (
  6299. // always force full diff in dev
  6300. // - #1942 if hmr is enabled with sfc component
  6301. // - vite#872 non-sfc component used by sfc component
  6302. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  6303. ) {
  6304. if (patchFlag & 8) {
  6305. const propsToUpdate = instance.vnode.dynamicProps;
  6306. for (let i = 0; i < propsToUpdate.length; i++) {
  6307. let key = propsToUpdate[i];
  6308. if (isEmitListener(instance.emitsOptions, key)) {
  6309. continue;
  6310. }
  6311. const value = rawProps[key];
  6312. if (options) {
  6313. if (hasOwn(attrs, key)) {
  6314. if (value !== attrs[key]) {
  6315. attrs[key] = value;
  6316. hasAttrsChanged = true;
  6317. }
  6318. } else {
  6319. const camelizedKey = camelize(key);
  6320. props[camelizedKey] = resolvePropValue(
  6321. options,
  6322. rawCurrentProps,
  6323. camelizedKey,
  6324. value,
  6325. instance,
  6326. false
  6327. );
  6328. }
  6329. } else {
  6330. if (value !== attrs[key]) {
  6331. attrs[key] = value;
  6332. hasAttrsChanged = true;
  6333. }
  6334. }
  6335. }
  6336. }
  6337. } else {
  6338. if (setFullProps(instance, rawProps, props, attrs)) {
  6339. hasAttrsChanged = true;
  6340. }
  6341. let kebabKey;
  6342. for (const key in rawCurrentProps) {
  6343. if (!rawProps || // for camelCase
  6344. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  6345. // and converted to camelCase (#955)
  6346. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  6347. if (options) {
  6348. if (rawPrevProps && // for camelCase
  6349. (rawPrevProps[key] !== void 0 || // for kebab-case
  6350. rawPrevProps[kebabKey] !== void 0)) {
  6351. props[key] = resolvePropValue(
  6352. options,
  6353. rawCurrentProps,
  6354. key,
  6355. void 0,
  6356. instance,
  6357. true
  6358. );
  6359. }
  6360. } else {
  6361. delete props[key];
  6362. }
  6363. }
  6364. }
  6365. if (attrs !== rawCurrentProps) {
  6366. for (const key in attrs) {
  6367. if (!rawProps || !hasOwn(rawProps, key) && true) {
  6368. delete attrs[key];
  6369. hasAttrsChanged = true;
  6370. }
  6371. }
  6372. }
  6373. }
  6374. if (hasAttrsChanged) {
  6375. trigger(instance.attrs, "set", "");
  6376. }
  6377. {
  6378. validateProps(rawProps || {}, props, instance);
  6379. }
  6380. }
  6381. function setFullProps(instance, rawProps, props, attrs) {
  6382. const [options, needCastKeys] = instance.propsOptions;
  6383. let hasAttrsChanged = false;
  6384. let rawCastValues;
  6385. if (rawProps) {
  6386. for (let key in rawProps) {
  6387. if (isReservedProp(key)) {
  6388. continue;
  6389. }
  6390. const value = rawProps[key];
  6391. let camelKey;
  6392. if (options && hasOwn(options, camelKey = camelize(key))) {
  6393. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  6394. props[camelKey] = value;
  6395. } else {
  6396. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  6397. }
  6398. } else if (!isEmitListener(instance.emitsOptions, key)) {
  6399. if (!(key in attrs) || value !== attrs[key]) {
  6400. attrs[key] = value;
  6401. hasAttrsChanged = true;
  6402. }
  6403. }
  6404. }
  6405. }
  6406. if (needCastKeys) {
  6407. const rawCurrentProps = toRaw(props);
  6408. const castValues = rawCastValues || EMPTY_OBJ;
  6409. for (let i = 0; i < needCastKeys.length; i++) {
  6410. const key = needCastKeys[i];
  6411. props[key] = resolvePropValue(
  6412. options,
  6413. rawCurrentProps,
  6414. key,
  6415. castValues[key],
  6416. instance,
  6417. !hasOwn(castValues, key)
  6418. );
  6419. }
  6420. }
  6421. return hasAttrsChanged;
  6422. }
  6423. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  6424. const opt = options[key];
  6425. if (opt != null) {
  6426. const hasDefault = hasOwn(opt, "default");
  6427. if (hasDefault && value === void 0) {
  6428. const defaultValue = opt.default;
  6429. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  6430. const { propsDefaults } = instance;
  6431. if (key in propsDefaults) {
  6432. value = propsDefaults[key];
  6433. } else {
  6434. const reset = setCurrentInstance(instance);
  6435. value = propsDefaults[key] = defaultValue.call(
  6436. null,
  6437. props
  6438. );
  6439. reset();
  6440. }
  6441. } else {
  6442. value = defaultValue;
  6443. }
  6444. if (instance.ce) {
  6445. instance.ce._setProp(key, value);
  6446. }
  6447. }
  6448. if (opt[0 /* shouldCast */]) {
  6449. if (isAbsent && !hasDefault) {
  6450. value = false;
  6451. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  6452. value = true;
  6453. }
  6454. }
  6455. }
  6456. return value;
  6457. }
  6458. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  6459. function normalizePropsOptions(comp, appContext, asMixin = false) {
  6460. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  6461. const cached = cache.get(comp);
  6462. if (cached) {
  6463. return cached;
  6464. }
  6465. const raw = comp.props;
  6466. const normalized = {};
  6467. const needCastKeys = [];
  6468. let hasExtends = false;
  6469. if (!isFunction(comp)) {
  6470. const extendProps = (raw2) => {
  6471. hasExtends = true;
  6472. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  6473. extend(normalized, props);
  6474. if (keys) needCastKeys.push(...keys);
  6475. };
  6476. if (!asMixin && appContext.mixins.length) {
  6477. appContext.mixins.forEach(extendProps);
  6478. }
  6479. if (comp.extends) {
  6480. extendProps(comp.extends);
  6481. }
  6482. if (comp.mixins) {
  6483. comp.mixins.forEach(extendProps);
  6484. }
  6485. }
  6486. if (!raw && !hasExtends) {
  6487. if (isObject(comp)) {
  6488. cache.set(comp, EMPTY_ARR);
  6489. }
  6490. return EMPTY_ARR;
  6491. }
  6492. if (isArray(raw)) {
  6493. for (let i = 0; i < raw.length; i++) {
  6494. if (!isString(raw[i])) {
  6495. warn$1(`props must be strings when using array syntax.`, raw[i]);
  6496. }
  6497. const normalizedKey = camelize(raw[i]);
  6498. if (validatePropName(normalizedKey)) {
  6499. normalized[normalizedKey] = EMPTY_OBJ;
  6500. }
  6501. }
  6502. } else if (raw) {
  6503. if (!isObject(raw)) {
  6504. warn$1(`invalid props options`, raw);
  6505. }
  6506. for (const key in raw) {
  6507. const normalizedKey = camelize(key);
  6508. if (validatePropName(normalizedKey)) {
  6509. const opt = raw[key];
  6510. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  6511. const propType = prop.type;
  6512. let shouldCast = false;
  6513. let shouldCastTrue = true;
  6514. if (isArray(propType)) {
  6515. for (let index = 0; index < propType.length; ++index) {
  6516. const type = propType[index];
  6517. const typeName = isFunction(type) && type.name;
  6518. if (typeName === "Boolean") {
  6519. shouldCast = true;
  6520. break;
  6521. } else if (typeName === "String") {
  6522. shouldCastTrue = false;
  6523. }
  6524. }
  6525. } else {
  6526. shouldCast = isFunction(propType) && propType.name === "Boolean";
  6527. }
  6528. prop[0 /* shouldCast */] = shouldCast;
  6529. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  6530. if (shouldCast || hasOwn(prop, "default")) {
  6531. needCastKeys.push(normalizedKey);
  6532. }
  6533. }
  6534. }
  6535. }
  6536. const res = [normalized, needCastKeys];
  6537. if (isObject(comp)) {
  6538. cache.set(comp, res);
  6539. }
  6540. return res;
  6541. }
  6542. function validatePropName(key) {
  6543. if (key[0] !== "$" && !isReservedProp(key)) {
  6544. return true;
  6545. } else {
  6546. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  6547. }
  6548. return false;
  6549. }
  6550. function getType(ctor) {
  6551. if (ctor === null) {
  6552. return "null";
  6553. }
  6554. if (typeof ctor === "function") {
  6555. return ctor.name || "";
  6556. } else if (typeof ctor === "object") {
  6557. const name = ctor.constructor && ctor.constructor.name;
  6558. return name || "";
  6559. }
  6560. return "";
  6561. }
  6562. function validateProps(rawProps, props, instance) {
  6563. const resolvedValues = toRaw(props);
  6564. const options = instance.propsOptions[0];
  6565. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  6566. for (const key in options) {
  6567. let opt = options[key];
  6568. if (opt == null) continue;
  6569. validateProp(
  6570. key,
  6571. resolvedValues[key],
  6572. opt,
  6573. shallowReadonly(resolvedValues) ,
  6574. !camelizePropsKey.includes(key)
  6575. );
  6576. }
  6577. }
  6578. function validateProp(name, value, prop, props, isAbsent) {
  6579. const { type, required, validator, skipCheck } = prop;
  6580. if (required && isAbsent) {
  6581. warn$1('Missing required prop: "' + name + '"');
  6582. return;
  6583. }
  6584. if (value == null && !required) {
  6585. return;
  6586. }
  6587. if (type != null && type !== true && !skipCheck) {
  6588. let isValid = false;
  6589. const types = isArray(type) ? type : [type];
  6590. const expectedTypes = [];
  6591. for (let i = 0; i < types.length && !isValid; i++) {
  6592. const { valid, expectedType } = assertType(value, types[i]);
  6593. expectedTypes.push(expectedType || "");
  6594. isValid = valid;
  6595. }
  6596. if (!isValid) {
  6597. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  6598. return;
  6599. }
  6600. }
  6601. if (validator && !validator(value, props)) {
  6602. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  6603. }
  6604. }
  6605. const isSimpleType = /* @__PURE__ */ makeMap(
  6606. "String,Number,Boolean,Function,Symbol,BigInt"
  6607. );
  6608. function assertType(value, type) {
  6609. let valid;
  6610. const expectedType = getType(type);
  6611. if (expectedType === "null") {
  6612. valid = value === null;
  6613. } else if (isSimpleType(expectedType)) {
  6614. const t = typeof value;
  6615. valid = t === expectedType.toLowerCase();
  6616. if (!valid && t === "object") {
  6617. valid = value instanceof type;
  6618. }
  6619. } else if (expectedType === "Object") {
  6620. valid = isObject(value);
  6621. } else if (expectedType === "Array") {
  6622. valid = isArray(value);
  6623. } else {
  6624. valid = value instanceof type;
  6625. }
  6626. return {
  6627. valid,
  6628. expectedType
  6629. };
  6630. }
  6631. function getInvalidTypeMessage(name, value, expectedTypes) {
  6632. if (expectedTypes.length === 0) {
  6633. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  6634. }
  6635. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  6636. const expectedType = expectedTypes[0];
  6637. const receivedType = toRawType(value);
  6638. const expectedValue = styleValue(value, expectedType);
  6639. const receivedValue = styleValue(value, receivedType);
  6640. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  6641. message += ` with value ${expectedValue}`;
  6642. }
  6643. message += `, got ${receivedType} `;
  6644. if (isExplicable(receivedType)) {
  6645. message += `with value ${receivedValue}.`;
  6646. }
  6647. return message;
  6648. }
  6649. function styleValue(value, type) {
  6650. if (type === "String") {
  6651. return `"${value}"`;
  6652. } else if (type === "Number") {
  6653. return `${Number(value)}`;
  6654. } else {
  6655. return `${value}`;
  6656. }
  6657. }
  6658. function isExplicable(type) {
  6659. const explicitTypes = ["string", "number", "boolean"];
  6660. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  6661. }
  6662. function isBoolean(...args) {
  6663. return args.some((elem) => elem.toLowerCase() === "boolean");
  6664. }
  6665. const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
  6666. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  6667. const normalizeSlot = (key, rawSlot, ctx) => {
  6668. if (rawSlot._n) {
  6669. return rawSlot;
  6670. }
  6671. const normalized = withCtx((...args) => {
  6672. if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
  6673. warn$1(
  6674. `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
  6675. );
  6676. }
  6677. return normalizeSlotValue(rawSlot(...args));
  6678. }, ctx);
  6679. normalized._c = false;
  6680. return normalized;
  6681. };
  6682. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  6683. const ctx = rawSlots._ctx;
  6684. for (const key in rawSlots) {
  6685. if (isInternalKey(key)) continue;
  6686. const value = rawSlots[key];
  6687. if (isFunction(value)) {
  6688. slots[key] = normalizeSlot(key, value, ctx);
  6689. } else if (value != null) {
  6690. {
  6691. warn$1(
  6692. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  6693. );
  6694. }
  6695. const normalized = normalizeSlotValue(value);
  6696. slots[key] = () => normalized;
  6697. }
  6698. }
  6699. };
  6700. const normalizeVNodeSlots = (instance, children) => {
  6701. if (!isKeepAlive(instance.vnode) && true) {
  6702. warn$1(
  6703. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  6704. );
  6705. }
  6706. const normalized = normalizeSlotValue(children);
  6707. instance.slots.default = () => normalized;
  6708. };
  6709. const assignSlots = (slots, children, optimized) => {
  6710. for (const key in children) {
  6711. if (optimized || !isInternalKey(key)) {
  6712. slots[key] = children[key];
  6713. }
  6714. }
  6715. };
  6716. const initSlots = (instance, children, optimized) => {
  6717. const slots = instance.slots = createInternalObject();
  6718. if (instance.vnode.shapeFlag & 32) {
  6719. const type = children._;
  6720. if (type) {
  6721. assignSlots(slots, children, optimized);
  6722. if (optimized) {
  6723. def(slots, "_", type, true);
  6724. }
  6725. } else {
  6726. normalizeObjectSlots(children, slots);
  6727. }
  6728. } else if (children) {
  6729. normalizeVNodeSlots(instance, children);
  6730. }
  6731. };
  6732. const updateSlots = (instance, children, optimized) => {
  6733. const { vnode, slots } = instance;
  6734. let needDeletionCheck = true;
  6735. let deletionComparisonTarget = EMPTY_OBJ;
  6736. if (vnode.shapeFlag & 32) {
  6737. const type = children._;
  6738. if (type) {
  6739. if (isHmrUpdating) {
  6740. assignSlots(slots, children, optimized);
  6741. trigger(instance, "set", "$slots");
  6742. } else if (optimized && type === 1) {
  6743. needDeletionCheck = false;
  6744. } else {
  6745. assignSlots(slots, children, optimized);
  6746. }
  6747. } else {
  6748. needDeletionCheck = !children.$stable;
  6749. normalizeObjectSlots(children, slots);
  6750. }
  6751. deletionComparisonTarget = children;
  6752. } else if (children) {
  6753. normalizeVNodeSlots(instance, children);
  6754. deletionComparisonTarget = { default: 1 };
  6755. }
  6756. if (needDeletionCheck) {
  6757. for (const key in slots) {
  6758. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6759. delete slots[key];
  6760. }
  6761. }
  6762. }
  6763. };
  6764. let supported;
  6765. let perf;
  6766. function startMeasure(instance, type) {
  6767. if (instance.appContext.config.performance && isSupported()) {
  6768. perf.mark(`vue-${type}-${instance.uid}`);
  6769. }
  6770. {
  6771. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6772. }
  6773. }
  6774. function endMeasure(instance, type) {
  6775. if (instance.appContext.config.performance && isSupported()) {
  6776. const startTag = `vue-${type}-${instance.uid}`;
  6777. const endTag = startTag + `:end`;
  6778. const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
  6779. perf.mark(endTag);
  6780. perf.measure(measureName, startTag, endTag);
  6781. perf.clearMeasures(measureName);
  6782. perf.clearMarks(startTag);
  6783. perf.clearMarks(endTag);
  6784. }
  6785. {
  6786. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6787. }
  6788. }
  6789. function isSupported() {
  6790. if (supported !== void 0) {
  6791. return supported;
  6792. }
  6793. if (typeof window !== "undefined" && window.performance) {
  6794. supported = true;
  6795. perf = window.performance;
  6796. } else {
  6797. supported = false;
  6798. }
  6799. return supported;
  6800. }
  6801. const queuePostRenderEffect = queueEffectWithSuspense ;
  6802. function createRenderer(options) {
  6803. return baseCreateRenderer(options);
  6804. }
  6805. function createHydrationRenderer(options) {
  6806. return baseCreateRenderer(options, createHydrationFunctions);
  6807. }
  6808. function baseCreateRenderer(options, createHydrationFns) {
  6809. const target = getGlobalThis();
  6810. target.__VUE__ = true;
  6811. {
  6812. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6813. }
  6814. const {
  6815. insert: hostInsert,
  6816. remove: hostRemove,
  6817. patchProp: hostPatchProp,
  6818. createElement: hostCreateElement,
  6819. createText: hostCreateText,
  6820. createComment: hostCreateComment,
  6821. setText: hostSetText,
  6822. setElementText: hostSetElementText,
  6823. parentNode: hostParentNode,
  6824. nextSibling: hostNextSibling,
  6825. setScopeId: hostSetScopeId = NOOP,
  6826. insertStaticContent: hostInsertStaticContent
  6827. } = options;
  6828. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6829. if (n1 === n2) {
  6830. return;
  6831. }
  6832. if (n1 && !isSameVNodeType(n1, n2)) {
  6833. anchor = getNextHostNode(n1);
  6834. unmount(n1, parentComponent, parentSuspense, true);
  6835. n1 = null;
  6836. }
  6837. if (n2.patchFlag === -2) {
  6838. optimized = false;
  6839. n2.dynamicChildren = null;
  6840. }
  6841. const { type, ref, shapeFlag } = n2;
  6842. switch (type) {
  6843. case Text:
  6844. processText(n1, n2, container, anchor);
  6845. break;
  6846. case Comment:
  6847. processCommentNode(n1, n2, container, anchor);
  6848. break;
  6849. case Static:
  6850. if (n1 == null) {
  6851. mountStaticNode(n2, container, anchor, namespace);
  6852. } else {
  6853. patchStaticNode(n1, n2, container, namespace);
  6854. }
  6855. break;
  6856. case Fragment:
  6857. processFragment(
  6858. n1,
  6859. n2,
  6860. container,
  6861. anchor,
  6862. parentComponent,
  6863. parentSuspense,
  6864. namespace,
  6865. slotScopeIds,
  6866. optimized
  6867. );
  6868. break;
  6869. default:
  6870. if (shapeFlag & 1) {
  6871. processElement(
  6872. n1,
  6873. n2,
  6874. container,
  6875. anchor,
  6876. parentComponent,
  6877. parentSuspense,
  6878. namespace,
  6879. slotScopeIds,
  6880. optimized
  6881. );
  6882. } else if (shapeFlag & 6) {
  6883. processComponent(
  6884. n1,
  6885. n2,
  6886. container,
  6887. anchor,
  6888. parentComponent,
  6889. parentSuspense,
  6890. namespace,
  6891. slotScopeIds,
  6892. optimized
  6893. );
  6894. } else if (shapeFlag & 64) {
  6895. type.process(
  6896. n1,
  6897. n2,
  6898. container,
  6899. anchor,
  6900. parentComponent,
  6901. parentSuspense,
  6902. namespace,
  6903. slotScopeIds,
  6904. optimized,
  6905. internals
  6906. );
  6907. } else if (shapeFlag & 128) {
  6908. type.process(
  6909. n1,
  6910. n2,
  6911. container,
  6912. anchor,
  6913. parentComponent,
  6914. parentSuspense,
  6915. namespace,
  6916. slotScopeIds,
  6917. optimized,
  6918. internals
  6919. );
  6920. } else {
  6921. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6922. }
  6923. }
  6924. if (ref != null && parentComponent) {
  6925. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6926. } else if (ref == null && n1 && n1.ref != null) {
  6927. setRef(n1.ref, null, parentSuspense, n1, true);
  6928. }
  6929. };
  6930. const processText = (n1, n2, container, anchor) => {
  6931. if (n1 == null) {
  6932. hostInsert(
  6933. n2.el = hostCreateText(n2.children),
  6934. container,
  6935. anchor
  6936. );
  6937. } else {
  6938. const el = n2.el = n1.el;
  6939. if (n2.children !== n1.children) {
  6940. hostSetText(el, n2.children);
  6941. }
  6942. }
  6943. };
  6944. const processCommentNode = (n1, n2, container, anchor) => {
  6945. if (n1 == null) {
  6946. hostInsert(
  6947. n2.el = hostCreateComment(n2.children || ""),
  6948. container,
  6949. anchor
  6950. );
  6951. } else {
  6952. n2.el = n1.el;
  6953. }
  6954. };
  6955. const mountStaticNode = (n2, container, anchor, namespace) => {
  6956. [n2.el, n2.anchor] = hostInsertStaticContent(
  6957. n2.children,
  6958. container,
  6959. anchor,
  6960. namespace,
  6961. n2.el,
  6962. n2.anchor
  6963. );
  6964. };
  6965. const patchStaticNode = (n1, n2, container, namespace) => {
  6966. if (n2.children !== n1.children) {
  6967. const anchor = hostNextSibling(n1.anchor);
  6968. removeStaticNode(n1);
  6969. [n2.el, n2.anchor] = hostInsertStaticContent(
  6970. n2.children,
  6971. container,
  6972. anchor,
  6973. namespace
  6974. );
  6975. } else {
  6976. n2.el = n1.el;
  6977. n2.anchor = n1.anchor;
  6978. }
  6979. };
  6980. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6981. let next;
  6982. while (el && el !== anchor) {
  6983. next = hostNextSibling(el);
  6984. hostInsert(el, container, nextSibling);
  6985. el = next;
  6986. }
  6987. hostInsert(anchor, container, nextSibling);
  6988. };
  6989. const removeStaticNode = ({ el, anchor }) => {
  6990. let next;
  6991. while (el && el !== anchor) {
  6992. next = hostNextSibling(el);
  6993. hostRemove(el);
  6994. el = next;
  6995. }
  6996. hostRemove(anchor);
  6997. };
  6998. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6999. if (n2.type === "svg") {
  7000. namespace = "svg";
  7001. } else if (n2.type === "math") {
  7002. namespace = "mathml";
  7003. }
  7004. if (n1 == null) {
  7005. mountElement(
  7006. n2,
  7007. container,
  7008. anchor,
  7009. parentComponent,
  7010. parentSuspense,
  7011. namespace,
  7012. slotScopeIds,
  7013. optimized
  7014. );
  7015. } else {
  7016. patchElement(
  7017. n1,
  7018. n2,
  7019. parentComponent,
  7020. parentSuspense,
  7021. namespace,
  7022. slotScopeIds,
  7023. optimized
  7024. );
  7025. }
  7026. };
  7027. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7028. let el;
  7029. let vnodeHook;
  7030. const { props, shapeFlag, transition, dirs } = vnode;
  7031. el = vnode.el = hostCreateElement(
  7032. vnode.type,
  7033. namespace,
  7034. props && props.is,
  7035. props
  7036. );
  7037. if (shapeFlag & 8) {
  7038. hostSetElementText(el, vnode.children);
  7039. } else if (shapeFlag & 16) {
  7040. mountChildren(
  7041. vnode.children,
  7042. el,
  7043. null,
  7044. parentComponent,
  7045. parentSuspense,
  7046. resolveChildrenNamespace(vnode, namespace),
  7047. slotScopeIds,
  7048. optimized
  7049. );
  7050. }
  7051. if (dirs) {
  7052. invokeDirectiveHook(vnode, null, parentComponent, "created");
  7053. }
  7054. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  7055. if (props) {
  7056. for (const key in props) {
  7057. if (key !== "value" && !isReservedProp(key)) {
  7058. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  7059. }
  7060. }
  7061. if ("value" in props) {
  7062. hostPatchProp(el, "value", null, props.value, namespace);
  7063. }
  7064. if (vnodeHook = props.onVnodeBeforeMount) {
  7065. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7066. }
  7067. }
  7068. {
  7069. def(el, "__vnode", vnode, true);
  7070. def(el, "__vueParentComponent", parentComponent, true);
  7071. }
  7072. if (dirs) {
  7073. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  7074. }
  7075. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  7076. if (needCallTransitionHooks) {
  7077. transition.beforeEnter(el);
  7078. }
  7079. hostInsert(el, container, anchor);
  7080. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  7081. queuePostRenderEffect(() => {
  7082. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7083. needCallTransitionHooks && transition.enter(el);
  7084. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  7085. }, parentSuspense);
  7086. }
  7087. };
  7088. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  7089. if (scopeId) {
  7090. hostSetScopeId(el, scopeId);
  7091. }
  7092. if (slotScopeIds) {
  7093. for (let i = 0; i < slotScopeIds.length; i++) {
  7094. hostSetScopeId(el, slotScopeIds[i]);
  7095. }
  7096. }
  7097. if (parentComponent) {
  7098. let subTree = parentComponent.subTree;
  7099. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7100. subTree = filterSingleRoot(subTree.children) || subTree;
  7101. }
  7102. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  7103. const parentVNode = parentComponent.vnode;
  7104. setScopeId(
  7105. el,
  7106. parentVNode,
  7107. parentVNode.scopeId,
  7108. parentVNode.slotScopeIds,
  7109. parentComponent.parent
  7110. );
  7111. }
  7112. }
  7113. };
  7114. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7115. for (let i = start; i < children.length; i++) {
  7116. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7117. patch(
  7118. null,
  7119. child,
  7120. container,
  7121. anchor,
  7122. parentComponent,
  7123. parentSuspense,
  7124. namespace,
  7125. slotScopeIds,
  7126. optimized
  7127. );
  7128. }
  7129. };
  7130. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7131. const el = n2.el = n1.el;
  7132. {
  7133. el.__vnode = n2;
  7134. }
  7135. let { patchFlag, dynamicChildren, dirs } = n2;
  7136. patchFlag |= n1.patchFlag & 16;
  7137. const oldProps = n1.props || EMPTY_OBJ;
  7138. const newProps = n2.props || EMPTY_OBJ;
  7139. let vnodeHook;
  7140. parentComponent && toggleRecurse(parentComponent, false);
  7141. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7142. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7143. }
  7144. if (dirs) {
  7145. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7146. }
  7147. parentComponent && toggleRecurse(parentComponent, true);
  7148. if (isHmrUpdating) {
  7149. patchFlag = 0;
  7150. optimized = false;
  7151. dynamicChildren = null;
  7152. }
  7153. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7154. hostSetElementText(el, "");
  7155. }
  7156. if (dynamicChildren) {
  7157. patchBlockChildren(
  7158. n1.dynamicChildren,
  7159. dynamicChildren,
  7160. el,
  7161. parentComponent,
  7162. parentSuspense,
  7163. resolveChildrenNamespace(n2, namespace),
  7164. slotScopeIds
  7165. );
  7166. {
  7167. traverseStaticChildren(n1, n2);
  7168. }
  7169. } else if (!optimized) {
  7170. patchChildren(
  7171. n1,
  7172. n2,
  7173. el,
  7174. null,
  7175. parentComponent,
  7176. parentSuspense,
  7177. resolveChildrenNamespace(n2, namespace),
  7178. slotScopeIds,
  7179. false
  7180. );
  7181. }
  7182. if (patchFlag > 0) {
  7183. if (patchFlag & 16) {
  7184. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7185. } else {
  7186. if (patchFlag & 2) {
  7187. if (oldProps.class !== newProps.class) {
  7188. hostPatchProp(el, "class", null, newProps.class, namespace);
  7189. }
  7190. }
  7191. if (patchFlag & 4) {
  7192. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7193. }
  7194. if (patchFlag & 8) {
  7195. const propsToUpdate = n2.dynamicProps;
  7196. for (let i = 0; i < propsToUpdate.length; i++) {
  7197. const key = propsToUpdate[i];
  7198. const prev = oldProps[key];
  7199. const next = newProps[key];
  7200. if (next !== prev || key === "value") {
  7201. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7202. }
  7203. }
  7204. }
  7205. }
  7206. if (patchFlag & 1) {
  7207. if (n1.children !== n2.children) {
  7208. hostSetElementText(el, n2.children);
  7209. }
  7210. }
  7211. } else if (!optimized && dynamicChildren == null) {
  7212. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7213. }
  7214. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7215. queuePostRenderEffect(() => {
  7216. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7217. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7218. }, parentSuspense);
  7219. }
  7220. };
  7221. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7222. for (let i = 0; i < newChildren.length; i++) {
  7223. const oldVNode = oldChildren[i];
  7224. const newVNode = newChildren[i];
  7225. const container = (
  7226. // oldVNode may be an errored async setup() component inside Suspense
  7227. // which will not have a mounted element
  7228. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7229. // of the Fragment itself so it can move its children.
  7230. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7231. // which also requires the correct parent container
  7232. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7233. oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
  7234. // In other cases, the parent container is not actually used so we
  7235. // just pass the block element here to avoid a DOM parentNode call.
  7236. fallbackContainer
  7237. )
  7238. );
  7239. patch(
  7240. oldVNode,
  7241. newVNode,
  7242. container,
  7243. null,
  7244. parentComponent,
  7245. parentSuspense,
  7246. namespace,
  7247. slotScopeIds,
  7248. true
  7249. );
  7250. }
  7251. };
  7252. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  7253. if (oldProps !== newProps) {
  7254. if (oldProps !== EMPTY_OBJ) {
  7255. for (const key in oldProps) {
  7256. if (!isReservedProp(key) && !(key in newProps)) {
  7257. hostPatchProp(
  7258. el,
  7259. key,
  7260. oldProps[key],
  7261. null,
  7262. namespace,
  7263. parentComponent
  7264. );
  7265. }
  7266. }
  7267. }
  7268. for (const key in newProps) {
  7269. if (isReservedProp(key)) continue;
  7270. const next = newProps[key];
  7271. const prev = oldProps[key];
  7272. if (next !== prev && key !== "value") {
  7273. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7274. }
  7275. }
  7276. if ("value" in newProps) {
  7277. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7278. }
  7279. }
  7280. };
  7281. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7282. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7283. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7284. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7285. if (
  7286. // #5523 dev root fragment may inherit directives
  7287. isHmrUpdating || patchFlag & 2048
  7288. ) {
  7289. patchFlag = 0;
  7290. optimized = false;
  7291. dynamicChildren = null;
  7292. }
  7293. if (fragmentSlotScopeIds) {
  7294. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7295. }
  7296. if (n1 == null) {
  7297. hostInsert(fragmentStartAnchor, container, anchor);
  7298. hostInsert(fragmentEndAnchor, container, anchor);
  7299. mountChildren(
  7300. // #10007
  7301. // such fragment like `<></>` will be compiled into
  7302. // a fragment which doesn't have a children.
  7303. // In this case fallback to an empty array
  7304. n2.children || [],
  7305. container,
  7306. fragmentEndAnchor,
  7307. parentComponent,
  7308. parentSuspense,
  7309. namespace,
  7310. slotScopeIds,
  7311. optimized
  7312. );
  7313. } else {
  7314. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7315. // of renderSlot() with no valid children
  7316. n1.dynamicChildren) {
  7317. patchBlockChildren(
  7318. n1.dynamicChildren,
  7319. dynamicChildren,
  7320. container,
  7321. parentComponent,
  7322. parentSuspense,
  7323. namespace,
  7324. slotScopeIds
  7325. );
  7326. {
  7327. traverseStaticChildren(n1, n2);
  7328. }
  7329. } else {
  7330. patchChildren(
  7331. n1,
  7332. n2,
  7333. container,
  7334. fragmentEndAnchor,
  7335. parentComponent,
  7336. parentSuspense,
  7337. namespace,
  7338. slotScopeIds,
  7339. optimized
  7340. );
  7341. }
  7342. }
  7343. };
  7344. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7345. n2.slotScopeIds = slotScopeIds;
  7346. if (n1 == null) {
  7347. if (n2.shapeFlag & 512) {
  7348. parentComponent.ctx.activate(
  7349. n2,
  7350. container,
  7351. anchor,
  7352. namespace,
  7353. optimized
  7354. );
  7355. } else {
  7356. mountComponent(
  7357. n2,
  7358. container,
  7359. anchor,
  7360. parentComponent,
  7361. parentSuspense,
  7362. namespace,
  7363. optimized
  7364. );
  7365. }
  7366. } else {
  7367. updateComponent(n1, n2, optimized);
  7368. }
  7369. };
  7370. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7371. const instance = (initialVNode.component = createComponentInstance(
  7372. initialVNode,
  7373. parentComponent,
  7374. parentSuspense
  7375. ));
  7376. if (instance.type.__hmrId) {
  7377. registerHMR(instance);
  7378. }
  7379. {
  7380. pushWarningContext(initialVNode);
  7381. startMeasure(instance, `mount`);
  7382. }
  7383. if (isKeepAlive(initialVNode)) {
  7384. instance.ctx.renderer = internals;
  7385. }
  7386. {
  7387. {
  7388. startMeasure(instance, `init`);
  7389. }
  7390. setupComponent(instance, false, optimized);
  7391. {
  7392. endMeasure(instance, `init`);
  7393. }
  7394. }
  7395. if (isHmrUpdating) initialVNode.el = null;
  7396. if (instance.asyncDep) {
  7397. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  7398. if (!initialVNode.el) {
  7399. const placeholder = instance.subTree = createVNode(Comment);
  7400. processCommentNode(null, placeholder, container, anchor);
  7401. initialVNode.placeholder = placeholder.el;
  7402. }
  7403. } else {
  7404. setupRenderEffect(
  7405. instance,
  7406. initialVNode,
  7407. container,
  7408. anchor,
  7409. parentSuspense,
  7410. namespace,
  7411. optimized
  7412. );
  7413. }
  7414. {
  7415. popWarningContext();
  7416. endMeasure(instance, `mount`);
  7417. }
  7418. };
  7419. const updateComponent = (n1, n2, optimized) => {
  7420. const instance = n2.component = n1.component;
  7421. if (shouldUpdateComponent(n1, n2, optimized)) {
  7422. if (instance.asyncDep && !instance.asyncResolved) {
  7423. {
  7424. pushWarningContext(n2);
  7425. }
  7426. updateComponentPreRender(instance, n2, optimized);
  7427. {
  7428. popWarningContext();
  7429. }
  7430. return;
  7431. } else {
  7432. instance.next = n2;
  7433. instance.update();
  7434. }
  7435. } else {
  7436. n2.el = n1.el;
  7437. instance.vnode = n2;
  7438. }
  7439. };
  7440. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7441. const componentUpdateFn = () => {
  7442. if (!instance.isMounted) {
  7443. let vnodeHook;
  7444. const { el, props } = initialVNode;
  7445. const { bm, m, parent, root, type } = instance;
  7446. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7447. toggleRecurse(instance, false);
  7448. if (bm) {
  7449. invokeArrayFns(bm);
  7450. }
  7451. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7452. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7453. }
  7454. toggleRecurse(instance, true);
  7455. if (el && hydrateNode) {
  7456. const hydrateSubTree = () => {
  7457. {
  7458. startMeasure(instance, `render`);
  7459. }
  7460. instance.subTree = renderComponentRoot(instance);
  7461. {
  7462. endMeasure(instance, `render`);
  7463. }
  7464. {
  7465. startMeasure(instance, `hydrate`);
  7466. }
  7467. hydrateNode(
  7468. el,
  7469. instance.subTree,
  7470. instance,
  7471. parentSuspense,
  7472. null
  7473. );
  7474. {
  7475. endMeasure(instance, `hydrate`);
  7476. }
  7477. };
  7478. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  7479. type.__asyncHydrate(
  7480. el,
  7481. instance,
  7482. hydrateSubTree
  7483. );
  7484. } else {
  7485. hydrateSubTree();
  7486. }
  7487. } else {
  7488. if (root.ce && // @ts-expect-error _def is private
  7489. root.ce._def.shadowRoot !== false) {
  7490. root.ce._injectChildStyle(type);
  7491. }
  7492. {
  7493. startMeasure(instance, `render`);
  7494. }
  7495. const subTree = instance.subTree = renderComponentRoot(instance);
  7496. {
  7497. endMeasure(instance, `render`);
  7498. }
  7499. {
  7500. startMeasure(instance, `patch`);
  7501. }
  7502. patch(
  7503. null,
  7504. subTree,
  7505. container,
  7506. anchor,
  7507. instance,
  7508. parentSuspense,
  7509. namespace
  7510. );
  7511. {
  7512. endMeasure(instance, `patch`);
  7513. }
  7514. initialVNode.el = subTree.el;
  7515. }
  7516. if (m) {
  7517. queuePostRenderEffect(m, parentSuspense);
  7518. }
  7519. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7520. const scopedInitialVNode = initialVNode;
  7521. queuePostRenderEffect(
  7522. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7523. parentSuspense
  7524. );
  7525. }
  7526. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7527. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7528. }
  7529. instance.isMounted = true;
  7530. {
  7531. devtoolsComponentAdded(instance);
  7532. }
  7533. initialVNode = container = anchor = null;
  7534. } else {
  7535. let { next, bu, u, parent, vnode } = instance;
  7536. {
  7537. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7538. if (nonHydratedAsyncRoot) {
  7539. if (next) {
  7540. next.el = vnode.el;
  7541. updateComponentPreRender(instance, next, optimized);
  7542. }
  7543. nonHydratedAsyncRoot.asyncDep.then(() => {
  7544. if (!instance.isUnmounted) {
  7545. componentUpdateFn();
  7546. }
  7547. });
  7548. return;
  7549. }
  7550. }
  7551. let originNext = next;
  7552. let vnodeHook;
  7553. {
  7554. pushWarningContext(next || instance.vnode);
  7555. }
  7556. toggleRecurse(instance, false);
  7557. if (next) {
  7558. next.el = vnode.el;
  7559. updateComponentPreRender(instance, next, optimized);
  7560. } else {
  7561. next = vnode;
  7562. }
  7563. if (bu) {
  7564. invokeArrayFns(bu);
  7565. }
  7566. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7567. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7568. }
  7569. toggleRecurse(instance, true);
  7570. {
  7571. startMeasure(instance, `render`);
  7572. }
  7573. const nextTree = renderComponentRoot(instance);
  7574. {
  7575. endMeasure(instance, `render`);
  7576. }
  7577. const prevTree = instance.subTree;
  7578. instance.subTree = nextTree;
  7579. {
  7580. startMeasure(instance, `patch`);
  7581. }
  7582. patch(
  7583. prevTree,
  7584. nextTree,
  7585. // parent may have changed if it's in a teleport
  7586. hostParentNode(prevTree.el),
  7587. // anchor may have changed if it's in a fragment
  7588. getNextHostNode(prevTree),
  7589. instance,
  7590. parentSuspense,
  7591. namespace
  7592. );
  7593. {
  7594. endMeasure(instance, `patch`);
  7595. }
  7596. next.el = nextTree.el;
  7597. if (originNext === null) {
  7598. updateHOCHostEl(instance, nextTree.el);
  7599. }
  7600. if (u) {
  7601. queuePostRenderEffect(u, parentSuspense);
  7602. }
  7603. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7604. queuePostRenderEffect(
  7605. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7606. parentSuspense
  7607. );
  7608. }
  7609. {
  7610. devtoolsComponentUpdated(instance);
  7611. }
  7612. {
  7613. popWarningContext();
  7614. }
  7615. }
  7616. };
  7617. instance.scope.on();
  7618. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  7619. instance.scope.off();
  7620. const update = instance.update = effect.run.bind(effect);
  7621. const job = instance.job = effect.runIfDirty.bind(effect);
  7622. job.i = instance;
  7623. job.id = instance.uid;
  7624. effect.scheduler = () => queueJob(job);
  7625. toggleRecurse(instance, true);
  7626. {
  7627. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7628. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7629. }
  7630. update();
  7631. };
  7632. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7633. nextVNode.component = instance;
  7634. const prevProps = instance.vnode.props;
  7635. instance.vnode = nextVNode;
  7636. instance.next = null;
  7637. updateProps(instance, nextVNode.props, prevProps, optimized);
  7638. updateSlots(instance, nextVNode.children, optimized);
  7639. pauseTracking();
  7640. flushPreFlushCbs(instance);
  7641. resetTracking();
  7642. };
  7643. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7644. const c1 = n1 && n1.children;
  7645. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7646. const c2 = n2.children;
  7647. const { patchFlag, shapeFlag } = n2;
  7648. if (patchFlag > 0) {
  7649. if (patchFlag & 128) {
  7650. patchKeyedChildren(
  7651. c1,
  7652. c2,
  7653. container,
  7654. anchor,
  7655. parentComponent,
  7656. parentSuspense,
  7657. namespace,
  7658. slotScopeIds,
  7659. optimized
  7660. );
  7661. return;
  7662. } else if (patchFlag & 256) {
  7663. patchUnkeyedChildren(
  7664. c1,
  7665. c2,
  7666. container,
  7667. anchor,
  7668. parentComponent,
  7669. parentSuspense,
  7670. namespace,
  7671. slotScopeIds,
  7672. optimized
  7673. );
  7674. return;
  7675. }
  7676. }
  7677. if (shapeFlag & 8) {
  7678. if (prevShapeFlag & 16) {
  7679. unmountChildren(c1, parentComponent, parentSuspense);
  7680. }
  7681. if (c2 !== c1) {
  7682. hostSetElementText(container, c2);
  7683. }
  7684. } else {
  7685. if (prevShapeFlag & 16) {
  7686. if (shapeFlag & 16) {
  7687. patchKeyedChildren(
  7688. c1,
  7689. c2,
  7690. container,
  7691. anchor,
  7692. parentComponent,
  7693. parentSuspense,
  7694. namespace,
  7695. slotScopeIds,
  7696. optimized
  7697. );
  7698. } else {
  7699. unmountChildren(c1, parentComponent, parentSuspense, true);
  7700. }
  7701. } else {
  7702. if (prevShapeFlag & 8) {
  7703. hostSetElementText(container, "");
  7704. }
  7705. if (shapeFlag & 16) {
  7706. mountChildren(
  7707. c2,
  7708. container,
  7709. anchor,
  7710. parentComponent,
  7711. parentSuspense,
  7712. namespace,
  7713. slotScopeIds,
  7714. optimized
  7715. );
  7716. }
  7717. }
  7718. }
  7719. };
  7720. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7721. c1 = c1 || EMPTY_ARR;
  7722. c2 = c2 || EMPTY_ARR;
  7723. const oldLength = c1.length;
  7724. const newLength = c2.length;
  7725. const commonLength = Math.min(oldLength, newLength);
  7726. let i;
  7727. for (i = 0; i < commonLength; i++) {
  7728. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7729. patch(
  7730. c1[i],
  7731. nextChild,
  7732. container,
  7733. null,
  7734. parentComponent,
  7735. parentSuspense,
  7736. namespace,
  7737. slotScopeIds,
  7738. optimized
  7739. );
  7740. }
  7741. if (oldLength > newLength) {
  7742. unmountChildren(
  7743. c1,
  7744. parentComponent,
  7745. parentSuspense,
  7746. true,
  7747. false,
  7748. commonLength
  7749. );
  7750. } else {
  7751. mountChildren(
  7752. c2,
  7753. container,
  7754. anchor,
  7755. parentComponent,
  7756. parentSuspense,
  7757. namespace,
  7758. slotScopeIds,
  7759. optimized,
  7760. commonLength
  7761. );
  7762. }
  7763. };
  7764. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7765. let i = 0;
  7766. const l2 = c2.length;
  7767. let e1 = c1.length - 1;
  7768. let e2 = l2 - 1;
  7769. while (i <= e1 && i <= e2) {
  7770. const n1 = c1[i];
  7771. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7772. if (isSameVNodeType(n1, n2)) {
  7773. patch(
  7774. n1,
  7775. n2,
  7776. container,
  7777. null,
  7778. parentComponent,
  7779. parentSuspense,
  7780. namespace,
  7781. slotScopeIds,
  7782. optimized
  7783. );
  7784. } else {
  7785. break;
  7786. }
  7787. i++;
  7788. }
  7789. while (i <= e1 && i <= e2) {
  7790. const n1 = c1[e1];
  7791. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7792. if (isSameVNodeType(n1, n2)) {
  7793. patch(
  7794. n1,
  7795. n2,
  7796. container,
  7797. null,
  7798. parentComponent,
  7799. parentSuspense,
  7800. namespace,
  7801. slotScopeIds,
  7802. optimized
  7803. );
  7804. } else {
  7805. break;
  7806. }
  7807. e1--;
  7808. e2--;
  7809. }
  7810. if (i > e1) {
  7811. if (i <= e2) {
  7812. const nextPos = e2 + 1;
  7813. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7814. while (i <= e2) {
  7815. patch(
  7816. null,
  7817. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7818. container,
  7819. anchor,
  7820. parentComponent,
  7821. parentSuspense,
  7822. namespace,
  7823. slotScopeIds,
  7824. optimized
  7825. );
  7826. i++;
  7827. }
  7828. }
  7829. } else if (i > e2) {
  7830. while (i <= e1) {
  7831. unmount(c1[i], parentComponent, parentSuspense, true);
  7832. i++;
  7833. }
  7834. } else {
  7835. const s1 = i;
  7836. const s2 = i;
  7837. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7838. for (i = s2; i <= e2; i++) {
  7839. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7840. if (nextChild.key != null) {
  7841. if (keyToNewIndexMap.has(nextChild.key)) {
  7842. warn$1(
  7843. `Duplicate keys found during update:`,
  7844. JSON.stringify(nextChild.key),
  7845. `Make sure keys are unique.`
  7846. );
  7847. }
  7848. keyToNewIndexMap.set(nextChild.key, i);
  7849. }
  7850. }
  7851. let j;
  7852. let patched = 0;
  7853. const toBePatched = e2 - s2 + 1;
  7854. let moved = false;
  7855. let maxNewIndexSoFar = 0;
  7856. const newIndexToOldIndexMap = new Array(toBePatched);
  7857. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  7858. for (i = s1; i <= e1; i++) {
  7859. const prevChild = c1[i];
  7860. if (patched >= toBePatched) {
  7861. unmount(prevChild, parentComponent, parentSuspense, true);
  7862. continue;
  7863. }
  7864. let newIndex;
  7865. if (prevChild.key != null) {
  7866. newIndex = keyToNewIndexMap.get(prevChild.key);
  7867. } else {
  7868. for (j = s2; j <= e2; j++) {
  7869. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7870. newIndex = j;
  7871. break;
  7872. }
  7873. }
  7874. }
  7875. if (newIndex === void 0) {
  7876. unmount(prevChild, parentComponent, parentSuspense, true);
  7877. } else {
  7878. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7879. if (newIndex >= maxNewIndexSoFar) {
  7880. maxNewIndexSoFar = newIndex;
  7881. } else {
  7882. moved = true;
  7883. }
  7884. patch(
  7885. prevChild,
  7886. c2[newIndex],
  7887. container,
  7888. null,
  7889. parentComponent,
  7890. parentSuspense,
  7891. namespace,
  7892. slotScopeIds,
  7893. optimized
  7894. );
  7895. patched++;
  7896. }
  7897. }
  7898. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7899. j = increasingNewIndexSequence.length - 1;
  7900. for (i = toBePatched - 1; i >= 0; i--) {
  7901. const nextIndex = s2 + i;
  7902. const nextChild = c2[nextIndex];
  7903. const anchorVNode = c2[nextIndex + 1];
  7904. const anchor = nextIndex + 1 < l2 ? (
  7905. // #13559, fallback to el placeholder for unresolved async component
  7906. anchorVNode.el || anchorVNode.placeholder
  7907. ) : parentAnchor;
  7908. if (newIndexToOldIndexMap[i] === 0) {
  7909. patch(
  7910. null,
  7911. nextChild,
  7912. container,
  7913. anchor,
  7914. parentComponent,
  7915. parentSuspense,
  7916. namespace,
  7917. slotScopeIds,
  7918. optimized
  7919. );
  7920. } else if (moved) {
  7921. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7922. move(nextChild, container, anchor, 2);
  7923. } else {
  7924. j--;
  7925. }
  7926. }
  7927. }
  7928. }
  7929. };
  7930. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7931. const { el, type, transition, children, shapeFlag } = vnode;
  7932. if (shapeFlag & 6) {
  7933. move(vnode.component.subTree, container, anchor, moveType);
  7934. return;
  7935. }
  7936. if (shapeFlag & 128) {
  7937. vnode.suspense.move(container, anchor, moveType);
  7938. return;
  7939. }
  7940. if (shapeFlag & 64) {
  7941. type.move(vnode, container, anchor, internals);
  7942. return;
  7943. }
  7944. if (type === Fragment) {
  7945. hostInsert(el, container, anchor);
  7946. for (let i = 0; i < children.length; i++) {
  7947. move(children[i], container, anchor, moveType);
  7948. }
  7949. hostInsert(vnode.anchor, container, anchor);
  7950. return;
  7951. }
  7952. if (type === Static) {
  7953. moveStaticNode(vnode, container, anchor);
  7954. return;
  7955. }
  7956. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7957. if (needTransition2) {
  7958. if (moveType === 0) {
  7959. transition.beforeEnter(el);
  7960. hostInsert(el, container, anchor);
  7961. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7962. } else {
  7963. const { leave, delayLeave, afterLeave } = transition;
  7964. const remove2 = () => {
  7965. if (vnode.ctx.isUnmounted) {
  7966. hostRemove(el);
  7967. } else {
  7968. hostInsert(el, container, anchor);
  7969. }
  7970. };
  7971. const performLeave = () => {
  7972. if (el._isLeaving) {
  7973. el[leaveCbKey](
  7974. true
  7975. /* cancelled */
  7976. );
  7977. }
  7978. leave(el, () => {
  7979. remove2();
  7980. afterLeave && afterLeave();
  7981. });
  7982. };
  7983. if (delayLeave) {
  7984. delayLeave(el, remove2, performLeave);
  7985. } else {
  7986. performLeave();
  7987. }
  7988. }
  7989. } else {
  7990. hostInsert(el, container, anchor);
  7991. }
  7992. };
  7993. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7994. const {
  7995. type,
  7996. props,
  7997. ref,
  7998. children,
  7999. dynamicChildren,
  8000. shapeFlag,
  8001. patchFlag,
  8002. dirs,
  8003. cacheIndex
  8004. } = vnode;
  8005. if (patchFlag === -2) {
  8006. optimized = false;
  8007. }
  8008. if (ref != null) {
  8009. pauseTracking();
  8010. setRef(ref, null, parentSuspense, vnode, true);
  8011. resetTracking();
  8012. }
  8013. if (cacheIndex != null) {
  8014. parentComponent.renderCache[cacheIndex] = void 0;
  8015. }
  8016. if (shapeFlag & 256) {
  8017. parentComponent.ctx.deactivate(vnode);
  8018. return;
  8019. }
  8020. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  8021. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  8022. let vnodeHook;
  8023. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  8024. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8025. }
  8026. if (shapeFlag & 6) {
  8027. unmountComponent(vnode.component, parentSuspense, doRemove);
  8028. } else {
  8029. if (shapeFlag & 128) {
  8030. vnode.suspense.unmount(parentSuspense, doRemove);
  8031. return;
  8032. }
  8033. if (shouldInvokeDirs) {
  8034. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  8035. }
  8036. if (shapeFlag & 64) {
  8037. vnode.type.remove(
  8038. vnode,
  8039. parentComponent,
  8040. parentSuspense,
  8041. internals,
  8042. doRemove
  8043. );
  8044. } else if (dynamicChildren && // #5154
  8045. // when v-once is used inside a block, setBlockTracking(-1) marks the
  8046. // parent block with hasOnce: true
  8047. // so that it doesn't take the fast path during unmount - otherwise
  8048. // components nested in v-once are never unmounted.
  8049. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  8050. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  8051. unmountChildren(
  8052. dynamicChildren,
  8053. parentComponent,
  8054. parentSuspense,
  8055. false,
  8056. true
  8057. );
  8058. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  8059. unmountChildren(children, parentComponent, parentSuspense);
  8060. }
  8061. if (doRemove) {
  8062. remove(vnode);
  8063. }
  8064. }
  8065. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  8066. queuePostRenderEffect(() => {
  8067. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8068. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  8069. }, parentSuspense);
  8070. }
  8071. };
  8072. const remove = (vnode) => {
  8073. const { type, el, anchor, transition } = vnode;
  8074. if (type === Fragment) {
  8075. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  8076. vnode.children.forEach((child) => {
  8077. if (child.type === Comment) {
  8078. hostRemove(child.el);
  8079. } else {
  8080. remove(child);
  8081. }
  8082. });
  8083. } else {
  8084. removeFragment(el, anchor);
  8085. }
  8086. return;
  8087. }
  8088. if (type === Static) {
  8089. removeStaticNode(vnode);
  8090. return;
  8091. }
  8092. const performRemove = () => {
  8093. hostRemove(el);
  8094. if (transition && !transition.persisted && transition.afterLeave) {
  8095. transition.afterLeave();
  8096. }
  8097. };
  8098. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  8099. const { leave, delayLeave } = transition;
  8100. const performLeave = () => leave(el, performRemove);
  8101. if (delayLeave) {
  8102. delayLeave(vnode.el, performRemove, performLeave);
  8103. } else {
  8104. performLeave();
  8105. }
  8106. } else {
  8107. performRemove();
  8108. }
  8109. };
  8110. const removeFragment = (cur, end) => {
  8111. let next;
  8112. while (cur !== end) {
  8113. next = hostNextSibling(cur);
  8114. hostRemove(cur);
  8115. cur = next;
  8116. }
  8117. hostRemove(end);
  8118. };
  8119. const unmountComponent = (instance, parentSuspense, doRemove) => {
  8120. if (instance.type.__hmrId) {
  8121. unregisterHMR(instance);
  8122. }
  8123. const { bum, scope, job, subTree, um, m, a } = instance;
  8124. invalidateMount(m);
  8125. invalidateMount(a);
  8126. if (bum) {
  8127. invokeArrayFns(bum);
  8128. }
  8129. scope.stop();
  8130. if (job) {
  8131. job.flags |= 8;
  8132. unmount(subTree, instance, parentSuspense, doRemove);
  8133. }
  8134. if (um) {
  8135. queuePostRenderEffect(um, parentSuspense);
  8136. }
  8137. queuePostRenderEffect(() => {
  8138. instance.isUnmounted = true;
  8139. }, parentSuspense);
  8140. {
  8141. devtoolsComponentRemoved(instance);
  8142. }
  8143. };
  8144. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8145. for (let i = start; i < children.length; i++) {
  8146. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8147. }
  8148. };
  8149. const getNextHostNode = (vnode) => {
  8150. if (vnode.shapeFlag & 6) {
  8151. return getNextHostNode(vnode.component.subTree);
  8152. }
  8153. if (vnode.shapeFlag & 128) {
  8154. return vnode.suspense.next();
  8155. }
  8156. const el = hostNextSibling(vnode.anchor || vnode.el);
  8157. const teleportEnd = el && el[TeleportEndKey];
  8158. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8159. };
  8160. let isFlushing = false;
  8161. const render = (vnode, container, namespace) => {
  8162. if (vnode == null) {
  8163. if (container._vnode) {
  8164. unmount(container._vnode, null, null, true);
  8165. }
  8166. } else {
  8167. patch(
  8168. container._vnode || null,
  8169. vnode,
  8170. container,
  8171. null,
  8172. null,
  8173. null,
  8174. namespace
  8175. );
  8176. }
  8177. container._vnode = vnode;
  8178. if (!isFlushing) {
  8179. isFlushing = true;
  8180. flushPreFlushCbs();
  8181. flushPostFlushCbs();
  8182. isFlushing = false;
  8183. }
  8184. };
  8185. const internals = {
  8186. p: patch,
  8187. um: unmount,
  8188. m: move,
  8189. r: remove,
  8190. mt: mountComponent,
  8191. mc: mountChildren,
  8192. pc: patchChildren,
  8193. pbc: patchBlockChildren,
  8194. n: getNextHostNode,
  8195. o: options
  8196. };
  8197. let hydrate;
  8198. let hydrateNode;
  8199. if (createHydrationFns) {
  8200. [hydrate, hydrateNode] = createHydrationFns(
  8201. internals
  8202. );
  8203. }
  8204. return {
  8205. render,
  8206. hydrate,
  8207. createApp: createAppAPI(render, hydrate)
  8208. };
  8209. }
  8210. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8211. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8212. }
  8213. function toggleRecurse({ effect, job }, allowed) {
  8214. if (allowed) {
  8215. effect.flags |= 32;
  8216. job.flags |= 4;
  8217. } else {
  8218. effect.flags &= -33;
  8219. job.flags &= -5;
  8220. }
  8221. }
  8222. function needTransition(parentSuspense, transition) {
  8223. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8224. }
  8225. function traverseStaticChildren(n1, n2, shallow = false) {
  8226. const ch1 = n1.children;
  8227. const ch2 = n2.children;
  8228. if (isArray(ch1) && isArray(ch2)) {
  8229. for (let i = 0; i < ch1.length; i++) {
  8230. const c1 = ch1[i];
  8231. let c2 = ch2[i];
  8232. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8233. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8234. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8235. c2.el = c1.el;
  8236. }
  8237. if (!shallow && c2.patchFlag !== -2)
  8238. traverseStaticChildren(c1, c2);
  8239. }
  8240. if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
  8241. c2.patchFlag !== -1) {
  8242. c2.el = c1.el;
  8243. }
  8244. if (c2.type === Comment && !c2.el) {
  8245. c2.el = c1.el;
  8246. }
  8247. {
  8248. c2.el && (c2.el.__vnode = c2);
  8249. }
  8250. }
  8251. }
  8252. }
  8253. function getSequence(arr) {
  8254. const p = arr.slice();
  8255. const result = [0];
  8256. let i, j, u, v, c;
  8257. const len = arr.length;
  8258. for (i = 0; i < len; i++) {
  8259. const arrI = arr[i];
  8260. if (arrI !== 0) {
  8261. j = result[result.length - 1];
  8262. if (arr[j] < arrI) {
  8263. p[i] = j;
  8264. result.push(i);
  8265. continue;
  8266. }
  8267. u = 0;
  8268. v = result.length - 1;
  8269. while (u < v) {
  8270. c = u + v >> 1;
  8271. if (arr[result[c]] < arrI) {
  8272. u = c + 1;
  8273. } else {
  8274. v = c;
  8275. }
  8276. }
  8277. if (arrI < arr[result[u]]) {
  8278. if (u > 0) {
  8279. p[i] = result[u - 1];
  8280. }
  8281. result[u] = i;
  8282. }
  8283. }
  8284. }
  8285. u = result.length;
  8286. v = result[u - 1];
  8287. while (u-- > 0) {
  8288. result[u] = v;
  8289. v = p[v];
  8290. }
  8291. return result;
  8292. }
  8293. function locateNonHydratedAsyncRoot(instance) {
  8294. const subComponent = instance.subTree.component;
  8295. if (subComponent) {
  8296. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8297. return subComponent;
  8298. } else {
  8299. return locateNonHydratedAsyncRoot(subComponent);
  8300. }
  8301. }
  8302. }
  8303. function invalidateMount(hooks) {
  8304. if (hooks) {
  8305. for (let i = 0; i < hooks.length; i++)
  8306. hooks[i].flags |= 8;
  8307. }
  8308. }
  8309. const ssrContextKey = Symbol.for("v-scx");
  8310. const useSSRContext = () => {
  8311. {
  8312. const ctx = inject(ssrContextKey);
  8313. if (!ctx) {
  8314. warn$1(
  8315. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  8316. );
  8317. }
  8318. return ctx;
  8319. }
  8320. };
  8321. function watchEffect(effect, options) {
  8322. return doWatch(effect, null, options);
  8323. }
  8324. function watchPostEffect(effect, options) {
  8325. return doWatch(
  8326. effect,
  8327. null,
  8328. extend({}, options, { flush: "post" })
  8329. );
  8330. }
  8331. function watchSyncEffect(effect, options) {
  8332. return doWatch(
  8333. effect,
  8334. null,
  8335. extend({}, options, { flush: "sync" })
  8336. );
  8337. }
  8338. function watch(source, cb, options) {
  8339. if (!isFunction(cb)) {
  8340. warn$1(
  8341. `\`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.`
  8342. );
  8343. }
  8344. return doWatch(source, cb, options);
  8345. }
  8346. function doWatch(source, cb, options = EMPTY_OBJ) {
  8347. const { immediate, deep, flush, once } = options;
  8348. if (!cb) {
  8349. if (immediate !== void 0) {
  8350. warn$1(
  8351. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  8352. );
  8353. }
  8354. if (deep !== void 0) {
  8355. warn$1(
  8356. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  8357. );
  8358. }
  8359. if (once !== void 0) {
  8360. warn$1(
  8361. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  8362. );
  8363. }
  8364. }
  8365. const baseWatchOptions = extend({}, options);
  8366. baseWatchOptions.onWarn = warn$1;
  8367. const runsImmediately = cb && immediate || !cb && flush !== "post";
  8368. let ssrCleanup;
  8369. if (isInSSRComponentSetup) {
  8370. if (flush === "sync") {
  8371. const ctx = useSSRContext();
  8372. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  8373. } else if (!runsImmediately) {
  8374. const watchStopHandle = () => {
  8375. };
  8376. watchStopHandle.stop = NOOP;
  8377. watchStopHandle.resume = NOOP;
  8378. watchStopHandle.pause = NOOP;
  8379. return watchStopHandle;
  8380. }
  8381. }
  8382. const instance = currentInstance;
  8383. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  8384. let isPre = false;
  8385. if (flush === "post") {
  8386. baseWatchOptions.scheduler = (job) => {
  8387. queuePostRenderEffect(job, instance && instance.suspense);
  8388. };
  8389. } else if (flush !== "sync") {
  8390. isPre = true;
  8391. baseWatchOptions.scheduler = (job, isFirstRun) => {
  8392. if (isFirstRun) {
  8393. job();
  8394. } else {
  8395. queueJob(job);
  8396. }
  8397. };
  8398. }
  8399. baseWatchOptions.augmentJob = (job) => {
  8400. if (cb) {
  8401. job.flags |= 4;
  8402. }
  8403. if (isPre) {
  8404. job.flags |= 2;
  8405. if (instance) {
  8406. job.id = instance.uid;
  8407. job.i = instance;
  8408. }
  8409. }
  8410. };
  8411. const watchHandle = watch$1(source, cb, baseWatchOptions);
  8412. if (isInSSRComponentSetup) {
  8413. if (ssrCleanup) {
  8414. ssrCleanup.push(watchHandle);
  8415. } else if (runsImmediately) {
  8416. watchHandle();
  8417. }
  8418. }
  8419. return watchHandle;
  8420. }
  8421. function instanceWatch(source, value, options) {
  8422. const publicThis = this.proxy;
  8423. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  8424. let cb;
  8425. if (isFunction(value)) {
  8426. cb = value;
  8427. } else {
  8428. cb = value.handler;
  8429. options = value;
  8430. }
  8431. const reset = setCurrentInstance(this);
  8432. const res = doWatch(getter, cb.bind(publicThis), options);
  8433. reset();
  8434. return res;
  8435. }
  8436. function createPathGetter(ctx, path) {
  8437. const segments = path.split(".");
  8438. return () => {
  8439. let cur = ctx;
  8440. for (let i = 0; i < segments.length && cur; i++) {
  8441. cur = cur[segments[i]];
  8442. }
  8443. return cur;
  8444. };
  8445. }
  8446. function useModel(props, name, options = EMPTY_OBJ) {
  8447. const i = getCurrentInstance();
  8448. if (!i) {
  8449. warn$1(`useModel() called without active instance.`);
  8450. return ref();
  8451. }
  8452. const camelizedName = camelize(name);
  8453. if (!i.propsOptions[0][camelizedName]) {
  8454. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  8455. return ref();
  8456. }
  8457. const hyphenatedName = hyphenate(name);
  8458. const modifiers = getModelModifiers(props, camelizedName);
  8459. const res = customRef((track, trigger) => {
  8460. let localValue;
  8461. let prevSetValue = EMPTY_OBJ;
  8462. let prevEmittedValue;
  8463. watchSyncEffect(() => {
  8464. const propValue = props[camelizedName];
  8465. if (hasChanged(localValue, propValue)) {
  8466. localValue = propValue;
  8467. trigger();
  8468. }
  8469. });
  8470. return {
  8471. get() {
  8472. track();
  8473. return options.get ? options.get(localValue) : localValue;
  8474. },
  8475. set(value) {
  8476. const emittedValue = options.set ? options.set(value) : value;
  8477. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  8478. return;
  8479. }
  8480. const rawProps = i.vnode.props;
  8481. if (!(rawProps && // check if parent has passed v-model
  8482. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  8483. localValue = value;
  8484. trigger();
  8485. }
  8486. i.emit(`update:${name}`, emittedValue);
  8487. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  8488. trigger();
  8489. }
  8490. prevSetValue = value;
  8491. prevEmittedValue = emittedValue;
  8492. }
  8493. };
  8494. });
  8495. res[Symbol.iterator] = () => {
  8496. let i2 = 0;
  8497. return {
  8498. next() {
  8499. if (i2 < 2) {
  8500. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  8501. } else {
  8502. return { done: true };
  8503. }
  8504. }
  8505. };
  8506. };
  8507. return res;
  8508. }
  8509. const getModelModifiers = (props, modelName) => {
  8510. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  8511. };
  8512. function emit(instance, event, ...rawArgs) {
  8513. if (instance.isUnmounted) return;
  8514. const props = instance.vnode.props || EMPTY_OBJ;
  8515. {
  8516. const {
  8517. emitsOptions,
  8518. propsOptions: [propsOptions]
  8519. } = instance;
  8520. if (emitsOptions) {
  8521. if (!(event in emitsOptions) && true) {
  8522. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  8523. warn$1(
  8524. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  8525. );
  8526. }
  8527. } else {
  8528. const validator = emitsOptions[event];
  8529. if (isFunction(validator)) {
  8530. const isValid = validator(...rawArgs);
  8531. if (!isValid) {
  8532. warn$1(
  8533. `Invalid event arguments: event validation failed for event "${event}".`
  8534. );
  8535. }
  8536. }
  8537. }
  8538. }
  8539. }
  8540. let args = rawArgs;
  8541. const isModelListener = event.startsWith("update:");
  8542. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  8543. if (modifiers) {
  8544. if (modifiers.trim) {
  8545. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  8546. }
  8547. if (modifiers.number) {
  8548. args = rawArgs.map(looseToNumber);
  8549. }
  8550. }
  8551. {
  8552. devtoolsComponentEmit(instance, event, args);
  8553. }
  8554. {
  8555. const lowerCaseEvent = event.toLowerCase();
  8556. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  8557. warn$1(
  8558. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  8559. instance,
  8560. instance.type
  8561. )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
  8562. event
  8563. )}" instead of "${event}".`
  8564. );
  8565. }
  8566. }
  8567. let handlerName;
  8568. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  8569. props[handlerName = toHandlerKey(camelize(event))];
  8570. if (!handler && isModelListener) {
  8571. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  8572. }
  8573. if (handler) {
  8574. callWithAsyncErrorHandling(
  8575. handler,
  8576. instance,
  8577. 6,
  8578. args
  8579. );
  8580. }
  8581. const onceHandler = props[handlerName + `Once`];
  8582. if (onceHandler) {
  8583. if (!instance.emitted) {
  8584. instance.emitted = {};
  8585. } else if (instance.emitted[handlerName]) {
  8586. return;
  8587. }
  8588. instance.emitted[handlerName] = true;
  8589. callWithAsyncErrorHandling(
  8590. onceHandler,
  8591. instance,
  8592. 6,
  8593. args
  8594. );
  8595. }
  8596. }
  8597. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  8598. const cache = appContext.emitsCache;
  8599. const cached = cache.get(comp);
  8600. if (cached !== void 0) {
  8601. return cached;
  8602. }
  8603. const raw = comp.emits;
  8604. let normalized = {};
  8605. let hasExtends = false;
  8606. if (!isFunction(comp)) {
  8607. const extendEmits = (raw2) => {
  8608. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  8609. if (normalizedFromExtend) {
  8610. hasExtends = true;
  8611. extend(normalized, normalizedFromExtend);
  8612. }
  8613. };
  8614. if (!asMixin && appContext.mixins.length) {
  8615. appContext.mixins.forEach(extendEmits);
  8616. }
  8617. if (comp.extends) {
  8618. extendEmits(comp.extends);
  8619. }
  8620. if (comp.mixins) {
  8621. comp.mixins.forEach(extendEmits);
  8622. }
  8623. }
  8624. if (!raw && !hasExtends) {
  8625. if (isObject(comp)) {
  8626. cache.set(comp, null);
  8627. }
  8628. return null;
  8629. }
  8630. if (isArray(raw)) {
  8631. raw.forEach((key) => normalized[key] = null);
  8632. } else {
  8633. extend(normalized, raw);
  8634. }
  8635. if (isObject(comp)) {
  8636. cache.set(comp, normalized);
  8637. }
  8638. return normalized;
  8639. }
  8640. function isEmitListener(options, key) {
  8641. if (!options || !isOn(key)) {
  8642. return false;
  8643. }
  8644. key = key.slice(2).replace(/Once$/, "");
  8645. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  8646. }
  8647. let accessedAttrs = false;
  8648. function markAttrsAccessed() {
  8649. accessedAttrs = true;
  8650. }
  8651. function renderComponentRoot(instance) {
  8652. const {
  8653. type: Component,
  8654. vnode,
  8655. proxy,
  8656. withProxy,
  8657. propsOptions: [propsOptions],
  8658. slots,
  8659. attrs,
  8660. emit,
  8661. render,
  8662. renderCache,
  8663. props,
  8664. data,
  8665. setupState,
  8666. ctx,
  8667. inheritAttrs
  8668. } = instance;
  8669. const prev = setCurrentRenderingInstance(instance);
  8670. let result;
  8671. let fallthroughAttrs;
  8672. {
  8673. accessedAttrs = false;
  8674. }
  8675. try {
  8676. if (vnode.shapeFlag & 4) {
  8677. const proxyToUse = withProxy || proxy;
  8678. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  8679. get(target, key, receiver) {
  8680. warn$1(
  8681. `Property '${String(
  8682. key
  8683. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  8684. );
  8685. return Reflect.get(target, key, receiver);
  8686. }
  8687. }) : proxyToUse;
  8688. result = normalizeVNode(
  8689. render.call(
  8690. thisProxy,
  8691. proxyToUse,
  8692. renderCache,
  8693. true ? shallowReadonly(props) : props,
  8694. setupState,
  8695. data,
  8696. ctx
  8697. )
  8698. );
  8699. fallthroughAttrs = attrs;
  8700. } else {
  8701. const render2 = Component;
  8702. if (attrs === props) {
  8703. markAttrsAccessed();
  8704. }
  8705. result = normalizeVNode(
  8706. render2.length > 1 ? render2(
  8707. true ? shallowReadonly(props) : props,
  8708. true ? {
  8709. get attrs() {
  8710. markAttrsAccessed();
  8711. return shallowReadonly(attrs);
  8712. },
  8713. slots,
  8714. emit
  8715. } : { attrs, slots, emit }
  8716. ) : render2(
  8717. true ? shallowReadonly(props) : props,
  8718. null
  8719. )
  8720. );
  8721. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  8722. }
  8723. } catch (err) {
  8724. blockStack.length = 0;
  8725. handleError(err, instance, 1);
  8726. result = createVNode(Comment);
  8727. }
  8728. let root = result;
  8729. let setRoot = void 0;
  8730. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  8731. [root, setRoot] = getChildRoot(result);
  8732. }
  8733. if (fallthroughAttrs && inheritAttrs !== false) {
  8734. const keys = Object.keys(fallthroughAttrs);
  8735. const { shapeFlag } = root;
  8736. if (keys.length) {
  8737. if (shapeFlag & (1 | 6)) {
  8738. if (propsOptions && keys.some(isModelListener)) {
  8739. fallthroughAttrs = filterModelListeners(
  8740. fallthroughAttrs,
  8741. propsOptions
  8742. );
  8743. }
  8744. root = cloneVNode(root, fallthroughAttrs, false, true);
  8745. } else if (!accessedAttrs && root.type !== Comment) {
  8746. const allAttrs = Object.keys(attrs);
  8747. const eventAttrs = [];
  8748. const extraAttrs = [];
  8749. for (let i = 0, l = allAttrs.length; i < l; i++) {
  8750. const key = allAttrs[i];
  8751. if (isOn(key)) {
  8752. if (!isModelListener(key)) {
  8753. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  8754. }
  8755. } else {
  8756. extraAttrs.push(key);
  8757. }
  8758. }
  8759. if (extraAttrs.length) {
  8760. warn$1(
  8761. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
  8762. );
  8763. }
  8764. if (eventAttrs.length) {
  8765. warn$1(
  8766. `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
  8767. );
  8768. }
  8769. }
  8770. }
  8771. }
  8772. if (vnode.dirs) {
  8773. if (!isElementRoot(root)) {
  8774. warn$1(
  8775. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  8776. );
  8777. }
  8778. root = cloneVNode(root, null, false, true);
  8779. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  8780. }
  8781. if (vnode.transition) {
  8782. if (!isElementRoot(root)) {
  8783. warn$1(
  8784. `Component inside <Transition> renders non-element root node that cannot be animated.`
  8785. );
  8786. }
  8787. setTransitionHooks(root, vnode.transition);
  8788. }
  8789. if (setRoot) {
  8790. setRoot(root);
  8791. } else {
  8792. result = root;
  8793. }
  8794. setCurrentRenderingInstance(prev);
  8795. return result;
  8796. }
  8797. const getChildRoot = (vnode) => {
  8798. const rawChildren = vnode.children;
  8799. const dynamicChildren = vnode.dynamicChildren;
  8800. const childRoot = filterSingleRoot(rawChildren, false);
  8801. if (!childRoot) {
  8802. return [vnode, void 0];
  8803. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  8804. return getChildRoot(childRoot);
  8805. }
  8806. const index = rawChildren.indexOf(childRoot);
  8807. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  8808. const setRoot = (updatedRoot) => {
  8809. rawChildren[index] = updatedRoot;
  8810. if (dynamicChildren) {
  8811. if (dynamicIndex > -1) {
  8812. dynamicChildren[dynamicIndex] = updatedRoot;
  8813. } else if (updatedRoot.patchFlag > 0) {
  8814. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  8815. }
  8816. }
  8817. };
  8818. return [normalizeVNode(childRoot), setRoot];
  8819. };
  8820. function filterSingleRoot(children, recurse = true) {
  8821. let singleRoot;
  8822. for (let i = 0; i < children.length; i++) {
  8823. const child = children[i];
  8824. if (isVNode(child)) {
  8825. if (child.type !== Comment || child.children === "v-if") {
  8826. if (singleRoot) {
  8827. return;
  8828. } else {
  8829. singleRoot = child;
  8830. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  8831. return filterSingleRoot(singleRoot.children);
  8832. }
  8833. }
  8834. }
  8835. } else {
  8836. return;
  8837. }
  8838. }
  8839. return singleRoot;
  8840. }
  8841. const getFunctionalFallthrough = (attrs) => {
  8842. let res;
  8843. for (const key in attrs) {
  8844. if (key === "class" || key === "style" || isOn(key)) {
  8845. (res || (res = {}))[key] = attrs[key];
  8846. }
  8847. }
  8848. return res;
  8849. };
  8850. const filterModelListeners = (attrs, props) => {
  8851. const res = {};
  8852. for (const key in attrs) {
  8853. if (!isModelListener(key) || !(key.slice(9) in props)) {
  8854. res[key] = attrs[key];
  8855. }
  8856. }
  8857. return res;
  8858. };
  8859. const isElementRoot = (vnode) => {
  8860. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  8861. };
  8862. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  8863. const { props: prevProps, children: prevChildren, component } = prevVNode;
  8864. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  8865. const emits = component.emitsOptions;
  8866. if ((prevChildren || nextChildren) && isHmrUpdating) {
  8867. return true;
  8868. }
  8869. if (nextVNode.dirs || nextVNode.transition) {
  8870. return true;
  8871. }
  8872. if (optimized && patchFlag >= 0) {
  8873. if (patchFlag & 1024) {
  8874. return true;
  8875. }
  8876. if (patchFlag & 16) {
  8877. if (!prevProps) {
  8878. return !!nextProps;
  8879. }
  8880. return hasPropsChanged(prevProps, nextProps, emits);
  8881. } else if (patchFlag & 8) {
  8882. const dynamicProps = nextVNode.dynamicProps;
  8883. for (let i = 0; i < dynamicProps.length; i++) {
  8884. const key = dynamicProps[i];
  8885. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  8886. return true;
  8887. }
  8888. }
  8889. }
  8890. } else {
  8891. if (prevChildren || nextChildren) {
  8892. if (!nextChildren || !nextChildren.$stable) {
  8893. return true;
  8894. }
  8895. }
  8896. if (prevProps === nextProps) {
  8897. return false;
  8898. }
  8899. if (!prevProps) {
  8900. return !!nextProps;
  8901. }
  8902. if (!nextProps) {
  8903. return true;
  8904. }
  8905. return hasPropsChanged(prevProps, nextProps, emits);
  8906. }
  8907. return false;
  8908. }
  8909. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  8910. const nextKeys = Object.keys(nextProps);
  8911. if (nextKeys.length !== Object.keys(prevProps).length) {
  8912. return true;
  8913. }
  8914. for (let i = 0; i < nextKeys.length; i++) {
  8915. const key = nextKeys[i];
  8916. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  8917. return true;
  8918. }
  8919. }
  8920. return false;
  8921. }
  8922. function updateHOCHostEl({ vnode, parent }, el) {
  8923. while (parent) {
  8924. const root = parent.subTree;
  8925. if (root.suspense && root.suspense.activeBranch === vnode) {
  8926. root.el = vnode.el;
  8927. }
  8928. if (root === vnode) {
  8929. (vnode = parent.vnode).el = el;
  8930. parent = parent.parent;
  8931. } else {
  8932. break;
  8933. }
  8934. }
  8935. }
  8936. const isSuspense = (type) => type.__isSuspense;
  8937. let suspenseId = 0;
  8938. const SuspenseImpl = {
  8939. name: "Suspense",
  8940. // In order to make Suspense tree-shakable, we need to avoid importing it
  8941. // directly in the renderer. The renderer checks for the __isSuspense flag
  8942. // on a vnode's type and calls the `process` method, passing in renderer
  8943. // internals.
  8944. __isSuspense: true,
  8945. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8946. if (n1 == null) {
  8947. mountSuspense(
  8948. n2,
  8949. container,
  8950. anchor,
  8951. parentComponent,
  8952. parentSuspense,
  8953. namespace,
  8954. slotScopeIds,
  8955. optimized,
  8956. rendererInternals
  8957. );
  8958. } else {
  8959. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8960. n2.suspense = n1.suspense;
  8961. n2.suspense.vnode = n2;
  8962. n2.el = n1.el;
  8963. return;
  8964. }
  8965. patchSuspense(
  8966. n1,
  8967. n2,
  8968. container,
  8969. anchor,
  8970. parentComponent,
  8971. namespace,
  8972. slotScopeIds,
  8973. optimized,
  8974. rendererInternals
  8975. );
  8976. }
  8977. },
  8978. hydrate: hydrateSuspense,
  8979. normalize: normalizeSuspenseChildren
  8980. };
  8981. const Suspense = SuspenseImpl ;
  8982. function triggerEvent(vnode, name) {
  8983. const eventListener = vnode.props && vnode.props[name];
  8984. if (isFunction(eventListener)) {
  8985. eventListener();
  8986. }
  8987. }
  8988. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8989. const {
  8990. p: patch,
  8991. o: { createElement }
  8992. } = rendererInternals;
  8993. const hiddenContainer = createElement("div");
  8994. const suspense = vnode.suspense = createSuspenseBoundary(
  8995. vnode,
  8996. parentSuspense,
  8997. parentComponent,
  8998. container,
  8999. hiddenContainer,
  9000. anchor,
  9001. namespace,
  9002. slotScopeIds,
  9003. optimized,
  9004. rendererInternals
  9005. );
  9006. patch(
  9007. null,
  9008. suspense.pendingBranch = vnode.ssContent,
  9009. hiddenContainer,
  9010. null,
  9011. parentComponent,
  9012. suspense,
  9013. namespace,
  9014. slotScopeIds
  9015. );
  9016. if (suspense.deps > 0) {
  9017. triggerEvent(vnode, "onPending");
  9018. triggerEvent(vnode, "onFallback");
  9019. patch(
  9020. null,
  9021. vnode.ssFallback,
  9022. container,
  9023. anchor,
  9024. parentComponent,
  9025. null,
  9026. // fallback tree will not have suspense context
  9027. namespace,
  9028. slotScopeIds
  9029. );
  9030. setActiveBranch(suspense, vnode.ssFallback);
  9031. } else {
  9032. suspense.resolve(false, true);
  9033. }
  9034. }
  9035. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  9036. const suspense = n2.suspense = n1.suspense;
  9037. suspense.vnode = n2;
  9038. n2.el = n1.el;
  9039. const newBranch = n2.ssContent;
  9040. const newFallback = n2.ssFallback;
  9041. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  9042. if (pendingBranch) {
  9043. suspense.pendingBranch = newBranch;
  9044. if (isSameVNodeType(newBranch, pendingBranch)) {
  9045. patch(
  9046. pendingBranch,
  9047. newBranch,
  9048. suspense.hiddenContainer,
  9049. null,
  9050. parentComponent,
  9051. suspense,
  9052. namespace,
  9053. slotScopeIds,
  9054. optimized
  9055. );
  9056. if (suspense.deps <= 0) {
  9057. suspense.resolve();
  9058. } else if (isInFallback) {
  9059. if (!isHydrating) {
  9060. patch(
  9061. activeBranch,
  9062. newFallback,
  9063. container,
  9064. anchor,
  9065. parentComponent,
  9066. null,
  9067. // fallback tree will not have suspense context
  9068. namespace,
  9069. slotScopeIds,
  9070. optimized
  9071. );
  9072. setActiveBranch(suspense, newFallback);
  9073. }
  9074. }
  9075. } else {
  9076. suspense.pendingId = suspenseId++;
  9077. if (isHydrating) {
  9078. suspense.isHydrating = false;
  9079. suspense.activeBranch = pendingBranch;
  9080. } else {
  9081. unmount(pendingBranch, parentComponent, suspense);
  9082. }
  9083. suspense.deps = 0;
  9084. suspense.effects.length = 0;
  9085. suspense.hiddenContainer = createElement("div");
  9086. if (isInFallback) {
  9087. patch(
  9088. null,
  9089. newBranch,
  9090. suspense.hiddenContainer,
  9091. null,
  9092. parentComponent,
  9093. suspense,
  9094. namespace,
  9095. slotScopeIds,
  9096. optimized
  9097. );
  9098. if (suspense.deps <= 0) {
  9099. suspense.resolve();
  9100. } else {
  9101. patch(
  9102. activeBranch,
  9103. newFallback,
  9104. container,
  9105. anchor,
  9106. parentComponent,
  9107. null,
  9108. // fallback tree will not have suspense context
  9109. namespace,
  9110. slotScopeIds,
  9111. optimized
  9112. );
  9113. setActiveBranch(suspense, newFallback);
  9114. }
  9115. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  9116. patch(
  9117. activeBranch,
  9118. newBranch,
  9119. container,
  9120. anchor,
  9121. parentComponent,
  9122. suspense,
  9123. namespace,
  9124. slotScopeIds,
  9125. optimized
  9126. );
  9127. suspense.resolve(true);
  9128. } else {
  9129. patch(
  9130. null,
  9131. newBranch,
  9132. suspense.hiddenContainer,
  9133. null,
  9134. parentComponent,
  9135. suspense,
  9136. namespace,
  9137. slotScopeIds,
  9138. optimized
  9139. );
  9140. if (suspense.deps <= 0) {
  9141. suspense.resolve();
  9142. }
  9143. }
  9144. }
  9145. } else {
  9146. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  9147. patch(
  9148. activeBranch,
  9149. newBranch,
  9150. container,
  9151. anchor,
  9152. parentComponent,
  9153. suspense,
  9154. namespace,
  9155. slotScopeIds,
  9156. optimized
  9157. );
  9158. setActiveBranch(suspense, newBranch);
  9159. } else {
  9160. triggerEvent(n2, "onPending");
  9161. suspense.pendingBranch = newBranch;
  9162. if (newBranch.shapeFlag & 512) {
  9163. suspense.pendingId = newBranch.component.suspenseId;
  9164. } else {
  9165. suspense.pendingId = suspenseId++;
  9166. }
  9167. patch(
  9168. null,
  9169. newBranch,
  9170. suspense.hiddenContainer,
  9171. null,
  9172. parentComponent,
  9173. suspense,
  9174. namespace,
  9175. slotScopeIds,
  9176. optimized
  9177. );
  9178. if (suspense.deps <= 0) {
  9179. suspense.resolve();
  9180. } else {
  9181. const { timeout, pendingId } = suspense;
  9182. if (timeout > 0) {
  9183. setTimeout(() => {
  9184. if (suspense.pendingId === pendingId) {
  9185. suspense.fallback(newFallback);
  9186. }
  9187. }, timeout);
  9188. } else if (timeout === 0) {
  9189. suspense.fallback(newFallback);
  9190. }
  9191. }
  9192. }
  9193. }
  9194. }
  9195. let hasWarned = false;
  9196. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9197. if (!hasWarned) {
  9198. hasWarned = true;
  9199. console[console.info ? "info" : "log"](
  9200. `<Suspense> is an experimental feature and its API will likely change.`
  9201. );
  9202. }
  9203. const {
  9204. p: patch,
  9205. m: move,
  9206. um: unmount,
  9207. n: next,
  9208. o: { parentNode, remove }
  9209. } = rendererInternals;
  9210. let parentSuspenseId;
  9211. const isSuspensible = isVNodeSuspensible(vnode);
  9212. if (isSuspensible) {
  9213. if (parentSuspense && parentSuspense.pendingBranch) {
  9214. parentSuspenseId = parentSuspense.pendingId;
  9215. parentSuspense.deps++;
  9216. }
  9217. }
  9218. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9219. {
  9220. assertNumber(timeout, `Suspense timeout`);
  9221. }
  9222. const initialAnchor = anchor;
  9223. const suspense = {
  9224. vnode,
  9225. parent: parentSuspense,
  9226. parentComponent,
  9227. namespace,
  9228. container,
  9229. hiddenContainer,
  9230. deps: 0,
  9231. pendingId: suspenseId++,
  9232. timeout: typeof timeout === "number" ? timeout : -1,
  9233. activeBranch: null,
  9234. pendingBranch: null,
  9235. isInFallback: !isHydrating,
  9236. isHydrating,
  9237. isUnmounted: false,
  9238. effects: [],
  9239. resolve(resume = false, sync = false) {
  9240. {
  9241. if (!resume && !suspense.pendingBranch) {
  9242. throw new Error(
  9243. `suspense.resolve() is called without a pending branch.`
  9244. );
  9245. }
  9246. if (suspense.isUnmounted) {
  9247. throw new Error(
  9248. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9249. );
  9250. }
  9251. }
  9252. const {
  9253. vnode: vnode2,
  9254. activeBranch,
  9255. pendingBranch,
  9256. pendingId,
  9257. effects,
  9258. parentComponent: parentComponent2,
  9259. container: container2
  9260. } = suspense;
  9261. let delayEnter = false;
  9262. if (suspense.isHydrating) {
  9263. suspense.isHydrating = false;
  9264. } else if (!resume) {
  9265. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9266. if (delayEnter) {
  9267. activeBranch.transition.afterLeave = () => {
  9268. if (pendingId === suspense.pendingId) {
  9269. move(
  9270. pendingBranch,
  9271. container2,
  9272. anchor === initialAnchor ? next(activeBranch) : anchor,
  9273. 0
  9274. );
  9275. queuePostFlushCb(effects);
  9276. }
  9277. };
  9278. }
  9279. if (activeBranch) {
  9280. if (parentNode(activeBranch.el) === container2) {
  9281. anchor = next(activeBranch);
  9282. }
  9283. unmount(activeBranch, parentComponent2, suspense, true);
  9284. }
  9285. if (!delayEnter) {
  9286. move(pendingBranch, container2, anchor, 0);
  9287. }
  9288. }
  9289. setActiveBranch(suspense, pendingBranch);
  9290. suspense.pendingBranch = null;
  9291. suspense.isInFallback = false;
  9292. let parent = suspense.parent;
  9293. let hasUnresolvedAncestor = false;
  9294. while (parent) {
  9295. if (parent.pendingBranch) {
  9296. parent.effects.push(...effects);
  9297. hasUnresolvedAncestor = true;
  9298. break;
  9299. }
  9300. parent = parent.parent;
  9301. }
  9302. if (!hasUnresolvedAncestor && !delayEnter) {
  9303. queuePostFlushCb(effects);
  9304. }
  9305. suspense.effects = [];
  9306. if (isSuspensible) {
  9307. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9308. parentSuspense.deps--;
  9309. if (parentSuspense.deps === 0 && !sync) {
  9310. parentSuspense.resolve();
  9311. }
  9312. }
  9313. }
  9314. triggerEvent(vnode2, "onResolve");
  9315. },
  9316. fallback(fallbackVNode) {
  9317. if (!suspense.pendingBranch) {
  9318. return;
  9319. }
  9320. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9321. triggerEvent(vnode2, "onFallback");
  9322. const anchor2 = next(activeBranch);
  9323. const mountFallback = () => {
  9324. if (!suspense.isInFallback) {
  9325. return;
  9326. }
  9327. patch(
  9328. null,
  9329. fallbackVNode,
  9330. container2,
  9331. anchor2,
  9332. parentComponent2,
  9333. null,
  9334. // fallback tree will not have suspense context
  9335. namespace2,
  9336. slotScopeIds,
  9337. optimized
  9338. );
  9339. setActiveBranch(suspense, fallbackVNode);
  9340. };
  9341. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9342. if (delayEnter) {
  9343. activeBranch.transition.afterLeave = mountFallback;
  9344. }
  9345. suspense.isInFallback = true;
  9346. unmount(
  9347. activeBranch,
  9348. parentComponent2,
  9349. null,
  9350. // no suspense so unmount hooks fire now
  9351. true
  9352. // shouldRemove
  9353. );
  9354. if (!delayEnter) {
  9355. mountFallback();
  9356. }
  9357. },
  9358. move(container2, anchor2, type) {
  9359. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9360. suspense.container = container2;
  9361. },
  9362. next() {
  9363. return suspense.activeBranch && next(suspense.activeBranch);
  9364. },
  9365. registerDep(instance, setupRenderEffect, optimized2) {
  9366. const isInPendingSuspense = !!suspense.pendingBranch;
  9367. if (isInPendingSuspense) {
  9368. suspense.deps++;
  9369. }
  9370. const hydratedEl = instance.vnode.el;
  9371. instance.asyncDep.catch((err) => {
  9372. handleError(err, instance, 0);
  9373. }).then((asyncSetupResult) => {
  9374. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9375. return;
  9376. }
  9377. instance.asyncResolved = true;
  9378. const { vnode: vnode2 } = instance;
  9379. {
  9380. pushWarningContext(vnode2);
  9381. }
  9382. handleSetupResult(instance, asyncSetupResult, false);
  9383. if (hydratedEl) {
  9384. vnode2.el = hydratedEl;
  9385. }
  9386. const placeholder = !hydratedEl && instance.subTree.el;
  9387. setupRenderEffect(
  9388. instance,
  9389. vnode2,
  9390. // component may have been moved before resolve.
  9391. // if this is not a hydration, instance.subTree will be the comment
  9392. // placeholder.
  9393. parentNode(hydratedEl || instance.subTree.el),
  9394. // anchor will not be used if this is hydration, so only need to
  9395. // consider the comment placeholder case.
  9396. hydratedEl ? null : next(instance.subTree),
  9397. suspense,
  9398. namespace,
  9399. optimized2
  9400. );
  9401. if (placeholder) {
  9402. remove(placeholder);
  9403. }
  9404. updateHOCHostEl(instance, vnode2.el);
  9405. {
  9406. popWarningContext();
  9407. }
  9408. if (isInPendingSuspense && --suspense.deps === 0) {
  9409. suspense.resolve();
  9410. }
  9411. });
  9412. },
  9413. unmount(parentSuspense2, doRemove) {
  9414. suspense.isUnmounted = true;
  9415. if (suspense.activeBranch) {
  9416. unmount(
  9417. suspense.activeBranch,
  9418. parentComponent,
  9419. parentSuspense2,
  9420. doRemove
  9421. );
  9422. }
  9423. if (suspense.pendingBranch) {
  9424. unmount(
  9425. suspense.pendingBranch,
  9426. parentComponent,
  9427. parentSuspense2,
  9428. doRemove
  9429. );
  9430. }
  9431. }
  9432. };
  9433. return suspense;
  9434. }
  9435. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9436. const suspense = vnode.suspense = createSuspenseBoundary(
  9437. vnode,
  9438. parentSuspense,
  9439. parentComponent,
  9440. node.parentNode,
  9441. // eslint-disable-next-line no-restricted-globals
  9442. document.createElement("div"),
  9443. null,
  9444. namespace,
  9445. slotScopeIds,
  9446. optimized,
  9447. rendererInternals,
  9448. true
  9449. );
  9450. const result = hydrateNode(
  9451. node,
  9452. suspense.pendingBranch = vnode.ssContent,
  9453. parentComponent,
  9454. suspense,
  9455. slotScopeIds,
  9456. optimized
  9457. );
  9458. if (suspense.deps === 0) {
  9459. suspense.resolve(false, true);
  9460. }
  9461. return result;
  9462. }
  9463. function normalizeSuspenseChildren(vnode) {
  9464. const { shapeFlag, children } = vnode;
  9465. const isSlotChildren = shapeFlag & 32;
  9466. vnode.ssContent = normalizeSuspenseSlot(
  9467. isSlotChildren ? children.default : children
  9468. );
  9469. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9470. }
  9471. function normalizeSuspenseSlot(s) {
  9472. let block;
  9473. if (isFunction(s)) {
  9474. const trackBlock = isBlockTreeEnabled && s._c;
  9475. if (trackBlock) {
  9476. s._d = false;
  9477. openBlock();
  9478. }
  9479. s = s();
  9480. if (trackBlock) {
  9481. s._d = true;
  9482. block = currentBlock;
  9483. closeBlock();
  9484. }
  9485. }
  9486. if (isArray(s)) {
  9487. const singleChild = filterSingleRoot(s);
  9488. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9489. warn$1(`<Suspense> slots expect a single root node.`);
  9490. }
  9491. s = singleChild;
  9492. }
  9493. s = normalizeVNode(s);
  9494. if (block && !s.dynamicChildren) {
  9495. s.dynamicChildren = block.filter((c) => c !== s);
  9496. }
  9497. return s;
  9498. }
  9499. function queueEffectWithSuspense(fn, suspense) {
  9500. if (suspense && suspense.pendingBranch) {
  9501. if (isArray(fn)) {
  9502. suspense.effects.push(...fn);
  9503. } else {
  9504. suspense.effects.push(fn);
  9505. }
  9506. } else {
  9507. queuePostFlushCb(fn);
  9508. }
  9509. }
  9510. function setActiveBranch(suspense, branch) {
  9511. suspense.activeBranch = branch;
  9512. const { vnode, parentComponent } = suspense;
  9513. let el = branch.el;
  9514. while (!el && branch.component) {
  9515. branch = branch.component.subTree;
  9516. el = branch.el;
  9517. }
  9518. vnode.el = el;
  9519. if (parentComponent && parentComponent.subTree === vnode) {
  9520. parentComponent.vnode.el = el;
  9521. updateHOCHostEl(parentComponent, el);
  9522. }
  9523. }
  9524. function isVNodeSuspensible(vnode) {
  9525. const suspensible = vnode.props && vnode.props.suspensible;
  9526. return suspensible != null && suspensible !== false;
  9527. }
  9528. const Fragment = Symbol.for("v-fgt");
  9529. const Text = Symbol.for("v-txt");
  9530. const Comment = Symbol.for("v-cmt");
  9531. const Static = Symbol.for("v-stc");
  9532. const blockStack = [];
  9533. let currentBlock = null;
  9534. function openBlock(disableTracking = false) {
  9535. blockStack.push(currentBlock = disableTracking ? null : []);
  9536. }
  9537. function closeBlock() {
  9538. blockStack.pop();
  9539. currentBlock = blockStack[blockStack.length - 1] || null;
  9540. }
  9541. let isBlockTreeEnabled = 1;
  9542. function setBlockTracking(value, inVOnce = false) {
  9543. isBlockTreeEnabled += value;
  9544. if (value < 0 && currentBlock && inVOnce) {
  9545. currentBlock.hasOnce = true;
  9546. }
  9547. }
  9548. function setupBlock(vnode) {
  9549. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9550. closeBlock();
  9551. if (isBlockTreeEnabled > 0 && currentBlock) {
  9552. currentBlock.push(vnode);
  9553. }
  9554. return vnode;
  9555. }
  9556. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9557. return setupBlock(
  9558. createBaseVNode(
  9559. type,
  9560. props,
  9561. children,
  9562. patchFlag,
  9563. dynamicProps,
  9564. shapeFlag,
  9565. true
  9566. )
  9567. );
  9568. }
  9569. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9570. return setupBlock(
  9571. createVNode(
  9572. type,
  9573. props,
  9574. children,
  9575. patchFlag,
  9576. dynamicProps,
  9577. true
  9578. )
  9579. );
  9580. }
  9581. function isVNode(value) {
  9582. return value ? value.__v_isVNode === true : false;
  9583. }
  9584. function isSameVNodeType(n1, n2) {
  9585. if (n2.shapeFlag & 6 && n1.component) {
  9586. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9587. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9588. n1.shapeFlag &= -257;
  9589. n2.shapeFlag &= -513;
  9590. return false;
  9591. }
  9592. }
  9593. return n1.type === n2.type && n1.key === n2.key;
  9594. }
  9595. let vnodeArgsTransformer;
  9596. function transformVNodeArgs(transformer) {
  9597. vnodeArgsTransformer = transformer;
  9598. }
  9599. const createVNodeWithArgsTransform = (...args) => {
  9600. return _createVNode(
  9601. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9602. );
  9603. };
  9604. const normalizeKey = ({ key }) => key != null ? key : null;
  9605. const normalizeRef = ({
  9606. ref,
  9607. ref_key,
  9608. ref_for
  9609. }) => {
  9610. if (typeof ref === "number") {
  9611. ref = "" + ref;
  9612. }
  9613. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9614. };
  9615. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9616. const vnode = {
  9617. __v_isVNode: true,
  9618. __v_skip: true,
  9619. type,
  9620. props,
  9621. key: props && normalizeKey(props),
  9622. ref: props && normalizeRef(props),
  9623. scopeId: currentScopeId,
  9624. slotScopeIds: null,
  9625. children,
  9626. component: null,
  9627. suspense: null,
  9628. ssContent: null,
  9629. ssFallback: null,
  9630. dirs: null,
  9631. transition: null,
  9632. el: null,
  9633. anchor: null,
  9634. target: null,
  9635. targetStart: null,
  9636. targetAnchor: null,
  9637. staticCount: 0,
  9638. shapeFlag,
  9639. patchFlag,
  9640. dynamicProps,
  9641. dynamicChildren: null,
  9642. appContext: null,
  9643. ctx: currentRenderingInstance
  9644. };
  9645. if (needFullChildrenNormalization) {
  9646. normalizeChildren(vnode, children);
  9647. if (shapeFlag & 128) {
  9648. type.normalize(vnode);
  9649. }
  9650. } else if (children) {
  9651. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9652. }
  9653. if (vnode.key !== vnode.key) {
  9654. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9655. }
  9656. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9657. !isBlockNode && // has current parent block
  9658. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9659. // component nodes also should always be patched, because even if the
  9660. // component doesn't need to update, it needs to persist the instance on to
  9661. // the next vnode so that it can be properly unmounted later.
  9662. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9663. // vnode should not be considered dynamic due to handler caching.
  9664. vnode.patchFlag !== 32) {
  9665. currentBlock.push(vnode);
  9666. }
  9667. return vnode;
  9668. }
  9669. const createVNode = createVNodeWithArgsTransform ;
  9670. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9671. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9672. if (!type) {
  9673. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9674. }
  9675. type = Comment;
  9676. }
  9677. if (isVNode(type)) {
  9678. const cloned = cloneVNode(
  9679. type,
  9680. props,
  9681. true
  9682. /* mergeRef: true */
  9683. );
  9684. if (children) {
  9685. normalizeChildren(cloned, children);
  9686. }
  9687. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9688. if (cloned.shapeFlag & 6) {
  9689. currentBlock[currentBlock.indexOf(type)] = cloned;
  9690. } else {
  9691. currentBlock.push(cloned);
  9692. }
  9693. }
  9694. cloned.patchFlag = -2;
  9695. return cloned;
  9696. }
  9697. if (isClassComponent(type)) {
  9698. type = type.__vccOpts;
  9699. }
  9700. if (props) {
  9701. props = guardReactiveProps(props);
  9702. let { class: klass, style } = props;
  9703. if (klass && !isString(klass)) {
  9704. props.class = normalizeClass(klass);
  9705. }
  9706. if (isObject(style)) {
  9707. if (isProxy(style) && !isArray(style)) {
  9708. style = extend({}, style);
  9709. }
  9710. props.style = normalizeStyle(style);
  9711. }
  9712. }
  9713. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9714. if (shapeFlag & 4 && isProxy(type)) {
  9715. type = toRaw(type);
  9716. warn$1(
  9717. `Vue received a Component that 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\`.`,
  9718. `
  9719. Component that was made reactive: `,
  9720. type
  9721. );
  9722. }
  9723. return createBaseVNode(
  9724. type,
  9725. props,
  9726. children,
  9727. patchFlag,
  9728. dynamicProps,
  9729. shapeFlag,
  9730. isBlockNode,
  9731. true
  9732. );
  9733. }
  9734. function guardReactiveProps(props) {
  9735. if (!props) return null;
  9736. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9737. }
  9738. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9739. const { props, ref, patchFlag, children, transition } = vnode;
  9740. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9741. const cloned = {
  9742. __v_isVNode: true,
  9743. __v_skip: true,
  9744. type: vnode.type,
  9745. props: mergedProps,
  9746. key: mergedProps && normalizeKey(mergedProps),
  9747. ref: extraProps && extraProps.ref ? (
  9748. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9749. // if the vnode itself already has a ref, cloneVNode will need to merge
  9750. // the refs so the single vnode can be set on multiple refs
  9751. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9752. ) : ref,
  9753. scopeId: vnode.scopeId,
  9754. slotScopeIds: vnode.slotScopeIds,
  9755. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9756. target: vnode.target,
  9757. targetStart: vnode.targetStart,
  9758. targetAnchor: vnode.targetAnchor,
  9759. staticCount: vnode.staticCount,
  9760. shapeFlag: vnode.shapeFlag,
  9761. // if the vnode is cloned with extra props, we can no longer assume its
  9762. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9763. // note: preserve flag for fragments since they use the flag for children
  9764. // fast paths only.
  9765. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9766. dynamicProps: vnode.dynamicProps,
  9767. dynamicChildren: vnode.dynamicChildren,
  9768. appContext: vnode.appContext,
  9769. dirs: vnode.dirs,
  9770. transition,
  9771. // These should technically only be non-null on mounted VNodes. However,
  9772. // they *should* be copied for kept-alive vnodes. So we just always copy
  9773. // them since them being non-null during a mount doesn't affect the logic as
  9774. // they will simply be overwritten.
  9775. component: vnode.component,
  9776. suspense: vnode.suspense,
  9777. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9778. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9779. placeholder: vnode.placeholder,
  9780. el: vnode.el,
  9781. anchor: vnode.anchor,
  9782. ctx: vnode.ctx,
  9783. ce: vnode.ce
  9784. };
  9785. if (transition && cloneTransition) {
  9786. setTransitionHooks(
  9787. cloned,
  9788. transition.clone(cloned)
  9789. );
  9790. }
  9791. return cloned;
  9792. }
  9793. function deepCloneVNode(vnode) {
  9794. const cloned = cloneVNode(vnode);
  9795. if (isArray(vnode.children)) {
  9796. cloned.children = vnode.children.map(deepCloneVNode);
  9797. }
  9798. return cloned;
  9799. }
  9800. function createTextVNode(text = " ", flag = 0) {
  9801. return createVNode(Text, null, text, flag);
  9802. }
  9803. function createStaticVNode(content, numberOfNodes) {
  9804. const vnode = createVNode(Static, null, content);
  9805. vnode.staticCount = numberOfNodes;
  9806. return vnode;
  9807. }
  9808. function createCommentVNode(text = "", asBlock = false) {
  9809. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9810. }
  9811. function normalizeVNode(child) {
  9812. if (child == null || typeof child === "boolean") {
  9813. return createVNode(Comment);
  9814. } else if (isArray(child)) {
  9815. return createVNode(
  9816. Fragment,
  9817. null,
  9818. // #3666, avoid reference pollution when reusing vnode
  9819. child.slice()
  9820. );
  9821. } else if (isVNode(child)) {
  9822. return cloneIfMounted(child);
  9823. } else {
  9824. return createVNode(Text, null, String(child));
  9825. }
  9826. }
  9827. function cloneIfMounted(child) {
  9828. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  9829. }
  9830. function normalizeChildren(vnode, children) {
  9831. let type = 0;
  9832. const { shapeFlag } = vnode;
  9833. if (children == null) {
  9834. children = null;
  9835. } else if (isArray(children)) {
  9836. type = 16;
  9837. } else if (typeof children === "object") {
  9838. if (shapeFlag & (1 | 64)) {
  9839. const slot = children.default;
  9840. if (slot) {
  9841. slot._c && (slot._d = false);
  9842. normalizeChildren(vnode, slot());
  9843. slot._c && (slot._d = true);
  9844. }
  9845. return;
  9846. } else {
  9847. type = 32;
  9848. const slotFlag = children._;
  9849. if (!slotFlag && !isInternalObject(children)) {
  9850. children._ctx = currentRenderingInstance;
  9851. } else if (slotFlag === 3 && currentRenderingInstance) {
  9852. if (currentRenderingInstance.slots._ === 1) {
  9853. children._ = 1;
  9854. } else {
  9855. children._ = 2;
  9856. vnode.patchFlag |= 1024;
  9857. }
  9858. }
  9859. }
  9860. } else if (isFunction(children)) {
  9861. children = { default: children, _ctx: currentRenderingInstance };
  9862. type = 32;
  9863. } else {
  9864. children = String(children);
  9865. if (shapeFlag & 64) {
  9866. type = 16;
  9867. children = [createTextVNode(children)];
  9868. } else {
  9869. type = 8;
  9870. }
  9871. }
  9872. vnode.children = children;
  9873. vnode.shapeFlag |= type;
  9874. }
  9875. function mergeProps(...args) {
  9876. const ret = {};
  9877. for (let i = 0; i < args.length; i++) {
  9878. const toMerge = args[i];
  9879. for (const key in toMerge) {
  9880. if (key === "class") {
  9881. if (ret.class !== toMerge.class) {
  9882. ret.class = normalizeClass([ret.class, toMerge.class]);
  9883. }
  9884. } else if (key === "style") {
  9885. ret.style = normalizeStyle([ret.style, toMerge.style]);
  9886. } else if (isOn(key)) {
  9887. const existing = ret[key];
  9888. const incoming = toMerge[key];
  9889. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  9890. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  9891. }
  9892. } else if (key !== "") {
  9893. ret[key] = toMerge[key];
  9894. }
  9895. }
  9896. }
  9897. return ret;
  9898. }
  9899. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  9900. callWithAsyncErrorHandling(hook, instance, 7, [
  9901. vnode,
  9902. prevVNode
  9903. ]);
  9904. }
  9905. const emptyAppContext = createAppContext();
  9906. let uid = 0;
  9907. function createComponentInstance(vnode, parent, suspense) {
  9908. const type = vnode.type;
  9909. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  9910. const instance = {
  9911. uid: uid++,
  9912. vnode,
  9913. type,
  9914. parent,
  9915. appContext,
  9916. root: null,
  9917. // to be immediately set
  9918. next: null,
  9919. subTree: null,
  9920. // will be set synchronously right after creation
  9921. effect: null,
  9922. update: null,
  9923. // will be set synchronously right after creation
  9924. job: null,
  9925. scope: new EffectScope(
  9926. true
  9927. /* detached */
  9928. ),
  9929. render: null,
  9930. proxy: null,
  9931. exposed: null,
  9932. exposeProxy: null,
  9933. withProxy: null,
  9934. provides: parent ? parent.provides : Object.create(appContext.provides),
  9935. ids: parent ? parent.ids : ["", 0, 0],
  9936. accessCache: null,
  9937. renderCache: [],
  9938. // local resolved assets
  9939. components: null,
  9940. directives: null,
  9941. // resolved props and emits options
  9942. propsOptions: normalizePropsOptions(type, appContext),
  9943. emitsOptions: normalizeEmitsOptions(type, appContext),
  9944. // emit
  9945. emit: null,
  9946. // to be set immediately
  9947. emitted: null,
  9948. // props default value
  9949. propsDefaults: EMPTY_OBJ,
  9950. // inheritAttrs
  9951. inheritAttrs: type.inheritAttrs,
  9952. // state
  9953. ctx: EMPTY_OBJ,
  9954. data: EMPTY_OBJ,
  9955. props: EMPTY_OBJ,
  9956. attrs: EMPTY_OBJ,
  9957. slots: EMPTY_OBJ,
  9958. refs: EMPTY_OBJ,
  9959. setupState: EMPTY_OBJ,
  9960. setupContext: null,
  9961. // suspense related
  9962. suspense,
  9963. suspenseId: suspense ? suspense.pendingId : 0,
  9964. asyncDep: null,
  9965. asyncResolved: false,
  9966. // lifecycle hooks
  9967. // not using enums here because it results in computed properties
  9968. isMounted: false,
  9969. isUnmounted: false,
  9970. isDeactivated: false,
  9971. bc: null,
  9972. c: null,
  9973. bm: null,
  9974. m: null,
  9975. bu: null,
  9976. u: null,
  9977. um: null,
  9978. bum: null,
  9979. da: null,
  9980. a: null,
  9981. rtg: null,
  9982. rtc: null,
  9983. ec: null,
  9984. sp: null
  9985. };
  9986. {
  9987. instance.ctx = createDevRenderContext(instance);
  9988. }
  9989. instance.root = parent ? parent.root : instance;
  9990. instance.emit = emit.bind(null, instance);
  9991. if (vnode.ce) {
  9992. vnode.ce(instance);
  9993. }
  9994. return instance;
  9995. }
  9996. let currentInstance = null;
  9997. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9998. let internalSetCurrentInstance;
  9999. let setInSSRSetupState;
  10000. {
  10001. const g = getGlobalThis();
  10002. const registerGlobalSetter = (key, setter) => {
  10003. let setters;
  10004. if (!(setters = g[key])) setters = g[key] = [];
  10005. setters.push(setter);
  10006. return (v) => {
  10007. if (setters.length > 1) setters.forEach((set) => set(v));
  10008. else setters[0](v);
  10009. };
  10010. };
  10011. internalSetCurrentInstance = registerGlobalSetter(
  10012. `__VUE_INSTANCE_SETTERS__`,
  10013. (v) => currentInstance = v
  10014. );
  10015. setInSSRSetupState = registerGlobalSetter(
  10016. `__VUE_SSR_SETTERS__`,
  10017. (v) => isInSSRComponentSetup = v
  10018. );
  10019. }
  10020. const setCurrentInstance = (instance) => {
  10021. const prev = currentInstance;
  10022. internalSetCurrentInstance(instance);
  10023. instance.scope.on();
  10024. return () => {
  10025. instance.scope.off();
  10026. internalSetCurrentInstance(prev);
  10027. };
  10028. };
  10029. const unsetCurrentInstance = () => {
  10030. currentInstance && currentInstance.scope.off();
  10031. internalSetCurrentInstance(null);
  10032. };
  10033. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  10034. function validateComponentName(name, { isNativeTag }) {
  10035. if (isBuiltInTag(name) || isNativeTag(name)) {
  10036. warn$1(
  10037. "Do not use built-in or reserved HTML elements as component id: " + name
  10038. );
  10039. }
  10040. }
  10041. function isStatefulComponent(instance) {
  10042. return instance.vnode.shapeFlag & 4;
  10043. }
  10044. let isInSSRComponentSetup = false;
  10045. function setupComponent(instance, isSSR = false, optimized = false) {
  10046. isSSR && setInSSRSetupState(isSSR);
  10047. const { props, children } = instance.vnode;
  10048. const isStateful = isStatefulComponent(instance);
  10049. initProps(instance, props, isStateful, isSSR);
  10050. initSlots(instance, children, optimized || isSSR);
  10051. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  10052. isSSR && setInSSRSetupState(false);
  10053. return setupResult;
  10054. }
  10055. function setupStatefulComponent(instance, isSSR) {
  10056. var _a;
  10057. const Component = instance.type;
  10058. {
  10059. if (Component.name) {
  10060. validateComponentName(Component.name, instance.appContext.config);
  10061. }
  10062. if (Component.components) {
  10063. const names = Object.keys(Component.components);
  10064. for (let i = 0; i < names.length; i++) {
  10065. validateComponentName(names[i], instance.appContext.config);
  10066. }
  10067. }
  10068. if (Component.directives) {
  10069. const names = Object.keys(Component.directives);
  10070. for (let i = 0; i < names.length; i++) {
  10071. validateDirectiveName(names[i]);
  10072. }
  10073. }
  10074. if (Component.compilerOptions && isRuntimeOnly()) {
  10075. warn$1(
  10076. `"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.`
  10077. );
  10078. }
  10079. }
  10080. instance.accessCache = /* @__PURE__ */ Object.create(null);
  10081. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  10082. {
  10083. exposePropsOnRenderContext(instance);
  10084. }
  10085. const { setup } = Component;
  10086. if (setup) {
  10087. pauseTracking();
  10088. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  10089. const reset = setCurrentInstance(instance);
  10090. const setupResult = callWithErrorHandling(
  10091. setup,
  10092. instance,
  10093. 0,
  10094. [
  10095. shallowReadonly(instance.props) ,
  10096. setupContext
  10097. ]
  10098. );
  10099. const isAsyncSetup = isPromise(setupResult);
  10100. resetTracking();
  10101. reset();
  10102. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  10103. markAsyncBoundary(instance);
  10104. }
  10105. if (isAsyncSetup) {
  10106. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  10107. if (isSSR) {
  10108. return setupResult.then((resolvedResult) => {
  10109. handleSetupResult(instance, resolvedResult, isSSR);
  10110. }).catch((e) => {
  10111. handleError(e, instance, 0);
  10112. });
  10113. } else {
  10114. instance.asyncDep = setupResult;
  10115. if (!instance.suspense) {
  10116. const name = (_a = Component.name) != null ? _a : "Anonymous";
  10117. warn$1(
  10118. `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
  10119. );
  10120. }
  10121. }
  10122. } else {
  10123. handleSetupResult(instance, setupResult, isSSR);
  10124. }
  10125. } else {
  10126. finishComponentSetup(instance, isSSR);
  10127. }
  10128. }
  10129. function handleSetupResult(instance, setupResult, isSSR) {
  10130. if (isFunction(setupResult)) {
  10131. if (instance.type.__ssrInlineRender) {
  10132. instance.ssrRender = setupResult;
  10133. } else {
  10134. instance.render = setupResult;
  10135. }
  10136. } else if (isObject(setupResult)) {
  10137. if (isVNode(setupResult)) {
  10138. warn$1(
  10139. `setup() should not return VNodes directly - return a render function instead.`
  10140. );
  10141. }
  10142. {
  10143. instance.devtoolsRawSetupState = setupResult;
  10144. }
  10145. instance.setupState = proxyRefs(setupResult);
  10146. {
  10147. exposeSetupStateOnRenderContext(instance);
  10148. }
  10149. } else if (setupResult !== void 0) {
  10150. warn$1(
  10151. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10152. );
  10153. }
  10154. finishComponentSetup(instance, isSSR);
  10155. }
  10156. let compile$1;
  10157. let installWithProxy;
  10158. function registerRuntimeCompiler(_compile) {
  10159. compile$1 = _compile;
  10160. installWithProxy = (i) => {
  10161. if (i.render._rc) {
  10162. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10163. }
  10164. };
  10165. }
  10166. const isRuntimeOnly = () => !compile$1;
  10167. function finishComponentSetup(instance, isSSR, skipOptions) {
  10168. const Component = instance.type;
  10169. if (!instance.render) {
  10170. if (!isSSR && compile$1 && !Component.render) {
  10171. const template = Component.template || resolveMergedOptions(instance).template;
  10172. if (template) {
  10173. {
  10174. startMeasure(instance, `compile`);
  10175. }
  10176. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10177. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10178. const finalCompilerOptions = extend(
  10179. extend(
  10180. {
  10181. isCustomElement,
  10182. delimiters
  10183. },
  10184. compilerOptions
  10185. ),
  10186. componentCompilerOptions
  10187. );
  10188. Component.render = compile$1(template, finalCompilerOptions);
  10189. {
  10190. endMeasure(instance, `compile`);
  10191. }
  10192. }
  10193. }
  10194. instance.render = Component.render || NOOP;
  10195. if (installWithProxy) {
  10196. installWithProxy(instance);
  10197. }
  10198. }
  10199. {
  10200. const reset = setCurrentInstance(instance);
  10201. pauseTracking();
  10202. try {
  10203. applyOptions(instance);
  10204. } finally {
  10205. resetTracking();
  10206. reset();
  10207. }
  10208. }
  10209. if (!Component.render && instance.render === NOOP && !isSSR) {
  10210. if (!compile$1 && Component.template) {
  10211. warn$1(
  10212. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  10213. );
  10214. } else {
  10215. warn$1(`Component is missing template or render function: `, Component);
  10216. }
  10217. }
  10218. }
  10219. const attrsProxyHandlers = {
  10220. get(target, key) {
  10221. markAttrsAccessed();
  10222. track(target, "get", "");
  10223. return target[key];
  10224. },
  10225. set() {
  10226. warn$1(`setupContext.attrs is readonly.`);
  10227. return false;
  10228. },
  10229. deleteProperty() {
  10230. warn$1(`setupContext.attrs is readonly.`);
  10231. return false;
  10232. }
  10233. } ;
  10234. function getSlotsProxy(instance) {
  10235. return new Proxy(instance.slots, {
  10236. get(target, key) {
  10237. track(instance, "get", "$slots");
  10238. return target[key];
  10239. }
  10240. });
  10241. }
  10242. function createSetupContext(instance) {
  10243. const expose = (exposed) => {
  10244. {
  10245. if (instance.exposed) {
  10246. warn$1(`expose() should be called only once per setup().`);
  10247. }
  10248. if (exposed != null) {
  10249. let exposedType = typeof exposed;
  10250. if (exposedType === "object") {
  10251. if (isArray(exposed)) {
  10252. exposedType = "array";
  10253. } else if (isRef(exposed)) {
  10254. exposedType = "ref";
  10255. }
  10256. }
  10257. if (exposedType !== "object") {
  10258. warn$1(
  10259. `expose() should be passed a plain object, received ${exposedType}.`
  10260. );
  10261. }
  10262. }
  10263. }
  10264. instance.exposed = exposed || {};
  10265. };
  10266. {
  10267. let attrsProxy;
  10268. let slotsProxy;
  10269. return Object.freeze({
  10270. get attrs() {
  10271. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10272. },
  10273. get slots() {
  10274. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10275. },
  10276. get emit() {
  10277. return (event, ...args) => instance.emit(event, ...args);
  10278. },
  10279. expose
  10280. });
  10281. }
  10282. }
  10283. function getComponentPublicInstance(instance) {
  10284. if (instance.exposed) {
  10285. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10286. get(target, key) {
  10287. if (key in target) {
  10288. return target[key];
  10289. } else if (key in publicPropertiesMap) {
  10290. return publicPropertiesMap[key](instance);
  10291. }
  10292. },
  10293. has(target, key) {
  10294. return key in target || key in publicPropertiesMap;
  10295. }
  10296. }));
  10297. } else {
  10298. return instance.proxy;
  10299. }
  10300. }
  10301. const classifyRE = /(?:^|[-_])(\w)/g;
  10302. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10303. function getComponentName(Component, includeInferred = true) {
  10304. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10305. }
  10306. function formatComponentName(instance, Component, isRoot = false) {
  10307. let name = getComponentName(Component);
  10308. if (!name && Component.__file) {
  10309. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10310. if (match) {
  10311. name = match[1];
  10312. }
  10313. }
  10314. if (!name && instance && instance.parent) {
  10315. const inferFromRegistry = (registry) => {
  10316. for (const key in registry) {
  10317. if (registry[key] === Component) {
  10318. return key;
  10319. }
  10320. }
  10321. };
  10322. name = inferFromRegistry(
  10323. instance.components || instance.parent.type.components
  10324. ) || inferFromRegistry(instance.appContext.components);
  10325. }
  10326. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10327. }
  10328. function isClassComponent(value) {
  10329. return isFunction(value) && "__vccOpts" in value;
  10330. }
  10331. const computed = (getterOrOptions, debugOptions) => {
  10332. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10333. {
  10334. const i = getCurrentInstance();
  10335. if (i && i.appContext.config.warnRecursiveComputed) {
  10336. c._warnRecursive = true;
  10337. }
  10338. }
  10339. return c;
  10340. };
  10341. function h(type, propsOrChildren, children) {
  10342. const l = arguments.length;
  10343. if (l === 2) {
  10344. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10345. if (isVNode(propsOrChildren)) {
  10346. return createVNode(type, null, [propsOrChildren]);
  10347. }
  10348. return createVNode(type, propsOrChildren);
  10349. } else {
  10350. return createVNode(type, null, propsOrChildren);
  10351. }
  10352. } else {
  10353. if (l > 3) {
  10354. children = Array.prototype.slice.call(arguments, 2);
  10355. } else if (l === 3 && isVNode(children)) {
  10356. children = [children];
  10357. }
  10358. return createVNode(type, propsOrChildren, children);
  10359. }
  10360. }
  10361. function initCustomFormatter() {
  10362. if (typeof window === "undefined") {
  10363. return;
  10364. }
  10365. const vueStyle = { style: "color:#3ba776" };
  10366. const numberStyle = { style: "color:#1677ff" };
  10367. const stringStyle = { style: "color:#f5222d" };
  10368. const keywordStyle = { style: "color:#eb2f96" };
  10369. const formatter = {
  10370. __vue_custom_formatter: true,
  10371. header(obj) {
  10372. if (!isObject(obj)) {
  10373. return null;
  10374. }
  10375. if (obj.__isVue) {
  10376. return ["div", vueStyle, `VueInstance`];
  10377. } else if (isRef(obj)) {
  10378. pauseTracking();
  10379. const value = obj.value;
  10380. resetTracking();
  10381. return [
  10382. "div",
  10383. {},
  10384. ["span", vueStyle, genRefFlag(obj)],
  10385. "<",
  10386. formatValue(value),
  10387. `>`
  10388. ];
  10389. } else if (isReactive(obj)) {
  10390. return [
  10391. "div",
  10392. {},
  10393. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10394. "<",
  10395. formatValue(obj),
  10396. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10397. ];
  10398. } else if (isReadonly(obj)) {
  10399. return [
  10400. "div",
  10401. {},
  10402. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10403. "<",
  10404. formatValue(obj),
  10405. ">"
  10406. ];
  10407. }
  10408. return null;
  10409. },
  10410. hasBody(obj) {
  10411. return obj && obj.__isVue;
  10412. },
  10413. body(obj) {
  10414. if (obj && obj.__isVue) {
  10415. return [
  10416. "div",
  10417. {},
  10418. ...formatInstance(obj.$)
  10419. ];
  10420. }
  10421. }
  10422. };
  10423. function formatInstance(instance) {
  10424. const blocks = [];
  10425. if (instance.type.props && instance.props) {
  10426. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10427. }
  10428. if (instance.setupState !== EMPTY_OBJ) {
  10429. blocks.push(createInstanceBlock("setup", instance.setupState));
  10430. }
  10431. if (instance.data !== EMPTY_OBJ) {
  10432. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10433. }
  10434. const computed = extractKeys(instance, "computed");
  10435. if (computed) {
  10436. blocks.push(createInstanceBlock("computed", computed));
  10437. }
  10438. const injected = extractKeys(instance, "inject");
  10439. if (injected) {
  10440. blocks.push(createInstanceBlock("injected", injected));
  10441. }
  10442. blocks.push([
  10443. "div",
  10444. {},
  10445. [
  10446. "span",
  10447. {
  10448. style: keywordStyle.style + ";opacity:0.66"
  10449. },
  10450. "$ (internal): "
  10451. ],
  10452. ["object", { object: instance }]
  10453. ]);
  10454. return blocks;
  10455. }
  10456. function createInstanceBlock(type, target) {
  10457. target = extend({}, target);
  10458. if (!Object.keys(target).length) {
  10459. return ["span", {}];
  10460. }
  10461. return [
  10462. "div",
  10463. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10464. [
  10465. "div",
  10466. {
  10467. style: "color:#476582"
  10468. },
  10469. type
  10470. ],
  10471. [
  10472. "div",
  10473. {
  10474. style: "padding-left:1.25em"
  10475. },
  10476. ...Object.keys(target).map((key) => {
  10477. return [
  10478. "div",
  10479. {},
  10480. ["span", keywordStyle, key + ": "],
  10481. formatValue(target[key], false)
  10482. ];
  10483. })
  10484. ]
  10485. ];
  10486. }
  10487. function formatValue(v, asRaw = true) {
  10488. if (typeof v === "number") {
  10489. return ["span", numberStyle, v];
  10490. } else if (typeof v === "string") {
  10491. return ["span", stringStyle, JSON.stringify(v)];
  10492. } else if (typeof v === "boolean") {
  10493. return ["span", keywordStyle, v];
  10494. } else if (isObject(v)) {
  10495. return ["object", { object: asRaw ? toRaw(v) : v }];
  10496. } else {
  10497. return ["span", stringStyle, String(v)];
  10498. }
  10499. }
  10500. function extractKeys(instance, type) {
  10501. const Comp = instance.type;
  10502. if (isFunction(Comp)) {
  10503. return;
  10504. }
  10505. const extracted = {};
  10506. for (const key in instance.ctx) {
  10507. if (isKeyOfType(Comp, key, type)) {
  10508. extracted[key] = instance.ctx[key];
  10509. }
  10510. }
  10511. return extracted;
  10512. }
  10513. function isKeyOfType(Comp, key, type) {
  10514. const opts = Comp[type];
  10515. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10516. return true;
  10517. }
  10518. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10519. return true;
  10520. }
  10521. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10522. return true;
  10523. }
  10524. }
  10525. function genRefFlag(v) {
  10526. if (isShallow(v)) {
  10527. return `ShallowRef`;
  10528. }
  10529. if (v.effect) {
  10530. return `ComputedRef`;
  10531. }
  10532. return `Ref`;
  10533. }
  10534. if (window.devtoolsFormatters) {
  10535. window.devtoolsFormatters.push(formatter);
  10536. } else {
  10537. window.devtoolsFormatters = [formatter];
  10538. }
  10539. }
  10540. function withMemo(memo, render, cache, index) {
  10541. const cached = cache[index];
  10542. if (cached && isMemoSame(cached, memo)) {
  10543. return cached;
  10544. }
  10545. const ret = render();
  10546. ret.memo = memo.slice();
  10547. ret.cacheIndex = index;
  10548. return cache[index] = ret;
  10549. }
  10550. function isMemoSame(cached, memo) {
  10551. const prev = cached.memo;
  10552. if (prev.length != memo.length) {
  10553. return false;
  10554. }
  10555. for (let i = 0; i < prev.length; i++) {
  10556. if (hasChanged(prev[i], memo[i])) {
  10557. return false;
  10558. }
  10559. }
  10560. if (isBlockTreeEnabled > 0 && currentBlock) {
  10561. currentBlock.push(cached);
  10562. }
  10563. return true;
  10564. }
  10565. const version = "3.5.19";
  10566. const warn = warn$1 ;
  10567. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10568. const devtools = devtools$1 ;
  10569. const setDevtoolsHook = setDevtoolsHook$1 ;
  10570. const _ssrUtils = {
  10571. createComponentInstance,
  10572. setupComponent,
  10573. renderComponentRoot,
  10574. setCurrentRenderingInstance,
  10575. isVNode: isVNode,
  10576. normalizeVNode,
  10577. getComponentPublicInstance,
  10578. ensureValidVNode,
  10579. pushWarningContext,
  10580. popWarningContext
  10581. };
  10582. const ssrUtils = _ssrUtils ;
  10583. const resolveFilter = null;
  10584. const compatUtils = null;
  10585. const DeprecationTypes = null;
  10586. let policy = void 0;
  10587. const tt = typeof window !== "undefined" && window.trustedTypes;
  10588. if (tt) {
  10589. try {
  10590. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10591. createHTML: (val) => val
  10592. });
  10593. } catch (e) {
  10594. warn(`Error creating trusted types policy: ${e}`);
  10595. }
  10596. }
  10597. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10598. const svgNS = "http://www.w3.org/2000/svg";
  10599. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10600. const doc = typeof document !== "undefined" ? document : null;
  10601. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10602. const nodeOps = {
  10603. insert: (child, parent, anchor) => {
  10604. parent.insertBefore(child, anchor || null);
  10605. },
  10606. remove: (child) => {
  10607. const parent = child.parentNode;
  10608. if (parent) {
  10609. parent.removeChild(child);
  10610. }
  10611. },
  10612. createElement: (tag, namespace, is, props) => {
  10613. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10614. if (tag === "select" && props && props.multiple != null) {
  10615. el.setAttribute("multiple", props.multiple);
  10616. }
  10617. return el;
  10618. },
  10619. createText: (text) => doc.createTextNode(text),
  10620. createComment: (text) => doc.createComment(text),
  10621. setText: (node, text) => {
  10622. node.nodeValue = text;
  10623. },
  10624. setElementText: (el, text) => {
  10625. el.textContent = text;
  10626. },
  10627. parentNode: (node) => node.parentNode,
  10628. nextSibling: (node) => node.nextSibling,
  10629. querySelector: (selector) => doc.querySelector(selector),
  10630. setScopeId(el, id) {
  10631. el.setAttribute(id, "");
  10632. },
  10633. // __UNSAFE__
  10634. // Reason: innerHTML.
  10635. // Static content here can only come from compiled templates.
  10636. // As long as the user only uses trusted templates, this is safe.
  10637. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10638. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10639. if (start && (start === end || start.nextSibling)) {
  10640. while (true) {
  10641. parent.insertBefore(start.cloneNode(true), anchor);
  10642. if (start === end || !(start = start.nextSibling)) break;
  10643. }
  10644. } else {
  10645. templateContainer.innerHTML = unsafeToTrustedHTML(
  10646. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10647. );
  10648. const template = templateContainer.content;
  10649. if (namespace === "svg" || namespace === "mathml") {
  10650. const wrapper = template.firstChild;
  10651. while (wrapper.firstChild) {
  10652. template.appendChild(wrapper.firstChild);
  10653. }
  10654. template.removeChild(wrapper);
  10655. }
  10656. parent.insertBefore(template, anchor);
  10657. }
  10658. return [
  10659. // first
  10660. before ? before.nextSibling : parent.firstChild,
  10661. // last
  10662. anchor ? anchor.previousSibling : parent.lastChild
  10663. ];
  10664. }
  10665. };
  10666. const TRANSITION$1 = "transition";
  10667. const ANIMATION = "animation";
  10668. const vtcKey = Symbol("_vtc");
  10669. const DOMTransitionPropsValidators = {
  10670. name: String,
  10671. type: String,
  10672. css: {
  10673. type: Boolean,
  10674. default: true
  10675. },
  10676. duration: [String, Number, Object],
  10677. enterFromClass: String,
  10678. enterActiveClass: String,
  10679. enterToClass: String,
  10680. appearFromClass: String,
  10681. appearActiveClass: String,
  10682. appearToClass: String,
  10683. leaveFromClass: String,
  10684. leaveActiveClass: String,
  10685. leaveToClass: String
  10686. };
  10687. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10688. {},
  10689. BaseTransitionPropsValidators,
  10690. DOMTransitionPropsValidators
  10691. );
  10692. const decorate$1 = (t) => {
  10693. t.displayName = "Transition";
  10694. t.props = TransitionPropsValidators;
  10695. return t;
  10696. };
  10697. const Transition = /* @__PURE__ */ decorate$1(
  10698. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10699. );
  10700. const callHook = (hook, args = []) => {
  10701. if (isArray(hook)) {
  10702. hook.forEach((h2) => h2(...args));
  10703. } else if (hook) {
  10704. hook(...args);
  10705. }
  10706. };
  10707. const hasExplicitCallback = (hook) => {
  10708. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10709. };
  10710. function resolveTransitionProps(rawProps) {
  10711. const baseProps = {};
  10712. for (const key in rawProps) {
  10713. if (!(key in DOMTransitionPropsValidators)) {
  10714. baseProps[key] = rawProps[key];
  10715. }
  10716. }
  10717. if (rawProps.css === false) {
  10718. return baseProps;
  10719. }
  10720. const {
  10721. name = "v",
  10722. type,
  10723. duration,
  10724. enterFromClass = `${name}-enter-from`,
  10725. enterActiveClass = `${name}-enter-active`,
  10726. enterToClass = `${name}-enter-to`,
  10727. appearFromClass = enterFromClass,
  10728. appearActiveClass = enterActiveClass,
  10729. appearToClass = enterToClass,
  10730. leaveFromClass = `${name}-leave-from`,
  10731. leaveActiveClass = `${name}-leave-active`,
  10732. leaveToClass = `${name}-leave-to`
  10733. } = rawProps;
  10734. const durations = normalizeDuration(duration);
  10735. const enterDuration = durations && durations[0];
  10736. const leaveDuration = durations && durations[1];
  10737. const {
  10738. onBeforeEnter,
  10739. onEnter,
  10740. onEnterCancelled,
  10741. onLeave,
  10742. onLeaveCancelled,
  10743. onBeforeAppear = onBeforeEnter,
  10744. onAppear = onEnter,
  10745. onAppearCancelled = onEnterCancelled
  10746. } = baseProps;
  10747. const finishEnter = (el, isAppear, done, isCancelled) => {
  10748. el._enterCancelled = isCancelled;
  10749. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10750. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10751. done && done();
  10752. };
  10753. const finishLeave = (el, done) => {
  10754. el._isLeaving = false;
  10755. removeTransitionClass(el, leaveFromClass);
  10756. removeTransitionClass(el, leaveToClass);
  10757. removeTransitionClass(el, leaveActiveClass);
  10758. done && done();
  10759. };
  10760. const makeEnterHook = (isAppear) => {
  10761. return (el, done) => {
  10762. const hook = isAppear ? onAppear : onEnter;
  10763. const resolve = () => finishEnter(el, isAppear, done);
  10764. callHook(hook, [el, resolve]);
  10765. nextFrame(() => {
  10766. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10767. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10768. if (!hasExplicitCallback(hook)) {
  10769. whenTransitionEnds(el, type, enterDuration, resolve);
  10770. }
  10771. });
  10772. };
  10773. };
  10774. return extend(baseProps, {
  10775. onBeforeEnter(el) {
  10776. callHook(onBeforeEnter, [el]);
  10777. addTransitionClass(el, enterFromClass);
  10778. addTransitionClass(el, enterActiveClass);
  10779. },
  10780. onBeforeAppear(el) {
  10781. callHook(onBeforeAppear, [el]);
  10782. addTransitionClass(el, appearFromClass);
  10783. addTransitionClass(el, appearActiveClass);
  10784. },
  10785. onEnter: makeEnterHook(false),
  10786. onAppear: makeEnterHook(true),
  10787. onLeave(el, done) {
  10788. el._isLeaving = true;
  10789. const resolve = () => finishLeave(el, done);
  10790. addTransitionClass(el, leaveFromClass);
  10791. if (!el._enterCancelled) {
  10792. forceReflow();
  10793. addTransitionClass(el, leaveActiveClass);
  10794. } else {
  10795. addTransitionClass(el, leaveActiveClass);
  10796. forceReflow();
  10797. }
  10798. nextFrame(() => {
  10799. if (!el._isLeaving) {
  10800. return;
  10801. }
  10802. removeTransitionClass(el, leaveFromClass);
  10803. addTransitionClass(el, leaveToClass);
  10804. if (!hasExplicitCallback(onLeave)) {
  10805. whenTransitionEnds(el, type, leaveDuration, resolve);
  10806. }
  10807. });
  10808. callHook(onLeave, [el, resolve]);
  10809. },
  10810. onEnterCancelled(el) {
  10811. finishEnter(el, false, void 0, true);
  10812. callHook(onEnterCancelled, [el]);
  10813. },
  10814. onAppearCancelled(el) {
  10815. finishEnter(el, true, void 0, true);
  10816. callHook(onAppearCancelled, [el]);
  10817. },
  10818. onLeaveCancelled(el) {
  10819. finishLeave(el);
  10820. callHook(onLeaveCancelled, [el]);
  10821. }
  10822. });
  10823. }
  10824. function normalizeDuration(duration) {
  10825. if (duration == null) {
  10826. return null;
  10827. } else if (isObject(duration)) {
  10828. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  10829. } else {
  10830. const n = NumberOf(duration);
  10831. return [n, n];
  10832. }
  10833. }
  10834. function NumberOf(val) {
  10835. const res = toNumber(val);
  10836. {
  10837. assertNumber(res, "<transition> explicit duration");
  10838. }
  10839. return res;
  10840. }
  10841. function addTransitionClass(el, cls) {
  10842. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  10843. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  10844. }
  10845. function removeTransitionClass(el, cls) {
  10846. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  10847. const _vtc = el[vtcKey];
  10848. if (_vtc) {
  10849. _vtc.delete(cls);
  10850. if (!_vtc.size) {
  10851. el[vtcKey] = void 0;
  10852. }
  10853. }
  10854. }
  10855. function nextFrame(cb) {
  10856. requestAnimationFrame(() => {
  10857. requestAnimationFrame(cb);
  10858. });
  10859. }
  10860. let endId = 0;
  10861. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  10862. const id = el._endId = ++endId;
  10863. const resolveIfNotStale = () => {
  10864. if (id === el._endId) {
  10865. resolve();
  10866. }
  10867. };
  10868. if (explicitTimeout != null) {
  10869. return setTimeout(resolveIfNotStale, explicitTimeout);
  10870. }
  10871. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  10872. if (!type) {
  10873. return resolve();
  10874. }
  10875. const endEvent = type + "end";
  10876. let ended = 0;
  10877. const end = () => {
  10878. el.removeEventListener(endEvent, onEnd);
  10879. resolveIfNotStale();
  10880. };
  10881. const onEnd = (e) => {
  10882. if (e.target === el && ++ended >= propCount) {
  10883. end();
  10884. }
  10885. };
  10886. setTimeout(() => {
  10887. if (ended < propCount) {
  10888. end();
  10889. }
  10890. }, timeout + 1);
  10891. el.addEventListener(endEvent, onEnd);
  10892. }
  10893. function getTransitionInfo(el, expectedType) {
  10894. const styles = window.getComputedStyle(el);
  10895. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  10896. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  10897. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  10898. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  10899. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  10900. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  10901. const animationTimeout = getTimeout(animationDelays, animationDurations);
  10902. let type = null;
  10903. let timeout = 0;
  10904. let propCount = 0;
  10905. if (expectedType === TRANSITION$1) {
  10906. if (transitionTimeout > 0) {
  10907. type = TRANSITION$1;
  10908. timeout = transitionTimeout;
  10909. propCount = transitionDurations.length;
  10910. }
  10911. } else if (expectedType === ANIMATION) {
  10912. if (animationTimeout > 0) {
  10913. type = ANIMATION;
  10914. timeout = animationTimeout;
  10915. propCount = animationDurations.length;
  10916. }
  10917. } else {
  10918. timeout = Math.max(transitionTimeout, animationTimeout);
  10919. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  10920. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  10921. }
  10922. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  10923. getStyleProperties(`${TRANSITION$1}Property`).toString()
  10924. );
  10925. return {
  10926. type,
  10927. timeout,
  10928. propCount,
  10929. hasTransform
  10930. };
  10931. }
  10932. function getTimeout(delays, durations) {
  10933. while (delays.length < durations.length) {
  10934. delays = delays.concat(delays);
  10935. }
  10936. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  10937. }
  10938. function toMs(s) {
  10939. if (s === "auto") return 0;
  10940. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  10941. }
  10942. function forceReflow() {
  10943. return document.body.offsetHeight;
  10944. }
  10945. function patchClass(el, value, isSVG) {
  10946. const transitionClasses = el[vtcKey];
  10947. if (transitionClasses) {
  10948. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  10949. }
  10950. if (value == null) {
  10951. el.removeAttribute("class");
  10952. } else if (isSVG) {
  10953. el.setAttribute("class", value);
  10954. } else {
  10955. el.className = value;
  10956. }
  10957. }
  10958. const vShowOriginalDisplay = Symbol("_vod");
  10959. const vShowHidden = Symbol("_vsh");
  10960. const vShow = {
  10961. beforeMount(el, { value }, { transition }) {
  10962. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  10963. if (transition && value) {
  10964. transition.beforeEnter(el);
  10965. } else {
  10966. setDisplay(el, value);
  10967. }
  10968. },
  10969. mounted(el, { value }, { transition }) {
  10970. if (transition && value) {
  10971. transition.enter(el);
  10972. }
  10973. },
  10974. updated(el, { value, oldValue }, { transition }) {
  10975. if (!value === !oldValue) return;
  10976. if (transition) {
  10977. if (value) {
  10978. transition.beforeEnter(el);
  10979. setDisplay(el, true);
  10980. transition.enter(el);
  10981. } else {
  10982. transition.leave(el, () => {
  10983. setDisplay(el, false);
  10984. });
  10985. }
  10986. } else {
  10987. setDisplay(el, value);
  10988. }
  10989. },
  10990. beforeUnmount(el, { value }) {
  10991. setDisplay(el, value);
  10992. }
  10993. };
  10994. {
  10995. vShow.name = "show";
  10996. }
  10997. function setDisplay(el, value) {
  10998. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10999. el[vShowHidden] = !value;
  11000. }
  11001. function initVShowForSSR() {
  11002. vShow.getSSRProps = ({ value }) => {
  11003. if (!value) {
  11004. return { style: { display: "none" } };
  11005. }
  11006. };
  11007. }
  11008. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  11009. function useCssVars(getter) {
  11010. const instance = getCurrentInstance();
  11011. if (!instance) {
  11012. warn(`useCssVars is called without current active component instance.`);
  11013. return;
  11014. }
  11015. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  11016. Array.from(
  11017. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  11018. ).forEach((node) => setVarsOnNode(node, vars));
  11019. };
  11020. {
  11021. instance.getCssVars = () => getter(instance.proxy);
  11022. }
  11023. const setVars = () => {
  11024. const vars = getter(instance.proxy);
  11025. if (instance.ce) {
  11026. setVarsOnNode(instance.ce, vars);
  11027. } else {
  11028. setVarsOnVNode(instance.subTree, vars);
  11029. }
  11030. updateTeleports(vars);
  11031. };
  11032. onBeforeUpdate(() => {
  11033. queuePostFlushCb(setVars);
  11034. });
  11035. onMounted(() => {
  11036. watch(setVars, NOOP, { flush: "post" });
  11037. const ob = new MutationObserver(setVars);
  11038. ob.observe(instance.subTree.el.parentNode, { childList: true });
  11039. onUnmounted(() => ob.disconnect());
  11040. });
  11041. }
  11042. function setVarsOnVNode(vnode, vars) {
  11043. if (vnode.shapeFlag & 128) {
  11044. const suspense = vnode.suspense;
  11045. vnode = suspense.activeBranch;
  11046. if (suspense.pendingBranch && !suspense.isHydrating) {
  11047. suspense.effects.push(() => {
  11048. setVarsOnVNode(suspense.activeBranch, vars);
  11049. });
  11050. }
  11051. }
  11052. while (vnode.component) {
  11053. vnode = vnode.component.subTree;
  11054. }
  11055. if (vnode.shapeFlag & 1 && vnode.el) {
  11056. setVarsOnNode(vnode.el, vars);
  11057. } else if (vnode.type === Fragment) {
  11058. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  11059. } else if (vnode.type === Static) {
  11060. let { el, anchor } = vnode;
  11061. while (el) {
  11062. setVarsOnNode(el, vars);
  11063. if (el === anchor) break;
  11064. el = el.nextSibling;
  11065. }
  11066. }
  11067. }
  11068. function setVarsOnNode(el, vars) {
  11069. if (el.nodeType === 1) {
  11070. const style = el.style;
  11071. let cssText = "";
  11072. for (const key in vars) {
  11073. const value = normalizeCssVarValue(vars[key]);
  11074. style.setProperty(`--${key}`, value);
  11075. cssText += `--${key}: ${value};`;
  11076. }
  11077. style[CSS_VAR_TEXT] = cssText;
  11078. }
  11079. }
  11080. const displayRE = /(^|;)\s*display\s*:/;
  11081. function patchStyle(el, prev, next) {
  11082. const style = el.style;
  11083. const isCssString = isString(next);
  11084. let hasControlledDisplay = false;
  11085. if (next && !isCssString) {
  11086. if (prev) {
  11087. if (!isString(prev)) {
  11088. for (const key in prev) {
  11089. if (next[key] == null) {
  11090. setStyle(style, key, "");
  11091. }
  11092. }
  11093. } else {
  11094. for (const prevStyle of prev.split(";")) {
  11095. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  11096. if (next[key] == null) {
  11097. setStyle(style, key, "");
  11098. }
  11099. }
  11100. }
  11101. }
  11102. for (const key in next) {
  11103. if (key === "display") {
  11104. hasControlledDisplay = true;
  11105. }
  11106. setStyle(style, key, next[key]);
  11107. }
  11108. } else {
  11109. if (isCssString) {
  11110. if (prev !== next) {
  11111. const cssVarText = style[CSS_VAR_TEXT];
  11112. if (cssVarText) {
  11113. next += ";" + cssVarText;
  11114. }
  11115. style.cssText = next;
  11116. hasControlledDisplay = displayRE.test(next);
  11117. }
  11118. } else if (prev) {
  11119. el.removeAttribute("style");
  11120. }
  11121. }
  11122. if (vShowOriginalDisplay in el) {
  11123. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  11124. if (el[vShowHidden]) {
  11125. style.display = "none";
  11126. }
  11127. }
  11128. }
  11129. const semicolonRE = /[^\\];\s*$/;
  11130. const importantRE = /\s*!important$/;
  11131. function setStyle(style, name, val) {
  11132. if (isArray(val)) {
  11133. val.forEach((v) => setStyle(style, name, v));
  11134. } else {
  11135. if (val == null) val = "";
  11136. {
  11137. if (semicolonRE.test(val)) {
  11138. warn(
  11139. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  11140. );
  11141. }
  11142. }
  11143. if (name.startsWith("--")) {
  11144. style.setProperty(name, val);
  11145. } else {
  11146. const prefixed = autoPrefix(style, name);
  11147. if (importantRE.test(val)) {
  11148. style.setProperty(
  11149. hyphenate(prefixed),
  11150. val.replace(importantRE, ""),
  11151. "important"
  11152. );
  11153. } else {
  11154. style[prefixed] = val;
  11155. }
  11156. }
  11157. }
  11158. }
  11159. const prefixes = ["Webkit", "Moz", "ms"];
  11160. const prefixCache = {};
  11161. function autoPrefix(style, rawName) {
  11162. const cached = prefixCache[rawName];
  11163. if (cached) {
  11164. return cached;
  11165. }
  11166. let name = camelize(rawName);
  11167. if (name !== "filter" && name in style) {
  11168. return prefixCache[rawName] = name;
  11169. }
  11170. name = capitalize(name);
  11171. for (let i = 0; i < prefixes.length; i++) {
  11172. const prefixed = prefixes[i] + name;
  11173. if (prefixed in style) {
  11174. return prefixCache[rawName] = prefixed;
  11175. }
  11176. }
  11177. return rawName;
  11178. }
  11179. const xlinkNS = "http://www.w3.org/1999/xlink";
  11180. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11181. if (isSVG && key.startsWith("xlink:")) {
  11182. if (value == null) {
  11183. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11184. } else {
  11185. el.setAttributeNS(xlinkNS, key, value);
  11186. }
  11187. } else {
  11188. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11189. el.removeAttribute(key);
  11190. } else {
  11191. el.setAttribute(
  11192. key,
  11193. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11194. );
  11195. }
  11196. }
  11197. }
  11198. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11199. if (key === "innerHTML" || key === "textContent") {
  11200. if (value != null) {
  11201. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11202. }
  11203. return;
  11204. }
  11205. const tag = el.tagName;
  11206. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11207. !tag.includes("-")) {
  11208. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11209. const newValue = value == null ? (
  11210. // #11647: value should be set as empty string for null and undefined,
  11211. // but <input type="checkbox"> should be set as 'on'.
  11212. el.type === "checkbox" ? "on" : ""
  11213. ) : String(value);
  11214. if (oldValue !== newValue || !("_value" in el)) {
  11215. el.value = newValue;
  11216. }
  11217. if (value == null) {
  11218. el.removeAttribute(key);
  11219. }
  11220. el._value = value;
  11221. return;
  11222. }
  11223. let needRemove = false;
  11224. if (value === "" || value == null) {
  11225. const type = typeof el[key];
  11226. if (type === "boolean") {
  11227. value = includeBooleanAttr(value);
  11228. } else if (value == null && type === "string") {
  11229. value = "";
  11230. needRemove = true;
  11231. } else if (type === "number") {
  11232. value = 0;
  11233. needRemove = true;
  11234. }
  11235. }
  11236. try {
  11237. el[key] = value;
  11238. } catch (e) {
  11239. if (!needRemove) {
  11240. warn(
  11241. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11242. e
  11243. );
  11244. }
  11245. }
  11246. needRemove && el.removeAttribute(attrName || key);
  11247. }
  11248. function addEventListener(el, event, handler, options) {
  11249. el.addEventListener(event, handler, options);
  11250. }
  11251. function removeEventListener(el, event, handler, options) {
  11252. el.removeEventListener(event, handler, options);
  11253. }
  11254. const veiKey = Symbol("_vei");
  11255. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11256. const invokers = el[veiKey] || (el[veiKey] = {});
  11257. const existingInvoker = invokers[rawName];
  11258. if (nextValue && existingInvoker) {
  11259. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11260. } else {
  11261. const [name, options] = parseName(rawName);
  11262. if (nextValue) {
  11263. const invoker = invokers[rawName] = createInvoker(
  11264. sanitizeEventValue(nextValue, rawName) ,
  11265. instance
  11266. );
  11267. addEventListener(el, name, invoker, options);
  11268. } else if (existingInvoker) {
  11269. removeEventListener(el, name, existingInvoker, options);
  11270. invokers[rawName] = void 0;
  11271. }
  11272. }
  11273. }
  11274. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11275. function parseName(name) {
  11276. let options;
  11277. if (optionsModifierRE.test(name)) {
  11278. options = {};
  11279. let m;
  11280. while (m = name.match(optionsModifierRE)) {
  11281. name = name.slice(0, name.length - m[0].length);
  11282. options[m[0].toLowerCase()] = true;
  11283. }
  11284. }
  11285. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11286. return [event, options];
  11287. }
  11288. let cachedNow = 0;
  11289. const p = /* @__PURE__ */ Promise.resolve();
  11290. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11291. function createInvoker(initialValue, instance) {
  11292. const invoker = (e) => {
  11293. if (!e._vts) {
  11294. e._vts = Date.now();
  11295. } else if (e._vts <= invoker.attached) {
  11296. return;
  11297. }
  11298. callWithAsyncErrorHandling(
  11299. patchStopImmediatePropagation(e, invoker.value),
  11300. instance,
  11301. 5,
  11302. [e]
  11303. );
  11304. };
  11305. invoker.value = initialValue;
  11306. invoker.attached = getNow();
  11307. return invoker;
  11308. }
  11309. function sanitizeEventValue(value, propName) {
  11310. if (isFunction(value) || isArray(value)) {
  11311. return value;
  11312. }
  11313. warn(
  11314. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11315. Expected function or array of functions, received type ${typeof value}.`
  11316. );
  11317. return NOOP;
  11318. }
  11319. function patchStopImmediatePropagation(e, value) {
  11320. if (isArray(value)) {
  11321. const originalStop = e.stopImmediatePropagation;
  11322. e.stopImmediatePropagation = () => {
  11323. originalStop.call(e);
  11324. e._stopped = true;
  11325. };
  11326. return value.map(
  11327. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11328. );
  11329. } else {
  11330. return value;
  11331. }
  11332. }
  11333. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11334. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11335. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11336. const isSVG = namespace === "svg";
  11337. if (key === "class") {
  11338. patchClass(el, nextValue, isSVG);
  11339. } else if (key === "style") {
  11340. patchStyle(el, prevValue, nextValue);
  11341. } else if (isOn(key)) {
  11342. if (!isModelListener(key)) {
  11343. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11344. }
  11345. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11346. patchDOMProp(el, key, nextValue);
  11347. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11348. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11349. }
  11350. } else if (
  11351. // #11081 force set props for possible async custom element
  11352. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  11353. ) {
  11354. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11355. } else {
  11356. if (key === "true-value") {
  11357. el._trueValue = nextValue;
  11358. } else if (key === "false-value") {
  11359. el._falseValue = nextValue;
  11360. }
  11361. patchAttr(el, key, nextValue, isSVG);
  11362. }
  11363. };
  11364. function shouldSetAsProp(el, key, value, isSVG) {
  11365. if (isSVG) {
  11366. if (key === "innerHTML" || key === "textContent") {
  11367. return true;
  11368. }
  11369. if (key in el && isNativeOn(key) && isFunction(value)) {
  11370. return true;
  11371. }
  11372. return false;
  11373. }
  11374. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  11375. return false;
  11376. }
  11377. if (key === "form") {
  11378. return false;
  11379. }
  11380. if (key === "list" && el.tagName === "INPUT") {
  11381. return false;
  11382. }
  11383. if (key === "type" && el.tagName === "TEXTAREA") {
  11384. return false;
  11385. }
  11386. if (key === "width" || key === "height") {
  11387. const tag = el.tagName;
  11388. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11389. return false;
  11390. }
  11391. }
  11392. if (isNativeOn(key) && isString(value)) {
  11393. return false;
  11394. }
  11395. return key in el;
  11396. }
  11397. const REMOVAL = {};
  11398. /*! #__NO_SIDE_EFFECTS__ */
  11399. // @__NO_SIDE_EFFECTS__
  11400. function defineCustomElement(options, extraOptions, _createApp) {
  11401. const Comp = defineComponent(options, extraOptions);
  11402. if (isPlainObject(Comp)) extend(Comp, extraOptions);
  11403. class VueCustomElement extends VueElement {
  11404. constructor(initialProps) {
  11405. super(Comp, initialProps, _createApp);
  11406. }
  11407. }
  11408. VueCustomElement.def = Comp;
  11409. return VueCustomElement;
  11410. }
  11411. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11412. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11413. });
  11414. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11415. };
  11416. class VueElement extends BaseClass {
  11417. constructor(_def, _props = {}, _createApp = createApp) {
  11418. super();
  11419. this._def = _def;
  11420. this._props = _props;
  11421. this._createApp = _createApp;
  11422. this._isVueCE = true;
  11423. /**
  11424. * @internal
  11425. */
  11426. this._instance = null;
  11427. /**
  11428. * @internal
  11429. */
  11430. this._app = null;
  11431. /**
  11432. * @internal
  11433. */
  11434. this._nonce = this._def.nonce;
  11435. this._connected = false;
  11436. this._resolved = false;
  11437. this._numberProps = null;
  11438. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11439. this._ob = null;
  11440. if (this.shadowRoot && _createApp !== createApp) {
  11441. this._root = this.shadowRoot;
  11442. } else {
  11443. if (this.shadowRoot) {
  11444. warn(
  11445. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11446. );
  11447. }
  11448. if (_def.shadowRoot !== false) {
  11449. this.attachShadow({ mode: "open" });
  11450. this._root = this.shadowRoot;
  11451. } else {
  11452. this._root = this;
  11453. }
  11454. }
  11455. }
  11456. connectedCallback() {
  11457. if (!this.isConnected) return;
  11458. if (!this.shadowRoot && !this._resolved) {
  11459. this._parseSlots();
  11460. }
  11461. this._connected = true;
  11462. let parent = this;
  11463. while (parent = parent && (parent.parentNode || parent.host)) {
  11464. if (parent instanceof VueElement) {
  11465. this._parent = parent;
  11466. break;
  11467. }
  11468. }
  11469. if (!this._instance) {
  11470. if (this._resolved) {
  11471. this._mount(this._def);
  11472. } else {
  11473. if (parent && parent._pendingResolve) {
  11474. this._pendingResolve = parent._pendingResolve.then(() => {
  11475. this._pendingResolve = void 0;
  11476. this._resolveDef();
  11477. });
  11478. } else {
  11479. this._resolveDef();
  11480. }
  11481. }
  11482. }
  11483. }
  11484. _setParent(parent = this._parent) {
  11485. if (parent) {
  11486. this._instance.parent = parent._instance;
  11487. this._inheritParentContext(parent);
  11488. }
  11489. }
  11490. _inheritParentContext(parent = this._parent) {
  11491. if (parent && this._app) {
  11492. Object.setPrototypeOf(
  11493. this._app._context.provides,
  11494. parent._instance.provides
  11495. );
  11496. }
  11497. }
  11498. disconnectedCallback() {
  11499. this._connected = false;
  11500. nextTick(() => {
  11501. if (!this._connected) {
  11502. if (this._ob) {
  11503. this._ob.disconnect();
  11504. this._ob = null;
  11505. }
  11506. this._app && this._app.unmount();
  11507. if (this._instance) this._instance.ce = void 0;
  11508. this._app = this._instance = null;
  11509. }
  11510. });
  11511. }
  11512. /**
  11513. * resolve inner component definition (handle possible async component)
  11514. */
  11515. _resolveDef() {
  11516. if (this._pendingResolve) {
  11517. return;
  11518. }
  11519. for (let i = 0; i < this.attributes.length; i++) {
  11520. this._setAttr(this.attributes[i].name);
  11521. }
  11522. this._ob = new MutationObserver((mutations) => {
  11523. for (const m of mutations) {
  11524. this._setAttr(m.attributeName);
  11525. }
  11526. });
  11527. this._ob.observe(this, { attributes: true });
  11528. const resolve = (def, isAsync = false) => {
  11529. this._resolved = true;
  11530. this._pendingResolve = void 0;
  11531. const { props, styles } = def;
  11532. let numberProps;
  11533. if (props && !isArray(props)) {
  11534. for (const key in props) {
  11535. const opt = props[key];
  11536. if (opt === Number || opt && opt.type === Number) {
  11537. if (key in this._props) {
  11538. this._props[key] = toNumber(this._props[key]);
  11539. }
  11540. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11541. }
  11542. }
  11543. }
  11544. this._numberProps = numberProps;
  11545. this._resolveProps(def);
  11546. if (this.shadowRoot) {
  11547. this._applyStyles(styles);
  11548. } else if (styles) {
  11549. warn(
  11550. "Custom element style injection is not supported when using shadowRoot: false"
  11551. );
  11552. }
  11553. this._mount(def);
  11554. };
  11555. const asyncDef = this._def.__asyncLoader;
  11556. if (asyncDef) {
  11557. this._pendingResolve = asyncDef().then((def) => {
  11558. def.configureApp = this._def.configureApp;
  11559. resolve(this._def = def, true);
  11560. });
  11561. } else {
  11562. resolve(this._def);
  11563. }
  11564. }
  11565. _mount(def) {
  11566. if (!def.name) {
  11567. def.name = "VueElement";
  11568. }
  11569. this._app = this._createApp(def);
  11570. this._inheritParentContext();
  11571. if (def.configureApp) {
  11572. def.configureApp(this._app);
  11573. }
  11574. this._app._ceVNode = this._createVNode();
  11575. this._app.mount(this._root);
  11576. const exposed = this._instance && this._instance.exposed;
  11577. if (!exposed) return;
  11578. for (const key in exposed) {
  11579. if (!hasOwn(this, key)) {
  11580. Object.defineProperty(this, key, {
  11581. // unwrap ref to be consistent with public instance behavior
  11582. get: () => unref(exposed[key])
  11583. });
  11584. } else {
  11585. warn(`Exposed property "${key}" already exists on custom element.`);
  11586. }
  11587. }
  11588. }
  11589. _resolveProps(def) {
  11590. const { props } = def;
  11591. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11592. for (const key of Object.keys(this)) {
  11593. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11594. this._setProp(key, this[key]);
  11595. }
  11596. }
  11597. for (const key of declaredPropKeys.map(camelize)) {
  11598. Object.defineProperty(this, key, {
  11599. get() {
  11600. return this._getProp(key);
  11601. },
  11602. set(val) {
  11603. this._setProp(key, val, true, true);
  11604. }
  11605. });
  11606. }
  11607. }
  11608. _setAttr(key) {
  11609. if (key.startsWith("data-v-")) return;
  11610. const has = this.hasAttribute(key);
  11611. let value = has ? this.getAttribute(key) : REMOVAL;
  11612. const camelKey = camelize(key);
  11613. if (has && this._numberProps && this._numberProps[camelKey]) {
  11614. value = toNumber(value);
  11615. }
  11616. this._setProp(camelKey, value, false, true);
  11617. }
  11618. /**
  11619. * @internal
  11620. */
  11621. _getProp(key) {
  11622. return this._props[key];
  11623. }
  11624. /**
  11625. * @internal
  11626. */
  11627. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11628. if (val !== this._props[key]) {
  11629. if (val === REMOVAL) {
  11630. delete this._props[key];
  11631. } else {
  11632. this._props[key] = val;
  11633. if (key === "key" && this._app) {
  11634. this._app._ceVNode.key = val;
  11635. }
  11636. }
  11637. if (shouldUpdate && this._instance) {
  11638. this._update();
  11639. }
  11640. if (shouldReflect) {
  11641. const ob = this._ob;
  11642. ob && ob.disconnect();
  11643. if (val === true) {
  11644. this.setAttribute(hyphenate(key), "");
  11645. } else if (typeof val === "string" || typeof val === "number") {
  11646. this.setAttribute(hyphenate(key), val + "");
  11647. } else if (!val) {
  11648. this.removeAttribute(hyphenate(key));
  11649. }
  11650. ob && ob.observe(this, { attributes: true });
  11651. }
  11652. }
  11653. }
  11654. _update() {
  11655. const vnode = this._createVNode();
  11656. if (this._app) vnode.appContext = this._app._context;
  11657. render(vnode, this._root);
  11658. }
  11659. _createVNode() {
  11660. const baseProps = {};
  11661. if (!this.shadowRoot) {
  11662. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11663. }
  11664. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11665. if (!this._instance) {
  11666. vnode.ce = (instance) => {
  11667. this._instance = instance;
  11668. instance.ce = this;
  11669. instance.isCE = true;
  11670. {
  11671. instance.ceReload = (newStyles) => {
  11672. if (this._styles) {
  11673. this._styles.forEach((s) => this._root.removeChild(s));
  11674. this._styles.length = 0;
  11675. }
  11676. this._applyStyles(newStyles);
  11677. this._instance = null;
  11678. this._update();
  11679. };
  11680. }
  11681. const dispatch = (event, args) => {
  11682. this.dispatchEvent(
  11683. new CustomEvent(
  11684. event,
  11685. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11686. )
  11687. );
  11688. };
  11689. instance.emit = (event, ...args) => {
  11690. dispatch(event, args);
  11691. if (hyphenate(event) !== event) {
  11692. dispatch(hyphenate(event), args);
  11693. }
  11694. };
  11695. this._setParent();
  11696. };
  11697. }
  11698. return vnode;
  11699. }
  11700. _applyStyles(styles, owner) {
  11701. if (!styles) return;
  11702. if (owner) {
  11703. if (owner === this._def || this._styleChildren.has(owner)) {
  11704. return;
  11705. }
  11706. this._styleChildren.add(owner);
  11707. }
  11708. const nonce = this._nonce;
  11709. for (let i = styles.length - 1; i >= 0; i--) {
  11710. const s = document.createElement("style");
  11711. if (nonce) s.setAttribute("nonce", nonce);
  11712. s.textContent = styles[i];
  11713. this.shadowRoot.prepend(s);
  11714. {
  11715. if (owner) {
  11716. if (owner.__hmrId) {
  11717. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11718. let entry = this._childStyles.get(owner.__hmrId);
  11719. if (!entry) {
  11720. this._childStyles.set(owner.__hmrId, entry = []);
  11721. }
  11722. entry.push(s);
  11723. }
  11724. } else {
  11725. (this._styles || (this._styles = [])).push(s);
  11726. }
  11727. }
  11728. }
  11729. }
  11730. /**
  11731. * Only called when shadowRoot is false
  11732. */
  11733. _parseSlots() {
  11734. const slots = this._slots = {};
  11735. let n;
  11736. while (n = this.firstChild) {
  11737. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11738. (slots[slotName] || (slots[slotName] = [])).push(n);
  11739. this.removeChild(n);
  11740. }
  11741. }
  11742. /**
  11743. * Only called when shadowRoot is false
  11744. */
  11745. _renderSlots() {
  11746. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  11747. const scopeId = this._instance.type.__scopeId;
  11748. for (let i = 0; i < outlets.length; i++) {
  11749. const o = outlets[i];
  11750. const slotName = o.getAttribute("name") || "default";
  11751. const content = this._slots[slotName];
  11752. const parent = o.parentNode;
  11753. if (content) {
  11754. for (const n of content) {
  11755. if (scopeId && n.nodeType === 1) {
  11756. const id = scopeId + "-s";
  11757. const walker = document.createTreeWalker(n, 1);
  11758. n.setAttribute(id, "");
  11759. let child;
  11760. while (child = walker.nextNode()) {
  11761. child.setAttribute(id, "");
  11762. }
  11763. }
  11764. parent.insertBefore(n, o);
  11765. }
  11766. } else {
  11767. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  11768. }
  11769. parent.removeChild(o);
  11770. }
  11771. }
  11772. /**
  11773. * @internal
  11774. */
  11775. _injectChildStyle(comp) {
  11776. this._applyStyles(comp.styles, comp);
  11777. }
  11778. /**
  11779. * @internal
  11780. */
  11781. _removeChildStyle(comp) {
  11782. {
  11783. this._styleChildren.delete(comp);
  11784. if (this._childStyles && comp.__hmrId) {
  11785. const oldStyles = this._childStyles.get(comp.__hmrId);
  11786. if (oldStyles) {
  11787. oldStyles.forEach((s) => this._root.removeChild(s));
  11788. oldStyles.length = 0;
  11789. }
  11790. }
  11791. }
  11792. }
  11793. }
  11794. function useHost(caller) {
  11795. const instance = getCurrentInstance();
  11796. const el = instance && instance.ce;
  11797. if (el) {
  11798. return el;
  11799. } else {
  11800. if (!instance) {
  11801. warn(
  11802. `${caller || "useHost"} called without an active component instance.`
  11803. );
  11804. } else {
  11805. warn(
  11806. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  11807. );
  11808. }
  11809. }
  11810. return null;
  11811. }
  11812. function useShadowRoot() {
  11813. const el = useHost("useShadowRoot") ;
  11814. return el && el.shadowRoot;
  11815. }
  11816. function useCssModule(name = "$style") {
  11817. {
  11818. const instance = getCurrentInstance();
  11819. if (!instance) {
  11820. warn(`useCssModule must be called inside setup()`);
  11821. return EMPTY_OBJ;
  11822. }
  11823. const modules = instance.type.__cssModules;
  11824. if (!modules) {
  11825. warn(`Current instance does not have CSS modules injected.`);
  11826. return EMPTY_OBJ;
  11827. }
  11828. const mod = modules[name];
  11829. if (!mod) {
  11830. warn(`Current instance does not have CSS module named "${name}".`);
  11831. return EMPTY_OBJ;
  11832. }
  11833. return mod;
  11834. }
  11835. }
  11836. const positionMap = /* @__PURE__ */ new WeakMap();
  11837. const newPositionMap = /* @__PURE__ */ new WeakMap();
  11838. const moveCbKey = Symbol("_moveCb");
  11839. const enterCbKey = Symbol("_enterCb");
  11840. const decorate = (t) => {
  11841. delete t.props.mode;
  11842. return t;
  11843. };
  11844. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  11845. name: "TransitionGroup",
  11846. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  11847. tag: String,
  11848. moveClass: String
  11849. }),
  11850. setup(props, { slots }) {
  11851. const instance = getCurrentInstance();
  11852. const state = useTransitionState();
  11853. let prevChildren;
  11854. let children;
  11855. onUpdated(() => {
  11856. if (!prevChildren.length) {
  11857. return;
  11858. }
  11859. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  11860. if (!hasCSSTransform(
  11861. prevChildren[0].el,
  11862. instance.vnode.el,
  11863. moveClass
  11864. )) {
  11865. prevChildren = [];
  11866. return;
  11867. }
  11868. prevChildren.forEach(callPendingCbs);
  11869. prevChildren.forEach(recordPosition);
  11870. const movedChildren = prevChildren.filter(applyTranslation);
  11871. forceReflow();
  11872. movedChildren.forEach((c) => {
  11873. const el = c.el;
  11874. const style = el.style;
  11875. addTransitionClass(el, moveClass);
  11876. style.transform = style.webkitTransform = style.transitionDuration = "";
  11877. const cb = el[moveCbKey] = (e) => {
  11878. if (e && e.target !== el) {
  11879. return;
  11880. }
  11881. if (!e || /transform$/.test(e.propertyName)) {
  11882. el.removeEventListener("transitionend", cb);
  11883. el[moveCbKey] = null;
  11884. removeTransitionClass(el, moveClass);
  11885. }
  11886. };
  11887. el.addEventListener("transitionend", cb);
  11888. });
  11889. prevChildren = [];
  11890. });
  11891. return () => {
  11892. const rawProps = toRaw(props);
  11893. const cssTransitionProps = resolveTransitionProps(rawProps);
  11894. let tag = rawProps.tag || Fragment;
  11895. prevChildren = [];
  11896. if (children) {
  11897. for (let i = 0; i < children.length; i++) {
  11898. const child = children[i];
  11899. if (child.el && child.el instanceof Element) {
  11900. prevChildren.push(child);
  11901. setTransitionHooks(
  11902. child,
  11903. resolveTransitionHooks(
  11904. child,
  11905. cssTransitionProps,
  11906. state,
  11907. instance
  11908. )
  11909. );
  11910. positionMap.set(
  11911. child,
  11912. child.el.getBoundingClientRect()
  11913. );
  11914. }
  11915. }
  11916. }
  11917. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  11918. for (let i = 0; i < children.length; i++) {
  11919. const child = children[i];
  11920. if (child.key != null) {
  11921. setTransitionHooks(
  11922. child,
  11923. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  11924. );
  11925. } else if (child.type !== Text) {
  11926. warn(`<TransitionGroup> children must be keyed.`);
  11927. }
  11928. }
  11929. return createVNode(tag, null, children);
  11930. };
  11931. }
  11932. });
  11933. const TransitionGroup = TransitionGroupImpl;
  11934. function callPendingCbs(c) {
  11935. const el = c.el;
  11936. if (el[moveCbKey]) {
  11937. el[moveCbKey]();
  11938. }
  11939. if (el[enterCbKey]) {
  11940. el[enterCbKey]();
  11941. }
  11942. }
  11943. function recordPosition(c) {
  11944. newPositionMap.set(c, c.el.getBoundingClientRect());
  11945. }
  11946. function applyTranslation(c) {
  11947. const oldPos = positionMap.get(c);
  11948. const newPos = newPositionMap.get(c);
  11949. const dx = oldPos.left - newPos.left;
  11950. const dy = oldPos.top - newPos.top;
  11951. if (dx || dy) {
  11952. const s = c.el.style;
  11953. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  11954. s.transitionDuration = "0s";
  11955. return c;
  11956. }
  11957. }
  11958. function hasCSSTransform(el, root, moveClass) {
  11959. const clone = el.cloneNode();
  11960. const _vtc = el[vtcKey];
  11961. if (_vtc) {
  11962. _vtc.forEach((cls) => {
  11963. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  11964. });
  11965. }
  11966. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  11967. clone.style.display = "none";
  11968. const container = root.nodeType === 1 ? root : root.parentNode;
  11969. container.appendChild(clone);
  11970. const { hasTransform } = getTransitionInfo(clone);
  11971. container.removeChild(clone);
  11972. return hasTransform;
  11973. }
  11974. const getModelAssigner = (vnode) => {
  11975. const fn = vnode.props["onUpdate:modelValue"] || false;
  11976. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  11977. };
  11978. function onCompositionStart(e) {
  11979. e.target.composing = true;
  11980. }
  11981. function onCompositionEnd(e) {
  11982. const target = e.target;
  11983. if (target.composing) {
  11984. target.composing = false;
  11985. target.dispatchEvent(new Event("input"));
  11986. }
  11987. }
  11988. const assignKey = Symbol("_assign");
  11989. const vModelText = {
  11990. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  11991. el[assignKey] = getModelAssigner(vnode);
  11992. const castToNumber = number || vnode.props && vnode.props.type === "number";
  11993. addEventListener(el, lazy ? "change" : "input", (e) => {
  11994. if (e.target.composing) return;
  11995. let domValue = el.value;
  11996. if (trim) {
  11997. domValue = domValue.trim();
  11998. }
  11999. if (castToNumber) {
  12000. domValue = looseToNumber(domValue);
  12001. }
  12002. el[assignKey](domValue);
  12003. });
  12004. if (trim) {
  12005. addEventListener(el, "change", () => {
  12006. el.value = el.value.trim();
  12007. });
  12008. }
  12009. if (!lazy) {
  12010. addEventListener(el, "compositionstart", onCompositionStart);
  12011. addEventListener(el, "compositionend", onCompositionEnd);
  12012. addEventListener(el, "change", onCompositionEnd);
  12013. }
  12014. },
  12015. // set value on mounted so it's after min/max for type="range"
  12016. mounted(el, { value }) {
  12017. el.value = value == null ? "" : value;
  12018. },
  12019. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  12020. el[assignKey] = getModelAssigner(vnode);
  12021. if (el.composing) return;
  12022. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  12023. const newValue = value == null ? "" : value;
  12024. if (elValue === newValue) {
  12025. return;
  12026. }
  12027. if (document.activeElement === el && el.type !== "range") {
  12028. if (lazy && value === oldValue) {
  12029. return;
  12030. }
  12031. if (trim && el.value.trim() === newValue) {
  12032. return;
  12033. }
  12034. }
  12035. el.value = newValue;
  12036. }
  12037. };
  12038. const vModelCheckbox = {
  12039. // #4096 array checkboxes need to be deep traversed
  12040. deep: true,
  12041. created(el, _, vnode) {
  12042. el[assignKey] = getModelAssigner(vnode);
  12043. addEventListener(el, "change", () => {
  12044. const modelValue = el._modelValue;
  12045. const elementValue = getValue(el);
  12046. const checked = el.checked;
  12047. const assign = el[assignKey];
  12048. if (isArray(modelValue)) {
  12049. const index = looseIndexOf(modelValue, elementValue);
  12050. const found = index !== -1;
  12051. if (checked && !found) {
  12052. assign(modelValue.concat(elementValue));
  12053. } else if (!checked && found) {
  12054. const filtered = [...modelValue];
  12055. filtered.splice(index, 1);
  12056. assign(filtered);
  12057. }
  12058. } else if (isSet(modelValue)) {
  12059. const cloned = new Set(modelValue);
  12060. if (checked) {
  12061. cloned.add(elementValue);
  12062. } else {
  12063. cloned.delete(elementValue);
  12064. }
  12065. assign(cloned);
  12066. } else {
  12067. assign(getCheckboxValue(el, checked));
  12068. }
  12069. });
  12070. },
  12071. // set initial checked on mount to wait for true-value/false-value
  12072. mounted: setChecked,
  12073. beforeUpdate(el, binding, vnode) {
  12074. el[assignKey] = getModelAssigner(vnode);
  12075. setChecked(el, binding, vnode);
  12076. }
  12077. };
  12078. function setChecked(el, { value, oldValue }, vnode) {
  12079. el._modelValue = value;
  12080. let checked;
  12081. if (isArray(value)) {
  12082. checked = looseIndexOf(value, vnode.props.value) > -1;
  12083. } else if (isSet(value)) {
  12084. checked = value.has(vnode.props.value);
  12085. } else {
  12086. if (value === oldValue) return;
  12087. checked = looseEqual(value, getCheckboxValue(el, true));
  12088. }
  12089. if (el.checked !== checked) {
  12090. el.checked = checked;
  12091. }
  12092. }
  12093. const vModelRadio = {
  12094. created(el, { value }, vnode) {
  12095. el.checked = looseEqual(value, vnode.props.value);
  12096. el[assignKey] = getModelAssigner(vnode);
  12097. addEventListener(el, "change", () => {
  12098. el[assignKey](getValue(el));
  12099. });
  12100. },
  12101. beforeUpdate(el, { value, oldValue }, vnode) {
  12102. el[assignKey] = getModelAssigner(vnode);
  12103. if (value !== oldValue) {
  12104. el.checked = looseEqual(value, vnode.props.value);
  12105. }
  12106. }
  12107. };
  12108. const vModelSelect = {
  12109. // <select multiple> value need to be deep traversed
  12110. deep: true,
  12111. created(el, { value, modifiers: { number } }, vnode) {
  12112. const isSetModel = isSet(value);
  12113. addEventListener(el, "change", () => {
  12114. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  12115. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  12116. );
  12117. el[assignKey](
  12118. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  12119. );
  12120. el._assigning = true;
  12121. nextTick(() => {
  12122. el._assigning = false;
  12123. });
  12124. });
  12125. el[assignKey] = getModelAssigner(vnode);
  12126. },
  12127. // set value in mounted & updated because <select> relies on its children
  12128. // <option>s.
  12129. mounted(el, { value }) {
  12130. setSelected(el, value);
  12131. },
  12132. beforeUpdate(el, _binding, vnode) {
  12133. el[assignKey] = getModelAssigner(vnode);
  12134. },
  12135. updated(el, { value }) {
  12136. if (!el._assigning) {
  12137. setSelected(el, value);
  12138. }
  12139. }
  12140. };
  12141. function setSelected(el, value) {
  12142. const isMultiple = el.multiple;
  12143. const isArrayValue = isArray(value);
  12144. if (isMultiple && !isArrayValue && !isSet(value)) {
  12145. warn(
  12146. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  12147. );
  12148. return;
  12149. }
  12150. for (let i = 0, l = el.options.length; i < l; i++) {
  12151. const option = el.options[i];
  12152. const optionValue = getValue(option);
  12153. if (isMultiple) {
  12154. if (isArrayValue) {
  12155. const optionType = typeof optionValue;
  12156. if (optionType === "string" || optionType === "number") {
  12157. option.selected = value.some((v) => String(v) === String(optionValue));
  12158. } else {
  12159. option.selected = looseIndexOf(value, optionValue) > -1;
  12160. }
  12161. } else {
  12162. option.selected = value.has(optionValue);
  12163. }
  12164. } else if (looseEqual(getValue(option), value)) {
  12165. if (el.selectedIndex !== i) el.selectedIndex = i;
  12166. return;
  12167. }
  12168. }
  12169. if (!isMultiple && el.selectedIndex !== -1) {
  12170. el.selectedIndex = -1;
  12171. }
  12172. }
  12173. function getValue(el) {
  12174. return "_value" in el ? el._value : el.value;
  12175. }
  12176. function getCheckboxValue(el, checked) {
  12177. const key = checked ? "_trueValue" : "_falseValue";
  12178. return key in el ? el[key] : checked;
  12179. }
  12180. const vModelDynamic = {
  12181. created(el, binding, vnode) {
  12182. callModelHook(el, binding, vnode, null, "created");
  12183. },
  12184. mounted(el, binding, vnode) {
  12185. callModelHook(el, binding, vnode, null, "mounted");
  12186. },
  12187. beforeUpdate(el, binding, vnode, prevVNode) {
  12188. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12189. },
  12190. updated(el, binding, vnode, prevVNode) {
  12191. callModelHook(el, binding, vnode, prevVNode, "updated");
  12192. }
  12193. };
  12194. function resolveDynamicModel(tagName, type) {
  12195. switch (tagName) {
  12196. case "SELECT":
  12197. return vModelSelect;
  12198. case "TEXTAREA":
  12199. return vModelText;
  12200. default:
  12201. switch (type) {
  12202. case "checkbox":
  12203. return vModelCheckbox;
  12204. case "radio":
  12205. return vModelRadio;
  12206. default:
  12207. return vModelText;
  12208. }
  12209. }
  12210. }
  12211. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12212. const modelToUse = resolveDynamicModel(
  12213. el.tagName,
  12214. vnode.props && vnode.props.type
  12215. );
  12216. const fn = modelToUse[hook];
  12217. fn && fn(el, binding, vnode, prevVNode);
  12218. }
  12219. function initVModelForSSR() {
  12220. vModelText.getSSRProps = ({ value }) => ({ value });
  12221. vModelRadio.getSSRProps = ({ value }, vnode) => {
  12222. if (vnode.props && looseEqual(vnode.props.value, value)) {
  12223. return { checked: true };
  12224. }
  12225. };
  12226. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  12227. if (isArray(value)) {
  12228. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  12229. return { checked: true };
  12230. }
  12231. } else if (isSet(value)) {
  12232. if (vnode.props && value.has(vnode.props.value)) {
  12233. return { checked: true };
  12234. }
  12235. } else if (value) {
  12236. return { checked: true };
  12237. }
  12238. };
  12239. vModelDynamic.getSSRProps = (binding, vnode) => {
  12240. if (typeof vnode.type !== "string") {
  12241. return;
  12242. }
  12243. const modelToUse = resolveDynamicModel(
  12244. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  12245. vnode.type.toUpperCase(),
  12246. vnode.props && vnode.props.type
  12247. );
  12248. if (modelToUse.getSSRProps) {
  12249. return modelToUse.getSSRProps(binding, vnode);
  12250. }
  12251. };
  12252. }
  12253. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12254. const modifierGuards = {
  12255. stop: (e) => e.stopPropagation(),
  12256. prevent: (e) => e.preventDefault(),
  12257. self: (e) => e.target !== e.currentTarget,
  12258. ctrl: (e) => !e.ctrlKey,
  12259. shift: (e) => !e.shiftKey,
  12260. alt: (e) => !e.altKey,
  12261. meta: (e) => !e.metaKey,
  12262. left: (e) => "button" in e && e.button !== 0,
  12263. middle: (e) => "button" in e && e.button !== 1,
  12264. right: (e) => "button" in e && e.button !== 2,
  12265. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12266. };
  12267. const withModifiers = (fn, modifiers) => {
  12268. const cache = fn._withMods || (fn._withMods = {});
  12269. const cacheKey = modifiers.join(".");
  12270. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  12271. for (let i = 0; i < modifiers.length; i++) {
  12272. const guard = modifierGuards[modifiers[i]];
  12273. if (guard && guard(event, modifiers)) return;
  12274. }
  12275. return fn(event, ...args);
  12276. }));
  12277. };
  12278. const keyNames = {
  12279. esc: "escape",
  12280. space: " ",
  12281. up: "arrow-up",
  12282. left: "arrow-left",
  12283. right: "arrow-right",
  12284. down: "arrow-down",
  12285. delete: "backspace"
  12286. };
  12287. const withKeys = (fn, modifiers) => {
  12288. const cache = fn._withKeys || (fn._withKeys = {});
  12289. const cacheKey = modifiers.join(".");
  12290. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  12291. if (!("key" in event)) {
  12292. return;
  12293. }
  12294. const eventKey = hyphenate(event.key);
  12295. if (modifiers.some(
  12296. (k) => k === eventKey || keyNames[k] === eventKey
  12297. )) {
  12298. return fn(event);
  12299. }
  12300. }));
  12301. };
  12302. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12303. let renderer;
  12304. let enabledHydration = false;
  12305. function ensureRenderer() {
  12306. return renderer || (renderer = createRenderer(rendererOptions));
  12307. }
  12308. function ensureHydrationRenderer() {
  12309. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12310. enabledHydration = true;
  12311. return renderer;
  12312. }
  12313. const render = ((...args) => {
  12314. ensureRenderer().render(...args);
  12315. });
  12316. const hydrate = ((...args) => {
  12317. ensureHydrationRenderer().hydrate(...args);
  12318. });
  12319. const createApp = ((...args) => {
  12320. const app = ensureRenderer().createApp(...args);
  12321. {
  12322. injectNativeTagCheck(app);
  12323. injectCompilerOptionsCheck(app);
  12324. }
  12325. const { mount } = app;
  12326. app.mount = (containerOrSelector) => {
  12327. const container = normalizeContainer(containerOrSelector);
  12328. if (!container) return;
  12329. const component = app._component;
  12330. if (!isFunction(component) && !component.render && !component.template) {
  12331. component.template = container.innerHTML;
  12332. }
  12333. if (container.nodeType === 1) {
  12334. container.textContent = "";
  12335. }
  12336. const proxy = mount(container, false, resolveRootNamespace(container));
  12337. if (container instanceof Element) {
  12338. container.removeAttribute("v-cloak");
  12339. container.setAttribute("data-v-app", "");
  12340. }
  12341. return proxy;
  12342. };
  12343. return app;
  12344. });
  12345. const createSSRApp = ((...args) => {
  12346. const app = ensureHydrationRenderer().createApp(...args);
  12347. {
  12348. injectNativeTagCheck(app);
  12349. injectCompilerOptionsCheck(app);
  12350. }
  12351. const { mount } = app;
  12352. app.mount = (containerOrSelector) => {
  12353. const container = normalizeContainer(containerOrSelector);
  12354. if (container) {
  12355. return mount(container, true, resolveRootNamespace(container));
  12356. }
  12357. };
  12358. return app;
  12359. });
  12360. function resolveRootNamespace(container) {
  12361. if (container instanceof SVGElement) {
  12362. return "svg";
  12363. }
  12364. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12365. return "mathml";
  12366. }
  12367. }
  12368. function injectNativeTagCheck(app) {
  12369. Object.defineProperty(app.config, "isNativeTag", {
  12370. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12371. writable: false
  12372. });
  12373. }
  12374. function injectCompilerOptionsCheck(app) {
  12375. if (isRuntimeOnly()) {
  12376. const isCustomElement = app.config.isCustomElement;
  12377. Object.defineProperty(app.config, "isCustomElement", {
  12378. get() {
  12379. return isCustomElement;
  12380. },
  12381. set() {
  12382. warn(
  12383. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12384. );
  12385. }
  12386. });
  12387. const compilerOptions = app.config.compilerOptions;
  12388. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  12389. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12390. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12391. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  12392. Object.defineProperty(app.config, "compilerOptions", {
  12393. get() {
  12394. warn(msg);
  12395. return compilerOptions;
  12396. },
  12397. set() {
  12398. warn(msg);
  12399. }
  12400. });
  12401. }
  12402. }
  12403. function normalizeContainer(container) {
  12404. if (isString(container)) {
  12405. const res = document.querySelector(container);
  12406. if (!res) {
  12407. warn(
  12408. `Failed to mount app: mount target selector "${container}" returned null.`
  12409. );
  12410. }
  12411. return res;
  12412. }
  12413. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12414. warn(
  12415. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12416. );
  12417. }
  12418. return container;
  12419. }
  12420. let ssrDirectiveInitialized = false;
  12421. const initDirectivesForSSR = () => {
  12422. if (!ssrDirectiveInitialized) {
  12423. ssrDirectiveInitialized = true;
  12424. initVModelForSSR();
  12425. initVShowForSSR();
  12426. }
  12427. } ;
  12428. var runtimeDom = /*#__PURE__*/Object.freeze({
  12429. __proto__: null,
  12430. BaseTransition: BaseTransition,
  12431. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  12432. Comment: Comment,
  12433. DeprecationTypes: DeprecationTypes,
  12434. EffectScope: EffectScope,
  12435. ErrorCodes: ErrorCodes,
  12436. ErrorTypeStrings: ErrorTypeStrings,
  12437. Fragment: Fragment,
  12438. KeepAlive: KeepAlive,
  12439. ReactiveEffect: ReactiveEffect,
  12440. Static: Static,
  12441. Suspense: Suspense,
  12442. Teleport: Teleport,
  12443. Text: Text,
  12444. TrackOpTypes: TrackOpTypes,
  12445. Transition: Transition,
  12446. TransitionGroup: TransitionGroup,
  12447. TriggerOpTypes: TriggerOpTypes,
  12448. VueElement: VueElement,
  12449. assertNumber: assertNumber,
  12450. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  12451. callWithErrorHandling: callWithErrorHandling,
  12452. camelize: camelize,
  12453. capitalize: capitalize,
  12454. cloneVNode: cloneVNode,
  12455. compatUtils: compatUtils,
  12456. computed: computed,
  12457. createApp: createApp,
  12458. createBlock: createBlock,
  12459. createCommentVNode: createCommentVNode,
  12460. createElementBlock: createElementBlock,
  12461. createElementVNode: createBaseVNode,
  12462. createHydrationRenderer: createHydrationRenderer,
  12463. createPropsRestProxy: createPropsRestProxy,
  12464. createRenderer: createRenderer,
  12465. createSSRApp: createSSRApp,
  12466. createSlots: createSlots,
  12467. createStaticVNode: createStaticVNode,
  12468. createTextVNode: createTextVNode,
  12469. createVNode: createVNode,
  12470. customRef: customRef,
  12471. defineAsyncComponent: defineAsyncComponent,
  12472. defineComponent: defineComponent,
  12473. defineCustomElement: defineCustomElement,
  12474. defineEmits: defineEmits,
  12475. defineExpose: defineExpose,
  12476. defineModel: defineModel,
  12477. defineOptions: defineOptions,
  12478. defineProps: defineProps,
  12479. defineSSRCustomElement: defineSSRCustomElement,
  12480. defineSlots: defineSlots,
  12481. devtools: devtools,
  12482. effect: effect,
  12483. effectScope: effectScope,
  12484. getCurrentInstance: getCurrentInstance,
  12485. getCurrentScope: getCurrentScope,
  12486. getCurrentWatcher: getCurrentWatcher,
  12487. getTransitionRawChildren: getTransitionRawChildren,
  12488. guardReactiveProps: guardReactiveProps,
  12489. h: h,
  12490. handleError: handleError,
  12491. hasInjectionContext: hasInjectionContext,
  12492. hydrate: hydrate,
  12493. hydrateOnIdle: hydrateOnIdle,
  12494. hydrateOnInteraction: hydrateOnInteraction,
  12495. hydrateOnMediaQuery: hydrateOnMediaQuery,
  12496. hydrateOnVisible: hydrateOnVisible,
  12497. initCustomFormatter: initCustomFormatter,
  12498. initDirectivesForSSR: initDirectivesForSSR,
  12499. inject: inject,
  12500. isMemoSame: isMemoSame,
  12501. isProxy: isProxy,
  12502. isReactive: isReactive,
  12503. isReadonly: isReadonly,
  12504. isRef: isRef,
  12505. isRuntimeOnly: isRuntimeOnly,
  12506. isShallow: isShallow,
  12507. isVNode: isVNode,
  12508. markRaw: markRaw,
  12509. mergeDefaults: mergeDefaults,
  12510. mergeModels: mergeModels,
  12511. mergeProps: mergeProps,
  12512. nextTick: nextTick,
  12513. normalizeClass: normalizeClass,
  12514. normalizeProps: normalizeProps,
  12515. normalizeStyle: normalizeStyle,
  12516. onActivated: onActivated,
  12517. onBeforeMount: onBeforeMount,
  12518. onBeforeUnmount: onBeforeUnmount,
  12519. onBeforeUpdate: onBeforeUpdate,
  12520. onDeactivated: onDeactivated,
  12521. onErrorCaptured: onErrorCaptured,
  12522. onMounted: onMounted,
  12523. onRenderTracked: onRenderTracked,
  12524. onRenderTriggered: onRenderTriggered,
  12525. onScopeDispose: onScopeDispose,
  12526. onServerPrefetch: onServerPrefetch,
  12527. onUnmounted: onUnmounted,
  12528. onUpdated: onUpdated,
  12529. onWatcherCleanup: onWatcherCleanup,
  12530. openBlock: openBlock,
  12531. popScopeId: popScopeId,
  12532. provide: provide,
  12533. proxyRefs: proxyRefs,
  12534. pushScopeId: pushScopeId,
  12535. queuePostFlushCb: queuePostFlushCb,
  12536. reactive: reactive,
  12537. readonly: readonly,
  12538. ref: ref,
  12539. registerRuntimeCompiler: registerRuntimeCompiler,
  12540. render: render,
  12541. renderList: renderList,
  12542. renderSlot: renderSlot,
  12543. resolveComponent: resolveComponent,
  12544. resolveDirective: resolveDirective,
  12545. resolveDynamicComponent: resolveDynamicComponent,
  12546. resolveFilter: resolveFilter,
  12547. resolveTransitionHooks: resolveTransitionHooks,
  12548. setBlockTracking: setBlockTracking,
  12549. setDevtoolsHook: setDevtoolsHook,
  12550. setTransitionHooks: setTransitionHooks,
  12551. shallowReactive: shallowReactive,
  12552. shallowReadonly: shallowReadonly,
  12553. shallowRef: shallowRef,
  12554. ssrContextKey: ssrContextKey,
  12555. ssrUtils: ssrUtils,
  12556. stop: stop,
  12557. toDisplayString: toDisplayString,
  12558. toHandlerKey: toHandlerKey,
  12559. toHandlers: toHandlers,
  12560. toRaw: toRaw,
  12561. toRef: toRef,
  12562. toRefs: toRefs,
  12563. toValue: toValue,
  12564. transformVNodeArgs: transformVNodeArgs,
  12565. triggerRef: triggerRef,
  12566. unref: unref,
  12567. useAttrs: useAttrs,
  12568. useCssModule: useCssModule,
  12569. useCssVars: useCssVars,
  12570. useHost: useHost,
  12571. useId: useId,
  12572. useModel: useModel,
  12573. useSSRContext: useSSRContext,
  12574. useShadowRoot: useShadowRoot,
  12575. useSlots: useSlots,
  12576. useTemplateRef: useTemplateRef,
  12577. useTransitionState: useTransitionState,
  12578. vModelCheckbox: vModelCheckbox,
  12579. vModelDynamic: vModelDynamic,
  12580. vModelRadio: vModelRadio,
  12581. vModelSelect: vModelSelect,
  12582. vModelText: vModelText,
  12583. vShow: vShow,
  12584. version: version,
  12585. warn: warn,
  12586. watch: watch,
  12587. watchEffect: watchEffect,
  12588. watchPostEffect: watchPostEffect,
  12589. watchSyncEffect: watchSyncEffect,
  12590. withAsyncContext: withAsyncContext,
  12591. withCtx: withCtx,
  12592. withDefaults: withDefaults,
  12593. withDirectives: withDirectives,
  12594. withKeys: withKeys,
  12595. withMemo: withMemo,
  12596. withModifiers: withModifiers,
  12597. withScopeId: withScopeId
  12598. });
  12599. function initDev() {
  12600. {
  12601. {
  12602. console.info(
  12603. `You are running a development build of Vue.
  12604. Make sure to use the production build (*.prod.js) when deploying for production.`
  12605. );
  12606. }
  12607. initCustomFormatter();
  12608. }
  12609. }
  12610. const FRAGMENT = Symbol(`Fragment` );
  12611. const TELEPORT = Symbol(`Teleport` );
  12612. const SUSPENSE = Symbol(`Suspense` );
  12613. const KEEP_ALIVE = Symbol(`KeepAlive` );
  12614. const BASE_TRANSITION = Symbol(
  12615. `BaseTransition`
  12616. );
  12617. const OPEN_BLOCK = Symbol(`openBlock` );
  12618. const CREATE_BLOCK = Symbol(`createBlock` );
  12619. const CREATE_ELEMENT_BLOCK = Symbol(
  12620. `createElementBlock`
  12621. );
  12622. const CREATE_VNODE = Symbol(`createVNode` );
  12623. const CREATE_ELEMENT_VNODE = Symbol(
  12624. `createElementVNode`
  12625. );
  12626. const CREATE_COMMENT = Symbol(
  12627. `createCommentVNode`
  12628. );
  12629. const CREATE_TEXT = Symbol(
  12630. `createTextVNode`
  12631. );
  12632. const CREATE_STATIC = Symbol(
  12633. `createStaticVNode`
  12634. );
  12635. const RESOLVE_COMPONENT = Symbol(
  12636. `resolveComponent`
  12637. );
  12638. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  12639. `resolveDynamicComponent`
  12640. );
  12641. const RESOLVE_DIRECTIVE = Symbol(
  12642. `resolveDirective`
  12643. );
  12644. const RESOLVE_FILTER = Symbol(
  12645. `resolveFilter`
  12646. );
  12647. const WITH_DIRECTIVES = Symbol(
  12648. `withDirectives`
  12649. );
  12650. const RENDER_LIST = Symbol(`renderList` );
  12651. const RENDER_SLOT = Symbol(`renderSlot` );
  12652. const CREATE_SLOTS = Symbol(`createSlots` );
  12653. const TO_DISPLAY_STRING = Symbol(
  12654. `toDisplayString`
  12655. );
  12656. const MERGE_PROPS = Symbol(`mergeProps` );
  12657. const NORMALIZE_CLASS = Symbol(
  12658. `normalizeClass`
  12659. );
  12660. const NORMALIZE_STYLE = Symbol(
  12661. `normalizeStyle`
  12662. );
  12663. const NORMALIZE_PROPS = Symbol(
  12664. `normalizeProps`
  12665. );
  12666. const GUARD_REACTIVE_PROPS = Symbol(
  12667. `guardReactiveProps`
  12668. );
  12669. const TO_HANDLERS = Symbol(`toHandlers` );
  12670. const CAMELIZE = Symbol(`camelize` );
  12671. const CAPITALIZE = Symbol(`capitalize` );
  12672. const TO_HANDLER_KEY = Symbol(
  12673. `toHandlerKey`
  12674. );
  12675. const SET_BLOCK_TRACKING = Symbol(
  12676. `setBlockTracking`
  12677. );
  12678. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  12679. const POP_SCOPE_ID = Symbol(`popScopeId` );
  12680. const WITH_CTX = Symbol(`withCtx` );
  12681. const UNREF = Symbol(`unref` );
  12682. const IS_REF = Symbol(`isRef` );
  12683. const WITH_MEMO = Symbol(`withMemo` );
  12684. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  12685. const helperNameMap = {
  12686. [FRAGMENT]: `Fragment`,
  12687. [TELEPORT]: `Teleport`,
  12688. [SUSPENSE]: `Suspense`,
  12689. [KEEP_ALIVE]: `KeepAlive`,
  12690. [BASE_TRANSITION]: `BaseTransition`,
  12691. [OPEN_BLOCK]: `openBlock`,
  12692. [CREATE_BLOCK]: `createBlock`,
  12693. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  12694. [CREATE_VNODE]: `createVNode`,
  12695. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  12696. [CREATE_COMMENT]: `createCommentVNode`,
  12697. [CREATE_TEXT]: `createTextVNode`,
  12698. [CREATE_STATIC]: `createStaticVNode`,
  12699. [RESOLVE_COMPONENT]: `resolveComponent`,
  12700. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  12701. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  12702. [RESOLVE_FILTER]: `resolveFilter`,
  12703. [WITH_DIRECTIVES]: `withDirectives`,
  12704. [RENDER_LIST]: `renderList`,
  12705. [RENDER_SLOT]: `renderSlot`,
  12706. [CREATE_SLOTS]: `createSlots`,
  12707. [TO_DISPLAY_STRING]: `toDisplayString`,
  12708. [MERGE_PROPS]: `mergeProps`,
  12709. [NORMALIZE_CLASS]: `normalizeClass`,
  12710. [NORMALIZE_STYLE]: `normalizeStyle`,
  12711. [NORMALIZE_PROPS]: `normalizeProps`,
  12712. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  12713. [TO_HANDLERS]: `toHandlers`,
  12714. [CAMELIZE]: `camelize`,
  12715. [CAPITALIZE]: `capitalize`,
  12716. [TO_HANDLER_KEY]: `toHandlerKey`,
  12717. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  12718. [PUSH_SCOPE_ID]: `pushScopeId`,
  12719. [POP_SCOPE_ID]: `popScopeId`,
  12720. [WITH_CTX]: `withCtx`,
  12721. [UNREF]: `unref`,
  12722. [IS_REF]: `isRef`,
  12723. [WITH_MEMO]: `withMemo`,
  12724. [IS_MEMO_SAME]: `isMemoSame`
  12725. };
  12726. function registerRuntimeHelpers(helpers) {
  12727. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  12728. helperNameMap[s] = helpers[s];
  12729. });
  12730. }
  12731. const locStub = {
  12732. start: { line: 1, column: 1, offset: 0 },
  12733. end: { line: 1, column: 1, offset: 0 },
  12734. source: ""
  12735. };
  12736. function createRoot(children, source = "") {
  12737. return {
  12738. type: 0,
  12739. source,
  12740. children,
  12741. helpers: /* @__PURE__ */ new Set(),
  12742. components: [],
  12743. directives: [],
  12744. hoists: [],
  12745. imports: [],
  12746. cached: [],
  12747. temps: 0,
  12748. codegenNode: void 0,
  12749. loc: locStub
  12750. };
  12751. }
  12752. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  12753. if (context) {
  12754. if (isBlock) {
  12755. context.helper(OPEN_BLOCK);
  12756. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  12757. } else {
  12758. context.helper(getVNodeHelper(context.inSSR, isComponent));
  12759. }
  12760. if (directives) {
  12761. context.helper(WITH_DIRECTIVES);
  12762. }
  12763. }
  12764. return {
  12765. type: 13,
  12766. tag,
  12767. props,
  12768. children,
  12769. patchFlag,
  12770. dynamicProps,
  12771. directives,
  12772. isBlock,
  12773. disableTracking,
  12774. isComponent,
  12775. loc
  12776. };
  12777. }
  12778. function createArrayExpression(elements, loc = locStub) {
  12779. return {
  12780. type: 17,
  12781. loc,
  12782. elements
  12783. };
  12784. }
  12785. function createObjectExpression(properties, loc = locStub) {
  12786. return {
  12787. type: 15,
  12788. loc,
  12789. properties
  12790. };
  12791. }
  12792. function createObjectProperty(key, value) {
  12793. return {
  12794. type: 16,
  12795. loc: locStub,
  12796. key: isString(key) ? createSimpleExpression(key, true) : key,
  12797. value
  12798. };
  12799. }
  12800. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  12801. return {
  12802. type: 4,
  12803. loc,
  12804. content,
  12805. isStatic,
  12806. constType: isStatic ? 3 : constType
  12807. };
  12808. }
  12809. function createCompoundExpression(children, loc = locStub) {
  12810. return {
  12811. type: 8,
  12812. loc,
  12813. children
  12814. };
  12815. }
  12816. function createCallExpression(callee, args = [], loc = locStub) {
  12817. return {
  12818. type: 14,
  12819. loc,
  12820. callee,
  12821. arguments: args
  12822. };
  12823. }
  12824. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  12825. return {
  12826. type: 18,
  12827. params,
  12828. returns,
  12829. newline,
  12830. isSlot,
  12831. loc
  12832. };
  12833. }
  12834. function createConditionalExpression(test, consequent, alternate, newline = true) {
  12835. return {
  12836. type: 19,
  12837. test,
  12838. consequent,
  12839. alternate,
  12840. newline,
  12841. loc: locStub
  12842. };
  12843. }
  12844. function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
  12845. return {
  12846. type: 20,
  12847. index,
  12848. value,
  12849. needPauseTracking,
  12850. inVOnce,
  12851. needArraySpread: false,
  12852. loc: locStub
  12853. };
  12854. }
  12855. function createBlockStatement(body) {
  12856. return {
  12857. type: 21,
  12858. body,
  12859. loc: locStub
  12860. };
  12861. }
  12862. function getVNodeHelper(ssr, isComponent) {
  12863. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  12864. }
  12865. function getVNodeBlockHelper(ssr, isComponent) {
  12866. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  12867. }
  12868. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  12869. if (!node.isBlock) {
  12870. node.isBlock = true;
  12871. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  12872. helper(OPEN_BLOCK);
  12873. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  12874. }
  12875. }
  12876. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  12877. const defaultDelimitersClose = new Uint8Array([125, 125]);
  12878. function isTagStartChar(c) {
  12879. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  12880. }
  12881. function isWhitespace(c) {
  12882. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  12883. }
  12884. function isEndOfTagSection(c) {
  12885. return c === 47 || c === 62 || isWhitespace(c);
  12886. }
  12887. function toCharCodes(str) {
  12888. const ret = new Uint8Array(str.length);
  12889. for (let i = 0; i < str.length; i++) {
  12890. ret[i] = str.charCodeAt(i);
  12891. }
  12892. return ret;
  12893. }
  12894. const Sequences = {
  12895. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  12896. // CDATA[
  12897. CdataEnd: new Uint8Array([93, 93, 62]),
  12898. // ]]>
  12899. CommentEnd: new Uint8Array([45, 45, 62]),
  12900. // `-->`
  12901. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  12902. // `<\/script`
  12903. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  12904. // `</style`
  12905. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  12906. // `</title`
  12907. TextareaEnd: new Uint8Array([
  12908. 60,
  12909. 47,
  12910. 116,
  12911. 101,
  12912. 120,
  12913. 116,
  12914. 97,
  12915. 114,
  12916. 101,
  12917. 97
  12918. ])
  12919. // `</textarea
  12920. };
  12921. class Tokenizer {
  12922. constructor(stack, cbs) {
  12923. this.stack = stack;
  12924. this.cbs = cbs;
  12925. /** The current state the tokenizer is in. */
  12926. this.state = 1;
  12927. /** The read buffer. */
  12928. this.buffer = "";
  12929. /** The beginning of the section that is currently being read. */
  12930. this.sectionStart = 0;
  12931. /** The index within the buffer that we are currently looking at. */
  12932. this.index = 0;
  12933. /** The start of the last entity. */
  12934. this.entityStart = 0;
  12935. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  12936. this.baseState = 1;
  12937. /** For special parsing behavior inside of script and style tags. */
  12938. this.inRCDATA = false;
  12939. /** For disabling RCDATA tags handling */
  12940. this.inXML = false;
  12941. /** For disabling interpolation parsing in v-pre */
  12942. this.inVPre = false;
  12943. /** Record newline positions for fast line / column calculation */
  12944. this.newlines = [];
  12945. this.mode = 0;
  12946. this.delimiterOpen = defaultDelimitersOpen;
  12947. this.delimiterClose = defaultDelimitersClose;
  12948. this.delimiterIndex = -1;
  12949. this.currentSequence = void 0;
  12950. this.sequenceIndex = 0;
  12951. }
  12952. get inSFCRoot() {
  12953. return this.mode === 2 && this.stack.length === 0;
  12954. }
  12955. reset() {
  12956. this.state = 1;
  12957. this.mode = 0;
  12958. this.buffer = "";
  12959. this.sectionStart = 0;
  12960. this.index = 0;
  12961. this.baseState = 1;
  12962. this.inRCDATA = false;
  12963. this.currentSequence = void 0;
  12964. this.newlines.length = 0;
  12965. this.delimiterOpen = defaultDelimitersOpen;
  12966. this.delimiterClose = defaultDelimitersClose;
  12967. }
  12968. /**
  12969. * Generate Position object with line / column information using recorded
  12970. * newline positions. We know the index is always going to be an already
  12971. * processed index, so all the newlines up to this index should have been
  12972. * recorded.
  12973. */
  12974. getPos(index) {
  12975. let line = 1;
  12976. let column = index + 1;
  12977. for (let i = this.newlines.length - 1; i >= 0; i--) {
  12978. const newlineIndex = this.newlines[i];
  12979. if (index > newlineIndex) {
  12980. line = i + 2;
  12981. column = index - newlineIndex;
  12982. break;
  12983. }
  12984. }
  12985. return {
  12986. column,
  12987. line,
  12988. offset: index
  12989. };
  12990. }
  12991. peek() {
  12992. return this.buffer.charCodeAt(this.index + 1);
  12993. }
  12994. stateText(c) {
  12995. if (c === 60) {
  12996. if (this.index > this.sectionStart) {
  12997. this.cbs.ontext(this.sectionStart, this.index);
  12998. }
  12999. this.state = 5;
  13000. this.sectionStart = this.index;
  13001. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  13002. this.state = 2;
  13003. this.delimiterIndex = 0;
  13004. this.stateInterpolationOpen(c);
  13005. }
  13006. }
  13007. stateInterpolationOpen(c) {
  13008. if (c === this.delimiterOpen[this.delimiterIndex]) {
  13009. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  13010. const start = this.index + 1 - this.delimiterOpen.length;
  13011. if (start > this.sectionStart) {
  13012. this.cbs.ontext(this.sectionStart, start);
  13013. }
  13014. this.state = 3;
  13015. this.sectionStart = start;
  13016. } else {
  13017. this.delimiterIndex++;
  13018. }
  13019. } else if (this.inRCDATA) {
  13020. this.state = 32;
  13021. this.stateInRCDATA(c);
  13022. } else {
  13023. this.state = 1;
  13024. this.stateText(c);
  13025. }
  13026. }
  13027. stateInterpolation(c) {
  13028. if (c === this.delimiterClose[0]) {
  13029. this.state = 4;
  13030. this.delimiterIndex = 0;
  13031. this.stateInterpolationClose(c);
  13032. }
  13033. }
  13034. stateInterpolationClose(c) {
  13035. if (c === this.delimiterClose[this.delimiterIndex]) {
  13036. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  13037. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  13038. if (this.inRCDATA) {
  13039. this.state = 32;
  13040. } else {
  13041. this.state = 1;
  13042. }
  13043. this.sectionStart = this.index + 1;
  13044. } else {
  13045. this.delimiterIndex++;
  13046. }
  13047. } else {
  13048. this.state = 3;
  13049. this.stateInterpolation(c);
  13050. }
  13051. }
  13052. stateSpecialStartSequence(c) {
  13053. const isEnd = this.sequenceIndex === this.currentSequence.length;
  13054. const isMatch = isEnd ? (
  13055. // If we are at the end of the sequence, make sure the tag name has ended
  13056. isEndOfTagSection(c)
  13057. ) : (
  13058. // Otherwise, do a case-insensitive comparison
  13059. (c | 32) === this.currentSequence[this.sequenceIndex]
  13060. );
  13061. if (!isMatch) {
  13062. this.inRCDATA = false;
  13063. } else if (!isEnd) {
  13064. this.sequenceIndex++;
  13065. return;
  13066. }
  13067. this.sequenceIndex = 0;
  13068. this.state = 6;
  13069. this.stateInTagName(c);
  13070. }
  13071. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  13072. stateInRCDATA(c) {
  13073. if (this.sequenceIndex === this.currentSequence.length) {
  13074. if (c === 62 || isWhitespace(c)) {
  13075. const endOfText = this.index - this.currentSequence.length;
  13076. if (this.sectionStart < endOfText) {
  13077. const actualIndex = this.index;
  13078. this.index = endOfText;
  13079. this.cbs.ontext(this.sectionStart, endOfText);
  13080. this.index = actualIndex;
  13081. }
  13082. this.sectionStart = endOfText + 2;
  13083. this.stateInClosingTagName(c);
  13084. this.inRCDATA = false;
  13085. return;
  13086. }
  13087. this.sequenceIndex = 0;
  13088. }
  13089. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  13090. this.sequenceIndex += 1;
  13091. } else if (this.sequenceIndex === 0) {
  13092. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  13093. if (!this.inVPre && c === this.delimiterOpen[0]) {
  13094. this.state = 2;
  13095. this.delimiterIndex = 0;
  13096. this.stateInterpolationOpen(c);
  13097. }
  13098. } else if (this.fastForwardTo(60)) {
  13099. this.sequenceIndex = 1;
  13100. }
  13101. } else {
  13102. this.sequenceIndex = Number(c === 60);
  13103. }
  13104. }
  13105. stateCDATASequence(c) {
  13106. if (c === Sequences.Cdata[this.sequenceIndex]) {
  13107. if (++this.sequenceIndex === Sequences.Cdata.length) {
  13108. this.state = 28;
  13109. this.currentSequence = Sequences.CdataEnd;
  13110. this.sequenceIndex = 0;
  13111. this.sectionStart = this.index + 1;
  13112. }
  13113. } else {
  13114. this.sequenceIndex = 0;
  13115. this.state = 23;
  13116. this.stateInDeclaration(c);
  13117. }
  13118. }
  13119. /**
  13120. * When we wait for one specific character, we can speed things up
  13121. * by skipping through the buffer until we find it.
  13122. *
  13123. * @returns Whether the character was found.
  13124. */
  13125. fastForwardTo(c) {
  13126. while (++this.index < this.buffer.length) {
  13127. const cc = this.buffer.charCodeAt(this.index);
  13128. if (cc === 10) {
  13129. this.newlines.push(this.index);
  13130. }
  13131. if (cc === c) {
  13132. return true;
  13133. }
  13134. }
  13135. this.index = this.buffer.length - 1;
  13136. return false;
  13137. }
  13138. /**
  13139. * Comments and CDATA end with `-->` and `]]>`.
  13140. *
  13141. * Their common qualities are:
  13142. * - Their end sequences have a distinct character they start with.
  13143. * - That character is then repeated, so we have to check multiple repeats.
  13144. * - All characters but the start character of the sequence can be skipped.
  13145. */
  13146. stateInCommentLike(c) {
  13147. if (c === this.currentSequence[this.sequenceIndex]) {
  13148. if (++this.sequenceIndex === this.currentSequence.length) {
  13149. if (this.currentSequence === Sequences.CdataEnd) {
  13150. this.cbs.oncdata(this.sectionStart, this.index - 2);
  13151. } else {
  13152. this.cbs.oncomment(this.sectionStart, this.index - 2);
  13153. }
  13154. this.sequenceIndex = 0;
  13155. this.sectionStart = this.index + 1;
  13156. this.state = 1;
  13157. }
  13158. } else if (this.sequenceIndex === 0) {
  13159. if (this.fastForwardTo(this.currentSequence[0])) {
  13160. this.sequenceIndex = 1;
  13161. }
  13162. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  13163. this.sequenceIndex = 0;
  13164. }
  13165. }
  13166. startSpecial(sequence, offset) {
  13167. this.enterRCDATA(sequence, offset);
  13168. this.state = 31;
  13169. }
  13170. enterRCDATA(sequence, offset) {
  13171. this.inRCDATA = true;
  13172. this.currentSequence = sequence;
  13173. this.sequenceIndex = offset;
  13174. }
  13175. stateBeforeTagName(c) {
  13176. if (c === 33) {
  13177. this.state = 22;
  13178. this.sectionStart = this.index + 1;
  13179. } else if (c === 63) {
  13180. this.state = 24;
  13181. this.sectionStart = this.index + 1;
  13182. } else if (isTagStartChar(c)) {
  13183. this.sectionStart = this.index;
  13184. if (this.mode === 0) {
  13185. this.state = 6;
  13186. } else if (this.inSFCRoot) {
  13187. this.state = 34;
  13188. } else if (!this.inXML) {
  13189. if (c === 116) {
  13190. this.state = 30;
  13191. } else {
  13192. this.state = c === 115 ? 29 : 6;
  13193. }
  13194. } else {
  13195. this.state = 6;
  13196. }
  13197. } else if (c === 47) {
  13198. this.state = 8;
  13199. } else {
  13200. this.state = 1;
  13201. this.stateText(c);
  13202. }
  13203. }
  13204. stateInTagName(c) {
  13205. if (isEndOfTagSection(c)) {
  13206. this.handleTagName(c);
  13207. }
  13208. }
  13209. stateInSFCRootTagName(c) {
  13210. if (isEndOfTagSection(c)) {
  13211. const tag = this.buffer.slice(this.sectionStart, this.index);
  13212. if (tag !== "template") {
  13213. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  13214. }
  13215. this.handleTagName(c);
  13216. }
  13217. }
  13218. handleTagName(c) {
  13219. this.cbs.onopentagname(this.sectionStart, this.index);
  13220. this.sectionStart = -1;
  13221. this.state = 11;
  13222. this.stateBeforeAttrName(c);
  13223. }
  13224. stateBeforeClosingTagName(c) {
  13225. if (isWhitespace(c)) ; else if (c === 62) {
  13226. {
  13227. this.cbs.onerr(14, this.index);
  13228. }
  13229. this.state = 1;
  13230. this.sectionStart = this.index + 1;
  13231. } else {
  13232. this.state = isTagStartChar(c) ? 9 : 27;
  13233. this.sectionStart = this.index;
  13234. }
  13235. }
  13236. stateInClosingTagName(c) {
  13237. if (c === 62 || isWhitespace(c)) {
  13238. this.cbs.onclosetag(this.sectionStart, this.index);
  13239. this.sectionStart = -1;
  13240. this.state = 10;
  13241. this.stateAfterClosingTagName(c);
  13242. }
  13243. }
  13244. stateAfterClosingTagName(c) {
  13245. if (c === 62) {
  13246. this.state = 1;
  13247. this.sectionStart = this.index + 1;
  13248. }
  13249. }
  13250. stateBeforeAttrName(c) {
  13251. if (c === 62) {
  13252. this.cbs.onopentagend(this.index);
  13253. if (this.inRCDATA) {
  13254. this.state = 32;
  13255. } else {
  13256. this.state = 1;
  13257. }
  13258. this.sectionStart = this.index + 1;
  13259. } else if (c === 47) {
  13260. this.state = 7;
  13261. if (this.peek() !== 62) {
  13262. this.cbs.onerr(22, this.index);
  13263. }
  13264. } else if (c === 60 && this.peek() === 47) {
  13265. this.cbs.onopentagend(this.index);
  13266. this.state = 5;
  13267. this.sectionStart = this.index;
  13268. } else if (!isWhitespace(c)) {
  13269. if (c === 61) {
  13270. this.cbs.onerr(
  13271. 19,
  13272. this.index
  13273. );
  13274. }
  13275. this.handleAttrStart(c);
  13276. }
  13277. }
  13278. handleAttrStart(c) {
  13279. if (c === 118 && this.peek() === 45) {
  13280. this.state = 13;
  13281. this.sectionStart = this.index;
  13282. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  13283. this.cbs.ondirname(this.index, this.index + 1);
  13284. this.state = 14;
  13285. this.sectionStart = this.index + 1;
  13286. } else {
  13287. this.state = 12;
  13288. this.sectionStart = this.index;
  13289. }
  13290. }
  13291. stateInSelfClosingTag(c) {
  13292. if (c === 62) {
  13293. this.cbs.onselfclosingtag(this.index);
  13294. this.state = 1;
  13295. this.sectionStart = this.index + 1;
  13296. this.inRCDATA = false;
  13297. } else if (!isWhitespace(c)) {
  13298. this.state = 11;
  13299. this.stateBeforeAttrName(c);
  13300. }
  13301. }
  13302. stateInAttrName(c) {
  13303. if (c === 61 || isEndOfTagSection(c)) {
  13304. this.cbs.onattribname(this.sectionStart, this.index);
  13305. this.handleAttrNameEnd(c);
  13306. } else if (c === 34 || c === 39 || c === 60) {
  13307. this.cbs.onerr(
  13308. 17,
  13309. this.index
  13310. );
  13311. }
  13312. }
  13313. stateInDirName(c) {
  13314. if (c === 61 || isEndOfTagSection(c)) {
  13315. this.cbs.ondirname(this.sectionStart, this.index);
  13316. this.handleAttrNameEnd(c);
  13317. } else if (c === 58) {
  13318. this.cbs.ondirname(this.sectionStart, this.index);
  13319. this.state = 14;
  13320. this.sectionStart = this.index + 1;
  13321. } else if (c === 46) {
  13322. this.cbs.ondirname(this.sectionStart, this.index);
  13323. this.state = 16;
  13324. this.sectionStart = this.index + 1;
  13325. }
  13326. }
  13327. stateInDirArg(c) {
  13328. if (c === 61 || isEndOfTagSection(c)) {
  13329. this.cbs.ondirarg(this.sectionStart, this.index);
  13330. this.handleAttrNameEnd(c);
  13331. } else if (c === 91) {
  13332. this.state = 15;
  13333. } else if (c === 46) {
  13334. this.cbs.ondirarg(this.sectionStart, this.index);
  13335. this.state = 16;
  13336. this.sectionStart = this.index + 1;
  13337. }
  13338. }
  13339. stateInDynamicDirArg(c) {
  13340. if (c === 93) {
  13341. this.state = 14;
  13342. } else if (c === 61 || isEndOfTagSection(c)) {
  13343. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  13344. this.handleAttrNameEnd(c);
  13345. {
  13346. this.cbs.onerr(
  13347. 27,
  13348. this.index
  13349. );
  13350. }
  13351. }
  13352. }
  13353. stateInDirModifier(c) {
  13354. if (c === 61 || isEndOfTagSection(c)) {
  13355. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13356. this.handleAttrNameEnd(c);
  13357. } else if (c === 46) {
  13358. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13359. this.sectionStart = this.index + 1;
  13360. }
  13361. }
  13362. handleAttrNameEnd(c) {
  13363. this.sectionStart = this.index;
  13364. this.state = 17;
  13365. this.cbs.onattribnameend(this.index);
  13366. this.stateAfterAttrName(c);
  13367. }
  13368. stateAfterAttrName(c) {
  13369. if (c === 61) {
  13370. this.state = 18;
  13371. } else if (c === 47 || c === 62) {
  13372. this.cbs.onattribend(0, this.sectionStart);
  13373. this.sectionStart = -1;
  13374. this.state = 11;
  13375. this.stateBeforeAttrName(c);
  13376. } else if (!isWhitespace(c)) {
  13377. this.cbs.onattribend(0, this.sectionStart);
  13378. this.handleAttrStart(c);
  13379. }
  13380. }
  13381. stateBeforeAttrValue(c) {
  13382. if (c === 34) {
  13383. this.state = 19;
  13384. this.sectionStart = this.index + 1;
  13385. } else if (c === 39) {
  13386. this.state = 20;
  13387. this.sectionStart = this.index + 1;
  13388. } else if (!isWhitespace(c)) {
  13389. this.sectionStart = this.index;
  13390. this.state = 21;
  13391. this.stateInAttrValueNoQuotes(c);
  13392. }
  13393. }
  13394. handleInAttrValue(c, quote) {
  13395. if (c === quote || this.fastForwardTo(quote)) {
  13396. this.cbs.onattribdata(this.sectionStart, this.index);
  13397. this.sectionStart = -1;
  13398. this.cbs.onattribend(
  13399. quote === 34 ? 3 : 2,
  13400. this.index + 1
  13401. );
  13402. this.state = 11;
  13403. }
  13404. }
  13405. stateInAttrValueDoubleQuotes(c) {
  13406. this.handleInAttrValue(c, 34);
  13407. }
  13408. stateInAttrValueSingleQuotes(c) {
  13409. this.handleInAttrValue(c, 39);
  13410. }
  13411. stateInAttrValueNoQuotes(c) {
  13412. if (isWhitespace(c) || c === 62) {
  13413. this.cbs.onattribdata(this.sectionStart, this.index);
  13414. this.sectionStart = -1;
  13415. this.cbs.onattribend(1, this.index);
  13416. this.state = 11;
  13417. this.stateBeforeAttrName(c);
  13418. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  13419. this.cbs.onerr(
  13420. 18,
  13421. this.index
  13422. );
  13423. } else ;
  13424. }
  13425. stateBeforeDeclaration(c) {
  13426. if (c === 91) {
  13427. this.state = 26;
  13428. this.sequenceIndex = 0;
  13429. } else {
  13430. this.state = c === 45 ? 25 : 23;
  13431. }
  13432. }
  13433. stateInDeclaration(c) {
  13434. if (c === 62 || this.fastForwardTo(62)) {
  13435. this.state = 1;
  13436. this.sectionStart = this.index + 1;
  13437. }
  13438. }
  13439. stateInProcessingInstruction(c) {
  13440. if (c === 62 || this.fastForwardTo(62)) {
  13441. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  13442. this.state = 1;
  13443. this.sectionStart = this.index + 1;
  13444. }
  13445. }
  13446. stateBeforeComment(c) {
  13447. if (c === 45) {
  13448. this.state = 28;
  13449. this.currentSequence = Sequences.CommentEnd;
  13450. this.sequenceIndex = 2;
  13451. this.sectionStart = this.index + 1;
  13452. } else {
  13453. this.state = 23;
  13454. }
  13455. }
  13456. stateInSpecialComment(c) {
  13457. if (c === 62 || this.fastForwardTo(62)) {
  13458. this.cbs.oncomment(this.sectionStart, this.index);
  13459. this.state = 1;
  13460. this.sectionStart = this.index + 1;
  13461. }
  13462. }
  13463. stateBeforeSpecialS(c) {
  13464. if (c === Sequences.ScriptEnd[3]) {
  13465. this.startSpecial(Sequences.ScriptEnd, 4);
  13466. } else if (c === Sequences.StyleEnd[3]) {
  13467. this.startSpecial(Sequences.StyleEnd, 4);
  13468. } else {
  13469. this.state = 6;
  13470. this.stateInTagName(c);
  13471. }
  13472. }
  13473. stateBeforeSpecialT(c) {
  13474. if (c === Sequences.TitleEnd[3]) {
  13475. this.startSpecial(Sequences.TitleEnd, 4);
  13476. } else if (c === Sequences.TextareaEnd[3]) {
  13477. this.startSpecial(Sequences.TextareaEnd, 4);
  13478. } else {
  13479. this.state = 6;
  13480. this.stateInTagName(c);
  13481. }
  13482. }
  13483. startEntity() {
  13484. }
  13485. stateInEntity() {
  13486. }
  13487. /**
  13488. * Iterates through the buffer, calling the function corresponding to the current state.
  13489. *
  13490. * States that are more likely to be hit are higher up, as a performance improvement.
  13491. */
  13492. parse(input) {
  13493. this.buffer = input;
  13494. while (this.index < this.buffer.length) {
  13495. const c = this.buffer.charCodeAt(this.index);
  13496. if (c === 10 && this.state !== 33) {
  13497. this.newlines.push(this.index);
  13498. }
  13499. switch (this.state) {
  13500. case 1: {
  13501. this.stateText(c);
  13502. break;
  13503. }
  13504. case 2: {
  13505. this.stateInterpolationOpen(c);
  13506. break;
  13507. }
  13508. case 3: {
  13509. this.stateInterpolation(c);
  13510. break;
  13511. }
  13512. case 4: {
  13513. this.stateInterpolationClose(c);
  13514. break;
  13515. }
  13516. case 31: {
  13517. this.stateSpecialStartSequence(c);
  13518. break;
  13519. }
  13520. case 32: {
  13521. this.stateInRCDATA(c);
  13522. break;
  13523. }
  13524. case 26: {
  13525. this.stateCDATASequence(c);
  13526. break;
  13527. }
  13528. case 19: {
  13529. this.stateInAttrValueDoubleQuotes(c);
  13530. break;
  13531. }
  13532. case 12: {
  13533. this.stateInAttrName(c);
  13534. break;
  13535. }
  13536. case 13: {
  13537. this.stateInDirName(c);
  13538. break;
  13539. }
  13540. case 14: {
  13541. this.stateInDirArg(c);
  13542. break;
  13543. }
  13544. case 15: {
  13545. this.stateInDynamicDirArg(c);
  13546. break;
  13547. }
  13548. case 16: {
  13549. this.stateInDirModifier(c);
  13550. break;
  13551. }
  13552. case 28: {
  13553. this.stateInCommentLike(c);
  13554. break;
  13555. }
  13556. case 27: {
  13557. this.stateInSpecialComment(c);
  13558. break;
  13559. }
  13560. case 11: {
  13561. this.stateBeforeAttrName(c);
  13562. break;
  13563. }
  13564. case 6: {
  13565. this.stateInTagName(c);
  13566. break;
  13567. }
  13568. case 34: {
  13569. this.stateInSFCRootTagName(c);
  13570. break;
  13571. }
  13572. case 9: {
  13573. this.stateInClosingTagName(c);
  13574. break;
  13575. }
  13576. case 5: {
  13577. this.stateBeforeTagName(c);
  13578. break;
  13579. }
  13580. case 17: {
  13581. this.stateAfterAttrName(c);
  13582. break;
  13583. }
  13584. case 20: {
  13585. this.stateInAttrValueSingleQuotes(c);
  13586. break;
  13587. }
  13588. case 18: {
  13589. this.stateBeforeAttrValue(c);
  13590. break;
  13591. }
  13592. case 8: {
  13593. this.stateBeforeClosingTagName(c);
  13594. break;
  13595. }
  13596. case 10: {
  13597. this.stateAfterClosingTagName(c);
  13598. break;
  13599. }
  13600. case 29: {
  13601. this.stateBeforeSpecialS(c);
  13602. break;
  13603. }
  13604. case 30: {
  13605. this.stateBeforeSpecialT(c);
  13606. break;
  13607. }
  13608. case 21: {
  13609. this.stateInAttrValueNoQuotes(c);
  13610. break;
  13611. }
  13612. case 7: {
  13613. this.stateInSelfClosingTag(c);
  13614. break;
  13615. }
  13616. case 23: {
  13617. this.stateInDeclaration(c);
  13618. break;
  13619. }
  13620. case 22: {
  13621. this.stateBeforeDeclaration(c);
  13622. break;
  13623. }
  13624. case 25: {
  13625. this.stateBeforeComment(c);
  13626. break;
  13627. }
  13628. case 24: {
  13629. this.stateInProcessingInstruction(c);
  13630. break;
  13631. }
  13632. case 33: {
  13633. this.stateInEntity();
  13634. break;
  13635. }
  13636. }
  13637. this.index++;
  13638. }
  13639. this.cleanup();
  13640. this.finish();
  13641. }
  13642. /**
  13643. * Remove data that has already been consumed from the buffer.
  13644. */
  13645. cleanup() {
  13646. if (this.sectionStart !== this.index) {
  13647. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  13648. this.cbs.ontext(this.sectionStart, this.index);
  13649. this.sectionStart = this.index;
  13650. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  13651. this.cbs.onattribdata(this.sectionStart, this.index);
  13652. this.sectionStart = this.index;
  13653. }
  13654. }
  13655. }
  13656. finish() {
  13657. this.handleTrailingData();
  13658. this.cbs.onend();
  13659. }
  13660. /** Handle any trailing data. */
  13661. handleTrailingData() {
  13662. const endIndex = this.buffer.length;
  13663. if (this.sectionStart >= endIndex) {
  13664. return;
  13665. }
  13666. if (this.state === 28) {
  13667. if (this.currentSequence === Sequences.CdataEnd) {
  13668. this.cbs.oncdata(this.sectionStart, endIndex);
  13669. } else {
  13670. this.cbs.oncomment(this.sectionStart, endIndex);
  13671. }
  13672. } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
  13673. this.cbs.ontext(this.sectionStart, endIndex);
  13674. }
  13675. }
  13676. emitCodePoint(cp, consumed) {
  13677. }
  13678. }
  13679. function defaultOnError(error) {
  13680. throw error;
  13681. }
  13682. function defaultOnWarn(msg) {
  13683. console.warn(`[Vue warn] ${msg.message}`);
  13684. }
  13685. function createCompilerError(code, loc, messages, additionalMessage) {
  13686. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  13687. const error = new SyntaxError(String(msg));
  13688. error.code = code;
  13689. error.loc = loc;
  13690. return error;
  13691. }
  13692. const errorMessages = {
  13693. // parse errors
  13694. [0]: "Illegal comment.",
  13695. [1]: "CDATA section is allowed only in XML context.",
  13696. [2]: "Duplicate attribute.",
  13697. [3]: "End tag cannot have attributes.",
  13698. [4]: "Illegal '/' in tags.",
  13699. [5]: "Unexpected EOF in tag.",
  13700. [6]: "Unexpected EOF in CDATA section.",
  13701. [7]: "Unexpected EOF in comment.",
  13702. [8]: "Unexpected EOF in script.",
  13703. [9]: "Unexpected EOF in tag.",
  13704. [10]: "Incorrectly closed comment.",
  13705. [11]: "Incorrectly opened comment.",
  13706. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  13707. [13]: "Attribute value was expected.",
  13708. [14]: "End tag name was expected.",
  13709. [15]: "Whitespace was expected.",
  13710. [16]: "Unexpected '<!--' in comment.",
  13711. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  13712. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  13713. [19]: "Attribute name cannot start with '='.",
  13714. [21]: "'<?' is allowed only in XML context.",
  13715. [20]: `Unexpected null character.`,
  13716. [22]: "Illegal '/' in tags.",
  13717. // Vue-specific parse errors
  13718. [23]: "Invalid end tag.",
  13719. [24]: "Element is missing end tag.",
  13720. [25]: "Interpolation end sign was not found.",
  13721. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  13722. [26]: "Legal directive name was expected.",
  13723. // transform errors
  13724. [28]: `v-if/v-else-if is missing expression.`,
  13725. [29]: `v-if/else branches must use unique keys.`,
  13726. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  13727. [31]: `v-for is missing expression.`,
  13728. [32]: `v-for has invalid expression.`,
  13729. [33]: `<template v-for> key should be placed on the <template> tag.`,
  13730. [34]: `v-bind is missing expression.`,
  13731. [52]: `v-bind with same-name shorthand only allows static argument.`,
  13732. [35]: `v-on is missing expression.`,
  13733. [36]: `Unexpected custom directive on <slot> outlet.`,
  13734. [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
  13735. [38]: `Duplicate slot names found. `,
  13736. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  13737. [40]: `v-slot can only be used on components or <template> tags.`,
  13738. [41]: `v-model is missing expression.`,
  13739. [42]: `v-model value must be a valid JavaScript member expression.`,
  13740. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  13741. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  13742. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  13743. [45]: `Error parsing JavaScript expression: `,
  13744. [46]: `<KeepAlive> expects exactly one child component.`,
  13745. [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
  13746. // generic errors
  13747. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  13748. [48]: `ES module mode is not supported in this build of compiler.`,
  13749. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  13750. [50]: `"scopeId" option is only supported in module mode.`,
  13751. // just to fulfill types
  13752. [53]: ``
  13753. };
  13754. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  13755. function isCoreComponent(tag) {
  13756. switch (tag) {
  13757. case "Teleport":
  13758. case "teleport":
  13759. return TELEPORT;
  13760. case "Suspense":
  13761. case "suspense":
  13762. return SUSPENSE;
  13763. case "KeepAlive":
  13764. case "keep-alive":
  13765. return KEEP_ALIVE;
  13766. case "BaseTransition":
  13767. case "base-transition":
  13768. return BASE_TRANSITION;
  13769. }
  13770. }
  13771. const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
  13772. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  13773. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  13774. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  13775. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  13776. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  13777. const isMemberExpressionBrowser = (exp) => {
  13778. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  13779. let state = 0 /* inMemberExp */;
  13780. let stateStack = [];
  13781. let currentOpenBracketCount = 0;
  13782. let currentOpenParensCount = 0;
  13783. let currentStringType = null;
  13784. for (let i = 0; i < path.length; i++) {
  13785. const char = path.charAt(i);
  13786. switch (state) {
  13787. case 0 /* inMemberExp */:
  13788. if (char === "[") {
  13789. stateStack.push(state);
  13790. state = 1 /* inBrackets */;
  13791. currentOpenBracketCount++;
  13792. } else if (char === "(") {
  13793. stateStack.push(state);
  13794. state = 2 /* inParens */;
  13795. currentOpenParensCount++;
  13796. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  13797. return false;
  13798. }
  13799. break;
  13800. case 1 /* inBrackets */:
  13801. if (char === `'` || char === `"` || char === "`") {
  13802. stateStack.push(state);
  13803. state = 3 /* inString */;
  13804. currentStringType = char;
  13805. } else if (char === `[`) {
  13806. currentOpenBracketCount++;
  13807. } else if (char === `]`) {
  13808. if (!--currentOpenBracketCount) {
  13809. state = stateStack.pop();
  13810. }
  13811. }
  13812. break;
  13813. case 2 /* inParens */:
  13814. if (char === `'` || char === `"` || char === "`") {
  13815. stateStack.push(state);
  13816. state = 3 /* inString */;
  13817. currentStringType = char;
  13818. } else if (char === `(`) {
  13819. currentOpenParensCount++;
  13820. } else if (char === `)`) {
  13821. if (i === path.length - 1) {
  13822. return false;
  13823. }
  13824. if (!--currentOpenParensCount) {
  13825. state = stateStack.pop();
  13826. }
  13827. }
  13828. break;
  13829. case 3 /* inString */:
  13830. if (char === currentStringType) {
  13831. state = stateStack.pop();
  13832. currentStringType = null;
  13833. }
  13834. break;
  13835. }
  13836. }
  13837. return !currentOpenBracketCount && !currentOpenParensCount;
  13838. };
  13839. const isMemberExpression = isMemberExpressionBrowser ;
  13840. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  13841. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  13842. const isFnExpression = isFnExpressionBrowser ;
  13843. function assert(condition, msg) {
  13844. if (!condition) {
  13845. throw new Error(msg || `unexpected compiler condition`);
  13846. }
  13847. }
  13848. function findDir(node, name, allowEmpty = false) {
  13849. for (let i = 0; i < node.props.length; i++) {
  13850. const p = node.props[i];
  13851. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  13852. return p;
  13853. }
  13854. }
  13855. }
  13856. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  13857. for (let i = 0; i < node.props.length; i++) {
  13858. const p = node.props[i];
  13859. if (p.type === 6) {
  13860. if (dynamicOnly) continue;
  13861. if (p.name === name && (p.value || allowEmpty)) {
  13862. return p;
  13863. }
  13864. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  13865. return p;
  13866. }
  13867. }
  13868. }
  13869. function isStaticArgOf(arg, name) {
  13870. return !!(arg && isStaticExp(arg) && arg.content === name);
  13871. }
  13872. function hasDynamicKeyVBind(node) {
  13873. return node.props.some(
  13874. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  13875. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  13876. !p.arg.isStatic)
  13877. // v-bind:[foo]
  13878. );
  13879. }
  13880. function isText$1(node) {
  13881. return node.type === 5 || node.type === 2;
  13882. }
  13883. function isVPre(p) {
  13884. return p.type === 7 && p.name === "pre";
  13885. }
  13886. function isVSlot(p) {
  13887. return p.type === 7 && p.name === "slot";
  13888. }
  13889. function isTemplateNode(node) {
  13890. return node.type === 1 && node.tagType === 3;
  13891. }
  13892. function isSlotOutlet(node) {
  13893. return node.type === 1 && node.tagType === 2;
  13894. }
  13895. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  13896. function getUnnormalizedProps(props, callPath = []) {
  13897. if (props && !isString(props) && props.type === 14) {
  13898. const callee = props.callee;
  13899. if (!isString(callee) && propsHelperSet.has(callee)) {
  13900. return getUnnormalizedProps(
  13901. props.arguments[0],
  13902. callPath.concat(props)
  13903. );
  13904. }
  13905. }
  13906. return [props, callPath];
  13907. }
  13908. function injectProp(node, prop, context) {
  13909. let propsWithInjection;
  13910. let props = node.type === 13 ? node.props : node.arguments[2];
  13911. let callPath = [];
  13912. let parentCall;
  13913. if (props && !isString(props) && props.type === 14) {
  13914. const ret = getUnnormalizedProps(props);
  13915. props = ret[0];
  13916. callPath = ret[1];
  13917. parentCall = callPath[callPath.length - 1];
  13918. }
  13919. if (props == null || isString(props)) {
  13920. propsWithInjection = createObjectExpression([prop]);
  13921. } else if (props.type === 14) {
  13922. const first = props.arguments[0];
  13923. if (!isString(first) && first.type === 15) {
  13924. if (!hasProp(prop, first)) {
  13925. first.properties.unshift(prop);
  13926. }
  13927. } else {
  13928. if (props.callee === TO_HANDLERS) {
  13929. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13930. createObjectExpression([prop]),
  13931. props
  13932. ]);
  13933. } else {
  13934. props.arguments.unshift(createObjectExpression([prop]));
  13935. }
  13936. }
  13937. !propsWithInjection && (propsWithInjection = props);
  13938. } else if (props.type === 15) {
  13939. if (!hasProp(prop, props)) {
  13940. props.properties.unshift(prop);
  13941. }
  13942. propsWithInjection = props;
  13943. } else {
  13944. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13945. createObjectExpression([prop]),
  13946. props
  13947. ]);
  13948. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  13949. parentCall = callPath[callPath.length - 2];
  13950. }
  13951. }
  13952. if (node.type === 13) {
  13953. if (parentCall) {
  13954. parentCall.arguments[0] = propsWithInjection;
  13955. } else {
  13956. node.props = propsWithInjection;
  13957. }
  13958. } else {
  13959. if (parentCall) {
  13960. parentCall.arguments[0] = propsWithInjection;
  13961. } else {
  13962. node.arguments[2] = propsWithInjection;
  13963. }
  13964. }
  13965. }
  13966. function hasProp(prop, props) {
  13967. let result = false;
  13968. if (prop.key.type === 4) {
  13969. const propKeyName = prop.key.content;
  13970. result = props.properties.some(
  13971. (p) => p.key.type === 4 && p.key.content === propKeyName
  13972. );
  13973. }
  13974. return result;
  13975. }
  13976. function toValidAssetId(name, type) {
  13977. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  13978. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  13979. })}`;
  13980. }
  13981. function getMemoedVNodeCall(node) {
  13982. if (node.type === 14 && node.callee === WITH_MEMO) {
  13983. return node.arguments[1].returns;
  13984. } else {
  13985. return node;
  13986. }
  13987. }
  13988. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  13989. const defaultParserOptions = {
  13990. parseMode: "base",
  13991. ns: 0,
  13992. delimiters: [`{{`, `}}`],
  13993. getNamespace: () => 0,
  13994. isVoidTag: NO,
  13995. isPreTag: NO,
  13996. isIgnoreNewlineTag: NO,
  13997. isCustomElement: NO,
  13998. onError: defaultOnError,
  13999. onWarn: defaultOnWarn,
  14000. comments: true,
  14001. prefixIdentifiers: false
  14002. };
  14003. let currentOptions = defaultParserOptions;
  14004. let currentRoot = null;
  14005. let currentInput = "";
  14006. let currentOpenTag = null;
  14007. let currentProp = null;
  14008. let currentAttrValue = "";
  14009. let currentAttrStartIndex = -1;
  14010. let currentAttrEndIndex = -1;
  14011. let inPre = 0;
  14012. let inVPre = false;
  14013. let currentVPreBoundary = null;
  14014. const stack = [];
  14015. const tokenizer = new Tokenizer(stack, {
  14016. onerr: emitError,
  14017. ontext(start, end) {
  14018. onText(getSlice(start, end), start, end);
  14019. },
  14020. ontextentity(char, start, end) {
  14021. onText(char, start, end);
  14022. },
  14023. oninterpolation(start, end) {
  14024. if (inVPre) {
  14025. return onText(getSlice(start, end), start, end);
  14026. }
  14027. let innerStart = start + tokenizer.delimiterOpen.length;
  14028. let innerEnd = end - tokenizer.delimiterClose.length;
  14029. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  14030. innerStart++;
  14031. }
  14032. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  14033. innerEnd--;
  14034. }
  14035. let exp = getSlice(innerStart, innerEnd);
  14036. if (exp.includes("&")) {
  14037. {
  14038. exp = currentOptions.decodeEntities(exp, false);
  14039. }
  14040. }
  14041. addNode({
  14042. type: 5,
  14043. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  14044. loc: getLoc(start, end)
  14045. });
  14046. },
  14047. onopentagname(start, end) {
  14048. const name = getSlice(start, end);
  14049. currentOpenTag = {
  14050. type: 1,
  14051. tag: name,
  14052. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  14053. tagType: 0,
  14054. // will be refined on tag close
  14055. props: [],
  14056. children: [],
  14057. loc: getLoc(start - 1, end),
  14058. codegenNode: void 0
  14059. };
  14060. },
  14061. onopentagend(end) {
  14062. endOpenTag(end);
  14063. },
  14064. onclosetag(start, end) {
  14065. const name = getSlice(start, end);
  14066. if (!currentOptions.isVoidTag(name)) {
  14067. let found = false;
  14068. for (let i = 0; i < stack.length; i++) {
  14069. const e = stack[i];
  14070. if (e.tag.toLowerCase() === name.toLowerCase()) {
  14071. found = true;
  14072. if (i > 0) {
  14073. emitError(24, stack[0].loc.start.offset);
  14074. }
  14075. for (let j = 0; j <= i; j++) {
  14076. const el = stack.shift();
  14077. onCloseTag(el, end, j < i);
  14078. }
  14079. break;
  14080. }
  14081. }
  14082. if (!found) {
  14083. emitError(23, backTrack(start, 60));
  14084. }
  14085. }
  14086. },
  14087. onselfclosingtag(end) {
  14088. const name = currentOpenTag.tag;
  14089. currentOpenTag.isSelfClosing = true;
  14090. endOpenTag(end);
  14091. if (stack[0] && stack[0].tag === name) {
  14092. onCloseTag(stack.shift(), end);
  14093. }
  14094. },
  14095. onattribname(start, end) {
  14096. currentProp = {
  14097. type: 6,
  14098. name: getSlice(start, end),
  14099. nameLoc: getLoc(start, end),
  14100. value: void 0,
  14101. loc: getLoc(start)
  14102. };
  14103. },
  14104. ondirname(start, end) {
  14105. const raw = getSlice(start, end);
  14106. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  14107. if (!inVPre && name === "") {
  14108. emitError(26, start);
  14109. }
  14110. if (inVPre || name === "") {
  14111. currentProp = {
  14112. type: 6,
  14113. name: raw,
  14114. nameLoc: getLoc(start, end),
  14115. value: void 0,
  14116. loc: getLoc(start)
  14117. };
  14118. } else {
  14119. currentProp = {
  14120. type: 7,
  14121. name,
  14122. rawName: raw,
  14123. exp: void 0,
  14124. arg: void 0,
  14125. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  14126. loc: getLoc(start)
  14127. };
  14128. if (name === "pre") {
  14129. inVPre = tokenizer.inVPre = true;
  14130. currentVPreBoundary = currentOpenTag;
  14131. const props = currentOpenTag.props;
  14132. for (let i = 0; i < props.length; i++) {
  14133. if (props[i].type === 7) {
  14134. props[i] = dirToAttr(props[i]);
  14135. }
  14136. }
  14137. }
  14138. }
  14139. },
  14140. ondirarg(start, end) {
  14141. if (start === end) return;
  14142. const arg = getSlice(start, end);
  14143. if (inVPre && !isVPre(currentProp)) {
  14144. currentProp.name += arg;
  14145. setLocEnd(currentProp.nameLoc, end);
  14146. } else {
  14147. const isStatic = arg[0] !== `[`;
  14148. currentProp.arg = createExp(
  14149. isStatic ? arg : arg.slice(1, -1),
  14150. isStatic,
  14151. getLoc(start, end),
  14152. isStatic ? 3 : 0
  14153. );
  14154. }
  14155. },
  14156. ondirmodifier(start, end) {
  14157. const mod = getSlice(start, end);
  14158. if (inVPre && !isVPre(currentProp)) {
  14159. currentProp.name += "." + mod;
  14160. setLocEnd(currentProp.nameLoc, end);
  14161. } else if (currentProp.name === "slot") {
  14162. const arg = currentProp.arg;
  14163. if (arg) {
  14164. arg.content += "." + mod;
  14165. setLocEnd(arg.loc, end);
  14166. }
  14167. } else {
  14168. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  14169. currentProp.modifiers.push(exp);
  14170. }
  14171. },
  14172. onattribdata(start, end) {
  14173. currentAttrValue += getSlice(start, end);
  14174. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14175. currentAttrEndIndex = end;
  14176. },
  14177. onattribentity(char, start, end) {
  14178. currentAttrValue += char;
  14179. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14180. currentAttrEndIndex = end;
  14181. },
  14182. onattribnameend(end) {
  14183. const start = currentProp.loc.start.offset;
  14184. const name = getSlice(start, end);
  14185. if (currentProp.type === 7) {
  14186. currentProp.rawName = name;
  14187. }
  14188. if (currentOpenTag.props.some(
  14189. (p) => (p.type === 7 ? p.rawName : p.name) === name
  14190. )) {
  14191. emitError(2, start);
  14192. }
  14193. },
  14194. onattribend(quote, end) {
  14195. if (currentOpenTag && currentProp) {
  14196. setLocEnd(currentProp.loc, end);
  14197. if (quote !== 0) {
  14198. if (currentAttrValue.includes("&")) {
  14199. currentAttrValue = currentOptions.decodeEntities(
  14200. currentAttrValue,
  14201. true
  14202. );
  14203. }
  14204. if (currentProp.type === 6) {
  14205. if (currentProp.name === "class") {
  14206. currentAttrValue = condense(currentAttrValue).trim();
  14207. }
  14208. if (quote === 1 && !currentAttrValue) {
  14209. emitError(13, end);
  14210. }
  14211. currentProp.value = {
  14212. type: 2,
  14213. content: currentAttrValue,
  14214. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  14215. };
  14216. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  14217. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  14218. }
  14219. } else {
  14220. let expParseMode = 0 /* Normal */;
  14221. currentProp.exp = createExp(
  14222. currentAttrValue,
  14223. false,
  14224. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  14225. 0,
  14226. expParseMode
  14227. );
  14228. if (currentProp.name === "for") {
  14229. currentProp.forParseResult = parseForExpression(currentProp.exp);
  14230. }
  14231. }
  14232. }
  14233. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  14234. currentOpenTag.props.push(currentProp);
  14235. }
  14236. }
  14237. currentAttrValue = "";
  14238. currentAttrStartIndex = currentAttrEndIndex = -1;
  14239. },
  14240. oncomment(start, end) {
  14241. if (currentOptions.comments) {
  14242. addNode({
  14243. type: 3,
  14244. content: getSlice(start, end),
  14245. loc: getLoc(start - 4, end + 3)
  14246. });
  14247. }
  14248. },
  14249. onend() {
  14250. const end = currentInput.length;
  14251. if (tokenizer.state !== 1) {
  14252. switch (tokenizer.state) {
  14253. case 5:
  14254. case 8:
  14255. emitError(5, end);
  14256. break;
  14257. case 3:
  14258. case 4:
  14259. emitError(
  14260. 25,
  14261. tokenizer.sectionStart
  14262. );
  14263. break;
  14264. case 28:
  14265. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  14266. emitError(6, end);
  14267. } else {
  14268. emitError(7, end);
  14269. }
  14270. break;
  14271. case 6:
  14272. case 7:
  14273. case 9:
  14274. case 11:
  14275. case 12:
  14276. case 13:
  14277. case 14:
  14278. case 15:
  14279. case 16:
  14280. case 17:
  14281. case 18:
  14282. case 19:
  14283. // "
  14284. case 20:
  14285. // '
  14286. case 21:
  14287. emitError(9, end);
  14288. break;
  14289. }
  14290. }
  14291. for (let index = 0; index < stack.length; index++) {
  14292. onCloseTag(stack[index], end - 1);
  14293. emitError(24, stack[index].loc.start.offset);
  14294. }
  14295. },
  14296. oncdata(start, end) {
  14297. if (stack[0].ns !== 0) {
  14298. onText(getSlice(start, end), start, end);
  14299. } else {
  14300. emitError(1, start - 9);
  14301. }
  14302. },
  14303. onprocessinginstruction(start) {
  14304. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14305. emitError(
  14306. 21,
  14307. start - 1
  14308. );
  14309. }
  14310. }
  14311. });
  14312. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  14313. const stripParensRE = /^\(|\)$/g;
  14314. function parseForExpression(input) {
  14315. const loc = input.loc;
  14316. const exp = input.content;
  14317. const inMatch = exp.match(forAliasRE);
  14318. if (!inMatch) return;
  14319. const [, LHS, RHS] = inMatch;
  14320. const createAliasExpression = (content, offset, asParam = false) => {
  14321. const start = loc.start.offset + offset;
  14322. const end = start + content.length;
  14323. return createExp(
  14324. content,
  14325. false,
  14326. getLoc(start, end),
  14327. 0,
  14328. asParam ? 1 /* Params */ : 0 /* Normal */
  14329. );
  14330. };
  14331. const result = {
  14332. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  14333. value: void 0,
  14334. key: void 0,
  14335. index: void 0,
  14336. finalized: false
  14337. };
  14338. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  14339. const trimmedOffset = LHS.indexOf(valueContent);
  14340. const iteratorMatch = valueContent.match(forIteratorRE);
  14341. if (iteratorMatch) {
  14342. valueContent = valueContent.replace(forIteratorRE, "").trim();
  14343. const keyContent = iteratorMatch[1].trim();
  14344. let keyOffset;
  14345. if (keyContent) {
  14346. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  14347. result.key = createAliasExpression(keyContent, keyOffset, true);
  14348. }
  14349. if (iteratorMatch[2]) {
  14350. const indexContent = iteratorMatch[2].trim();
  14351. if (indexContent) {
  14352. result.index = createAliasExpression(
  14353. indexContent,
  14354. exp.indexOf(
  14355. indexContent,
  14356. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  14357. ),
  14358. true
  14359. );
  14360. }
  14361. }
  14362. }
  14363. if (valueContent) {
  14364. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  14365. }
  14366. return result;
  14367. }
  14368. function getSlice(start, end) {
  14369. return currentInput.slice(start, end);
  14370. }
  14371. function endOpenTag(end) {
  14372. if (tokenizer.inSFCRoot) {
  14373. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  14374. }
  14375. addNode(currentOpenTag);
  14376. const { tag, ns } = currentOpenTag;
  14377. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14378. inPre++;
  14379. }
  14380. if (currentOptions.isVoidTag(tag)) {
  14381. onCloseTag(currentOpenTag, end);
  14382. } else {
  14383. stack.unshift(currentOpenTag);
  14384. if (ns === 1 || ns === 2) {
  14385. tokenizer.inXML = true;
  14386. }
  14387. }
  14388. currentOpenTag = null;
  14389. }
  14390. function onText(content, start, end) {
  14391. {
  14392. const tag = stack[0] && stack[0].tag;
  14393. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  14394. content = currentOptions.decodeEntities(content, false);
  14395. }
  14396. }
  14397. const parent = stack[0] || currentRoot;
  14398. const lastNode = parent.children[parent.children.length - 1];
  14399. if (lastNode && lastNode.type === 2) {
  14400. lastNode.content += content;
  14401. setLocEnd(lastNode.loc, end);
  14402. } else {
  14403. parent.children.push({
  14404. type: 2,
  14405. content,
  14406. loc: getLoc(start, end)
  14407. });
  14408. }
  14409. }
  14410. function onCloseTag(el, end, isImplied = false) {
  14411. if (isImplied) {
  14412. setLocEnd(el.loc, backTrack(end, 60));
  14413. } else {
  14414. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  14415. }
  14416. if (tokenizer.inSFCRoot) {
  14417. if (el.children.length) {
  14418. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  14419. } else {
  14420. el.innerLoc.end = extend({}, el.innerLoc.start);
  14421. }
  14422. el.innerLoc.source = getSlice(
  14423. el.innerLoc.start.offset,
  14424. el.innerLoc.end.offset
  14425. );
  14426. }
  14427. const { tag, ns, children } = el;
  14428. if (!inVPre) {
  14429. if (tag === "slot") {
  14430. el.tagType = 2;
  14431. } else if (isFragmentTemplate(el)) {
  14432. el.tagType = 3;
  14433. } else if (isComponent(el)) {
  14434. el.tagType = 1;
  14435. }
  14436. }
  14437. if (!tokenizer.inRCDATA) {
  14438. el.children = condenseWhitespace(children);
  14439. }
  14440. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  14441. const first = children[0];
  14442. if (first && first.type === 2) {
  14443. first.content = first.content.replace(/^\r?\n/, "");
  14444. }
  14445. }
  14446. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14447. inPre--;
  14448. }
  14449. if (currentVPreBoundary === el) {
  14450. inVPre = tokenizer.inVPre = false;
  14451. currentVPreBoundary = null;
  14452. }
  14453. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14454. tokenizer.inXML = false;
  14455. }
  14456. }
  14457. function lookAhead(index, c) {
  14458. let i = index;
  14459. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  14460. return i;
  14461. }
  14462. function backTrack(index, c) {
  14463. let i = index;
  14464. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  14465. return i;
  14466. }
  14467. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  14468. function isFragmentTemplate({ tag, props }) {
  14469. if (tag === "template") {
  14470. for (let i = 0; i < props.length; i++) {
  14471. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  14472. return true;
  14473. }
  14474. }
  14475. }
  14476. return false;
  14477. }
  14478. function isComponent({ tag, props }) {
  14479. if (currentOptions.isCustomElement(tag)) {
  14480. return false;
  14481. }
  14482. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  14483. return true;
  14484. }
  14485. for (let i = 0; i < props.length; i++) {
  14486. const p = props[i];
  14487. if (p.type === 6) {
  14488. if (p.name === "is" && p.value) {
  14489. if (p.value.content.startsWith("vue:")) {
  14490. return true;
  14491. }
  14492. }
  14493. }
  14494. }
  14495. return false;
  14496. }
  14497. function isUpperCase(c) {
  14498. return c > 64 && c < 91;
  14499. }
  14500. const windowsNewlineRE = /\r\n/g;
  14501. function condenseWhitespace(nodes) {
  14502. const shouldCondense = currentOptions.whitespace !== "preserve";
  14503. let removedWhitespace = false;
  14504. for (let i = 0; i < nodes.length; i++) {
  14505. const node = nodes[i];
  14506. if (node.type === 2) {
  14507. if (!inPre) {
  14508. if (isAllWhitespace(node.content)) {
  14509. const prev = nodes[i - 1] && nodes[i - 1].type;
  14510. const next = nodes[i + 1] && nodes[i + 1].type;
  14511. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  14512. removedWhitespace = true;
  14513. nodes[i] = null;
  14514. } else {
  14515. node.content = " ";
  14516. }
  14517. } else if (shouldCondense) {
  14518. node.content = condense(node.content);
  14519. }
  14520. } else {
  14521. node.content = node.content.replace(windowsNewlineRE, "\n");
  14522. }
  14523. }
  14524. }
  14525. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  14526. }
  14527. function isAllWhitespace(str) {
  14528. for (let i = 0; i < str.length; i++) {
  14529. if (!isWhitespace(str.charCodeAt(i))) {
  14530. return false;
  14531. }
  14532. }
  14533. return true;
  14534. }
  14535. function hasNewlineChar(str) {
  14536. for (let i = 0; i < str.length; i++) {
  14537. const c = str.charCodeAt(i);
  14538. if (c === 10 || c === 13) {
  14539. return true;
  14540. }
  14541. }
  14542. return false;
  14543. }
  14544. function condense(str) {
  14545. let ret = "";
  14546. let prevCharIsWhitespace = false;
  14547. for (let i = 0; i < str.length; i++) {
  14548. if (isWhitespace(str.charCodeAt(i))) {
  14549. if (!prevCharIsWhitespace) {
  14550. ret += " ";
  14551. prevCharIsWhitespace = true;
  14552. }
  14553. } else {
  14554. ret += str[i];
  14555. prevCharIsWhitespace = false;
  14556. }
  14557. }
  14558. return ret;
  14559. }
  14560. function addNode(node) {
  14561. (stack[0] || currentRoot).children.push(node);
  14562. }
  14563. function getLoc(start, end) {
  14564. return {
  14565. start: tokenizer.getPos(start),
  14566. // @ts-expect-error allow late attachment
  14567. end: end == null ? end : tokenizer.getPos(end),
  14568. // @ts-expect-error allow late attachment
  14569. source: end == null ? end : getSlice(start, end)
  14570. };
  14571. }
  14572. function cloneLoc(loc) {
  14573. return getLoc(loc.start.offset, loc.end.offset);
  14574. }
  14575. function setLocEnd(loc, end) {
  14576. loc.end = tokenizer.getPos(end);
  14577. loc.source = getSlice(loc.start.offset, end);
  14578. }
  14579. function dirToAttr(dir) {
  14580. const attr = {
  14581. type: 6,
  14582. name: dir.rawName,
  14583. nameLoc: getLoc(
  14584. dir.loc.start.offset,
  14585. dir.loc.start.offset + dir.rawName.length
  14586. ),
  14587. value: void 0,
  14588. loc: dir.loc
  14589. };
  14590. if (dir.exp) {
  14591. const loc = dir.exp.loc;
  14592. if (loc.end.offset < dir.loc.end.offset) {
  14593. loc.start.offset--;
  14594. loc.start.column--;
  14595. loc.end.offset++;
  14596. loc.end.column++;
  14597. }
  14598. attr.value = {
  14599. type: 2,
  14600. content: dir.exp.content,
  14601. loc
  14602. };
  14603. }
  14604. return attr;
  14605. }
  14606. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  14607. const exp = createSimpleExpression(content, isStatic, loc, constType);
  14608. return exp;
  14609. }
  14610. function emitError(code, index, message) {
  14611. currentOptions.onError(
  14612. createCompilerError(code, getLoc(index, index), void 0, message)
  14613. );
  14614. }
  14615. function reset() {
  14616. tokenizer.reset();
  14617. currentOpenTag = null;
  14618. currentProp = null;
  14619. currentAttrValue = "";
  14620. currentAttrStartIndex = -1;
  14621. currentAttrEndIndex = -1;
  14622. stack.length = 0;
  14623. }
  14624. function baseParse(input, options) {
  14625. reset();
  14626. currentInput = input;
  14627. currentOptions = extend({}, defaultParserOptions);
  14628. if (options) {
  14629. let key;
  14630. for (key in options) {
  14631. if (options[key] != null) {
  14632. currentOptions[key] = options[key];
  14633. }
  14634. }
  14635. }
  14636. {
  14637. if (!currentOptions.decodeEntities) {
  14638. throw new Error(
  14639. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  14640. );
  14641. }
  14642. }
  14643. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  14644. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  14645. const delimiters = options && options.delimiters;
  14646. if (delimiters) {
  14647. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  14648. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  14649. }
  14650. const root = currentRoot = createRoot([], input);
  14651. tokenizer.parse(currentInput);
  14652. root.loc = getLoc(0, input.length);
  14653. root.children = condenseWhitespace(root.children);
  14654. currentRoot = null;
  14655. return root;
  14656. }
  14657. function cacheStatic(root, context) {
  14658. walk(
  14659. root,
  14660. void 0,
  14661. context,
  14662. // Root node is unfortunately non-hoistable due to potential parent
  14663. // fallthrough attributes.
  14664. !!getSingleElementRoot(root)
  14665. );
  14666. }
  14667. function getSingleElementRoot(root) {
  14668. const children = root.children.filter((x) => x.type !== 3);
  14669. return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
  14670. }
  14671. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  14672. const { children } = node;
  14673. const toCache = [];
  14674. for (let i = 0; i < children.length; i++) {
  14675. const child = children[i];
  14676. if (child.type === 1 && child.tagType === 0) {
  14677. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14678. if (constantType > 0) {
  14679. if (constantType >= 2) {
  14680. child.codegenNode.patchFlag = -1;
  14681. toCache.push(child);
  14682. continue;
  14683. }
  14684. } else {
  14685. const codegenNode = child.codegenNode;
  14686. if (codegenNode.type === 13) {
  14687. const flag = codegenNode.patchFlag;
  14688. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  14689. const props = getNodeProps(child);
  14690. if (props) {
  14691. codegenNode.props = context.hoist(props);
  14692. }
  14693. }
  14694. if (codegenNode.dynamicProps) {
  14695. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  14696. }
  14697. }
  14698. }
  14699. } else if (child.type === 12) {
  14700. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14701. if (constantType >= 2) {
  14702. if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
  14703. child.codegenNode.arguments.push(
  14704. -1 + (` /* ${PatchFlagNames[-1]} */` )
  14705. );
  14706. }
  14707. toCache.push(child);
  14708. continue;
  14709. }
  14710. }
  14711. if (child.type === 1) {
  14712. const isComponent = child.tagType === 1;
  14713. if (isComponent) {
  14714. context.scopes.vSlot++;
  14715. }
  14716. walk(child, node, context, false, inFor);
  14717. if (isComponent) {
  14718. context.scopes.vSlot--;
  14719. }
  14720. } else if (child.type === 11) {
  14721. walk(child, node, context, child.children.length === 1, true);
  14722. } else if (child.type === 9) {
  14723. for (let i2 = 0; i2 < child.branches.length; i2++) {
  14724. walk(
  14725. child.branches[i2],
  14726. node,
  14727. context,
  14728. child.branches[i2].children.length === 1,
  14729. inFor
  14730. );
  14731. }
  14732. }
  14733. }
  14734. let cachedAsArray = false;
  14735. if (toCache.length === children.length && node.type === 1) {
  14736. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  14737. node.codegenNode.children = getCacheExpression(
  14738. createArrayExpression(node.codegenNode.children)
  14739. );
  14740. cachedAsArray = true;
  14741. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  14742. const slot = getSlotNode(node.codegenNode, "default");
  14743. if (slot) {
  14744. slot.returns = getCacheExpression(
  14745. createArrayExpression(slot.returns)
  14746. );
  14747. cachedAsArray = true;
  14748. }
  14749. } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
  14750. const slotName = findDir(node, "slot", true);
  14751. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  14752. if (slot) {
  14753. slot.returns = getCacheExpression(
  14754. createArrayExpression(slot.returns)
  14755. );
  14756. cachedAsArray = true;
  14757. }
  14758. }
  14759. }
  14760. if (!cachedAsArray) {
  14761. for (const child of toCache) {
  14762. child.codegenNode = context.cache(child.codegenNode);
  14763. }
  14764. }
  14765. function getCacheExpression(value) {
  14766. const exp = context.cache(value);
  14767. exp.needArraySpread = true;
  14768. return exp;
  14769. }
  14770. function getSlotNode(node2, name) {
  14771. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  14772. const slot = node2.children.properties.find(
  14773. (p) => p.key === name || p.key.content === name
  14774. );
  14775. return slot && slot.value;
  14776. }
  14777. }
  14778. if (toCache.length && context.transformHoist) {
  14779. context.transformHoist(children, context, node);
  14780. }
  14781. }
  14782. function getConstantType(node, context) {
  14783. const { constantCache } = context;
  14784. switch (node.type) {
  14785. case 1:
  14786. if (node.tagType !== 0) {
  14787. return 0;
  14788. }
  14789. const cached = constantCache.get(node);
  14790. if (cached !== void 0) {
  14791. return cached;
  14792. }
  14793. const codegenNode = node.codegenNode;
  14794. if (codegenNode.type !== 13) {
  14795. return 0;
  14796. }
  14797. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  14798. return 0;
  14799. }
  14800. if (codegenNode.patchFlag === void 0) {
  14801. let returnType2 = 3;
  14802. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  14803. if (generatedPropsType === 0) {
  14804. constantCache.set(node, 0);
  14805. return 0;
  14806. }
  14807. if (generatedPropsType < returnType2) {
  14808. returnType2 = generatedPropsType;
  14809. }
  14810. for (let i = 0; i < node.children.length; i++) {
  14811. const childType = getConstantType(node.children[i], context);
  14812. if (childType === 0) {
  14813. constantCache.set(node, 0);
  14814. return 0;
  14815. }
  14816. if (childType < returnType2) {
  14817. returnType2 = childType;
  14818. }
  14819. }
  14820. if (returnType2 > 1) {
  14821. for (let i = 0; i < node.props.length; i++) {
  14822. const p = node.props[i];
  14823. if (p.type === 7 && p.name === "bind" && p.exp) {
  14824. const expType = getConstantType(p.exp, context);
  14825. if (expType === 0) {
  14826. constantCache.set(node, 0);
  14827. return 0;
  14828. }
  14829. if (expType < returnType2) {
  14830. returnType2 = expType;
  14831. }
  14832. }
  14833. }
  14834. }
  14835. if (codegenNode.isBlock) {
  14836. for (let i = 0; i < node.props.length; i++) {
  14837. const p = node.props[i];
  14838. if (p.type === 7) {
  14839. constantCache.set(node, 0);
  14840. return 0;
  14841. }
  14842. }
  14843. context.removeHelper(OPEN_BLOCK);
  14844. context.removeHelper(
  14845. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  14846. );
  14847. codegenNode.isBlock = false;
  14848. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  14849. }
  14850. constantCache.set(node, returnType2);
  14851. return returnType2;
  14852. } else {
  14853. constantCache.set(node, 0);
  14854. return 0;
  14855. }
  14856. case 2:
  14857. case 3:
  14858. return 3;
  14859. case 9:
  14860. case 11:
  14861. case 10:
  14862. return 0;
  14863. case 5:
  14864. case 12:
  14865. return getConstantType(node.content, context);
  14866. case 4:
  14867. return node.constType;
  14868. case 8:
  14869. let returnType = 3;
  14870. for (let i = 0; i < node.children.length; i++) {
  14871. const child = node.children[i];
  14872. if (isString(child) || isSymbol(child)) {
  14873. continue;
  14874. }
  14875. const childType = getConstantType(child, context);
  14876. if (childType === 0) {
  14877. return 0;
  14878. } else if (childType < returnType) {
  14879. returnType = childType;
  14880. }
  14881. }
  14882. return returnType;
  14883. case 20:
  14884. return 2;
  14885. default:
  14886. return 0;
  14887. }
  14888. }
  14889. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  14890. NORMALIZE_CLASS,
  14891. NORMALIZE_STYLE,
  14892. NORMALIZE_PROPS,
  14893. GUARD_REACTIVE_PROPS
  14894. ]);
  14895. function getConstantTypeOfHelperCall(value, context) {
  14896. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  14897. const arg = value.arguments[0];
  14898. if (arg.type === 4) {
  14899. return getConstantType(arg, context);
  14900. } else if (arg.type === 14) {
  14901. return getConstantTypeOfHelperCall(arg, context);
  14902. }
  14903. }
  14904. return 0;
  14905. }
  14906. function getGeneratedPropsConstantType(node, context) {
  14907. let returnType = 3;
  14908. const props = getNodeProps(node);
  14909. if (props && props.type === 15) {
  14910. const { properties } = props;
  14911. for (let i = 0; i < properties.length; i++) {
  14912. const { key, value } = properties[i];
  14913. const keyType = getConstantType(key, context);
  14914. if (keyType === 0) {
  14915. return keyType;
  14916. }
  14917. if (keyType < returnType) {
  14918. returnType = keyType;
  14919. }
  14920. let valueType;
  14921. if (value.type === 4) {
  14922. valueType = getConstantType(value, context);
  14923. } else if (value.type === 14) {
  14924. valueType = getConstantTypeOfHelperCall(value, context);
  14925. } else {
  14926. valueType = 0;
  14927. }
  14928. if (valueType === 0) {
  14929. return valueType;
  14930. }
  14931. if (valueType < returnType) {
  14932. returnType = valueType;
  14933. }
  14934. }
  14935. }
  14936. return returnType;
  14937. }
  14938. function getNodeProps(node) {
  14939. const codegenNode = node.codegenNode;
  14940. if (codegenNode.type === 13) {
  14941. return codegenNode.props;
  14942. }
  14943. }
  14944. function createTransformContext(root, {
  14945. filename = "",
  14946. prefixIdentifiers = false,
  14947. hoistStatic = false,
  14948. hmr = false,
  14949. cacheHandlers = false,
  14950. nodeTransforms = [],
  14951. directiveTransforms = {},
  14952. transformHoist = null,
  14953. isBuiltInComponent = NOOP,
  14954. isCustomElement = NOOP,
  14955. expressionPlugins = [],
  14956. scopeId = null,
  14957. slotted = true,
  14958. ssr = false,
  14959. inSSR = false,
  14960. ssrCssVars = ``,
  14961. bindingMetadata = EMPTY_OBJ,
  14962. inline = false,
  14963. isTS = false,
  14964. onError = defaultOnError,
  14965. onWarn = defaultOnWarn,
  14966. compatConfig
  14967. }) {
  14968. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  14969. const context = {
  14970. // options
  14971. filename,
  14972. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  14973. prefixIdentifiers,
  14974. hoistStatic,
  14975. hmr,
  14976. cacheHandlers,
  14977. nodeTransforms,
  14978. directiveTransforms,
  14979. transformHoist,
  14980. isBuiltInComponent,
  14981. isCustomElement,
  14982. expressionPlugins,
  14983. scopeId,
  14984. slotted,
  14985. ssr,
  14986. inSSR,
  14987. ssrCssVars,
  14988. bindingMetadata,
  14989. inline,
  14990. isTS,
  14991. onError,
  14992. onWarn,
  14993. compatConfig,
  14994. // state
  14995. root,
  14996. helpers: /* @__PURE__ */ new Map(),
  14997. components: /* @__PURE__ */ new Set(),
  14998. directives: /* @__PURE__ */ new Set(),
  14999. hoists: [],
  15000. imports: [],
  15001. cached: [],
  15002. constantCache: /* @__PURE__ */ new WeakMap(),
  15003. temps: 0,
  15004. identifiers: /* @__PURE__ */ Object.create(null),
  15005. scopes: {
  15006. vFor: 0,
  15007. vSlot: 0,
  15008. vPre: 0,
  15009. vOnce: 0
  15010. },
  15011. parent: null,
  15012. grandParent: null,
  15013. currentNode: root,
  15014. childIndex: 0,
  15015. inVOnce: false,
  15016. // methods
  15017. helper(name) {
  15018. const count = context.helpers.get(name) || 0;
  15019. context.helpers.set(name, count + 1);
  15020. return name;
  15021. },
  15022. removeHelper(name) {
  15023. const count = context.helpers.get(name);
  15024. if (count) {
  15025. const currentCount = count - 1;
  15026. if (!currentCount) {
  15027. context.helpers.delete(name);
  15028. } else {
  15029. context.helpers.set(name, currentCount);
  15030. }
  15031. }
  15032. },
  15033. helperString(name) {
  15034. return `_${helperNameMap[context.helper(name)]}`;
  15035. },
  15036. replaceNode(node) {
  15037. {
  15038. if (!context.currentNode) {
  15039. throw new Error(`Node being replaced is already removed.`);
  15040. }
  15041. if (!context.parent) {
  15042. throw new Error(`Cannot replace root node.`);
  15043. }
  15044. }
  15045. context.parent.children[context.childIndex] = context.currentNode = node;
  15046. },
  15047. removeNode(node) {
  15048. if (!context.parent) {
  15049. throw new Error(`Cannot remove root node.`);
  15050. }
  15051. const list = context.parent.children;
  15052. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  15053. if (removalIndex < 0) {
  15054. throw new Error(`node being removed is not a child of current parent`);
  15055. }
  15056. if (!node || node === context.currentNode) {
  15057. context.currentNode = null;
  15058. context.onNodeRemoved();
  15059. } else {
  15060. if (context.childIndex > removalIndex) {
  15061. context.childIndex--;
  15062. context.onNodeRemoved();
  15063. }
  15064. }
  15065. context.parent.children.splice(removalIndex, 1);
  15066. },
  15067. onNodeRemoved: NOOP,
  15068. addIdentifiers(exp) {
  15069. },
  15070. removeIdentifiers(exp) {
  15071. },
  15072. hoist(exp) {
  15073. if (isString(exp)) exp = createSimpleExpression(exp);
  15074. context.hoists.push(exp);
  15075. const identifier = createSimpleExpression(
  15076. `_hoisted_${context.hoists.length}`,
  15077. false,
  15078. exp.loc,
  15079. 2
  15080. );
  15081. identifier.hoisted = exp;
  15082. return identifier;
  15083. },
  15084. cache(exp, isVNode = false, inVOnce = false) {
  15085. const cacheExp = createCacheExpression(
  15086. context.cached.length,
  15087. exp,
  15088. isVNode,
  15089. inVOnce
  15090. );
  15091. context.cached.push(cacheExp);
  15092. return cacheExp;
  15093. }
  15094. };
  15095. return context;
  15096. }
  15097. function transform(root, options) {
  15098. const context = createTransformContext(root, options);
  15099. traverseNode(root, context);
  15100. if (options.hoistStatic) {
  15101. cacheStatic(root, context);
  15102. }
  15103. if (!options.ssr) {
  15104. createRootCodegen(root, context);
  15105. }
  15106. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  15107. root.components = [...context.components];
  15108. root.directives = [...context.directives];
  15109. root.imports = context.imports;
  15110. root.hoists = context.hoists;
  15111. root.temps = context.temps;
  15112. root.cached = context.cached;
  15113. root.transformed = true;
  15114. }
  15115. function createRootCodegen(root, context) {
  15116. const { helper } = context;
  15117. const { children } = root;
  15118. if (children.length === 1) {
  15119. const singleElementRootChild = getSingleElementRoot(root);
  15120. if (singleElementRootChild && singleElementRootChild.codegenNode) {
  15121. const codegenNode = singleElementRootChild.codegenNode;
  15122. if (codegenNode.type === 13) {
  15123. convertToBlock(codegenNode, context);
  15124. }
  15125. root.codegenNode = codegenNode;
  15126. } else {
  15127. root.codegenNode = children[0];
  15128. }
  15129. } else if (children.length > 1) {
  15130. let patchFlag = 64;
  15131. if (children.filter((c) => c.type !== 3).length === 1) {
  15132. patchFlag |= 2048;
  15133. }
  15134. root.codegenNode = createVNodeCall(
  15135. context,
  15136. helper(FRAGMENT),
  15137. void 0,
  15138. root.children,
  15139. patchFlag,
  15140. void 0,
  15141. void 0,
  15142. true,
  15143. void 0,
  15144. false
  15145. );
  15146. } else ;
  15147. }
  15148. function traverseChildren(parent, context) {
  15149. let i = 0;
  15150. const nodeRemoved = () => {
  15151. i--;
  15152. };
  15153. for (; i < parent.children.length; i++) {
  15154. const child = parent.children[i];
  15155. if (isString(child)) continue;
  15156. context.grandParent = context.parent;
  15157. context.parent = parent;
  15158. context.childIndex = i;
  15159. context.onNodeRemoved = nodeRemoved;
  15160. traverseNode(child, context);
  15161. }
  15162. }
  15163. function traverseNode(node, context) {
  15164. context.currentNode = node;
  15165. const { nodeTransforms } = context;
  15166. const exitFns = [];
  15167. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  15168. const onExit = nodeTransforms[i2](node, context);
  15169. if (onExit) {
  15170. if (isArray(onExit)) {
  15171. exitFns.push(...onExit);
  15172. } else {
  15173. exitFns.push(onExit);
  15174. }
  15175. }
  15176. if (!context.currentNode) {
  15177. return;
  15178. } else {
  15179. node = context.currentNode;
  15180. }
  15181. }
  15182. switch (node.type) {
  15183. case 3:
  15184. if (!context.ssr) {
  15185. context.helper(CREATE_COMMENT);
  15186. }
  15187. break;
  15188. case 5:
  15189. if (!context.ssr) {
  15190. context.helper(TO_DISPLAY_STRING);
  15191. }
  15192. break;
  15193. // for container types, further traverse downwards
  15194. case 9:
  15195. for (let i2 = 0; i2 < node.branches.length; i2++) {
  15196. traverseNode(node.branches[i2], context);
  15197. }
  15198. break;
  15199. case 10:
  15200. case 11:
  15201. case 1:
  15202. case 0:
  15203. traverseChildren(node, context);
  15204. break;
  15205. }
  15206. context.currentNode = node;
  15207. let i = exitFns.length;
  15208. while (i--) {
  15209. exitFns[i]();
  15210. }
  15211. }
  15212. function createStructuralDirectiveTransform(name, fn) {
  15213. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  15214. return (node, context) => {
  15215. if (node.type === 1) {
  15216. const { props } = node;
  15217. if (node.tagType === 3 && props.some(isVSlot)) {
  15218. return;
  15219. }
  15220. const exitFns = [];
  15221. for (let i = 0; i < props.length; i++) {
  15222. const prop = props[i];
  15223. if (prop.type === 7 && matches(prop.name)) {
  15224. props.splice(i, 1);
  15225. i--;
  15226. const onExit = fn(node, prop, context);
  15227. if (onExit) exitFns.push(onExit);
  15228. }
  15229. }
  15230. return exitFns;
  15231. }
  15232. };
  15233. }
  15234. const PURE_ANNOTATION = `/*@__PURE__*/`;
  15235. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  15236. function createCodegenContext(ast, {
  15237. mode = "function",
  15238. prefixIdentifiers = mode === "module",
  15239. sourceMap = false,
  15240. filename = `template.vue.html`,
  15241. scopeId = null,
  15242. optimizeImports = false,
  15243. runtimeGlobalName = `Vue`,
  15244. runtimeModuleName = `vue`,
  15245. ssrRuntimeModuleName = "vue/server-renderer",
  15246. ssr = false,
  15247. isTS = false,
  15248. inSSR = false
  15249. }) {
  15250. const context = {
  15251. mode,
  15252. prefixIdentifiers,
  15253. sourceMap,
  15254. filename,
  15255. scopeId,
  15256. optimizeImports,
  15257. runtimeGlobalName,
  15258. runtimeModuleName,
  15259. ssrRuntimeModuleName,
  15260. ssr,
  15261. isTS,
  15262. inSSR,
  15263. source: ast.source,
  15264. code: ``,
  15265. column: 1,
  15266. line: 1,
  15267. offset: 0,
  15268. indentLevel: 0,
  15269. pure: false,
  15270. map: void 0,
  15271. helper(key) {
  15272. return `_${helperNameMap[key]}`;
  15273. },
  15274. push(code, newlineIndex = -2 /* None */, node) {
  15275. context.code += code;
  15276. },
  15277. indent() {
  15278. newline(++context.indentLevel);
  15279. },
  15280. deindent(withoutNewLine = false) {
  15281. if (withoutNewLine) {
  15282. --context.indentLevel;
  15283. } else {
  15284. newline(--context.indentLevel);
  15285. }
  15286. },
  15287. newline() {
  15288. newline(context.indentLevel);
  15289. }
  15290. };
  15291. function newline(n) {
  15292. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  15293. }
  15294. return context;
  15295. }
  15296. function generate(ast, options = {}) {
  15297. const context = createCodegenContext(ast, options);
  15298. if (options.onContextCreated) options.onContextCreated(context);
  15299. const {
  15300. mode,
  15301. push,
  15302. prefixIdentifiers,
  15303. indent,
  15304. deindent,
  15305. newline,
  15306. scopeId,
  15307. ssr
  15308. } = context;
  15309. const helpers = Array.from(ast.helpers);
  15310. const hasHelpers = helpers.length > 0;
  15311. const useWithBlock = !prefixIdentifiers && mode !== "module";
  15312. const preambleContext = context;
  15313. {
  15314. genFunctionPreamble(ast, preambleContext);
  15315. }
  15316. const functionName = ssr ? `ssrRender` : `render`;
  15317. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  15318. const signature = args.join(", ");
  15319. {
  15320. push(`function ${functionName}(${signature}) {`);
  15321. }
  15322. indent();
  15323. if (useWithBlock) {
  15324. push(`with (_ctx) {`);
  15325. indent();
  15326. if (hasHelpers) {
  15327. push(
  15328. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  15329. `,
  15330. -1 /* End */
  15331. );
  15332. newline();
  15333. }
  15334. }
  15335. if (ast.components.length) {
  15336. genAssets(ast.components, "component", context);
  15337. if (ast.directives.length || ast.temps > 0) {
  15338. newline();
  15339. }
  15340. }
  15341. if (ast.directives.length) {
  15342. genAssets(ast.directives, "directive", context);
  15343. if (ast.temps > 0) {
  15344. newline();
  15345. }
  15346. }
  15347. if (ast.temps > 0) {
  15348. push(`let `);
  15349. for (let i = 0; i < ast.temps; i++) {
  15350. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  15351. }
  15352. }
  15353. if (ast.components.length || ast.directives.length || ast.temps) {
  15354. push(`
  15355. `, 0 /* Start */);
  15356. newline();
  15357. }
  15358. if (!ssr) {
  15359. push(`return `);
  15360. }
  15361. if (ast.codegenNode) {
  15362. genNode(ast.codegenNode, context);
  15363. } else {
  15364. push(`null`);
  15365. }
  15366. if (useWithBlock) {
  15367. deindent();
  15368. push(`}`);
  15369. }
  15370. deindent();
  15371. push(`}`);
  15372. return {
  15373. ast,
  15374. code: context.code,
  15375. preamble: ``,
  15376. map: context.map ? context.map.toJSON() : void 0
  15377. };
  15378. }
  15379. function genFunctionPreamble(ast, context) {
  15380. const {
  15381. ssr,
  15382. prefixIdentifiers,
  15383. push,
  15384. newline,
  15385. runtimeModuleName,
  15386. runtimeGlobalName,
  15387. ssrRuntimeModuleName
  15388. } = context;
  15389. const VueBinding = runtimeGlobalName;
  15390. const helpers = Array.from(ast.helpers);
  15391. if (helpers.length > 0) {
  15392. {
  15393. push(`const _Vue = ${VueBinding}
  15394. `, -1 /* End */);
  15395. if (ast.hoists.length) {
  15396. const staticHelpers = [
  15397. CREATE_VNODE,
  15398. CREATE_ELEMENT_VNODE,
  15399. CREATE_COMMENT,
  15400. CREATE_TEXT,
  15401. CREATE_STATIC
  15402. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  15403. push(`const { ${staticHelpers} } = _Vue
  15404. `, -1 /* End */);
  15405. }
  15406. }
  15407. }
  15408. genHoists(ast.hoists, context);
  15409. newline();
  15410. push(`return `);
  15411. }
  15412. function genAssets(assets, type, { helper, push, newline, isTS }) {
  15413. const resolver = helper(
  15414. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  15415. );
  15416. for (let i = 0; i < assets.length; i++) {
  15417. let id = assets[i];
  15418. const maybeSelfReference = id.endsWith("__self");
  15419. if (maybeSelfReference) {
  15420. id = id.slice(0, -6);
  15421. }
  15422. push(
  15423. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  15424. );
  15425. if (i < assets.length - 1) {
  15426. newline();
  15427. }
  15428. }
  15429. }
  15430. function genHoists(hoists, context) {
  15431. if (!hoists.length) {
  15432. return;
  15433. }
  15434. context.pure = true;
  15435. const { push, newline } = context;
  15436. newline();
  15437. for (let i = 0; i < hoists.length; i++) {
  15438. const exp = hoists[i];
  15439. if (exp) {
  15440. push(`const _hoisted_${i + 1} = `);
  15441. genNode(exp, context);
  15442. newline();
  15443. }
  15444. }
  15445. context.pure = false;
  15446. }
  15447. function isText(n) {
  15448. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  15449. }
  15450. function genNodeListAsArray(nodes, context) {
  15451. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  15452. context.push(`[`);
  15453. multilines && context.indent();
  15454. genNodeList(nodes, context, multilines);
  15455. multilines && context.deindent();
  15456. context.push(`]`);
  15457. }
  15458. function genNodeList(nodes, context, multilines = false, comma = true) {
  15459. const { push, newline } = context;
  15460. for (let i = 0; i < nodes.length; i++) {
  15461. const node = nodes[i];
  15462. if (isString(node)) {
  15463. push(node, -3 /* Unknown */);
  15464. } else if (isArray(node)) {
  15465. genNodeListAsArray(node, context);
  15466. } else {
  15467. genNode(node, context);
  15468. }
  15469. if (i < nodes.length - 1) {
  15470. if (multilines) {
  15471. comma && push(",");
  15472. newline();
  15473. } else {
  15474. comma && push(", ");
  15475. }
  15476. }
  15477. }
  15478. }
  15479. function genNode(node, context) {
  15480. if (isString(node)) {
  15481. context.push(node, -3 /* Unknown */);
  15482. return;
  15483. }
  15484. if (isSymbol(node)) {
  15485. context.push(context.helper(node));
  15486. return;
  15487. }
  15488. switch (node.type) {
  15489. case 1:
  15490. case 9:
  15491. case 11:
  15492. assert(
  15493. node.codegenNode != null,
  15494. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  15495. );
  15496. genNode(node.codegenNode, context);
  15497. break;
  15498. case 2:
  15499. genText(node, context);
  15500. break;
  15501. case 4:
  15502. genExpression(node, context);
  15503. break;
  15504. case 5:
  15505. genInterpolation(node, context);
  15506. break;
  15507. case 12:
  15508. genNode(node.codegenNode, context);
  15509. break;
  15510. case 8:
  15511. genCompoundExpression(node, context);
  15512. break;
  15513. case 3:
  15514. genComment(node, context);
  15515. break;
  15516. case 13:
  15517. genVNodeCall(node, context);
  15518. break;
  15519. case 14:
  15520. genCallExpression(node, context);
  15521. break;
  15522. case 15:
  15523. genObjectExpression(node, context);
  15524. break;
  15525. case 17:
  15526. genArrayExpression(node, context);
  15527. break;
  15528. case 18:
  15529. genFunctionExpression(node, context);
  15530. break;
  15531. case 19:
  15532. genConditionalExpression(node, context);
  15533. break;
  15534. case 20:
  15535. genCacheExpression(node, context);
  15536. break;
  15537. case 21:
  15538. genNodeList(node.body, context, true, false);
  15539. break;
  15540. // SSR only types
  15541. case 22:
  15542. break;
  15543. case 23:
  15544. break;
  15545. case 24:
  15546. break;
  15547. case 25:
  15548. break;
  15549. case 26:
  15550. break;
  15551. /* v8 ignore start */
  15552. case 10:
  15553. break;
  15554. default:
  15555. {
  15556. assert(false, `unhandled codegen node type: ${node.type}`);
  15557. const exhaustiveCheck = node;
  15558. return exhaustiveCheck;
  15559. }
  15560. }
  15561. }
  15562. function genText(node, context) {
  15563. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  15564. }
  15565. function genExpression(node, context) {
  15566. const { content, isStatic } = node;
  15567. context.push(
  15568. isStatic ? JSON.stringify(content) : content,
  15569. -3 /* Unknown */,
  15570. node
  15571. );
  15572. }
  15573. function genInterpolation(node, context) {
  15574. const { push, helper, pure } = context;
  15575. if (pure) push(PURE_ANNOTATION);
  15576. push(`${helper(TO_DISPLAY_STRING)}(`);
  15577. genNode(node.content, context);
  15578. push(`)`);
  15579. }
  15580. function genCompoundExpression(node, context) {
  15581. for (let i = 0; i < node.children.length; i++) {
  15582. const child = node.children[i];
  15583. if (isString(child)) {
  15584. context.push(child, -3 /* Unknown */);
  15585. } else {
  15586. genNode(child, context);
  15587. }
  15588. }
  15589. }
  15590. function genExpressionAsPropertyKey(node, context) {
  15591. const { push } = context;
  15592. if (node.type === 8) {
  15593. push(`[`);
  15594. genCompoundExpression(node, context);
  15595. push(`]`);
  15596. } else if (node.isStatic) {
  15597. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  15598. push(text, -2 /* None */, node);
  15599. } else {
  15600. push(`[${node.content}]`, -3 /* Unknown */, node);
  15601. }
  15602. }
  15603. function genComment(node, context) {
  15604. const { push, helper, pure } = context;
  15605. if (pure) {
  15606. push(PURE_ANNOTATION);
  15607. }
  15608. push(
  15609. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  15610. -3 /* Unknown */,
  15611. node
  15612. );
  15613. }
  15614. function genVNodeCall(node, context) {
  15615. const { push, helper, pure } = context;
  15616. const {
  15617. tag,
  15618. props,
  15619. children,
  15620. patchFlag,
  15621. dynamicProps,
  15622. directives,
  15623. isBlock,
  15624. disableTracking,
  15625. isComponent
  15626. } = node;
  15627. let patchFlagString;
  15628. if (patchFlag) {
  15629. {
  15630. if (patchFlag < 0) {
  15631. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15632. } else {
  15633. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15634. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  15635. }
  15636. }
  15637. }
  15638. if (directives) {
  15639. push(helper(WITH_DIRECTIVES) + `(`);
  15640. }
  15641. if (isBlock) {
  15642. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  15643. }
  15644. if (pure) {
  15645. push(PURE_ANNOTATION);
  15646. }
  15647. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  15648. push(helper(callHelper) + `(`, -2 /* None */, node);
  15649. genNodeList(
  15650. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  15651. context
  15652. );
  15653. push(`)`);
  15654. if (isBlock) {
  15655. push(`)`);
  15656. }
  15657. if (directives) {
  15658. push(`, `);
  15659. genNode(directives, context);
  15660. push(`)`);
  15661. }
  15662. }
  15663. function genNullableArgs(args) {
  15664. let i = args.length;
  15665. while (i--) {
  15666. if (args[i] != null) break;
  15667. }
  15668. return args.slice(0, i + 1).map((arg) => arg || `null`);
  15669. }
  15670. function genCallExpression(node, context) {
  15671. const { push, helper, pure } = context;
  15672. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  15673. if (pure) {
  15674. push(PURE_ANNOTATION);
  15675. }
  15676. push(callee + `(`, -2 /* None */, node);
  15677. genNodeList(node.arguments, context);
  15678. push(`)`);
  15679. }
  15680. function genObjectExpression(node, context) {
  15681. const { push, indent, deindent, newline } = context;
  15682. const { properties } = node;
  15683. if (!properties.length) {
  15684. push(`{}`, -2 /* None */, node);
  15685. return;
  15686. }
  15687. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  15688. push(multilines ? `{` : `{ `);
  15689. multilines && indent();
  15690. for (let i = 0; i < properties.length; i++) {
  15691. const { key, value } = properties[i];
  15692. genExpressionAsPropertyKey(key, context);
  15693. push(`: `);
  15694. genNode(value, context);
  15695. if (i < properties.length - 1) {
  15696. push(`,`);
  15697. newline();
  15698. }
  15699. }
  15700. multilines && deindent();
  15701. push(multilines ? `}` : ` }`);
  15702. }
  15703. function genArrayExpression(node, context) {
  15704. genNodeListAsArray(node.elements, context);
  15705. }
  15706. function genFunctionExpression(node, context) {
  15707. const { push, indent, deindent } = context;
  15708. const { params, returns, body, newline, isSlot } = node;
  15709. if (isSlot) {
  15710. push(`_${helperNameMap[WITH_CTX]}(`);
  15711. }
  15712. push(`(`, -2 /* None */, node);
  15713. if (isArray(params)) {
  15714. genNodeList(params, context);
  15715. } else if (params) {
  15716. genNode(params, context);
  15717. }
  15718. push(`) => `);
  15719. if (newline || body) {
  15720. push(`{`);
  15721. indent();
  15722. }
  15723. if (returns) {
  15724. if (newline) {
  15725. push(`return `);
  15726. }
  15727. if (isArray(returns)) {
  15728. genNodeListAsArray(returns, context);
  15729. } else {
  15730. genNode(returns, context);
  15731. }
  15732. } else if (body) {
  15733. genNode(body, context);
  15734. }
  15735. if (newline || body) {
  15736. deindent();
  15737. push(`}`);
  15738. }
  15739. if (isSlot) {
  15740. push(`)`);
  15741. }
  15742. }
  15743. function genConditionalExpression(node, context) {
  15744. const { test, consequent, alternate, newline: needNewline } = node;
  15745. const { push, indent, deindent, newline } = context;
  15746. if (test.type === 4) {
  15747. const needsParens = !isSimpleIdentifier(test.content);
  15748. needsParens && push(`(`);
  15749. genExpression(test, context);
  15750. needsParens && push(`)`);
  15751. } else {
  15752. push(`(`);
  15753. genNode(test, context);
  15754. push(`)`);
  15755. }
  15756. needNewline && indent();
  15757. context.indentLevel++;
  15758. needNewline || push(` `);
  15759. push(`? `);
  15760. genNode(consequent, context);
  15761. context.indentLevel--;
  15762. needNewline && newline();
  15763. needNewline || push(` `);
  15764. push(`: `);
  15765. const isNested = alternate.type === 19;
  15766. if (!isNested) {
  15767. context.indentLevel++;
  15768. }
  15769. genNode(alternate, context);
  15770. if (!isNested) {
  15771. context.indentLevel--;
  15772. }
  15773. needNewline && deindent(
  15774. true
  15775. /* without newline */
  15776. );
  15777. }
  15778. function genCacheExpression(node, context) {
  15779. const { push, helper, indent, deindent, newline } = context;
  15780. const { needPauseTracking, needArraySpread } = node;
  15781. if (needArraySpread) {
  15782. push(`[...(`);
  15783. }
  15784. push(`_cache[${node.index}] || (`);
  15785. if (needPauseTracking) {
  15786. indent();
  15787. push(`${helper(SET_BLOCK_TRACKING)}(-1`);
  15788. if (node.inVOnce) push(`, true`);
  15789. push(`),`);
  15790. newline();
  15791. push(`(`);
  15792. }
  15793. push(`_cache[${node.index}] = `);
  15794. genNode(node.value, context);
  15795. if (needPauseTracking) {
  15796. push(`).cacheIndex = ${node.index},`);
  15797. newline();
  15798. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  15799. newline();
  15800. push(`_cache[${node.index}]`);
  15801. deindent();
  15802. }
  15803. push(`)`);
  15804. if (needArraySpread) {
  15805. push(`)]`);
  15806. }
  15807. }
  15808. const prohibitedKeywordRE = new RegExp(
  15809. "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
  15810. );
  15811. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  15812. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  15813. const exp = node.content;
  15814. if (!exp.trim()) {
  15815. return;
  15816. }
  15817. try {
  15818. new Function(
  15819. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  15820. );
  15821. } catch (e) {
  15822. let message = e.message;
  15823. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  15824. if (keywordMatch) {
  15825. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  15826. }
  15827. context.onError(
  15828. createCompilerError(
  15829. 45,
  15830. node.loc,
  15831. void 0,
  15832. message
  15833. )
  15834. );
  15835. }
  15836. }
  15837. const transformExpression = (node, context) => {
  15838. if (node.type === 5) {
  15839. node.content = processExpression(
  15840. node.content,
  15841. context
  15842. );
  15843. } else if (node.type === 1) {
  15844. const memo = findDir(node, "memo");
  15845. for (let i = 0; i < node.props.length; i++) {
  15846. const dir = node.props[i];
  15847. if (dir.type === 7 && dir.name !== "for") {
  15848. const exp = dir.exp;
  15849. const arg = dir.arg;
  15850. if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
  15851. !(memo && arg && arg.type === 4 && arg.content === "key")) {
  15852. dir.exp = processExpression(
  15853. exp,
  15854. context,
  15855. // slot args must be processed as function params
  15856. dir.name === "slot"
  15857. );
  15858. }
  15859. if (arg && arg.type === 4 && !arg.isStatic) {
  15860. dir.arg = processExpression(arg, context);
  15861. }
  15862. }
  15863. }
  15864. }
  15865. };
  15866. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  15867. {
  15868. {
  15869. validateBrowserExpression(node, context, asParams, asRawStatements);
  15870. }
  15871. return node;
  15872. }
  15873. }
  15874. const transformIf = createStructuralDirectiveTransform(
  15875. /^(if|else|else-if)$/,
  15876. (node, dir, context) => {
  15877. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  15878. const siblings = context.parent.children;
  15879. let i = siblings.indexOf(ifNode);
  15880. let key = 0;
  15881. while (i-- >= 0) {
  15882. const sibling = siblings[i];
  15883. if (sibling && sibling.type === 9) {
  15884. key += sibling.branches.length;
  15885. }
  15886. }
  15887. return () => {
  15888. if (isRoot) {
  15889. ifNode.codegenNode = createCodegenNodeForBranch(
  15890. branch,
  15891. key,
  15892. context
  15893. );
  15894. } else {
  15895. const parentCondition = getParentCondition(ifNode.codegenNode);
  15896. parentCondition.alternate = createCodegenNodeForBranch(
  15897. branch,
  15898. key + ifNode.branches.length - 1,
  15899. context
  15900. );
  15901. }
  15902. };
  15903. });
  15904. }
  15905. );
  15906. function processIf(node, dir, context, processCodegen) {
  15907. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  15908. const loc = dir.exp ? dir.exp.loc : node.loc;
  15909. context.onError(
  15910. createCompilerError(28, dir.loc)
  15911. );
  15912. dir.exp = createSimpleExpression(`true`, false, loc);
  15913. }
  15914. if (dir.exp) {
  15915. validateBrowserExpression(dir.exp, context);
  15916. }
  15917. if (dir.name === "if") {
  15918. const branch = createIfBranch(node, dir);
  15919. const ifNode = {
  15920. type: 9,
  15921. loc: cloneLoc(node.loc),
  15922. branches: [branch]
  15923. };
  15924. context.replaceNode(ifNode);
  15925. if (processCodegen) {
  15926. return processCodegen(ifNode, branch, true);
  15927. }
  15928. } else {
  15929. const siblings = context.parent.children;
  15930. const comments = [];
  15931. let i = siblings.indexOf(node);
  15932. while (i-- >= -1) {
  15933. const sibling = siblings[i];
  15934. if (sibling && sibling.type === 3) {
  15935. context.removeNode(sibling);
  15936. comments.unshift(sibling);
  15937. continue;
  15938. }
  15939. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  15940. context.removeNode(sibling);
  15941. continue;
  15942. }
  15943. if (sibling && sibling.type === 9) {
  15944. if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  15945. context.onError(
  15946. createCompilerError(30, node.loc)
  15947. );
  15948. }
  15949. context.removeNode();
  15950. const branch = createIfBranch(node, dir);
  15951. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  15952. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  15953. branch.children = [...comments, ...branch.children];
  15954. }
  15955. {
  15956. const key = branch.userKey;
  15957. if (key) {
  15958. sibling.branches.forEach(({ userKey }) => {
  15959. if (isSameKey(userKey, key)) {
  15960. context.onError(
  15961. createCompilerError(
  15962. 29,
  15963. branch.userKey.loc
  15964. )
  15965. );
  15966. }
  15967. });
  15968. }
  15969. }
  15970. sibling.branches.push(branch);
  15971. const onExit = processCodegen && processCodegen(sibling, branch, false);
  15972. traverseNode(branch, context);
  15973. if (onExit) onExit();
  15974. context.currentNode = null;
  15975. } else {
  15976. context.onError(
  15977. createCompilerError(30, node.loc)
  15978. );
  15979. }
  15980. break;
  15981. }
  15982. }
  15983. }
  15984. function createIfBranch(node, dir) {
  15985. const isTemplateIf = node.tagType === 3;
  15986. return {
  15987. type: 10,
  15988. loc: node.loc,
  15989. condition: dir.name === "else" ? void 0 : dir.exp,
  15990. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  15991. userKey: findProp(node, `key`),
  15992. isTemplateIf
  15993. };
  15994. }
  15995. function createCodegenNodeForBranch(branch, keyIndex, context) {
  15996. if (branch.condition) {
  15997. return createConditionalExpression(
  15998. branch.condition,
  15999. createChildrenCodegenNode(branch, keyIndex, context),
  16000. // make sure to pass in asBlock: true so that the comment node call
  16001. // closes the current block.
  16002. createCallExpression(context.helper(CREATE_COMMENT), [
  16003. '"v-if"' ,
  16004. "true"
  16005. ])
  16006. );
  16007. } else {
  16008. return createChildrenCodegenNode(branch, keyIndex, context);
  16009. }
  16010. }
  16011. function createChildrenCodegenNode(branch, keyIndex, context) {
  16012. const { helper } = context;
  16013. const keyProperty = createObjectProperty(
  16014. `key`,
  16015. createSimpleExpression(
  16016. `${keyIndex}`,
  16017. false,
  16018. locStub,
  16019. 2
  16020. )
  16021. );
  16022. const { children } = branch;
  16023. const firstChild = children[0];
  16024. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  16025. if (needFragmentWrapper) {
  16026. if (children.length === 1 && firstChild.type === 11) {
  16027. const vnodeCall = firstChild.codegenNode;
  16028. injectProp(vnodeCall, keyProperty, context);
  16029. return vnodeCall;
  16030. } else {
  16031. let patchFlag = 64;
  16032. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  16033. patchFlag |= 2048;
  16034. }
  16035. return createVNodeCall(
  16036. context,
  16037. helper(FRAGMENT),
  16038. createObjectExpression([keyProperty]),
  16039. children,
  16040. patchFlag,
  16041. void 0,
  16042. void 0,
  16043. true,
  16044. false,
  16045. false,
  16046. branch.loc
  16047. );
  16048. }
  16049. } else {
  16050. const ret = firstChild.codegenNode;
  16051. const vnodeCall = getMemoedVNodeCall(ret);
  16052. if (vnodeCall.type === 13) {
  16053. convertToBlock(vnodeCall, context);
  16054. }
  16055. injectProp(vnodeCall, keyProperty, context);
  16056. return ret;
  16057. }
  16058. }
  16059. function isSameKey(a, b) {
  16060. if (!a || a.type !== b.type) {
  16061. return false;
  16062. }
  16063. if (a.type === 6) {
  16064. if (a.value.content !== b.value.content) {
  16065. return false;
  16066. }
  16067. } else {
  16068. const exp = a.exp;
  16069. const branchExp = b.exp;
  16070. if (exp.type !== branchExp.type) {
  16071. return false;
  16072. }
  16073. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  16074. return false;
  16075. }
  16076. }
  16077. return true;
  16078. }
  16079. function getParentCondition(node) {
  16080. while (true) {
  16081. if (node.type === 19) {
  16082. if (node.alternate.type === 19) {
  16083. node = node.alternate;
  16084. } else {
  16085. return node;
  16086. }
  16087. } else if (node.type === 20) {
  16088. node = node.value;
  16089. }
  16090. }
  16091. }
  16092. const transformBind = (dir, _node, context) => {
  16093. const { modifiers, loc } = dir;
  16094. const arg = dir.arg;
  16095. let { exp } = dir;
  16096. if (exp && exp.type === 4 && !exp.content.trim()) {
  16097. {
  16098. exp = void 0;
  16099. }
  16100. }
  16101. if (!exp) {
  16102. if (arg.type !== 4 || !arg.isStatic) {
  16103. context.onError(
  16104. createCompilerError(
  16105. 52,
  16106. arg.loc
  16107. )
  16108. );
  16109. return {
  16110. props: [
  16111. createObjectProperty(arg, createSimpleExpression("", true, loc))
  16112. ]
  16113. };
  16114. }
  16115. transformBindShorthand(dir);
  16116. exp = dir.exp;
  16117. }
  16118. if (arg.type !== 4) {
  16119. arg.children.unshift(`(`);
  16120. arg.children.push(`) || ""`);
  16121. } else if (!arg.isStatic) {
  16122. arg.content = arg.content ? `${arg.content} || ""` : `""`;
  16123. }
  16124. if (modifiers.some((mod) => mod.content === "camel")) {
  16125. if (arg.type === 4) {
  16126. if (arg.isStatic) {
  16127. arg.content = camelize(arg.content);
  16128. } else {
  16129. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  16130. }
  16131. } else {
  16132. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  16133. arg.children.push(`)`);
  16134. }
  16135. }
  16136. if (!context.inSSR) {
  16137. if (modifiers.some((mod) => mod.content === "prop")) {
  16138. injectPrefix(arg, ".");
  16139. }
  16140. if (modifiers.some((mod) => mod.content === "attr")) {
  16141. injectPrefix(arg, "^");
  16142. }
  16143. }
  16144. return {
  16145. props: [createObjectProperty(arg, exp)]
  16146. };
  16147. };
  16148. const transformBindShorthand = (dir, context) => {
  16149. const arg = dir.arg;
  16150. const propName = camelize(arg.content);
  16151. dir.exp = createSimpleExpression(propName, false, arg.loc);
  16152. };
  16153. const injectPrefix = (arg, prefix) => {
  16154. if (arg.type === 4) {
  16155. if (arg.isStatic) {
  16156. arg.content = prefix + arg.content;
  16157. } else {
  16158. arg.content = `\`${prefix}\${${arg.content}}\``;
  16159. }
  16160. } else {
  16161. arg.children.unshift(`'${prefix}' + (`);
  16162. arg.children.push(`)`);
  16163. }
  16164. };
  16165. const transformFor = createStructuralDirectiveTransform(
  16166. "for",
  16167. (node, dir, context) => {
  16168. const { helper, removeHelper } = context;
  16169. return processFor(node, dir, context, (forNode) => {
  16170. const renderExp = createCallExpression(helper(RENDER_LIST), [
  16171. forNode.source
  16172. ]);
  16173. const isTemplate = isTemplateNode(node);
  16174. const memo = findDir(node, "memo");
  16175. const keyProp = findProp(node, `key`, false, true);
  16176. const isDirKey = keyProp && keyProp.type === 7;
  16177. if (isDirKey && !keyProp.exp) {
  16178. transformBindShorthand(keyProp);
  16179. }
  16180. let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  16181. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  16182. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  16183. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  16184. forNode.codegenNode = createVNodeCall(
  16185. context,
  16186. helper(FRAGMENT),
  16187. void 0,
  16188. renderExp,
  16189. fragmentFlag,
  16190. void 0,
  16191. void 0,
  16192. true,
  16193. !isStableFragment,
  16194. false,
  16195. node.loc
  16196. );
  16197. return () => {
  16198. let childBlock;
  16199. const { children } = forNode;
  16200. if (isTemplate) {
  16201. node.children.some((c) => {
  16202. if (c.type === 1) {
  16203. const key = findProp(c, "key");
  16204. if (key) {
  16205. context.onError(
  16206. createCompilerError(
  16207. 33,
  16208. key.loc
  16209. )
  16210. );
  16211. return true;
  16212. }
  16213. }
  16214. });
  16215. }
  16216. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  16217. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  16218. if (slotOutlet) {
  16219. childBlock = slotOutlet.codegenNode;
  16220. if (isTemplate && keyProperty) {
  16221. injectProp(childBlock, keyProperty, context);
  16222. }
  16223. } else if (needFragmentWrapper) {
  16224. childBlock = createVNodeCall(
  16225. context,
  16226. helper(FRAGMENT),
  16227. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  16228. node.children,
  16229. 64,
  16230. void 0,
  16231. void 0,
  16232. true,
  16233. void 0,
  16234. false
  16235. );
  16236. } else {
  16237. childBlock = children[0].codegenNode;
  16238. if (isTemplate && keyProperty) {
  16239. injectProp(childBlock, keyProperty, context);
  16240. }
  16241. if (childBlock.isBlock !== !isStableFragment) {
  16242. if (childBlock.isBlock) {
  16243. removeHelper(OPEN_BLOCK);
  16244. removeHelper(
  16245. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  16246. );
  16247. } else {
  16248. removeHelper(
  16249. getVNodeHelper(context.inSSR, childBlock.isComponent)
  16250. );
  16251. }
  16252. }
  16253. childBlock.isBlock = !isStableFragment;
  16254. if (childBlock.isBlock) {
  16255. helper(OPEN_BLOCK);
  16256. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  16257. } else {
  16258. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  16259. }
  16260. }
  16261. if (memo) {
  16262. const loop = createFunctionExpression(
  16263. createForLoopParams(forNode.parseResult, [
  16264. createSimpleExpression(`_cached`)
  16265. ])
  16266. );
  16267. loop.body = createBlockStatement([
  16268. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  16269. createCompoundExpression([
  16270. `if (_cached`,
  16271. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  16272. ` && ${context.helperString(
  16273. IS_MEMO_SAME
  16274. )}(_cached, _memo)) return _cached`
  16275. ]),
  16276. createCompoundExpression([`const _item = `, childBlock]),
  16277. createSimpleExpression(`_item.memo = _memo`),
  16278. createSimpleExpression(`return _item`)
  16279. ]);
  16280. renderExp.arguments.push(
  16281. loop,
  16282. createSimpleExpression(`_cache`),
  16283. createSimpleExpression(String(context.cached.length))
  16284. );
  16285. context.cached.push(null);
  16286. } else {
  16287. renderExp.arguments.push(
  16288. createFunctionExpression(
  16289. createForLoopParams(forNode.parseResult),
  16290. childBlock,
  16291. true
  16292. )
  16293. );
  16294. }
  16295. };
  16296. });
  16297. }
  16298. );
  16299. function processFor(node, dir, context, processCodegen) {
  16300. if (!dir.exp) {
  16301. context.onError(
  16302. createCompilerError(31, dir.loc)
  16303. );
  16304. return;
  16305. }
  16306. const parseResult = dir.forParseResult;
  16307. if (!parseResult) {
  16308. context.onError(
  16309. createCompilerError(32, dir.loc)
  16310. );
  16311. return;
  16312. }
  16313. finalizeForParseResult(parseResult, context);
  16314. const { addIdentifiers, removeIdentifiers, scopes } = context;
  16315. const { source, value, key, index } = parseResult;
  16316. const forNode = {
  16317. type: 11,
  16318. loc: dir.loc,
  16319. source,
  16320. valueAlias: value,
  16321. keyAlias: key,
  16322. objectIndexAlias: index,
  16323. parseResult,
  16324. children: isTemplateNode(node) ? node.children : [node]
  16325. };
  16326. context.replaceNode(forNode);
  16327. scopes.vFor++;
  16328. const onExit = processCodegen && processCodegen(forNode);
  16329. return () => {
  16330. scopes.vFor--;
  16331. if (onExit) onExit();
  16332. };
  16333. }
  16334. function finalizeForParseResult(result, context) {
  16335. if (result.finalized) return;
  16336. {
  16337. validateBrowserExpression(result.source, context);
  16338. if (result.key) {
  16339. validateBrowserExpression(
  16340. result.key,
  16341. context,
  16342. true
  16343. );
  16344. }
  16345. if (result.index) {
  16346. validateBrowserExpression(
  16347. result.index,
  16348. context,
  16349. true
  16350. );
  16351. }
  16352. if (result.value) {
  16353. validateBrowserExpression(
  16354. result.value,
  16355. context,
  16356. true
  16357. );
  16358. }
  16359. }
  16360. result.finalized = true;
  16361. }
  16362. function createForLoopParams({ value, key, index }, memoArgs = []) {
  16363. return createParamsList([value, key, index, ...memoArgs]);
  16364. }
  16365. function createParamsList(args) {
  16366. let i = args.length;
  16367. while (i--) {
  16368. if (args[i]) break;
  16369. }
  16370. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  16371. }
  16372. const defaultFallback = createSimpleExpression(`undefined`, false);
  16373. const trackSlotScopes = (node, context) => {
  16374. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  16375. const vSlot = findDir(node, "slot");
  16376. if (vSlot) {
  16377. vSlot.exp;
  16378. context.scopes.vSlot++;
  16379. return () => {
  16380. context.scopes.vSlot--;
  16381. };
  16382. }
  16383. }
  16384. };
  16385. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  16386. props,
  16387. children,
  16388. false,
  16389. true,
  16390. children.length ? children[0].loc : loc
  16391. );
  16392. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  16393. context.helper(WITH_CTX);
  16394. const { children, loc } = node;
  16395. const slotsProperties = [];
  16396. const dynamicSlots = [];
  16397. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  16398. const onComponentSlot = findDir(node, "slot", true);
  16399. if (onComponentSlot) {
  16400. const { arg, exp } = onComponentSlot;
  16401. if (arg && !isStaticExp(arg)) {
  16402. hasDynamicSlots = true;
  16403. }
  16404. slotsProperties.push(
  16405. createObjectProperty(
  16406. arg || createSimpleExpression("default", true),
  16407. buildSlotFn(exp, void 0, children, loc)
  16408. )
  16409. );
  16410. }
  16411. let hasTemplateSlots = false;
  16412. let hasNamedDefaultSlot = false;
  16413. const implicitDefaultChildren = [];
  16414. const seenSlotNames = /* @__PURE__ */ new Set();
  16415. let conditionalBranchIndex = 0;
  16416. for (let i = 0; i < children.length; i++) {
  16417. const slotElement = children[i];
  16418. let slotDir;
  16419. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  16420. if (slotElement.type !== 3) {
  16421. implicitDefaultChildren.push(slotElement);
  16422. }
  16423. continue;
  16424. }
  16425. if (onComponentSlot) {
  16426. context.onError(
  16427. createCompilerError(37, slotDir.loc)
  16428. );
  16429. break;
  16430. }
  16431. hasTemplateSlots = true;
  16432. const { children: slotChildren, loc: slotLoc } = slotElement;
  16433. const {
  16434. arg: slotName = createSimpleExpression(`default`, true),
  16435. exp: slotProps,
  16436. loc: dirLoc
  16437. } = slotDir;
  16438. let staticSlotName;
  16439. if (isStaticExp(slotName)) {
  16440. staticSlotName = slotName ? slotName.content : `default`;
  16441. } else {
  16442. hasDynamicSlots = true;
  16443. }
  16444. const vFor = findDir(slotElement, "for");
  16445. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  16446. let vIf;
  16447. let vElse;
  16448. if (vIf = findDir(slotElement, "if")) {
  16449. hasDynamicSlots = true;
  16450. dynamicSlots.push(
  16451. createConditionalExpression(
  16452. vIf.exp,
  16453. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  16454. defaultFallback
  16455. )
  16456. );
  16457. } else if (vElse = findDir(
  16458. slotElement,
  16459. /^else(-if)?$/,
  16460. true
  16461. /* allowEmpty */
  16462. )) {
  16463. let j = i;
  16464. let prev;
  16465. while (j--) {
  16466. prev = children[j];
  16467. if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
  16468. break;
  16469. }
  16470. }
  16471. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  16472. let conditional = dynamicSlots[dynamicSlots.length - 1];
  16473. while (conditional.alternate.type === 19) {
  16474. conditional = conditional.alternate;
  16475. }
  16476. conditional.alternate = vElse.exp ? createConditionalExpression(
  16477. vElse.exp,
  16478. buildDynamicSlot(
  16479. slotName,
  16480. slotFunction,
  16481. conditionalBranchIndex++
  16482. ),
  16483. defaultFallback
  16484. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  16485. } else {
  16486. context.onError(
  16487. createCompilerError(30, vElse.loc)
  16488. );
  16489. }
  16490. } else if (vFor) {
  16491. hasDynamicSlots = true;
  16492. const parseResult = vFor.forParseResult;
  16493. if (parseResult) {
  16494. finalizeForParseResult(parseResult, context);
  16495. dynamicSlots.push(
  16496. createCallExpression(context.helper(RENDER_LIST), [
  16497. parseResult.source,
  16498. createFunctionExpression(
  16499. createForLoopParams(parseResult),
  16500. buildDynamicSlot(slotName, slotFunction),
  16501. true
  16502. )
  16503. ])
  16504. );
  16505. } else {
  16506. context.onError(
  16507. createCompilerError(
  16508. 32,
  16509. vFor.loc
  16510. )
  16511. );
  16512. }
  16513. } else {
  16514. if (staticSlotName) {
  16515. if (seenSlotNames.has(staticSlotName)) {
  16516. context.onError(
  16517. createCompilerError(
  16518. 38,
  16519. dirLoc
  16520. )
  16521. );
  16522. continue;
  16523. }
  16524. seenSlotNames.add(staticSlotName);
  16525. if (staticSlotName === "default") {
  16526. hasNamedDefaultSlot = true;
  16527. }
  16528. }
  16529. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  16530. }
  16531. }
  16532. if (!onComponentSlot) {
  16533. const buildDefaultSlotProperty = (props, children2) => {
  16534. const fn = buildSlotFn(props, void 0, children2, loc);
  16535. return createObjectProperty(`default`, fn);
  16536. };
  16537. if (!hasTemplateSlots) {
  16538. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  16539. } else if (implicitDefaultChildren.length && // #3766
  16540. // with whitespace: 'preserve', whitespaces between slots will end up in
  16541. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  16542. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  16543. if (hasNamedDefaultSlot) {
  16544. context.onError(
  16545. createCompilerError(
  16546. 39,
  16547. implicitDefaultChildren[0].loc
  16548. )
  16549. );
  16550. } else {
  16551. slotsProperties.push(
  16552. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  16553. );
  16554. }
  16555. }
  16556. }
  16557. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  16558. let slots = createObjectExpression(
  16559. slotsProperties.concat(
  16560. createObjectProperty(
  16561. `_`,
  16562. // 2 = compiled but dynamic = can skip normalization, but must run diff
  16563. // 1 = compiled and static = can skip normalization AND diff as optimized
  16564. createSimpleExpression(
  16565. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  16566. false
  16567. )
  16568. )
  16569. ),
  16570. loc
  16571. );
  16572. if (dynamicSlots.length) {
  16573. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  16574. slots,
  16575. createArrayExpression(dynamicSlots)
  16576. ]);
  16577. }
  16578. return {
  16579. slots,
  16580. hasDynamicSlots
  16581. };
  16582. }
  16583. function buildDynamicSlot(name, fn, index) {
  16584. const props = [
  16585. createObjectProperty(`name`, name),
  16586. createObjectProperty(`fn`, fn)
  16587. ];
  16588. if (index != null) {
  16589. props.push(
  16590. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  16591. );
  16592. }
  16593. return createObjectExpression(props);
  16594. }
  16595. function hasForwardedSlots(children) {
  16596. for (let i = 0; i < children.length; i++) {
  16597. const child = children[i];
  16598. switch (child.type) {
  16599. case 1:
  16600. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  16601. return true;
  16602. }
  16603. break;
  16604. case 9:
  16605. if (hasForwardedSlots(child.branches)) return true;
  16606. break;
  16607. case 10:
  16608. case 11:
  16609. if (hasForwardedSlots(child.children)) return true;
  16610. break;
  16611. }
  16612. }
  16613. return false;
  16614. }
  16615. function isNonWhitespaceContent(node) {
  16616. if (node.type !== 2 && node.type !== 12)
  16617. return true;
  16618. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  16619. }
  16620. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  16621. const transformElement = (node, context) => {
  16622. return function postTransformElement() {
  16623. node = context.currentNode;
  16624. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  16625. return;
  16626. }
  16627. const { tag, props } = node;
  16628. const isComponent = node.tagType === 1;
  16629. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  16630. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  16631. let vnodeProps;
  16632. let vnodeChildren;
  16633. let patchFlag = 0;
  16634. let vnodeDynamicProps;
  16635. let dynamicPropNames;
  16636. let vnodeDirectives;
  16637. let shouldUseBlock = (
  16638. // dynamic component may resolve to plain elements
  16639. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  16640. // updates inside get proper isSVG flag at runtime. (#639, #643)
  16641. // This is technically web-specific, but splitting the logic out of core
  16642. // leads to too much unnecessary complexity.
  16643. (tag === "svg" || tag === "foreignObject" || tag === "math")
  16644. );
  16645. if (props.length > 0) {
  16646. const propsBuildResult = buildProps(
  16647. node,
  16648. context,
  16649. void 0,
  16650. isComponent,
  16651. isDynamicComponent
  16652. );
  16653. vnodeProps = propsBuildResult.props;
  16654. patchFlag = propsBuildResult.patchFlag;
  16655. dynamicPropNames = propsBuildResult.dynamicPropNames;
  16656. const directives = propsBuildResult.directives;
  16657. vnodeDirectives = directives && directives.length ? createArrayExpression(
  16658. directives.map((dir) => buildDirectiveArgs(dir, context))
  16659. ) : void 0;
  16660. if (propsBuildResult.shouldUseBlock) {
  16661. shouldUseBlock = true;
  16662. }
  16663. }
  16664. if (node.children.length > 0) {
  16665. if (vnodeTag === KEEP_ALIVE) {
  16666. shouldUseBlock = true;
  16667. patchFlag |= 1024;
  16668. if (node.children.length > 1) {
  16669. context.onError(
  16670. createCompilerError(46, {
  16671. start: node.children[0].loc.start,
  16672. end: node.children[node.children.length - 1].loc.end,
  16673. source: ""
  16674. })
  16675. );
  16676. }
  16677. }
  16678. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  16679. vnodeTag !== TELEPORT && // explained above.
  16680. vnodeTag !== KEEP_ALIVE;
  16681. if (shouldBuildAsSlots) {
  16682. const { slots, hasDynamicSlots } = buildSlots(node, context);
  16683. vnodeChildren = slots;
  16684. if (hasDynamicSlots) {
  16685. patchFlag |= 1024;
  16686. }
  16687. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  16688. const child = node.children[0];
  16689. const type = child.type;
  16690. const hasDynamicTextChild = type === 5 || type === 8;
  16691. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  16692. patchFlag |= 1;
  16693. }
  16694. if (hasDynamicTextChild || type === 2) {
  16695. vnodeChildren = child;
  16696. } else {
  16697. vnodeChildren = node.children;
  16698. }
  16699. } else {
  16700. vnodeChildren = node.children;
  16701. }
  16702. }
  16703. if (dynamicPropNames && dynamicPropNames.length) {
  16704. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  16705. }
  16706. node.codegenNode = createVNodeCall(
  16707. context,
  16708. vnodeTag,
  16709. vnodeProps,
  16710. vnodeChildren,
  16711. patchFlag === 0 ? void 0 : patchFlag,
  16712. vnodeDynamicProps,
  16713. vnodeDirectives,
  16714. !!shouldUseBlock,
  16715. false,
  16716. isComponent,
  16717. node.loc
  16718. );
  16719. };
  16720. };
  16721. function resolveComponentType(node, context, ssr = false) {
  16722. let { tag } = node;
  16723. const isExplicitDynamic = isComponentTag(tag);
  16724. const isProp = findProp(
  16725. node,
  16726. "is",
  16727. false,
  16728. true
  16729. /* allow empty */
  16730. );
  16731. if (isProp) {
  16732. if (isExplicitDynamic || false) {
  16733. let exp;
  16734. if (isProp.type === 6) {
  16735. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  16736. } else {
  16737. exp = isProp.exp;
  16738. if (!exp) {
  16739. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  16740. }
  16741. }
  16742. if (exp) {
  16743. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  16744. exp
  16745. ]);
  16746. }
  16747. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  16748. tag = isProp.value.content.slice(4);
  16749. }
  16750. }
  16751. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  16752. if (builtIn) {
  16753. if (!ssr) context.helper(builtIn);
  16754. return builtIn;
  16755. }
  16756. context.helper(RESOLVE_COMPONENT);
  16757. context.components.add(tag);
  16758. return toValidAssetId(tag, `component`);
  16759. }
  16760. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  16761. const { tag, loc: elementLoc, children } = node;
  16762. let properties = [];
  16763. const mergeArgs = [];
  16764. const runtimeDirectives = [];
  16765. const hasChildren = children.length > 0;
  16766. let shouldUseBlock = false;
  16767. let patchFlag = 0;
  16768. let hasRef = false;
  16769. let hasClassBinding = false;
  16770. let hasStyleBinding = false;
  16771. let hasHydrationEventBinding = false;
  16772. let hasDynamicKeys = false;
  16773. let hasVnodeHook = false;
  16774. const dynamicPropNames = [];
  16775. const pushMergeArg = (arg) => {
  16776. if (properties.length) {
  16777. mergeArgs.push(
  16778. createObjectExpression(dedupeProperties(properties), elementLoc)
  16779. );
  16780. properties = [];
  16781. }
  16782. if (arg) mergeArgs.push(arg);
  16783. };
  16784. const pushRefVForMarker = () => {
  16785. if (context.scopes.vFor > 0) {
  16786. properties.push(
  16787. createObjectProperty(
  16788. createSimpleExpression("ref_for", true),
  16789. createSimpleExpression("true")
  16790. )
  16791. );
  16792. }
  16793. };
  16794. const analyzePatchFlag = ({ key, value }) => {
  16795. if (isStaticExp(key)) {
  16796. const name = key.content;
  16797. const isEventHandler = isOn(name);
  16798. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  16799. // dedicated fast path.
  16800. name.toLowerCase() !== "onclick" && // omit v-model handlers
  16801. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  16802. !isReservedProp(name)) {
  16803. hasHydrationEventBinding = true;
  16804. }
  16805. if (isEventHandler && isReservedProp(name)) {
  16806. hasVnodeHook = true;
  16807. }
  16808. if (isEventHandler && value.type === 14) {
  16809. value = value.arguments[0];
  16810. }
  16811. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  16812. return;
  16813. }
  16814. if (name === "ref") {
  16815. hasRef = true;
  16816. } else if (name === "class") {
  16817. hasClassBinding = true;
  16818. } else if (name === "style") {
  16819. hasStyleBinding = true;
  16820. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  16821. dynamicPropNames.push(name);
  16822. }
  16823. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  16824. dynamicPropNames.push(name);
  16825. }
  16826. } else {
  16827. hasDynamicKeys = true;
  16828. }
  16829. };
  16830. for (let i = 0; i < props.length; i++) {
  16831. const prop = props[i];
  16832. if (prop.type === 6) {
  16833. const { loc, name, nameLoc, value } = prop;
  16834. let isStatic = true;
  16835. if (name === "ref") {
  16836. hasRef = true;
  16837. pushRefVForMarker();
  16838. }
  16839. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  16840. continue;
  16841. }
  16842. properties.push(
  16843. createObjectProperty(
  16844. createSimpleExpression(name, true, nameLoc),
  16845. createSimpleExpression(
  16846. value ? value.content : "",
  16847. isStatic,
  16848. value ? value.loc : loc
  16849. )
  16850. )
  16851. );
  16852. } else {
  16853. const { name, arg, exp, loc, modifiers } = prop;
  16854. const isVBind = name === "bind";
  16855. const isVOn = name === "on";
  16856. if (name === "slot") {
  16857. if (!isComponent) {
  16858. context.onError(
  16859. createCompilerError(40, loc)
  16860. );
  16861. }
  16862. continue;
  16863. }
  16864. if (name === "once" || name === "memo") {
  16865. continue;
  16866. }
  16867. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  16868. continue;
  16869. }
  16870. if (isVOn && ssr) {
  16871. continue;
  16872. }
  16873. if (
  16874. // #938: elements with dynamic keys should be forced into blocks
  16875. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  16876. // before children
  16877. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  16878. ) {
  16879. shouldUseBlock = true;
  16880. }
  16881. if (isVBind && isStaticArgOf(arg, "ref")) {
  16882. pushRefVForMarker();
  16883. }
  16884. if (!arg && (isVBind || isVOn)) {
  16885. hasDynamicKeys = true;
  16886. if (exp) {
  16887. if (isVBind) {
  16888. pushRefVForMarker();
  16889. pushMergeArg();
  16890. mergeArgs.push(exp);
  16891. } else {
  16892. pushMergeArg({
  16893. type: 14,
  16894. loc,
  16895. callee: context.helper(TO_HANDLERS),
  16896. arguments: isComponent ? [exp] : [exp, `true`]
  16897. });
  16898. }
  16899. } else {
  16900. context.onError(
  16901. createCompilerError(
  16902. isVBind ? 34 : 35,
  16903. loc
  16904. )
  16905. );
  16906. }
  16907. continue;
  16908. }
  16909. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  16910. patchFlag |= 32;
  16911. }
  16912. const directiveTransform = context.directiveTransforms[name];
  16913. if (directiveTransform) {
  16914. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  16915. !ssr && props2.forEach(analyzePatchFlag);
  16916. if (isVOn && arg && !isStaticExp(arg)) {
  16917. pushMergeArg(createObjectExpression(props2, elementLoc));
  16918. } else {
  16919. properties.push(...props2);
  16920. }
  16921. if (needRuntime) {
  16922. runtimeDirectives.push(prop);
  16923. if (isSymbol(needRuntime)) {
  16924. directiveImportMap.set(prop, needRuntime);
  16925. }
  16926. }
  16927. } else if (!isBuiltInDirective(name)) {
  16928. runtimeDirectives.push(prop);
  16929. if (hasChildren) {
  16930. shouldUseBlock = true;
  16931. }
  16932. }
  16933. }
  16934. }
  16935. let propsExpression = void 0;
  16936. if (mergeArgs.length) {
  16937. pushMergeArg();
  16938. if (mergeArgs.length > 1) {
  16939. propsExpression = createCallExpression(
  16940. context.helper(MERGE_PROPS),
  16941. mergeArgs,
  16942. elementLoc
  16943. );
  16944. } else {
  16945. propsExpression = mergeArgs[0];
  16946. }
  16947. } else if (properties.length) {
  16948. propsExpression = createObjectExpression(
  16949. dedupeProperties(properties),
  16950. elementLoc
  16951. );
  16952. }
  16953. if (hasDynamicKeys) {
  16954. patchFlag |= 16;
  16955. } else {
  16956. if (hasClassBinding && !isComponent) {
  16957. patchFlag |= 2;
  16958. }
  16959. if (hasStyleBinding && !isComponent) {
  16960. patchFlag |= 4;
  16961. }
  16962. if (dynamicPropNames.length) {
  16963. patchFlag |= 8;
  16964. }
  16965. if (hasHydrationEventBinding) {
  16966. patchFlag |= 32;
  16967. }
  16968. }
  16969. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  16970. patchFlag |= 512;
  16971. }
  16972. if (!context.inSSR && propsExpression) {
  16973. switch (propsExpression.type) {
  16974. case 15:
  16975. let classKeyIndex = -1;
  16976. let styleKeyIndex = -1;
  16977. let hasDynamicKey = false;
  16978. for (let i = 0; i < propsExpression.properties.length; i++) {
  16979. const key = propsExpression.properties[i].key;
  16980. if (isStaticExp(key)) {
  16981. if (key.content === "class") {
  16982. classKeyIndex = i;
  16983. } else if (key.content === "style") {
  16984. styleKeyIndex = i;
  16985. }
  16986. } else if (!key.isHandlerKey) {
  16987. hasDynamicKey = true;
  16988. }
  16989. }
  16990. const classProp = propsExpression.properties[classKeyIndex];
  16991. const styleProp = propsExpression.properties[styleKeyIndex];
  16992. if (!hasDynamicKey) {
  16993. if (classProp && !isStaticExp(classProp.value)) {
  16994. classProp.value = createCallExpression(
  16995. context.helper(NORMALIZE_CLASS),
  16996. [classProp.value]
  16997. );
  16998. }
  16999. if (styleProp && // the static style is compiled into an object,
  17000. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  17001. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  17002. // v-bind:style with static literal object
  17003. styleProp.value.type === 17)) {
  17004. styleProp.value = createCallExpression(
  17005. context.helper(NORMALIZE_STYLE),
  17006. [styleProp.value]
  17007. );
  17008. }
  17009. } else {
  17010. propsExpression = createCallExpression(
  17011. context.helper(NORMALIZE_PROPS),
  17012. [propsExpression]
  17013. );
  17014. }
  17015. break;
  17016. case 14:
  17017. break;
  17018. default:
  17019. propsExpression = createCallExpression(
  17020. context.helper(NORMALIZE_PROPS),
  17021. [
  17022. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  17023. propsExpression
  17024. ])
  17025. ]
  17026. );
  17027. break;
  17028. }
  17029. }
  17030. return {
  17031. props: propsExpression,
  17032. directives: runtimeDirectives,
  17033. patchFlag,
  17034. dynamicPropNames,
  17035. shouldUseBlock
  17036. };
  17037. }
  17038. function dedupeProperties(properties) {
  17039. const knownProps = /* @__PURE__ */ new Map();
  17040. const deduped = [];
  17041. for (let i = 0; i < properties.length; i++) {
  17042. const prop = properties[i];
  17043. if (prop.key.type === 8 || !prop.key.isStatic) {
  17044. deduped.push(prop);
  17045. continue;
  17046. }
  17047. const name = prop.key.content;
  17048. const existing = knownProps.get(name);
  17049. if (existing) {
  17050. if (name === "style" || name === "class" || isOn(name)) {
  17051. mergeAsArray(existing, prop);
  17052. }
  17053. } else {
  17054. knownProps.set(name, prop);
  17055. deduped.push(prop);
  17056. }
  17057. }
  17058. return deduped;
  17059. }
  17060. function mergeAsArray(existing, incoming) {
  17061. if (existing.value.type === 17) {
  17062. existing.value.elements.push(incoming.value);
  17063. } else {
  17064. existing.value = createArrayExpression(
  17065. [existing.value, incoming.value],
  17066. existing.loc
  17067. );
  17068. }
  17069. }
  17070. function buildDirectiveArgs(dir, context) {
  17071. const dirArgs = [];
  17072. const runtime = directiveImportMap.get(dir);
  17073. if (runtime) {
  17074. dirArgs.push(context.helperString(runtime));
  17075. } else {
  17076. {
  17077. context.helper(RESOLVE_DIRECTIVE);
  17078. context.directives.add(dir.name);
  17079. dirArgs.push(toValidAssetId(dir.name, `directive`));
  17080. }
  17081. }
  17082. const { loc } = dir;
  17083. if (dir.exp) dirArgs.push(dir.exp);
  17084. if (dir.arg) {
  17085. if (!dir.exp) {
  17086. dirArgs.push(`void 0`);
  17087. }
  17088. dirArgs.push(dir.arg);
  17089. }
  17090. if (Object.keys(dir.modifiers).length) {
  17091. if (!dir.arg) {
  17092. if (!dir.exp) {
  17093. dirArgs.push(`void 0`);
  17094. }
  17095. dirArgs.push(`void 0`);
  17096. }
  17097. const trueExpression = createSimpleExpression(`true`, false, loc);
  17098. dirArgs.push(
  17099. createObjectExpression(
  17100. dir.modifiers.map(
  17101. (modifier) => createObjectProperty(modifier, trueExpression)
  17102. ),
  17103. loc
  17104. )
  17105. );
  17106. }
  17107. return createArrayExpression(dirArgs, dir.loc);
  17108. }
  17109. function stringifyDynamicPropNames(props) {
  17110. let propsNamesString = `[`;
  17111. for (let i = 0, l = props.length; i < l; i++) {
  17112. propsNamesString += JSON.stringify(props[i]);
  17113. if (i < l - 1) propsNamesString += ", ";
  17114. }
  17115. return propsNamesString + `]`;
  17116. }
  17117. function isComponentTag(tag) {
  17118. return tag === "component" || tag === "Component";
  17119. }
  17120. const transformSlotOutlet = (node, context) => {
  17121. if (isSlotOutlet(node)) {
  17122. const { children, loc } = node;
  17123. const { slotName, slotProps } = processSlotOutlet(node, context);
  17124. const slotArgs = [
  17125. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  17126. slotName,
  17127. "{}",
  17128. "undefined",
  17129. "true"
  17130. ];
  17131. let expectedLen = 2;
  17132. if (slotProps) {
  17133. slotArgs[2] = slotProps;
  17134. expectedLen = 3;
  17135. }
  17136. if (children.length) {
  17137. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  17138. expectedLen = 4;
  17139. }
  17140. if (context.scopeId && !context.slotted) {
  17141. expectedLen = 5;
  17142. }
  17143. slotArgs.splice(expectedLen);
  17144. node.codegenNode = createCallExpression(
  17145. context.helper(RENDER_SLOT),
  17146. slotArgs,
  17147. loc
  17148. );
  17149. }
  17150. };
  17151. function processSlotOutlet(node, context) {
  17152. let slotName = `"default"`;
  17153. let slotProps = void 0;
  17154. const nonNameProps = [];
  17155. for (let i = 0; i < node.props.length; i++) {
  17156. const p = node.props[i];
  17157. if (p.type === 6) {
  17158. if (p.value) {
  17159. if (p.name === "name") {
  17160. slotName = JSON.stringify(p.value.content);
  17161. } else {
  17162. p.name = camelize(p.name);
  17163. nonNameProps.push(p);
  17164. }
  17165. }
  17166. } else {
  17167. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  17168. if (p.exp) {
  17169. slotName = p.exp;
  17170. } else if (p.arg && p.arg.type === 4) {
  17171. const name = camelize(p.arg.content);
  17172. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  17173. }
  17174. } else {
  17175. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  17176. p.arg.content = camelize(p.arg.content);
  17177. }
  17178. nonNameProps.push(p);
  17179. }
  17180. }
  17181. }
  17182. if (nonNameProps.length > 0) {
  17183. const { props, directives } = buildProps(
  17184. node,
  17185. context,
  17186. nonNameProps,
  17187. false,
  17188. false
  17189. );
  17190. slotProps = props;
  17191. if (directives.length) {
  17192. context.onError(
  17193. createCompilerError(
  17194. 36,
  17195. directives[0].loc
  17196. )
  17197. );
  17198. }
  17199. }
  17200. return {
  17201. slotName,
  17202. slotProps
  17203. };
  17204. }
  17205. const transformOn$1 = (dir, node, context, augmentor) => {
  17206. const { loc, modifiers, arg } = dir;
  17207. if (!dir.exp && !modifiers.length) {
  17208. context.onError(createCompilerError(35, loc));
  17209. }
  17210. let eventName;
  17211. if (arg.type === 4) {
  17212. if (arg.isStatic) {
  17213. let rawName = arg.content;
  17214. if (rawName.startsWith("vnode")) {
  17215. context.onError(createCompilerError(51, arg.loc));
  17216. }
  17217. if (rawName.startsWith("vue:")) {
  17218. rawName = `vnode-${rawName.slice(4)}`;
  17219. }
  17220. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  17221. // for non-element and vnode lifecycle event listeners, auto convert
  17222. // it to camelCase. See issue #2249
  17223. toHandlerKey(camelize(rawName))
  17224. ) : (
  17225. // preserve case for plain element listeners that have uppercase
  17226. // letters, as these may be custom elements' custom events
  17227. `on:${rawName}`
  17228. );
  17229. eventName = createSimpleExpression(eventString, true, arg.loc);
  17230. } else {
  17231. eventName = createCompoundExpression([
  17232. `${context.helperString(TO_HANDLER_KEY)}(`,
  17233. arg,
  17234. `)`
  17235. ]);
  17236. }
  17237. } else {
  17238. eventName = arg;
  17239. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  17240. eventName.children.push(`)`);
  17241. }
  17242. let exp = dir.exp;
  17243. if (exp && !exp.content.trim()) {
  17244. exp = void 0;
  17245. }
  17246. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  17247. if (exp) {
  17248. const isMemberExp = isMemberExpression(exp);
  17249. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  17250. const hasMultipleStatements = exp.content.includes(`;`);
  17251. {
  17252. validateBrowserExpression(
  17253. exp,
  17254. context,
  17255. false,
  17256. hasMultipleStatements
  17257. );
  17258. }
  17259. if (isInlineStatement || shouldCache && isMemberExp) {
  17260. exp = createCompoundExpression([
  17261. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  17262. exp,
  17263. hasMultipleStatements ? `}` : `)`
  17264. ]);
  17265. }
  17266. }
  17267. let ret = {
  17268. props: [
  17269. createObjectProperty(
  17270. eventName,
  17271. exp || createSimpleExpression(`() => {}`, false, loc)
  17272. )
  17273. ]
  17274. };
  17275. if (augmentor) {
  17276. ret = augmentor(ret);
  17277. }
  17278. if (shouldCache) {
  17279. ret.props[0].value = context.cache(ret.props[0].value);
  17280. }
  17281. ret.props.forEach((p) => p.key.isHandlerKey = true);
  17282. return ret;
  17283. };
  17284. const transformText = (node, context) => {
  17285. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  17286. return () => {
  17287. const children = node.children;
  17288. let currentContainer = void 0;
  17289. let hasText = false;
  17290. for (let i = 0; i < children.length; i++) {
  17291. const child = children[i];
  17292. if (isText$1(child)) {
  17293. hasText = true;
  17294. for (let j = i + 1; j < children.length; j++) {
  17295. const next = children[j];
  17296. if (isText$1(next)) {
  17297. if (!currentContainer) {
  17298. currentContainer = children[i] = createCompoundExpression(
  17299. [child],
  17300. child.loc
  17301. );
  17302. }
  17303. currentContainer.children.push(` + `, next);
  17304. children.splice(j, 1);
  17305. j--;
  17306. } else {
  17307. currentContainer = void 0;
  17308. break;
  17309. }
  17310. }
  17311. }
  17312. }
  17313. if (!hasText || // if this is a plain element with a single text child, leave it
  17314. // as-is since the runtime has dedicated fast path for this by directly
  17315. // setting textContent of the element.
  17316. // for component root it's always normalized anyway.
  17317. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  17318. // custom directives can potentially add DOM elements arbitrarily,
  17319. // we need to avoid setting textContent of the element at runtime
  17320. // to avoid accidentally overwriting the DOM elements added
  17321. // by the user through custom directives.
  17322. !node.props.find(
  17323. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  17324. ) && // in compat mode, <template> tags with no special directives
  17325. // will be rendered as a fragment so its children must be
  17326. // converted into vnodes.
  17327. true)) {
  17328. return;
  17329. }
  17330. for (let i = 0; i < children.length; i++) {
  17331. const child = children[i];
  17332. if (isText$1(child) || child.type === 8) {
  17333. const callArgs = [];
  17334. if (child.type !== 2 || child.content !== " ") {
  17335. callArgs.push(child);
  17336. }
  17337. if (!context.ssr && getConstantType(child, context) === 0) {
  17338. callArgs.push(
  17339. 1 + (` /* ${PatchFlagNames[1]} */` )
  17340. );
  17341. }
  17342. children[i] = {
  17343. type: 12,
  17344. content: child,
  17345. loc: child.loc,
  17346. codegenNode: createCallExpression(
  17347. context.helper(CREATE_TEXT),
  17348. callArgs
  17349. )
  17350. };
  17351. }
  17352. }
  17353. };
  17354. }
  17355. };
  17356. const seen$1 = /* @__PURE__ */ new WeakSet();
  17357. const transformOnce = (node, context) => {
  17358. if (node.type === 1 && findDir(node, "once", true)) {
  17359. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  17360. return;
  17361. }
  17362. seen$1.add(node);
  17363. context.inVOnce = true;
  17364. context.helper(SET_BLOCK_TRACKING);
  17365. return () => {
  17366. context.inVOnce = false;
  17367. const cur = context.currentNode;
  17368. if (cur.codegenNode) {
  17369. cur.codegenNode = context.cache(
  17370. cur.codegenNode,
  17371. true,
  17372. true
  17373. );
  17374. }
  17375. };
  17376. }
  17377. };
  17378. const transformModel$1 = (dir, node, context) => {
  17379. const { exp, arg } = dir;
  17380. if (!exp) {
  17381. context.onError(
  17382. createCompilerError(41, dir.loc)
  17383. );
  17384. return createTransformProps();
  17385. }
  17386. const rawExp = exp.loc.source.trim();
  17387. const expString = exp.type === 4 ? exp.content : rawExp;
  17388. const bindingType = context.bindingMetadata[rawExp];
  17389. if (bindingType === "props" || bindingType === "props-aliased") {
  17390. context.onError(createCompilerError(44, exp.loc));
  17391. return createTransformProps();
  17392. }
  17393. if (!expString.trim() || !isMemberExpression(exp) && true) {
  17394. context.onError(
  17395. createCompilerError(42, exp.loc)
  17396. );
  17397. return createTransformProps();
  17398. }
  17399. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  17400. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  17401. let assignmentExp;
  17402. const eventArg = context.isTS ? `($event: any)` : `$event`;
  17403. {
  17404. assignmentExp = createCompoundExpression([
  17405. `${eventArg} => ((`,
  17406. exp,
  17407. `) = $event)`
  17408. ]);
  17409. }
  17410. const props = [
  17411. // modelValue: foo
  17412. createObjectProperty(propName, dir.exp),
  17413. // "onUpdate:modelValue": $event => (foo = $event)
  17414. createObjectProperty(eventName, assignmentExp)
  17415. ];
  17416. if (dir.modifiers.length && node.tagType === 1) {
  17417. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  17418. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  17419. props.push(
  17420. createObjectProperty(
  17421. modifiersKey,
  17422. createSimpleExpression(
  17423. `{ ${modifiers} }`,
  17424. false,
  17425. dir.loc,
  17426. 2
  17427. )
  17428. )
  17429. );
  17430. }
  17431. return createTransformProps(props);
  17432. };
  17433. function createTransformProps(props = []) {
  17434. return { props };
  17435. }
  17436. const seen = /* @__PURE__ */ new WeakSet();
  17437. const transformMemo = (node, context) => {
  17438. if (node.type === 1) {
  17439. const dir = findDir(node, "memo");
  17440. if (!dir || seen.has(node) || context.inSSR) {
  17441. return;
  17442. }
  17443. seen.add(node);
  17444. return () => {
  17445. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  17446. if (codegenNode && codegenNode.type === 13) {
  17447. if (node.tagType !== 1) {
  17448. convertToBlock(codegenNode, context);
  17449. }
  17450. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  17451. dir.exp,
  17452. createFunctionExpression(void 0, codegenNode),
  17453. `_cache`,
  17454. String(context.cached.length)
  17455. ]);
  17456. context.cached.push(null);
  17457. }
  17458. };
  17459. }
  17460. };
  17461. function getBaseTransformPreset(prefixIdentifiers) {
  17462. return [
  17463. [
  17464. transformOnce,
  17465. transformIf,
  17466. transformMemo,
  17467. transformFor,
  17468. ...[],
  17469. ...[transformExpression] ,
  17470. transformSlotOutlet,
  17471. transformElement,
  17472. trackSlotScopes,
  17473. transformText
  17474. ],
  17475. {
  17476. on: transformOn$1,
  17477. bind: transformBind,
  17478. model: transformModel$1
  17479. }
  17480. ];
  17481. }
  17482. function baseCompile(source, options = {}) {
  17483. const onError = options.onError || defaultOnError;
  17484. const isModuleMode = options.mode === "module";
  17485. {
  17486. if (options.prefixIdentifiers === true) {
  17487. onError(createCompilerError(47));
  17488. } else if (isModuleMode) {
  17489. onError(createCompilerError(48));
  17490. }
  17491. }
  17492. const prefixIdentifiers = false;
  17493. if (options.cacheHandlers) {
  17494. onError(createCompilerError(49));
  17495. }
  17496. if (options.scopeId && !isModuleMode) {
  17497. onError(createCompilerError(50));
  17498. }
  17499. const resolvedOptions = extend({}, options, {
  17500. prefixIdentifiers
  17501. });
  17502. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  17503. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  17504. transform(
  17505. ast,
  17506. extend({}, resolvedOptions, {
  17507. nodeTransforms: [
  17508. ...nodeTransforms,
  17509. ...options.nodeTransforms || []
  17510. // user transforms
  17511. ],
  17512. directiveTransforms: extend(
  17513. {},
  17514. directiveTransforms,
  17515. options.directiveTransforms || {}
  17516. // user transforms
  17517. )
  17518. })
  17519. );
  17520. return generate(ast, resolvedOptions);
  17521. }
  17522. const noopDirectiveTransform = () => ({ props: [] });
  17523. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  17524. const V_MODEL_CHECKBOX = Symbol(
  17525. `vModelCheckbox`
  17526. );
  17527. const V_MODEL_TEXT = Symbol(`vModelText` );
  17528. const V_MODEL_SELECT = Symbol(
  17529. `vModelSelect`
  17530. );
  17531. const V_MODEL_DYNAMIC = Symbol(
  17532. `vModelDynamic`
  17533. );
  17534. const V_ON_WITH_MODIFIERS = Symbol(
  17535. `vOnModifiersGuard`
  17536. );
  17537. const V_ON_WITH_KEYS = Symbol(
  17538. `vOnKeysGuard`
  17539. );
  17540. const V_SHOW = Symbol(`vShow` );
  17541. const TRANSITION = Symbol(`Transition` );
  17542. const TRANSITION_GROUP = Symbol(
  17543. `TransitionGroup`
  17544. );
  17545. registerRuntimeHelpers({
  17546. [V_MODEL_RADIO]: `vModelRadio`,
  17547. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  17548. [V_MODEL_TEXT]: `vModelText`,
  17549. [V_MODEL_SELECT]: `vModelSelect`,
  17550. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  17551. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  17552. [V_ON_WITH_KEYS]: `withKeys`,
  17553. [V_SHOW]: `vShow`,
  17554. [TRANSITION]: `Transition`,
  17555. [TRANSITION_GROUP]: `TransitionGroup`
  17556. });
  17557. let decoder;
  17558. function decodeHtmlBrowser(raw, asAttr = false) {
  17559. if (!decoder) {
  17560. decoder = document.createElement("div");
  17561. }
  17562. if (asAttr) {
  17563. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  17564. return decoder.children[0].getAttribute("foo");
  17565. } else {
  17566. decoder.innerHTML = raw;
  17567. return decoder.textContent;
  17568. }
  17569. }
  17570. const parserOptions = {
  17571. parseMode: "html",
  17572. isVoidTag,
  17573. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  17574. isPreTag: (tag) => tag === "pre",
  17575. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  17576. decodeEntities: decodeHtmlBrowser ,
  17577. isBuiltInComponent: (tag) => {
  17578. if (tag === "Transition" || tag === "transition") {
  17579. return TRANSITION;
  17580. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  17581. return TRANSITION_GROUP;
  17582. }
  17583. },
  17584. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  17585. getNamespace(tag, parent, rootNamespace) {
  17586. let ns = parent ? parent.ns : rootNamespace;
  17587. if (parent && ns === 2) {
  17588. if (parent.tag === "annotation-xml") {
  17589. if (tag === "svg") {
  17590. return 1;
  17591. }
  17592. if (parent.props.some(
  17593. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  17594. )) {
  17595. ns = 0;
  17596. }
  17597. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  17598. ns = 0;
  17599. }
  17600. } else if (parent && ns === 1) {
  17601. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  17602. ns = 0;
  17603. }
  17604. }
  17605. if (ns === 0) {
  17606. if (tag === "svg") {
  17607. return 1;
  17608. }
  17609. if (tag === "math") {
  17610. return 2;
  17611. }
  17612. }
  17613. return ns;
  17614. }
  17615. };
  17616. const transformStyle = (node) => {
  17617. if (node.type === 1) {
  17618. node.props.forEach((p, i) => {
  17619. if (p.type === 6 && p.name === "style" && p.value) {
  17620. node.props[i] = {
  17621. type: 7,
  17622. name: `bind`,
  17623. arg: createSimpleExpression(`style`, true, p.loc),
  17624. exp: parseInlineCSS(p.value.content, p.loc),
  17625. modifiers: [],
  17626. loc: p.loc
  17627. };
  17628. }
  17629. });
  17630. }
  17631. };
  17632. const parseInlineCSS = (cssText, loc) => {
  17633. const normalized = parseStringStyle(cssText);
  17634. return createSimpleExpression(
  17635. JSON.stringify(normalized),
  17636. false,
  17637. loc,
  17638. 3
  17639. );
  17640. };
  17641. function createDOMCompilerError(code, loc) {
  17642. return createCompilerError(
  17643. code,
  17644. loc,
  17645. DOMErrorMessages
  17646. );
  17647. }
  17648. const DOMErrorMessages = {
  17649. [53]: `v-html is missing expression.`,
  17650. [54]: `v-html will override element children.`,
  17651. [55]: `v-text is missing expression.`,
  17652. [56]: `v-text will override element children.`,
  17653. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  17654. [58]: `v-model argument is not supported on plain elements.`,
  17655. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  17656. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  17657. [61]: `v-show is missing expression.`,
  17658. [62]: `<Transition> expects exactly one child element or component.`,
  17659. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  17660. };
  17661. const transformVHtml = (dir, node, context) => {
  17662. const { exp, loc } = dir;
  17663. if (!exp) {
  17664. context.onError(
  17665. createDOMCompilerError(53, loc)
  17666. );
  17667. }
  17668. if (node.children.length) {
  17669. context.onError(
  17670. createDOMCompilerError(54, loc)
  17671. );
  17672. node.children.length = 0;
  17673. }
  17674. return {
  17675. props: [
  17676. createObjectProperty(
  17677. createSimpleExpression(`innerHTML`, true, loc),
  17678. exp || createSimpleExpression("", true)
  17679. )
  17680. ]
  17681. };
  17682. };
  17683. const transformVText = (dir, node, context) => {
  17684. const { exp, loc } = dir;
  17685. if (!exp) {
  17686. context.onError(
  17687. createDOMCompilerError(55, loc)
  17688. );
  17689. }
  17690. if (node.children.length) {
  17691. context.onError(
  17692. createDOMCompilerError(56, loc)
  17693. );
  17694. node.children.length = 0;
  17695. }
  17696. return {
  17697. props: [
  17698. createObjectProperty(
  17699. createSimpleExpression(`textContent`, true),
  17700. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  17701. context.helperString(TO_DISPLAY_STRING),
  17702. [exp],
  17703. loc
  17704. ) : createSimpleExpression("", true)
  17705. )
  17706. ]
  17707. };
  17708. };
  17709. const transformModel = (dir, node, context) => {
  17710. const baseResult = transformModel$1(dir, node, context);
  17711. if (!baseResult.props.length || node.tagType === 1) {
  17712. return baseResult;
  17713. }
  17714. if (dir.arg) {
  17715. context.onError(
  17716. createDOMCompilerError(
  17717. 58,
  17718. dir.arg.loc
  17719. )
  17720. );
  17721. }
  17722. function checkDuplicatedValue() {
  17723. const value = findDir(node, "bind");
  17724. if (value && isStaticArgOf(value.arg, "value")) {
  17725. context.onError(
  17726. createDOMCompilerError(
  17727. 60,
  17728. value.loc
  17729. )
  17730. );
  17731. }
  17732. }
  17733. const { tag } = node;
  17734. const isCustomElement = context.isCustomElement(tag);
  17735. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  17736. let directiveToUse = V_MODEL_TEXT;
  17737. let isInvalidType = false;
  17738. if (tag === "input" || isCustomElement) {
  17739. const type = findProp(node, `type`);
  17740. if (type) {
  17741. if (type.type === 7) {
  17742. directiveToUse = V_MODEL_DYNAMIC;
  17743. } else if (type.value) {
  17744. switch (type.value.content) {
  17745. case "radio":
  17746. directiveToUse = V_MODEL_RADIO;
  17747. break;
  17748. case "checkbox":
  17749. directiveToUse = V_MODEL_CHECKBOX;
  17750. break;
  17751. case "file":
  17752. isInvalidType = true;
  17753. context.onError(
  17754. createDOMCompilerError(
  17755. 59,
  17756. dir.loc
  17757. )
  17758. );
  17759. break;
  17760. default:
  17761. checkDuplicatedValue();
  17762. break;
  17763. }
  17764. }
  17765. } else if (hasDynamicKeyVBind(node)) {
  17766. directiveToUse = V_MODEL_DYNAMIC;
  17767. } else {
  17768. checkDuplicatedValue();
  17769. }
  17770. } else if (tag === "select") {
  17771. directiveToUse = V_MODEL_SELECT;
  17772. } else {
  17773. checkDuplicatedValue();
  17774. }
  17775. if (!isInvalidType) {
  17776. baseResult.needRuntime = context.helper(directiveToUse);
  17777. }
  17778. } else {
  17779. context.onError(
  17780. createDOMCompilerError(
  17781. 57,
  17782. dir.loc
  17783. )
  17784. );
  17785. }
  17786. baseResult.props = baseResult.props.filter(
  17787. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  17788. );
  17789. return baseResult;
  17790. };
  17791. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  17792. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  17793. // event propagation management
  17794. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  17795. );
  17796. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  17797. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  17798. const resolveModifiers = (key, modifiers, context, loc) => {
  17799. const keyModifiers = [];
  17800. const nonKeyModifiers = [];
  17801. const eventOptionModifiers = [];
  17802. for (let i = 0; i < modifiers.length; i++) {
  17803. const modifier = modifiers[i].content;
  17804. if (isEventOptionModifier(modifier)) {
  17805. eventOptionModifiers.push(modifier);
  17806. } else {
  17807. if (maybeKeyModifier(modifier)) {
  17808. if (isStaticExp(key)) {
  17809. if (isKeyboardEvent(key.content.toLowerCase())) {
  17810. keyModifiers.push(modifier);
  17811. } else {
  17812. nonKeyModifiers.push(modifier);
  17813. }
  17814. } else {
  17815. keyModifiers.push(modifier);
  17816. nonKeyModifiers.push(modifier);
  17817. }
  17818. } else {
  17819. if (isNonKeyModifier(modifier)) {
  17820. nonKeyModifiers.push(modifier);
  17821. } else {
  17822. keyModifiers.push(modifier);
  17823. }
  17824. }
  17825. }
  17826. }
  17827. return {
  17828. keyModifiers,
  17829. nonKeyModifiers,
  17830. eventOptionModifiers
  17831. };
  17832. };
  17833. const transformClick = (key, event) => {
  17834. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  17835. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  17836. `(`,
  17837. key,
  17838. `) === "onClick" ? "${event}" : (`,
  17839. key,
  17840. `)`
  17841. ]) : key;
  17842. };
  17843. const transformOn = (dir, node, context) => {
  17844. return transformOn$1(dir, node, context, (baseResult) => {
  17845. const { modifiers } = dir;
  17846. if (!modifiers.length) return baseResult;
  17847. let { key, value: handlerExp } = baseResult.props[0];
  17848. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  17849. if (nonKeyModifiers.includes("right")) {
  17850. key = transformClick(key, `onContextmenu`);
  17851. }
  17852. if (nonKeyModifiers.includes("middle")) {
  17853. key = transformClick(key, `onMouseup`);
  17854. }
  17855. if (nonKeyModifiers.length) {
  17856. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  17857. handlerExp,
  17858. JSON.stringify(nonKeyModifiers)
  17859. ]);
  17860. }
  17861. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  17862. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  17863. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  17864. handlerExp,
  17865. JSON.stringify(keyModifiers)
  17866. ]);
  17867. }
  17868. if (eventOptionModifiers.length) {
  17869. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  17870. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  17871. }
  17872. return {
  17873. props: [createObjectProperty(key, handlerExp)]
  17874. };
  17875. });
  17876. };
  17877. const transformShow = (dir, node, context) => {
  17878. const { exp, loc } = dir;
  17879. if (!exp) {
  17880. context.onError(
  17881. createDOMCompilerError(61, loc)
  17882. );
  17883. }
  17884. return {
  17885. props: [],
  17886. needRuntime: context.helper(V_SHOW)
  17887. };
  17888. };
  17889. const transformTransition = (node, context) => {
  17890. if (node.type === 1 && node.tagType === 1) {
  17891. const component = context.isBuiltInComponent(node.tag);
  17892. if (component === TRANSITION) {
  17893. return () => {
  17894. if (!node.children.length) {
  17895. return;
  17896. }
  17897. if (hasMultipleChildren(node)) {
  17898. context.onError(
  17899. createDOMCompilerError(
  17900. 62,
  17901. {
  17902. start: node.children[0].loc.start,
  17903. end: node.children[node.children.length - 1].loc.end,
  17904. source: ""
  17905. }
  17906. )
  17907. );
  17908. }
  17909. const child = node.children[0];
  17910. if (child.type === 1) {
  17911. for (const p of child.props) {
  17912. if (p.type === 7 && p.name === "show") {
  17913. node.props.push({
  17914. type: 6,
  17915. name: "persisted",
  17916. nameLoc: node.loc,
  17917. value: void 0,
  17918. loc: node.loc
  17919. });
  17920. }
  17921. }
  17922. }
  17923. };
  17924. }
  17925. }
  17926. };
  17927. function hasMultipleChildren(node) {
  17928. const children = node.children = node.children.filter(
  17929. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  17930. );
  17931. const child = children[0];
  17932. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  17933. }
  17934. const ignoreSideEffectTags = (node, context) => {
  17935. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  17936. context.onError(
  17937. createDOMCompilerError(
  17938. 63,
  17939. node.loc
  17940. )
  17941. );
  17942. context.removeNode();
  17943. }
  17944. };
  17945. function isValidHTMLNesting(parent, child) {
  17946. if (parent === "template") {
  17947. return true;
  17948. }
  17949. if (parent in onlyValidChildren) {
  17950. return onlyValidChildren[parent].has(child);
  17951. }
  17952. if (child in onlyValidParents) {
  17953. return onlyValidParents[child].has(parent);
  17954. }
  17955. if (parent in knownInvalidChildren) {
  17956. if (knownInvalidChildren[parent].has(child)) return false;
  17957. }
  17958. if (child in knownInvalidParents) {
  17959. if (knownInvalidParents[child].has(parent)) return false;
  17960. }
  17961. return true;
  17962. }
  17963. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  17964. const emptySet = /* @__PURE__ */ new Set([]);
  17965. const onlyValidChildren = {
  17966. head: /* @__PURE__ */ new Set([
  17967. "base",
  17968. "basefront",
  17969. "bgsound",
  17970. "link",
  17971. "meta",
  17972. "title",
  17973. "noscript",
  17974. "noframes",
  17975. "style",
  17976. "script",
  17977. "template"
  17978. ]),
  17979. optgroup: /* @__PURE__ */ new Set(["option"]),
  17980. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  17981. // table
  17982. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  17983. tr: /* @__PURE__ */ new Set(["td", "th"]),
  17984. colgroup: /* @__PURE__ */ new Set(["col"]),
  17985. tbody: /* @__PURE__ */ new Set(["tr"]),
  17986. thead: /* @__PURE__ */ new Set(["tr"]),
  17987. tfoot: /* @__PURE__ */ new Set(["tr"]),
  17988. // these elements can not have any children elements
  17989. script: emptySet,
  17990. iframe: emptySet,
  17991. option: emptySet,
  17992. textarea: emptySet,
  17993. style: emptySet,
  17994. title: emptySet
  17995. };
  17996. const onlyValidParents = {
  17997. // sections
  17998. html: emptySet,
  17999. body: /* @__PURE__ */ new Set(["html"]),
  18000. head: /* @__PURE__ */ new Set(["html"]),
  18001. // table
  18002. td: /* @__PURE__ */ new Set(["tr"]),
  18003. colgroup: /* @__PURE__ */ new Set(["table"]),
  18004. caption: /* @__PURE__ */ new Set(["table"]),
  18005. tbody: /* @__PURE__ */ new Set(["table"]),
  18006. tfoot: /* @__PURE__ */ new Set(["table"]),
  18007. col: /* @__PURE__ */ new Set(["colgroup"]),
  18008. th: /* @__PURE__ */ new Set(["tr"]),
  18009. thead: /* @__PURE__ */ new Set(["table"]),
  18010. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  18011. // data list
  18012. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  18013. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  18014. // other
  18015. figcaption: /* @__PURE__ */ new Set(["figure"]),
  18016. // li: new Set(["ul", "ol"]),
  18017. summary: /* @__PURE__ */ new Set(["details"]),
  18018. area: /* @__PURE__ */ new Set(["map"])
  18019. };
  18020. const knownInvalidChildren = {
  18021. p: /* @__PURE__ */ new Set([
  18022. "address",
  18023. "article",
  18024. "aside",
  18025. "blockquote",
  18026. "center",
  18027. "details",
  18028. "dialog",
  18029. "dir",
  18030. "div",
  18031. "dl",
  18032. "fieldset",
  18033. "figure",
  18034. "footer",
  18035. "form",
  18036. "h1",
  18037. "h2",
  18038. "h3",
  18039. "h4",
  18040. "h5",
  18041. "h6",
  18042. "header",
  18043. "hgroup",
  18044. "hr",
  18045. "li",
  18046. "main",
  18047. "nav",
  18048. "menu",
  18049. "ol",
  18050. "p",
  18051. "pre",
  18052. "section",
  18053. "table",
  18054. "ul"
  18055. ]),
  18056. svg: /* @__PURE__ */ new Set([
  18057. "b",
  18058. "blockquote",
  18059. "br",
  18060. "code",
  18061. "dd",
  18062. "div",
  18063. "dl",
  18064. "dt",
  18065. "em",
  18066. "embed",
  18067. "h1",
  18068. "h2",
  18069. "h3",
  18070. "h4",
  18071. "h5",
  18072. "h6",
  18073. "hr",
  18074. "i",
  18075. "img",
  18076. "li",
  18077. "menu",
  18078. "meta",
  18079. "ol",
  18080. "p",
  18081. "pre",
  18082. "ruby",
  18083. "s",
  18084. "small",
  18085. "span",
  18086. "strong",
  18087. "sub",
  18088. "sup",
  18089. "table",
  18090. "u",
  18091. "ul",
  18092. "var"
  18093. ])
  18094. };
  18095. const knownInvalidParents = {
  18096. a: /* @__PURE__ */ new Set(["a"]),
  18097. button: /* @__PURE__ */ new Set(["button"]),
  18098. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  18099. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  18100. form: /* @__PURE__ */ new Set(["form"]),
  18101. li: /* @__PURE__ */ new Set(["li"]),
  18102. h1: headings,
  18103. h2: headings,
  18104. h3: headings,
  18105. h4: headings,
  18106. h5: headings,
  18107. h6: headings
  18108. };
  18109. const validateHtmlNesting = (node, context) => {
  18110. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  18111. const error = new SyntaxError(
  18112. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  18113. );
  18114. error.loc = node.loc;
  18115. context.onWarn(error);
  18116. }
  18117. };
  18118. const DOMNodeTransforms = [
  18119. transformStyle,
  18120. ...[transformTransition, validateHtmlNesting]
  18121. ];
  18122. const DOMDirectiveTransforms = {
  18123. cloak: noopDirectiveTransform,
  18124. html: transformVHtml,
  18125. text: transformVText,
  18126. model: transformModel,
  18127. // override compiler-core
  18128. on: transformOn,
  18129. // override compiler-core
  18130. show: transformShow
  18131. };
  18132. function compile(src, options = {}) {
  18133. return baseCompile(
  18134. src,
  18135. extend({}, parserOptions, options, {
  18136. nodeTransforms: [
  18137. // ignore <script> and <tag>
  18138. // this is not put inside DOMNodeTransforms because that list is used
  18139. // by compiler-ssr to generate vnode fallback branches
  18140. ignoreSideEffectTags,
  18141. ...DOMNodeTransforms,
  18142. ...options.nodeTransforms || []
  18143. ],
  18144. directiveTransforms: extend(
  18145. {},
  18146. DOMDirectiveTransforms,
  18147. options.directiveTransforms || {}
  18148. ),
  18149. transformHoist: null
  18150. })
  18151. );
  18152. }
  18153. {
  18154. initDev();
  18155. }
  18156. const compileCache = /* @__PURE__ */ Object.create(null);
  18157. function compileToFunction(template, options) {
  18158. if (!isString(template)) {
  18159. if (template.nodeType) {
  18160. template = template.innerHTML;
  18161. } else {
  18162. warn(`invalid template option: `, template);
  18163. return NOOP;
  18164. }
  18165. }
  18166. const key = genCacheKey(template, options);
  18167. const cached = compileCache[key];
  18168. if (cached) {
  18169. return cached;
  18170. }
  18171. if (template[0] === "#") {
  18172. const el = document.querySelector(template);
  18173. if (!el) {
  18174. warn(`Template element not found or is empty: ${template}`);
  18175. }
  18176. template = el ? el.innerHTML : ``;
  18177. }
  18178. const opts = extend(
  18179. {
  18180. hoistStatic: true,
  18181. onError: onError ,
  18182. onWarn: (e) => onError(e, true)
  18183. },
  18184. options
  18185. );
  18186. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  18187. opts.isCustomElement = (tag) => !!customElements.get(tag);
  18188. }
  18189. const { code } = compile(template, opts);
  18190. function onError(err, asWarning = false) {
  18191. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  18192. const codeFrame = err.loc && generateCodeFrame(
  18193. template,
  18194. err.loc.start.offset,
  18195. err.loc.end.offset
  18196. );
  18197. warn(codeFrame ? `${message}
  18198. ${codeFrame}` : message);
  18199. }
  18200. const render = new Function("Vue", code)(runtimeDom);
  18201. render._rc = true;
  18202. return compileCache[key] = render;
  18203. }
  18204. registerRuntimeCompiler(compileToFunction);
  18205. export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, 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, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };