vue.esm-browser.js 478 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740
  1. /**
  2. * vue v3.4.23
  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, expectsLowerCase) {
  9. const set = new Set(str.split(","));
  10. return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
  11. }
  12. const EMPTY_OBJ = Object.freeze({}) ;
  13. const EMPTY_ARR = Object.freeze([]) ;
  14. const NOOP = () => {
  15. };
  16. const NO = () => false;
  17. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  18. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  19. const isModelListener = (key) => key.startsWith("onUpdate:");
  20. const extend = Object.assign;
  21. const remove = (arr, el) => {
  22. const i = arr.indexOf(el);
  23. if (i > -1) {
  24. arr.splice(i, 1);
  25. }
  26. };
  27. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  28. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  29. const isArray = Array.isArray;
  30. const isMap = (val) => toTypeString(val) === "[object Map]";
  31. const isSet = (val) => toTypeString(val) === "[object Set]";
  32. const isDate = (val) => toTypeString(val) === "[object Date]";
  33. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  34. const isFunction = (val) => typeof val === "function";
  35. const isString = (val) => typeof val === "string";
  36. const isSymbol = (val) => typeof val === "symbol";
  37. const isObject = (val) => val !== null && typeof val === "object";
  38. const isPromise = (val) => {
  39. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  40. };
  41. const objectToString = Object.prototype.toString;
  42. const toTypeString = (value) => objectToString.call(value);
  43. const toRawType = (value) => {
  44. return toTypeString(value).slice(8, -1);
  45. };
  46. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  47. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  48. const isReservedProp = /* @__PURE__ */ makeMap(
  49. // the leading comma is intentional so empty string "" is also included
  50. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  51. );
  52. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  53. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  54. );
  55. const cacheStringFunction = (fn) => {
  56. const cache = /* @__PURE__ */ Object.create(null);
  57. return (str) => {
  58. const hit = cache[str];
  59. return hit || (cache[str] = fn(str));
  60. };
  61. };
  62. const camelizeRE = /-(\w)/g;
  63. const camelize = cacheStringFunction((str) => {
  64. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  65. });
  66. const hyphenateRE = /\B([A-Z])/g;
  67. const hyphenate = cacheStringFunction(
  68. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  69. );
  70. const capitalize = cacheStringFunction((str) => {
  71. return str.charAt(0).toUpperCase() + str.slice(1);
  72. });
  73. const toHandlerKey = cacheStringFunction((str) => {
  74. const s = str ? `on${capitalize(str)}` : ``;
  75. return s;
  76. });
  77. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  78. const invokeArrayFns = (fns, arg) => {
  79. for (let i = 0; i < fns.length; i++) {
  80. fns[i](arg);
  81. }
  82. };
  83. const def = (obj, key, value) => {
  84. Object.defineProperty(obj, key, {
  85. configurable: true,
  86. enumerable: false,
  87. value
  88. });
  89. };
  90. const looseToNumber = (val) => {
  91. const n = parseFloat(val);
  92. return isNaN(n) ? val : n;
  93. };
  94. const toNumber = (val) => {
  95. const n = isString(val) ? Number(val) : NaN;
  96. return isNaN(n) ? val : n;
  97. };
  98. let _globalThis;
  99. const getGlobalThis = () => {
  100. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  101. };
  102. const PatchFlagNames = {
  103. [1]: `TEXT`,
  104. [2]: `CLASS`,
  105. [4]: `STYLE`,
  106. [8]: `PROPS`,
  107. [16]: `FULL_PROPS`,
  108. [32]: `NEED_HYDRATION`,
  109. [64]: `STABLE_FRAGMENT`,
  110. [128]: `KEYED_FRAGMENT`,
  111. [256]: `UNKEYED_FRAGMENT`,
  112. [512]: `NEED_PATCH`,
  113. [1024]: `DYNAMIC_SLOTS`,
  114. [2048]: `DEV_ROOT_FRAGMENT`,
  115. [-1]: `HOISTED`,
  116. [-2]: `BAIL`
  117. };
  118. const slotFlagsText = {
  119. [1]: "STABLE",
  120. [2]: "DYNAMIC",
  121. [3]: "FORWARDED"
  122. };
  123. 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";
  124. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  125. const range = 2;
  126. function generateCodeFrame(source, start = 0, end = source.length) {
  127. let lines = source.split(/(\r?\n)/);
  128. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  129. lines = lines.filter((_, idx) => idx % 2 === 0);
  130. let count = 0;
  131. const res = [];
  132. for (let i = 0; i < lines.length; i++) {
  133. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  134. if (count >= start) {
  135. for (let j = i - range; j <= i + range || end > count; j++) {
  136. if (j < 0 || j >= lines.length)
  137. continue;
  138. const line = j + 1;
  139. res.push(
  140. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  141. );
  142. const lineLength = lines[j].length;
  143. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  144. if (j === i) {
  145. const pad = start - (count - (lineLength + newLineSeqLength));
  146. const length = Math.max(
  147. 1,
  148. end > count ? lineLength - pad : end - start
  149. );
  150. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  151. } else if (j > i) {
  152. if (end > count) {
  153. const length = Math.max(Math.min(end - count, lineLength), 1);
  154. res.push(` | ` + "^".repeat(length));
  155. }
  156. count += lineLength + newLineSeqLength;
  157. }
  158. }
  159. break;
  160. }
  161. }
  162. return res.join("\n");
  163. }
  164. function normalizeStyle(value) {
  165. if (isArray(value)) {
  166. const res = {};
  167. for (let i = 0; i < value.length; i++) {
  168. const item = value[i];
  169. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  170. if (normalized) {
  171. for (const key in normalized) {
  172. res[key] = normalized[key];
  173. }
  174. }
  175. }
  176. return res;
  177. } else if (isString(value) || isObject(value)) {
  178. return value;
  179. }
  180. }
  181. const listDelimiterRE = /;(?![^(]*\))/g;
  182. const propertyDelimiterRE = /:([^]+)/;
  183. const styleCommentRE = /\/\*[^]*?\*\//g;
  184. function parseStringStyle(cssText) {
  185. const ret = {};
  186. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  187. if (item) {
  188. const tmp = item.split(propertyDelimiterRE);
  189. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  190. }
  191. });
  192. return ret;
  193. }
  194. function stringifyStyle(styles) {
  195. let ret = "";
  196. if (!styles || isString(styles)) {
  197. return ret;
  198. }
  199. for (const key in styles) {
  200. const value = styles[key];
  201. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  202. if (isString(value) || typeof value === "number") {
  203. ret += `${normalizedKey}:${value};`;
  204. }
  205. }
  206. return ret;
  207. }
  208. function normalizeClass(value) {
  209. let res = "";
  210. if (isString(value)) {
  211. res = value;
  212. } else if (isArray(value)) {
  213. for (let i = 0; i < value.length; i++) {
  214. const normalized = normalizeClass(value[i]);
  215. if (normalized) {
  216. res += normalized + " ";
  217. }
  218. }
  219. } else if (isObject(value)) {
  220. for (const name in value) {
  221. if (value[name]) {
  222. res += name + " ";
  223. }
  224. }
  225. }
  226. return res.trim();
  227. }
  228. function normalizeProps(props) {
  229. if (!props)
  230. return null;
  231. let { class: klass, style } = props;
  232. if (klass && !isString(klass)) {
  233. props.class = normalizeClass(klass);
  234. }
  235. if (style) {
  236. props.style = normalizeStyle(style);
  237. }
  238. return props;
  239. }
  240. 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";
  241. 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";
  242. 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";
  243. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  244. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  245. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  246. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  247. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  248. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  249. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  250. const isBooleanAttr = /* @__PURE__ */ makeMap(
  251. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  252. );
  253. function includeBooleanAttr(value) {
  254. return !!value || value === "";
  255. }
  256. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  257. `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`
  258. );
  259. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  260. `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`
  261. );
  262. function isRenderableAttrValue(value) {
  263. if (value == null) {
  264. return false;
  265. }
  266. const type = typeof value;
  267. return type === "string" || type === "number" || type === "boolean";
  268. }
  269. function looseCompareArrays(a, b) {
  270. if (a.length !== b.length)
  271. return false;
  272. let equal = true;
  273. for (let i = 0; equal && i < a.length; i++) {
  274. equal = looseEqual(a[i], b[i]);
  275. }
  276. return equal;
  277. }
  278. function looseEqual(a, b) {
  279. if (a === b)
  280. return true;
  281. let aValidType = isDate(a);
  282. let bValidType = isDate(b);
  283. if (aValidType || bValidType) {
  284. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  285. }
  286. aValidType = isSymbol(a);
  287. bValidType = isSymbol(b);
  288. if (aValidType || bValidType) {
  289. return a === b;
  290. }
  291. aValidType = isArray(a);
  292. bValidType = isArray(b);
  293. if (aValidType || bValidType) {
  294. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  295. }
  296. aValidType = isObject(a);
  297. bValidType = isObject(b);
  298. if (aValidType || bValidType) {
  299. if (!aValidType || !bValidType) {
  300. return false;
  301. }
  302. const aKeysCount = Object.keys(a).length;
  303. const bKeysCount = Object.keys(b).length;
  304. if (aKeysCount !== bKeysCount) {
  305. return false;
  306. }
  307. for (const key in a) {
  308. const aHasKey = a.hasOwnProperty(key);
  309. const bHasKey = b.hasOwnProperty(key);
  310. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  311. return false;
  312. }
  313. }
  314. }
  315. return String(a) === String(b);
  316. }
  317. function looseIndexOf(arr, val) {
  318. return arr.findIndex((item) => looseEqual(item, val));
  319. }
  320. const toDisplayString = (val) => {
  321. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  322. };
  323. const replacer = (_key, val) => {
  324. if (val && val.__v_isRef) {
  325. return replacer(_key, val.value);
  326. } else if (isMap(val)) {
  327. return {
  328. [`Map(${val.size})`]: [...val.entries()].reduce(
  329. (entries, [key, val2], i) => {
  330. entries[stringifySymbol(key, i) + " =>"] = val2;
  331. return entries;
  332. },
  333. {}
  334. )
  335. };
  336. } else if (isSet(val)) {
  337. return {
  338. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  339. };
  340. } else if (isSymbol(val)) {
  341. return stringifySymbol(val);
  342. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  343. return String(val);
  344. }
  345. return val;
  346. };
  347. const stringifySymbol = (v, i = "") => {
  348. var _a;
  349. return (
  350. // Symbol.description in es2019+ so we need to cast here to pass
  351. // the lib: es2016 check
  352. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  353. );
  354. };
  355. function warn$2(msg, ...args) {
  356. console.warn(`[Vue warn] ${msg}`, ...args);
  357. }
  358. let activeEffectScope;
  359. class EffectScope {
  360. constructor(detached = false) {
  361. this.detached = detached;
  362. /**
  363. * @internal
  364. */
  365. this._active = true;
  366. /**
  367. * @internal
  368. */
  369. this.effects = [];
  370. /**
  371. * @internal
  372. */
  373. this.cleanups = [];
  374. this.parent = activeEffectScope;
  375. if (!detached && activeEffectScope) {
  376. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  377. this
  378. ) - 1;
  379. }
  380. }
  381. get active() {
  382. return this._active;
  383. }
  384. run(fn) {
  385. if (this._active) {
  386. const currentEffectScope = activeEffectScope;
  387. try {
  388. activeEffectScope = this;
  389. return fn();
  390. } finally {
  391. activeEffectScope = currentEffectScope;
  392. }
  393. } else {
  394. warn$2(`cannot run an inactive effect scope.`);
  395. }
  396. }
  397. /**
  398. * This should only be called on non-detached scopes
  399. * @internal
  400. */
  401. on() {
  402. activeEffectScope = this;
  403. }
  404. /**
  405. * This should only be called on non-detached scopes
  406. * @internal
  407. */
  408. off() {
  409. activeEffectScope = this.parent;
  410. }
  411. stop(fromParent) {
  412. if (this._active) {
  413. let i, l;
  414. for (i = 0, l = this.effects.length; i < l; i++) {
  415. this.effects[i].stop();
  416. }
  417. for (i = 0, l = this.cleanups.length; i < l; i++) {
  418. this.cleanups[i]();
  419. }
  420. if (this.scopes) {
  421. for (i = 0, l = this.scopes.length; i < l; i++) {
  422. this.scopes[i].stop(true);
  423. }
  424. }
  425. if (!this.detached && this.parent && !fromParent) {
  426. const last = this.parent.scopes.pop();
  427. if (last && last !== this) {
  428. this.parent.scopes[this.index] = last;
  429. last.index = this.index;
  430. }
  431. }
  432. this.parent = void 0;
  433. this._active = false;
  434. }
  435. }
  436. }
  437. function effectScope(detached) {
  438. return new EffectScope(detached);
  439. }
  440. function recordEffectScope(effect, scope = activeEffectScope) {
  441. if (scope && scope.active) {
  442. scope.effects.push(effect);
  443. }
  444. }
  445. function getCurrentScope() {
  446. return activeEffectScope;
  447. }
  448. function onScopeDispose(fn) {
  449. if (activeEffectScope) {
  450. activeEffectScope.cleanups.push(fn);
  451. } else {
  452. warn$2(
  453. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  454. );
  455. }
  456. }
  457. let activeEffect;
  458. class ReactiveEffect {
  459. constructor(fn, trigger, scheduler, scope) {
  460. this.fn = fn;
  461. this.trigger = trigger;
  462. this.scheduler = scheduler;
  463. this.active = true;
  464. this.deps = [];
  465. /**
  466. * @internal
  467. */
  468. this._dirtyLevel = 4;
  469. /**
  470. * @internal
  471. */
  472. this._trackId = 0;
  473. /**
  474. * @internal
  475. */
  476. this._runnings = 0;
  477. /**
  478. * @internal
  479. */
  480. this._shouldSchedule = false;
  481. /**
  482. * @internal
  483. */
  484. this._depsLength = 0;
  485. recordEffectScope(this, scope);
  486. }
  487. get dirty() {
  488. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  489. this._dirtyLevel = 1;
  490. pauseTracking();
  491. for (let i = 0; i < this._depsLength; i++) {
  492. const dep = this.deps[i];
  493. if (dep.computed) {
  494. triggerComputed(dep.computed);
  495. if (this._dirtyLevel >= 4) {
  496. break;
  497. }
  498. }
  499. }
  500. if (this._dirtyLevel === 1) {
  501. this._dirtyLevel = 0;
  502. }
  503. resetTracking();
  504. }
  505. return this._dirtyLevel >= 4;
  506. }
  507. set dirty(v) {
  508. this._dirtyLevel = v ? 4 : 0;
  509. }
  510. run() {
  511. this._dirtyLevel = 0;
  512. if (!this.active) {
  513. return this.fn();
  514. }
  515. let lastShouldTrack = shouldTrack;
  516. let lastEffect = activeEffect;
  517. try {
  518. shouldTrack = true;
  519. activeEffect = this;
  520. this._runnings++;
  521. preCleanupEffect(this);
  522. return this.fn();
  523. } finally {
  524. postCleanupEffect(this);
  525. this._runnings--;
  526. activeEffect = lastEffect;
  527. shouldTrack = lastShouldTrack;
  528. }
  529. }
  530. stop() {
  531. var _a;
  532. if (this.active) {
  533. preCleanupEffect(this);
  534. postCleanupEffect(this);
  535. (_a = this.onStop) == null ? void 0 : _a.call(this);
  536. this.active = false;
  537. }
  538. }
  539. }
  540. function triggerComputed(computed) {
  541. return computed.value;
  542. }
  543. function preCleanupEffect(effect2) {
  544. effect2._trackId++;
  545. effect2._depsLength = 0;
  546. }
  547. function postCleanupEffect(effect2) {
  548. if (effect2.deps.length > effect2._depsLength) {
  549. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  550. cleanupDepEffect(effect2.deps[i], effect2);
  551. }
  552. effect2.deps.length = effect2._depsLength;
  553. }
  554. }
  555. function cleanupDepEffect(dep, effect2) {
  556. const trackId = dep.get(effect2);
  557. if (trackId !== void 0 && effect2._trackId !== trackId) {
  558. dep.delete(effect2);
  559. if (dep.size === 0) {
  560. dep.cleanup();
  561. }
  562. }
  563. }
  564. function effect(fn, options) {
  565. if (fn.effect instanceof ReactiveEffect) {
  566. fn = fn.effect.fn;
  567. }
  568. const _effect = new ReactiveEffect(fn, NOOP, () => {
  569. if (_effect.dirty) {
  570. _effect.run();
  571. }
  572. });
  573. if (options) {
  574. extend(_effect, options);
  575. if (options.scope)
  576. recordEffectScope(_effect, options.scope);
  577. }
  578. if (!options || !options.lazy) {
  579. _effect.run();
  580. }
  581. const runner = _effect.run.bind(_effect);
  582. runner.effect = _effect;
  583. return runner;
  584. }
  585. function stop(runner) {
  586. runner.effect.stop();
  587. }
  588. let shouldTrack = true;
  589. let pauseScheduleStack = 0;
  590. const trackStack = [];
  591. function pauseTracking() {
  592. trackStack.push(shouldTrack);
  593. shouldTrack = false;
  594. }
  595. function resetTracking() {
  596. const last = trackStack.pop();
  597. shouldTrack = last === void 0 ? true : last;
  598. }
  599. function pauseScheduling() {
  600. pauseScheduleStack++;
  601. }
  602. function resetScheduling() {
  603. pauseScheduleStack--;
  604. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  605. queueEffectSchedulers.shift()();
  606. }
  607. }
  608. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  609. var _a;
  610. if (dep.get(effect2) !== effect2._trackId) {
  611. dep.set(effect2, effect2._trackId);
  612. const oldDep = effect2.deps[effect2._depsLength];
  613. if (oldDep !== dep) {
  614. if (oldDep) {
  615. cleanupDepEffect(oldDep, effect2);
  616. }
  617. effect2.deps[effect2._depsLength++] = dep;
  618. } else {
  619. effect2._depsLength++;
  620. }
  621. {
  622. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  623. }
  624. }
  625. }
  626. const queueEffectSchedulers = [];
  627. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  628. var _a;
  629. pauseScheduling();
  630. for (const effect2 of dep.keys()) {
  631. let tracking;
  632. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  633. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  634. effect2._dirtyLevel = dirtyLevel;
  635. }
  636. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  637. {
  638. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  639. }
  640. effect2.trigger();
  641. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  642. effect2._shouldSchedule = false;
  643. if (effect2.scheduler) {
  644. queueEffectSchedulers.push(effect2.scheduler);
  645. }
  646. }
  647. }
  648. }
  649. resetScheduling();
  650. }
  651. const createDep = (cleanup, computed) => {
  652. const dep = /* @__PURE__ */ new Map();
  653. dep.cleanup = cleanup;
  654. dep.computed = computed;
  655. return dep;
  656. };
  657. const targetMap = /* @__PURE__ */ new WeakMap();
  658. const ITERATE_KEY = Symbol("iterate" );
  659. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  660. function track(target, type, key) {
  661. if (shouldTrack && activeEffect) {
  662. let depsMap = targetMap.get(target);
  663. if (!depsMap) {
  664. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  665. }
  666. let dep = depsMap.get(key);
  667. if (!dep) {
  668. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  669. }
  670. trackEffect(
  671. activeEffect,
  672. dep,
  673. {
  674. target,
  675. type,
  676. key
  677. }
  678. );
  679. }
  680. }
  681. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  682. const depsMap = targetMap.get(target);
  683. if (!depsMap) {
  684. return;
  685. }
  686. let deps = [];
  687. if (type === "clear") {
  688. deps = [...depsMap.values()];
  689. } else if (key === "length" && isArray(target)) {
  690. const newLength = Number(newValue);
  691. depsMap.forEach((dep, key2) => {
  692. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  693. deps.push(dep);
  694. }
  695. });
  696. } else {
  697. if (key !== void 0) {
  698. deps.push(depsMap.get(key));
  699. }
  700. switch (type) {
  701. case "add":
  702. if (!isArray(target)) {
  703. deps.push(depsMap.get(ITERATE_KEY));
  704. if (isMap(target)) {
  705. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  706. }
  707. } else if (isIntegerKey(key)) {
  708. deps.push(depsMap.get("length"));
  709. }
  710. break;
  711. case "delete":
  712. if (!isArray(target)) {
  713. deps.push(depsMap.get(ITERATE_KEY));
  714. if (isMap(target)) {
  715. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  716. }
  717. }
  718. break;
  719. case "set":
  720. if (isMap(target)) {
  721. deps.push(depsMap.get(ITERATE_KEY));
  722. }
  723. break;
  724. }
  725. }
  726. pauseScheduling();
  727. for (const dep of deps) {
  728. if (dep) {
  729. triggerEffects(
  730. dep,
  731. 4,
  732. {
  733. target,
  734. type,
  735. key,
  736. newValue,
  737. oldValue,
  738. oldTarget
  739. }
  740. );
  741. }
  742. }
  743. resetScheduling();
  744. }
  745. function getDepFromReactive(object, key) {
  746. var _a;
  747. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  748. }
  749. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  750. const builtInSymbols = new Set(
  751. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  752. );
  753. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  754. function createArrayInstrumentations() {
  755. const instrumentations = {};
  756. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  757. instrumentations[key] = function(...args) {
  758. const arr = toRaw(this);
  759. for (let i = 0, l = this.length; i < l; i++) {
  760. track(arr, "get", i + "");
  761. }
  762. const res = arr[key](...args);
  763. if (res === -1 || res === false) {
  764. return arr[key](...args.map(toRaw));
  765. } else {
  766. return res;
  767. }
  768. };
  769. });
  770. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  771. instrumentations[key] = function(...args) {
  772. pauseTracking();
  773. pauseScheduling();
  774. const res = toRaw(this)[key].apply(this, args);
  775. resetScheduling();
  776. resetTracking();
  777. return res;
  778. };
  779. });
  780. return instrumentations;
  781. }
  782. function hasOwnProperty(key) {
  783. if (!isSymbol(key))
  784. key = String(key);
  785. const obj = toRaw(this);
  786. track(obj, "has", key);
  787. return obj.hasOwnProperty(key);
  788. }
  789. class BaseReactiveHandler {
  790. constructor(_isReadonly = false, _isShallow = false) {
  791. this._isReadonly = _isReadonly;
  792. this._isShallow = _isShallow;
  793. }
  794. get(target, key, receiver) {
  795. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  796. if (key === "__v_isReactive") {
  797. return !isReadonly2;
  798. } else if (key === "__v_isReadonly") {
  799. return isReadonly2;
  800. } else if (key === "__v_isShallow") {
  801. return isShallow2;
  802. } else if (key === "__v_raw") {
  803. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  804. // this means the reciever is a user proxy of the reactive proxy
  805. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  806. return target;
  807. }
  808. return;
  809. }
  810. const targetIsArray = isArray(target);
  811. if (!isReadonly2) {
  812. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  813. return Reflect.get(arrayInstrumentations, key, receiver);
  814. }
  815. if (key === "hasOwnProperty") {
  816. return hasOwnProperty;
  817. }
  818. }
  819. const res = Reflect.get(target, key, receiver);
  820. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  821. return res;
  822. }
  823. if (!isReadonly2) {
  824. track(target, "get", key);
  825. }
  826. if (isShallow2) {
  827. return res;
  828. }
  829. if (isRef(res)) {
  830. return targetIsArray && isIntegerKey(key) ? res : res.value;
  831. }
  832. if (isObject(res)) {
  833. return isReadonly2 ? readonly(res) : reactive(res);
  834. }
  835. return res;
  836. }
  837. }
  838. class MutableReactiveHandler extends BaseReactiveHandler {
  839. constructor(isShallow2 = false) {
  840. super(false, isShallow2);
  841. }
  842. set(target, key, value, receiver) {
  843. let oldValue = target[key];
  844. if (!this._isShallow) {
  845. const isOldValueReadonly = isReadonly(oldValue);
  846. if (!isShallow(value) && !isReadonly(value)) {
  847. oldValue = toRaw(oldValue);
  848. value = toRaw(value);
  849. }
  850. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  851. if (isOldValueReadonly) {
  852. return false;
  853. } else {
  854. oldValue.value = value;
  855. return true;
  856. }
  857. }
  858. }
  859. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  860. const result = Reflect.set(target, key, value, receiver);
  861. if (target === toRaw(receiver)) {
  862. if (!hadKey) {
  863. trigger(target, "add", key, value);
  864. } else if (hasChanged(value, oldValue)) {
  865. trigger(target, "set", key, value, oldValue);
  866. }
  867. }
  868. return result;
  869. }
  870. deleteProperty(target, key) {
  871. const hadKey = hasOwn(target, key);
  872. const oldValue = target[key];
  873. const result = Reflect.deleteProperty(target, key);
  874. if (result && hadKey) {
  875. trigger(target, "delete", key, void 0, oldValue);
  876. }
  877. return result;
  878. }
  879. has(target, key) {
  880. const result = Reflect.has(target, key);
  881. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  882. track(target, "has", key);
  883. }
  884. return result;
  885. }
  886. ownKeys(target) {
  887. track(
  888. target,
  889. "iterate",
  890. isArray(target) ? "length" : ITERATE_KEY
  891. );
  892. return Reflect.ownKeys(target);
  893. }
  894. }
  895. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  896. constructor(isShallow2 = false) {
  897. super(true, isShallow2);
  898. }
  899. set(target, key) {
  900. {
  901. warn$2(
  902. `Set operation on key "${String(key)}" failed: target is readonly.`,
  903. target
  904. );
  905. }
  906. return true;
  907. }
  908. deleteProperty(target, key) {
  909. {
  910. warn$2(
  911. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  912. target
  913. );
  914. }
  915. return true;
  916. }
  917. }
  918. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  919. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  920. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  921. true
  922. );
  923. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  924. const toShallow = (value) => value;
  925. const getProto = (v) => Reflect.getPrototypeOf(v);
  926. function get(target, key, isReadonly = false, isShallow = false) {
  927. target = target["__v_raw"];
  928. const rawTarget = toRaw(target);
  929. const rawKey = toRaw(key);
  930. if (!isReadonly) {
  931. if (hasChanged(key, rawKey)) {
  932. track(rawTarget, "get", key);
  933. }
  934. track(rawTarget, "get", rawKey);
  935. }
  936. const { has: has2 } = getProto(rawTarget);
  937. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  938. if (has2.call(rawTarget, key)) {
  939. return wrap(target.get(key));
  940. } else if (has2.call(rawTarget, rawKey)) {
  941. return wrap(target.get(rawKey));
  942. } else if (target !== rawTarget) {
  943. target.get(key);
  944. }
  945. }
  946. function has(key, isReadonly = false) {
  947. const target = this["__v_raw"];
  948. const rawTarget = toRaw(target);
  949. const rawKey = toRaw(key);
  950. if (!isReadonly) {
  951. if (hasChanged(key, rawKey)) {
  952. track(rawTarget, "has", key);
  953. }
  954. track(rawTarget, "has", rawKey);
  955. }
  956. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  957. }
  958. function size(target, isReadonly = false) {
  959. target = target["__v_raw"];
  960. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  961. return Reflect.get(target, "size", target);
  962. }
  963. function add(value) {
  964. value = toRaw(value);
  965. const target = toRaw(this);
  966. const proto = getProto(target);
  967. const hadKey = proto.has.call(target, value);
  968. if (!hadKey) {
  969. target.add(value);
  970. trigger(target, "add", value, value);
  971. }
  972. return this;
  973. }
  974. function set(key, value) {
  975. value = toRaw(value);
  976. const target = toRaw(this);
  977. const { has: has2, get: get2 } = getProto(target);
  978. let hadKey = has2.call(target, key);
  979. if (!hadKey) {
  980. key = toRaw(key);
  981. hadKey = has2.call(target, key);
  982. } else {
  983. checkIdentityKeys(target, has2, key);
  984. }
  985. const oldValue = get2.call(target, key);
  986. target.set(key, value);
  987. if (!hadKey) {
  988. trigger(target, "add", key, value);
  989. } else if (hasChanged(value, oldValue)) {
  990. trigger(target, "set", key, value, oldValue);
  991. }
  992. return this;
  993. }
  994. function deleteEntry(key) {
  995. const target = toRaw(this);
  996. const { has: has2, get: get2 } = getProto(target);
  997. let hadKey = has2.call(target, key);
  998. if (!hadKey) {
  999. key = toRaw(key);
  1000. hadKey = has2.call(target, key);
  1001. } else {
  1002. checkIdentityKeys(target, has2, key);
  1003. }
  1004. const oldValue = get2 ? get2.call(target, key) : void 0;
  1005. const result = target.delete(key);
  1006. if (hadKey) {
  1007. trigger(target, "delete", key, void 0, oldValue);
  1008. }
  1009. return result;
  1010. }
  1011. function clear() {
  1012. const target = toRaw(this);
  1013. const hadItems = target.size !== 0;
  1014. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1015. const result = target.clear();
  1016. if (hadItems) {
  1017. trigger(target, "clear", void 0, void 0, oldTarget);
  1018. }
  1019. return result;
  1020. }
  1021. function createForEach(isReadonly, isShallow) {
  1022. return function forEach(callback, thisArg) {
  1023. const observed = this;
  1024. const target = observed["__v_raw"];
  1025. const rawTarget = toRaw(target);
  1026. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  1027. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  1028. return target.forEach((value, key) => {
  1029. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1030. });
  1031. };
  1032. }
  1033. function createIterableMethod(method, isReadonly, isShallow) {
  1034. return function(...args) {
  1035. const target = this["__v_raw"];
  1036. const rawTarget = toRaw(target);
  1037. const targetIsMap = isMap(rawTarget);
  1038. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1039. const isKeyOnly = method === "keys" && targetIsMap;
  1040. const innerIterator = target[method](...args);
  1041. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  1042. !isReadonly && track(
  1043. rawTarget,
  1044. "iterate",
  1045. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1046. );
  1047. return {
  1048. // iterator protocol
  1049. next() {
  1050. const { value, done } = innerIterator.next();
  1051. return done ? { value, done } : {
  1052. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1053. done
  1054. };
  1055. },
  1056. // iterable protocol
  1057. [Symbol.iterator]() {
  1058. return this;
  1059. }
  1060. };
  1061. };
  1062. }
  1063. function createReadonlyMethod(type) {
  1064. return function(...args) {
  1065. {
  1066. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1067. warn$2(
  1068. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1069. toRaw(this)
  1070. );
  1071. }
  1072. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1073. };
  1074. }
  1075. function createInstrumentations() {
  1076. const mutableInstrumentations2 = {
  1077. get(key) {
  1078. return get(this, key);
  1079. },
  1080. get size() {
  1081. return size(this);
  1082. },
  1083. has,
  1084. add,
  1085. set,
  1086. delete: deleteEntry,
  1087. clear,
  1088. forEach: createForEach(false, false)
  1089. };
  1090. const shallowInstrumentations2 = {
  1091. get(key) {
  1092. return get(this, key, false, true);
  1093. },
  1094. get size() {
  1095. return size(this);
  1096. },
  1097. has,
  1098. add,
  1099. set,
  1100. delete: deleteEntry,
  1101. clear,
  1102. forEach: createForEach(false, true)
  1103. };
  1104. const readonlyInstrumentations2 = {
  1105. get(key) {
  1106. return get(this, key, true);
  1107. },
  1108. get size() {
  1109. return size(this, true);
  1110. },
  1111. has(key) {
  1112. return has.call(this, key, true);
  1113. },
  1114. add: createReadonlyMethod("add"),
  1115. set: createReadonlyMethod("set"),
  1116. delete: createReadonlyMethod("delete"),
  1117. clear: createReadonlyMethod("clear"),
  1118. forEach: createForEach(true, false)
  1119. };
  1120. const shallowReadonlyInstrumentations2 = {
  1121. get(key) {
  1122. return get(this, key, true, true);
  1123. },
  1124. get size() {
  1125. return size(this, true);
  1126. },
  1127. has(key) {
  1128. return has.call(this, key, true);
  1129. },
  1130. add: createReadonlyMethod("add"),
  1131. set: createReadonlyMethod("set"),
  1132. delete: createReadonlyMethod("delete"),
  1133. clear: createReadonlyMethod("clear"),
  1134. forEach: createForEach(true, true)
  1135. };
  1136. const iteratorMethods = [
  1137. "keys",
  1138. "values",
  1139. "entries",
  1140. Symbol.iterator
  1141. ];
  1142. iteratorMethods.forEach((method) => {
  1143. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1144. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1145. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1146. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1147. method,
  1148. true,
  1149. true
  1150. );
  1151. });
  1152. return [
  1153. mutableInstrumentations2,
  1154. readonlyInstrumentations2,
  1155. shallowInstrumentations2,
  1156. shallowReadonlyInstrumentations2
  1157. ];
  1158. }
  1159. const [
  1160. mutableInstrumentations,
  1161. readonlyInstrumentations,
  1162. shallowInstrumentations,
  1163. shallowReadonlyInstrumentations
  1164. ] = /* @__PURE__ */ createInstrumentations();
  1165. function createInstrumentationGetter(isReadonly, shallow) {
  1166. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1167. return (target, key, receiver) => {
  1168. if (key === "__v_isReactive") {
  1169. return !isReadonly;
  1170. } else if (key === "__v_isReadonly") {
  1171. return isReadonly;
  1172. } else if (key === "__v_raw") {
  1173. return target;
  1174. }
  1175. return Reflect.get(
  1176. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1177. key,
  1178. receiver
  1179. );
  1180. };
  1181. }
  1182. const mutableCollectionHandlers = {
  1183. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1184. };
  1185. const shallowCollectionHandlers = {
  1186. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1187. };
  1188. const readonlyCollectionHandlers = {
  1189. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1190. };
  1191. const shallowReadonlyCollectionHandlers = {
  1192. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1193. };
  1194. function checkIdentityKeys(target, has2, key) {
  1195. const rawKey = toRaw(key);
  1196. if (rawKey !== key && has2.call(target, rawKey)) {
  1197. const type = toRawType(target);
  1198. warn$2(
  1199. `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.`
  1200. );
  1201. }
  1202. }
  1203. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1204. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1205. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1206. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1207. function targetTypeMap(rawType) {
  1208. switch (rawType) {
  1209. case "Object":
  1210. case "Array":
  1211. return 1 /* COMMON */;
  1212. case "Map":
  1213. case "Set":
  1214. case "WeakMap":
  1215. case "WeakSet":
  1216. return 2 /* COLLECTION */;
  1217. default:
  1218. return 0 /* INVALID */;
  1219. }
  1220. }
  1221. function getTargetType(value) {
  1222. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1223. }
  1224. function reactive(target) {
  1225. if (isReadonly(target)) {
  1226. return target;
  1227. }
  1228. return createReactiveObject(
  1229. target,
  1230. false,
  1231. mutableHandlers,
  1232. mutableCollectionHandlers,
  1233. reactiveMap
  1234. );
  1235. }
  1236. function shallowReactive(target) {
  1237. return createReactiveObject(
  1238. target,
  1239. false,
  1240. shallowReactiveHandlers,
  1241. shallowCollectionHandlers,
  1242. shallowReactiveMap
  1243. );
  1244. }
  1245. function readonly(target) {
  1246. return createReactiveObject(
  1247. target,
  1248. true,
  1249. readonlyHandlers,
  1250. readonlyCollectionHandlers,
  1251. readonlyMap
  1252. );
  1253. }
  1254. function shallowReadonly(target) {
  1255. return createReactiveObject(
  1256. target,
  1257. true,
  1258. shallowReadonlyHandlers,
  1259. shallowReadonlyCollectionHandlers,
  1260. shallowReadonlyMap
  1261. );
  1262. }
  1263. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1264. if (!isObject(target)) {
  1265. {
  1266. warn$2(`value cannot be made reactive: ${String(target)}`);
  1267. }
  1268. return target;
  1269. }
  1270. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1271. return target;
  1272. }
  1273. const existingProxy = proxyMap.get(target);
  1274. if (existingProxy) {
  1275. return existingProxy;
  1276. }
  1277. const targetType = getTargetType(target);
  1278. if (targetType === 0 /* INVALID */) {
  1279. return target;
  1280. }
  1281. const proxy = new Proxy(
  1282. target,
  1283. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1284. );
  1285. proxyMap.set(target, proxy);
  1286. return proxy;
  1287. }
  1288. function isReactive(value) {
  1289. if (isReadonly(value)) {
  1290. return isReactive(value["__v_raw"]);
  1291. }
  1292. return !!(value && value["__v_isReactive"]);
  1293. }
  1294. function isReadonly(value) {
  1295. return !!(value && value["__v_isReadonly"]);
  1296. }
  1297. function isShallow(value) {
  1298. return !!(value && value["__v_isShallow"]);
  1299. }
  1300. function isProxy(value) {
  1301. return value ? !!value["__v_raw"] : false;
  1302. }
  1303. function toRaw(observed) {
  1304. const raw = observed && observed["__v_raw"];
  1305. return raw ? toRaw(raw) : observed;
  1306. }
  1307. function markRaw(value) {
  1308. if (Object.isExtensible(value)) {
  1309. def(value, "__v_skip", true);
  1310. }
  1311. return value;
  1312. }
  1313. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1314. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1315. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1316. class ComputedRefImpl {
  1317. constructor(getter, _setter, isReadonly, isSSR) {
  1318. this.getter = getter;
  1319. this._setter = _setter;
  1320. this.dep = void 0;
  1321. this.__v_isRef = true;
  1322. this["__v_isReadonly"] = false;
  1323. this.effect = new ReactiveEffect(
  1324. () => getter(this._value),
  1325. () => triggerRefValue(
  1326. this,
  1327. this.effect._dirtyLevel === 2 ? 2 : 3
  1328. )
  1329. );
  1330. this.effect.computed = this;
  1331. this.effect.active = this._cacheable = !isSSR;
  1332. this["__v_isReadonly"] = isReadonly;
  1333. }
  1334. get value() {
  1335. const self = toRaw(this);
  1336. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1337. triggerRefValue(self, 4);
  1338. }
  1339. trackRefValue(self);
  1340. if (self.effect._dirtyLevel >= 2) {
  1341. if (this._warnRecursive) {
  1342. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1343. getter: `, this.getter);
  1344. }
  1345. triggerRefValue(self, 2);
  1346. }
  1347. return self._value;
  1348. }
  1349. set value(newValue) {
  1350. this._setter(newValue);
  1351. }
  1352. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1353. get _dirty() {
  1354. return this.effect.dirty;
  1355. }
  1356. set _dirty(v) {
  1357. this.effect.dirty = v;
  1358. }
  1359. // #endregion
  1360. }
  1361. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1362. let getter;
  1363. let setter;
  1364. const onlyGetter = isFunction(getterOrOptions);
  1365. if (onlyGetter) {
  1366. getter = getterOrOptions;
  1367. setter = () => {
  1368. warn$2("Write operation failed: computed value is readonly");
  1369. } ;
  1370. } else {
  1371. getter = getterOrOptions.get;
  1372. setter = getterOrOptions.set;
  1373. }
  1374. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1375. if (debugOptions && !isSSR) {
  1376. cRef.effect.onTrack = debugOptions.onTrack;
  1377. cRef.effect.onTrigger = debugOptions.onTrigger;
  1378. }
  1379. return cRef;
  1380. }
  1381. function trackRefValue(ref2) {
  1382. var _a;
  1383. if (shouldTrack && activeEffect) {
  1384. ref2 = toRaw(ref2);
  1385. trackEffect(
  1386. activeEffect,
  1387. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1388. () => ref2.dep = void 0,
  1389. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1390. ),
  1391. {
  1392. target: ref2,
  1393. type: "get",
  1394. key: "value"
  1395. }
  1396. );
  1397. }
  1398. }
  1399. function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
  1400. ref2 = toRaw(ref2);
  1401. const dep = ref2.dep;
  1402. if (dep) {
  1403. triggerEffects(
  1404. dep,
  1405. dirtyLevel,
  1406. {
  1407. target: ref2,
  1408. type: "set",
  1409. key: "value",
  1410. newValue: newVal
  1411. }
  1412. );
  1413. }
  1414. }
  1415. function isRef(r) {
  1416. return !!(r && r.__v_isRef === true);
  1417. }
  1418. function ref(value) {
  1419. return createRef(value, false);
  1420. }
  1421. function shallowRef(value) {
  1422. return createRef(value, true);
  1423. }
  1424. function createRef(rawValue, shallow) {
  1425. if (isRef(rawValue)) {
  1426. return rawValue;
  1427. }
  1428. return new RefImpl(rawValue, shallow);
  1429. }
  1430. class RefImpl {
  1431. constructor(value, __v_isShallow) {
  1432. this.__v_isShallow = __v_isShallow;
  1433. this.dep = void 0;
  1434. this.__v_isRef = true;
  1435. this._rawValue = __v_isShallow ? value : toRaw(value);
  1436. this._value = __v_isShallow ? value : toReactive(value);
  1437. }
  1438. get value() {
  1439. trackRefValue(this);
  1440. return this._value;
  1441. }
  1442. set value(newVal) {
  1443. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1444. newVal = useDirectValue ? newVal : toRaw(newVal);
  1445. if (hasChanged(newVal, this._rawValue)) {
  1446. this._rawValue = newVal;
  1447. this._value = useDirectValue ? newVal : toReactive(newVal);
  1448. triggerRefValue(this, 4, newVal);
  1449. }
  1450. }
  1451. }
  1452. function triggerRef(ref2) {
  1453. triggerRefValue(ref2, 4, ref2.value );
  1454. }
  1455. function unref(ref2) {
  1456. return isRef(ref2) ? ref2.value : ref2;
  1457. }
  1458. function toValue(source) {
  1459. return isFunction(source) ? source() : unref(source);
  1460. }
  1461. const shallowUnwrapHandlers = {
  1462. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1463. set: (target, key, value, receiver) => {
  1464. const oldValue = target[key];
  1465. if (isRef(oldValue) && !isRef(value)) {
  1466. oldValue.value = value;
  1467. return true;
  1468. } else {
  1469. return Reflect.set(target, key, value, receiver);
  1470. }
  1471. }
  1472. };
  1473. function proxyRefs(objectWithRefs) {
  1474. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1475. }
  1476. class CustomRefImpl {
  1477. constructor(factory) {
  1478. this.dep = void 0;
  1479. this.__v_isRef = true;
  1480. const { get, set } = factory(
  1481. () => trackRefValue(this),
  1482. () => triggerRefValue(this)
  1483. );
  1484. this._get = get;
  1485. this._set = set;
  1486. }
  1487. get value() {
  1488. return this._get();
  1489. }
  1490. set value(newVal) {
  1491. this._set(newVal);
  1492. }
  1493. }
  1494. function customRef(factory) {
  1495. return new CustomRefImpl(factory);
  1496. }
  1497. function toRefs(object) {
  1498. if (!isProxy(object)) {
  1499. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1500. }
  1501. const ret = isArray(object) ? new Array(object.length) : {};
  1502. for (const key in object) {
  1503. ret[key] = propertyToRef(object, key);
  1504. }
  1505. return ret;
  1506. }
  1507. class ObjectRefImpl {
  1508. constructor(_object, _key, _defaultValue) {
  1509. this._object = _object;
  1510. this._key = _key;
  1511. this._defaultValue = _defaultValue;
  1512. this.__v_isRef = true;
  1513. }
  1514. get value() {
  1515. const val = this._object[this._key];
  1516. return val === void 0 ? this._defaultValue : val;
  1517. }
  1518. set value(newVal) {
  1519. this._object[this._key] = newVal;
  1520. }
  1521. get dep() {
  1522. return getDepFromReactive(toRaw(this._object), this._key);
  1523. }
  1524. }
  1525. class GetterRefImpl {
  1526. constructor(_getter) {
  1527. this._getter = _getter;
  1528. this.__v_isRef = true;
  1529. this.__v_isReadonly = true;
  1530. }
  1531. get value() {
  1532. return this._getter();
  1533. }
  1534. }
  1535. function toRef(source, key, defaultValue) {
  1536. if (isRef(source)) {
  1537. return source;
  1538. } else if (isFunction(source)) {
  1539. return new GetterRefImpl(source);
  1540. } else if (isObject(source) && arguments.length > 1) {
  1541. return propertyToRef(source, key, defaultValue);
  1542. } else {
  1543. return ref(source);
  1544. }
  1545. }
  1546. function propertyToRef(source, key, defaultValue) {
  1547. const val = source[key];
  1548. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1549. }
  1550. const TrackOpTypes = {
  1551. "GET": "get",
  1552. "HAS": "has",
  1553. "ITERATE": "iterate"
  1554. };
  1555. const TriggerOpTypes = {
  1556. "SET": "set",
  1557. "ADD": "add",
  1558. "DELETE": "delete",
  1559. "CLEAR": "clear"
  1560. };
  1561. const stack$1 = [];
  1562. function pushWarningContext(vnode) {
  1563. stack$1.push(vnode);
  1564. }
  1565. function popWarningContext() {
  1566. stack$1.pop();
  1567. }
  1568. function warn$1(msg, ...args) {
  1569. pauseTracking();
  1570. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1571. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1572. const trace = getComponentTrace();
  1573. if (appWarnHandler) {
  1574. callWithErrorHandling(
  1575. appWarnHandler,
  1576. instance,
  1577. 11,
  1578. [
  1579. msg + args.map((a) => {
  1580. var _a, _b;
  1581. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1582. }).join(""),
  1583. instance && instance.proxy,
  1584. trace.map(
  1585. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1586. ).join("\n"),
  1587. trace
  1588. ]
  1589. );
  1590. } else {
  1591. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1592. if (trace.length && // avoid spamming console during tests
  1593. true) {
  1594. warnArgs.push(`
  1595. `, ...formatTrace(trace));
  1596. }
  1597. console.warn(...warnArgs);
  1598. }
  1599. resetTracking();
  1600. }
  1601. function getComponentTrace() {
  1602. let currentVNode = stack$1[stack$1.length - 1];
  1603. if (!currentVNode) {
  1604. return [];
  1605. }
  1606. const normalizedStack = [];
  1607. while (currentVNode) {
  1608. const last = normalizedStack[0];
  1609. if (last && last.vnode === currentVNode) {
  1610. last.recurseCount++;
  1611. } else {
  1612. normalizedStack.push({
  1613. vnode: currentVNode,
  1614. recurseCount: 0
  1615. });
  1616. }
  1617. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1618. currentVNode = parentInstance && parentInstance.vnode;
  1619. }
  1620. return normalizedStack;
  1621. }
  1622. function formatTrace(trace) {
  1623. const logs = [];
  1624. trace.forEach((entry, i) => {
  1625. logs.push(...i === 0 ? [] : [`
  1626. `], ...formatTraceEntry(entry));
  1627. });
  1628. return logs;
  1629. }
  1630. function formatTraceEntry({ vnode, recurseCount }) {
  1631. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1632. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1633. const open = ` at <${formatComponentName(
  1634. vnode.component,
  1635. vnode.type,
  1636. isRoot
  1637. )}`;
  1638. const close = `>` + postfix;
  1639. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1640. }
  1641. function formatProps(props) {
  1642. const res = [];
  1643. const keys = Object.keys(props);
  1644. keys.slice(0, 3).forEach((key) => {
  1645. res.push(...formatProp(key, props[key]));
  1646. });
  1647. if (keys.length > 3) {
  1648. res.push(` ...`);
  1649. }
  1650. return res;
  1651. }
  1652. function formatProp(key, value, raw) {
  1653. if (isString(value)) {
  1654. value = JSON.stringify(value);
  1655. return raw ? value : [`${key}=${value}`];
  1656. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1657. return raw ? value : [`${key}=${value}`];
  1658. } else if (isRef(value)) {
  1659. value = formatProp(key, toRaw(value.value), true);
  1660. return raw ? value : [`${key}=Ref<`, value, `>`];
  1661. } else if (isFunction(value)) {
  1662. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1663. } else {
  1664. value = toRaw(value);
  1665. return raw ? value : [`${key}=`, value];
  1666. }
  1667. }
  1668. function assertNumber(val, type) {
  1669. if (val === void 0) {
  1670. return;
  1671. } else if (typeof val !== "number") {
  1672. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1673. } else if (isNaN(val)) {
  1674. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  1675. }
  1676. }
  1677. const ErrorCodes = {
  1678. "SETUP_FUNCTION": 0,
  1679. "0": "SETUP_FUNCTION",
  1680. "RENDER_FUNCTION": 1,
  1681. "1": "RENDER_FUNCTION",
  1682. "WATCH_GETTER": 2,
  1683. "2": "WATCH_GETTER",
  1684. "WATCH_CALLBACK": 3,
  1685. "3": "WATCH_CALLBACK",
  1686. "WATCH_CLEANUP": 4,
  1687. "4": "WATCH_CLEANUP",
  1688. "NATIVE_EVENT_HANDLER": 5,
  1689. "5": "NATIVE_EVENT_HANDLER",
  1690. "COMPONENT_EVENT_HANDLER": 6,
  1691. "6": "COMPONENT_EVENT_HANDLER",
  1692. "VNODE_HOOK": 7,
  1693. "7": "VNODE_HOOK",
  1694. "DIRECTIVE_HOOK": 8,
  1695. "8": "DIRECTIVE_HOOK",
  1696. "TRANSITION_HOOK": 9,
  1697. "9": "TRANSITION_HOOK",
  1698. "APP_ERROR_HANDLER": 10,
  1699. "10": "APP_ERROR_HANDLER",
  1700. "APP_WARN_HANDLER": 11,
  1701. "11": "APP_WARN_HANDLER",
  1702. "FUNCTION_REF": 12,
  1703. "12": "FUNCTION_REF",
  1704. "ASYNC_COMPONENT_LOADER": 13,
  1705. "13": "ASYNC_COMPONENT_LOADER",
  1706. "SCHEDULER": 14,
  1707. "14": "SCHEDULER"
  1708. };
  1709. const ErrorTypeStrings$1 = {
  1710. ["sp"]: "serverPrefetch hook",
  1711. ["bc"]: "beforeCreate hook",
  1712. ["c"]: "created hook",
  1713. ["bm"]: "beforeMount hook",
  1714. ["m"]: "mounted hook",
  1715. ["bu"]: "beforeUpdate hook",
  1716. ["u"]: "updated",
  1717. ["bum"]: "beforeUnmount hook",
  1718. ["um"]: "unmounted hook",
  1719. ["a"]: "activated hook",
  1720. ["da"]: "deactivated hook",
  1721. ["ec"]: "errorCaptured hook",
  1722. ["rtc"]: "renderTracked hook",
  1723. ["rtg"]: "renderTriggered hook",
  1724. [0]: "setup function",
  1725. [1]: "render function",
  1726. [2]: "watcher getter",
  1727. [3]: "watcher callback",
  1728. [4]: "watcher cleanup function",
  1729. [5]: "native event handler",
  1730. [6]: "component event handler",
  1731. [7]: "vnode hook",
  1732. [8]: "directive hook",
  1733. [9]: "transition hook",
  1734. [10]: "app errorHandler",
  1735. [11]: "app warnHandler",
  1736. [12]: "ref function",
  1737. [13]: "async component loader",
  1738. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  1739. };
  1740. function callWithErrorHandling(fn, instance, type, args) {
  1741. try {
  1742. return args ? fn(...args) : fn();
  1743. } catch (err) {
  1744. handleError(err, instance, type);
  1745. }
  1746. }
  1747. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1748. if (isFunction(fn)) {
  1749. const res = callWithErrorHandling(fn, instance, type, args);
  1750. if (res && isPromise(res)) {
  1751. res.catch((err) => {
  1752. handleError(err, instance, type);
  1753. });
  1754. }
  1755. return res;
  1756. }
  1757. if (isArray(fn)) {
  1758. const values = [];
  1759. for (let i = 0; i < fn.length; i++) {
  1760. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1761. }
  1762. return values;
  1763. } else {
  1764. warn$1(
  1765. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  1766. );
  1767. }
  1768. }
  1769. function handleError(err, instance, type, throwInDev = true) {
  1770. const contextVNode = instance ? instance.vnode : null;
  1771. if (instance) {
  1772. let cur = instance.parent;
  1773. const exposedInstance = instance.proxy;
  1774. const errorInfo = ErrorTypeStrings$1[type] ;
  1775. while (cur) {
  1776. const errorCapturedHooks = cur.ec;
  1777. if (errorCapturedHooks) {
  1778. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1779. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1780. return;
  1781. }
  1782. }
  1783. }
  1784. cur = cur.parent;
  1785. }
  1786. const appErrorHandler = instance.appContext.config.errorHandler;
  1787. if (appErrorHandler) {
  1788. pauseTracking();
  1789. callWithErrorHandling(
  1790. appErrorHandler,
  1791. null,
  1792. 10,
  1793. [err, exposedInstance, errorInfo]
  1794. );
  1795. resetTracking();
  1796. return;
  1797. }
  1798. }
  1799. logError(err, type, contextVNode, throwInDev);
  1800. }
  1801. function logError(err, type, contextVNode, throwInDev = true) {
  1802. {
  1803. const info = ErrorTypeStrings$1[type];
  1804. if (contextVNode) {
  1805. pushWarningContext(contextVNode);
  1806. }
  1807. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1808. if (contextVNode) {
  1809. popWarningContext();
  1810. }
  1811. if (throwInDev) {
  1812. throw err;
  1813. } else {
  1814. console.error(err);
  1815. }
  1816. }
  1817. }
  1818. let isFlushing = false;
  1819. let isFlushPending = false;
  1820. const queue = [];
  1821. let flushIndex = 0;
  1822. const pendingPostFlushCbs = [];
  1823. let activePostFlushCbs = null;
  1824. let postFlushIndex = 0;
  1825. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1826. let currentFlushPromise = null;
  1827. const RECURSION_LIMIT = 100;
  1828. function nextTick(fn) {
  1829. const p = currentFlushPromise || resolvedPromise;
  1830. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1831. }
  1832. function findInsertionIndex(id) {
  1833. let start = flushIndex + 1;
  1834. let end = queue.length;
  1835. while (start < end) {
  1836. const middle = start + end >>> 1;
  1837. const middleJob = queue[middle];
  1838. const middleJobId = getId(middleJob);
  1839. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1840. start = middle + 1;
  1841. } else {
  1842. end = middle;
  1843. }
  1844. }
  1845. return start;
  1846. }
  1847. function queueJob(job) {
  1848. if (!queue.length || !queue.includes(
  1849. job,
  1850. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1851. )) {
  1852. if (job.id == null) {
  1853. queue.push(job);
  1854. } else {
  1855. queue.splice(findInsertionIndex(job.id), 0, job);
  1856. }
  1857. queueFlush();
  1858. }
  1859. }
  1860. function queueFlush() {
  1861. if (!isFlushing && !isFlushPending) {
  1862. isFlushPending = true;
  1863. currentFlushPromise = resolvedPromise.then(flushJobs);
  1864. }
  1865. }
  1866. function invalidateJob(job) {
  1867. const i = queue.indexOf(job);
  1868. if (i > flushIndex) {
  1869. queue.splice(i, 1);
  1870. }
  1871. }
  1872. function queuePostFlushCb(cb) {
  1873. if (!isArray(cb)) {
  1874. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1875. cb,
  1876. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1877. )) {
  1878. pendingPostFlushCbs.push(cb);
  1879. }
  1880. } else {
  1881. pendingPostFlushCbs.push(...cb);
  1882. }
  1883. queueFlush();
  1884. }
  1885. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1886. {
  1887. seen = seen || /* @__PURE__ */ new Map();
  1888. }
  1889. for (; i < queue.length; i++) {
  1890. const cb = queue[i];
  1891. if (cb && cb.pre) {
  1892. if (instance && cb.id !== instance.uid) {
  1893. continue;
  1894. }
  1895. if (checkRecursiveUpdates(seen, cb)) {
  1896. continue;
  1897. }
  1898. queue.splice(i, 1);
  1899. i--;
  1900. cb();
  1901. }
  1902. }
  1903. }
  1904. function flushPostFlushCbs(seen) {
  1905. if (pendingPostFlushCbs.length) {
  1906. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1907. (a, b) => getId(a) - getId(b)
  1908. );
  1909. pendingPostFlushCbs.length = 0;
  1910. if (activePostFlushCbs) {
  1911. activePostFlushCbs.push(...deduped);
  1912. return;
  1913. }
  1914. activePostFlushCbs = deduped;
  1915. {
  1916. seen = seen || /* @__PURE__ */ new Map();
  1917. }
  1918. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1919. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1920. continue;
  1921. }
  1922. activePostFlushCbs[postFlushIndex]();
  1923. }
  1924. activePostFlushCbs = null;
  1925. postFlushIndex = 0;
  1926. }
  1927. }
  1928. const getId = (job) => job.id == null ? Infinity : job.id;
  1929. const comparator = (a, b) => {
  1930. const diff = getId(a) - getId(b);
  1931. if (diff === 0) {
  1932. if (a.pre && !b.pre)
  1933. return -1;
  1934. if (b.pre && !a.pre)
  1935. return 1;
  1936. }
  1937. return diff;
  1938. };
  1939. function flushJobs(seen) {
  1940. isFlushPending = false;
  1941. isFlushing = true;
  1942. {
  1943. seen = seen || /* @__PURE__ */ new Map();
  1944. }
  1945. queue.sort(comparator);
  1946. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1947. try {
  1948. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1949. const job = queue[flushIndex];
  1950. if (job && job.active !== false) {
  1951. if (check(job)) {
  1952. continue;
  1953. }
  1954. callWithErrorHandling(job, null, 14);
  1955. }
  1956. }
  1957. } finally {
  1958. flushIndex = 0;
  1959. queue.length = 0;
  1960. flushPostFlushCbs(seen);
  1961. isFlushing = false;
  1962. currentFlushPromise = null;
  1963. if (queue.length || pendingPostFlushCbs.length) {
  1964. flushJobs(seen);
  1965. }
  1966. }
  1967. }
  1968. function checkRecursiveUpdates(seen, fn) {
  1969. if (!seen.has(fn)) {
  1970. seen.set(fn, 1);
  1971. } else {
  1972. const count = seen.get(fn);
  1973. if (count > RECURSION_LIMIT) {
  1974. const instance = fn.ownerInstance;
  1975. const componentName = instance && getComponentName(instance.type);
  1976. handleError(
  1977. `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.`,
  1978. null,
  1979. 10
  1980. );
  1981. return true;
  1982. } else {
  1983. seen.set(fn, count + 1);
  1984. }
  1985. }
  1986. }
  1987. let isHmrUpdating = false;
  1988. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1989. {
  1990. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1991. createRecord: tryWrap(createRecord),
  1992. rerender: tryWrap(rerender),
  1993. reload: tryWrap(reload)
  1994. };
  1995. }
  1996. const map = /* @__PURE__ */ new Map();
  1997. function registerHMR(instance) {
  1998. const id = instance.type.__hmrId;
  1999. let record = map.get(id);
  2000. if (!record) {
  2001. createRecord(id, instance.type);
  2002. record = map.get(id);
  2003. }
  2004. record.instances.add(instance);
  2005. }
  2006. function unregisterHMR(instance) {
  2007. map.get(instance.type.__hmrId).instances.delete(instance);
  2008. }
  2009. function createRecord(id, initialDef) {
  2010. if (map.has(id)) {
  2011. return false;
  2012. }
  2013. map.set(id, {
  2014. initialDef: normalizeClassComponent(initialDef),
  2015. instances: /* @__PURE__ */ new Set()
  2016. });
  2017. return true;
  2018. }
  2019. function normalizeClassComponent(component) {
  2020. return isClassComponent(component) ? component.__vccOpts : component;
  2021. }
  2022. function rerender(id, newRender) {
  2023. const record = map.get(id);
  2024. if (!record) {
  2025. return;
  2026. }
  2027. record.initialDef.render = newRender;
  2028. [...record.instances].forEach((instance) => {
  2029. if (newRender) {
  2030. instance.render = newRender;
  2031. normalizeClassComponent(instance.type).render = newRender;
  2032. }
  2033. instance.renderCache = [];
  2034. isHmrUpdating = true;
  2035. instance.effect.dirty = true;
  2036. instance.update();
  2037. isHmrUpdating = false;
  2038. });
  2039. }
  2040. function reload(id, newComp) {
  2041. const record = map.get(id);
  2042. if (!record)
  2043. return;
  2044. newComp = normalizeClassComponent(newComp);
  2045. updateComponentDef(record.initialDef, newComp);
  2046. const instances = [...record.instances];
  2047. for (const instance of instances) {
  2048. const oldComp = normalizeClassComponent(instance.type);
  2049. if (!hmrDirtyComponents.has(oldComp)) {
  2050. if (oldComp !== record.initialDef) {
  2051. updateComponentDef(oldComp, newComp);
  2052. }
  2053. hmrDirtyComponents.add(oldComp);
  2054. }
  2055. instance.appContext.propsCache.delete(instance.type);
  2056. instance.appContext.emitsCache.delete(instance.type);
  2057. instance.appContext.optionsCache.delete(instance.type);
  2058. if (instance.ceReload) {
  2059. hmrDirtyComponents.add(oldComp);
  2060. instance.ceReload(newComp.styles);
  2061. hmrDirtyComponents.delete(oldComp);
  2062. } else if (instance.parent) {
  2063. instance.parent.effect.dirty = true;
  2064. queueJob(instance.parent.update);
  2065. } else if (instance.appContext.reload) {
  2066. instance.appContext.reload();
  2067. } else if (typeof window !== "undefined") {
  2068. window.location.reload();
  2069. } else {
  2070. console.warn(
  2071. "[HMR] Root or manually mounted instance modified. Full reload required."
  2072. );
  2073. }
  2074. }
  2075. queuePostFlushCb(() => {
  2076. for (const instance of instances) {
  2077. hmrDirtyComponents.delete(
  2078. normalizeClassComponent(instance.type)
  2079. );
  2080. }
  2081. });
  2082. }
  2083. function updateComponentDef(oldComp, newComp) {
  2084. extend(oldComp, newComp);
  2085. for (const key in oldComp) {
  2086. if (key !== "__file" && !(key in newComp)) {
  2087. delete oldComp[key];
  2088. }
  2089. }
  2090. }
  2091. function tryWrap(fn) {
  2092. return (id, arg) => {
  2093. try {
  2094. return fn(id, arg);
  2095. } catch (e) {
  2096. console.error(e);
  2097. console.warn(
  2098. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2099. );
  2100. }
  2101. };
  2102. }
  2103. let devtools$1;
  2104. let buffer = [];
  2105. let devtoolsNotInstalled = false;
  2106. function emit$1(event, ...args) {
  2107. if (devtools$1) {
  2108. devtools$1.emit(event, ...args);
  2109. } else if (!devtoolsNotInstalled) {
  2110. buffer.push({ event, args });
  2111. }
  2112. }
  2113. function setDevtoolsHook$1(hook, target) {
  2114. var _a, _b;
  2115. devtools$1 = hook;
  2116. if (devtools$1) {
  2117. devtools$1.enabled = true;
  2118. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2119. buffer = [];
  2120. } else if (
  2121. // handle late devtools injection - only do this if we are in an actual
  2122. // browser environment to avoid the timer handle stalling test runner exit
  2123. // (#4815)
  2124. typeof window !== "undefined" && // some envs mock window but not fully
  2125. window.HTMLElement && // also exclude jsdom
  2126. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2127. ) {
  2128. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2129. replay.push((newHook) => {
  2130. setDevtoolsHook$1(newHook, target);
  2131. });
  2132. setTimeout(() => {
  2133. if (!devtools$1) {
  2134. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2135. devtoolsNotInstalled = true;
  2136. buffer = [];
  2137. }
  2138. }, 3e3);
  2139. } else {
  2140. devtoolsNotInstalled = true;
  2141. buffer = [];
  2142. }
  2143. }
  2144. function devtoolsInitApp(app, version) {
  2145. emit$1("app:init" /* APP_INIT */, app, version, {
  2146. Fragment,
  2147. Text,
  2148. Comment,
  2149. Static
  2150. });
  2151. }
  2152. function devtoolsUnmountApp(app) {
  2153. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2154. }
  2155. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2156. "component:added" /* COMPONENT_ADDED */
  2157. );
  2158. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2159. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2160. "component:removed" /* COMPONENT_REMOVED */
  2161. );
  2162. const devtoolsComponentRemoved = (component) => {
  2163. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2164. !devtools$1.cleanupBuffer(component)) {
  2165. _devtoolsComponentRemoved(component);
  2166. }
  2167. };
  2168. /*! #__NO_SIDE_EFFECTS__ */
  2169. // @__NO_SIDE_EFFECTS__
  2170. function createDevtoolsComponentHook(hook) {
  2171. return (component) => {
  2172. emit$1(
  2173. hook,
  2174. component.appContext.app,
  2175. component.uid,
  2176. component.parent ? component.parent.uid : void 0,
  2177. component
  2178. );
  2179. };
  2180. }
  2181. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2182. "perf:start" /* PERFORMANCE_START */
  2183. );
  2184. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2185. "perf:end" /* PERFORMANCE_END */
  2186. );
  2187. function createDevtoolsPerformanceHook(hook) {
  2188. return (component, type, time) => {
  2189. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2190. };
  2191. }
  2192. function devtoolsComponentEmit(component, event, params) {
  2193. emit$1(
  2194. "component:emit" /* COMPONENT_EMIT */,
  2195. component.appContext.app,
  2196. component,
  2197. event,
  2198. params
  2199. );
  2200. }
  2201. function emit(instance, event, ...rawArgs) {
  2202. if (instance.isUnmounted)
  2203. return;
  2204. const props = instance.vnode.props || EMPTY_OBJ;
  2205. {
  2206. const {
  2207. emitsOptions,
  2208. propsOptions: [propsOptions]
  2209. } = instance;
  2210. if (emitsOptions) {
  2211. if (!(event in emitsOptions) && true) {
  2212. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  2213. warn$1(
  2214. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  2215. );
  2216. }
  2217. } else {
  2218. const validator = emitsOptions[event];
  2219. if (isFunction(validator)) {
  2220. const isValid = validator(...rawArgs);
  2221. if (!isValid) {
  2222. warn$1(
  2223. `Invalid event arguments: event validation failed for event "${event}".`
  2224. );
  2225. }
  2226. }
  2227. }
  2228. }
  2229. }
  2230. let args = rawArgs;
  2231. const isModelListener = event.startsWith("update:");
  2232. const modelArg = isModelListener && event.slice(7);
  2233. if (modelArg && modelArg in props) {
  2234. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2235. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  2236. if (trim) {
  2237. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2238. }
  2239. if (number) {
  2240. args = rawArgs.map(looseToNumber);
  2241. }
  2242. }
  2243. {
  2244. devtoolsComponentEmit(instance, event, args);
  2245. }
  2246. {
  2247. const lowerCaseEvent = event.toLowerCase();
  2248. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2249. warn$1(
  2250. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2251. instance,
  2252. instance.type
  2253. )} 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(
  2254. event
  2255. )}" instead of "${event}".`
  2256. );
  2257. }
  2258. }
  2259. let handlerName;
  2260. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2261. props[handlerName = toHandlerKey(camelize(event))];
  2262. if (!handler && isModelListener) {
  2263. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2264. }
  2265. if (handler) {
  2266. callWithAsyncErrorHandling(
  2267. handler,
  2268. instance,
  2269. 6,
  2270. args
  2271. );
  2272. }
  2273. const onceHandler = props[handlerName + `Once`];
  2274. if (onceHandler) {
  2275. if (!instance.emitted) {
  2276. instance.emitted = {};
  2277. } else if (instance.emitted[handlerName]) {
  2278. return;
  2279. }
  2280. instance.emitted[handlerName] = true;
  2281. callWithAsyncErrorHandling(
  2282. onceHandler,
  2283. instance,
  2284. 6,
  2285. args
  2286. );
  2287. }
  2288. }
  2289. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2290. const cache = appContext.emitsCache;
  2291. const cached = cache.get(comp);
  2292. if (cached !== void 0) {
  2293. return cached;
  2294. }
  2295. const raw = comp.emits;
  2296. let normalized = {};
  2297. let hasExtends = false;
  2298. if (!isFunction(comp)) {
  2299. const extendEmits = (raw2) => {
  2300. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2301. if (normalizedFromExtend) {
  2302. hasExtends = true;
  2303. extend(normalized, normalizedFromExtend);
  2304. }
  2305. };
  2306. if (!asMixin && appContext.mixins.length) {
  2307. appContext.mixins.forEach(extendEmits);
  2308. }
  2309. if (comp.extends) {
  2310. extendEmits(comp.extends);
  2311. }
  2312. if (comp.mixins) {
  2313. comp.mixins.forEach(extendEmits);
  2314. }
  2315. }
  2316. if (!raw && !hasExtends) {
  2317. if (isObject(comp)) {
  2318. cache.set(comp, null);
  2319. }
  2320. return null;
  2321. }
  2322. if (isArray(raw)) {
  2323. raw.forEach((key) => normalized[key] = null);
  2324. } else {
  2325. extend(normalized, raw);
  2326. }
  2327. if (isObject(comp)) {
  2328. cache.set(comp, normalized);
  2329. }
  2330. return normalized;
  2331. }
  2332. function isEmitListener(options, key) {
  2333. if (!options || !isOn(key)) {
  2334. return false;
  2335. }
  2336. key = key.slice(2).replace(/Once$/, "");
  2337. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2338. }
  2339. let currentRenderingInstance = null;
  2340. let currentScopeId = null;
  2341. function setCurrentRenderingInstance(instance) {
  2342. const prev = currentRenderingInstance;
  2343. currentRenderingInstance = instance;
  2344. currentScopeId = instance && instance.type.__scopeId || null;
  2345. return prev;
  2346. }
  2347. function pushScopeId(id) {
  2348. currentScopeId = id;
  2349. }
  2350. function popScopeId() {
  2351. currentScopeId = null;
  2352. }
  2353. const withScopeId = (_id) => withCtx;
  2354. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2355. if (!ctx)
  2356. return fn;
  2357. if (fn._n) {
  2358. return fn;
  2359. }
  2360. const renderFnWithContext = (...args) => {
  2361. if (renderFnWithContext._d) {
  2362. setBlockTracking(-1);
  2363. }
  2364. const prevInstance = setCurrentRenderingInstance(ctx);
  2365. let res;
  2366. try {
  2367. res = fn(...args);
  2368. } finally {
  2369. setCurrentRenderingInstance(prevInstance);
  2370. if (renderFnWithContext._d) {
  2371. setBlockTracking(1);
  2372. }
  2373. }
  2374. {
  2375. devtoolsComponentUpdated(ctx);
  2376. }
  2377. return res;
  2378. };
  2379. renderFnWithContext._n = true;
  2380. renderFnWithContext._c = true;
  2381. renderFnWithContext._d = true;
  2382. return renderFnWithContext;
  2383. }
  2384. let accessedAttrs = false;
  2385. function markAttrsAccessed() {
  2386. accessedAttrs = true;
  2387. }
  2388. function renderComponentRoot(instance) {
  2389. const {
  2390. type: Component,
  2391. vnode,
  2392. proxy,
  2393. withProxy,
  2394. props,
  2395. propsOptions: [propsOptions],
  2396. slots,
  2397. attrs,
  2398. emit,
  2399. render,
  2400. renderCache,
  2401. data,
  2402. setupState,
  2403. ctx,
  2404. inheritAttrs
  2405. } = instance;
  2406. let result;
  2407. let fallthroughAttrs;
  2408. const prev = setCurrentRenderingInstance(instance);
  2409. {
  2410. accessedAttrs = false;
  2411. }
  2412. try {
  2413. if (vnode.shapeFlag & 4) {
  2414. const proxyToUse = withProxy || proxy;
  2415. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  2416. get(target, key, receiver) {
  2417. warn$1(
  2418. `Property '${String(
  2419. key
  2420. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  2421. );
  2422. return Reflect.get(target, key, receiver);
  2423. }
  2424. }) : proxyToUse;
  2425. result = normalizeVNode(
  2426. render.call(
  2427. thisProxy,
  2428. proxyToUse,
  2429. renderCache,
  2430. props,
  2431. setupState,
  2432. data,
  2433. ctx
  2434. )
  2435. );
  2436. fallthroughAttrs = attrs;
  2437. } else {
  2438. const render2 = Component;
  2439. if (attrs === props) {
  2440. markAttrsAccessed();
  2441. }
  2442. result = normalizeVNode(
  2443. render2.length > 1 ? render2(
  2444. props,
  2445. true ? {
  2446. get attrs() {
  2447. markAttrsAccessed();
  2448. return attrs;
  2449. },
  2450. slots,
  2451. emit
  2452. } : { attrs, slots, emit }
  2453. ) : render2(
  2454. props,
  2455. null
  2456. /* we know it doesn't need it */
  2457. )
  2458. );
  2459. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2460. }
  2461. } catch (err) {
  2462. blockStack.length = 0;
  2463. handleError(err, instance, 1);
  2464. result = createVNode(Comment);
  2465. }
  2466. let root = result;
  2467. let setRoot = void 0;
  2468. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2469. [root, setRoot] = getChildRoot(result);
  2470. }
  2471. if (fallthroughAttrs && inheritAttrs !== false) {
  2472. const keys = Object.keys(fallthroughAttrs);
  2473. const { shapeFlag } = root;
  2474. if (keys.length) {
  2475. if (shapeFlag & (1 | 6)) {
  2476. if (propsOptions && keys.some(isModelListener)) {
  2477. fallthroughAttrs = filterModelListeners(
  2478. fallthroughAttrs,
  2479. propsOptions
  2480. );
  2481. }
  2482. root = cloneVNode(root, fallthroughAttrs);
  2483. } else if (!accessedAttrs && root.type !== Comment) {
  2484. const allAttrs = Object.keys(attrs);
  2485. const eventAttrs = [];
  2486. const extraAttrs = [];
  2487. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2488. const key = allAttrs[i];
  2489. if (isOn(key)) {
  2490. if (!isModelListener(key)) {
  2491. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2492. }
  2493. } else {
  2494. extraAttrs.push(key);
  2495. }
  2496. }
  2497. if (extraAttrs.length) {
  2498. warn$1(
  2499. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2500. );
  2501. }
  2502. if (eventAttrs.length) {
  2503. warn$1(
  2504. `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.`
  2505. );
  2506. }
  2507. }
  2508. }
  2509. }
  2510. if (vnode.dirs) {
  2511. if (!isElementRoot(root)) {
  2512. warn$1(
  2513. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2514. );
  2515. }
  2516. root = cloneVNode(root);
  2517. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2518. }
  2519. if (vnode.transition) {
  2520. if (!isElementRoot(root)) {
  2521. warn$1(
  2522. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2523. );
  2524. }
  2525. root.transition = vnode.transition;
  2526. }
  2527. if (setRoot) {
  2528. setRoot(root);
  2529. } else {
  2530. result = root;
  2531. }
  2532. setCurrentRenderingInstance(prev);
  2533. return result;
  2534. }
  2535. const getChildRoot = (vnode) => {
  2536. const rawChildren = vnode.children;
  2537. const dynamicChildren = vnode.dynamicChildren;
  2538. const childRoot = filterSingleRoot(rawChildren, false);
  2539. if (!childRoot) {
  2540. return [vnode, void 0];
  2541. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  2542. return getChildRoot(childRoot);
  2543. }
  2544. const index = rawChildren.indexOf(childRoot);
  2545. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2546. const setRoot = (updatedRoot) => {
  2547. rawChildren[index] = updatedRoot;
  2548. if (dynamicChildren) {
  2549. if (dynamicIndex > -1) {
  2550. dynamicChildren[dynamicIndex] = updatedRoot;
  2551. } else if (updatedRoot.patchFlag > 0) {
  2552. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2553. }
  2554. }
  2555. };
  2556. return [normalizeVNode(childRoot), setRoot];
  2557. };
  2558. function filterSingleRoot(children, recurse = true) {
  2559. let singleRoot;
  2560. for (let i = 0; i < children.length; i++) {
  2561. const child = children[i];
  2562. if (isVNode(child)) {
  2563. if (child.type !== Comment || child.children === "v-if") {
  2564. if (singleRoot) {
  2565. return;
  2566. } else {
  2567. singleRoot = child;
  2568. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  2569. return filterSingleRoot(singleRoot.children);
  2570. }
  2571. }
  2572. }
  2573. } else {
  2574. return;
  2575. }
  2576. }
  2577. return singleRoot;
  2578. }
  2579. const getFunctionalFallthrough = (attrs) => {
  2580. let res;
  2581. for (const key in attrs) {
  2582. if (key === "class" || key === "style" || isOn(key)) {
  2583. (res || (res = {}))[key] = attrs[key];
  2584. }
  2585. }
  2586. return res;
  2587. };
  2588. const filterModelListeners = (attrs, props) => {
  2589. const res = {};
  2590. for (const key in attrs) {
  2591. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2592. res[key] = attrs[key];
  2593. }
  2594. }
  2595. return res;
  2596. };
  2597. const isElementRoot = (vnode) => {
  2598. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2599. };
  2600. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2601. const { props: prevProps, children: prevChildren, component } = prevVNode;
  2602. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  2603. const emits = component.emitsOptions;
  2604. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2605. return true;
  2606. }
  2607. if (nextVNode.dirs || nextVNode.transition) {
  2608. return true;
  2609. }
  2610. if (optimized && patchFlag >= 0) {
  2611. if (patchFlag & 1024) {
  2612. return true;
  2613. }
  2614. if (patchFlag & 16) {
  2615. if (!prevProps) {
  2616. return !!nextProps;
  2617. }
  2618. return hasPropsChanged(prevProps, nextProps, emits);
  2619. } else if (patchFlag & 8) {
  2620. const dynamicProps = nextVNode.dynamicProps;
  2621. for (let i = 0; i < dynamicProps.length; i++) {
  2622. const key = dynamicProps[i];
  2623. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2624. return true;
  2625. }
  2626. }
  2627. }
  2628. } else {
  2629. if (prevChildren || nextChildren) {
  2630. if (!nextChildren || !nextChildren.$stable) {
  2631. return true;
  2632. }
  2633. }
  2634. if (prevProps === nextProps) {
  2635. return false;
  2636. }
  2637. if (!prevProps) {
  2638. return !!nextProps;
  2639. }
  2640. if (!nextProps) {
  2641. return true;
  2642. }
  2643. return hasPropsChanged(prevProps, nextProps, emits);
  2644. }
  2645. return false;
  2646. }
  2647. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2648. const nextKeys = Object.keys(nextProps);
  2649. if (nextKeys.length !== Object.keys(prevProps).length) {
  2650. return true;
  2651. }
  2652. for (let i = 0; i < nextKeys.length; i++) {
  2653. const key = nextKeys[i];
  2654. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2655. return true;
  2656. }
  2657. }
  2658. return false;
  2659. }
  2660. function updateHOCHostEl({ vnode, parent }, el) {
  2661. while (parent) {
  2662. const root = parent.subTree;
  2663. if (root.suspense && root.suspense.activeBranch === vnode) {
  2664. root.el = vnode.el;
  2665. }
  2666. if (root === vnode) {
  2667. (vnode = parent.vnode).el = el;
  2668. parent = parent.parent;
  2669. } else {
  2670. break;
  2671. }
  2672. }
  2673. }
  2674. const COMPONENTS = "components";
  2675. const DIRECTIVES = "directives";
  2676. function resolveComponent(name, maybeSelfReference) {
  2677. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2678. }
  2679. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2680. function resolveDynamicComponent(component) {
  2681. if (isString(component)) {
  2682. return resolveAsset(COMPONENTS, component, false) || component;
  2683. } else {
  2684. return component || NULL_DYNAMIC_COMPONENT;
  2685. }
  2686. }
  2687. function resolveDirective(name) {
  2688. return resolveAsset(DIRECTIVES, name);
  2689. }
  2690. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2691. const instance = currentRenderingInstance || currentInstance;
  2692. if (instance) {
  2693. const Component = instance.type;
  2694. if (type === COMPONENTS) {
  2695. const selfName = getComponentName(
  2696. Component,
  2697. false
  2698. );
  2699. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  2700. return Component;
  2701. }
  2702. }
  2703. const res = (
  2704. // local registration
  2705. // check instance[type] first which is resolved for options API
  2706. resolve(instance[type] || Component[type], name) || // global registration
  2707. resolve(instance.appContext[type], name)
  2708. );
  2709. if (!res && maybeSelfReference) {
  2710. return Component;
  2711. }
  2712. if (warnMissing && !res) {
  2713. const extra = type === COMPONENTS ? `
  2714. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2715. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2716. }
  2717. return res;
  2718. } else {
  2719. warn$1(
  2720. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2721. );
  2722. }
  2723. }
  2724. function resolve(registry, name) {
  2725. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  2726. }
  2727. const isSuspense = (type) => type.__isSuspense;
  2728. let suspenseId = 0;
  2729. const SuspenseImpl = {
  2730. name: "Suspense",
  2731. // In order to make Suspense tree-shakable, we need to avoid importing it
  2732. // directly in the renderer. The renderer checks for the __isSuspense flag
  2733. // on a vnode's type and calls the `process` method, passing in renderer
  2734. // internals.
  2735. __isSuspense: true,
  2736. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  2737. if (n1 == null) {
  2738. mountSuspense(
  2739. n2,
  2740. container,
  2741. anchor,
  2742. parentComponent,
  2743. parentSuspense,
  2744. namespace,
  2745. slotScopeIds,
  2746. optimized,
  2747. rendererInternals
  2748. );
  2749. } else {
  2750. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  2751. n2.suspense = n1.suspense;
  2752. n2.suspense.vnode = n2;
  2753. n2.el = n1.el;
  2754. return;
  2755. }
  2756. patchSuspense(
  2757. n1,
  2758. n2,
  2759. container,
  2760. anchor,
  2761. parentComponent,
  2762. namespace,
  2763. slotScopeIds,
  2764. optimized,
  2765. rendererInternals
  2766. );
  2767. }
  2768. },
  2769. hydrate: hydrateSuspense,
  2770. create: createSuspenseBoundary,
  2771. normalize: normalizeSuspenseChildren
  2772. };
  2773. const Suspense = SuspenseImpl ;
  2774. function triggerEvent(vnode, name) {
  2775. const eventListener = vnode.props && vnode.props[name];
  2776. if (isFunction(eventListener)) {
  2777. eventListener();
  2778. }
  2779. }
  2780. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  2781. const {
  2782. p: patch,
  2783. o: { createElement }
  2784. } = rendererInternals;
  2785. const hiddenContainer = createElement("div");
  2786. const suspense = vnode.suspense = createSuspenseBoundary(
  2787. vnode,
  2788. parentSuspense,
  2789. parentComponent,
  2790. container,
  2791. hiddenContainer,
  2792. anchor,
  2793. namespace,
  2794. slotScopeIds,
  2795. optimized,
  2796. rendererInternals
  2797. );
  2798. patch(
  2799. null,
  2800. suspense.pendingBranch = vnode.ssContent,
  2801. hiddenContainer,
  2802. null,
  2803. parentComponent,
  2804. suspense,
  2805. namespace,
  2806. slotScopeIds
  2807. );
  2808. if (suspense.deps > 0) {
  2809. triggerEvent(vnode, "onPending");
  2810. triggerEvent(vnode, "onFallback");
  2811. patch(
  2812. null,
  2813. vnode.ssFallback,
  2814. container,
  2815. anchor,
  2816. parentComponent,
  2817. null,
  2818. // fallback tree will not have suspense context
  2819. namespace,
  2820. slotScopeIds
  2821. );
  2822. setActiveBranch(suspense, vnode.ssFallback);
  2823. } else {
  2824. suspense.resolve(false, true);
  2825. }
  2826. }
  2827. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  2828. const suspense = n2.suspense = n1.suspense;
  2829. suspense.vnode = n2;
  2830. n2.el = n1.el;
  2831. const newBranch = n2.ssContent;
  2832. const newFallback = n2.ssFallback;
  2833. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  2834. if (pendingBranch) {
  2835. suspense.pendingBranch = newBranch;
  2836. if (isSameVNodeType(newBranch, pendingBranch)) {
  2837. patch(
  2838. pendingBranch,
  2839. newBranch,
  2840. suspense.hiddenContainer,
  2841. null,
  2842. parentComponent,
  2843. suspense,
  2844. namespace,
  2845. slotScopeIds,
  2846. optimized
  2847. );
  2848. if (suspense.deps <= 0) {
  2849. suspense.resolve();
  2850. } else if (isInFallback) {
  2851. if (!isHydrating) {
  2852. patch(
  2853. activeBranch,
  2854. newFallback,
  2855. container,
  2856. anchor,
  2857. parentComponent,
  2858. null,
  2859. // fallback tree will not have suspense context
  2860. namespace,
  2861. slotScopeIds,
  2862. optimized
  2863. );
  2864. setActiveBranch(suspense, newFallback);
  2865. }
  2866. }
  2867. } else {
  2868. suspense.pendingId = suspenseId++;
  2869. if (isHydrating) {
  2870. suspense.isHydrating = false;
  2871. suspense.activeBranch = pendingBranch;
  2872. } else {
  2873. unmount(pendingBranch, parentComponent, suspense);
  2874. }
  2875. suspense.deps = 0;
  2876. suspense.effects.length = 0;
  2877. suspense.hiddenContainer = createElement("div");
  2878. if (isInFallback) {
  2879. patch(
  2880. null,
  2881. newBranch,
  2882. suspense.hiddenContainer,
  2883. null,
  2884. parentComponent,
  2885. suspense,
  2886. namespace,
  2887. slotScopeIds,
  2888. optimized
  2889. );
  2890. if (suspense.deps <= 0) {
  2891. suspense.resolve();
  2892. } else {
  2893. patch(
  2894. activeBranch,
  2895. newFallback,
  2896. container,
  2897. anchor,
  2898. parentComponent,
  2899. null,
  2900. // fallback tree will not have suspense context
  2901. namespace,
  2902. slotScopeIds,
  2903. optimized
  2904. );
  2905. setActiveBranch(suspense, newFallback);
  2906. }
  2907. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2908. patch(
  2909. activeBranch,
  2910. newBranch,
  2911. container,
  2912. anchor,
  2913. parentComponent,
  2914. suspense,
  2915. namespace,
  2916. slotScopeIds,
  2917. optimized
  2918. );
  2919. suspense.resolve(true);
  2920. } else {
  2921. patch(
  2922. null,
  2923. newBranch,
  2924. suspense.hiddenContainer,
  2925. null,
  2926. parentComponent,
  2927. suspense,
  2928. namespace,
  2929. slotScopeIds,
  2930. optimized
  2931. );
  2932. if (suspense.deps <= 0) {
  2933. suspense.resolve();
  2934. }
  2935. }
  2936. }
  2937. } else {
  2938. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2939. patch(
  2940. activeBranch,
  2941. newBranch,
  2942. container,
  2943. anchor,
  2944. parentComponent,
  2945. suspense,
  2946. namespace,
  2947. slotScopeIds,
  2948. optimized
  2949. );
  2950. setActiveBranch(suspense, newBranch);
  2951. } else {
  2952. triggerEvent(n2, "onPending");
  2953. suspense.pendingBranch = newBranch;
  2954. if (newBranch.shapeFlag & 512) {
  2955. suspense.pendingId = newBranch.component.suspenseId;
  2956. } else {
  2957. suspense.pendingId = suspenseId++;
  2958. }
  2959. patch(
  2960. null,
  2961. newBranch,
  2962. suspense.hiddenContainer,
  2963. null,
  2964. parentComponent,
  2965. suspense,
  2966. namespace,
  2967. slotScopeIds,
  2968. optimized
  2969. );
  2970. if (suspense.deps <= 0) {
  2971. suspense.resolve();
  2972. } else {
  2973. const { timeout, pendingId } = suspense;
  2974. if (timeout > 0) {
  2975. setTimeout(() => {
  2976. if (suspense.pendingId === pendingId) {
  2977. suspense.fallback(newFallback);
  2978. }
  2979. }, timeout);
  2980. } else if (timeout === 0) {
  2981. suspense.fallback(newFallback);
  2982. }
  2983. }
  2984. }
  2985. }
  2986. }
  2987. let hasWarned = false;
  2988. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2989. if (!hasWarned) {
  2990. hasWarned = true;
  2991. console[console.info ? "info" : "log"](
  2992. `<Suspense> is an experimental feature and its API will likely change.`
  2993. );
  2994. }
  2995. const {
  2996. p: patch,
  2997. m: move,
  2998. um: unmount,
  2999. n: next,
  3000. o: { parentNode, remove }
  3001. } = rendererInternals;
  3002. let parentSuspenseId;
  3003. const isSuspensible = isVNodeSuspensible(vnode);
  3004. if (isSuspensible) {
  3005. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  3006. parentSuspenseId = parentSuspense.pendingId;
  3007. parentSuspense.deps++;
  3008. }
  3009. }
  3010. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  3011. {
  3012. assertNumber(timeout, `Suspense timeout`);
  3013. }
  3014. const initialAnchor = anchor;
  3015. const suspense = {
  3016. vnode,
  3017. parent: parentSuspense,
  3018. parentComponent,
  3019. namespace,
  3020. container,
  3021. hiddenContainer,
  3022. deps: 0,
  3023. pendingId: suspenseId++,
  3024. timeout: typeof timeout === "number" ? timeout : -1,
  3025. activeBranch: null,
  3026. pendingBranch: null,
  3027. isInFallback: !isHydrating,
  3028. isHydrating,
  3029. isUnmounted: false,
  3030. effects: [],
  3031. resolve(resume = false, sync = false) {
  3032. {
  3033. if (!resume && !suspense.pendingBranch) {
  3034. throw new Error(
  3035. `suspense.resolve() is called without a pending branch.`
  3036. );
  3037. }
  3038. if (suspense.isUnmounted) {
  3039. throw new Error(
  3040. `suspense.resolve() is called on an already unmounted suspense boundary.`
  3041. );
  3042. }
  3043. }
  3044. const {
  3045. vnode: vnode2,
  3046. activeBranch,
  3047. pendingBranch,
  3048. pendingId,
  3049. effects,
  3050. parentComponent: parentComponent2,
  3051. container: container2
  3052. } = suspense;
  3053. let delayEnter = false;
  3054. if (suspense.isHydrating) {
  3055. suspense.isHydrating = false;
  3056. } else if (!resume) {
  3057. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  3058. if (delayEnter) {
  3059. activeBranch.transition.afterLeave = () => {
  3060. if (pendingId === suspense.pendingId) {
  3061. move(
  3062. pendingBranch,
  3063. container2,
  3064. anchor === initialAnchor ? next(activeBranch) : anchor,
  3065. 0
  3066. );
  3067. queuePostFlushCb(effects);
  3068. }
  3069. };
  3070. }
  3071. if (activeBranch) {
  3072. if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
  3073. anchor = next(activeBranch);
  3074. }
  3075. unmount(activeBranch, parentComponent2, suspense, true);
  3076. }
  3077. if (!delayEnter) {
  3078. move(pendingBranch, container2, anchor, 0);
  3079. }
  3080. }
  3081. setActiveBranch(suspense, pendingBranch);
  3082. suspense.pendingBranch = null;
  3083. suspense.isInFallback = false;
  3084. let parent = suspense.parent;
  3085. let hasUnresolvedAncestor = false;
  3086. while (parent) {
  3087. if (parent.pendingBranch) {
  3088. parent.effects.push(...effects);
  3089. hasUnresolvedAncestor = true;
  3090. break;
  3091. }
  3092. parent = parent.parent;
  3093. }
  3094. if (!hasUnresolvedAncestor && !delayEnter) {
  3095. queuePostFlushCb(effects);
  3096. }
  3097. suspense.effects = [];
  3098. if (isSuspensible) {
  3099. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  3100. parentSuspense.deps--;
  3101. if (parentSuspense.deps === 0 && !sync) {
  3102. parentSuspense.resolve();
  3103. }
  3104. }
  3105. }
  3106. triggerEvent(vnode2, "onResolve");
  3107. },
  3108. fallback(fallbackVNode) {
  3109. if (!suspense.pendingBranch) {
  3110. return;
  3111. }
  3112. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  3113. triggerEvent(vnode2, "onFallback");
  3114. const anchor2 = next(activeBranch);
  3115. const mountFallback = () => {
  3116. if (!suspense.isInFallback) {
  3117. return;
  3118. }
  3119. patch(
  3120. null,
  3121. fallbackVNode,
  3122. container2,
  3123. anchor2,
  3124. parentComponent2,
  3125. null,
  3126. // fallback tree will not have suspense context
  3127. namespace2,
  3128. slotScopeIds,
  3129. optimized
  3130. );
  3131. setActiveBranch(suspense, fallbackVNode);
  3132. };
  3133. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  3134. if (delayEnter) {
  3135. activeBranch.transition.afterLeave = mountFallback;
  3136. }
  3137. suspense.isInFallback = true;
  3138. unmount(
  3139. activeBranch,
  3140. parentComponent2,
  3141. null,
  3142. // no suspense so unmount hooks fire now
  3143. true
  3144. // shouldRemove
  3145. );
  3146. if (!delayEnter) {
  3147. mountFallback();
  3148. }
  3149. },
  3150. move(container2, anchor2, type) {
  3151. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  3152. suspense.container = container2;
  3153. },
  3154. next() {
  3155. return suspense.activeBranch && next(suspense.activeBranch);
  3156. },
  3157. registerDep(instance, setupRenderEffect) {
  3158. const isInPendingSuspense = !!suspense.pendingBranch;
  3159. if (isInPendingSuspense) {
  3160. suspense.deps++;
  3161. }
  3162. const hydratedEl = instance.vnode.el;
  3163. instance.asyncDep.catch((err) => {
  3164. handleError(err, instance, 0);
  3165. }).then((asyncSetupResult) => {
  3166. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  3167. return;
  3168. }
  3169. instance.asyncResolved = true;
  3170. const { vnode: vnode2 } = instance;
  3171. {
  3172. pushWarningContext(vnode2);
  3173. }
  3174. handleSetupResult(instance, asyncSetupResult, false);
  3175. if (hydratedEl) {
  3176. vnode2.el = hydratedEl;
  3177. }
  3178. const placeholder = !hydratedEl && instance.subTree.el;
  3179. setupRenderEffect(
  3180. instance,
  3181. vnode2,
  3182. // component may have been moved before resolve.
  3183. // if this is not a hydration, instance.subTree will be the comment
  3184. // placeholder.
  3185. parentNode(hydratedEl || instance.subTree.el),
  3186. // anchor will not be used if this is hydration, so only need to
  3187. // consider the comment placeholder case.
  3188. hydratedEl ? null : next(instance.subTree),
  3189. suspense,
  3190. namespace,
  3191. optimized
  3192. );
  3193. if (placeholder) {
  3194. remove(placeholder);
  3195. }
  3196. updateHOCHostEl(instance, vnode2.el);
  3197. {
  3198. popWarningContext();
  3199. }
  3200. if (isInPendingSuspense && --suspense.deps === 0) {
  3201. suspense.resolve();
  3202. }
  3203. });
  3204. },
  3205. unmount(parentSuspense2, doRemove) {
  3206. suspense.isUnmounted = true;
  3207. if (suspense.activeBranch) {
  3208. unmount(
  3209. suspense.activeBranch,
  3210. parentComponent,
  3211. parentSuspense2,
  3212. doRemove
  3213. );
  3214. }
  3215. if (suspense.pendingBranch) {
  3216. unmount(
  3217. suspense.pendingBranch,
  3218. parentComponent,
  3219. parentSuspense2,
  3220. doRemove
  3221. );
  3222. }
  3223. }
  3224. };
  3225. return suspense;
  3226. }
  3227. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  3228. const suspense = vnode.suspense = createSuspenseBoundary(
  3229. vnode,
  3230. parentSuspense,
  3231. parentComponent,
  3232. node.parentNode,
  3233. // eslint-disable-next-line no-restricted-globals
  3234. document.createElement("div"),
  3235. null,
  3236. namespace,
  3237. slotScopeIds,
  3238. optimized,
  3239. rendererInternals,
  3240. true
  3241. );
  3242. const result = hydrateNode(
  3243. node,
  3244. suspense.pendingBranch = vnode.ssContent,
  3245. parentComponent,
  3246. suspense,
  3247. slotScopeIds,
  3248. optimized
  3249. );
  3250. if (suspense.deps === 0) {
  3251. suspense.resolve(false, true);
  3252. }
  3253. return result;
  3254. }
  3255. function normalizeSuspenseChildren(vnode) {
  3256. const { shapeFlag, children } = vnode;
  3257. const isSlotChildren = shapeFlag & 32;
  3258. vnode.ssContent = normalizeSuspenseSlot(
  3259. isSlotChildren ? children.default : children
  3260. );
  3261. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  3262. }
  3263. function normalizeSuspenseSlot(s) {
  3264. let block;
  3265. if (isFunction(s)) {
  3266. const trackBlock = isBlockTreeEnabled && s._c;
  3267. if (trackBlock) {
  3268. s._d = false;
  3269. openBlock();
  3270. }
  3271. s = s();
  3272. if (trackBlock) {
  3273. s._d = true;
  3274. block = currentBlock;
  3275. closeBlock();
  3276. }
  3277. }
  3278. if (isArray(s)) {
  3279. const singleChild = filterSingleRoot(s);
  3280. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  3281. warn$1(`<Suspense> slots expect a single root node.`);
  3282. }
  3283. s = singleChild;
  3284. }
  3285. s = normalizeVNode(s);
  3286. if (block && !s.dynamicChildren) {
  3287. s.dynamicChildren = block.filter((c) => c !== s);
  3288. }
  3289. return s;
  3290. }
  3291. function queueEffectWithSuspense(fn, suspense) {
  3292. if (suspense && suspense.pendingBranch) {
  3293. if (isArray(fn)) {
  3294. suspense.effects.push(...fn);
  3295. } else {
  3296. suspense.effects.push(fn);
  3297. }
  3298. } else {
  3299. queuePostFlushCb(fn);
  3300. }
  3301. }
  3302. function setActiveBranch(suspense, branch) {
  3303. suspense.activeBranch = branch;
  3304. const { vnode, parentComponent } = suspense;
  3305. let el = branch.el;
  3306. while (!el && branch.component) {
  3307. branch = branch.component.subTree;
  3308. el = branch.el;
  3309. }
  3310. vnode.el = el;
  3311. if (parentComponent && parentComponent.subTree === vnode) {
  3312. parentComponent.vnode.el = el;
  3313. updateHOCHostEl(parentComponent, el);
  3314. }
  3315. }
  3316. function isVNodeSuspensible(vnode) {
  3317. var _a;
  3318. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  3319. }
  3320. const ssrContextKey = Symbol.for("v-scx");
  3321. const useSSRContext = () => {
  3322. {
  3323. const ctx = inject(ssrContextKey);
  3324. if (!ctx) {
  3325. warn$1(
  3326. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  3327. );
  3328. }
  3329. return ctx;
  3330. }
  3331. };
  3332. function watchEffect(effect, options) {
  3333. return doWatch(effect, null, options);
  3334. }
  3335. function watchPostEffect(effect, options) {
  3336. return doWatch(
  3337. effect,
  3338. null,
  3339. extend({}, options, { flush: "post" })
  3340. );
  3341. }
  3342. function watchSyncEffect(effect, options) {
  3343. return doWatch(
  3344. effect,
  3345. null,
  3346. extend({}, options, { flush: "sync" })
  3347. );
  3348. }
  3349. const INITIAL_WATCHER_VALUE = {};
  3350. function watch(source, cb, options) {
  3351. if (!isFunction(cb)) {
  3352. warn$1(
  3353. `\`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.`
  3354. );
  3355. }
  3356. return doWatch(source, cb, options);
  3357. }
  3358. function doWatch(source, cb, {
  3359. immediate,
  3360. deep,
  3361. flush,
  3362. once,
  3363. onTrack,
  3364. onTrigger
  3365. } = EMPTY_OBJ) {
  3366. if (cb && once) {
  3367. const _cb = cb;
  3368. cb = (...args) => {
  3369. _cb(...args);
  3370. unwatch();
  3371. };
  3372. }
  3373. if (deep !== void 0 && typeof deep === "number") {
  3374. warn$1(
  3375. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  3376. );
  3377. }
  3378. if (!cb) {
  3379. if (immediate !== void 0) {
  3380. warn$1(
  3381. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3382. );
  3383. }
  3384. if (deep !== void 0) {
  3385. warn$1(
  3386. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3387. );
  3388. }
  3389. if (once !== void 0) {
  3390. warn$1(
  3391. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  3392. );
  3393. }
  3394. }
  3395. const warnInvalidSource = (s) => {
  3396. warn$1(
  3397. `Invalid watch source: `,
  3398. s,
  3399. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3400. );
  3401. };
  3402. const instance = currentInstance;
  3403. const reactiveGetter = (source2) => deep === true ? source2 : (
  3404. // for deep: false, only traverse root-level properties
  3405. traverse(source2, deep === false ? 1 : void 0)
  3406. );
  3407. let getter;
  3408. let forceTrigger = false;
  3409. let isMultiSource = false;
  3410. if (isRef(source)) {
  3411. getter = () => source.value;
  3412. forceTrigger = isShallow(source);
  3413. } else if (isReactive(source)) {
  3414. getter = () => reactiveGetter(source);
  3415. forceTrigger = true;
  3416. } else if (isArray(source)) {
  3417. isMultiSource = true;
  3418. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3419. getter = () => source.map((s) => {
  3420. if (isRef(s)) {
  3421. return s.value;
  3422. } else if (isReactive(s)) {
  3423. return reactiveGetter(s);
  3424. } else if (isFunction(s)) {
  3425. return callWithErrorHandling(s, instance, 2);
  3426. } else {
  3427. warnInvalidSource(s);
  3428. }
  3429. });
  3430. } else if (isFunction(source)) {
  3431. if (cb) {
  3432. getter = () => callWithErrorHandling(source, instance, 2);
  3433. } else {
  3434. getter = () => {
  3435. if (cleanup) {
  3436. cleanup();
  3437. }
  3438. return callWithAsyncErrorHandling(
  3439. source,
  3440. instance,
  3441. 3,
  3442. [onCleanup]
  3443. );
  3444. };
  3445. }
  3446. } else {
  3447. getter = NOOP;
  3448. warnInvalidSource(source);
  3449. }
  3450. if (cb && deep) {
  3451. const baseGetter = getter;
  3452. getter = () => traverse(baseGetter());
  3453. }
  3454. let cleanup;
  3455. let onCleanup = (fn) => {
  3456. cleanup = effect.onStop = () => {
  3457. callWithErrorHandling(fn, instance, 4);
  3458. cleanup = effect.onStop = void 0;
  3459. };
  3460. };
  3461. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3462. const job = () => {
  3463. if (!effect.active || !effect.dirty) {
  3464. return;
  3465. }
  3466. if (cb) {
  3467. const newValue = effect.run();
  3468. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  3469. if (cleanup) {
  3470. cleanup();
  3471. }
  3472. callWithAsyncErrorHandling(cb, instance, 3, [
  3473. newValue,
  3474. // pass undefined as the old value when it's changed for the first time
  3475. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3476. onCleanup
  3477. ]);
  3478. oldValue = newValue;
  3479. }
  3480. } else {
  3481. effect.run();
  3482. }
  3483. };
  3484. job.allowRecurse = !!cb;
  3485. let scheduler;
  3486. if (flush === "sync") {
  3487. scheduler = job;
  3488. } else if (flush === "post") {
  3489. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3490. } else {
  3491. job.pre = true;
  3492. if (instance)
  3493. job.id = instance.uid;
  3494. scheduler = () => queueJob(job);
  3495. }
  3496. const effect = new ReactiveEffect(getter, NOOP, scheduler);
  3497. const scope = getCurrentScope();
  3498. const unwatch = () => {
  3499. effect.stop();
  3500. if (scope) {
  3501. remove(scope.effects, effect);
  3502. }
  3503. };
  3504. {
  3505. effect.onTrack = onTrack;
  3506. effect.onTrigger = onTrigger;
  3507. }
  3508. if (cb) {
  3509. if (immediate) {
  3510. job();
  3511. } else {
  3512. oldValue = effect.run();
  3513. }
  3514. } else if (flush === "post") {
  3515. queuePostRenderEffect(
  3516. effect.run.bind(effect),
  3517. instance && instance.suspense
  3518. );
  3519. } else {
  3520. effect.run();
  3521. }
  3522. return unwatch;
  3523. }
  3524. function instanceWatch(source, value, options) {
  3525. const publicThis = this.proxy;
  3526. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3527. let cb;
  3528. if (isFunction(value)) {
  3529. cb = value;
  3530. } else {
  3531. cb = value.handler;
  3532. options = value;
  3533. }
  3534. const reset = setCurrentInstance(this);
  3535. const res = doWatch(getter, cb.bind(publicThis), options);
  3536. reset();
  3537. return res;
  3538. }
  3539. function createPathGetter(ctx, path) {
  3540. const segments = path.split(".");
  3541. return () => {
  3542. let cur = ctx;
  3543. for (let i = 0; i < segments.length && cur; i++) {
  3544. cur = cur[segments[i]];
  3545. }
  3546. return cur;
  3547. };
  3548. }
  3549. function traverse(value, depth, currentDepth = 0, seen) {
  3550. if (!isObject(value) || value["__v_skip"]) {
  3551. return value;
  3552. }
  3553. if (depth && depth > 0) {
  3554. if (currentDepth >= depth) {
  3555. return value;
  3556. }
  3557. currentDepth++;
  3558. }
  3559. seen = seen || /* @__PURE__ */ new Set();
  3560. if (seen.has(value)) {
  3561. return value;
  3562. }
  3563. seen.add(value);
  3564. if (isRef(value)) {
  3565. traverse(value.value, depth, currentDepth, seen);
  3566. } else if (isArray(value)) {
  3567. for (let i = 0; i < value.length; i++) {
  3568. traverse(value[i], depth, currentDepth, seen);
  3569. }
  3570. } else if (isSet(value) || isMap(value)) {
  3571. value.forEach((v) => {
  3572. traverse(v, depth, currentDepth, seen);
  3573. });
  3574. } else if (isPlainObject(value)) {
  3575. for (const key in value) {
  3576. traverse(value[key], depth, currentDepth, seen);
  3577. }
  3578. }
  3579. return value;
  3580. }
  3581. function validateDirectiveName(name) {
  3582. if (isBuiltInDirective(name)) {
  3583. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  3584. }
  3585. }
  3586. function withDirectives(vnode, directives) {
  3587. if (currentRenderingInstance === null) {
  3588. warn$1(`withDirectives can only be used inside render functions.`);
  3589. return vnode;
  3590. }
  3591. const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
  3592. const bindings = vnode.dirs || (vnode.dirs = []);
  3593. for (let i = 0; i < directives.length; i++) {
  3594. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3595. if (dir) {
  3596. if (isFunction(dir)) {
  3597. dir = {
  3598. mounted: dir,
  3599. updated: dir
  3600. };
  3601. }
  3602. if (dir.deep) {
  3603. traverse(value);
  3604. }
  3605. bindings.push({
  3606. dir,
  3607. instance,
  3608. value,
  3609. oldValue: void 0,
  3610. arg,
  3611. modifiers
  3612. });
  3613. }
  3614. }
  3615. return vnode;
  3616. }
  3617. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3618. const bindings = vnode.dirs;
  3619. const oldBindings = prevVNode && prevVNode.dirs;
  3620. for (let i = 0; i < bindings.length; i++) {
  3621. const binding = bindings[i];
  3622. if (oldBindings) {
  3623. binding.oldValue = oldBindings[i].value;
  3624. }
  3625. let hook = binding.dir[name];
  3626. if (hook) {
  3627. pauseTracking();
  3628. callWithAsyncErrorHandling(hook, instance, 8, [
  3629. vnode.el,
  3630. binding,
  3631. vnode,
  3632. prevVNode
  3633. ]);
  3634. resetTracking();
  3635. }
  3636. }
  3637. }
  3638. const leaveCbKey = Symbol("_leaveCb");
  3639. const enterCbKey$1 = Symbol("_enterCb");
  3640. function useTransitionState() {
  3641. const state = {
  3642. isMounted: false,
  3643. isLeaving: false,
  3644. isUnmounting: false,
  3645. leavingVNodes: /* @__PURE__ */ new Map()
  3646. };
  3647. onMounted(() => {
  3648. state.isMounted = true;
  3649. });
  3650. onBeforeUnmount(() => {
  3651. state.isUnmounting = true;
  3652. });
  3653. return state;
  3654. }
  3655. const TransitionHookValidator = [Function, Array];
  3656. const BaseTransitionPropsValidators = {
  3657. mode: String,
  3658. appear: Boolean,
  3659. persisted: Boolean,
  3660. // enter
  3661. onBeforeEnter: TransitionHookValidator,
  3662. onEnter: TransitionHookValidator,
  3663. onAfterEnter: TransitionHookValidator,
  3664. onEnterCancelled: TransitionHookValidator,
  3665. // leave
  3666. onBeforeLeave: TransitionHookValidator,
  3667. onLeave: TransitionHookValidator,
  3668. onAfterLeave: TransitionHookValidator,
  3669. onLeaveCancelled: TransitionHookValidator,
  3670. // appear
  3671. onBeforeAppear: TransitionHookValidator,
  3672. onAppear: TransitionHookValidator,
  3673. onAfterAppear: TransitionHookValidator,
  3674. onAppearCancelled: TransitionHookValidator
  3675. };
  3676. const BaseTransitionImpl = {
  3677. name: `BaseTransition`,
  3678. props: BaseTransitionPropsValidators,
  3679. setup(props, { slots }) {
  3680. const instance = getCurrentInstance();
  3681. const state = useTransitionState();
  3682. return () => {
  3683. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3684. if (!children || !children.length) {
  3685. return;
  3686. }
  3687. let child = children[0];
  3688. if (children.length > 1) {
  3689. let hasFound = false;
  3690. for (const c of children) {
  3691. if (c.type !== Comment) {
  3692. if (hasFound) {
  3693. warn$1(
  3694. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3695. );
  3696. break;
  3697. }
  3698. child = c;
  3699. hasFound = true;
  3700. }
  3701. }
  3702. }
  3703. const rawProps = toRaw(props);
  3704. const { mode } = rawProps;
  3705. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3706. warn$1(`invalid <transition> mode: ${mode}`);
  3707. }
  3708. if (state.isLeaving) {
  3709. return emptyPlaceholder(child);
  3710. }
  3711. const innerChild = getKeepAliveChild(child);
  3712. if (!innerChild) {
  3713. return emptyPlaceholder(child);
  3714. }
  3715. const enterHooks = resolveTransitionHooks(
  3716. innerChild,
  3717. rawProps,
  3718. state,
  3719. instance
  3720. );
  3721. setTransitionHooks(innerChild, enterHooks);
  3722. const oldChild = instance.subTree;
  3723. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3724. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
  3725. const leavingHooks = resolveTransitionHooks(
  3726. oldInnerChild,
  3727. rawProps,
  3728. state,
  3729. instance
  3730. );
  3731. setTransitionHooks(oldInnerChild, leavingHooks);
  3732. if (mode === "out-in") {
  3733. state.isLeaving = true;
  3734. leavingHooks.afterLeave = () => {
  3735. state.isLeaving = false;
  3736. if (instance.update.active !== false) {
  3737. instance.effect.dirty = true;
  3738. instance.update();
  3739. }
  3740. };
  3741. return emptyPlaceholder(child);
  3742. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3743. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3744. const leavingVNodesCache = getLeavingNodesForType(
  3745. state,
  3746. oldInnerChild
  3747. );
  3748. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3749. el[leaveCbKey] = () => {
  3750. earlyRemove();
  3751. el[leaveCbKey] = void 0;
  3752. delete enterHooks.delayedLeave;
  3753. };
  3754. enterHooks.delayedLeave = delayedLeave;
  3755. };
  3756. }
  3757. }
  3758. return child;
  3759. };
  3760. }
  3761. };
  3762. const BaseTransition = BaseTransitionImpl;
  3763. function getLeavingNodesForType(state, vnode) {
  3764. const { leavingVNodes } = state;
  3765. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3766. if (!leavingVNodesCache) {
  3767. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3768. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3769. }
  3770. return leavingVNodesCache;
  3771. }
  3772. function resolveTransitionHooks(vnode, props, state, instance) {
  3773. const {
  3774. appear,
  3775. mode,
  3776. persisted = false,
  3777. onBeforeEnter,
  3778. onEnter,
  3779. onAfterEnter,
  3780. onEnterCancelled,
  3781. onBeforeLeave,
  3782. onLeave,
  3783. onAfterLeave,
  3784. onLeaveCancelled,
  3785. onBeforeAppear,
  3786. onAppear,
  3787. onAfterAppear,
  3788. onAppearCancelled
  3789. } = props;
  3790. const key = String(vnode.key);
  3791. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3792. const callHook = (hook, args) => {
  3793. hook && callWithAsyncErrorHandling(
  3794. hook,
  3795. instance,
  3796. 9,
  3797. args
  3798. );
  3799. };
  3800. const callAsyncHook = (hook, args) => {
  3801. const done = args[1];
  3802. callHook(hook, args);
  3803. if (isArray(hook)) {
  3804. if (hook.every((hook2) => hook2.length <= 1))
  3805. done();
  3806. } else if (hook.length <= 1) {
  3807. done();
  3808. }
  3809. };
  3810. const hooks = {
  3811. mode,
  3812. persisted,
  3813. beforeEnter(el) {
  3814. let hook = onBeforeEnter;
  3815. if (!state.isMounted) {
  3816. if (appear) {
  3817. hook = onBeforeAppear || onBeforeEnter;
  3818. } else {
  3819. return;
  3820. }
  3821. }
  3822. if (el[leaveCbKey]) {
  3823. el[leaveCbKey](
  3824. true
  3825. /* cancelled */
  3826. );
  3827. }
  3828. const leavingVNode = leavingVNodesCache[key];
  3829. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3830. leavingVNode.el[leaveCbKey]();
  3831. }
  3832. callHook(hook, [el]);
  3833. },
  3834. enter(el) {
  3835. let hook = onEnter;
  3836. let afterHook = onAfterEnter;
  3837. let cancelHook = onEnterCancelled;
  3838. if (!state.isMounted) {
  3839. if (appear) {
  3840. hook = onAppear || onEnter;
  3841. afterHook = onAfterAppear || onAfterEnter;
  3842. cancelHook = onAppearCancelled || onEnterCancelled;
  3843. } else {
  3844. return;
  3845. }
  3846. }
  3847. let called = false;
  3848. const done = el[enterCbKey$1] = (cancelled) => {
  3849. if (called)
  3850. return;
  3851. called = true;
  3852. if (cancelled) {
  3853. callHook(cancelHook, [el]);
  3854. } else {
  3855. callHook(afterHook, [el]);
  3856. }
  3857. if (hooks.delayedLeave) {
  3858. hooks.delayedLeave();
  3859. }
  3860. el[enterCbKey$1] = void 0;
  3861. };
  3862. if (hook) {
  3863. callAsyncHook(hook, [el, done]);
  3864. } else {
  3865. done();
  3866. }
  3867. },
  3868. leave(el, remove) {
  3869. const key2 = String(vnode.key);
  3870. if (el[enterCbKey$1]) {
  3871. el[enterCbKey$1](
  3872. true
  3873. /* cancelled */
  3874. );
  3875. }
  3876. if (state.isUnmounting) {
  3877. return remove();
  3878. }
  3879. callHook(onBeforeLeave, [el]);
  3880. let called = false;
  3881. const done = el[leaveCbKey] = (cancelled) => {
  3882. if (called)
  3883. return;
  3884. called = true;
  3885. remove();
  3886. if (cancelled) {
  3887. callHook(onLeaveCancelled, [el]);
  3888. } else {
  3889. callHook(onAfterLeave, [el]);
  3890. }
  3891. el[leaveCbKey] = void 0;
  3892. if (leavingVNodesCache[key2] === vnode) {
  3893. delete leavingVNodesCache[key2];
  3894. }
  3895. };
  3896. leavingVNodesCache[key2] = vnode;
  3897. if (onLeave) {
  3898. callAsyncHook(onLeave, [el, done]);
  3899. } else {
  3900. done();
  3901. }
  3902. },
  3903. clone(vnode2) {
  3904. return resolveTransitionHooks(vnode2, props, state, instance);
  3905. }
  3906. };
  3907. return hooks;
  3908. }
  3909. function emptyPlaceholder(vnode) {
  3910. if (isKeepAlive(vnode)) {
  3911. vnode = cloneVNode(vnode);
  3912. vnode.children = null;
  3913. return vnode;
  3914. }
  3915. }
  3916. function getKeepAliveChild(vnode) {
  3917. return isKeepAlive(vnode) ? (
  3918. // #7121 ensure get the child component subtree in case
  3919. // it's been replaced during HMR
  3920. vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
  3921. ) : vnode;
  3922. }
  3923. function setTransitionHooks(vnode, hooks) {
  3924. if (vnode.shapeFlag & 6 && vnode.component) {
  3925. setTransitionHooks(vnode.component.subTree, hooks);
  3926. } else if (vnode.shapeFlag & 128) {
  3927. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3928. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3929. } else {
  3930. vnode.transition = hooks;
  3931. }
  3932. }
  3933. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3934. let ret = [];
  3935. let keyedFragmentCount = 0;
  3936. for (let i = 0; i < children.length; i++) {
  3937. let child = children[i];
  3938. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3939. if (child.type === Fragment) {
  3940. if (child.patchFlag & 128)
  3941. keyedFragmentCount++;
  3942. ret = ret.concat(
  3943. getTransitionRawChildren(child.children, keepComment, key)
  3944. );
  3945. } else if (keepComment || child.type !== Comment) {
  3946. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3947. }
  3948. }
  3949. if (keyedFragmentCount > 1) {
  3950. for (let i = 0; i < ret.length; i++) {
  3951. ret[i].patchFlag = -2;
  3952. }
  3953. }
  3954. return ret;
  3955. }
  3956. /*! #__NO_SIDE_EFFECTS__ */
  3957. // @__NO_SIDE_EFFECTS__
  3958. function defineComponent(options, extraOptions) {
  3959. return isFunction(options) ? (
  3960. // #8326: extend call and options.name access are considered side-effects
  3961. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3962. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3963. ) : options;
  3964. }
  3965. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3966. /*! #__NO_SIDE_EFFECTS__ */
  3967. // @__NO_SIDE_EFFECTS__
  3968. function defineAsyncComponent(source) {
  3969. if (isFunction(source)) {
  3970. source = { loader: source };
  3971. }
  3972. const {
  3973. loader,
  3974. loadingComponent,
  3975. errorComponent,
  3976. delay = 200,
  3977. timeout,
  3978. // undefined = never times out
  3979. suspensible = true,
  3980. onError: userOnError
  3981. } = source;
  3982. let pendingRequest = null;
  3983. let resolvedComp;
  3984. let retries = 0;
  3985. const retry = () => {
  3986. retries++;
  3987. pendingRequest = null;
  3988. return load();
  3989. };
  3990. const load = () => {
  3991. let thisRequest;
  3992. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3993. err = err instanceof Error ? err : new Error(String(err));
  3994. if (userOnError) {
  3995. return new Promise((resolve, reject) => {
  3996. const userRetry = () => resolve(retry());
  3997. const userFail = () => reject(err);
  3998. userOnError(err, userRetry, userFail, retries + 1);
  3999. });
  4000. } else {
  4001. throw err;
  4002. }
  4003. }).then((comp) => {
  4004. if (thisRequest !== pendingRequest && pendingRequest) {
  4005. return pendingRequest;
  4006. }
  4007. if (!comp) {
  4008. warn$1(
  4009. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4010. );
  4011. }
  4012. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4013. comp = comp.default;
  4014. }
  4015. if (comp && !isObject(comp) && !isFunction(comp)) {
  4016. throw new Error(`Invalid async component load result: ${comp}`);
  4017. }
  4018. resolvedComp = comp;
  4019. return comp;
  4020. }));
  4021. };
  4022. return defineComponent({
  4023. name: "AsyncComponentWrapper",
  4024. __asyncLoader: load,
  4025. get __asyncResolved() {
  4026. return resolvedComp;
  4027. },
  4028. setup() {
  4029. const instance = currentInstance;
  4030. if (resolvedComp) {
  4031. return () => createInnerComp(resolvedComp, instance);
  4032. }
  4033. const onError = (err) => {
  4034. pendingRequest = null;
  4035. handleError(
  4036. err,
  4037. instance,
  4038. 13,
  4039. !errorComponent
  4040. );
  4041. };
  4042. if (suspensible && instance.suspense || false) {
  4043. return load().then((comp) => {
  4044. return () => createInnerComp(comp, instance);
  4045. }).catch((err) => {
  4046. onError(err);
  4047. return () => errorComponent ? createVNode(errorComponent, {
  4048. error: err
  4049. }) : null;
  4050. });
  4051. }
  4052. const loaded = ref(false);
  4053. const error = ref();
  4054. const delayed = ref(!!delay);
  4055. if (delay) {
  4056. setTimeout(() => {
  4057. delayed.value = false;
  4058. }, delay);
  4059. }
  4060. if (timeout != null) {
  4061. setTimeout(() => {
  4062. if (!loaded.value && !error.value) {
  4063. const err = new Error(
  4064. `Async component timed out after ${timeout}ms.`
  4065. );
  4066. onError(err);
  4067. error.value = err;
  4068. }
  4069. }, timeout);
  4070. }
  4071. load().then(() => {
  4072. loaded.value = true;
  4073. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4074. instance.parent.effect.dirty = true;
  4075. queueJob(instance.parent.update);
  4076. }
  4077. }).catch((err) => {
  4078. onError(err);
  4079. error.value = err;
  4080. });
  4081. return () => {
  4082. if (loaded.value && resolvedComp) {
  4083. return createInnerComp(resolvedComp, instance);
  4084. } else if (error.value && errorComponent) {
  4085. return createVNode(errorComponent, {
  4086. error: error.value
  4087. });
  4088. } else if (loadingComponent && !delayed.value) {
  4089. return createVNode(loadingComponent);
  4090. }
  4091. };
  4092. }
  4093. });
  4094. }
  4095. function createInnerComp(comp, parent) {
  4096. const { ref: ref2, props, children, ce } = parent.vnode;
  4097. const vnode = createVNode(comp, props, children);
  4098. vnode.ref = ref2;
  4099. vnode.ce = ce;
  4100. delete parent.vnode.ce;
  4101. return vnode;
  4102. }
  4103. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4104. const KeepAliveImpl = {
  4105. name: `KeepAlive`,
  4106. // Marker for special handling inside the renderer. We are not using a ===
  4107. // check directly on KeepAlive in the renderer, because importing it directly
  4108. // would prevent it from being tree-shaken.
  4109. __isKeepAlive: true,
  4110. props: {
  4111. include: [String, RegExp, Array],
  4112. exclude: [String, RegExp, Array],
  4113. max: [String, Number]
  4114. },
  4115. setup(props, { slots }) {
  4116. const instance = getCurrentInstance();
  4117. const sharedContext = instance.ctx;
  4118. const cache = /* @__PURE__ */ new Map();
  4119. const keys = /* @__PURE__ */ new Set();
  4120. let current = null;
  4121. {
  4122. instance.__v_cache = cache;
  4123. }
  4124. const parentSuspense = instance.suspense;
  4125. const {
  4126. renderer: {
  4127. p: patch,
  4128. m: move,
  4129. um: _unmount,
  4130. o: { createElement }
  4131. }
  4132. } = sharedContext;
  4133. const storageContainer = createElement("div");
  4134. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4135. const instance2 = vnode.component;
  4136. move(vnode, container, anchor, 0, parentSuspense);
  4137. patch(
  4138. instance2.vnode,
  4139. vnode,
  4140. container,
  4141. anchor,
  4142. instance2,
  4143. parentSuspense,
  4144. namespace,
  4145. vnode.slotScopeIds,
  4146. optimized
  4147. );
  4148. queuePostRenderEffect(() => {
  4149. instance2.isDeactivated = false;
  4150. if (instance2.a) {
  4151. invokeArrayFns(instance2.a);
  4152. }
  4153. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4154. if (vnodeHook) {
  4155. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4156. }
  4157. }, parentSuspense);
  4158. {
  4159. devtoolsComponentAdded(instance2);
  4160. }
  4161. };
  4162. sharedContext.deactivate = (vnode) => {
  4163. const instance2 = vnode.component;
  4164. move(vnode, storageContainer, null, 1, parentSuspense);
  4165. queuePostRenderEffect(() => {
  4166. if (instance2.da) {
  4167. invokeArrayFns(instance2.da);
  4168. }
  4169. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4170. if (vnodeHook) {
  4171. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4172. }
  4173. instance2.isDeactivated = true;
  4174. }, parentSuspense);
  4175. {
  4176. devtoolsComponentAdded(instance2);
  4177. }
  4178. };
  4179. function unmount(vnode) {
  4180. resetShapeFlag(vnode);
  4181. _unmount(vnode, instance, parentSuspense, true);
  4182. }
  4183. function pruneCache(filter) {
  4184. cache.forEach((vnode, key) => {
  4185. const name = getComponentName(vnode.type);
  4186. if (name && (!filter || !filter(name))) {
  4187. pruneCacheEntry(key);
  4188. }
  4189. });
  4190. }
  4191. function pruneCacheEntry(key) {
  4192. const cached = cache.get(key);
  4193. if (!current || !isSameVNodeType(cached, current)) {
  4194. unmount(cached);
  4195. } else if (current) {
  4196. resetShapeFlag(current);
  4197. }
  4198. cache.delete(key);
  4199. keys.delete(key);
  4200. }
  4201. watch(
  4202. () => [props.include, props.exclude],
  4203. ([include, exclude]) => {
  4204. include && pruneCache((name) => matches(include, name));
  4205. exclude && pruneCache((name) => !matches(exclude, name));
  4206. },
  4207. // prune post-render after `current` has been updated
  4208. { flush: "post", deep: true }
  4209. );
  4210. let pendingCacheKey = null;
  4211. const cacheSubtree = () => {
  4212. if (pendingCacheKey != null) {
  4213. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4214. }
  4215. };
  4216. onMounted(cacheSubtree);
  4217. onUpdated(cacheSubtree);
  4218. onBeforeUnmount(() => {
  4219. cache.forEach((cached) => {
  4220. const { subTree, suspense } = instance;
  4221. const vnode = getInnerChild(subTree);
  4222. if (cached.type === vnode.type && cached.key === vnode.key) {
  4223. resetShapeFlag(vnode);
  4224. const da = vnode.component.da;
  4225. da && queuePostRenderEffect(da, suspense);
  4226. return;
  4227. }
  4228. unmount(cached);
  4229. });
  4230. });
  4231. return () => {
  4232. pendingCacheKey = null;
  4233. if (!slots.default) {
  4234. return current = null;
  4235. }
  4236. const children = slots.default();
  4237. const rawVNode = children[0];
  4238. if (children.length > 1) {
  4239. {
  4240. warn$1(`KeepAlive should contain exactly one component child.`);
  4241. }
  4242. current = null;
  4243. return children;
  4244. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4245. current = null;
  4246. return rawVNode;
  4247. }
  4248. let vnode = getInnerChild(rawVNode);
  4249. const comp = vnode.type;
  4250. const name = getComponentName(
  4251. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4252. );
  4253. const { include, exclude, max } = props;
  4254. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4255. current = vnode;
  4256. return rawVNode;
  4257. }
  4258. const key = vnode.key == null ? comp : vnode.key;
  4259. const cachedVNode = cache.get(key);
  4260. if (vnode.el) {
  4261. vnode = cloneVNode(vnode);
  4262. if (rawVNode.shapeFlag & 128) {
  4263. rawVNode.ssContent = vnode;
  4264. }
  4265. }
  4266. pendingCacheKey = key;
  4267. if (cachedVNode) {
  4268. vnode.el = cachedVNode.el;
  4269. vnode.component = cachedVNode.component;
  4270. if (vnode.transition) {
  4271. setTransitionHooks(vnode, vnode.transition);
  4272. }
  4273. vnode.shapeFlag |= 512;
  4274. keys.delete(key);
  4275. keys.add(key);
  4276. } else {
  4277. keys.add(key);
  4278. if (max && keys.size > parseInt(max, 10)) {
  4279. pruneCacheEntry(keys.values().next().value);
  4280. }
  4281. }
  4282. vnode.shapeFlag |= 256;
  4283. current = vnode;
  4284. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4285. };
  4286. }
  4287. };
  4288. const KeepAlive = KeepAliveImpl;
  4289. function matches(pattern, name) {
  4290. if (isArray(pattern)) {
  4291. return pattern.some((p) => matches(p, name));
  4292. } else if (isString(pattern)) {
  4293. return pattern.split(",").includes(name);
  4294. } else if (isRegExp(pattern)) {
  4295. return pattern.test(name);
  4296. }
  4297. return false;
  4298. }
  4299. function onActivated(hook, target) {
  4300. registerKeepAliveHook(hook, "a", target);
  4301. }
  4302. function onDeactivated(hook, target) {
  4303. registerKeepAliveHook(hook, "da", target);
  4304. }
  4305. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4306. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4307. let current = target;
  4308. while (current) {
  4309. if (current.isDeactivated) {
  4310. return;
  4311. }
  4312. current = current.parent;
  4313. }
  4314. return hook();
  4315. });
  4316. injectHook(type, wrappedHook, target);
  4317. if (target) {
  4318. let current = target.parent;
  4319. while (current && current.parent) {
  4320. if (isKeepAlive(current.parent.vnode)) {
  4321. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4322. }
  4323. current = current.parent;
  4324. }
  4325. }
  4326. }
  4327. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4328. const injected = injectHook(
  4329. type,
  4330. hook,
  4331. keepAliveRoot,
  4332. true
  4333. /* prepend */
  4334. );
  4335. onUnmounted(() => {
  4336. remove(keepAliveRoot[type], injected);
  4337. }, target);
  4338. }
  4339. function resetShapeFlag(vnode) {
  4340. vnode.shapeFlag &= ~256;
  4341. vnode.shapeFlag &= ~512;
  4342. }
  4343. function getInnerChild(vnode) {
  4344. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4345. }
  4346. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4347. if (target) {
  4348. const hooks = target[type] || (target[type] = []);
  4349. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4350. if (target.isUnmounted) {
  4351. return;
  4352. }
  4353. pauseTracking();
  4354. const reset = setCurrentInstance(target);
  4355. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4356. reset();
  4357. resetTracking();
  4358. return res;
  4359. });
  4360. if (prepend) {
  4361. hooks.unshift(wrappedHook);
  4362. } else {
  4363. hooks.push(wrappedHook);
  4364. }
  4365. return wrappedHook;
  4366. } else {
  4367. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  4368. warn$1(
  4369. `${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.` )
  4370. );
  4371. }
  4372. }
  4373. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4374. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4375. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4376. );
  4377. const onBeforeMount = createHook("bm");
  4378. const onMounted = createHook("m");
  4379. const onBeforeUpdate = createHook("bu");
  4380. const onUpdated = createHook("u");
  4381. const onBeforeUnmount = createHook("bum");
  4382. const onUnmounted = createHook("um");
  4383. const onServerPrefetch = createHook("sp");
  4384. const onRenderTriggered = createHook(
  4385. "rtg"
  4386. );
  4387. const onRenderTracked = createHook(
  4388. "rtc"
  4389. );
  4390. function onErrorCaptured(hook, target = currentInstance) {
  4391. injectHook("ec", hook, target);
  4392. }
  4393. function renderList(source, renderItem, cache, index) {
  4394. let ret;
  4395. const cached = cache && cache[index];
  4396. if (isArray(source) || isString(source)) {
  4397. ret = new Array(source.length);
  4398. for (let i = 0, l = source.length; i < l; i++) {
  4399. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4400. }
  4401. } else if (typeof source === "number") {
  4402. if (!Number.isInteger(source)) {
  4403. warn$1(`The v-for range expect an integer value but got ${source}.`);
  4404. }
  4405. ret = new Array(source);
  4406. for (let i = 0; i < source; i++) {
  4407. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4408. }
  4409. } else if (isObject(source)) {
  4410. if (source[Symbol.iterator]) {
  4411. ret = Array.from(
  4412. source,
  4413. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4414. );
  4415. } else {
  4416. const keys = Object.keys(source);
  4417. ret = new Array(keys.length);
  4418. for (let i = 0, l = keys.length; i < l; i++) {
  4419. const key = keys[i];
  4420. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4421. }
  4422. }
  4423. } else {
  4424. ret = [];
  4425. }
  4426. if (cache) {
  4427. cache[index] = ret;
  4428. }
  4429. return ret;
  4430. }
  4431. function createSlots(slots, dynamicSlots) {
  4432. for (let i = 0; i < dynamicSlots.length; i++) {
  4433. const slot = dynamicSlots[i];
  4434. if (isArray(slot)) {
  4435. for (let j = 0; j < slot.length; j++) {
  4436. slots[slot[j].name] = slot[j].fn;
  4437. }
  4438. } else if (slot) {
  4439. slots[slot.name] = slot.key ? (...args) => {
  4440. const res = slot.fn(...args);
  4441. if (res)
  4442. res.key = slot.key;
  4443. return res;
  4444. } : slot.fn;
  4445. }
  4446. }
  4447. return slots;
  4448. }
  4449. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4450. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4451. if (name !== "default")
  4452. props.name = name;
  4453. return createVNode("slot", props, fallback && fallback());
  4454. }
  4455. let slot = slots[name];
  4456. if (slot && slot.length > 1) {
  4457. warn$1(
  4458. `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.`
  4459. );
  4460. slot = () => [];
  4461. }
  4462. if (slot && slot._c) {
  4463. slot._d = false;
  4464. }
  4465. openBlock();
  4466. const validSlotContent = slot && ensureValidVNode(slot(props));
  4467. const rendered = createBlock(
  4468. Fragment,
  4469. {
  4470. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4471. // key attached in the `createSlots` helper, respect that
  4472. validSlotContent && validSlotContent.key || `_${name}`
  4473. },
  4474. validSlotContent || (fallback ? fallback() : []),
  4475. validSlotContent && slots._ === 1 ? 64 : -2
  4476. );
  4477. if (!noSlotted && rendered.scopeId) {
  4478. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4479. }
  4480. if (slot && slot._c) {
  4481. slot._d = true;
  4482. }
  4483. return rendered;
  4484. }
  4485. function ensureValidVNode(vnodes) {
  4486. return vnodes.some((child) => {
  4487. if (!isVNode(child))
  4488. return true;
  4489. if (child.type === Comment)
  4490. return false;
  4491. if (child.type === Fragment && !ensureValidVNode(child.children))
  4492. return false;
  4493. return true;
  4494. }) ? vnodes : null;
  4495. }
  4496. function toHandlers(obj, preserveCaseIfNecessary) {
  4497. const ret = {};
  4498. if (!isObject(obj)) {
  4499. warn$1(`v-on with no argument expects an object value.`);
  4500. return ret;
  4501. }
  4502. for (const key in obj) {
  4503. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4504. }
  4505. return ret;
  4506. }
  4507. const getPublicInstance = (i) => {
  4508. if (!i)
  4509. return null;
  4510. if (isStatefulComponent(i))
  4511. return getExposeProxy(i) || i.proxy;
  4512. return getPublicInstance(i.parent);
  4513. };
  4514. const publicPropertiesMap = (
  4515. // Move PURE marker to new line to workaround compiler discarding it
  4516. // due to type annotation
  4517. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4518. $: (i) => i,
  4519. $el: (i) => i.vnode.el,
  4520. $data: (i) => i.data,
  4521. $props: (i) => shallowReadonly(i.props) ,
  4522. $attrs: (i) => shallowReadonly(i.attrs) ,
  4523. $slots: (i) => shallowReadonly(i.slots) ,
  4524. $refs: (i) => shallowReadonly(i.refs) ,
  4525. $parent: (i) => getPublicInstance(i.parent),
  4526. $root: (i) => getPublicInstance(i.root),
  4527. $emit: (i) => i.emit,
  4528. $options: (i) => resolveMergedOptions(i) ,
  4529. $forceUpdate: (i) => i.f || (i.f = () => {
  4530. i.effect.dirty = true;
  4531. queueJob(i.update);
  4532. }),
  4533. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4534. $watch: (i) => instanceWatch.bind(i)
  4535. })
  4536. );
  4537. const isReservedPrefix = (key) => key === "_" || key === "$";
  4538. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4539. const PublicInstanceProxyHandlers = {
  4540. get({ _: instance }, key) {
  4541. if (key === "__v_skip") {
  4542. return true;
  4543. }
  4544. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4545. if (key === "__isVue") {
  4546. return true;
  4547. }
  4548. let normalizedProps;
  4549. if (key[0] !== "$") {
  4550. const n = accessCache[key];
  4551. if (n !== void 0) {
  4552. switch (n) {
  4553. case 1 /* SETUP */:
  4554. return setupState[key];
  4555. case 2 /* DATA */:
  4556. return data[key];
  4557. case 4 /* CONTEXT */:
  4558. return ctx[key];
  4559. case 3 /* PROPS */:
  4560. return props[key];
  4561. }
  4562. } else if (hasSetupBinding(setupState, key)) {
  4563. accessCache[key] = 1 /* SETUP */;
  4564. return setupState[key];
  4565. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4566. accessCache[key] = 2 /* DATA */;
  4567. return data[key];
  4568. } else if (
  4569. // only cache other properties when instance has declared (thus stable)
  4570. // props
  4571. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4572. ) {
  4573. accessCache[key] = 3 /* PROPS */;
  4574. return props[key];
  4575. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4576. accessCache[key] = 4 /* CONTEXT */;
  4577. return ctx[key];
  4578. } else if (shouldCacheAccess) {
  4579. accessCache[key] = 0 /* OTHER */;
  4580. }
  4581. }
  4582. const publicGetter = publicPropertiesMap[key];
  4583. let cssModule, globalProperties;
  4584. if (publicGetter) {
  4585. if (key === "$attrs") {
  4586. track(instance.attrs, "get", "");
  4587. markAttrsAccessed();
  4588. } else if (key === "$slots") {
  4589. track(instance, "get", key);
  4590. }
  4591. return publicGetter(instance);
  4592. } else if (
  4593. // css module (injected by vue-loader)
  4594. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4595. ) {
  4596. return cssModule;
  4597. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4598. accessCache[key] = 4 /* CONTEXT */;
  4599. return ctx[key];
  4600. } else if (
  4601. // global properties
  4602. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4603. ) {
  4604. {
  4605. return globalProperties[key];
  4606. }
  4607. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4608. // to infinite warning loop
  4609. key.indexOf("__v") !== 0)) {
  4610. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4611. warn$1(
  4612. `Property ${JSON.stringify(
  4613. key
  4614. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4615. );
  4616. } else if (instance === currentRenderingInstance) {
  4617. warn$1(
  4618. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4619. );
  4620. }
  4621. }
  4622. },
  4623. set({ _: instance }, key, value) {
  4624. const { data, setupState, ctx } = instance;
  4625. if (hasSetupBinding(setupState, key)) {
  4626. setupState[key] = value;
  4627. return true;
  4628. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4629. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4630. return false;
  4631. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4632. data[key] = value;
  4633. return true;
  4634. } else if (hasOwn(instance.props, key)) {
  4635. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  4636. return false;
  4637. }
  4638. if (key[0] === "$" && key.slice(1) in instance) {
  4639. warn$1(
  4640. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4641. );
  4642. return false;
  4643. } else {
  4644. if (key in instance.appContext.config.globalProperties) {
  4645. Object.defineProperty(ctx, key, {
  4646. enumerable: true,
  4647. configurable: true,
  4648. value
  4649. });
  4650. } else {
  4651. ctx[key] = value;
  4652. }
  4653. }
  4654. return true;
  4655. },
  4656. has({
  4657. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4658. }, key) {
  4659. let normalizedProps;
  4660. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  4661. },
  4662. defineProperty(target, key, descriptor) {
  4663. if (descriptor.get != null) {
  4664. target._.accessCache[key] = 0;
  4665. } else if (hasOwn(descriptor, "value")) {
  4666. this.set(target, key, descriptor.value, null);
  4667. }
  4668. return Reflect.defineProperty(target, key, descriptor);
  4669. }
  4670. };
  4671. {
  4672. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4673. warn$1(
  4674. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4675. );
  4676. return Reflect.ownKeys(target);
  4677. };
  4678. }
  4679. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4680. {},
  4681. PublicInstanceProxyHandlers,
  4682. {
  4683. get(target, key) {
  4684. if (key === Symbol.unscopables) {
  4685. return;
  4686. }
  4687. return PublicInstanceProxyHandlers.get(target, key, target);
  4688. },
  4689. has(_, key) {
  4690. const has = key[0] !== "_" && !isGloballyAllowed(key);
  4691. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4692. warn$1(
  4693. `Property ${JSON.stringify(
  4694. key
  4695. )} should not start with _ which is a reserved prefix for Vue internals.`
  4696. );
  4697. }
  4698. return has;
  4699. }
  4700. }
  4701. );
  4702. function createDevRenderContext(instance) {
  4703. const target = {};
  4704. Object.defineProperty(target, `_`, {
  4705. configurable: true,
  4706. enumerable: false,
  4707. get: () => instance
  4708. });
  4709. Object.keys(publicPropertiesMap).forEach((key) => {
  4710. Object.defineProperty(target, key, {
  4711. configurable: true,
  4712. enumerable: false,
  4713. get: () => publicPropertiesMap[key](instance),
  4714. // intercepted by the proxy so no need for implementation,
  4715. // but needed to prevent set errors
  4716. set: NOOP
  4717. });
  4718. });
  4719. return target;
  4720. }
  4721. function exposePropsOnRenderContext(instance) {
  4722. const {
  4723. ctx,
  4724. propsOptions: [propsOptions]
  4725. } = instance;
  4726. if (propsOptions) {
  4727. Object.keys(propsOptions).forEach((key) => {
  4728. Object.defineProperty(ctx, key, {
  4729. enumerable: true,
  4730. configurable: true,
  4731. get: () => instance.props[key],
  4732. set: NOOP
  4733. });
  4734. });
  4735. }
  4736. }
  4737. function exposeSetupStateOnRenderContext(instance) {
  4738. const { ctx, setupState } = instance;
  4739. Object.keys(toRaw(setupState)).forEach((key) => {
  4740. if (!setupState.__isScriptSetup) {
  4741. if (isReservedPrefix(key[0])) {
  4742. warn$1(
  4743. `setup() return property ${JSON.stringify(
  4744. key
  4745. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4746. );
  4747. return;
  4748. }
  4749. Object.defineProperty(ctx, key, {
  4750. enumerable: true,
  4751. configurable: true,
  4752. get: () => setupState[key],
  4753. set: NOOP
  4754. });
  4755. }
  4756. });
  4757. }
  4758. const warnRuntimeUsage = (method) => warn$1(
  4759. `${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.`
  4760. );
  4761. function defineProps() {
  4762. {
  4763. warnRuntimeUsage(`defineProps`);
  4764. }
  4765. return null;
  4766. }
  4767. function defineEmits() {
  4768. {
  4769. warnRuntimeUsage(`defineEmits`);
  4770. }
  4771. return null;
  4772. }
  4773. function defineExpose(exposed) {
  4774. {
  4775. warnRuntimeUsage(`defineExpose`);
  4776. }
  4777. }
  4778. function defineOptions(options) {
  4779. {
  4780. warnRuntimeUsage(`defineOptions`);
  4781. }
  4782. }
  4783. function defineSlots() {
  4784. {
  4785. warnRuntimeUsage(`defineSlots`);
  4786. }
  4787. return null;
  4788. }
  4789. function defineModel() {
  4790. {
  4791. warnRuntimeUsage("defineModel");
  4792. }
  4793. }
  4794. function withDefaults(props, defaults) {
  4795. {
  4796. warnRuntimeUsage(`withDefaults`);
  4797. }
  4798. return null;
  4799. }
  4800. function useSlots() {
  4801. return getContext().slots;
  4802. }
  4803. function useAttrs() {
  4804. return getContext().attrs;
  4805. }
  4806. function getContext() {
  4807. const i = getCurrentInstance();
  4808. if (!i) {
  4809. warn$1(`useContext() called without active instance.`);
  4810. }
  4811. return i.setupContext || (i.setupContext = createSetupContext(i));
  4812. }
  4813. function normalizePropsOrEmits(props) {
  4814. return isArray(props) ? props.reduce(
  4815. (normalized, p) => (normalized[p] = null, normalized),
  4816. {}
  4817. ) : props;
  4818. }
  4819. function mergeDefaults(raw, defaults) {
  4820. const props = normalizePropsOrEmits(raw);
  4821. for (const key in defaults) {
  4822. if (key.startsWith("__skip"))
  4823. continue;
  4824. let opt = props[key];
  4825. if (opt) {
  4826. if (isArray(opt) || isFunction(opt)) {
  4827. opt = props[key] = { type: opt, default: defaults[key] };
  4828. } else {
  4829. opt.default = defaults[key];
  4830. }
  4831. } else if (opt === null) {
  4832. opt = props[key] = { default: defaults[key] };
  4833. } else {
  4834. warn$1(`props default key "${key}" has no corresponding declaration.`);
  4835. }
  4836. if (opt && defaults[`__skip_${key}`]) {
  4837. opt.skipFactory = true;
  4838. }
  4839. }
  4840. return props;
  4841. }
  4842. function mergeModels(a, b) {
  4843. if (!a || !b)
  4844. return a || b;
  4845. if (isArray(a) && isArray(b))
  4846. return a.concat(b);
  4847. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4848. }
  4849. function createPropsRestProxy(props, excludedKeys) {
  4850. const ret = {};
  4851. for (const key in props) {
  4852. if (!excludedKeys.includes(key)) {
  4853. Object.defineProperty(ret, key, {
  4854. enumerable: true,
  4855. get: () => props[key]
  4856. });
  4857. }
  4858. }
  4859. return ret;
  4860. }
  4861. function withAsyncContext(getAwaitable) {
  4862. const ctx = getCurrentInstance();
  4863. if (!ctx) {
  4864. warn$1(
  4865. `withAsyncContext called without active current instance. This is likely a bug.`
  4866. );
  4867. }
  4868. let awaitable = getAwaitable();
  4869. unsetCurrentInstance();
  4870. if (isPromise(awaitable)) {
  4871. awaitable = awaitable.catch((e) => {
  4872. setCurrentInstance(ctx);
  4873. throw e;
  4874. });
  4875. }
  4876. return [awaitable, () => setCurrentInstance(ctx)];
  4877. }
  4878. function createDuplicateChecker() {
  4879. const cache = /* @__PURE__ */ Object.create(null);
  4880. return (type, key) => {
  4881. if (cache[key]) {
  4882. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4883. } else {
  4884. cache[key] = type;
  4885. }
  4886. };
  4887. }
  4888. let shouldCacheAccess = true;
  4889. function applyOptions(instance) {
  4890. const options = resolveMergedOptions(instance);
  4891. const publicThis = instance.proxy;
  4892. const ctx = instance.ctx;
  4893. shouldCacheAccess = false;
  4894. if (options.beforeCreate) {
  4895. callHook$1(options.beforeCreate, instance, "bc");
  4896. }
  4897. const {
  4898. // state
  4899. data: dataOptions,
  4900. computed: computedOptions,
  4901. methods,
  4902. watch: watchOptions,
  4903. provide: provideOptions,
  4904. inject: injectOptions,
  4905. // lifecycle
  4906. created,
  4907. beforeMount,
  4908. mounted,
  4909. beforeUpdate,
  4910. updated,
  4911. activated,
  4912. deactivated,
  4913. beforeDestroy,
  4914. beforeUnmount,
  4915. destroyed,
  4916. unmounted,
  4917. render,
  4918. renderTracked,
  4919. renderTriggered,
  4920. errorCaptured,
  4921. serverPrefetch,
  4922. // public API
  4923. expose,
  4924. inheritAttrs,
  4925. // assets
  4926. components,
  4927. directives,
  4928. filters
  4929. } = options;
  4930. const checkDuplicateProperties = createDuplicateChecker() ;
  4931. {
  4932. const [propsOptions] = instance.propsOptions;
  4933. if (propsOptions) {
  4934. for (const key in propsOptions) {
  4935. checkDuplicateProperties("Props" /* PROPS */, key);
  4936. }
  4937. }
  4938. }
  4939. if (injectOptions) {
  4940. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4941. }
  4942. if (methods) {
  4943. for (const key in methods) {
  4944. const methodHandler = methods[key];
  4945. if (isFunction(methodHandler)) {
  4946. {
  4947. Object.defineProperty(ctx, key, {
  4948. value: methodHandler.bind(publicThis),
  4949. configurable: true,
  4950. enumerable: true,
  4951. writable: true
  4952. });
  4953. }
  4954. {
  4955. checkDuplicateProperties("Methods" /* METHODS */, key);
  4956. }
  4957. } else {
  4958. warn$1(
  4959. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4960. );
  4961. }
  4962. }
  4963. }
  4964. if (dataOptions) {
  4965. if (!isFunction(dataOptions)) {
  4966. warn$1(
  4967. `The data option must be a function. Plain object usage is no longer supported.`
  4968. );
  4969. }
  4970. const data = dataOptions.call(publicThis, publicThis);
  4971. if (isPromise(data)) {
  4972. warn$1(
  4973. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4974. );
  4975. }
  4976. if (!isObject(data)) {
  4977. warn$1(`data() should return an object.`);
  4978. } else {
  4979. instance.data = reactive(data);
  4980. {
  4981. for (const key in data) {
  4982. checkDuplicateProperties("Data" /* DATA */, key);
  4983. if (!isReservedPrefix(key[0])) {
  4984. Object.defineProperty(ctx, key, {
  4985. configurable: true,
  4986. enumerable: true,
  4987. get: () => data[key],
  4988. set: NOOP
  4989. });
  4990. }
  4991. }
  4992. }
  4993. }
  4994. }
  4995. shouldCacheAccess = true;
  4996. if (computedOptions) {
  4997. for (const key in computedOptions) {
  4998. const opt = computedOptions[key];
  4999. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5000. if (get === NOOP) {
  5001. warn$1(`Computed property "${key}" has no getter.`);
  5002. }
  5003. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5004. warn$1(
  5005. `Write operation failed: computed property "${key}" is readonly.`
  5006. );
  5007. } ;
  5008. const c = computed({
  5009. get,
  5010. set
  5011. });
  5012. Object.defineProperty(ctx, key, {
  5013. enumerable: true,
  5014. configurable: true,
  5015. get: () => c.value,
  5016. set: (v) => c.value = v
  5017. });
  5018. {
  5019. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5020. }
  5021. }
  5022. }
  5023. if (watchOptions) {
  5024. for (const key in watchOptions) {
  5025. createWatcher(watchOptions[key], ctx, publicThis, key);
  5026. }
  5027. }
  5028. if (provideOptions) {
  5029. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5030. Reflect.ownKeys(provides).forEach((key) => {
  5031. provide(key, provides[key]);
  5032. });
  5033. }
  5034. if (created) {
  5035. callHook$1(created, instance, "c");
  5036. }
  5037. function registerLifecycleHook(register, hook) {
  5038. if (isArray(hook)) {
  5039. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5040. } else if (hook) {
  5041. register(hook.bind(publicThis));
  5042. }
  5043. }
  5044. registerLifecycleHook(onBeforeMount, beforeMount);
  5045. registerLifecycleHook(onMounted, mounted);
  5046. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5047. registerLifecycleHook(onUpdated, updated);
  5048. registerLifecycleHook(onActivated, activated);
  5049. registerLifecycleHook(onDeactivated, deactivated);
  5050. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5051. registerLifecycleHook(onRenderTracked, renderTracked);
  5052. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5053. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5054. registerLifecycleHook(onUnmounted, unmounted);
  5055. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5056. if (isArray(expose)) {
  5057. if (expose.length) {
  5058. const exposed = instance.exposed || (instance.exposed = {});
  5059. expose.forEach((key) => {
  5060. Object.defineProperty(exposed, key, {
  5061. get: () => publicThis[key],
  5062. set: (val) => publicThis[key] = val
  5063. });
  5064. });
  5065. } else if (!instance.exposed) {
  5066. instance.exposed = {};
  5067. }
  5068. }
  5069. if (render && instance.render === NOOP) {
  5070. instance.render = render;
  5071. }
  5072. if (inheritAttrs != null) {
  5073. instance.inheritAttrs = inheritAttrs;
  5074. }
  5075. if (components)
  5076. instance.components = components;
  5077. if (directives)
  5078. instance.directives = directives;
  5079. }
  5080. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5081. if (isArray(injectOptions)) {
  5082. injectOptions = normalizeInject(injectOptions);
  5083. }
  5084. for (const key in injectOptions) {
  5085. const opt = injectOptions[key];
  5086. let injected;
  5087. if (isObject(opt)) {
  5088. if ("default" in opt) {
  5089. injected = inject(
  5090. opt.from || key,
  5091. opt.default,
  5092. true
  5093. );
  5094. } else {
  5095. injected = inject(opt.from || key);
  5096. }
  5097. } else {
  5098. injected = inject(opt);
  5099. }
  5100. if (isRef(injected)) {
  5101. Object.defineProperty(ctx, key, {
  5102. enumerable: true,
  5103. configurable: true,
  5104. get: () => injected.value,
  5105. set: (v) => injected.value = v
  5106. });
  5107. } else {
  5108. ctx[key] = injected;
  5109. }
  5110. {
  5111. checkDuplicateProperties("Inject" /* INJECT */, key);
  5112. }
  5113. }
  5114. }
  5115. function callHook$1(hook, instance, type) {
  5116. callWithAsyncErrorHandling(
  5117. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5118. instance,
  5119. type
  5120. );
  5121. }
  5122. function createWatcher(raw, ctx, publicThis, key) {
  5123. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5124. if (isString(raw)) {
  5125. const handler = ctx[raw];
  5126. if (isFunction(handler)) {
  5127. watch(getter, handler);
  5128. } else {
  5129. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5130. }
  5131. } else if (isFunction(raw)) {
  5132. watch(getter, raw.bind(publicThis));
  5133. } else if (isObject(raw)) {
  5134. if (isArray(raw)) {
  5135. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5136. } else {
  5137. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5138. if (isFunction(handler)) {
  5139. watch(getter, handler, raw);
  5140. } else {
  5141. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5142. }
  5143. }
  5144. } else {
  5145. warn$1(`Invalid watch option: "${key}"`, raw);
  5146. }
  5147. }
  5148. function resolveMergedOptions(instance) {
  5149. const base = instance.type;
  5150. const { mixins, extends: extendsOptions } = base;
  5151. const {
  5152. mixins: globalMixins,
  5153. optionsCache: cache,
  5154. config: { optionMergeStrategies }
  5155. } = instance.appContext;
  5156. const cached = cache.get(base);
  5157. let resolved;
  5158. if (cached) {
  5159. resolved = cached;
  5160. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5161. {
  5162. resolved = base;
  5163. }
  5164. } else {
  5165. resolved = {};
  5166. if (globalMixins.length) {
  5167. globalMixins.forEach(
  5168. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5169. );
  5170. }
  5171. mergeOptions(resolved, base, optionMergeStrategies);
  5172. }
  5173. if (isObject(base)) {
  5174. cache.set(base, resolved);
  5175. }
  5176. return resolved;
  5177. }
  5178. function mergeOptions(to, from, strats, asMixin = false) {
  5179. const { mixins, extends: extendsOptions } = from;
  5180. if (extendsOptions) {
  5181. mergeOptions(to, extendsOptions, strats, true);
  5182. }
  5183. if (mixins) {
  5184. mixins.forEach(
  5185. (m) => mergeOptions(to, m, strats, true)
  5186. );
  5187. }
  5188. for (const key in from) {
  5189. if (asMixin && key === "expose") {
  5190. warn$1(
  5191. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5192. );
  5193. } else {
  5194. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5195. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5196. }
  5197. }
  5198. return to;
  5199. }
  5200. const internalOptionMergeStrats = {
  5201. data: mergeDataFn,
  5202. props: mergeEmitsOrPropsOptions,
  5203. emits: mergeEmitsOrPropsOptions,
  5204. // objects
  5205. methods: mergeObjectOptions,
  5206. computed: mergeObjectOptions,
  5207. // lifecycle
  5208. beforeCreate: mergeAsArray$1,
  5209. created: mergeAsArray$1,
  5210. beforeMount: mergeAsArray$1,
  5211. mounted: mergeAsArray$1,
  5212. beforeUpdate: mergeAsArray$1,
  5213. updated: mergeAsArray$1,
  5214. beforeDestroy: mergeAsArray$1,
  5215. beforeUnmount: mergeAsArray$1,
  5216. destroyed: mergeAsArray$1,
  5217. unmounted: mergeAsArray$1,
  5218. activated: mergeAsArray$1,
  5219. deactivated: mergeAsArray$1,
  5220. errorCaptured: mergeAsArray$1,
  5221. serverPrefetch: mergeAsArray$1,
  5222. // assets
  5223. components: mergeObjectOptions,
  5224. directives: mergeObjectOptions,
  5225. // watch
  5226. watch: mergeWatchOptions,
  5227. // provide / inject
  5228. provide: mergeDataFn,
  5229. inject: mergeInject
  5230. };
  5231. function mergeDataFn(to, from) {
  5232. if (!from) {
  5233. return to;
  5234. }
  5235. if (!to) {
  5236. return from;
  5237. }
  5238. return function mergedDataFn() {
  5239. return (extend)(
  5240. isFunction(to) ? to.call(this, this) : to,
  5241. isFunction(from) ? from.call(this, this) : from
  5242. );
  5243. };
  5244. }
  5245. function mergeInject(to, from) {
  5246. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5247. }
  5248. function normalizeInject(raw) {
  5249. if (isArray(raw)) {
  5250. const res = {};
  5251. for (let i = 0; i < raw.length; i++) {
  5252. res[raw[i]] = raw[i];
  5253. }
  5254. return res;
  5255. }
  5256. return raw;
  5257. }
  5258. function mergeAsArray$1(to, from) {
  5259. return to ? [...new Set([].concat(to, from))] : from;
  5260. }
  5261. function mergeObjectOptions(to, from) {
  5262. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5263. }
  5264. function mergeEmitsOrPropsOptions(to, from) {
  5265. if (to) {
  5266. if (isArray(to) && isArray(from)) {
  5267. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5268. }
  5269. return extend(
  5270. /* @__PURE__ */ Object.create(null),
  5271. normalizePropsOrEmits(to),
  5272. normalizePropsOrEmits(from != null ? from : {})
  5273. );
  5274. } else {
  5275. return from;
  5276. }
  5277. }
  5278. function mergeWatchOptions(to, from) {
  5279. if (!to)
  5280. return from;
  5281. if (!from)
  5282. return to;
  5283. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5284. for (const key in from) {
  5285. merged[key] = mergeAsArray$1(to[key], from[key]);
  5286. }
  5287. return merged;
  5288. }
  5289. function createAppContext() {
  5290. return {
  5291. app: null,
  5292. config: {
  5293. isNativeTag: NO,
  5294. performance: false,
  5295. globalProperties: {},
  5296. optionMergeStrategies: {},
  5297. errorHandler: void 0,
  5298. warnHandler: void 0,
  5299. compilerOptions: {}
  5300. },
  5301. mixins: [],
  5302. components: {},
  5303. directives: {},
  5304. provides: /* @__PURE__ */ Object.create(null),
  5305. optionsCache: /* @__PURE__ */ new WeakMap(),
  5306. propsCache: /* @__PURE__ */ new WeakMap(),
  5307. emitsCache: /* @__PURE__ */ new WeakMap()
  5308. };
  5309. }
  5310. let uid$1 = 0;
  5311. function createAppAPI(render, hydrate) {
  5312. return function createApp(rootComponent, rootProps = null) {
  5313. if (!isFunction(rootComponent)) {
  5314. rootComponent = extend({}, rootComponent);
  5315. }
  5316. if (rootProps != null && !isObject(rootProps)) {
  5317. warn$1(`root props passed to app.mount() must be an object.`);
  5318. rootProps = null;
  5319. }
  5320. const context = createAppContext();
  5321. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5322. let isMounted = false;
  5323. const app = context.app = {
  5324. _uid: uid$1++,
  5325. _component: rootComponent,
  5326. _props: rootProps,
  5327. _container: null,
  5328. _context: context,
  5329. _instance: null,
  5330. version,
  5331. get config() {
  5332. return context.config;
  5333. },
  5334. set config(v) {
  5335. {
  5336. warn$1(
  5337. `app.config cannot be replaced. Modify individual options instead.`
  5338. );
  5339. }
  5340. },
  5341. use(plugin, ...options) {
  5342. if (installedPlugins.has(plugin)) {
  5343. warn$1(`Plugin has already been applied to target app.`);
  5344. } else if (plugin && isFunction(plugin.install)) {
  5345. installedPlugins.add(plugin);
  5346. plugin.install(app, ...options);
  5347. } else if (isFunction(plugin)) {
  5348. installedPlugins.add(plugin);
  5349. plugin(app, ...options);
  5350. } else {
  5351. warn$1(
  5352. `A plugin must either be a function or an object with an "install" function.`
  5353. );
  5354. }
  5355. return app;
  5356. },
  5357. mixin(mixin) {
  5358. {
  5359. if (!context.mixins.includes(mixin)) {
  5360. context.mixins.push(mixin);
  5361. } else {
  5362. warn$1(
  5363. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5364. );
  5365. }
  5366. }
  5367. return app;
  5368. },
  5369. component(name, component) {
  5370. {
  5371. validateComponentName(name, context.config);
  5372. }
  5373. if (!component) {
  5374. return context.components[name];
  5375. }
  5376. if (context.components[name]) {
  5377. warn$1(`Component "${name}" has already been registered in target app.`);
  5378. }
  5379. context.components[name] = component;
  5380. return app;
  5381. },
  5382. directive(name, directive) {
  5383. {
  5384. validateDirectiveName(name);
  5385. }
  5386. if (!directive) {
  5387. return context.directives[name];
  5388. }
  5389. if (context.directives[name]) {
  5390. warn$1(`Directive "${name}" has already been registered in target app.`);
  5391. }
  5392. context.directives[name] = directive;
  5393. return app;
  5394. },
  5395. mount(rootContainer, isHydrate, namespace) {
  5396. if (!isMounted) {
  5397. if (rootContainer.__vue_app__) {
  5398. warn$1(
  5399. `There is already an app instance mounted on the host container.
  5400. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5401. );
  5402. }
  5403. const vnode = createVNode(rootComponent, rootProps);
  5404. vnode.appContext = context;
  5405. if (namespace === true) {
  5406. namespace = "svg";
  5407. } else if (namespace === false) {
  5408. namespace = void 0;
  5409. }
  5410. {
  5411. context.reload = () => {
  5412. render(
  5413. cloneVNode(vnode),
  5414. rootContainer,
  5415. namespace
  5416. );
  5417. };
  5418. }
  5419. if (isHydrate && hydrate) {
  5420. hydrate(vnode, rootContainer);
  5421. } else {
  5422. render(vnode, rootContainer, namespace);
  5423. }
  5424. isMounted = true;
  5425. app._container = rootContainer;
  5426. rootContainer.__vue_app__ = app;
  5427. {
  5428. app._instance = vnode.component;
  5429. devtoolsInitApp(app, version);
  5430. }
  5431. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5432. } else {
  5433. warn$1(
  5434. `App has already been mounted.
  5435. 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)\``
  5436. );
  5437. }
  5438. },
  5439. unmount() {
  5440. if (isMounted) {
  5441. render(null, app._container);
  5442. {
  5443. app._instance = null;
  5444. devtoolsUnmountApp(app);
  5445. }
  5446. delete app._container.__vue_app__;
  5447. } else {
  5448. warn$1(`Cannot unmount an app that is not mounted.`);
  5449. }
  5450. },
  5451. provide(key, value) {
  5452. if (key in context.provides) {
  5453. warn$1(
  5454. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5455. );
  5456. }
  5457. context.provides[key] = value;
  5458. return app;
  5459. },
  5460. runWithContext(fn) {
  5461. const lastApp = currentApp;
  5462. currentApp = app;
  5463. try {
  5464. return fn();
  5465. } finally {
  5466. currentApp = lastApp;
  5467. }
  5468. }
  5469. };
  5470. return app;
  5471. };
  5472. }
  5473. let currentApp = null;
  5474. function provide(key, value) {
  5475. if (!currentInstance) {
  5476. {
  5477. warn$1(`provide() can only be used inside setup().`);
  5478. }
  5479. } else {
  5480. let provides = currentInstance.provides;
  5481. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5482. if (parentProvides === provides) {
  5483. provides = currentInstance.provides = Object.create(parentProvides);
  5484. }
  5485. provides[key] = value;
  5486. }
  5487. }
  5488. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5489. const instance = currentInstance || currentRenderingInstance;
  5490. if (instance || currentApp) {
  5491. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5492. if (provides && key in provides) {
  5493. return provides[key];
  5494. } else if (arguments.length > 1) {
  5495. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5496. } else {
  5497. warn$1(`injection "${String(key)}" not found.`);
  5498. }
  5499. } else {
  5500. warn$1(`inject() can only be used inside setup() or functional components.`);
  5501. }
  5502. }
  5503. function hasInjectionContext() {
  5504. return !!(currentInstance || currentRenderingInstance || currentApp);
  5505. }
  5506. const internalObjectProto = /* @__PURE__ */ Object.create(null);
  5507. const createInternalObject = () => Object.create(internalObjectProto);
  5508. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  5509. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5510. const props = {};
  5511. const attrs = createInternalObject();
  5512. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5513. setFullProps(instance, rawProps, props, attrs);
  5514. for (const key in instance.propsOptions[0]) {
  5515. if (!(key in props)) {
  5516. props[key] = void 0;
  5517. }
  5518. }
  5519. {
  5520. validateProps(rawProps || {}, props, instance);
  5521. }
  5522. if (isStateful) {
  5523. instance.props = isSSR ? props : shallowReactive(props);
  5524. } else {
  5525. if (!instance.type.props) {
  5526. instance.props = attrs;
  5527. } else {
  5528. instance.props = props;
  5529. }
  5530. }
  5531. instance.attrs = attrs;
  5532. }
  5533. function isInHmrContext(instance) {
  5534. while (instance) {
  5535. if (instance.type.__hmrId)
  5536. return true;
  5537. instance = instance.parent;
  5538. }
  5539. }
  5540. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5541. const {
  5542. props,
  5543. attrs,
  5544. vnode: { patchFlag }
  5545. } = instance;
  5546. const rawCurrentProps = toRaw(props);
  5547. const [options] = instance.propsOptions;
  5548. let hasAttrsChanged = false;
  5549. if (
  5550. // always force full diff in dev
  5551. // - #1942 if hmr is enabled with sfc component
  5552. // - vite#872 non-sfc component used by sfc component
  5553. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5554. ) {
  5555. if (patchFlag & 8) {
  5556. const propsToUpdate = instance.vnode.dynamicProps;
  5557. for (let i = 0; i < propsToUpdate.length; i++) {
  5558. let key = propsToUpdate[i];
  5559. if (isEmitListener(instance.emitsOptions, key)) {
  5560. continue;
  5561. }
  5562. const value = rawProps[key];
  5563. if (options) {
  5564. if (hasOwn(attrs, key)) {
  5565. if (value !== attrs[key]) {
  5566. attrs[key] = value;
  5567. hasAttrsChanged = true;
  5568. }
  5569. } else {
  5570. const camelizedKey = camelize(key);
  5571. props[camelizedKey] = resolvePropValue(
  5572. options,
  5573. rawCurrentProps,
  5574. camelizedKey,
  5575. value,
  5576. instance,
  5577. false
  5578. );
  5579. }
  5580. } else {
  5581. if (value !== attrs[key]) {
  5582. attrs[key] = value;
  5583. hasAttrsChanged = true;
  5584. }
  5585. }
  5586. }
  5587. }
  5588. } else {
  5589. if (setFullProps(instance, rawProps, props, attrs)) {
  5590. hasAttrsChanged = true;
  5591. }
  5592. let kebabKey;
  5593. for (const key in rawCurrentProps) {
  5594. if (!rawProps || // for camelCase
  5595. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5596. // and converted to camelCase (#955)
  5597. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5598. if (options) {
  5599. if (rawPrevProps && // for camelCase
  5600. (rawPrevProps[key] !== void 0 || // for kebab-case
  5601. rawPrevProps[kebabKey] !== void 0)) {
  5602. props[key] = resolvePropValue(
  5603. options,
  5604. rawCurrentProps,
  5605. key,
  5606. void 0,
  5607. instance,
  5608. true
  5609. );
  5610. }
  5611. } else {
  5612. delete props[key];
  5613. }
  5614. }
  5615. }
  5616. if (attrs !== rawCurrentProps) {
  5617. for (const key in attrs) {
  5618. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5619. delete attrs[key];
  5620. hasAttrsChanged = true;
  5621. }
  5622. }
  5623. }
  5624. }
  5625. if (hasAttrsChanged) {
  5626. trigger(instance.attrs, "set", "");
  5627. }
  5628. {
  5629. validateProps(rawProps || {}, props, instance);
  5630. }
  5631. }
  5632. function setFullProps(instance, rawProps, props, attrs) {
  5633. const [options, needCastKeys] = instance.propsOptions;
  5634. let hasAttrsChanged = false;
  5635. let rawCastValues;
  5636. if (rawProps) {
  5637. for (let key in rawProps) {
  5638. if (isReservedProp(key)) {
  5639. continue;
  5640. }
  5641. const value = rawProps[key];
  5642. let camelKey;
  5643. if (options && hasOwn(options, camelKey = camelize(key))) {
  5644. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5645. props[camelKey] = value;
  5646. } else {
  5647. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5648. }
  5649. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5650. if (!(key in attrs) || value !== attrs[key]) {
  5651. attrs[key] = value;
  5652. hasAttrsChanged = true;
  5653. }
  5654. }
  5655. }
  5656. }
  5657. if (needCastKeys) {
  5658. const rawCurrentProps = toRaw(props);
  5659. const castValues = rawCastValues || EMPTY_OBJ;
  5660. for (let i = 0; i < needCastKeys.length; i++) {
  5661. const key = needCastKeys[i];
  5662. props[key] = resolvePropValue(
  5663. options,
  5664. rawCurrentProps,
  5665. key,
  5666. castValues[key],
  5667. instance,
  5668. !hasOwn(castValues, key)
  5669. );
  5670. }
  5671. }
  5672. return hasAttrsChanged;
  5673. }
  5674. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5675. const opt = options[key];
  5676. if (opt != null) {
  5677. const hasDefault = hasOwn(opt, "default");
  5678. if (hasDefault && value === void 0) {
  5679. const defaultValue = opt.default;
  5680. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5681. const { propsDefaults } = instance;
  5682. if (key in propsDefaults) {
  5683. value = propsDefaults[key];
  5684. } else {
  5685. const reset = setCurrentInstance(instance);
  5686. value = propsDefaults[key] = defaultValue.call(
  5687. null,
  5688. props
  5689. );
  5690. reset();
  5691. }
  5692. } else {
  5693. value = defaultValue;
  5694. }
  5695. }
  5696. if (opt[0 /* shouldCast */]) {
  5697. if (isAbsent && !hasDefault) {
  5698. value = false;
  5699. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5700. value = true;
  5701. }
  5702. }
  5703. }
  5704. return value;
  5705. }
  5706. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5707. const cache = appContext.propsCache;
  5708. const cached = cache.get(comp);
  5709. if (cached) {
  5710. return cached;
  5711. }
  5712. const raw = comp.props;
  5713. const normalized = {};
  5714. const needCastKeys = [];
  5715. let hasExtends = false;
  5716. if (!isFunction(comp)) {
  5717. const extendProps = (raw2) => {
  5718. hasExtends = true;
  5719. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5720. extend(normalized, props);
  5721. if (keys)
  5722. needCastKeys.push(...keys);
  5723. };
  5724. if (!asMixin && appContext.mixins.length) {
  5725. appContext.mixins.forEach(extendProps);
  5726. }
  5727. if (comp.extends) {
  5728. extendProps(comp.extends);
  5729. }
  5730. if (comp.mixins) {
  5731. comp.mixins.forEach(extendProps);
  5732. }
  5733. }
  5734. if (!raw && !hasExtends) {
  5735. if (isObject(comp)) {
  5736. cache.set(comp, EMPTY_ARR);
  5737. }
  5738. return EMPTY_ARR;
  5739. }
  5740. if (isArray(raw)) {
  5741. for (let i = 0; i < raw.length; i++) {
  5742. if (!isString(raw[i])) {
  5743. warn$1(`props must be strings when using array syntax.`, raw[i]);
  5744. }
  5745. const normalizedKey = camelize(raw[i]);
  5746. if (validatePropName(normalizedKey)) {
  5747. normalized[normalizedKey] = EMPTY_OBJ;
  5748. }
  5749. }
  5750. } else if (raw) {
  5751. if (!isObject(raw)) {
  5752. warn$1(`invalid props options`, raw);
  5753. }
  5754. for (const key in raw) {
  5755. const normalizedKey = camelize(key);
  5756. if (validatePropName(normalizedKey)) {
  5757. const opt = raw[key];
  5758. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5759. if (prop) {
  5760. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5761. const stringIndex = getTypeIndex(String, prop.type);
  5762. prop[0 /* shouldCast */] = booleanIndex > -1;
  5763. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5764. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5765. needCastKeys.push(normalizedKey);
  5766. }
  5767. }
  5768. }
  5769. }
  5770. }
  5771. const res = [normalized, needCastKeys];
  5772. if (isObject(comp)) {
  5773. cache.set(comp, res);
  5774. }
  5775. return res;
  5776. }
  5777. function validatePropName(key) {
  5778. if (key[0] !== "$" && !isReservedProp(key)) {
  5779. return true;
  5780. } else {
  5781. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  5782. }
  5783. return false;
  5784. }
  5785. function getType(ctor) {
  5786. if (ctor === null) {
  5787. return "null";
  5788. }
  5789. if (typeof ctor === "function") {
  5790. return ctor.name || "";
  5791. } else if (typeof ctor === "object") {
  5792. const name = ctor.constructor && ctor.constructor.name;
  5793. return name || "";
  5794. }
  5795. return "";
  5796. }
  5797. function isSameType(a, b) {
  5798. return getType(a) === getType(b);
  5799. }
  5800. function getTypeIndex(type, expectedTypes) {
  5801. if (isArray(expectedTypes)) {
  5802. return expectedTypes.findIndex((t) => isSameType(t, type));
  5803. } else if (isFunction(expectedTypes)) {
  5804. return isSameType(expectedTypes, type) ? 0 : -1;
  5805. }
  5806. return -1;
  5807. }
  5808. function validateProps(rawProps, props, instance) {
  5809. const resolvedValues = toRaw(props);
  5810. const options = instance.propsOptions[0];
  5811. for (const key in options) {
  5812. let opt = options[key];
  5813. if (opt == null)
  5814. continue;
  5815. validateProp(
  5816. key,
  5817. resolvedValues[key],
  5818. opt,
  5819. shallowReadonly(resolvedValues) ,
  5820. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5821. );
  5822. }
  5823. }
  5824. function validateProp(name, value, prop, props, isAbsent) {
  5825. const { type, required, validator, skipCheck } = prop;
  5826. if (required && isAbsent) {
  5827. warn$1('Missing required prop: "' + name + '"');
  5828. return;
  5829. }
  5830. if (value == null && !required) {
  5831. return;
  5832. }
  5833. if (type != null && type !== true && !skipCheck) {
  5834. let isValid = false;
  5835. const types = isArray(type) ? type : [type];
  5836. const expectedTypes = [];
  5837. for (let i = 0; i < types.length && !isValid; i++) {
  5838. const { valid, expectedType } = assertType(value, types[i]);
  5839. expectedTypes.push(expectedType || "");
  5840. isValid = valid;
  5841. }
  5842. if (!isValid) {
  5843. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  5844. return;
  5845. }
  5846. }
  5847. if (validator && !validator(value, props)) {
  5848. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  5849. }
  5850. }
  5851. const isSimpleType = /* @__PURE__ */ makeMap(
  5852. "String,Number,Boolean,Function,Symbol,BigInt"
  5853. );
  5854. function assertType(value, type) {
  5855. let valid;
  5856. const expectedType = getType(type);
  5857. if (isSimpleType(expectedType)) {
  5858. const t = typeof value;
  5859. valid = t === expectedType.toLowerCase();
  5860. if (!valid && t === "object") {
  5861. valid = value instanceof type;
  5862. }
  5863. } else if (expectedType === "Object") {
  5864. valid = isObject(value);
  5865. } else if (expectedType === "Array") {
  5866. valid = isArray(value);
  5867. } else if (expectedType === "null") {
  5868. valid = value === null;
  5869. } else {
  5870. valid = value instanceof type;
  5871. }
  5872. return {
  5873. valid,
  5874. expectedType
  5875. };
  5876. }
  5877. function getInvalidTypeMessage(name, value, expectedTypes) {
  5878. if (expectedTypes.length === 0) {
  5879. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  5880. }
  5881. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5882. const expectedType = expectedTypes[0];
  5883. const receivedType = toRawType(value);
  5884. const expectedValue = styleValue(value, expectedType);
  5885. const receivedValue = styleValue(value, receivedType);
  5886. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5887. message += ` with value ${expectedValue}`;
  5888. }
  5889. message += `, got ${receivedType} `;
  5890. if (isExplicable(receivedType)) {
  5891. message += `with value ${receivedValue}.`;
  5892. }
  5893. return message;
  5894. }
  5895. function styleValue(value, type) {
  5896. if (type === "String") {
  5897. return `"${value}"`;
  5898. } else if (type === "Number") {
  5899. return `${Number(value)}`;
  5900. } else {
  5901. return `${value}`;
  5902. }
  5903. }
  5904. function isExplicable(type) {
  5905. const explicitTypes = ["string", "number", "boolean"];
  5906. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5907. }
  5908. function isBoolean(...args) {
  5909. return args.some((elem) => elem.toLowerCase() === "boolean");
  5910. }
  5911. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5912. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5913. const normalizeSlot = (key, rawSlot, ctx) => {
  5914. if (rawSlot._n) {
  5915. return rawSlot;
  5916. }
  5917. const normalized = withCtx((...args) => {
  5918. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  5919. warn$1(
  5920. `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.`
  5921. );
  5922. }
  5923. return normalizeSlotValue(rawSlot(...args));
  5924. }, ctx);
  5925. normalized._c = false;
  5926. return normalized;
  5927. };
  5928. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5929. const ctx = rawSlots._ctx;
  5930. for (const key in rawSlots) {
  5931. if (isInternalKey(key))
  5932. continue;
  5933. const value = rawSlots[key];
  5934. if (isFunction(value)) {
  5935. slots[key] = normalizeSlot(key, value, ctx);
  5936. } else if (value != null) {
  5937. {
  5938. warn$1(
  5939. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5940. );
  5941. }
  5942. const normalized = normalizeSlotValue(value);
  5943. slots[key] = () => normalized;
  5944. }
  5945. }
  5946. };
  5947. const normalizeVNodeSlots = (instance, children) => {
  5948. if (!isKeepAlive(instance.vnode) && true) {
  5949. warn$1(
  5950. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5951. );
  5952. }
  5953. const normalized = normalizeSlotValue(children);
  5954. instance.slots.default = () => normalized;
  5955. };
  5956. const initSlots = (instance, children) => {
  5957. if (instance.vnode.shapeFlag & 32) {
  5958. const type = children._;
  5959. if (type) {
  5960. instance.slots = toRaw(children);
  5961. def(instance.slots, "_", type);
  5962. } else {
  5963. normalizeObjectSlots(
  5964. children,
  5965. instance.slots = createInternalObject());
  5966. }
  5967. } else {
  5968. instance.slots = createInternalObject();
  5969. if (children) {
  5970. normalizeVNodeSlots(instance, children);
  5971. }
  5972. }
  5973. };
  5974. const updateSlots = (instance, children, optimized) => {
  5975. const { vnode, slots } = instance;
  5976. let needDeletionCheck = true;
  5977. let deletionComparisonTarget = EMPTY_OBJ;
  5978. if (vnode.shapeFlag & 32) {
  5979. const type = children._;
  5980. if (type) {
  5981. if (isHmrUpdating) {
  5982. extend(slots, children);
  5983. trigger(instance, "set", "$slots");
  5984. } else if (optimized && type === 1) {
  5985. needDeletionCheck = false;
  5986. } else {
  5987. extend(slots, children);
  5988. if (!optimized && type === 1) {
  5989. delete slots._;
  5990. }
  5991. }
  5992. } else {
  5993. needDeletionCheck = !children.$stable;
  5994. normalizeObjectSlots(children, slots);
  5995. }
  5996. deletionComparisonTarget = children;
  5997. } else if (children) {
  5998. normalizeVNodeSlots(instance, children);
  5999. deletionComparisonTarget = { default: 1 };
  6000. }
  6001. if (needDeletionCheck) {
  6002. for (const key in slots) {
  6003. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6004. delete slots[key];
  6005. }
  6006. }
  6007. }
  6008. };
  6009. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  6010. if (isArray(rawRef)) {
  6011. rawRef.forEach(
  6012. (r, i) => setRef(
  6013. r,
  6014. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  6015. parentSuspense,
  6016. vnode,
  6017. isUnmount
  6018. )
  6019. );
  6020. return;
  6021. }
  6022. if (isAsyncWrapper(vnode) && !isUnmount) {
  6023. return;
  6024. }
  6025. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  6026. const value = isUnmount ? null : refValue;
  6027. const { i: owner, r: ref } = rawRef;
  6028. if (!owner) {
  6029. warn$1(
  6030. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  6031. );
  6032. return;
  6033. }
  6034. const oldRef = oldRawRef && oldRawRef.r;
  6035. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  6036. const setupState = owner.setupState;
  6037. if (oldRef != null && oldRef !== ref) {
  6038. if (isString(oldRef)) {
  6039. refs[oldRef] = null;
  6040. if (hasOwn(setupState, oldRef)) {
  6041. setupState[oldRef] = null;
  6042. }
  6043. } else if (isRef(oldRef)) {
  6044. oldRef.value = null;
  6045. }
  6046. }
  6047. if (isFunction(ref)) {
  6048. callWithErrorHandling(ref, owner, 12, [value, refs]);
  6049. } else {
  6050. const _isString = isString(ref);
  6051. const _isRef = isRef(ref);
  6052. if (_isString || _isRef) {
  6053. const doSet = () => {
  6054. if (rawRef.f) {
  6055. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  6056. if (isUnmount) {
  6057. isArray(existing) && remove(existing, refValue);
  6058. } else {
  6059. if (!isArray(existing)) {
  6060. if (_isString) {
  6061. refs[ref] = [refValue];
  6062. if (hasOwn(setupState, ref)) {
  6063. setupState[ref] = refs[ref];
  6064. }
  6065. } else {
  6066. ref.value = [refValue];
  6067. if (rawRef.k)
  6068. refs[rawRef.k] = ref.value;
  6069. }
  6070. } else if (!existing.includes(refValue)) {
  6071. existing.push(refValue);
  6072. }
  6073. }
  6074. } else if (_isString) {
  6075. refs[ref] = value;
  6076. if (hasOwn(setupState, ref)) {
  6077. setupState[ref] = value;
  6078. }
  6079. } else if (_isRef) {
  6080. ref.value = value;
  6081. if (rawRef.k)
  6082. refs[rawRef.k] = value;
  6083. } else {
  6084. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  6085. }
  6086. };
  6087. if (value) {
  6088. doSet.id = -1;
  6089. queuePostRenderEffect(doSet, parentSuspense);
  6090. } else {
  6091. doSet();
  6092. }
  6093. } else {
  6094. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  6095. }
  6096. }
  6097. }
  6098. let hasMismatch = false;
  6099. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  6100. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  6101. const getContainerType = (container) => {
  6102. if (isSVGContainer(container))
  6103. return "svg";
  6104. if (isMathMLContainer(container))
  6105. return "mathml";
  6106. return void 0;
  6107. };
  6108. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  6109. function createHydrationFunctions(rendererInternals) {
  6110. const {
  6111. mt: mountComponent,
  6112. p: patch,
  6113. o: {
  6114. patchProp,
  6115. createText,
  6116. nextSibling,
  6117. parentNode,
  6118. remove,
  6119. insert,
  6120. createComment
  6121. }
  6122. } = rendererInternals;
  6123. const hydrate = (vnode, container) => {
  6124. if (!container.hasChildNodes()) {
  6125. warn$1(
  6126. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  6127. );
  6128. patch(null, vnode, container);
  6129. flushPostFlushCbs();
  6130. container._vnode = vnode;
  6131. return;
  6132. }
  6133. hasMismatch = false;
  6134. hydrateNode(container.firstChild, vnode, null, null, null);
  6135. flushPostFlushCbs();
  6136. container._vnode = vnode;
  6137. if (hasMismatch && true) {
  6138. console.error(`Hydration completed but contains mismatches.`);
  6139. }
  6140. };
  6141. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  6142. optimized = optimized || !!vnode.dynamicChildren;
  6143. const isFragmentStart = isComment(node) && node.data === "[";
  6144. const onMismatch = () => handleMismatch(
  6145. node,
  6146. vnode,
  6147. parentComponent,
  6148. parentSuspense,
  6149. slotScopeIds,
  6150. isFragmentStart
  6151. );
  6152. const { type, ref, shapeFlag, patchFlag } = vnode;
  6153. let domType = node.nodeType;
  6154. vnode.el = node;
  6155. {
  6156. if (!("__vnode" in node)) {
  6157. Object.defineProperty(node, "__vnode", {
  6158. value: vnode,
  6159. enumerable: false
  6160. });
  6161. }
  6162. if (!("__vueParentComponent" in node)) {
  6163. Object.defineProperty(node, "__vueParentComponent", {
  6164. value: parentComponent,
  6165. enumerable: false
  6166. });
  6167. }
  6168. }
  6169. if (patchFlag === -2) {
  6170. optimized = false;
  6171. vnode.dynamicChildren = null;
  6172. }
  6173. let nextNode = null;
  6174. switch (type) {
  6175. case Text:
  6176. if (domType !== 3 /* TEXT */) {
  6177. if (vnode.children === "") {
  6178. insert(vnode.el = createText(""), parentNode(node), node);
  6179. nextNode = node;
  6180. } else {
  6181. nextNode = onMismatch();
  6182. }
  6183. } else {
  6184. if (node.data !== vnode.children) {
  6185. hasMismatch = true;
  6186. warn$1(
  6187. `Hydration text mismatch in`,
  6188. node.parentNode,
  6189. `
  6190. - rendered on server: ${JSON.stringify(
  6191. node.data
  6192. )}
  6193. - expected on client: ${JSON.stringify(vnode.children)}`
  6194. );
  6195. node.data = vnode.children;
  6196. }
  6197. nextNode = nextSibling(node);
  6198. }
  6199. break;
  6200. case Comment:
  6201. if (isTemplateNode(node)) {
  6202. nextNode = nextSibling(node);
  6203. replaceNode(
  6204. vnode.el = node.content.firstChild,
  6205. node,
  6206. parentComponent
  6207. );
  6208. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  6209. nextNode = onMismatch();
  6210. } else {
  6211. nextNode = nextSibling(node);
  6212. }
  6213. break;
  6214. case Static:
  6215. if (isFragmentStart) {
  6216. node = nextSibling(node);
  6217. domType = node.nodeType;
  6218. }
  6219. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  6220. nextNode = node;
  6221. const needToAdoptContent = !vnode.children.length;
  6222. for (let i = 0; i < vnode.staticCount; i++) {
  6223. if (needToAdoptContent)
  6224. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  6225. if (i === vnode.staticCount - 1) {
  6226. vnode.anchor = nextNode;
  6227. }
  6228. nextNode = nextSibling(nextNode);
  6229. }
  6230. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  6231. } else {
  6232. onMismatch();
  6233. }
  6234. break;
  6235. case Fragment:
  6236. if (!isFragmentStart) {
  6237. nextNode = onMismatch();
  6238. } else {
  6239. nextNode = hydrateFragment(
  6240. node,
  6241. vnode,
  6242. parentComponent,
  6243. parentSuspense,
  6244. slotScopeIds,
  6245. optimized
  6246. );
  6247. }
  6248. break;
  6249. default:
  6250. if (shapeFlag & 1) {
  6251. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  6252. nextNode = onMismatch();
  6253. } else {
  6254. nextNode = hydrateElement(
  6255. node,
  6256. vnode,
  6257. parentComponent,
  6258. parentSuspense,
  6259. slotScopeIds,
  6260. optimized
  6261. );
  6262. }
  6263. } else if (shapeFlag & 6) {
  6264. vnode.slotScopeIds = slotScopeIds;
  6265. const container = parentNode(node);
  6266. if (isFragmentStart) {
  6267. nextNode = locateClosingAnchor(node);
  6268. } else if (isComment(node) && node.data === "teleport start") {
  6269. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  6270. } else {
  6271. nextNode = nextSibling(node);
  6272. }
  6273. mountComponent(
  6274. vnode,
  6275. container,
  6276. null,
  6277. parentComponent,
  6278. parentSuspense,
  6279. getContainerType(container),
  6280. optimized
  6281. );
  6282. if (isAsyncWrapper(vnode)) {
  6283. let subTree;
  6284. if (isFragmentStart) {
  6285. subTree = createVNode(Fragment);
  6286. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  6287. } else {
  6288. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  6289. }
  6290. subTree.el = node;
  6291. vnode.component.subTree = subTree;
  6292. }
  6293. } else if (shapeFlag & 64) {
  6294. if (domType !== 8 /* COMMENT */) {
  6295. nextNode = onMismatch();
  6296. } else {
  6297. nextNode = vnode.type.hydrate(
  6298. node,
  6299. vnode,
  6300. parentComponent,
  6301. parentSuspense,
  6302. slotScopeIds,
  6303. optimized,
  6304. rendererInternals,
  6305. hydrateChildren
  6306. );
  6307. }
  6308. } else if (shapeFlag & 128) {
  6309. nextNode = vnode.type.hydrate(
  6310. node,
  6311. vnode,
  6312. parentComponent,
  6313. parentSuspense,
  6314. getContainerType(parentNode(node)),
  6315. slotScopeIds,
  6316. optimized,
  6317. rendererInternals,
  6318. hydrateNode
  6319. );
  6320. } else {
  6321. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  6322. }
  6323. }
  6324. if (ref != null) {
  6325. setRef(ref, null, parentSuspense, vnode);
  6326. }
  6327. return nextNode;
  6328. };
  6329. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6330. optimized = optimized || !!vnode.dynamicChildren;
  6331. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  6332. const forcePatch = type === "input" || type === "option";
  6333. {
  6334. if (dirs) {
  6335. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6336. }
  6337. let needCallTransitionHooks = false;
  6338. if (isTemplateNode(el)) {
  6339. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  6340. const content = el.content.firstChild;
  6341. if (needCallTransitionHooks) {
  6342. transition.beforeEnter(content);
  6343. }
  6344. replaceNode(content, el, parentComponent);
  6345. vnode.el = el = content;
  6346. }
  6347. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6348. !(props && (props.innerHTML || props.textContent))) {
  6349. let next = hydrateChildren(
  6350. el.firstChild,
  6351. vnode,
  6352. el,
  6353. parentComponent,
  6354. parentSuspense,
  6355. slotScopeIds,
  6356. optimized
  6357. );
  6358. let hasWarned = false;
  6359. while (next) {
  6360. hasMismatch = true;
  6361. if (!hasWarned) {
  6362. warn$1(
  6363. `Hydration children mismatch on`,
  6364. el,
  6365. `
  6366. Server rendered element contains more child nodes than client vdom.`
  6367. );
  6368. hasWarned = true;
  6369. }
  6370. const cur = next;
  6371. next = next.nextSibling;
  6372. remove(cur);
  6373. }
  6374. } else if (shapeFlag & 8) {
  6375. if (el.textContent !== vnode.children) {
  6376. hasMismatch = true;
  6377. warn$1(
  6378. `Hydration text content mismatch on`,
  6379. el,
  6380. `
  6381. - rendered on server: ${el.textContent}
  6382. - expected on client: ${vnode.children}`
  6383. );
  6384. el.textContent = vnode.children;
  6385. }
  6386. }
  6387. if (props) {
  6388. {
  6389. for (const key in props) {
  6390. if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  6391. hasMismatch = true;
  6392. }
  6393. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  6394. key[0] === ".") {
  6395. patchProp(
  6396. el,
  6397. key,
  6398. null,
  6399. props[key],
  6400. void 0,
  6401. void 0,
  6402. parentComponent
  6403. );
  6404. }
  6405. }
  6406. }
  6407. }
  6408. let vnodeHooks;
  6409. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6410. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6411. }
  6412. if (dirs) {
  6413. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6414. }
  6415. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  6416. queueEffectWithSuspense(() => {
  6417. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6418. needCallTransitionHooks && transition.enter(el);
  6419. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6420. }, parentSuspense);
  6421. }
  6422. }
  6423. return el.nextSibling;
  6424. };
  6425. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6426. optimized = optimized || !!parentVNode.dynamicChildren;
  6427. const children = parentVNode.children;
  6428. const l = children.length;
  6429. let hasWarned = false;
  6430. for (let i = 0; i < l; i++) {
  6431. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6432. if (node) {
  6433. node = hydrateNode(
  6434. node,
  6435. vnode,
  6436. parentComponent,
  6437. parentSuspense,
  6438. slotScopeIds,
  6439. optimized
  6440. );
  6441. } else if (vnode.type === Text && !vnode.children) {
  6442. continue;
  6443. } else {
  6444. hasMismatch = true;
  6445. if (!hasWarned) {
  6446. warn$1(
  6447. `Hydration children mismatch on`,
  6448. container,
  6449. `
  6450. Server rendered element contains fewer child nodes than client vdom.`
  6451. );
  6452. hasWarned = true;
  6453. }
  6454. patch(
  6455. null,
  6456. vnode,
  6457. container,
  6458. null,
  6459. parentComponent,
  6460. parentSuspense,
  6461. getContainerType(container),
  6462. slotScopeIds
  6463. );
  6464. }
  6465. }
  6466. return node;
  6467. };
  6468. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6469. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  6470. if (fragmentSlotScopeIds) {
  6471. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6472. }
  6473. const container = parentNode(node);
  6474. const next = hydrateChildren(
  6475. nextSibling(node),
  6476. vnode,
  6477. container,
  6478. parentComponent,
  6479. parentSuspense,
  6480. slotScopeIds,
  6481. optimized
  6482. );
  6483. if (next && isComment(next) && next.data === "]") {
  6484. return nextSibling(vnode.anchor = next);
  6485. } else {
  6486. hasMismatch = true;
  6487. insert(vnode.anchor = createComment(`]`), container, next);
  6488. return next;
  6489. }
  6490. };
  6491. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6492. hasMismatch = true;
  6493. warn$1(
  6494. `Hydration node mismatch:
  6495. - rendered on server:`,
  6496. node,
  6497. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  6498. `
  6499. - expected on client:`,
  6500. vnode.type
  6501. );
  6502. vnode.el = null;
  6503. if (isFragment) {
  6504. const end = locateClosingAnchor(node);
  6505. while (true) {
  6506. const next2 = nextSibling(node);
  6507. if (next2 && next2 !== end) {
  6508. remove(next2);
  6509. } else {
  6510. break;
  6511. }
  6512. }
  6513. }
  6514. const next = nextSibling(node);
  6515. const container = parentNode(node);
  6516. remove(node);
  6517. patch(
  6518. null,
  6519. vnode,
  6520. container,
  6521. next,
  6522. parentComponent,
  6523. parentSuspense,
  6524. getContainerType(container),
  6525. slotScopeIds
  6526. );
  6527. return next;
  6528. };
  6529. const locateClosingAnchor = (node, open = "[", close = "]") => {
  6530. let match = 0;
  6531. while (node) {
  6532. node = nextSibling(node);
  6533. if (node && isComment(node)) {
  6534. if (node.data === open)
  6535. match++;
  6536. if (node.data === close) {
  6537. if (match === 0) {
  6538. return nextSibling(node);
  6539. } else {
  6540. match--;
  6541. }
  6542. }
  6543. }
  6544. }
  6545. return node;
  6546. };
  6547. const replaceNode = (newNode, oldNode, parentComponent) => {
  6548. const parentNode2 = oldNode.parentNode;
  6549. if (parentNode2) {
  6550. parentNode2.replaceChild(newNode, oldNode);
  6551. }
  6552. let parent = parentComponent;
  6553. while (parent) {
  6554. if (parent.vnode.el === oldNode) {
  6555. parent.vnode.el = parent.subTree.el = newNode;
  6556. }
  6557. parent = parent.parent;
  6558. }
  6559. };
  6560. const isTemplateNode = (node) => {
  6561. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  6562. };
  6563. return [hydrate, hydrateNode];
  6564. }
  6565. function propHasMismatch(el, key, clientValue, vnode, instance) {
  6566. var _a;
  6567. let mismatchType;
  6568. let mismatchKey;
  6569. let actual;
  6570. let expected;
  6571. if (key === "class") {
  6572. actual = el.getAttribute("class");
  6573. expected = normalizeClass(clientValue);
  6574. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  6575. mismatchType = mismatchKey = `class`;
  6576. }
  6577. } else if (key === "style") {
  6578. actual = el.getAttribute("style");
  6579. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  6580. const actualMap = toStyleMap(actual);
  6581. const expectedMap = toStyleMap(expected);
  6582. if (vnode.dirs) {
  6583. for (const { dir, value } of vnode.dirs) {
  6584. if (dir.name === "show" && !value) {
  6585. expectedMap.set("display", "none");
  6586. }
  6587. }
  6588. }
  6589. const root = instance == null ? void 0 : instance.subTree;
  6590. if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
  6591. const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
  6592. for (const key2 in cssVars) {
  6593. expectedMap.set(`--${key2}`, String(cssVars[key2]));
  6594. }
  6595. }
  6596. if (!isMapEqual(actualMap, expectedMap)) {
  6597. mismatchType = mismatchKey = "style";
  6598. }
  6599. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  6600. if (isBooleanAttr(key)) {
  6601. actual = el.hasAttribute(key);
  6602. expected = includeBooleanAttr(clientValue);
  6603. } else if (clientValue == null) {
  6604. actual = el.hasAttribute(key);
  6605. expected = false;
  6606. } else {
  6607. if (el.hasAttribute(key)) {
  6608. actual = el.getAttribute(key);
  6609. } else if (key === "value" && el.tagName === "TEXTAREA") {
  6610. actual = el.value;
  6611. } else {
  6612. actual = false;
  6613. }
  6614. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  6615. }
  6616. if (actual !== expected) {
  6617. mismatchType = `attribute`;
  6618. mismatchKey = key;
  6619. }
  6620. }
  6621. if (mismatchType) {
  6622. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  6623. const preSegment = `Hydration ${mismatchType} mismatch on`;
  6624. const postSegment = `
  6625. - rendered on server: ${format(actual)}
  6626. - expected on client: ${format(expected)}
  6627. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  6628. You should fix the source of the mismatch.`;
  6629. {
  6630. warn$1(preSegment, el, postSegment);
  6631. }
  6632. return true;
  6633. }
  6634. return false;
  6635. }
  6636. function toClassSet(str) {
  6637. return new Set(str.trim().split(/\s+/));
  6638. }
  6639. function isSetEqual(a, b) {
  6640. if (a.size !== b.size) {
  6641. return false;
  6642. }
  6643. for (const s of a) {
  6644. if (!b.has(s)) {
  6645. return false;
  6646. }
  6647. }
  6648. return true;
  6649. }
  6650. function toStyleMap(str) {
  6651. const styleMap = /* @__PURE__ */ new Map();
  6652. for (const item of str.split(";")) {
  6653. let [key, value] = item.split(":");
  6654. key = key == null ? void 0 : key.trim();
  6655. value = value == null ? void 0 : value.trim();
  6656. if (key && value) {
  6657. styleMap.set(key, value);
  6658. }
  6659. }
  6660. return styleMap;
  6661. }
  6662. function isMapEqual(a, b) {
  6663. if (a.size !== b.size) {
  6664. return false;
  6665. }
  6666. for (const [key, value] of a) {
  6667. if (value !== b.get(key)) {
  6668. return false;
  6669. }
  6670. }
  6671. return true;
  6672. }
  6673. let supported;
  6674. let perf;
  6675. function startMeasure(instance, type) {
  6676. if (instance.appContext.config.performance && isSupported()) {
  6677. perf.mark(`vue-${type}-${instance.uid}`);
  6678. }
  6679. {
  6680. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6681. }
  6682. }
  6683. function endMeasure(instance, type) {
  6684. if (instance.appContext.config.performance && isSupported()) {
  6685. const startTag = `vue-${type}-${instance.uid}`;
  6686. const endTag = startTag + `:end`;
  6687. perf.mark(endTag);
  6688. perf.measure(
  6689. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6690. startTag,
  6691. endTag
  6692. );
  6693. perf.clearMarks(startTag);
  6694. perf.clearMarks(endTag);
  6695. }
  6696. {
  6697. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6698. }
  6699. }
  6700. function isSupported() {
  6701. if (supported !== void 0) {
  6702. return supported;
  6703. }
  6704. if (typeof window !== "undefined" && window.performance) {
  6705. supported = true;
  6706. perf = window.performance;
  6707. } else {
  6708. supported = false;
  6709. }
  6710. return supported;
  6711. }
  6712. const queuePostRenderEffect = queueEffectWithSuspense ;
  6713. function createRenderer(options) {
  6714. return baseCreateRenderer(options);
  6715. }
  6716. function createHydrationRenderer(options) {
  6717. return baseCreateRenderer(options, createHydrationFunctions);
  6718. }
  6719. function baseCreateRenderer(options, createHydrationFns) {
  6720. const target = getGlobalThis();
  6721. target.__VUE__ = true;
  6722. {
  6723. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6724. }
  6725. const {
  6726. insert: hostInsert,
  6727. remove: hostRemove,
  6728. patchProp: hostPatchProp,
  6729. createElement: hostCreateElement,
  6730. createText: hostCreateText,
  6731. createComment: hostCreateComment,
  6732. setText: hostSetText,
  6733. setElementText: hostSetElementText,
  6734. parentNode: hostParentNode,
  6735. nextSibling: hostNextSibling,
  6736. setScopeId: hostSetScopeId = NOOP,
  6737. insertStaticContent: hostInsertStaticContent
  6738. } = options;
  6739. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6740. if (n1 === n2) {
  6741. return;
  6742. }
  6743. if (n1 && !isSameVNodeType(n1, n2)) {
  6744. anchor = getNextHostNode(n1);
  6745. unmount(n1, parentComponent, parentSuspense, true);
  6746. n1 = null;
  6747. }
  6748. if (n2.patchFlag === -2) {
  6749. optimized = false;
  6750. n2.dynamicChildren = null;
  6751. }
  6752. const { type, ref, shapeFlag } = n2;
  6753. switch (type) {
  6754. case Text:
  6755. processText(n1, n2, container, anchor);
  6756. break;
  6757. case Comment:
  6758. processCommentNode(n1, n2, container, anchor);
  6759. break;
  6760. case Static:
  6761. if (n1 == null) {
  6762. mountStaticNode(n2, container, anchor, namespace);
  6763. } else {
  6764. patchStaticNode(n1, n2, container, namespace);
  6765. }
  6766. break;
  6767. case Fragment:
  6768. processFragment(
  6769. n1,
  6770. n2,
  6771. container,
  6772. anchor,
  6773. parentComponent,
  6774. parentSuspense,
  6775. namespace,
  6776. slotScopeIds,
  6777. optimized
  6778. );
  6779. break;
  6780. default:
  6781. if (shapeFlag & 1) {
  6782. processElement(
  6783. n1,
  6784. n2,
  6785. container,
  6786. anchor,
  6787. parentComponent,
  6788. parentSuspense,
  6789. namespace,
  6790. slotScopeIds,
  6791. optimized
  6792. );
  6793. } else if (shapeFlag & 6) {
  6794. processComponent(
  6795. n1,
  6796. n2,
  6797. container,
  6798. anchor,
  6799. parentComponent,
  6800. parentSuspense,
  6801. namespace,
  6802. slotScopeIds,
  6803. optimized
  6804. );
  6805. } else if (shapeFlag & 64) {
  6806. type.process(
  6807. n1,
  6808. n2,
  6809. container,
  6810. anchor,
  6811. parentComponent,
  6812. parentSuspense,
  6813. namespace,
  6814. slotScopeIds,
  6815. optimized,
  6816. internals
  6817. );
  6818. } else if (shapeFlag & 128) {
  6819. type.process(
  6820. n1,
  6821. n2,
  6822. container,
  6823. anchor,
  6824. parentComponent,
  6825. parentSuspense,
  6826. namespace,
  6827. slotScopeIds,
  6828. optimized,
  6829. internals
  6830. );
  6831. } else {
  6832. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6833. }
  6834. }
  6835. if (ref != null && parentComponent) {
  6836. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6837. }
  6838. };
  6839. const processText = (n1, n2, container, anchor) => {
  6840. if (n1 == null) {
  6841. hostInsert(
  6842. n2.el = hostCreateText(n2.children),
  6843. container,
  6844. anchor
  6845. );
  6846. } else {
  6847. const el = n2.el = n1.el;
  6848. if (n2.children !== n1.children) {
  6849. hostSetText(el, n2.children);
  6850. }
  6851. }
  6852. };
  6853. const processCommentNode = (n1, n2, container, anchor) => {
  6854. if (n1 == null) {
  6855. hostInsert(
  6856. n2.el = hostCreateComment(n2.children || ""),
  6857. container,
  6858. anchor
  6859. );
  6860. } else {
  6861. n2.el = n1.el;
  6862. }
  6863. };
  6864. const mountStaticNode = (n2, container, anchor, namespace) => {
  6865. [n2.el, n2.anchor] = hostInsertStaticContent(
  6866. n2.children,
  6867. container,
  6868. anchor,
  6869. namespace,
  6870. n2.el,
  6871. n2.anchor
  6872. );
  6873. };
  6874. const patchStaticNode = (n1, n2, container, namespace) => {
  6875. if (n2.children !== n1.children) {
  6876. const anchor = hostNextSibling(n1.anchor);
  6877. removeStaticNode(n1);
  6878. [n2.el, n2.anchor] = hostInsertStaticContent(
  6879. n2.children,
  6880. container,
  6881. anchor,
  6882. namespace
  6883. );
  6884. } else {
  6885. n2.el = n1.el;
  6886. n2.anchor = n1.anchor;
  6887. }
  6888. };
  6889. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6890. let next;
  6891. while (el && el !== anchor) {
  6892. next = hostNextSibling(el);
  6893. hostInsert(el, container, nextSibling);
  6894. el = next;
  6895. }
  6896. hostInsert(anchor, container, nextSibling);
  6897. };
  6898. const removeStaticNode = ({ el, anchor }) => {
  6899. let next;
  6900. while (el && el !== anchor) {
  6901. next = hostNextSibling(el);
  6902. hostRemove(el);
  6903. el = next;
  6904. }
  6905. hostRemove(anchor);
  6906. };
  6907. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6908. if (n2.type === "svg") {
  6909. namespace = "svg";
  6910. } else if (n2.type === "math") {
  6911. namespace = "mathml";
  6912. }
  6913. if (n1 == null) {
  6914. mountElement(
  6915. n2,
  6916. container,
  6917. anchor,
  6918. parentComponent,
  6919. parentSuspense,
  6920. namespace,
  6921. slotScopeIds,
  6922. optimized
  6923. );
  6924. } else {
  6925. patchElement(
  6926. n1,
  6927. n2,
  6928. parentComponent,
  6929. parentSuspense,
  6930. namespace,
  6931. slotScopeIds,
  6932. optimized
  6933. );
  6934. }
  6935. };
  6936. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6937. let el;
  6938. let vnodeHook;
  6939. const { props, shapeFlag, transition, dirs } = vnode;
  6940. el = vnode.el = hostCreateElement(
  6941. vnode.type,
  6942. namespace,
  6943. props && props.is,
  6944. props
  6945. );
  6946. if (shapeFlag & 8) {
  6947. hostSetElementText(el, vnode.children);
  6948. } else if (shapeFlag & 16) {
  6949. mountChildren(
  6950. vnode.children,
  6951. el,
  6952. null,
  6953. parentComponent,
  6954. parentSuspense,
  6955. resolveChildrenNamespace(vnode, namespace),
  6956. slotScopeIds,
  6957. optimized
  6958. );
  6959. }
  6960. if (dirs) {
  6961. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6962. }
  6963. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6964. if (props) {
  6965. for (const key in props) {
  6966. if (key !== "value" && !isReservedProp(key)) {
  6967. hostPatchProp(
  6968. el,
  6969. key,
  6970. null,
  6971. props[key],
  6972. namespace,
  6973. vnode.children,
  6974. parentComponent,
  6975. parentSuspense,
  6976. unmountChildren
  6977. );
  6978. }
  6979. }
  6980. if ("value" in props) {
  6981. hostPatchProp(el, "value", null, props.value, namespace);
  6982. }
  6983. if (vnodeHook = props.onVnodeBeforeMount) {
  6984. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6985. }
  6986. }
  6987. {
  6988. Object.defineProperty(el, "__vnode", {
  6989. value: vnode,
  6990. enumerable: false
  6991. });
  6992. Object.defineProperty(el, "__vueParentComponent", {
  6993. value: parentComponent,
  6994. enumerable: false
  6995. });
  6996. }
  6997. if (dirs) {
  6998. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6999. }
  7000. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  7001. if (needCallTransitionHooks) {
  7002. transition.beforeEnter(el);
  7003. }
  7004. hostInsert(el, container, anchor);
  7005. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  7006. queuePostRenderEffect(() => {
  7007. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7008. needCallTransitionHooks && transition.enter(el);
  7009. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  7010. }, parentSuspense);
  7011. }
  7012. };
  7013. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  7014. if (scopeId) {
  7015. hostSetScopeId(el, scopeId);
  7016. }
  7017. if (slotScopeIds) {
  7018. for (let i = 0; i < slotScopeIds.length; i++) {
  7019. hostSetScopeId(el, slotScopeIds[i]);
  7020. }
  7021. }
  7022. if (parentComponent) {
  7023. let subTree = parentComponent.subTree;
  7024. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7025. subTree = filterSingleRoot(subTree.children) || subTree;
  7026. }
  7027. if (vnode === subTree) {
  7028. const parentVNode = parentComponent.vnode;
  7029. setScopeId(
  7030. el,
  7031. parentVNode,
  7032. parentVNode.scopeId,
  7033. parentVNode.slotScopeIds,
  7034. parentComponent.parent
  7035. );
  7036. }
  7037. }
  7038. };
  7039. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7040. for (let i = start; i < children.length; i++) {
  7041. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7042. patch(
  7043. null,
  7044. child,
  7045. container,
  7046. anchor,
  7047. parentComponent,
  7048. parentSuspense,
  7049. namespace,
  7050. slotScopeIds,
  7051. optimized
  7052. );
  7053. }
  7054. };
  7055. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7056. const el = n2.el = n1.el;
  7057. let { patchFlag, dynamicChildren, dirs } = n2;
  7058. patchFlag |= n1.patchFlag & 16;
  7059. const oldProps = n1.props || EMPTY_OBJ;
  7060. const newProps = n2.props || EMPTY_OBJ;
  7061. let vnodeHook;
  7062. parentComponent && toggleRecurse(parentComponent, false);
  7063. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7064. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7065. }
  7066. if (dirs) {
  7067. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7068. }
  7069. parentComponent && toggleRecurse(parentComponent, true);
  7070. if (isHmrUpdating) {
  7071. patchFlag = 0;
  7072. optimized = false;
  7073. dynamicChildren = null;
  7074. }
  7075. if (dynamicChildren) {
  7076. patchBlockChildren(
  7077. n1.dynamicChildren,
  7078. dynamicChildren,
  7079. el,
  7080. parentComponent,
  7081. parentSuspense,
  7082. resolveChildrenNamespace(n2, namespace),
  7083. slotScopeIds
  7084. );
  7085. {
  7086. traverseStaticChildren(n1, n2);
  7087. }
  7088. } else if (!optimized) {
  7089. patchChildren(
  7090. n1,
  7091. n2,
  7092. el,
  7093. null,
  7094. parentComponent,
  7095. parentSuspense,
  7096. resolveChildrenNamespace(n2, namespace),
  7097. slotScopeIds,
  7098. false
  7099. );
  7100. }
  7101. if (patchFlag > 0) {
  7102. if (patchFlag & 16) {
  7103. patchProps(
  7104. el,
  7105. n2,
  7106. oldProps,
  7107. newProps,
  7108. parentComponent,
  7109. parentSuspense,
  7110. namespace
  7111. );
  7112. } else {
  7113. if (patchFlag & 2) {
  7114. if (oldProps.class !== newProps.class) {
  7115. hostPatchProp(el, "class", null, newProps.class, namespace);
  7116. }
  7117. }
  7118. if (patchFlag & 4) {
  7119. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7120. }
  7121. if (patchFlag & 8) {
  7122. const propsToUpdate = n2.dynamicProps;
  7123. for (let i = 0; i < propsToUpdate.length; i++) {
  7124. const key = propsToUpdate[i];
  7125. const prev = oldProps[key];
  7126. const next = newProps[key];
  7127. if (next !== prev || key === "value") {
  7128. hostPatchProp(
  7129. el,
  7130. key,
  7131. prev,
  7132. next,
  7133. namespace,
  7134. n1.children,
  7135. parentComponent,
  7136. parentSuspense,
  7137. unmountChildren
  7138. );
  7139. }
  7140. }
  7141. }
  7142. }
  7143. if (patchFlag & 1) {
  7144. if (n1.children !== n2.children) {
  7145. hostSetElementText(el, n2.children);
  7146. }
  7147. }
  7148. } else if (!optimized && dynamicChildren == null) {
  7149. patchProps(
  7150. el,
  7151. n2,
  7152. oldProps,
  7153. newProps,
  7154. parentComponent,
  7155. parentSuspense,
  7156. namespace
  7157. );
  7158. }
  7159. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7160. queuePostRenderEffect(() => {
  7161. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7162. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7163. }, parentSuspense);
  7164. }
  7165. };
  7166. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7167. for (let i = 0; i < newChildren.length; i++) {
  7168. const oldVNode = oldChildren[i];
  7169. const newVNode = newChildren[i];
  7170. const container = (
  7171. // oldVNode may be an errored async setup() component inside Suspense
  7172. // which will not have a mounted element
  7173. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7174. // of the Fragment itself so it can move its children.
  7175. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7176. // which also requires the correct parent container
  7177. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7178. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  7179. // In other cases, the parent container is not actually used so we
  7180. // just pass the block element here to avoid a DOM parentNode call.
  7181. fallbackContainer
  7182. )
  7183. );
  7184. patch(
  7185. oldVNode,
  7186. newVNode,
  7187. container,
  7188. null,
  7189. parentComponent,
  7190. parentSuspense,
  7191. namespace,
  7192. slotScopeIds,
  7193. true
  7194. );
  7195. }
  7196. };
  7197. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
  7198. if (oldProps !== newProps) {
  7199. if (oldProps !== EMPTY_OBJ) {
  7200. for (const key in oldProps) {
  7201. if (!isReservedProp(key) && !(key in newProps)) {
  7202. hostPatchProp(
  7203. el,
  7204. key,
  7205. oldProps[key],
  7206. null,
  7207. namespace,
  7208. vnode.children,
  7209. parentComponent,
  7210. parentSuspense,
  7211. unmountChildren
  7212. );
  7213. }
  7214. }
  7215. }
  7216. for (const key in newProps) {
  7217. if (isReservedProp(key))
  7218. continue;
  7219. const next = newProps[key];
  7220. const prev = oldProps[key];
  7221. if (next !== prev && key !== "value") {
  7222. hostPatchProp(
  7223. el,
  7224. key,
  7225. prev,
  7226. next,
  7227. namespace,
  7228. vnode.children,
  7229. parentComponent,
  7230. parentSuspense,
  7231. unmountChildren
  7232. );
  7233. }
  7234. }
  7235. if ("value" in newProps) {
  7236. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7237. }
  7238. }
  7239. };
  7240. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7241. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7242. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7243. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7244. if (
  7245. // #5523 dev root fragment may inherit directives
  7246. isHmrUpdating || patchFlag & 2048
  7247. ) {
  7248. patchFlag = 0;
  7249. optimized = false;
  7250. dynamicChildren = null;
  7251. }
  7252. if (fragmentSlotScopeIds) {
  7253. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7254. }
  7255. if (n1 == null) {
  7256. hostInsert(fragmentStartAnchor, container, anchor);
  7257. hostInsert(fragmentEndAnchor, container, anchor);
  7258. mountChildren(
  7259. // #10007
  7260. // such fragment like `<></>` will be compiled into
  7261. // a fragment which doesn't have a children.
  7262. // In this case fallback to an empty array
  7263. n2.children || [],
  7264. container,
  7265. fragmentEndAnchor,
  7266. parentComponent,
  7267. parentSuspense,
  7268. namespace,
  7269. slotScopeIds,
  7270. optimized
  7271. );
  7272. } else {
  7273. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7274. // of renderSlot() with no valid children
  7275. n1.dynamicChildren) {
  7276. patchBlockChildren(
  7277. n1.dynamicChildren,
  7278. dynamicChildren,
  7279. container,
  7280. parentComponent,
  7281. parentSuspense,
  7282. namespace,
  7283. slotScopeIds
  7284. );
  7285. {
  7286. traverseStaticChildren(n1, n2);
  7287. }
  7288. } else {
  7289. patchChildren(
  7290. n1,
  7291. n2,
  7292. container,
  7293. fragmentEndAnchor,
  7294. parentComponent,
  7295. parentSuspense,
  7296. namespace,
  7297. slotScopeIds,
  7298. optimized
  7299. );
  7300. }
  7301. }
  7302. };
  7303. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7304. n2.slotScopeIds = slotScopeIds;
  7305. if (n1 == null) {
  7306. if (n2.shapeFlag & 512) {
  7307. parentComponent.ctx.activate(
  7308. n2,
  7309. container,
  7310. anchor,
  7311. namespace,
  7312. optimized
  7313. );
  7314. } else {
  7315. mountComponent(
  7316. n2,
  7317. container,
  7318. anchor,
  7319. parentComponent,
  7320. parentSuspense,
  7321. namespace,
  7322. optimized
  7323. );
  7324. }
  7325. } else {
  7326. updateComponent(n1, n2, optimized);
  7327. }
  7328. };
  7329. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7330. const instance = (initialVNode.component = createComponentInstance(
  7331. initialVNode,
  7332. parentComponent,
  7333. parentSuspense
  7334. ));
  7335. if (instance.type.__hmrId) {
  7336. registerHMR(instance);
  7337. }
  7338. {
  7339. pushWarningContext(initialVNode);
  7340. startMeasure(instance, `mount`);
  7341. }
  7342. if (isKeepAlive(initialVNode)) {
  7343. instance.ctx.renderer = internals;
  7344. }
  7345. {
  7346. {
  7347. startMeasure(instance, `init`);
  7348. }
  7349. setupComponent(instance);
  7350. {
  7351. endMeasure(instance, `init`);
  7352. }
  7353. }
  7354. if (instance.asyncDep) {
  7355. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  7356. if (!initialVNode.el) {
  7357. const placeholder = instance.subTree = createVNode(Comment);
  7358. processCommentNode(null, placeholder, container, anchor);
  7359. }
  7360. } else {
  7361. setupRenderEffect(
  7362. instance,
  7363. initialVNode,
  7364. container,
  7365. anchor,
  7366. parentSuspense,
  7367. namespace,
  7368. optimized
  7369. );
  7370. }
  7371. {
  7372. popWarningContext();
  7373. endMeasure(instance, `mount`);
  7374. }
  7375. };
  7376. const updateComponent = (n1, n2, optimized) => {
  7377. const instance = n2.component = n1.component;
  7378. if (shouldUpdateComponent(n1, n2, optimized)) {
  7379. if (instance.asyncDep && !instance.asyncResolved) {
  7380. {
  7381. pushWarningContext(n2);
  7382. }
  7383. updateComponentPreRender(instance, n2, optimized);
  7384. {
  7385. popWarningContext();
  7386. }
  7387. return;
  7388. } else {
  7389. instance.next = n2;
  7390. invalidateJob(instance.update);
  7391. instance.effect.dirty = true;
  7392. instance.update();
  7393. }
  7394. } else {
  7395. n2.el = n1.el;
  7396. instance.vnode = n2;
  7397. }
  7398. };
  7399. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7400. const componentUpdateFn = () => {
  7401. if (!instance.isMounted) {
  7402. let vnodeHook;
  7403. const { el, props } = initialVNode;
  7404. const { bm, m, parent } = instance;
  7405. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7406. toggleRecurse(instance, false);
  7407. if (bm) {
  7408. invokeArrayFns(bm);
  7409. }
  7410. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7411. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7412. }
  7413. toggleRecurse(instance, true);
  7414. if (el && hydrateNode) {
  7415. const hydrateSubTree = () => {
  7416. {
  7417. startMeasure(instance, `render`);
  7418. }
  7419. instance.subTree = renderComponentRoot(instance);
  7420. {
  7421. endMeasure(instance, `render`);
  7422. }
  7423. {
  7424. startMeasure(instance, `hydrate`);
  7425. }
  7426. hydrateNode(
  7427. el,
  7428. instance.subTree,
  7429. instance,
  7430. parentSuspense,
  7431. null
  7432. );
  7433. {
  7434. endMeasure(instance, `hydrate`);
  7435. }
  7436. };
  7437. if (isAsyncWrapperVNode) {
  7438. initialVNode.type.__asyncLoader().then(
  7439. // note: we are moving the render call into an async callback,
  7440. // which means it won't track dependencies - but it's ok because
  7441. // a server-rendered async wrapper is already in resolved state
  7442. // and it will never need to change.
  7443. () => !instance.isUnmounted && hydrateSubTree()
  7444. );
  7445. } else {
  7446. hydrateSubTree();
  7447. }
  7448. } else {
  7449. {
  7450. startMeasure(instance, `render`);
  7451. }
  7452. const subTree = instance.subTree = renderComponentRoot(instance);
  7453. {
  7454. endMeasure(instance, `render`);
  7455. }
  7456. {
  7457. startMeasure(instance, `patch`);
  7458. }
  7459. patch(
  7460. null,
  7461. subTree,
  7462. container,
  7463. anchor,
  7464. instance,
  7465. parentSuspense,
  7466. namespace
  7467. );
  7468. {
  7469. endMeasure(instance, `patch`);
  7470. }
  7471. initialVNode.el = subTree.el;
  7472. }
  7473. if (m) {
  7474. queuePostRenderEffect(m, parentSuspense);
  7475. }
  7476. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7477. const scopedInitialVNode = initialVNode;
  7478. queuePostRenderEffect(
  7479. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7480. parentSuspense
  7481. );
  7482. }
  7483. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7484. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7485. }
  7486. instance.isMounted = true;
  7487. {
  7488. devtoolsComponentAdded(instance);
  7489. }
  7490. initialVNode = container = anchor = null;
  7491. } else {
  7492. let { next, bu, u, parent, vnode } = instance;
  7493. {
  7494. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7495. if (nonHydratedAsyncRoot) {
  7496. if (next) {
  7497. next.el = vnode.el;
  7498. updateComponentPreRender(instance, next, optimized);
  7499. }
  7500. nonHydratedAsyncRoot.asyncDep.then(() => {
  7501. if (!instance.isUnmounted) {
  7502. componentUpdateFn();
  7503. }
  7504. });
  7505. return;
  7506. }
  7507. }
  7508. let originNext = next;
  7509. let vnodeHook;
  7510. {
  7511. pushWarningContext(next || instance.vnode);
  7512. }
  7513. toggleRecurse(instance, false);
  7514. if (next) {
  7515. next.el = vnode.el;
  7516. updateComponentPreRender(instance, next, optimized);
  7517. } else {
  7518. next = vnode;
  7519. }
  7520. if (bu) {
  7521. invokeArrayFns(bu);
  7522. }
  7523. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7524. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7525. }
  7526. toggleRecurse(instance, true);
  7527. {
  7528. startMeasure(instance, `render`);
  7529. }
  7530. const nextTree = renderComponentRoot(instance);
  7531. {
  7532. endMeasure(instance, `render`);
  7533. }
  7534. const prevTree = instance.subTree;
  7535. instance.subTree = nextTree;
  7536. {
  7537. startMeasure(instance, `patch`);
  7538. }
  7539. patch(
  7540. prevTree,
  7541. nextTree,
  7542. // parent may have changed if it's in a teleport
  7543. hostParentNode(prevTree.el),
  7544. // anchor may have changed if it's in a fragment
  7545. getNextHostNode(prevTree),
  7546. instance,
  7547. parentSuspense,
  7548. namespace
  7549. );
  7550. {
  7551. endMeasure(instance, `patch`);
  7552. }
  7553. next.el = nextTree.el;
  7554. if (originNext === null) {
  7555. updateHOCHostEl(instance, nextTree.el);
  7556. }
  7557. if (u) {
  7558. queuePostRenderEffect(u, parentSuspense);
  7559. }
  7560. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7561. queuePostRenderEffect(
  7562. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7563. parentSuspense
  7564. );
  7565. }
  7566. {
  7567. devtoolsComponentUpdated(instance);
  7568. }
  7569. {
  7570. popWarningContext();
  7571. }
  7572. }
  7573. };
  7574. const effect = instance.effect = new ReactiveEffect(
  7575. componentUpdateFn,
  7576. NOOP,
  7577. () => queueJob(update),
  7578. instance.scope
  7579. // track it in component's effect scope
  7580. );
  7581. const update = instance.update = () => {
  7582. if (effect.dirty) {
  7583. effect.run();
  7584. }
  7585. };
  7586. update.id = instance.uid;
  7587. toggleRecurse(instance, true);
  7588. {
  7589. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7590. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7591. update.ownerInstance = instance;
  7592. }
  7593. update();
  7594. };
  7595. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7596. nextVNode.component = instance;
  7597. const prevProps = instance.vnode.props;
  7598. instance.vnode = nextVNode;
  7599. instance.next = null;
  7600. updateProps(instance, nextVNode.props, prevProps, optimized);
  7601. updateSlots(instance, nextVNode.children, optimized);
  7602. pauseTracking();
  7603. flushPreFlushCbs(instance);
  7604. resetTracking();
  7605. };
  7606. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7607. const c1 = n1 && n1.children;
  7608. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7609. const c2 = n2.children;
  7610. const { patchFlag, shapeFlag } = n2;
  7611. if (patchFlag > 0) {
  7612. if (patchFlag & 128) {
  7613. patchKeyedChildren(
  7614. c1,
  7615. c2,
  7616. container,
  7617. anchor,
  7618. parentComponent,
  7619. parentSuspense,
  7620. namespace,
  7621. slotScopeIds,
  7622. optimized
  7623. );
  7624. return;
  7625. } else if (patchFlag & 256) {
  7626. patchUnkeyedChildren(
  7627. c1,
  7628. c2,
  7629. container,
  7630. anchor,
  7631. parentComponent,
  7632. parentSuspense,
  7633. namespace,
  7634. slotScopeIds,
  7635. optimized
  7636. );
  7637. return;
  7638. }
  7639. }
  7640. if (shapeFlag & 8) {
  7641. if (prevShapeFlag & 16) {
  7642. unmountChildren(c1, parentComponent, parentSuspense);
  7643. }
  7644. if (c2 !== c1) {
  7645. hostSetElementText(container, c2);
  7646. }
  7647. } else {
  7648. if (prevShapeFlag & 16) {
  7649. if (shapeFlag & 16) {
  7650. patchKeyedChildren(
  7651. c1,
  7652. c2,
  7653. container,
  7654. anchor,
  7655. parentComponent,
  7656. parentSuspense,
  7657. namespace,
  7658. slotScopeIds,
  7659. optimized
  7660. );
  7661. } else {
  7662. unmountChildren(c1, parentComponent, parentSuspense, true);
  7663. }
  7664. } else {
  7665. if (prevShapeFlag & 8) {
  7666. hostSetElementText(container, "");
  7667. }
  7668. if (shapeFlag & 16) {
  7669. mountChildren(
  7670. c2,
  7671. container,
  7672. anchor,
  7673. parentComponent,
  7674. parentSuspense,
  7675. namespace,
  7676. slotScopeIds,
  7677. optimized
  7678. );
  7679. }
  7680. }
  7681. }
  7682. };
  7683. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7684. c1 = c1 || EMPTY_ARR;
  7685. c2 = c2 || EMPTY_ARR;
  7686. const oldLength = c1.length;
  7687. const newLength = c2.length;
  7688. const commonLength = Math.min(oldLength, newLength);
  7689. let i;
  7690. for (i = 0; i < commonLength; i++) {
  7691. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7692. patch(
  7693. c1[i],
  7694. nextChild,
  7695. container,
  7696. null,
  7697. parentComponent,
  7698. parentSuspense,
  7699. namespace,
  7700. slotScopeIds,
  7701. optimized
  7702. );
  7703. }
  7704. if (oldLength > newLength) {
  7705. unmountChildren(
  7706. c1,
  7707. parentComponent,
  7708. parentSuspense,
  7709. true,
  7710. false,
  7711. commonLength
  7712. );
  7713. } else {
  7714. mountChildren(
  7715. c2,
  7716. container,
  7717. anchor,
  7718. parentComponent,
  7719. parentSuspense,
  7720. namespace,
  7721. slotScopeIds,
  7722. optimized,
  7723. commonLength
  7724. );
  7725. }
  7726. };
  7727. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7728. let i = 0;
  7729. const l2 = c2.length;
  7730. let e1 = c1.length - 1;
  7731. let e2 = l2 - 1;
  7732. while (i <= e1 && i <= e2) {
  7733. const n1 = c1[i];
  7734. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7735. if (isSameVNodeType(n1, n2)) {
  7736. patch(
  7737. n1,
  7738. n2,
  7739. container,
  7740. null,
  7741. parentComponent,
  7742. parentSuspense,
  7743. namespace,
  7744. slotScopeIds,
  7745. optimized
  7746. );
  7747. } else {
  7748. break;
  7749. }
  7750. i++;
  7751. }
  7752. while (i <= e1 && i <= e2) {
  7753. const n1 = c1[e1];
  7754. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7755. if (isSameVNodeType(n1, n2)) {
  7756. patch(
  7757. n1,
  7758. n2,
  7759. container,
  7760. null,
  7761. parentComponent,
  7762. parentSuspense,
  7763. namespace,
  7764. slotScopeIds,
  7765. optimized
  7766. );
  7767. } else {
  7768. break;
  7769. }
  7770. e1--;
  7771. e2--;
  7772. }
  7773. if (i > e1) {
  7774. if (i <= e2) {
  7775. const nextPos = e2 + 1;
  7776. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7777. while (i <= e2) {
  7778. patch(
  7779. null,
  7780. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7781. container,
  7782. anchor,
  7783. parentComponent,
  7784. parentSuspense,
  7785. namespace,
  7786. slotScopeIds,
  7787. optimized
  7788. );
  7789. i++;
  7790. }
  7791. }
  7792. } else if (i > e2) {
  7793. while (i <= e1) {
  7794. unmount(c1[i], parentComponent, parentSuspense, true);
  7795. i++;
  7796. }
  7797. } else {
  7798. const s1 = i;
  7799. const s2 = i;
  7800. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7801. for (i = s2; i <= e2; i++) {
  7802. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7803. if (nextChild.key != null) {
  7804. if (keyToNewIndexMap.has(nextChild.key)) {
  7805. warn$1(
  7806. `Duplicate keys found during update:`,
  7807. JSON.stringify(nextChild.key),
  7808. `Make sure keys are unique.`
  7809. );
  7810. }
  7811. keyToNewIndexMap.set(nextChild.key, i);
  7812. }
  7813. }
  7814. let j;
  7815. let patched = 0;
  7816. const toBePatched = e2 - s2 + 1;
  7817. let moved = false;
  7818. let maxNewIndexSoFar = 0;
  7819. const newIndexToOldIndexMap = new Array(toBePatched);
  7820. for (i = 0; i < toBePatched; i++)
  7821. newIndexToOldIndexMap[i] = 0;
  7822. for (i = s1; i <= e1; i++) {
  7823. const prevChild = c1[i];
  7824. if (patched >= toBePatched) {
  7825. unmount(prevChild, parentComponent, parentSuspense, true);
  7826. continue;
  7827. }
  7828. let newIndex;
  7829. if (prevChild.key != null) {
  7830. newIndex = keyToNewIndexMap.get(prevChild.key);
  7831. } else {
  7832. for (j = s2; j <= e2; j++) {
  7833. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7834. newIndex = j;
  7835. break;
  7836. }
  7837. }
  7838. }
  7839. if (newIndex === void 0) {
  7840. unmount(prevChild, parentComponent, parentSuspense, true);
  7841. } else {
  7842. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7843. if (newIndex >= maxNewIndexSoFar) {
  7844. maxNewIndexSoFar = newIndex;
  7845. } else {
  7846. moved = true;
  7847. }
  7848. patch(
  7849. prevChild,
  7850. c2[newIndex],
  7851. container,
  7852. null,
  7853. parentComponent,
  7854. parentSuspense,
  7855. namespace,
  7856. slotScopeIds,
  7857. optimized
  7858. );
  7859. patched++;
  7860. }
  7861. }
  7862. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7863. j = increasingNewIndexSequence.length - 1;
  7864. for (i = toBePatched - 1; i >= 0; i--) {
  7865. const nextIndex = s2 + i;
  7866. const nextChild = c2[nextIndex];
  7867. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7868. if (newIndexToOldIndexMap[i] === 0) {
  7869. patch(
  7870. null,
  7871. nextChild,
  7872. container,
  7873. anchor,
  7874. parentComponent,
  7875. parentSuspense,
  7876. namespace,
  7877. slotScopeIds,
  7878. optimized
  7879. );
  7880. } else if (moved) {
  7881. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7882. move(nextChild, container, anchor, 2);
  7883. } else {
  7884. j--;
  7885. }
  7886. }
  7887. }
  7888. }
  7889. };
  7890. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7891. const { el, type, transition, children, shapeFlag } = vnode;
  7892. if (shapeFlag & 6) {
  7893. move(vnode.component.subTree, container, anchor, moveType);
  7894. return;
  7895. }
  7896. if (shapeFlag & 128) {
  7897. vnode.suspense.move(container, anchor, moveType);
  7898. return;
  7899. }
  7900. if (shapeFlag & 64) {
  7901. type.move(vnode, container, anchor, internals);
  7902. return;
  7903. }
  7904. if (type === Fragment) {
  7905. hostInsert(el, container, anchor);
  7906. for (let i = 0; i < children.length; i++) {
  7907. move(children[i], container, anchor, moveType);
  7908. }
  7909. hostInsert(vnode.anchor, container, anchor);
  7910. return;
  7911. }
  7912. if (type === Static) {
  7913. moveStaticNode(vnode, container, anchor);
  7914. return;
  7915. }
  7916. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7917. if (needTransition2) {
  7918. if (moveType === 0) {
  7919. transition.beforeEnter(el);
  7920. hostInsert(el, container, anchor);
  7921. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7922. } else {
  7923. const { leave, delayLeave, afterLeave } = transition;
  7924. const remove2 = () => hostInsert(el, container, anchor);
  7925. const performLeave = () => {
  7926. leave(el, () => {
  7927. remove2();
  7928. afterLeave && afterLeave();
  7929. });
  7930. };
  7931. if (delayLeave) {
  7932. delayLeave(el, remove2, performLeave);
  7933. } else {
  7934. performLeave();
  7935. }
  7936. }
  7937. } else {
  7938. hostInsert(el, container, anchor);
  7939. }
  7940. };
  7941. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7942. const {
  7943. type,
  7944. props,
  7945. ref,
  7946. children,
  7947. dynamicChildren,
  7948. shapeFlag,
  7949. patchFlag,
  7950. dirs
  7951. } = vnode;
  7952. if (ref != null) {
  7953. setRef(ref, null, parentSuspense, vnode, true);
  7954. }
  7955. if (shapeFlag & 256) {
  7956. parentComponent.ctx.deactivate(vnode);
  7957. return;
  7958. }
  7959. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7960. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7961. let vnodeHook;
  7962. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7963. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7964. }
  7965. if (shapeFlag & 6) {
  7966. unmountComponent(vnode.component, parentSuspense, doRemove);
  7967. } else {
  7968. if (shapeFlag & 128) {
  7969. vnode.suspense.unmount(parentSuspense, doRemove);
  7970. return;
  7971. }
  7972. if (shouldInvokeDirs) {
  7973. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7974. }
  7975. if (shapeFlag & 64) {
  7976. vnode.type.remove(
  7977. vnode,
  7978. parentComponent,
  7979. parentSuspense,
  7980. optimized,
  7981. internals,
  7982. doRemove
  7983. );
  7984. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7985. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7986. unmountChildren(
  7987. dynamicChildren,
  7988. parentComponent,
  7989. parentSuspense,
  7990. false,
  7991. true
  7992. );
  7993. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7994. unmountChildren(children, parentComponent, parentSuspense);
  7995. }
  7996. if (doRemove) {
  7997. remove(vnode);
  7998. }
  7999. }
  8000. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  8001. queuePostRenderEffect(() => {
  8002. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8003. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  8004. }, parentSuspense);
  8005. }
  8006. };
  8007. const remove = (vnode) => {
  8008. const { type, el, anchor, transition } = vnode;
  8009. if (type === Fragment) {
  8010. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  8011. vnode.children.forEach((child) => {
  8012. if (child.type === Comment) {
  8013. hostRemove(child.el);
  8014. } else {
  8015. remove(child);
  8016. }
  8017. });
  8018. } else {
  8019. removeFragment(el, anchor);
  8020. }
  8021. return;
  8022. }
  8023. if (type === Static) {
  8024. removeStaticNode(vnode);
  8025. return;
  8026. }
  8027. const performRemove = () => {
  8028. hostRemove(el);
  8029. if (transition && !transition.persisted && transition.afterLeave) {
  8030. transition.afterLeave();
  8031. }
  8032. };
  8033. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  8034. const { leave, delayLeave } = transition;
  8035. const performLeave = () => leave(el, performRemove);
  8036. if (delayLeave) {
  8037. delayLeave(vnode.el, performRemove, performLeave);
  8038. } else {
  8039. performLeave();
  8040. }
  8041. } else {
  8042. performRemove();
  8043. }
  8044. };
  8045. const removeFragment = (cur, end) => {
  8046. let next;
  8047. while (cur !== end) {
  8048. next = hostNextSibling(cur);
  8049. hostRemove(cur);
  8050. cur = next;
  8051. }
  8052. hostRemove(end);
  8053. };
  8054. const unmountComponent = (instance, parentSuspense, doRemove) => {
  8055. if (instance.type.__hmrId) {
  8056. unregisterHMR(instance);
  8057. }
  8058. const { bum, scope, update, subTree, um } = instance;
  8059. if (bum) {
  8060. invokeArrayFns(bum);
  8061. }
  8062. scope.stop();
  8063. if (update) {
  8064. update.active = false;
  8065. unmount(subTree, instance, parentSuspense, doRemove);
  8066. }
  8067. if (um) {
  8068. queuePostRenderEffect(um, parentSuspense);
  8069. }
  8070. queuePostRenderEffect(() => {
  8071. instance.isUnmounted = true;
  8072. }, parentSuspense);
  8073. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  8074. parentSuspense.deps--;
  8075. if (parentSuspense.deps === 0) {
  8076. parentSuspense.resolve();
  8077. }
  8078. }
  8079. {
  8080. devtoolsComponentRemoved(instance);
  8081. }
  8082. };
  8083. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8084. for (let i = start; i < children.length; i++) {
  8085. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8086. }
  8087. };
  8088. const getNextHostNode = (vnode) => {
  8089. if (vnode.shapeFlag & 6) {
  8090. return getNextHostNode(vnode.component.subTree);
  8091. }
  8092. if (vnode.shapeFlag & 128) {
  8093. return vnode.suspense.next();
  8094. }
  8095. return hostNextSibling(vnode.anchor || vnode.el);
  8096. };
  8097. let isFlushing = false;
  8098. const render = (vnode, container, namespace) => {
  8099. if (vnode == null) {
  8100. if (container._vnode) {
  8101. unmount(container._vnode, null, null, true);
  8102. }
  8103. } else {
  8104. patch(
  8105. container._vnode || null,
  8106. vnode,
  8107. container,
  8108. null,
  8109. null,
  8110. null,
  8111. namespace
  8112. );
  8113. }
  8114. if (!isFlushing) {
  8115. isFlushing = true;
  8116. flushPreFlushCbs();
  8117. flushPostFlushCbs();
  8118. isFlushing = false;
  8119. }
  8120. container._vnode = vnode;
  8121. };
  8122. const internals = {
  8123. p: patch,
  8124. um: unmount,
  8125. m: move,
  8126. r: remove,
  8127. mt: mountComponent,
  8128. mc: mountChildren,
  8129. pc: patchChildren,
  8130. pbc: patchBlockChildren,
  8131. n: getNextHostNode,
  8132. o: options
  8133. };
  8134. let hydrate;
  8135. let hydrateNode;
  8136. if (createHydrationFns) {
  8137. [hydrate, hydrateNode] = createHydrationFns(
  8138. internals
  8139. );
  8140. }
  8141. return {
  8142. render,
  8143. hydrate,
  8144. createApp: createAppAPI(render, hydrate)
  8145. };
  8146. }
  8147. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8148. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8149. }
  8150. function toggleRecurse({ effect, update }, allowed) {
  8151. effect.allowRecurse = update.allowRecurse = allowed;
  8152. }
  8153. function needTransition(parentSuspense, transition) {
  8154. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8155. }
  8156. function traverseStaticChildren(n1, n2, shallow = false) {
  8157. const ch1 = n1.children;
  8158. const ch2 = n2.children;
  8159. if (isArray(ch1) && isArray(ch2)) {
  8160. for (let i = 0; i < ch1.length; i++) {
  8161. const c1 = ch1[i];
  8162. let c2 = ch2[i];
  8163. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8164. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8165. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8166. c2.el = c1.el;
  8167. }
  8168. if (!shallow)
  8169. traverseStaticChildren(c1, c2);
  8170. }
  8171. if (c2.type === Text) {
  8172. c2.el = c1.el;
  8173. }
  8174. if (c2.type === Comment && !c2.el) {
  8175. c2.el = c1.el;
  8176. }
  8177. }
  8178. }
  8179. }
  8180. function getSequence(arr) {
  8181. const p = arr.slice();
  8182. const result = [0];
  8183. let i, j, u, v, c;
  8184. const len = arr.length;
  8185. for (i = 0; i < len; i++) {
  8186. const arrI = arr[i];
  8187. if (arrI !== 0) {
  8188. j = result[result.length - 1];
  8189. if (arr[j] < arrI) {
  8190. p[i] = j;
  8191. result.push(i);
  8192. continue;
  8193. }
  8194. u = 0;
  8195. v = result.length - 1;
  8196. while (u < v) {
  8197. c = u + v >> 1;
  8198. if (arr[result[c]] < arrI) {
  8199. u = c + 1;
  8200. } else {
  8201. v = c;
  8202. }
  8203. }
  8204. if (arrI < arr[result[u]]) {
  8205. if (u > 0) {
  8206. p[i] = result[u - 1];
  8207. }
  8208. result[u] = i;
  8209. }
  8210. }
  8211. }
  8212. u = result.length;
  8213. v = result[u - 1];
  8214. while (u-- > 0) {
  8215. result[u] = v;
  8216. v = p[v];
  8217. }
  8218. return result;
  8219. }
  8220. function locateNonHydratedAsyncRoot(instance) {
  8221. const subComponent = instance.subTree.component;
  8222. if (subComponent) {
  8223. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8224. return subComponent;
  8225. } else {
  8226. return locateNonHydratedAsyncRoot(subComponent);
  8227. }
  8228. }
  8229. }
  8230. const isTeleport = (type) => type.__isTeleport;
  8231. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  8232. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  8233. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  8234. const resolveTarget = (props, select) => {
  8235. const targetSelector = props && props.to;
  8236. if (isString(targetSelector)) {
  8237. if (!select) {
  8238. warn$1(
  8239. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  8240. );
  8241. return null;
  8242. } else {
  8243. const target = select(targetSelector);
  8244. if (!target) {
  8245. warn$1(
  8246. `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.`
  8247. );
  8248. }
  8249. return target;
  8250. }
  8251. } else {
  8252. if (!targetSelector && !isTeleportDisabled(props)) {
  8253. warn$1(`Invalid Teleport target: ${targetSelector}`);
  8254. }
  8255. return targetSelector;
  8256. }
  8257. };
  8258. const TeleportImpl = {
  8259. name: "Teleport",
  8260. __isTeleport: true,
  8261. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  8262. const {
  8263. mc: mountChildren,
  8264. pc: patchChildren,
  8265. pbc: patchBlockChildren,
  8266. o: { insert, querySelector, createText, createComment }
  8267. } = internals;
  8268. const disabled = isTeleportDisabled(n2.props);
  8269. let { shapeFlag, children, dynamicChildren } = n2;
  8270. if (isHmrUpdating) {
  8271. optimized = false;
  8272. dynamicChildren = null;
  8273. }
  8274. if (n1 == null) {
  8275. const placeholder = n2.el = createComment("teleport start") ;
  8276. const mainAnchor = n2.anchor = createComment("teleport end") ;
  8277. insert(placeholder, container, anchor);
  8278. insert(mainAnchor, container, anchor);
  8279. const target = n2.target = resolveTarget(n2.props, querySelector);
  8280. const targetAnchor = n2.targetAnchor = createText("");
  8281. if (target) {
  8282. insert(targetAnchor, target);
  8283. if (namespace === "svg" || isTargetSVG(target)) {
  8284. namespace = "svg";
  8285. } else if (namespace === "mathml" || isTargetMathML(target)) {
  8286. namespace = "mathml";
  8287. }
  8288. } else if (!disabled) {
  8289. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  8290. }
  8291. const mount = (container2, anchor2) => {
  8292. if (shapeFlag & 16) {
  8293. mountChildren(
  8294. children,
  8295. container2,
  8296. anchor2,
  8297. parentComponent,
  8298. parentSuspense,
  8299. namespace,
  8300. slotScopeIds,
  8301. optimized
  8302. );
  8303. }
  8304. };
  8305. if (disabled) {
  8306. mount(container, mainAnchor);
  8307. } else if (target) {
  8308. mount(target, targetAnchor);
  8309. }
  8310. } else {
  8311. n2.el = n1.el;
  8312. const mainAnchor = n2.anchor = n1.anchor;
  8313. const target = n2.target = n1.target;
  8314. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  8315. const wasDisabled = isTeleportDisabled(n1.props);
  8316. const currentContainer = wasDisabled ? container : target;
  8317. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  8318. if (namespace === "svg" || isTargetSVG(target)) {
  8319. namespace = "svg";
  8320. } else if (namespace === "mathml" || isTargetMathML(target)) {
  8321. namespace = "mathml";
  8322. }
  8323. if (dynamicChildren) {
  8324. patchBlockChildren(
  8325. n1.dynamicChildren,
  8326. dynamicChildren,
  8327. currentContainer,
  8328. parentComponent,
  8329. parentSuspense,
  8330. namespace,
  8331. slotScopeIds
  8332. );
  8333. traverseStaticChildren(n1, n2, true);
  8334. } else if (!optimized) {
  8335. patchChildren(
  8336. n1,
  8337. n2,
  8338. currentContainer,
  8339. currentAnchor,
  8340. parentComponent,
  8341. parentSuspense,
  8342. namespace,
  8343. slotScopeIds,
  8344. false
  8345. );
  8346. }
  8347. if (disabled) {
  8348. if (!wasDisabled) {
  8349. moveTeleport(
  8350. n2,
  8351. container,
  8352. mainAnchor,
  8353. internals,
  8354. 1
  8355. );
  8356. } else {
  8357. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  8358. n2.props.to = n1.props.to;
  8359. }
  8360. }
  8361. } else {
  8362. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  8363. const nextTarget = n2.target = resolveTarget(
  8364. n2.props,
  8365. querySelector
  8366. );
  8367. if (nextTarget) {
  8368. moveTeleport(
  8369. n2,
  8370. nextTarget,
  8371. null,
  8372. internals,
  8373. 0
  8374. );
  8375. } else {
  8376. warn$1(
  8377. "Invalid Teleport target on update:",
  8378. target,
  8379. `(${typeof target})`
  8380. );
  8381. }
  8382. } else if (wasDisabled) {
  8383. moveTeleport(
  8384. n2,
  8385. target,
  8386. targetAnchor,
  8387. internals,
  8388. 1
  8389. );
  8390. }
  8391. }
  8392. }
  8393. updateCssVars(n2);
  8394. },
  8395. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  8396. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  8397. if (target) {
  8398. hostRemove(targetAnchor);
  8399. }
  8400. doRemove && hostRemove(anchor);
  8401. if (shapeFlag & 16) {
  8402. const shouldRemove = doRemove || !isTeleportDisabled(props);
  8403. for (let i = 0; i < children.length; i++) {
  8404. const child = children[i];
  8405. unmount(
  8406. child,
  8407. parentComponent,
  8408. parentSuspense,
  8409. shouldRemove,
  8410. !!child.dynamicChildren
  8411. );
  8412. }
  8413. }
  8414. },
  8415. move: moveTeleport,
  8416. hydrate: hydrateTeleport
  8417. };
  8418. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  8419. if (moveType === 0) {
  8420. insert(vnode.targetAnchor, container, parentAnchor);
  8421. }
  8422. const { el, anchor, shapeFlag, children, props } = vnode;
  8423. const isReorder = moveType === 2;
  8424. if (isReorder) {
  8425. insert(el, container, parentAnchor);
  8426. }
  8427. if (!isReorder || isTeleportDisabled(props)) {
  8428. if (shapeFlag & 16) {
  8429. for (let i = 0; i < children.length; i++) {
  8430. move(
  8431. children[i],
  8432. container,
  8433. parentAnchor,
  8434. 2
  8435. );
  8436. }
  8437. }
  8438. }
  8439. if (isReorder) {
  8440. insert(anchor, container, parentAnchor);
  8441. }
  8442. }
  8443. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  8444. o: { nextSibling, parentNode, querySelector }
  8445. }, hydrateChildren) {
  8446. const target = vnode.target = resolveTarget(
  8447. vnode.props,
  8448. querySelector
  8449. );
  8450. if (target) {
  8451. const targetNode = target._lpa || target.firstChild;
  8452. if (vnode.shapeFlag & 16) {
  8453. if (isTeleportDisabled(vnode.props)) {
  8454. vnode.anchor = hydrateChildren(
  8455. nextSibling(node),
  8456. vnode,
  8457. parentNode(node),
  8458. parentComponent,
  8459. parentSuspense,
  8460. slotScopeIds,
  8461. optimized
  8462. );
  8463. vnode.targetAnchor = targetNode;
  8464. } else {
  8465. vnode.anchor = nextSibling(node);
  8466. let targetAnchor = targetNode;
  8467. while (targetAnchor) {
  8468. targetAnchor = nextSibling(targetAnchor);
  8469. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  8470. vnode.targetAnchor = targetAnchor;
  8471. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  8472. break;
  8473. }
  8474. }
  8475. hydrateChildren(
  8476. targetNode,
  8477. vnode,
  8478. target,
  8479. parentComponent,
  8480. parentSuspense,
  8481. slotScopeIds,
  8482. optimized
  8483. );
  8484. }
  8485. }
  8486. updateCssVars(vnode);
  8487. }
  8488. return vnode.anchor && nextSibling(vnode.anchor);
  8489. }
  8490. const Teleport = TeleportImpl;
  8491. function updateCssVars(vnode) {
  8492. const ctx = vnode.ctx;
  8493. if (ctx && ctx.ut) {
  8494. let node = vnode.children[0].el;
  8495. while (node && node !== vnode.targetAnchor) {
  8496. if (node.nodeType === 1)
  8497. node.setAttribute("data-v-owner", ctx.uid);
  8498. node = node.nextSibling;
  8499. }
  8500. ctx.ut();
  8501. }
  8502. }
  8503. const Fragment = Symbol.for("v-fgt");
  8504. const Text = Symbol.for("v-txt");
  8505. const Comment = Symbol.for("v-cmt");
  8506. const Static = Symbol.for("v-stc");
  8507. const blockStack = [];
  8508. let currentBlock = null;
  8509. function openBlock(disableTracking = false) {
  8510. blockStack.push(currentBlock = disableTracking ? null : []);
  8511. }
  8512. function closeBlock() {
  8513. blockStack.pop();
  8514. currentBlock = blockStack[blockStack.length - 1] || null;
  8515. }
  8516. let isBlockTreeEnabled = 1;
  8517. function setBlockTracking(value) {
  8518. isBlockTreeEnabled += value;
  8519. }
  8520. function setupBlock(vnode) {
  8521. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8522. closeBlock();
  8523. if (isBlockTreeEnabled > 0 && currentBlock) {
  8524. currentBlock.push(vnode);
  8525. }
  8526. return vnode;
  8527. }
  8528. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8529. return setupBlock(
  8530. createBaseVNode(
  8531. type,
  8532. props,
  8533. children,
  8534. patchFlag,
  8535. dynamicProps,
  8536. shapeFlag,
  8537. true
  8538. )
  8539. );
  8540. }
  8541. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8542. return setupBlock(
  8543. createVNode(
  8544. type,
  8545. props,
  8546. children,
  8547. patchFlag,
  8548. dynamicProps,
  8549. true
  8550. )
  8551. );
  8552. }
  8553. function isVNode(value) {
  8554. return value ? value.__v_isVNode === true : false;
  8555. }
  8556. function isSameVNodeType(n1, n2) {
  8557. if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  8558. n1.shapeFlag &= ~256;
  8559. n2.shapeFlag &= ~512;
  8560. return false;
  8561. }
  8562. return n1.type === n2.type && n1.key === n2.key;
  8563. }
  8564. let vnodeArgsTransformer;
  8565. function transformVNodeArgs(transformer) {
  8566. vnodeArgsTransformer = transformer;
  8567. }
  8568. const createVNodeWithArgsTransform = (...args) => {
  8569. return _createVNode(
  8570. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8571. );
  8572. };
  8573. const normalizeKey = ({ key }) => key != null ? key : null;
  8574. const normalizeRef = ({
  8575. ref,
  8576. ref_key,
  8577. ref_for
  8578. }) => {
  8579. if (typeof ref === "number") {
  8580. ref = "" + ref;
  8581. }
  8582. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8583. };
  8584. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8585. const vnode = {
  8586. __v_isVNode: true,
  8587. __v_skip: true,
  8588. type,
  8589. props,
  8590. key: props && normalizeKey(props),
  8591. ref: props && normalizeRef(props),
  8592. scopeId: currentScopeId,
  8593. slotScopeIds: null,
  8594. children,
  8595. component: null,
  8596. suspense: null,
  8597. ssContent: null,
  8598. ssFallback: null,
  8599. dirs: null,
  8600. transition: null,
  8601. el: null,
  8602. anchor: null,
  8603. target: null,
  8604. targetAnchor: null,
  8605. staticCount: 0,
  8606. shapeFlag,
  8607. patchFlag,
  8608. dynamicProps,
  8609. dynamicChildren: null,
  8610. appContext: null,
  8611. ctx: currentRenderingInstance
  8612. };
  8613. if (needFullChildrenNormalization) {
  8614. normalizeChildren(vnode, children);
  8615. if (shapeFlag & 128) {
  8616. type.normalize(vnode);
  8617. }
  8618. } else if (children) {
  8619. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8620. }
  8621. if (vnode.key !== vnode.key) {
  8622. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8623. }
  8624. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8625. !isBlockNode && // has current parent block
  8626. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8627. // component nodes also should always be patched, because even if the
  8628. // component doesn't need to update, it needs to persist the instance on to
  8629. // the next vnode so that it can be properly unmounted later.
  8630. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8631. // vnode should not be considered dynamic due to handler caching.
  8632. vnode.patchFlag !== 32) {
  8633. currentBlock.push(vnode);
  8634. }
  8635. return vnode;
  8636. }
  8637. const createVNode = createVNodeWithArgsTransform ;
  8638. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8639. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8640. if (!type) {
  8641. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  8642. }
  8643. type = Comment;
  8644. }
  8645. if (isVNode(type)) {
  8646. const cloned = cloneVNode(
  8647. type,
  8648. props,
  8649. true
  8650. /* mergeRef: true */
  8651. );
  8652. if (children) {
  8653. normalizeChildren(cloned, children);
  8654. }
  8655. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8656. if (cloned.shapeFlag & 6) {
  8657. currentBlock[currentBlock.indexOf(type)] = cloned;
  8658. } else {
  8659. currentBlock.push(cloned);
  8660. }
  8661. }
  8662. cloned.patchFlag |= -2;
  8663. return cloned;
  8664. }
  8665. if (isClassComponent(type)) {
  8666. type = type.__vccOpts;
  8667. }
  8668. if (props) {
  8669. props = guardReactiveProps(props);
  8670. let { class: klass, style } = props;
  8671. if (klass && !isString(klass)) {
  8672. props.class = normalizeClass(klass);
  8673. }
  8674. if (isObject(style)) {
  8675. if (isProxy(style) && !isArray(style)) {
  8676. style = extend({}, style);
  8677. }
  8678. props.style = normalizeStyle(style);
  8679. }
  8680. }
  8681. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8682. if (shapeFlag & 4 && isProxy(type)) {
  8683. type = toRaw(type);
  8684. warn$1(
  8685. `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\`.`,
  8686. `
  8687. Component that was made reactive: `,
  8688. type
  8689. );
  8690. }
  8691. return createBaseVNode(
  8692. type,
  8693. props,
  8694. children,
  8695. patchFlag,
  8696. dynamicProps,
  8697. shapeFlag,
  8698. isBlockNode,
  8699. true
  8700. );
  8701. }
  8702. function guardReactiveProps(props) {
  8703. if (!props)
  8704. return null;
  8705. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  8706. }
  8707. function cloneVNode(vnode, extraProps, mergeRef = false) {
  8708. const { props, ref, patchFlag, children } = vnode;
  8709. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8710. const cloned = {
  8711. __v_isVNode: true,
  8712. __v_skip: true,
  8713. type: vnode.type,
  8714. props: mergedProps,
  8715. key: mergedProps && normalizeKey(mergedProps),
  8716. ref: extraProps && extraProps.ref ? (
  8717. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8718. // if the vnode itself already has a ref, cloneVNode will need to merge
  8719. // the refs so the single vnode can be set on multiple refs
  8720. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8721. ) : ref,
  8722. scopeId: vnode.scopeId,
  8723. slotScopeIds: vnode.slotScopeIds,
  8724. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8725. target: vnode.target,
  8726. targetAnchor: vnode.targetAnchor,
  8727. staticCount: vnode.staticCount,
  8728. shapeFlag: vnode.shapeFlag,
  8729. // if the vnode is cloned with extra props, we can no longer assume its
  8730. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8731. // note: preserve flag for fragments since they use the flag for children
  8732. // fast paths only.
  8733. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8734. dynamicProps: vnode.dynamicProps,
  8735. dynamicChildren: vnode.dynamicChildren,
  8736. appContext: vnode.appContext,
  8737. dirs: vnode.dirs,
  8738. transition: vnode.transition,
  8739. // These should technically only be non-null on mounted VNodes. However,
  8740. // they *should* be copied for kept-alive vnodes. So we just always copy
  8741. // them since them being non-null during a mount doesn't affect the logic as
  8742. // they will simply be overwritten.
  8743. component: vnode.component,
  8744. suspense: vnode.suspense,
  8745. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8746. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8747. el: vnode.el,
  8748. anchor: vnode.anchor,
  8749. ctx: vnode.ctx,
  8750. ce: vnode.ce
  8751. };
  8752. return cloned;
  8753. }
  8754. function deepCloneVNode(vnode) {
  8755. const cloned = cloneVNode(vnode);
  8756. if (isArray(vnode.children)) {
  8757. cloned.children = vnode.children.map(deepCloneVNode);
  8758. }
  8759. return cloned;
  8760. }
  8761. function createTextVNode(text = " ", flag = 0) {
  8762. return createVNode(Text, null, text, flag);
  8763. }
  8764. function createStaticVNode(content, numberOfNodes) {
  8765. const vnode = createVNode(Static, null, content);
  8766. vnode.staticCount = numberOfNodes;
  8767. return vnode;
  8768. }
  8769. function createCommentVNode(text = "", asBlock = false) {
  8770. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8771. }
  8772. function normalizeVNode(child) {
  8773. if (child == null || typeof child === "boolean") {
  8774. return createVNode(Comment);
  8775. } else if (isArray(child)) {
  8776. return createVNode(
  8777. Fragment,
  8778. null,
  8779. // #3666, avoid reference pollution when reusing vnode
  8780. child.slice()
  8781. );
  8782. } else if (typeof child === "object") {
  8783. return cloneIfMounted(child);
  8784. } else {
  8785. return createVNode(Text, null, String(child));
  8786. }
  8787. }
  8788. function cloneIfMounted(child) {
  8789. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8790. }
  8791. function normalizeChildren(vnode, children) {
  8792. let type = 0;
  8793. const { shapeFlag } = vnode;
  8794. if (children == null) {
  8795. children = null;
  8796. } else if (isArray(children)) {
  8797. type = 16;
  8798. } else if (typeof children === "object") {
  8799. if (shapeFlag & (1 | 64)) {
  8800. const slot = children.default;
  8801. if (slot) {
  8802. slot._c && (slot._d = false);
  8803. normalizeChildren(vnode, slot());
  8804. slot._c && (slot._d = true);
  8805. }
  8806. return;
  8807. } else {
  8808. type = 32;
  8809. const slotFlag = children._;
  8810. if (!slotFlag && !isInternalObject(children)) {
  8811. children._ctx = currentRenderingInstance;
  8812. } else if (slotFlag === 3 && currentRenderingInstance) {
  8813. if (currentRenderingInstance.slots._ === 1) {
  8814. children._ = 1;
  8815. } else {
  8816. children._ = 2;
  8817. vnode.patchFlag |= 1024;
  8818. }
  8819. }
  8820. }
  8821. } else if (isFunction(children)) {
  8822. children = { default: children, _ctx: currentRenderingInstance };
  8823. type = 32;
  8824. } else {
  8825. children = String(children);
  8826. if (shapeFlag & 64) {
  8827. type = 16;
  8828. children = [createTextVNode(children)];
  8829. } else {
  8830. type = 8;
  8831. }
  8832. }
  8833. vnode.children = children;
  8834. vnode.shapeFlag |= type;
  8835. }
  8836. function mergeProps(...args) {
  8837. const ret = {};
  8838. for (let i = 0; i < args.length; i++) {
  8839. const toMerge = args[i];
  8840. for (const key in toMerge) {
  8841. if (key === "class") {
  8842. if (ret.class !== toMerge.class) {
  8843. ret.class = normalizeClass([ret.class, toMerge.class]);
  8844. }
  8845. } else if (key === "style") {
  8846. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8847. } else if (isOn(key)) {
  8848. const existing = ret[key];
  8849. const incoming = toMerge[key];
  8850. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8851. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8852. }
  8853. } else if (key !== "") {
  8854. ret[key] = toMerge[key];
  8855. }
  8856. }
  8857. }
  8858. return ret;
  8859. }
  8860. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8861. callWithAsyncErrorHandling(hook, instance, 7, [
  8862. vnode,
  8863. prevVNode
  8864. ]);
  8865. }
  8866. const emptyAppContext = createAppContext();
  8867. let uid = 0;
  8868. function createComponentInstance(vnode, parent, suspense) {
  8869. const type = vnode.type;
  8870. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8871. const instance = {
  8872. uid: uid++,
  8873. vnode,
  8874. type,
  8875. parent,
  8876. appContext,
  8877. root: null,
  8878. // to be immediately set
  8879. next: null,
  8880. subTree: null,
  8881. // will be set synchronously right after creation
  8882. effect: null,
  8883. update: null,
  8884. // will be set synchronously right after creation
  8885. scope: new EffectScope(
  8886. true
  8887. /* detached */
  8888. ),
  8889. render: null,
  8890. proxy: null,
  8891. exposed: null,
  8892. exposeProxy: null,
  8893. withProxy: null,
  8894. provides: parent ? parent.provides : Object.create(appContext.provides),
  8895. accessCache: null,
  8896. renderCache: [],
  8897. // local resolved assets
  8898. components: null,
  8899. directives: null,
  8900. // resolved props and emits options
  8901. propsOptions: normalizePropsOptions(type, appContext),
  8902. emitsOptions: normalizeEmitsOptions(type, appContext),
  8903. // emit
  8904. emit: null,
  8905. // to be set immediately
  8906. emitted: null,
  8907. // props default value
  8908. propsDefaults: EMPTY_OBJ,
  8909. // inheritAttrs
  8910. inheritAttrs: type.inheritAttrs,
  8911. // state
  8912. ctx: EMPTY_OBJ,
  8913. data: EMPTY_OBJ,
  8914. props: EMPTY_OBJ,
  8915. attrs: EMPTY_OBJ,
  8916. slots: EMPTY_OBJ,
  8917. refs: EMPTY_OBJ,
  8918. setupState: EMPTY_OBJ,
  8919. setupContext: null,
  8920. attrsProxy: null,
  8921. slotsProxy: null,
  8922. // suspense related
  8923. suspense,
  8924. suspenseId: suspense ? suspense.pendingId : 0,
  8925. asyncDep: null,
  8926. asyncResolved: false,
  8927. // lifecycle hooks
  8928. // not using enums here because it results in computed properties
  8929. isMounted: false,
  8930. isUnmounted: false,
  8931. isDeactivated: false,
  8932. bc: null,
  8933. c: null,
  8934. bm: null,
  8935. m: null,
  8936. bu: null,
  8937. u: null,
  8938. um: null,
  8939. bum: null,
  8940. da: null,
  8941. a: null,
  8942. rtg: null,
  8943. rtc: null,
  8944. ec: null,
  8945. sp: null
  8946. };
  8947. {
  8948. instance.ctx = createDevRenderContext(instance);
  8949. }
  8950. instance.root = parent ? parent.root : instance;
  8951. instance.emit = emit.bind(null, instance);
  8952. if (vnode.ce) {
  8953. vnode.ce(instance);
  8954. }
  8955. return instance;
  8956. }
  8957. let currentInstance = null;
  8958. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8959. let internalSetCurrentInstance;
  8960. let setInSSRSetupState;
  8961. {
  8962. internalSetCurrentInstance = (i) => {
  8963. currentInstance = i;
  8964. };
  8965. setInSSRSetupState = (v) => {
  8966. isInSSRComponentSetup = v;
  8967. };
  8968. }
  8969. const setCurrentInstance = (instance) => {
  8970. const prev = currentInstance;
  8971. internalSetCurrentInstance(instance);
  8972. instance.scope.on();
  8973. return () => {
  8974. instance.scope.off();
  8975. internalSetCurrentInstance(prev);
  8976. };
  8977. };
  8978. const unsetCurrentInstance = () => {
  8979. currentInstance && currentInstance.scope.off();
  8980. internalSetCurrentInstance(null);
  8981. };
  8982. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  8983. function validateComponentName(name, { isNativeTag }) {
  8984. if (isBuiltInTag(name) || isNativeTag(name)) {
  8985. warn$1(
  8986. "Do not use built-in or reserved HTML elements as component id: " + name
  8987. );
  8988. }
  8989. }
  8990. function isStatefulComponent(instance) {
  8991. return instance.vnode.shapeFlag & 4;
  8992. }
  8993. let isInSSRComponentSetup = false;
  8994. function setupComponent(instance, isSSR = false) {
  8995. isSSR && setInSSRSetupState(isSSR);
  8996. const { props, children } = instance.vnode;
  8997. const isStateful = isStatefulComponent(instance);
  8998. initProps(instance, props, isStateful, isSSR);
  8999. initSlots(instance, children);
  9000. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9001. isSSR && setInSSRSetupState(false);
  9002. return setupResult;
  9003. }
  9004. function setupStatefulComponent(instance, isSSR) {
  9005. var _a;
  9006. const Component = instance.type;
  9007. {
  9008. if (Component.name) {
  9009. validateComponentName(Component.name, instance.appContext.config);
  9010. }
  9011. if (Component.components) {
  9012. const names = Object.keys(Component.components);
  9013. for (let i = 0; i < names.length; i++) {
  9014. validateComponentName(names[i], instance.appContext.config);
  9015. }
  9016. }
  9017. if (Component.directives) {
  9018. const names = Object.keys(Component.directives);
  9019. for (let i = 0; i < names.length; i++) {
  9020. validateDirectiveName(names[i]);
  9021. }
  9022. }
  9023. if (Component.compilerOptions && isRuntimeOnly()) {
  9024. warn$1(
  9025. `"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.`
  9026. );
  9027. }
  9028. }
  9029. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9030. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9031. {
  9032. exposePropsOnRenderContext(instance);
  9033. }
  9034. const { setup } = Component;
  9035. if (setup) {
  9036. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9037. const reset = setCurrentInstance(instance);
  9038. pauseTracking();
  9039. const setupResult = callWithErrorHandling(
  9040. setup,
  9041. instance,
  9042. 0,
  9043. [
  9044. shallowReadonly(instance.props) ,
  9045. setupContext
  9046. ]
  9047. );
  9048. resetTracking();
  9049. reset();
  9050. if (isPromise(setupResult)) {
  9051. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9052. if (isSSR) {
  9053. return setupResult.then((resolvedResult) => {
  9054. handleSetupResult(instance, resolvedResult, isSSR);
  9055. }).catch((e) => {
  9056. handleError(e, instance, 0);
  9057. });
  9058. } else {
  9059. instance.asyncDep = setupResult;
  9060. if (!instance.suspense) {
  9061. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9062. warn$1(
  9063. `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.`
  9064. );
  9065. }
  9066. }
  9067. } else {
  9068. handleSetupResult(instance, setupResult, isSSR);
  9069. }
  9070. } else {
  9071. finishComponentSetup(instance, isSSR);
  9072. }
  9073. }
  9074. function handleSetupResult(instance, setupResult, isSSR) {
  9075. if (isFunction(setupResult)) {
  9076. {
  9077. instance.render = setupResult;
  9078. }
  9079. } else if (isObject(setupResult)) {
  9080. if (isVNode(setupResult)) {
  9081. warn$1(
  9082. `setup() should not return VNodes directly - return a render function instead.`
  9083. );
  9084. }
  9085. {
  9086. instance.devtoolsRawSetupState = setupResult;
  9087. }
  9088. instance.setupState = proxyRefs(setupResult);
  9089. {
  9090. exposeSetupStateOnRenderContext(instance);
  9091. }
  9092. } else if (setupResult !== void 0) {
  9093. warn$1(
  9094. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  9095. );
  9096. }
  9097. finishComponentSetup(instance, isSSR);
  9098. }
  9099. let compile$1;
  9100. let installWithProxy;
  9101. function registerRuntimeCompiler(_compile) {
  9102. compile$1 = _compile;
  9103. installWithProxy = (i) => {
  9104. if (i.render._rc) {
  9105. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  9106. }
  9107. };
  9108. }
  9109. const isRuntimeOnly = () => !compile$1;
  9110. function finishComponentSetup(instance, isSSR, skipOptions) {
  9111. const Component = instance.type;
  9112. if (!instance.render) {
  9113. if (!isSSR && compile$1 && !Component.render) {
  9114. const template = Component.template || resolveMergedOptions(instance).template;
  9115. if (template) {
  9116. {
  9117. startMeasure(instance, `compile`);
  9118. }
  9119. const { isCustomElement, compilerOptions } = instance.appContext.config;
  9120. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  9121. const finalCompilerOptions = extend(
  9122. extend(
  9123. {
  9124. isCustomElement,
  9125. delimiters
  9126. },
  9127. compilerOptions
  9128. ),
  9129. componentCompilerOptions
  9130. );
  9131. Component.render = compile$1(template, finalCompilerOptions);
  9132. {
  9133. endMeasure(instance, `compile`);
  9134. }
  9135. }
  9136. }
  9137. instance.render = Component.render || NOOP;
  9138. if (installWithProxy) {
  9139. installWithProxy(instance);
  9140. }
  9141. }
  9142. {
  9143. const reset = setCurrentInstance(instance);
  9144. pauseTracking();
  9145. try {
  9146. applyOptions(instance);
  9147. } finally {
  9148. resetTracking();
  9149. reset();
  9150. }
  9151. }
  9152. if (!Component.render && instance.render === NOOP && !isSSR) {
  9153. if (!compile$1 && Component.template) {
  9154. warn$1(
  9155. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  9156. );
  9157. } else {
  9158. warn$1(`Component is missing template or render function.`);
  9159. }
  9160. }
  9161. }
  9162. const attrsProxyHandlers = {
  9163. get(target, key) {
  9164. markAttrsAccessed();
  9165. track(target, "get", "");
  9166. return target[key];
  9167. },
  9168. set() {
  9169. warn$1(`setupContext.attrs is readonly.`);
  9170. return false;
  9171. },
  9172. deleteProperty() {
  9173. warn$1(`setupContext.attrs is readonly.`);
  9174. return false;
  9175. }
  9176. } ;
  9177. function getSlotsProxy(instance) {
  9178. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  9179. get(target, key) {
  9180. track(instance, "get", "$slots");
  9181. return target[key];
  9182. }
  9183. }));
  9184. }
  9185. function createSetupContext(instance) {
  9186. const expose = (exposed) => {
  9187. {
  9188. if (instance.exposed) {
  9189. warn$1(`expose() should be called only once per setup().`);
  9190. }
  9191. if (exposed != null) {
  9192. let exposedType = typeof exposed;
  9193. if (exposedType === "object") {
  9194. if (isArray(exposed)) {
  9195. exposedType = "array";
  9196. } else if (isRef(exposed)) {
  9197. exposedType = "ref";
  9198. }
  9199. }
  9200. if (exposedType !== "object") {
  9201. warn$1(
  9202. `expose() should be passed a plain object, received ${exposedType}.`
  9203. );
  9204. }
  9205. }
  9206. }
  9207. instance.exposed = exposed || {};
  9208. };
  9209. {
  9210. let attrsProxy;
  9211. return Object.freeze({
  9212. get attrs() {
  9213. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  9214. },
  9215. get slots() {
  9216. return getSlotsProxy(instance);
  9217. },
  9218. get emit() {
  9219. return (event, ...args) => instance.emit(event, ...args);
  9220. },
  9221. expose
  9222. });
  9223. }
  9224. }
  9225. function getExposeProxy(instance) {
  9226. if (instance.exposed) {
  9227. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  9228. get(target, key) {
  9229. if (key in target) {
  9230. return target[key];
  9231. } else if (key in publicPropertiesMap) {
  9232. return publicPropertiesMap[key](instance);
  9233. }
  9234. },
  9235. has(target, key) {
  9236. return key in target || key in publicPropertiesMap;
  9237. }
  9238. }));
  9239. }
  9240. }
  9241. const classifyRE = /(?:^|[-_])(\w)/g;
  9242. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  9243. function getComponentName(Component, includeInferred = true) {
  9244. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  9245. }
  9246. function formatComponentName(instance, Component, isRoot = false) {
  9247. let name = getComponentName(Component);
  9248. if (!name && Component.__file) {
  9249. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  9250. if (match) {
  9251. name = match[1];
  9252. }
  9253. }
  9254. if (!name && instance && instance.parent) {
  9255. const inferFromRegistry = (registry) => {
  9256. for (const key in registry) {
  9257. if (registry[key] === Component) {
  9258. return key;
  9259. }
  9260. }
  9261. };
  9262. name = inferFromRegistry(
  9263. instance.components || instance.parent.type.components
  9264. ) || inferFromRegistry(instance.appContext.components);
  9265. }
  9266. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  9267. }
  9268. function isClassComponent(value) {
  9269. return isFunction(value) && "__vccOpts" in value;
  9270. }
  9271. const computed = (getterOrOptions, debugOptions) => {
  9272. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  9273. {
  9274. const i = getCurrentInstance();
  9275. if (i && i.appContext.config.warnRecursiveComputed) {
  9276. c._warnRecursive = true;
  9277. }
  9278. }
  9279. return c;
  9280. };
  9281. function useModel(props, name, options = EMPTY_OBJ) {
  9282. const i = getCurrentInstance();
  9283. if (!i) {
  9284. warn$1(`useModel() called without active instance.`);
  9285. return ref();
  9286. }
  9287. if (!i.propsOptions[0][name]) {
  9288. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  9289. return ref();
  9290. }
  9291. const camelizedName = camelize(name);
  9292. const hyphenatedName = hyphenate(name);
  9293. const res = customRef((track, trigger) => {
  9294. let localValue;
  9295. watchSyncEffect(() => {
  9296. const propValue = props[name];
  9297. if (hasChanged(localValue, propValue)) {
  9298. localValue = propValue;
  9299. trigger();
  9300. }
  9301. });
  9302. return {
  9303. get() {
  9304. track();
  9305. return options.get ? options.get(localValue) : localValue;
  9306. },
  9307. set(value) {
  9308. const rawProps = i.vnode.props;
  9309. if (!(rawProps && // check if parent has passed v-model
  9310. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
  9311. localValue = value;
  9312. trigger();
  9313. }
  9314. i.emit(`update:${name}`, options.set ? options.set(value) : value);
  9315. }
  9316. };
  9317. });
  9318. const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
  9319. res[Symbol.iterator] = () => {
  9320. let i2 = 0;
  9321. return {
  9322. next() {
  9323. if (i2 < 2) {
  9324. return { value: i2++ ? props[modifierKey] || {} : res, done: false };
  9325. } else {
  9326. return { done: true };
  9327. }
  9328. }
  9329. };
  9330. };
  9331. return res;
  9332. }
  9333. function h(type, propsOrChildren, children) {
  9334. const l = arguments.length;
  9335. if (l === 2) {
  9336. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  9337. if (isVNode(propsOrChildren)) {
  9338. return createVNode(type, null, [propsOrChildren]);
  9339. }
  9340. return createVNode(type, propsOrChildren);
  9341. } else {
  9342. return createVNode(type, null, propsOrChildren);
  9343. }
  9344. } else {
  9345. if (l > 3) {
  9346. children = Array.prototype.slice.call(arguments, 2);
  9347. } else if (l === 3 && isVNode(children)) {
  9348. children = [children];
  9349. }
  9350. return createVNode(type, propsOrChildren, children);
  9351. }
  9352. }
  9353. function initCustomFormatter() {
  9354. if (typeof window === "undefined") {
  9355. return;
  9356. }
  9357. const vueStyle = { style: "color:#3ba776" };
  9358. const numberStyle = { style: "color:#1677ff" };
  9359. const stringStyle = { style: "color:#f5222d" };
  9360. const keywordStyle = { style: "color:#eb2f96" };
  9361. const formatter = {
  9362. header(obj) {
  9363. if (!isObject(obj)) {
  9364. return null;
  9365. }
  9366. if (obj.__isVue) {
  9367. return ["div", vueStyle, `VueInstance`];
  9368. } else if (isRef(obj)) {
  9369. return [
  9370. "div",
  9371. {},
  9372. ["span", vueStyle, genRefFlag(obj)],
  9373. "<",
  9374. formatValue(obj.value),
  9375. `>`
  9376. ];
  9377. } else if (isReactive(obj)) {
  9378. return [
  9379. "div",
  9380. {},
  9381. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  9382. "<",
  9383. formatValue(obj),
  9384. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  9385. ];
  9386. } else if (isReadonly(obj)) {
  9387. return [
  9388. "div",
  9389. {},
  9390. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  9391. "<",
  9392. formatValue(obj),
  9393. ">"
  9394. ];
  9395. }
  9396. return null;
  9397. },
  9398. hasBody(obj) {
  9399. return obj && obj.__isVue;
  9400. },
  9401. body(obj) {
  9402. if (obj && obj.__isVue) {
  9403. return [
  9404. "div",
  9405. {},
  9406. ...formatInstance(obj.$)
  9407. ];
  9408. }
  9409. }
  9410. };
  9411. function formatInstance(instance) {
  9412. const blocks = [];
  9413. if (instance.type.props && instance.props) {
  9414. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  9415. }
  9416. if (instance.setupState !== EMPTY_OBJ) {
  9417. blocks.push(createInstanceBlock("setup", instance.setupState));
  9418. }
  9419. if (instance.data !== EMPTY_OBJ) {
  9420. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  9421. }
  9422. const computed = extractKeys(instance, "computed");
  9423. if (computed) {
  9424. blocks.push(createInstanceBlock("computed", computed));
  9425. }
  9426. const injected = extractKeys(instance, "inject");
  9427. if (injected) {
  9428. blocks.push(createInstanceBlock("injected", injected));
  9429. }
  9430. blocks.push([
  9431. "div",
  9432. {},
  9433. [
  9434. "span",
  9435. {
  9436. style: keywordStyle.style + ";opacity:0.66"
  9437. },
  9438. "$ (internal): "
  9439. ],
  9440. ["object", { object: instance }]
  9441. ]);
  9442. return blocks;
  9443. }
  9444. function createInstanceBlock(type, target) {
  9445. target = extend({}, target);
  9446. if (!Object.keys(target).length) {
  9447. return ["span", {}];
  9448. }
  9449. return [
  9450. "div",
  9451. { style: "line-height:1.25em;margin-bottom:0.6em" },
  9452. [
  9453. "div",
  9454. {
  9455. style: "color:#476582"
  9456. },
  9457. type
  9458. ],
  9459. [
  9460. "div",
  9461. {
  9462. style: "padding-left:1.25em"
  9463. },
  9464. ...Object.keys(target).map((key) => {
  9465. return [
  9466. "div",
  9467. {},
  9468. ["span", keywordStyle, key + ": "],
  9469. formatValue(target[key], false)
  9470. ];
  9471. })
  9472. ]
  9473. ];
  9474. }
  9475. function formatValue(v, asRaw = true) {
  9476. if (typeof v === "number") {
  9477. return ["span", numberStyle, v];
  9478. } else if (typeof v === "string") {
  9479. return ["span", stringStyle, JSON.stringify(v)];
  9480. } else if (typeof v === "boolean") {
  9481. return ["span", keywordStyle, v];
  9482. } else if (isObject(v)) {
  9483. return ["object", { object: asRaw ? toRaw(v) : v }];
  9484. } else {
  9485. return ["span", stringStyle, String(v)];
  9486. }
  9487. }
  9488. function extractKeys(instance, type) {
  9489. const Comp = instance.type;
  9490. if (isFunction(Comp)) {
  9491. return;
  9492. }
  9493. const extracted = {};
  9494. for (const key in instance.ctx) {
  9495. if (isKeyOfType(Comp, key, type)) {
  9496. extracted[key] = instance.ctx[key];
  9497. }
  9498. }
  9499. return extracted;
  9500. }
  9501. function isKeyOfType(Comp, key, type) {
  9502. const opts = Comp[type];
  9503. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  9504. return true;
  9505. }
  9506. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9507. return true;
  9508. }
  9509. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  9510. return true;
  9511. }
  9512. }
  9513. function genRefFlag(v) {
  9514. if (isShallow(v)) {
  9515. return `ShallowRef`;
  9516. }
  9517. if (v.effect) {
  9518. return `ComputedRef`;
  9519. }
  9520. return `Ref`;
  9521. }
  9522. if (window.devtoolsFormatters) {
  9523. window.devtoolsFormatters.push(formatter);
  9524. } else {
  9525. window.devtoolsFormatters = [formatter];
  9526. }
  9527. }
  9528. function withMemo(memo, render, cache, index) {
  9529. const cached = cache[index];
  9530. if (cached && isMemoSame(cached, memo)) {
  9531. return cached;
  9532. }
  9533. const ret = render();
  9534. ret.memo = memo.slice();
  9535. return cache[index] = ret;
  9536. }
  9537. function isMemoSame(cached, memo) {
  9538. const prev = cached.memo;
  9539. if (prev.length != memo.length) {
  9540. return false;
  9541. }
  9542. for (let i = 0; i < prev.length; i++) {
  9543. if (hasChanged(prev[i], memo[i])) {
  9544. return false;
  9545. }
  9546. }
  9547. if (isBlockTreeEnabled > 0 && currentBlock) {
  9548. currentBlock.push(cached);
  9549. }
  9550. return true;
  9551. }
  9552. const version = "3.4.23";
  9553. const warn = warn$1 ;
  9554. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  9555. const devtools = devtools$1 ;
  9556. const setDevtoolsHook = setDevtoolsHook$1 ;
  9557. const ssrUtils = null;
  9558. const resolveFilter = null;
  9559. const compatUtils = null;
  9560. const DeprecationTypes = null;
  9561. const svgNS = "http://www.w3.org/2000/svg";
  9562. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  9563. const doc = typeof document !== "undefined" ? document : null;
  9564. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9565. const nodeOps = {
  9566. insert: (child, parent, anchor) => {
  9567. parent.insertBefore(child, anchor || null);
  9568. },
  9569. remove: (child) => {
  9570. const parent = child.parentNode;
  9571. if (parent) {
  9572. parent.removeChild(child);
  9573. }
  9574. },
  9575. createElement: (tag, namespace, is, props) => {
  9576. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  9577. if (tag === "select" && props && props.multiple != null) {
  9578. el.setAttribute("multiple", props.multiple);
  9579. }
  9580. return el;
  9581. },
  9582. createText: (text) => doc.createTextNode(text),
  9583. createComment: (text) => doc.createComment(text),
  9584. setText: (node, text) => {
  9585. node.nodeValue = text;
  9586. },
  9587. setElementText: (el, text) => {
  9588. el.textContent = text;
  9589. },
  9590. parentNode: (node) => node.parentNode,
  9591. nextSibling: (node) => node.nextSibling,
  9592. querySelector: (selector) => doc.querySelector(selector),
  9593. setScopeId(el, id) {
  9594. el.setAttribute(id, "");
  9595. },
  9596. // __UNSAFE__
  9597. // Reason: innerHTML.
  9598. // Static content here can only come from compiled templates.
  9599. // As long as the user only uses trusted templates, this is safe.
  9600. insertStaticContent(content, parent, anchor, namespace, start, end) {
  9601. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9602. if (start && (start === end || start.nextSibling)) {
  9603. while (true) {
  9604. parent.insertBefore(start.cloneNode(true), anchor);
  9605. if (start === end || !(start = start.nextSibling))
  9606. break;
  9607. }
  9608. } else {
  9609. templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
  9610. const template = templateContainer.content;
  9611. if (namespace === "svg" || namespace === "mathml") {
  9612. const wrapper = template.firstChild;
  9613. while (wrapper.firstChild) {
  9614. template.appendChild(wrapper.firstChild);
  9615. }
  9616. template.removeChild(wrapper);
  9617. }
  9618. parent.insertBefore(template, anchor);
  9619. }
  9620. return [
  9621. // first
  9622. before ? before.nextSibling : parent.firstChild,
  9623. // last
  9624. anchor ? anchor.previousSibling : parent.lastChild
  9625. ];
  9626. }
  9627. };
  9628. const TRANSITION$1 = "transition";
  9629. const ANIMATION = "animation";
  9630. const vtcKey = Symbol("_vtc");
  9631. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9632. Transition.displayName = "Transition";
  9633. const DOMTransitionPropsValidators = {
  9634. name: String,
  9635. type: String,
  9636. css: {
  9637. type: Boolean,
  9638. default: true
  9639. },
  9640. duration: [String, Number, Object],
  9641. enterFromClass: String,
  9642. enterActiveClass: String,
  9643. enterToClass: String,
  9644. appearFromClass: String,
  9645. appearActiveClass: String,
  9646. appearToClass: String,
  9647. leaveFromClass: String,
  9648. leaveActiveClass: String,
  9649. leaveToClass: String
  9650. };
  9651. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9652. {},
  9653. BaseTransitionPropsValidators,
  9654. DOMTransitionPropsValidators
  9655. );
  9656. const callHook = (hook, args = []) => {
  9657. if (isArray(hook)) {
  9658. hook.forEach((h2) => h2(...args));
  9659. } else if (hook) {
  9660. hook(...args);
  9661. }
  9662. };
  9663. const hasExplicitCallback = (hook) => {
  9664. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9665. };
  9666. function resolveTransitionProps(rawProps) {
  9667. const baseProps = {};
  9668. for (const key in rawProps) {
  9669. if (!(key in DOMTransitionPropsValidators)) {
  9670. baseProps[key] = rawProps[key];
  9671. }
  9672. }
  9673. if (rawProps.css === false) {
  9674. return baseProps;
  9675. }
  9676. const {
  9677. name = "v",
  9678. type,
  9679. duration,
  9680. enterFromClass = `${name}-enter-from`,
  9681. enterActiveClass = `${name}-enter-active`,
  9682. enterToClass = `${name}-enter-to`,
  9683. appearFromClass = enterFromClass,
  9684. appearActiveClass = enterActiveClass,
  9685. appearToClass = enterToClass,
  9686. leaveFromClass = `${name}-leave-from`,
  9687. leaveActiveClass = `${name}-leave-active`,
  9688. leaveToClass = `${name}-leave-to`
  9689. } = rawProps;
  9690. const durations = normalizeDuration(duration);
  9691. const enterDuration = durations && durations[0];
  9692. const leaveDuration = durations && durations[1];
  9693. const {
  9694. onBeforeEnter,
  9695. onEnter,
  9696. onEnterCancelled,
  9697. onLeave,
  9698. onLeaveCancelled,
  9699. onBeforeAppear = onBeforeEnter,
  9700. onAppear = onEnter,
  9701. onAppearCancelled = onEnterCancelled
  9702. } = baseProps;
  9703. const finishEnter = (el, isAppear, done) => {
  9704. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9705. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9706. done && done();
  9707. };
  9708. const finishLeave = (el, done) => {
  9709. el._isLeaving = false;
  9710. removeTransitionClass(el, leaveFromClass);
  9711. removeTransitionClass(el, leaveToClass);
  9712. removeTransitionClass(el, leaveActiveClass);
  9713. done && done();
  9714. };
  9715. const makeEnterHook = (isAppear) => {
  9716. return (el, done) => {
  9717. const hook = isAppear ? onAppear : onEnter;
  9718. const resolve = () => finishEnter(el, isAppear, done);
  9719. callHook(hook, [el, resolve]);
  9720. nextFrame(() => {
  9721. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9722. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9723. if (!hasExplicitCallback(hook)) {
  9724. whenTransitionEnds(el, type, enterDuration, resolve);
  9725. }
  9726. });
  9727. };
  9728. };
  9729. return extend(baseProps, {
  9730. onBeforeEnter(el) {
  9731. callHook(onBeforeEnter, [el]);
  9732. addTransitionClass(el, enterFromClass);
  9733. addTransitionClass(el, enterActiveClass);
  9734. },
  9735. onBeforeAppear(el) {
  9736. callHook(onBeforeAppear, [el]);
  9737. addTransitionClass(el, appearFromClass);
  9738. addTransitionClass(el, appearActiveClass);
  9739. },
  9740. onEnter: makeEnterHook(false),
  9741. onAppear: makeEnterHook(true),
  9742. onLeave(el, done) {
  9743. el._isLeaving = true;
  9744. const resolve = () => finishLeave(el, done);
  9745. addTransitionClass(el, leaveFromClass);
  9746. forceReflow();
  9747. addTransitionClass(el, leaveActiveClass);
  9748. nextFrame(() => {
  9749. if (!el._isLeaving) {
  9750. return;
  9751. }
  9752. removeTransitionClass(el, leaveFromClass);
  9753. addTransitionClass(el, leaveToClass);
  9754. if (!hasExplicitCallback(onLeave)) {
  9755. whenTransitionEnds(el, type, leaveDuration, resolve);
  9756. }
  9757. });
  9758. callHook(onLeave, [el, resolve]);
  9759. },
  9760. onEnterCancelled(el) {
  9761. finishEnter(el, false);
  9762. callHook(onEnterCancelled, [el]);
  9763. },
  9764. onAppearCancelled(el) {
  9765. finishEnter(el, true);
  9766. callHook(onAppearCancelled, [el]);
  9767. },
  9768. onLeaveCancelled(el) {
  9769. finishLeave(el);
  9770. callHook(onLeaveCancelled, [el]);
  9771. }
  9772. });
  9773. }
  9774. function normalizeDuration(duration) {
  9775. if (duration == null) {
  9776. return null;
  9777. } else if (isObject(duration)) {
  9778. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9779. } else {
  9780. const n = NumberOf(duration);
  9781. return [n, n];
  9782. }
  9783. }
  9784. function NumberOf(val) {
  9785. const res = toNumber(val);
  9786. {
  9787. assertNumber(res, "<transition> explicit duration");
  9788. }
  9789. return res;
  9790. }
  9791. function addTransitionClass(el, cls) {
  9792. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9793. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  9794. }
  9795. function removeTransitionClass(el, cls) {
  9796. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9797. const _vtc = el[vtcKey];
  9798. if (_vtc) {
  9799. _vtc.delete(cls);
  9800. if (!_vtc.size) {
  9801. el[vtcKey] = void 0;
  9802. }
  9803. }
  9804. }
  9805. function nextFrame(cb) {
  9806. requestAnimationFrame(() => {
  9807. requestAnimationFrame(cb);
  9808. });
  9809. }
  9810. let endId = 0;
  9811. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9812. const id = el._endId = ++endId;
  9813. const resolveIfNotStale = () => {
  9814. if (id === el._endId) {
  9815. resolve();
  9816. }
  9817. };
  9818. if (explicitTimeout) {
  9819. return setTimeout(resolveIfNotStale, explicitTimeout);
  9820. }
  9821. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9822. if (!type) {
  9823. return resolve();
  9824. }
  9825. const endEvent = type + "end";
  9826. let ended = 0;
  9827. const end = () => {
  9828. el.removeEventListener(endEvent, onEnd);
  9829. resolveIfNotStale();
  9830. };
  9831. const onEnd = (e) => {
  9832. if (e.target === el && ++ended >= propCount) {
  9833. end();
  9834. }
  9835. };
  9836. setTimeout(() => {
  9837. if (ended < propCount) {
  9838. end();
  9839. }
  9840. }, timeout + 1);
  9841. el.addEventListener(endEvent, onEnd);
  9842. }
  9843. function getTransitionInfo(el, expectedType) {
  9844. const styles = window.getComputedStyle(el);
  9845. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9846. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9847. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9848. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9849. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9850. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9851. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9852. let type = null;
  9853. let timeout = 0;
  9854. let propCount = 0;
  9855. if (expectedType === TRANSITION$1) {
  9856. if (transitionTimeout > 0) {
  9857. type = TRANSITION$1;
  9858. timeout = transitionTimeout;
  9859. propCount = transitionDurations.length;
  9860. }
  9861. } else if (expectedType === ANIMATION) {
  9862. if (animationTimeout > 0) {
  9863. type = ANIMATION;
  9864. timeout = animationTimeout;
  9865. propCount = animationDurations.length;
  9866. }
  9867. } else {
  9868. timeout = Math.max(transitionTimeout, animationTimeout);
  9869. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9870. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9871. }
  9872. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9873. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9874. );
  9875. return {
  9876. type,
  9877. timeout,
  9878. propCount,
  9879. hasTransform
  9880. };
  9881. }
  9882. function getTimeout(delays, durations) {
  9883. while (delays.length < durations.length) {
  9884. delays = delays.concat(delays);
  9885. }
  9886. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9887. }
  9888. function toMs(s) {
  9889. if (s === "auto")
  9890. return 0;
  9891. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9892. }
  9893. function forceReflow() {
  9894. return document.body.offsetHeight;
  9895. }
  9896. function patchClass(el, value, isSVG) {
  9897. const transitionClasses = el[vtcKey];
  9898. if (transitionClasses) {
  9899. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9900. }
  9901. if (value == null) {
  9902. el.removeAttribute("class");
  9903. } else if (isSVG) {
  9904. el.setAttribute("class", value);
  9905. } else {
  9906. el.className = value;
  9907. }
  9908. }
  9909. const vShowOriginalDisplay = Symbol("_vod");
  9910. const vShowHidden = Symbol("_vsh");
  9911. const vShow = {
  9912. beforeMount(el, { value }, { transition }) {
  9913. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  9914. if (transition && value) {
  9915. transition.beforeEnter(el);
  9916. } else {
  9917. setDisplay(el, value);
  9918. }
  9919. },
  9920. mounted(el, { value }, { transition }) {
  9921. if (transition && value) {
  9922. transition.enter(el);
  9923. }
  9924. },
  9925. updated(el, { value, oldValue }, { transition }) {
  9926. if (!value === !oldValue)
  9927. return;
  9928. if (transition) {
  9929. if (value) {
  9930. transition.beforeEnter(el);
  9931. setDisplay(el, true);
  9932. transition.enter(el);
  9933. } else {
  9934. transition.leave(el, () => {
  9935. setDisplay(el, false);
  9936. });
  9937. }
  9938. } else {
  9939. setDisplay(el, value);
  9940. }
  9941. },
  9942. beforeUnmount(el, { value }) {
  9943. setDisplay(el, value);
  9944. }
  9945. };
  9946. {
  9947. vShow.name = "show";
  9948. }
  9949. function setDisplay(el, value) {
  9950. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  9951. el[vShowHidden] = !value;
  9952. }
  9953. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  9954. function useCssVars(getter) {
  9955. const instance = getCurrentInstance();
  9956. if (!instance) {
  9957. warn(`useCssVars is called without current active component instance.`);
  9958. return;
  9959. }
  9960. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  9961. Array.from(
  9962. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  9963. ).forEach((node) => setVarsOnNode(node, vars));
  9964. };
  9965. {
  9966. instance.getCssVars = () => getter(instance.proxy);
  9967. }
  9968. const setVars = () => {
  9969. const vars = getter(instance.proxy);
  9970. setVarsOnVNode(instance.subTree, vars);
  9971. updateTeleports(vars);
  9972. };
  9973. onMounted(() => {
  9974. watchPostEffect(setVars);
  9975. const ob = new MutationObserver(setVars);
  9976. ob.observe(instance.subTree.el.parentNode, { childList: true });
  9977. onUnmounted(() => ob.disconnect());
  9978. });
  9979. }
  9980. function setVarsOnVNode(vnode, vars) {
  9981. if (vnode.shapeFlag & 128) {
  9982. const suspense = vnode.suspense;
  9983. vnode = suspense.activeBranch;
  9984. if (suspense.pendingBranch && !suspense.isHydrating) {
  9985. suspense.effects.push(() => {
  9986. setVarsOnVNode(suspense.activeBranch, vars);
  9987. });
  9988. }
  9989. }
  9990. while (vnode.component) {
  9991. vnode = vnode.component.subTree;
  9992. }
  9993. if (vnode.shapeFlag & 1 && vnode.el) {
  9994. setVarsOnNode(vnode.el, vars);
  9995. } else if (vnode.type === Fragment) {
  9996. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  9997. } else if (vnode.type === Static) {
  9998. let { el, anchor } = vnode;
  9999. while (el) {
  10000. setVarsOnNode(el, vars);
  10001. if (el === anchor)
  10002. break;
  10003. el = el.nextSibling;
  10004. }
  10005. }
  10006. }
  10007. function setVarsOnNode(el, vars) {
  10008. if (el.nodeType === 1) {
  10009. const style = el.style;
  10010. let cssText = "";
  10011. for (const key in vars) {
  10012. style.setProperty(`--${key}`, vars[key]);
  10013. cssText += `--${key}: ${vars[key]};`;
  10014. }
  10015. style[CSS_VAR_TEXT] = cssText;
  10016. }
  10017. }
  10018. const displayRE = /(^|;)\s*display\s*:/;
  10019. function patchStyle(el, prev, next) {
  10020. const style = el.style;
  10021. const isCssString = isString(next);
  10022. let hasControlledDisplay = false;
  10023. if (next && !isCssString) {
  10024. if (prev) {
  10025. if (!isString(prev)) {
  10026. for (const key in prev) {
  10027. if (next[key] == null) {
  10028. setStyle(style, key, "");
  10029. }
  10030. }
  10031. } else {
  10032. for (const prevStyle of prev.split(";")) {
  10033. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10034. if (next[key] == null) {
  10035. setStyle(style, key, "");
  10036. }
  10037. }
  10038. }
  10039. }
  10040. for (const key in next) {
  10041. if (key === "display") {
  10042. hasControlledDisplay = true;
  10043. }
  10044. setStyle(style, key, next[key]);
  10045. }
  10046. } else {
  10047. if (isCssString) {
  10048. if (prev !== next) {
  10049. const cssVarText = style[CSS_VAR_TEXT];
  10050. if (cssVarText) {
  10051. next += ";" + cssVarText;
  10052. }
  10053. style.cssText = next;
  10054. hasControlledDisplay = displayRE.test(next);
  10055. }
  10056. } else if (prev) {
  10057. el.removeAttribute("style");
  10058. }
  10059. }
  10060. if (vShowOriginalDisplay in el) {
  10061. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10062. if (el[vShowHidden]) {
  10063. style.display = "none";
  10064. }
  10065. }
  10066. }
  10067. const semicolonRE = /[^\\];\s*$/;
  10068. const importantRE = /\s*!important$/;
  10069. function setStyle(style, name, val) {
  10070. if (isArray(val)) {
  10071. val.forEach((v) => setStyle(style, name, v));
  10072. } else {
  10073. if (val == null)
  10074. val = "";
  10075. {
  10076. if (semicolonRE.test(val)) {
  10077. warn(
  10078. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10079. );
  10080. }
  10081. }
  10082. if (name.startsWith("--")) {
  10083. style.setProperty(name, val);
  10084. } else {
  10085. const prefixed = autoPrefix(style, name);
  10086. if (importantRE.test(val)) {
  10087. style.setProperty(
  10088. hyphenate(prefixed),
  10089. val.replace(importantRE, ""),
  10090. "important"
  10091. );
  10092. } else {
  10093. style[prefixed] = val;
  10094. }
  10095. }
  10096. }
  10097. }
  10098. const prefixes = ["Webkit", "Moz", "ms"];
  10099. const prefixCache = {};
  10100. function autoPrefix(style, rawName) {
  10101. const cached = prefixCache[rawName];
  10102. if (cached) {
  10103. return cached;
  10104. }
  10105. let name = camelize(rawName);
  10106. if (name !== "filter" && name in style) {
  10107. return prefixCache[rawName] = name;
  10108. }
  10109. name = capitalize(name);
  10110. for (let i = 0; i < prefixes.length; i++) {
  10111. const prefixed = prefixes[i] + name;
  10112. if (prefixed in style) {
  10113. return prefixCache[rawName] = prefixed;
  10114. }
  10115. }
  10116. return rawName;
  10117. }
  10118. const xlinkNS = "http://www.w3.org/1999/xlink";
  10119. function patchAttr(el, key, value, isSVG, instance) {
  10120. if (isSVG && key.startsWith("xlink:")) {
  10121. if (value == null) {
  10122. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  10123. } else {
  10124. el.setAttributeNS(xlinkNS, key, value);
  10125. }
  10126. } else {
  10127. const isBoolean = isSpecialBooleanAttr(key);
  10128. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  10129. el.removeAttribute(key);
  10130. } else {
  10131. el.setAttribute(key, isBoolean ? "" : value);
  10132. }
  10133. }
  10134. }
  10135. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  10136. if (key === "innerHTML" || key === "textContent") {
  10137. if (prevChildren) {
  10138. unmountChildren(prevChildren, parentComponent, parentSuspense);
  10139. }
  10140. el[key] = value == null ? "" : value;
  10141. return;
  10142. }
  10143. const tag = el.tagName;
  10144. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  10145. !tag.includes("-")) {
  10146. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  10147. const newValue = value == null ? "" : value;
  10148. if (oldValue !== newValue || !("_value" in el)) {
  10149. el.value = newValue;
  10150. }
  10151. if (value == null) {
  10152. el.removeAttribute(key);
  10153. }
  10154. el._value = value;
  10155. return;
  10156. }
  10157. let needRemove = false;
  10158. if (value === "" || value == null) {
  10159. const type = typeof el[key];
  10160. if (type === "boolean") {
  10161. value = includeBooleanAttr(value);
  10162. } else if (value == null && type === "string") {
  10163. value = "";
  10164. needRemove = true;
  10165. } else if (type === "number") {
  10166. value = 0;
  10167. needRemove = true;
  10168. }
  10169. }
  10170. try {
  10171. el[key] = value;
  10172. } catch (e) {
  10173. if (!needRemove) {
  10174. warn(
  10175. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  10176. e
  10177. );
  10178. }
  10179. }
  10180. needRemove && el.removeAttribute(key);
  10181. }
  10182. function addEventListener(el, event, handler, options) {
  10183. el.addEventListener(event, handler, options);
  10184. }
  10185. function removeEventListener(el, event, handler, options) {
  10186. el.removeEventListener(event, handler, options);
  10187. }
  10188. const veiKey = Symbol("_vei");
  10189. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  10190. const invokers = el[veiKey] || (el[veiKey] = {});
  10191. const existingInvoker = invokers[rawName];
  10192. if (nextValue && existingInvoker) {
  10193. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  10194. } else {
  10195. const [name, options] = parseName(rawName);
  10196. if (nextValue) {
  10197. const invoker = invokers[rawName] = createInvoker(
  10198. sanitizeEventValue(nextValue, rawName) ,
  10199. instance
  10200. );
  10201. addEventListener(el, name, invoker, options);
  10202. } else if (existingInvoker) {
  10203. removeEventListener(el, name, existingInvoker, options);
  10204. invokers[rawName] = void 0;
  10205. }
  10206. }
  10207. }
  10208. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  10209. function parseName(name) {
  10210. let options;
  10211. if (optionsModifierRE.test(name)) {
  10212. options = {};
  10213. let m;
  10214. while (m = name.match(optionsModifierRE)) {
  10215. name = name.slice(0, name.length - m[0].length);
  10216. options[m[0].toLowerCase()] = true;
  10217. }
  10218. }
  10219. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  10220. return [event, options];
  10221. }
  10222. let cachedNow = 0;
  10223. const p = /* @__PURE__ */ Promise.resolve();
  10224. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  10225. function createInvoker(initialValue, instance) {
  10226. const invoker = (e) => {
  10227. if (!e._vts) {
  10228. e._vts = Date.now();
  10229. } else if (e._vts <= invoker.attached) {
  10230. return;
  10231. }
  10232. callWithAsyncErrorHandling(
  10233. patchStopImmediatePropagation(e, invoker.value),
  10234. instance,
  10235. 5,
  10236. [e]
  10237. );
  10238. };
  10239. invoker.value = initialValue;
  10240. invoker.attached = getNow();
  10241. return invoker;
  10242. }
  10243. function sanitizeEventValue(value, propName) {
  10244. if (isFunction(value) || isArray(value)) {
  10245. return value;
  10246. }
  10247. warn(
  10248. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  10249. Expected function or array of functions, received type ${typeof value}.`
  10250. );
  10251. return NOOP;
  10252. }
  10253. function patchStopImmediatePropagation(e, value) {
  10254. if (isArray(value)) {
  10255. const originalStop = e.stopImmediatePropagation;
  10256. e.stopImmediatePropagation = () => {
  10257. originalStop.call(e);
  10258. e._stopped = true;
  10259. };
  10260. return value.map(
  10261. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  10262. );
  10263. } else {
  10264. return value;
  10265. }
  10266. }
  10267. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  10268. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  10269. const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  10270. const isSVG = namespace === "svg";
  10271. if (key === "class") {
  10272. patchClass(el, nextValue, isSVG);
  10273. } else if (key === "style") {
  10274. patchStyle(el, prevValue, nextValue);
  10275. } else if (isOn(key)) {
  10276. if (!isModelListener(key)) {
  10277. patchEvent(el, key, prevValue, nextValue, parentComponent);
  10278. }
  10279. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  10280. patchDOMProp(
  10281. el,
  10282. key,
  10283. nextValue,
  10284. prevChildren,
  10285. parentComponent,
  10286. parentSuspense,
  10287. unmountChildren
  10288. );
  10289. } else {
  10290. if (key === "true-value") {
  10291. el._trueValue = nextValue;
  10292. } else if (key === "false-value") {
  10293. el._falseValue = nextValue;
  10294. }
  10295. patchAttr(el, key, nextValue, isSVG);
  10296. }
  10297. };
  10298. function shouldSetAsProp(el, key, value, isSVG) {
  10299. if (isSVG) {
  10300. if (key === "innerHTML" || key === "textContent") {
  10301. return true;
  10302. }
  10303. if (key in el && isNativeOn(key) && isFunction(value)) {
  10304. return true;
  10305. }
  10306. return false;
  10307. }
  10308. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  10309. return false;
  10310. }
  10311. if (key === "form") {
  10312. return false;
  10313. }
  10314. if (key === "list" && el.tagName === "INPUT") {
  10315. return false;
  10316. }
  10317. if (key === "type" && el.tagName === "TEXTAREA") {
  10318. return false;
  10319. }
  10320. if (key === "width" || key === "height") {
  10321. const tag = el.tagName;
  10322. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  10323. return false;
  10324. }
  10325. }
  10326. if (isNativeOn(key) && isString(value)) {
  10327. return false;
  10328. }
  10329. return key in el;
  10330. }
  10331. /*! #__NO_SIDE_EFFECTS__ */
  10332. // @__NO_SIDE_EFFECTS__
  10333. function defineCustomElement(options, hydrate2) {
  10334. const Comp = defineComponent(options);
  10335. class VueCustomElement extends VueElement {
  10336. constructor(initialProps) {
  10337. super(Comp, initialProps, hydrate2);
  10338. }
  10339. }
  10340. VueCustomElement.def = Comp;
  10341. return VueCustomElement;
  10342. }
  10343. /*! #__NO_SIDE_EFFECTS__ */
  10344. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
  10345. return /* @__PURE__ */ defineCustomElement(options, hydrate);
  10346. };
  10347. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  10348. };
  10349. class VueElement extends BaseClass {
  10350. constructor(_def, _props = {}, hydrate2) {
  10351. super();
  10352. this._def = _def;
  10353. this._props = _props;
  10354. /**
  10355. * @internal
  10356. */
  10357. this._instance = null;
  10358. this._connected = false;
  10359. this._resolved = false;
  10360. this._numberProps = null;
  10361. this._ob = null;
  10362. if (this.shadowRoot && hydrate2) {
  10363. hydrate2(this._createVNode(), this.shadowRoot);
  10364. } else {
  10365. if (this.shadowRoot) {
  10366. warn(
  10367. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  10368. );
  10369. }
  10370. this.attachShadow({ mode: "open" });
  10371. if (!this._def.__asyncLoader) {
  10372. this._resolveProps(this._def);
  10373. }
  10374. }
  10375. }
  10376. connectedCallback() {
  10377. this._connected = true;
  10378. if (!this._instance) {
  10379. if (this._resolved) {
  10380. this._update();
  10381. } else {
  10382. this._resolveDef();
  10383. }
  10384. }
  10385. }
  10386. disconnectedCallback() {
  10387. this._connected = false;
  10388. if (this._ob) {
  10389. this._ob.disconnect();
  10390. this._ob = null;
  10391. }
  10392. nextTick(() => {
  10393. if (!this._connected) {
  10394. render(null, this.shadowRoot);
  10395. this._instance = null;
  10396. }
  10397. });
  10398. }
  10399. /**
  10400. * resolve inner component definition (handle possible async component)
  10401. */
  10402. _resolveDef() {
  10403. this._resolved = true;
  10404. for (let i = 0; i < this.attributes.length; i++) {
  10405. this._setAttr(this.attributes[i].name);
  10406. }
  10407. this._ob = new MutationObserver((mutations) => {
  10408. for (const m of mutations) {
  10409. this._setAttr(m.attributeName);
  10410. }
  10411. });
  10412. this._ob.observe(this, { attributes: true });
  10413. const resolve = (def, isAsync = false) => {
  10414. const { props, styles } = def;
  10415. let numberProps;
  10416. if (props && !isArray(props)) {
  10417. for (const key in props) {
  10418. const opt = props[key];
  10419. if (opt === Number || opt && opt.type === Number) {
  10420. if (key in this._props) {
  10421. this._props[key] = toNumber(this._props[key]);
  10422. }
  10423. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  10424. }
  10425. }
  10426. }
  10427. this._numberProps = numberProps;
  10428. if (isAsync) {
  10429. this._resolveProps(def);
  10430. }
  10431. this._applyStyles(styles);
  10432. this._update();
  10433. };
  10434. const asyncDef = this._def.__asyncLoader;
  10435. if (asyncDef) {
  10436. asyncDef().then((def) => resolve(def, true));
  10437. } else {
  10438. resolve(this._def);
  10439. }
  10440. }
  10441. _resolveProps(def) {
  10442. const { props } = def;
  10443. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  10444. for (const key of Object.keys(this)) {
  10445. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  10446. this._setProp(key, this[key], true, false);
  10447. }
  10448. }
  10449. for (const key of declaredPropKeys.map(camelize)) {
  10450. Object.defineProperty(this, key, {
  10451. get() {
  10452. return this._getProp(key);
  10453. },
  10454. set(val) {
  10455. this._setProp(key, val);
  10456. }
  10457. });
  10458. }
  10459. }
  10460. _setAttr(key) {
  10461. let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
  10462. const camelKey = camelize(key);
  10463. if (this._numberProps && this._numberProps[camelKey]) {
  10464. value = toNumber(value);
  10465. }
  10466. this._setProp(camelKey, value, false);
  10467. }
  10468. /**
  10469. * @internal
  10470. */
  10471. _getProp(key) {
  10472. return this._props[key];
  10473. }
  10474. /**
  10475. * @internal
  10476. */
  10477. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  10478. if (val !== this._props[key]) {
  10479. this._props[key] = val;
  10480. if (shouldUpdate && this._instance) {
  10481. this._update();
  10482. }
  10483. if (shouldReflect) {
  10484. if (val === true) {
  10485. this.setAttribute(hyphenate(key), "");
  10486. } else if (typeof val === "string" || typeof val === "number") {
  10487. this.setAttribute(hyphenate(key), val + "");
  10488. } else if (!val) {
  10489. this.removeAttribute(hyphenate(key));
  10490. }
  10491. }
  10492. }
  10493. }
  10494. _update() {
  10495. render(this._createVNode(), this.shadowRoot);
  10496. }
  10497. _createVNode() {
  10498. const vnode = createVNode(this._def, extend({}, this._props));
  10499. if (!this._instance) {
  10500. vnode.ce = (instance) => {
  10501. this._instance = instance;
  10502. instance.isCE = true;
  10503. {
  10504. instance.ceReload = (newStyles) => {
  10505. if (this._styles) {
  10506. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  10507. this._styles.length = 0;
  10508. }
  10509. this._applyStyles(newStyles);
  10510. this._instance = null;
  10511. this._update();
  10512. };
  10513. }
  10514. const dispatch = (event, args) => {
  10515. this.dispatchEvent(
  10516. new CustomEvent(event, {
  10517. detail: args
  10518. })
  10519. );
  10520. };
  10521. instance.emit = (event, ...args) => {
  10522. dispatch(event, args);
  10523. if (hyphenate(event) !== event) {
  10524. dispatch(hyphenate(event), args);
  10525. }
  10526. };
  10527. let parent = this;
  10528. while (parent = parent && (parent.parentNode || parent.host)) {
  10529. if (parent instanceof VueElement) {
  10530. instance.parent = parent._instance;
  10531. instance.provides = parent._instance.provides;
  10532. break;
  10533. }
  10534. }
  10535. };
  10536. }
  10537. return vnode;
  10538. }
  10539. _applyStyles(styles) {
  10540. if (styles) {
  10541. styles.forEach((css) => {
  10542. const s = document.createElement("style");
  10543. s.textContent = css;
  10544. this.shadowRoot.appendChild(s);
  10545. {
  10546. (this._styles || (this._styles = [])).push(s);
  10547. }
  10548. });
  10549. }
  10550. }
  10551. }
  10552. function useCssModule(name = "$style") {
  10553. {
  10554. const instance = getCurrentInstance();
  10555. if (!instance) {
  10556. warn(`useCssModule must be called inside setup()`);
  10557. return EMPTY_OBJ;
  10558. }
  10559. const modules = instance.type.__cssModules;
  10560. if (!modules) {
  10561. warn(`Current instance does not have CSS modules injected.`);
  10562. return EMPTY_OBJ;
  10563. }
  10564. const mod = modules[name];
  10565. if (!mod) {
  10566. warn(`Current instance does not have CSS module named "${name}".`);
  10567. return EMPTY_OBJ;
  10568. }
  10569. return mod;
  10570. }
  10571. }
  10572. const positionMap = /* @__PURE__ */ new WeakMap();
  10573. const newPositionMap = /* @__PURE__ */ new WeakMap();
  10574. const moveCbKey = Symbol("_moveCb");
  10575. const enterCbKey = Symbol("_enterCb");
  10576. const TransitionGroupImpl = {
  10577. name: "TransitionGroup",
  10578. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  10579. tag: String,
  10580. moveClass: String
  10581. }),
  10582. setup(props, { slots }) {
  10583. const instance = getCurrentInstance();
  10584. const state = useTransitionState();
  10585. let prevChildren;
  10586. let children;
  10587. onUpdated(() => {
  10588. if (!prevChildren.length) {
  10589. return;
  10590. }
  10591. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  10592. if (!hasCSSTransform(
  10593. prevChildren[0].el,
  10594. instance.vnode.el,
  10595. moveClass
  10596. )) {
  10597. return;
  10598. }
  10599. prevChildren.forEach(callPendingCbs);
  10600. prevChildren.forEach(recordPosition);
  10601. const movedChildren = prevChildren.filter(applyTranslation);
  10602. forceReflow();
  10603. movedChildren.forEach((c) => {
  10604. const el = c.el;
  10605. const style = el.style;
  10606. addTransitionClass(el, moveClass);
  10607. style.transform = style.webkitTransform = style.transitionDuration = "";
  10608. const cb = el[moveCbKey] = (e) => {
  10609. if (e && e.target !== el) {
  10610. return;
  10611. }
  10612. if (!e || /transform$/.test(e.propertyName)) {
  10613. el.removeEventListener("transitionend", cb);
  10614. el[moveCbKey] = null;
  10615. removeTransitionClass(el, moveClass);
  10616. }
  10617. };
  10618. el.addEventListener("transitionend", cb);
  10619. });
  10620. });
  10621. return () => {
  10622. const rawProps = toRaw(props);
  10623. const cssTransitionProps = resolveTransitionProps(rawProps);
  10624. let tag = rawProps.tag || Fragment;
  10625. prevChildren = [];
  10626. if (children) {
  10627. for (let i = 0; i < children.length; i++) {
  10628. const child = children[i];
  10629. if (child.el && child.el instanceof Element) {
  10630. prevChildren.push(child);
  10631. setTransitionHooks(
  10632. child,
  10633. resolveTransitionHooks(
  10634. child,
  10635. cssTransitionProps,
  10636. state,
  10637. instance
  10638. )
  10639. );
  10640. positionMap.set(
  10641. child,
  10642. child.el.getBoundingClientRect()
  10643. );
  10644. }
  10645. }
  10646. }
  10647. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  10648. for (let i = 0; i < children.length; i++) {
  10649. const child = children[i];
  10650. if (child.key != null) {
  10651. setTransitionHooks(
  10652. child,
  10653. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10654. );
  10655. } else {
  10656. warn(`<TransitionGroup> children must be keyed.`);
  10657. }
  10658. }
  10659. return createVNode(tag, null, children);
  10660. };
  10661. }
  10662. };
  10663. const removeMode = (props) => delete props.mode;
  10664. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  10665. const TransitionGroup = TransitionGroupImpl;
  10666. function callPendingCbs(c) {
  10667. const el = c.el;
  10668. if (el[moveCbKey]) {
  10669. el[moveCbKey]();
  10670. }
  10671. if (el[enterCbKey]) {
  10672. el[enterCbKey]();
  10673. }
  10674. }
  10675. function recordPosition(c) {
  10676. newPositionMap.set(c, c.el.getBoundingClientRect());
  10677. }
  10678. function applyTranslation(c) {
  10679. const oldPos = positionMap.get(c);
  10680. const newPos = newPositionMap.get(c);
  10681. const dx = oldPos.left - newPos.left;
  10682. const dy = oldPos.top - newPos.top;
  10683. if (dx || dy) {
  10684. const s = c.el.style;
  10685. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10686. s.transitionDuration = "0s";
  10687. return c;
  10688. }
  10689. }
  10690. function hasCSSTransform(el, root, moveClass) {
  10691. const clone = el.cloneNode();
  10692. const _vtc = el[vtcKey];
  10693. if (_vtc) {
  10694. _vtc.forEach((cls) => {
  10695. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10696. });
  10697. }
  10698. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10699. clone.style.display = "none";
  10700. const container = root.nodeType === 1 ? root : root.parentNode;
  10701. container.appendChild(clone);
  10702. const { hasTransform } = getTransitionInfo(clone);
  10703. container.removeChild(clone);
  10704. return hasTransform;
  10705. }
  10706. const getModelAssigner = (vnode) => {
  10707. const fn = vnode.props["onUpdate:modelValue"] || false;
  10708. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10709. };
  10710. function onCompositionStart(e) {
  10711. e.target.composing = true;
  10712. }
  10713. function onCompositionEnd(e) {
  10714. const target = e.target;
  10715. if (target.composing) {
  10716. target.composing = false;
  10717. target.dispatchEvent(new Event("input"));
  10718. }
  10719. }
  10720. const assignKey = Symbol("_assign");
  10721. const vModelText = {
  10722. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10723. el[assignKey] = getModelAssigner(vnode);
  10724. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10725. addEventListener(el, lazy ? "change" : "input", (e) => {
  10726. if (e.target.composing)
  10727. return;
  10728. let domValue = el.value;
  10729. if (trim) {
  10730. domValue = domValue.trim();
  10731. }
  10732. if (castToNumber) {
  10733. domValue = looseToNumber(domValue);
  10734. }
  10735. el[assignKey](domValue);
  10736. });
  10737. if (trim) {
  10738. addEventListener(el, "change", () => {
  10739. el.value = el.value.trim();
  10740. });
  10741. }
  10742. if (!lazy) {
  10743. addEventListener(el, "compositionstart", onCompositionStart);
  10744. addEventListener(el, "compositionend", onCompositionEnd);
  10745. addEventListener(el, "change", onCompositionEnd);
  10746. }
  10747. },
  10748. // set value on mounted so it's after min/max for type="range"
  10749. mounted(el, { value }) {
  10750. el.value = value == null ? "" : value;
  10751. },
  10752. beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
  10753. el[assignKey] = getModelAssigner(vnode);
  10754. if (el.composing)
  10755. return;
  10756. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  10757. const newValue = value == null ? "" : value;
  10758. if (elValue === newValue) {
  10759. return;
  10760. }
  10761. if (document.activeElement === el && el.type !== "range") {
  10762. if (lazy) {
  10763. return;
  10764. }
  10765. if (trim && el.value.trim() === newValue) {
  10766. return;
  10767. }
  10768. }
  10769. el.value = newValue;
  10770. }
  10771. };
  10772. const vModelCheckbox = {
  10773. // #4096 array checkboxes need to be deep traversed
  10774. deep: true,
  10775. created(el, _, vnode) {
  10776. el[assignKey] = getModelAssigner(vnode);
  10777. addEventListener(el, "change", () => {
  10778. const modelValue = el._modelValue;
  10779. const elementValue = getValue(el);
  10780. const checked = el.checked;
  10781. const assign = el[assignKey];
  10782. if (isArray(modelValue)) {
  10783. const index = looseIndexOf(modelValue, elementValue);
  10784. const found = index !== -1;
  10785. if (checked && !found) {
  10786. assign(modelValue.concat(elementValue));
  10787. } else if (!checked && found) {
  10788. const filtered = [...modelValue];
  10789. filtered.splice(index, 1);
  10790. assign(filtered);
  10791. }
  10792. } else if (isSet(modelValue)) {
  10793. const cloned = new Set(modelValue);
  10794. if (checked) {
  10795. cloned.add(elementValue);
  10796. } else {
  10797. cloned.delete(elementValue);
  10798. }
  10799. assign(cloned);
  10800. } else {
  10801. assign(getCheckboxValue(el, checked));
  10802. }
  10803. });
  10804. },
  10805. // set initial checked on mount to wait for true-value/false-value
  10806. mounted: setChecked,
  10807. beforeUpdate(el, binding, vnode) {
  10808. el[assignKey] = getModelAssigner(vnode);
  10809. setChecked(el, binding, vnode);
  10810. }
  10811. };
  10812. function setChecked(el, { value, oldValue }, vnode) {
  10813. el._modelValue = value;
  10814. if (isArray(value)) {
  10815. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10816. } else if (isSet(value)) {
  10817. el.checked = value.has(vnode.props.value);
  10818. } else if (value !== oldValue) {
  10819. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10820. }
  10821. }
  10822. const vModelRadio = {
  10823. created(el, { value }, vnode) {
  10824. el.checked = looseEqual(value, vnode.props.value);
  10825. el[assignKey] = getModelAssigner(vnode);
  10826. addEventListener(el, "change", () => {
  10827. el[assignKey](getValue(el));
  10828. });
  10829. },
  10830. beforeUpdate(el, { value, oldValue }, vnode) {
  10831. el[assignKey] = getModelAssigner(vnode);
  10832. if (value !== oldValue) {
  10833. el.checked = looseEqual(value, vnode.props.value);
  10834. }
  10835. }
  10836. };
  10837. const vModelSelect = {
  10838. // <select multiple> value need to be deep traversed
  10839. deep: true,
  10840. created(el, { value, modifiers: { number } }, vnode) {
  10841. const isSetModel = isSet(value);
  10842. addEventListener(el, "change", () => {
  10843. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10844. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10845. );
  10846. el[assignKey](
  10847. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10848. );
  10849. el._assigning = true;
  10850. nextTick(() => {
  10851. el._assigning = false;
  10852. });
  10853. });
  10854. el[assignKey] = getModelAssigner(vnode);
  10855. },
  10856. // set value in mounted & updated because <select> relies on its children
  10857. // <option>s.
  10858. mounted(el, { value, modifiers: { number } }) {
  10859. setSelected(el, value);
  10860. },
  10861. beforeUpdate(el, _binding, vnode) {
  10862. el[assignKey] = getModelAssigner(vnode);
  10863. },
  10864. updated(el, { value, modifiers: { number } }) {
  10865. if (!el._assigning) {
  10866. setSelected(el, value);
  10867. }
  10868. }
  10869. };
  10870. function setSelected(el, value, number) {
  10871. const isMultiple = el.multiple;
  10872. const isArrayValue = isArray(value);
  10873. if (isMultiple && !isArrayValue && !isSet(value)) {
  10874. warn(
  10875. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10876. );
  10877. return;
  10878. }
  10879. for (let i = 0, l = el.options.length; i < l; i++) {
  10880. const option = el.options[i];
  10881. const optionValue = getValue(option);
  10882. if (isMultiple) {
  10883. if (isArrayValue) {
  10884. const optionType = typeof optionValue;
  10885. if (optionType === "string" || optionType === "number") {
  10886. option.selected = value.some((v) => String(v) === String(optionValue));
  10887. } else {
  10888. option.selected = looseIndexOf(value, optionValue) > -1;
  10889. }
  10890. } else {
  10891. option.selected = value.has(optionValue);
  10892. }
  10893. } else if (looseEqual(getValue(option), value)) {
  10894. if (el.selectedIndex !== i)
  10895. el.selectedIndex = i;
  10896. return;
  10897. }
  10898. }
  10899. if (!isMultiple && el.selectedIndex !== -1) {
  10900. el.selectedIndex = -1;
  10901. }
  10902. }
  10903. function getValue(el) {
  10904. return "_value" in el ? el._value : el.value;
  10905. }
  10906. function getCheckboxValue(el, checked) {
  10907. const key = checked ? "_trueValue" : "_falseValue";
  10908. return key in el ? el[key] : checked;
  10909. }
  10910. const vModelDynamic = {
  10911. created(el, binding, vnode) {
  10912. callModelHook(el, binding, vnode, null, "created");
  10913. },
  10914. mounted(el, binding, vnode) {
  10915. callModelHook(el, binding, vnode, null, "mounted");
  10916. },
  10917. beforeUpdate(el, binding, vnode, prevVNode) {
  10918. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10919. },
  10920. updated(el, binding, vnode, prevVNode) {
  10921. callModelHook(el, binding, vnode, prevVNode, "updated");
  10922. }
  10923. };
  10924. function resolveDynamicModel(tagName, type) {
  10925. switch (tagName) {
  10926. case "SELECT":
  10927. return vModelSelect;
  10928. case "TEXTAREA":
  10929. return vModelText;
  10930. default:
  10931. switch (type) {
  10932. case "checkbox":
  10933. return vModelCheckbox;
  10934. case "radio":
  10935. return vModelRadio;
  10936. default:
  10937. return vModelText;
  10938. }
  10939. }
  10940. }
  10941. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10942. const modelToUse = resolveDynamicModel(
  10943. el.tagName,
  10944. vnode.props && vnode.props.type
  10945. );
  10946. const fn = modelToUse[hook];
  10947. fn && fn(el, binding, vnode, prevVNode);
  10948. }
  10949. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10950. const modifierGuards = {
  10951. stop: (e) => e.stopPropagation(),
  10952. prevent: (e) => e.preventDefault(),
  10953. self: (e) => e.target !== e.currentTarget,
  10954. ctrl: (e) => !e.ctrlKey,
  10955. shift: (e) => !e.shiftKey,
  10956. alt: (e) => !e.altKey,
  10957. meta: (e) => !e.metaKey,
  10958. left: (e) => "button" in e && e.button !== 0,
  10959. middle: (e) => "button" in e && e.button !== 1,
  10960. right: (e) => "button" in e && e.button !== 2,
  10961. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  10962. };
  10963. const withModifiers = (fn, modifiers) => {
  10964. const cache = fn._withMods || (fn._withMods = {});
  10965. const cacheKey = modifiers.join(".");
  10966. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  10967. for (let i = 0; i < modifiers.length; i++) {
  10968. const guard = modifierGuards[modifiers[i]];
  10969. if (guard && guard(event, modifiers))
  10970. return;
  10971. }
  10972. return fn(event, ...args);
  10973. });
  10974. };
  10975. const keyNames = {
  10976. esc: "escape",
  10977. space: " ",
  10978. up: "arrow-up",
  10979. left: "arrow-left",
  10980. right: "arrow-right",
  10981. down: "arrow-down",
  10982. delete: "backspace"
  10983. };
  10984. const withKeys = (fn, modifiers) => {
  10985. const cache = fn._withKeys || (fn._withKeys = {});
  10986. const cacheKey = modifiers.join(".");
  10987. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  10988. if (!("key" in event)) {
  10989. return;
  10990. }
  10991. const eventKey = hyphenate(event.key);
  10992. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  10993. return fn(event);
  10994. }
  10995. });
  10996. };
  10997. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  10998. let renderer;
  10999. let enabledHydration = false;
  11000. function ensureRenderer() {
  11001. return renderer || (renderer = createRenderer(rendererOptions));
  11002. }
  11003. function ensureHydrationRenderer() {
  11004. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  11005. enabledHydration = true;
  11006. return renderer;
  11007. }
  11008. const render = (...args) => {
  11009. ensureRenderer().render(...args);
  11010. };
  11011. const hydrate = (...args) => {
  11012. ensureHydrationRenderer().hydrate(...args);
  11013. };
  11014. const createApp = (...args) => {
  11015. const app = ensureRenderer().createApp(...args);
  11016. {
  11017. injectNativeTagCheck(app);
  11018. injectCompilerOptionsCheck(app);
  11019. }
  11020. const { mount } = app;
  11021. app.mount = (containerOrSelector) => {
  11022. const container = normalizeContainer(containerOrSelector);
  11023. if (!container)
  11024. return;
  11025. const component = app._component;
  11026. if (!isFunction(component) && !component.render && !component.template) {
  11027. component.template = container.innerHTML;
  11028. }
  11029. container.innerHTML = "";
  11030. const proxy = mount(container, false, resolveRootNamespace(container));
  11031. if (container instanceof Element) {
  11032. container.removeAttribute("v-cloak");
  11033. container.setAttribute("data-v-app", "");
  11034. }
  11035. return proxy;
  11036. };
  11037. return app;
  11038. };
  11039. const createSSRApp = (...args) => {
  11040. const app = ensureHydrationRenderer().createApp(...args);
  11041. {
  11042. injectNativeTagCheck(app);
  11043. injectCompilerOptionsCheck(app);
  11044. }
  11045. const { mount } = app;
  11046. app.mount = (containerOrSelector) => {
  11047. const container = normalizeContainer(containerOrSelector);
  11048. if (container) {
  11049. return mount(container, true, resolveRootNamespace(container));
  11050. }
  11051. };
  11052. return app;
  11053. };
  11054. function resolveRootNamespace(container) {
  11055. if (container instanceof SVGElement) {
  11056. return "svg";
  11057. }
  11058. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  11059. return "mathml";
  11060. }
  11061. }
  11062. function injectNativeTagCheck(app) {
  11063. Object.defineProperty(app.config, "isNativeTag", {
  11064. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  11065. writable: false
  11066. });
  11067. }
  11068. function injectCompilerOptionsCheck(app) {
  11069. if (isRuntimeOnly()) {
  11070. const isCustomElement = app.config.isCustomElement;
  11071. Object.defineProperty(app.config, "isCustomElement", {
  11072. get() {
  11073. return isCustomElement;
  11074. },
  11075. set() {
  11076. warn(
  11077. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  11078. );
  11079. }
  11080. });
  11081. const compilerOptions = app.config.compilerOptions;
  11082. 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.
  11083. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  11084. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  11085. - 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`;
  11086. Object.defineProperty(app.config, "compilerOptions", {
  11087. get() {
  11088. warn(msg);
  11089. return compilerOptions;
  11090. },
  11091. set() {
  11092. warn(msg);
  11093. }
  11094. });
  11095. }
  11096. }
  11097. function normalizeContainer(container) {
  11098. if (isString(container)) {
  11099. const res = document.querySelector(container);
  11100. if (!res) {
  11101. warn(
  11102. `Failed to mount app: mount target selector "${container}" returned null.`
  11103. );
  11104. }
  11105. return res;
  11106. }
  11107. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  11108. warn(
  11109. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  11110. );
  11111. }
  11112. return container;
  11113. }
  11114. const initDirectivesForSSR = NOOP;
  11115. var runtimeDom = /*#__PURE__*/Object.freeze({
  11116. __proto__: null,
  11117. BaseTransition: BaseTransition,
  11118. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  11119. Comment: Comment,
  11120. DeprecationTypes: DeprecationTypes,
  11121. EffectScope: EffectScope,
  11122. ErrorCodes: ErrorCodes,
  11123. ErrorTypeStrings: ErrorTypeStrings,
  11124. Fragment: Fragment,
  11125. KeepAlive: KeepAlive,
  11126. ReactiveEffect: ReactiveEffect,
  11127. Static: Static,
  11128. Suspense: Suspense,
  11129. Teleport: Teleport,
  11130. Text: Text,
  11131. TrackOpTypes: TrackOpTypes,
  11132. Transition: Transition,
  11133. TransitionGroup: TransitionGroup,
  11134. TriggerOpTypes: TriggerOpTypes,
  11135. VueElement: VueElement,
  11136. assertNumber: assertNumber,
  11137. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  11138. callWithErrorHandling: callWithErrorHandling,
  11139. camelize: camelize,
  11140. capitalize: capitalize,
  11141. cloneVNode: cloneVNode,
  11142. compatUtils: compatUtils,
  11143. computed: computed,
  11144. createApp: createApp,
  11145. createBlock: createBlock,
  11146. createCommentVNode: createCommentVNode,
  11147. createElementBlock: createElementBlock,
  11148. createElementVNode: createBaseVNode,
  11149. createHydrationRenderer: createHydrationRenderer,
  11150. createPropsRestProxy: createPropsRestProxy,
  11151. createRenderer: createRenderer,
  11152. createSSRApp: createSSRApp,
  11153. createSlots: createSlots,
  11154. createStaticVNode: createStaticVNode,
  11155. createTextVNode: createTextVNode,
  11156. createVNode: createVNode,
  11157. customRef: customRef,
  11158. defineAsyncComponent: defineAsyncComponent,
  11159. defineComponent: defineComponent,
  11160. defineCustomElement: defineCustomElement,
  11161. defineEmits: defineEmits,
  11162. defineExpose: defineExpose,
  11163. defineModel: defineModel,
  11164. defineOptions: defineOptions,
  11165. defineProps: defineProps,
  11166. defineSSRCustomElement: defineSSRCustomElement,
  11167. defineSlots: defineSlots,
  11168. devtools: devtools,
  11169. effect: effect,
  11170. effectScope: effectScope,
  11171. getCurrentInstance: getCurrentInstance,
  11172. getCurrentScope: getCurrentScope,
  11173. getTransitionRawChildren: getTransitionRawChildren,
  11174. guardReactiveProps: guardReactiveProps,
  11175. h: h,
  11176. handleError: handleError,
  11177. hasInjectionContext: hasInjectionContext,
  11178. hydrate: hydrate,
  11179. initCustomFormatter: initCustomFormatter,
  11180. initDirectivesForSSR: initDirectivesForSSR,
  11181. inject: inject,
  11182. isMemoSame: isMemoSame,
  11183. isProxy: isProxy,
  11184. isReactive: isReactive,
  11185. isReadonly: isReadonly,
  11186. isRef: isRef,
  11187. isRuntimeOnly: isRuntimeOnly,
  11188. isShallow: isShallow,
  11189. isVNode: isVNode,
  11190. markRaw: markRaw,
  11191. mergeDefaults: mergeDefaults,
  11192. mergeModels: mergeModels,
  11193. mergeProps: mergeProps,
  11194. nextTick: nextTick,
  11195. normalizeClass: normalizeClass,
  11196. normalizeProps: normalizeProps,
  11197. normalizeStyle: normalizeStyle,
  11198. onActivated: onActivated,
  11199. onBeforeMount: onBeforeMount,
  11200. onBeforeUnmount: onBeforeUnmount,
  11201. onBeforeUpdate: onBeforeUpdate,
  11202. onDeactivated: onDeactivated,
  11203. onErrorCaptured: onErrorCaptured,
  11204. onMounted: onMounted,
  11205. onRenderTracked: onRenderTracked,
  11206. onRenderTriggered: onRenderTriggered,
  11207. onScopeDispose: onScopeDispose,
  11208. onServerPrefetch: onServerPrefetch,
  11209. onUnmounted: onUnmounted,
  11210. onUpdated: onUpdated,
  11211. openBlock: openBlock,
  11212. popScopeId: popScopeId,
  11213. provide: provide,
  11214. proxyRefs: proxyRefs,
  11215. pushScopeId: pushScopeId,
  11216. queuePostFlushCb: queuePostFlushCb,
  11217. reactive: reactive,
  11218. readonly: readonly,
  11219. ref: ref,
  11220. registerRuntimeCompiler: registerRuntimeCompiler,
  11221. render: render,
  11222. renderList: renderList,
  11223. renderSlot: renderSlot,
  11224. resolveComponent: resolveComponent,
  11225. resolveDirective: resolveDirective,
  11226. resolveDynamicComponent: resolveDynamicComponent,
  11227. resolveFilter: resolveFilter,
  11228. resolveTransitionHooks: resolveTransitionHooks,
  11229. setBlockTracking: setBlockTracking,
  11230. setDevtoolsHook: setDevtoolsHook,
  11231. setTransitionHooks: setTransitionHooks,
  11232. shallowReactive: shallowReactive,
  11233. shallowReadonly: shallowReadonly,
  11234. shallowRef: shallowRef,
  11235. ssrContextKey: ssrContextKey,
  11236. ssrUtils: ssrUtils,
  11237. stop: stop,
  11238. toDisplayString: toDisplayString,
  11239. toHandlerKey: toHandlerKey,
  11240. toHandlers: toHandlers,
  11241. toRaw: toRaw,
  11242. toRef: toRef,
  11243. toRefs: toRefs,
  11244. toValue: toValue,
  11245. transformVNodeArgs: transformVNodeArgs,
  11246. triggerRef: triggerRef,
  11247. unref: unref,
  11248. useAttrs: useAttrs,
  11249. useCssModule: useCssModule,
  11250. useCssVars: useCssVars,
  11251. useModel: useModel,
  11252. useSSRContext: useSSRContext,
  11253. useSlots: useSlots,
  11254. useTransitionState: useTransitionState,
  11255. vModelCheckbox: vModelCheckbox,
  11256. vModelDynamic: vModelDynamic,
  11257. vModelRadio: vModelRadio,
  11258. vModelSelect: vModelSelect,
  11259. vModelText: vModelText,
  11260. vShow: vShow,
  11261. version: version,
  11262. warn: warn,
  11263. watch: watch,
  11264. watchEffect: watchEffect,
  11265. watchPostEffect: watchPostEffect,
  11266. watchSyncEffect: watchSyncEffect,
  11267. withAsyncContext: withAsyncContext,
  11268. withCtx: withCtx,
  11269. withDefaults: withDefaults,
  11270. withDirectives: withDirectives,
  11271. withKeys: withKeys,
  11272. withMemo: withMemo,
  11273. withModifiers: withModifiers,
  11274. withScopeId: withScopeId
  11275. });
  11276. function initDev() {
  11277. {
  11278. {
  11279. console.info(
  11280. `You are running a development build of Vue.
  11281. Make sure to use the production build (*.prod.js) when deploying for production.`
  11282. );
  11283. }
  11284. initCustomFormatter();
  11285. }
  11286. }
  11287. const FRAGMENT = Symbol(`Fragment` );
  11288. const TELEPORT = Symbol(`Teleport` );
  11289. const SUSPENSE = Symbol(`Suspense` );
  11290. const KEEP_ALIVE = Symbol(`KeepAlive` );
  11291. const BASE_TRANSITION = Symbol(`BaseTransition` );
  11292. const OPEN_BLOCK = Symbol(`openBlock` );
  11293. const CREATE_BLOCK = Symbol(`createBlock` );
  11294. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
  11295. const CREATE_VNODE = Symbol(`createVNode` );
  11296. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
  11297. const CREATE_COMMENT = Symbol(`createCommentVNode` );
  11298. const CREATE_TEXT = Symbol(`createTextVNode` );
  11299. const CREATE_STATIC = Symbol(`createStaticVNode` );
  11300. const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
  11301. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  11302. `resolveDynamicComponent`
  11303. );
  11304. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
  11305. const RESOLVE_FILTER = Symbol(`resolveFilter` );
  11306. const WITH_DIRECTIVES = Symbol(`withDirectives` );
  11307. const RENDER_LIST = Symbol(`renderList` );
  11308. const RENDER_SLOT = Symbol(`renderSlot` );
  11309. const CREATE_SLOTS = Symbol(`createSlots` );
  11310. const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
  11311. const MERGE_PROPS = Symbol(`mergeProps` );
  11312. const NORMALIZE_CLASS = Symbol(`normalizeClass` );
  11313. const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
  11314. const NORMALIZE_PROPS = Symbol(`normalizeProps` );
  11315. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
  11316. const TO_HANDLERS = Symbol(`toHandlers` );
  11317. const CAMELIZE = Symbol(`camelize` );
  11318. const CAPITALIZE = Symbol(`capitalize` );
  11319. const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
  11320. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
  11321. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  11322. const POP_SCOPE_ID = Symbol(`popScopeId` );
  11323. const WITH_CTX = Symbol(`withCtx` );
  11324. const UNREF = Symbol(`unref` );
  11325. const IS_REF = Symbol(`isRef` );
  11326. const WITH_MEMO = Symbol(`withMemo` );
  11327. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  11328. const helperNameMap = {
  11329. [FRAGMENT]: `Fragment`,
  11330. [TELEPORT]: `Teleport`,
  11331. [SUSPENSE]: `Suspense`,
  11332. [KEEP_ALIVE]: `KeepAlive`,
  11333. [BASE_TRANSITION]: `BaseTransition`,
  11334. [OPEN_BLOCK]: `openBlock`,
  11335. [CREATE_BLOCK]: `createBlock`,
  11336. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  11337. [CREATE_VNODE]: `createVNode`,
  11338. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  11339. [CREATE_COMMENT]: `createCommentVNode`,
  11340. [CREATE_TEXT]: `createTextVNode`,
  11341. [CREATE_STATIC]: `createStaticVNode`,
  11342. [RESOLVE_COMPONENT]: `resolveComponent`,
  11343. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  11344. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  11345. [RESOLVE_FILTER]: `resolveFilter`,
  11346. [WITH_DIRECTIVES]: `withDirectives`,
  11347. [RENDER_LIST]: `renderList`,
  11348. [RENDER_SLOT]: `renderSlot`,
  11349. [CREATE_SLOTS]: `createSlots`,
  11350. [TO_DISPLAY_STRING]: `toDisplayString`,
  11351. [MERGE_PROPS]: `mergeProps`,
  11352. [NORMALIZE_CLASS]: `normalizeClass`,
  11353. [NORMALIZE_STYLE]: `normalizeStyle`,
  11354. [NORMALIZE_PROPS]: `normalizeProps`,
  11355. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  11356. [TO_HANDLERS]: `toHandlers`,
  11357. [CAMELIZE]: `camelize`,
  11358. [CAPITALIZE]: `capitalize`,
  11359. [TO_HANDLER_KEY]: `toHandlerKey`,
  11360. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  11361. [PUSH_SCOPE_ID]: `pushScopeId`,
  11362. [POP_SCOPE_ID]: `popScopeId`,
  11363. [WITH_CTX]: `withCtx`,
  11364. [UNREF]: `unref`,
  11365. [IS_REF]: `isRef`,
  11366. [WITH_MEMO]: `withMemo`,
  11367. [IS_MEMO_SAME]: `isMemoSame`
  11368. };
  11369. function registerRuntimeHelpers(helpers) {
  11370. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  11371. helperNameMap[s] = helpers[s];
  11372. });
  11373. }
  11374. const locStub = {
  11375. start: { line: 1, column: 1, offset: 0 },
  11376. end: { line: 1, column: 1, offset: 0 },
  11377. source: ""
  11378. };
  11379. function createRoot(children, source = "") {
  11380. return {
  11381. type: 0,
  11382. source,
  11383. children,
  11384. helpers: /* @__PURE__ */ new Set(),
  11385. components: [],
  11386. directives: [],
  11387. hoists: [],
  11388. imports: [],
  11389. cached: 0,
  11390. temps: 0,
  11391. codegenNode: void 0,
  11392. loc: locStub
  11393. };
  11394. }
  11395. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  11396. if (context) {
  11397. if (isBlock) {
  11398. context.helper(OPEN_BLOCK);
  11399. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  11400. } else {
  11401. context.helper(getVNodeHelper(context.inSSR, isComponent));
  11402. }
  11403. if (directives) {
  11404. context.helper(WITH_DIRECTIVES);
  11405. }
  11406. }
  11407. return {
  11408. type: 13,
  11409. tag,
  11410. props,
  11411. children,
  11412. patchFlag,
  11413. dynamicProps,
  11414. directives,
  11415. isBlock,
  11416. disableTracking,
  11417. isComponent,
  11418. loc
  11419. };
  11420. }
  11421. function createArrayExpression(elements, loc = locStub) {
  11422. return {
  11423. type: 17,
  11424. loc,
  11425. elements
  11426. };
  11427. }
  11428. function createObjectExpression(properties, loc = locStub) {
  11429. return {
  11430. type: 15,
  11431. loc,
  11432. properties
  11433. };
  11434. }
  11435. function createObjectProperty(key, value) {
  11436. return {
  11437. type: 16,
  11438. loc: locStub,
  11439. key: isString(key) ? createSimpleExpression(key, true) : key,
  11440. value
  11441. };
  11442. }
  11443. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  11444. return {
  11445. type: 4,
  11446. loc,
  11447. content,
  11448. isStatic,
  11449. constType: isStatic ? 3 : constType
  11450. };
  11451. }
  11452. function createCompoundExpression(children, loc = locStub) {
  11453. return {
  11454. type: 8,
  11455. loc,
  11456. children
  11457. };
  11458. }
  11459. function createCallExpression(callee, args = [], loc = locStub) {
  11460. return {
  11461. type: 14,
  11462. loc,
  11463. callee,
  11464. arguments: args
  11465. };
  11466. }
  11467. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  11468. return {
  11469. type: 18,
  11470. params,
  11471. returns,
  11472. newline,
  11473. isSlot,
  11474. loc
  11475. };
  11476. }
  11477. function createConditionalExpression(test, consequent, alternate, newline = true) {
  11478. return {
  11479. type: 19,
  11480. test,
  11481. consequent,
  11482. alternate,
  11483. newline,
  11484. loc: locStub
  11485. };
  11486. }
  11487. function createCacheExpression(index, value, isVNode = false) {
  11488. return {
  11489. type: 20,
  11490. index,
  11491. value,
  11492. isVNode,
  11493. loc: locStub
  11494. };
  11495. }
  11496. function createBlockStatement(body) {
  11497. return {
  11498. type: 21,
  11499. body,
  11500. loc: locStub
  11501. };
  11502. }
  11503. function getVNodeHelper(ssr, isComponent) {
  11504. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  11505. }
  11506. function getVNodeBlockHelper(ssr, isComponent) {
  11507. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  11508. }
  11509. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  11510. if (!node.isBlock) {
  11511. node.isBlock = true;
  11512. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  11513. helper(OPEN_BLOCK);
  11514. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  11515. }
  11516. }
  11517. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  11518. const defaultDelimitersClose = new Uint8Array([125, 125]);
  11519. function isTagStartChar(c) {
  11520. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  11521. }
  11522. function isWhitespace(c) {
  11523. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  11524. }
  11525. function isEndOfTagSection(c) {
  11526. return c === 47 || c === 62 || isWhitespace(c);
  11527. }
  11528. function toCharCodes(str) {
  11529. const ret = new Uint8Array(str.length);
  11530. for (let i = 0; i < str.length; i++) {
  11531. ret[i] = str.charCodeAt(i);
  11532. }
  11533. return ret;
  11534. }
  11535. const Sequences = {
  11536. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  11537. // CDATA[
  11538. CdataEnd: new Uint8Array([93, 93, 62]),
  11539. // ]]>
  11540. CommentEnd: new Uint8Array([45, 45, 62]),
  11541. // `-->`
  11542. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  11543. // `<\/script`
  11544. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  11545. // `</style`
  11546. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  11547. // `</title`
  11548. TextareaEnd: new Uint8Array([
  11549. 60,
  11550. 47,
  11551. 116,
  11552. 101,
  11553. 120,
  11554. 116,
  11555. 97,
  11556. 114,
  11557. 101,
  11558. 97
  11559. ])
  11560. // `</textarea
  11561. };
  11562. class Tokenizer {
  11563. constructor(stack, cbs) {
  11564. this.stack = stack;
  11565. this.cbs = cbs;
  11566. /** The current state the tokenizer is in. */
  11567. this.state = 1;
  11568. /** The read buffer. */
  11569. this.buffer = "";
  11570. /** The beginning of the section that is currently being read. */
  11571. this.sectionStart = 0;
  11572. /** The index within the buffer that we are currently looking at. */
  11573. this.index = 0;
  11574. /** The start of the last entity. */
  11575. this.entityStart = 0;
  11576. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  11577. this.baseState = 1;
  11578. /** For special parsing behavior inside of script and style tags. */
  11579. this.inRCDATA = false;
  11580. /** For disabling RCDATA tags handling */
  11581. this.inXML = false;
  11582. /** For disabling interpolation parsing in v-pre */
  11583. this.inVPre = false;
  11584. /** Record newline positions for fast line / column calculation */
  11585. this.newlines = [];
  11586. this.mode = 0;
  11587. this.delimiterOpen = defaultDelimitersOpen;
  11588. this.delimiterClose = defaultDelimitersClose;
  11589. this.delimiterIndex = -1;
  11590. this.currentSequence = void 0;
  11591. this.sequenceIndex = 0;
  11592. }
  11593. get inSFCRoot() {
  11594. return this.mode === 2 && this.stack.length === 0;
  11595. }
  11596. reset() {
  11597. this.state = 1;
  11598. this.mode = 0;
  11599. this.buffer = "";
  11600. this.sectionStart = 0;
  11601. this.index = 0;
  11602. this.baseState = 1;
  11603. this.inRCDATA = false;
  11604. this.currentSequence = void 0;
  11605. this.newlines.length = 0;
  11606. this.delimiterOpen = defaultDelimitersOpen;
  11607. this.delimiterClose = defaultDelimitersClose;
  11608. }
  11609. /**
  11610. * Generate Position object with line / column information using recorded
  11611. * newline positions. We know the index is always going to be an already
  11612. * processed index, so all the newlines up to this index should have been
  11613. * recorded.
  11614. */
  11615. getPos(index) {
  11616. let line = 1;
  11617. let column = index + 1;
  11618. for (let i = this.newlines.length - 1; i >= 0; i--) {
  11619. const newlineIndex = this.newlines[i];
  11620. if (index > newlineIndex) {
  11621. line = i + 2;
  11622. column = index - newlineIndex;
  11623. break;
  11624. }
  11625. }
  11626. return {
  11627. column,
  11628. line,
  11629. offset: index
  11630. };
  11631. }
  11632. peek() {
  11633. return this.buffer.charCodeAt(this.index + 1);
  11634. }
  11635. stateText(c) {
  11636. if (c === 60) {
  11637. if (this.index > this.sectionStart) {
  11638. this.cbs.ontext(this.sectionStart, this.index);
  11639. }
  11640. this.state = 5;
  11641. this.sectionStart = this.index;
  11642. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  11643. this.state = 2;
  11644. this.delimiterIndex = 0;
  11645. this.stateInterpolationOpen(c);
  11646. }
  11647. }
  11648. stateInterpolationOpen(c) {
  11649. if (c === this.delimiterOpen[this.delimiterIndex]) {
  11650. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  11651. const start = this.index + 1 - this.delimiterOpen.length;
  11652. if (start > this.sectionStart) {
  11653. this.cbs.ontext(this.sectionStart, start);
  11654. }
  11655. this.state = 3;
  11656. this.sectionStart = start;
  11657. } else {
  11658. this.delimiterIndex++;
  11659. }
  11660. } else if (this.inRCDATA) {
  11661. this.state = 32;
  11662. this.stateInRCDATA(c);
  11663. } else {
  11664. this.state = 1;
  11665. this.stateText(c);
  11666. }
  11667. }
  11668. stateInterpolation(c) {
  11669. if (c === this.delimiterClose[0]) {
  11670. this.state = 4;
  11671. this.delimiterIndex = 0;
  11672. this.stateInterpolationClose(c);
  11673. }
  11674. }
  11675. stateInterpolationClose(c) {
  11676. if (c === this.delimiterClose[this.delimiterIndex]) {
  11677. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  11678. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  11679. if (this.inRCDATA) {
  11680. this.state = 32;
  11681. } else {
  11682. this.state = 1;
  11683. }
  11684. this.sectionStart = this.index + 1;
  11685. } else {
  11686. this.delimiterIndex++;
  11687. }
  11688. } else {
  11689. this.state = 3;
  11690. this.stateInterpolation(c);
  11691. }
  11692. }
  11693. stateSpecialStartSequence(c) {
  11694. const isEnd = this.sequenceIndex === this.currentSequence.length;
  11695. const isMatch = isEnd ? (
  11696. // If we are at the end of the sequence, make sure the tag name has ended
  11697. isEndOfTagSection(c)
  11698. ) : (
  11699. // Otherwise, do a case-insensitive comparison
  11700. (c | 32) === this.currentSequence[this.sequenceIndex]
  11701. );
  11702. if (!isMatch) {
  11703. this.inRCDATA = false;
  11704. } else if (!isEnd) {
  11705. this.sequenceIndex++;
  11706. return;
  11707. }
  11708. this.sequenceIndex = 0;
  11709. this.state = 6;
  11710. this.stateInTagName(c);
  11711. }
  11712. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  11713. stateInRCDATA(c) {
  11714. if (this.sequenceIndex === this.currentSequence.length) {
  11715. if (c === 62 || isWhitespace(c)) {
  11716. const endOfText = this.index - this.currentSequence.length;
  11717. if (this.sectionStart < endOfText) {
  11718. const actualIndex = this.index;
  11719. this.index = endOfText;
  11720. this.cbs.ontext(this.sectionStart, endOfText);
  11721. this.index = actualIndex;
  11722. }
  11723. this.sectionStart = endOfText + 2;
  11724. this.stateInClosingTagName(c);
  11725. this.inRCDATA = false;
  11726. return;
  11727. }
  11728. this.sequenceIndex = 0;
  11729. }
  11730. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  11731. this.sequenceIndex += 1;
  11732. } else if (this.sequenceIndex === 0) {
  11733. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  11734. if (c === this.delimiterOpen[0]) {
  11735. this.state = 2;
  11736. this.delimiterIndex = 0;
  11737. this.stateInterpolationOpen(c);
  11738. }
  11739. } else if (this.fastForwardTo(60)) {
  11740. this.sequenceIndex = 1;
  11741. }
  11742. } else {
  11743. this.sequenceIndex = Number(c === 60);
  11744. }
  11745. }
  11746. stateCDATASequence(c) {
  11747. if (c === Sequences.Cdata[this.sequenceIndex]) {
  11748. if (++this.sequenceIndex === Sequences.Cdata.length) {
  11749. this.state = 28;
  11750. this.currentSequence = Sequences.CdataEnd;
  11751. this.sequenceIndex = 0;
  11752. this.sectionStart = this.index + 1;
  11753. }
  11754. } else {
  11755. this.sequenceIndex = 0;
  11756. this.state = 23;
  11757. this.stateInDeclaration(c);
  11758. }
  11759. }
  11760. /**
  11761. * When we wait for one specific character, we can speed things up
  11762. * by skipping through the buffer until we find it.
  11763. *
  11764. * @returns Whether the character was found.
  11765. */
  11766. fastForwardTo(c) {
  11767. while (++this.index < this.buffer.length) {
  11768. const cc = this.buffer.charCodeAt(this.index);
  11769. if (cc === 10) {
  11770. this.newlines.push(this.index);
  11771. }
  11772. if (cc === c) {
  11773. return true;
  11774. }
  11775. }
  11776. this.index = this.buffer.length - 1;
  11777. return false;
  11778. }
  11779. /**
  11780. * Comments and CDATA end with `-->` and `]]>`.
  11781. *
  11782. * Their common qualities are:
  11783. * - Their end sequences have a distinct character they start with.
  11784. * - That character is then repeated, so we have to check multiple repeats.
  11785. * - All characters but the start character of the sequence can be skipped.
  11786. */
  11787. stateInCommentLike(c) {
  11788. if (c === this.currentSequence[this.sequenceIndex]) {
  11789. if (++this.sequenceIndex === this.currentSequence.length) {
  11790. if (this.currentSequence === Sequences.CdataEnd) {
  11791. this.cbs.oncdata(this.sectionStart, this.index - 2);
  11792. } else {
  11793. this.cbs.oncomment(this.sectionStart, this.index - 2);
  11794. }
  11795. this.sequenceIndex = 0;
  11796. this.sectionStart = this.index + 1;
  11797. this.state = 1;
  11798. }
  11799. } else if (this.sequenceIndex === 0) {
  11800. if (this.fastForwardTo(this.currentSequence[0])) {
  11801. this.sequenceIndex = 1;
  11802. }
  11803. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  11804. this.sequenceIndex = 0;
  11805. }
  11806. }
  11807. startSpecial(sequence, offset) {
  11808. this.enterRCDATA(sequence, offset);
  11809. this.state = 31;
  11810. }
  11811. enterRCDATA(sequence, offset) {
  11812. this.inRCDATA = true;
  11813. this.currentSequence = sequence;
  11814. this.sequenceIndex = offset;
  11815. }
  11816. stateBeforeTagName(c) {
  11817. if (c === 33) {
  11818. this.state = 22;
  11819. this.sectionStart = this.index + 1;
  11820. } else if (c === 63) {
  11821. this.state = 24;
  11822. this.sectionStart = this.index + 1;
  11823. } else if (isTagStartChar(c)) {
  11824. this.sectionStart = this.index;
  11825. if (this.mode === 0) {
  11826. this.state = 6;
  11827. } else if (this.inSFCRoot) {
  11828. this.state = 34;
  11829. } else if (!this.inXML) {
  11830. if (c === 116) {
  11831. this.state = 30;
  11832. } else {
  11833. this.state = c === 115 ? 29 : 6;
  11834. }
  11835. } else {
  11836. this.state = 6;
  11837. }
  11838. } else if (c === 47) {
  11839. this.state = 8;
  11840. } else {
  11841. this.state = 1;
  11842. this.stateText(c);
  11843. }
  11844. }
  11845. stateInTagName(c) {
  11846. if (isEndOfTagSection(c)) {
  11847. this.handleTagName(c);
  11848. }
  11849. }
  11850. stateInSFCRootTagName(c) {
  11851. if (isEndOfTagSection(c)) {
  11852. const tag = this.buffer.slice(this.sectionStart, this.index);
  11853. if (tag !== "template") {
  11854. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  11855. }
  11856. this.handleTagName(c);
  11857. }
  11858. }
  11859. handleTagName(c) {
  11860. this.cbs.onopentagname(this.sectionStart, this.index);
  11861. this.sectionStart = -1;
  11862. this.state = 11;
  11863. this.stateBeforeAttrName(c);
  11864. }
  11865. stateBeforeClosingTagName(c) {
  11866. if (isWhitespace(c)) ; else if (c === 62) {
  11867. {
  11868. this.cbs.onerr(14, this.index);
  11869. }
  11870. this.state = 1;
  11871. this.sectionStart = this.index + 1;
  11872. } else {
  11873. this.state = isTagStartChar(c) ? 9 : 27;
  11874. this.sectionStart = this.index;
  11875. }
  11876. }
  11877. stateInClosingTagName(c) {
  11878. if (c === 62 || isWhitespace(c)) {
  11879. this.cbs.onclosetag(this.sectionStart, this.index);
  11880. this.sectionStart = -1;
  11881. this.state = 10;
  11882. this.stateAfterClosingTagName(c);
  11883. }
  11884. }
  11885. stateAfterClosingTagName(c) {
  11886. if (c === 62) {
  11887. this.state = 1;
  11888. this.sectionStart = this.index + 1;
  11889. }
  11890. }
  11891. stateBeforeAttrName(c) {
  11892. if (c === 62) {
  11893. this.cbs.onopentagend(this.index);
  11894. if (this.inRCDATA) {
  11895. this.state = 32;
  11896. } else {
  11897. this.state = 1;
  11898. }
  11899. this.sectionStart = this.index + 1;
  11900. } else if (c === 47) {
  11901. this.state = 7;
  11902. if (this.peek() !== 62) {
  11903. this.cbs.onerr(22, this.index);
  11904. }
  11905. } else if (c === 60 && this.peek() === 47) {
  11906. this.cbs.onopentagend(this.index);
  11907. this.state = 5;
  11908. this.sectionStart = this.index;
  11909. } else if (!isWhitespace(c)) {
  11910. if (c === 61) {
  11911. this.cbs.onerr(
  11912. 19,
  11913. this.index
  11914. );
  11915. }
  11916. this.handleAttrStart(c);
  11917. }
  11918. }
  11919. handleAttrStart(c) {
  11920. if (c === 118 && this.peek() === 45) {
  11921. this.state = 13;
  11922. this.sectionStart = this.index;
  11923. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  11924. this.cbs.ondirname(this.index, this.index + 1);
  11925. this.state = 14;
  11926. this.sectionStart = this.index + 1;
  11927. } else {
  11928. this.state = 12;
  11929. this.sectionStart = this.index;
  11930. }
  11931. }
  11932. stateInSelfClosingTag(c) {
  11933. if (c === 62) {
  11934. this.cbs.onselfclosingtag(this.index);
  11935. this.state = 1;
  11936. this.sectionStart = this.index + 1;
  11937. this.inRCDATA = false;
  11938. } else if (!isWhitespace(c)) {
  11939. this.state = 11;
  11940. this.stateBeforeAttrName(c);
  11941. }
  11942. }
  11943. stateInAttrName(c) {
  11944. if (c === 61 || isEndOfTagSection(c)) {
  11945. this.cbs.onattribname(this.sectionStart, this.index);
  11946. this.handleAttrNameEnd(c);
  11947. } else if (c === 34 || c === 39 || c === 60) {
  11948. this.cbs.onerr(
  11949. 17,
  11950. this.index
  11951. );
  11952. }
  11953. }
  11954. stateInDirName(c) {
  11955. if (c === 61 || isEndOfTagSection(c)) {
  11956. this.cbs.ondirname(this.sectionStart, this.index);
  11957. this.handleAttrNameEnd(c);
  11958. } else if (c === 58) {
  11959. this.cbs.ondirname(this.sectionStart, this.index);
  11960. this.state = 14;
  11961. this.sectionStart = this.index + 1;
  11962. } else if (c === 46) {
  11963. this.cbs.ondirname(this.sectionStart, this.index);
  11964. this.state = 16;
  11965. this.sectionStart = this.index + 1;
  11966. }
  11967. }
  11968. stateInDirArg(c) {
  11969. if (c === 61 || isEndOfTagSection(c)) {
  11970. this.cbs.ondirarg(this.sectionStart, this.index);
  11971. this.handleAttrNameEnd(c);
  11972. } else if (c === 91) {
  11973. this.state = 15;
  11974. } else if (c === 46) {
  11975. this.cbs.ondirarg(this.sectionStart, this.index);
  11976. this.state = 16;
  11977. this.sectionStart = this.index + 1;
  11978. }
  11979. }
  11980. stateInDynamicDirArg(c) {
  11981. if (c === 93) {
  11982. this.state = 14;
  11983. } else if (c === 61 || isEndOfTagSection(c)) {
  11984. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  11985. this.handleAttrNameEnd(c);
  11986. {
  11987. this.cbs.onerr(
  11988. 27,
  11989. this.index
  11990. );
  11991. }
  11992. }
  11993. }
  11994. stateInDirModifier(c) {
  11995. if (c === 61 || isEndOfTagSection(c)) {
  11996. this.cbs.ondirmodifier(this.sectionStart, this.index);
  11997. this.handleAttrNameEnd(c);
  11998. } else if (c === 46) {
  11999. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12000. this.sectionStart = this.index + 1;
  12001. }
  12002. }
  12003. handleAttrNameEnd(c) {
  12004. this.sectionStart = this.index;
  12005. this.state = 17;
  12006. this.cbs.onattribnameend(this.index);
  12007. this.stateAfterAttrName(c);
  12008. }
  12009. stateAfterAttrName(c) {
  12010. if (c === 61) {
  12011. this.state = 18;
  12012. } else if (c === 47 || c === 62) {
  12013. this.cbs.onattribend(0, this.sectionStart);
  12014. this.sectionStart = -1;
  12015. this.state = 11;
  12016. this.stateBeforeAttrName(c);
  12017. } else if (!isWhitespace(c)) {
  12018. this.cbs.onattribend(0, this.sectionStart);
  12019. this.handleAttrStart(c);
  12020. }
  12021. }
  12022. stateBeforeAttrValue(c) {
  12023. if (c === 34) {
  12024. this.state = 19;
  12025. this.sectionStart = this.index + 1;
  12026. } else if (c === 39) {
  12027. this.state = 20;
  12028. this.sectionStart = this.index + 1;
  12029. } else if (!isWhitespace(c)) {
  12030. this.sectionStart = this.index;
  12031. this.state = 21;
  12032. this.stateInAttrValueNoQuotes(c);
  12033. }
  12034. }
  12035. handleInAttrValue(c, quote) {
  12036. if (c === quote || this.fastForwardTo(quote)) {
  12037. this.cbs.onattribdata(this.sectionStart, this.index);
  12038. this.sectionStart = -1;
  12039. this.cbs.onattribend(
  12040. quote === 34 ? 3 : 2,
  12041. this.index + 1
  12042. );
  12043. this.state = 11;
  12044. }
  12045. }
  12046. stateInAttrValueDoubleQuotes(c) {
  12047. this.handleInAttrValue(c, 34);
  12048. }
  12049. stateInAttrValueSingleQuotes(c) {
  12050. this.handleInAttrValue(c, 39);
  12051. }
  12052. stateInAttrValueNoQuotes(c) {
  12053. if (isWhitespace(c) || c === 62) {
  12054. this.cbs.onattribdata(this.sectionStart, this.index);
  12055. this.sectionStart = -1;
  12056. this.cbs.onattribend(1, this.index);
  12057. this.state = 11;
  12058. this.stateBeforeAttrName(c);
  12059. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  12060. this.cbs.onerr(
  12061. 18,
  12062. this.index
  12063. );
  12064. } else ;
  12065. }
  12066. stateBeforeDeclaration(c) {
  12067. if (c === 91) {
  12068. this.state = 26;
  12069. this.sequenceIndex = 0;
  12070. } else {
  12071. this.state = c === 45 ? 25 : 23;
  12072. }
  12073. }
  12074. stateInDeclaration(c) {
  12075. if (c === 62 || this.fastForwardTo(62)) {
  12076. this.state = 1;
  12077. this.sectionStart = this.index + 1;
  12078. }
  12079. }
  12080. stateInProcessingInstruction(c) {
  12081. if (c === 62 || this.fastForwardTo(62)) {
  12082. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  12083. this.state = 1;
  12084. this.sectionStart = this.index + 1;
  12085. }
  12086. }
  12087. stateBeforeComment(c) {
  12088. if (c === 45) {
  12089. this.state = 28;
  12090. this.currentSequence = Sequences.CommentEnd;
  12091. this.sequenceIndex = 2;
  12092. this.sectionStart = this.index + 1;
  12093. } else {
  12094. this.state = 23;
  12095. }
  12096. }
  12097. stateInSpecialComment(c) {
  12098. if (c === 62 || this.fastForwardTo(62)) {
  12099. this.cbs.oncomment(this.sectionStart, this.index);
  12100. this.state = 1;
  12101. this.sectionStart = this.index + 1;
  12102. }
  12103. }
  12104. stateBeforeSpecialS(c) {
  12105. if (c === Sequences.ScriptEnd[3]) {
  12106. this.startSpecial(Sequences.ScriptEnd, 4);
  12107. } else if (c === Sequences.StyleEnd[3]) {
  12108. this.startSpecial(Sequences.StyleEnd, 4);
  12109. } else {
  12110. this.state = 6;
  12111. this.stateInTagName(c);
  12112. }
  12113. }
  12114. stateBeforeSpecialT(c) {
  12115. if (c === Sequences.TitleEnd[3]) {
  12116. this.startSpecial(Sequences.TitleEnd, 4);
  12117. } else if (c === Sequences.TextareaEnd[3]) {
  12118. this.startSpecial(Sequences.TextareaEnd, 4);
  12119. } else {
  12120. this.state = 6;
  12121. this.stateInTagName(c);
  12122. }
  12123. }
  12124. startEntity() {
  12125. }
  12126. stateInEntity() {
  12127. }
  12128. /**
  12129. * Iterates through the buffer, calling the function corresponding to the current state.
  12130. *
  12131. * States that are more likely to be hit are higher up, as a performance improvement.
  12132. */
  12133. parse(input) {
  12134. this.buffer = input;
  12135. while (this.index < this.buffer.length) {
  12136. const c = this.buffer.charCodeAt(this.index);
  12137. if (c === 10) {
  12138. this.newlines.push(this.index);
  12139. }
  12140. switch (this.state) {
  12141. case 1: {
  12142. this.stateText(c);
  12143. break;
  12144. }
  12145. case 2: {
  12146. this.stateInterpolationOpen(c);
  12147. break;
  12148. }
  12149. case 3: {
  12150. this.stateInterpolation(c);
  12151. break;
  12152. }
  12153. case 4: {
  12154. this.stateInterpolationClose(c);
  12155. break;
  12156. }
  12157. case 31: {
  12158. this.stateSpecialStartSequence(c);
  12159. break;
  12160. }
  12161. case 32: {
  12162. this.stateInRCDATA(c);
  12163. break;
  12164. }
  12165. case 26: {
  12166. this.stateCDATASequence(c);
  12167. break;
  12168. }
  12169. case 19: {
  12170. this.stateInAttrValueDoubleQuotes(c);
  12171. break;
  12172. }
  12173. case 12: {
  12174. this.stateInAttrName(c);
  12175. break;
  12176. }
  12177. case 13: {
  12178. this.stateInDirName(c);
  12179. break;
  12180. }
  12181. case 14: {
  12182. this.stateInDirArg(c);
  12183. break;
  12184. }
  12185. case 15: {
  12186. this.stateInDynamicDirArg(c);
  12187. break;
  12188. }
  12189. case 16: {
  12190. this.stateInDirModifier(c);
  12191. break;
  12192. }
  12193. case 28: {
  12194. this.stateInCommentLike(c);
  12195. break;
  12196. }
  12197. case 27: {
  12198. this.stateInSpecialComment(c);
  12199. break;
  12200. }
  12201. case 11: {
  12202. this.stateBeforeAttrName(c);
  12203. break;
  12204. }
  12205. case 6: {
  12206. this.stateInTagName(c);
  12207. break;
  12208. }
  12209. case 34: {
  12210. this.stateInSFCRootTagName(c);
  12211. break;
  12212. }
  12213. case 9: {
  12214. this.stateInClosingTagName(c);
  12215. break;
  12216. }
  12217. case 5: {
  12218. this.stateBeforeTagName(c);
  12219. break;
  12220. }
  12221. case 17: {
  12222. this.stateAfterAttrName(c);
  12223. break;
  12224. }
  12225. case 20: {
  12226. this.stateInAttrValueSingleQuotes(c);
  12227. break;
  12228. }
  12229. case 18: {
  12230. this.stateBeforeAttrValue(c);
  12231. break;
  12232. }
  12233. case 8: {
  12234. this.stateBeforeClosingTagName(c);
  12235. break;
  12236. }
  12237. case 10: {
  12238. this.stateAfterClosingTagName(c);
  12239. break;
  12240. }
  12241. case 29: {
  12242. this.stateBeforeSpecialS(c);
  12243. break;
  12244. }
  12245. case 30: {
  12246. this.stateBeforeSpecialT(c);
  12247. break;
  12248. }
  12249. case 21: {
  12250. this.stateInAttrValueNoQuotes(c);
  12251. break;
  12252. }
  12253. case 7: {
  12254. this.stateInSelfClosingTag(c);
  12255. break;
  12256. }
  12257. case 23: {
  12258. this.stateInDeclaration(c);
  12259. break;
  12260. }
  12261. case 22: {
  12262. this.stateBeforeDeclaration(c);
  12263. break;
  12264. }
  12265. case 25: {
  12266. this.stateBeforeComment(c);
  12267. break;
  12268. }
  12269. case 24: {
  12270. this.stateInProcessingInstruction(c);
  12271. break;
  12272. }
  12273. case 33: {
  12274. this.stateInEntity();
  12275. break;
  12276. }
  12277. }
  12278. this.index++;
  12279. }
  12280. this.cleanup();
  12281. this.finish();
  12282. }
  12283. /**
  12284. * Remove data that has already been consumed from the buffer.
  12285. */
  12286. cleanup() {
  12287. if (this.sectionStart !== this.index) {
  12288. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  12289. this.cbs.ontext(this.sectionStart, this.index);
  12290. this.sectionStart = this.index;
  12291. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  12292. this.cbs.onattribdata(this.sectionStart, this.index);
  12293. this.sectionStart = this.index;
  12294. }
  12295. }
  12296. }
  12297. finish() {
  12298. this.handleTrailingData();
  12299. this.cbs.onend();
  12300. }
  12301. /** Handle any trailing data. */
  12302. handleTrailingData() {
  12303. const endIndex = this.buffer.length;
  12304. if (this.sectionStart >= endIndex) {
  12305. return;
  12306. }
  12307. if (this.state === 28) {
  12308. if (this.currentSequence === Sequences.CdataEnd) {
  12309. this.cbs.oncdata(this.sectionStart, endIndex);
  12310. } else {
  12311. this.cbs.oncomment(this.sectionStart, endIndex);
  12312. }
  12313. } 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 {
  12314. this.cbs.ontext(this.sectionStart, endIndex);
  12315. }
  12316. }
  12317. emitCodePoint(cp, consumed) {
  12318. }
  12319. }
  12320. function defaultOnError(error) {
  12321. throw error;
  12322. }
  12323. function defaultOnWarn(msg) {
  12324. console.warn(`[Vue warn] ${msg.message}`);
  12325. }
  12326. function createCompilerError(code, loc, messages, additionalMessage) {
  12327. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  12328. const error = new SyntaxError(String(msg));
  12329. error.code = code;
  12330. error.loc = loc;
  12331. return error;
  12332. }
  12333. const errorMessages = {
  12334. // parse errors
  12335. [0]: "Illegal comment.",
  12336. [1]: "CDATA section is allowed only in XML context.",
  12337. [2]: "Duplicate attribute.",
  12338. [3]: "End tag cannot have attributes.",
  12339. [4]: "Illegal '/' in tags.",
  12340. [5]: "Unexpected EOF in tag.",
  12341. [6]: "Unexpected EOF in CDATA section.",
  12342. [7]: "Unexpected EOF in comment.",
  12343. [8]: "Unexpected EOF in script.",
  12344. [9]: "Unexpected EOF in tag.",
  12345. [10]: "Incorrectly closed comment.",
  12346. [11]: "Incorrectly opened comment.",
  12347. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  12348. [13]: "Attribute value was expected.",
  12349. [14]: "End tag name was expected.",
  12350. [15]: "Whitespace was expected.",
  12351. [16]: "Unexpected '<!--' in comment.",
  12352. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  12353. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  12354. [19]: "Attribute name cannot start with '='.",
  12355. [21]: "'<?' is allowed only in XML context.",
  12356. [20]: `Unexpected null character.`,
  12357. [22]: "Illegal '/' in tags.",
  12358. // Vue-specific parse errors
  12359. [23]: "Invalid end tag.",
  12360. [24]: "Element is missing end tag.",
  12361. [25]: "Interpolation end sign was not found.",
  12362. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  12363. [26]: "Legal directive name was expected.",
  12364. // transform errors
  12365. [28]: `v-if/v-else-if is missing expression.`,
  12366. [29]: `v-if/else branches must use unique keys.`,
  12367. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  12368. [31]: `v-for is missing expression.`,
  12369. [32]: `v-for has invalid expression.`,
  12370. [33]: `<template v-for> key should be placed on the <template> tag.`,
  12371. [34]: `v-bind is missing expression.`,
  12372. [52]: `v-bind with same-name shorthand only allows static argument.`,
  12373. [35]: `v-on is missing expression.`,
  12374. [36]: `Unexpected custom directive on <slot> outlet.`,
  12375. [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.`,
  12376. [38]: `Duplicate slot names found. `,
  12377. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  12378. [40]: `v-slot can only be used on components or <template> tags.`,
  12379. [41]: `v-model is missing expression.`,
  12380. [42]: `v-model value must be a valid JavaScript member expression.`,
  12381. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  12382. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  12383. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  12384. [45]: `Error parsing JavaScript expression: `,
  12385. [46]: `<KeepAlive> expects exactly one child component.`,
  12386. [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.`,
  12387. // generic errors
  12388. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  12389. [48]: `ES module mode is not supported in this build of compiler.`,
  12390. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  12391. [50]: `"scopeId" option is only supported in module mode.`,
  12392. // just to fulfill types
  12393. [53]: ``
  12394. };
  12395. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  12396. function isCoreComponent(tag) {
  12397. switch (tag) {
  12398. case "Teleport":
  12399. case "teleport":
  12400. return TELEPORT;
  12401. case "Suspense":
  12402. case "suspense":
  12403. return SUSPENSE;
  12404. case "KeepAlive":
  12405. case "keep-alive":
  12406. return KEEP_ALIVE;
  12407. case "BaseTransition":
  12408. case "base-transition":
  12409. return BASE_TRANSITION;
  12410. }
  12411. }
  12412. const nonIdentifierRE = /^\d|[^\$\w]/;
  12413. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  12414. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  12415. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  12416. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  12417. const isMemberExpressionBrowser = (path) => {
  12418. path = path.trim().replace(whitespaceRE, (s) => s.trim());
  12419. let state = 0 /* inMemberExp */;
  12420. let stateStack = [];
  12421. let currentOpenBracketCount = 0;
  12422. let currentOpenParensCount = 0;
  12423. let currentStringType = null;
  12424. for (let i = 0; i < path.length; i++) {
  12425. const char = path.charAt(i);
  12426. switch (state) {
  12427. case 0 /* inMemberExp */:
  12428. if (char === "[") {
  12429. stateStack.push(state);
  12430. state = 1 /* inBrackets */;
  12431. currentOpenBracketCount++;
  12432. } else if (char === "(") {
  12433. stateStack.push(state);
  12434. state = 2 /* inParens */;
  12435. currentOpenParensCount++;
  12436. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  12437. return false;
  12438. }
  12439. break;
  12440. case 1 /* inBrackets */:
  12441. if (char === `'` || char === `"` || char === "`") {
  12442. stateStack.push(state);
  12443. state = 3 /* inString */;
  12444. currentStringType = char;
  12445. } else if (char === `[`) {
  12446. currentOpenBracketCount++;
  12447. } else if (char === `]`) {
  12448. if (!--currentOpenBracketCount) {
  12449. state = stateStack.pop();
  12450. }
  12451. }
  12452. break;
  12453. case 2 /* inParens */:
  12454. if (char === `'` || char === `"` || char === "`") {
  12455. stateStack.push(state);
  12456. state = 3 /* inString */;
  12457. currentStringType = char;
  12458. } else if (char === `(`) {
  12459. currentOpenParensCount++;
  12460. } else if (char === `)`) {
  12461. if (i === path.length - 1) {
  12462. return false;
  12463. }
  12464. if (!--currentOpenParensCount) {
  12465. state = stateStack.pop();
  12466. }
  12467. }
  12468. break;
  12469. case 3 /* inString */:
  12470. if (char === currentStringType) {
  12471. state = stateStack.pop();
  12472. currentStringType = null;
  12473. }
  12474. break;
  12475. }
  12476. }
  12477. return !currentOpenBracketCount && !currentOpenParensCount;
  12478. };
  12479. const isMemberExpression = isMemberExpressionBrowser ;
  12480. function assert(condition, msg) {
  12481. if (!condition) {
  12482. throw new Error(msg || `unexpected compiler condition`);
  12483. }
  12484. }
  12485. function findDir(node, name, allowEmpty = false) {
  12486. for (let i = 0; i < node.props.length; i++) {
  12487. const p = node.props[i];
  12488. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  12489. return p;
  12490. }
  12491. }
  12492. }
  12493. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  12494. for (let i = 0; i < node.props.length; i++) {
  12495. const p = node.props[i];
  12496. if (p.type === 6) {
  12497. if (dynamicOnly)
  12498. continue;
  12499. if (p.name === name && (p.value || allowEmpty)) {
  12500. return p;
  12501. }
  12502. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  12503. return p;
  12504. }
  12505. }
  12506. }
  12507. function isStaticArgOf(arg, name) {
  12508. return !!(arg && isStaticExp(arg) && arg.content === name);
  12509. }
  12510. function hasDynamicKeyVBind(node) {
  12511. return node.props.some(
  12512. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  12513. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  12514. !p.arg.isStatic)
  12515. // v-bind:[foo]
  12516. );
  12517. }
  12518. function isText$1(node) {
  12519. return node.type === 5 || node.type === 2;
  12520. }
  12521. function isVSlot(p) {
  12522. return p.type === 7 && p.name === "slot";
  12523. }
  12524. function isTemplateNode(node) {
  12525. return node.type === 1 && node.tagType === 3;
  12526. }
  12527. function isSlotOutlet(node) {
  12528. return node.type === 1 && node.tagType === 2;
  12529. }
  12530. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  12531. function getUnnormalizedProps(props, callPath = []) {
  12532. if (props && !isString(props) && props.type === 14) {
  12533. const callee = props.callee;
  12534. if (!isString(callee) && propsHelperSet.has(callee)) {
  12535. return getUnnormalizedProps(
  12536. props.arguments[0],
  12537. callPath.concat(props)
  12538. );
  12539. }
  12540. }
  12541. return [props, callPath];
  12542. }
  12543. function injectProp(node, prop, context) {
  12544. let propsWithInjection;
  12545. let props = node.type === 13 ? node.props : node.arguments[2];
  12546. let callPath = [];
  12547. let parentCall;
  12548. if (props && !isString(props) && props.type === 14) {
  12549. const ret = getUnnormalizedProps(props);
  12550. props = ret[0];
  12551. callPath = ret[1];
  12552. parentCall = callPath[callPath.length - 1];
  12553. }
  12554. if (props == null || isString(props)) {
  12555. propsWithInjection = createObjectExpression([prop]);
  12556. } else if (props.type === 14) {
  12557. const first = props.arguments[0];
  12558. if (!isString(first) && first.type === 15) {
  12559. if (!hasProp(prop, first)) {
  12560. first.properties.unshift(prop);
  12561. }
  12562. } else {
  12563. if (props.callee === TO_HANDLERS) {
  12564. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12565. createObjectExpression([prop]),
  12566. props
  12567. ]);
  12568. } else {
  12569. props.arguments.unshift(createObjectExpression([prop]));
  12570. }
  12571. }
  12572. !propsWithInjection && (propsWithInjection = props);
  12573. } else if (props.type === 15) {
  12574. if (!hasProp(prop, props)) {
  12575. props.properties.unshift(prop);
  12576. }
  12577. propsWithInjection = props;
  12578. } else {
  12579. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12580. createObjectExpression([prop]),
  12581. props
  12582. ]);
  12583. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  12584. parentCall = callPath[callPath.length - 2];
  12585. }
  12586. }
  12587. if (node.type === 13) {
  12588. if (parentCall) {
  12589. parentCall.arguments[0] = propsWithInjection;
  12590. } else {
  12591. node.props = propsWithInjection;
  12592. }
  12593. } else {
  12594. if (parentCall) {
  12595. parentCall.arguments[0] = propsWithInjection;
  12596. } else {
  12597. node.arguments[2] = propsWithInjection;
  12598. }
  12599. }
  12600. }
  12601. function hasProp(prop, props) {
  12602. let result = false;
  12603. if (prop.key.type === 4) {
  12604. const propKeyName = prop.key.content;
  12605. result = props.properties.some(
  12606. (p) => p.key.type === 4 && p.key.content === propKeyName
  12607. );
  12608. }
  12609. return result;
  12610. }
  12611. function toValidAssetId(name, type) {
  12612. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  12613. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  12614. })}`;
  12615. }
  12616. function getMemoedVNodeCall(node) {
  12617. if (node.type === 14 && node.callee === WITH_MEMO) {
  12618. return node.arguments[1].returns;
  12619. } else {
  12620. return node;
  12621. }
  12622. }
  12623. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  12624. const defaultParserOptions = {
  12625. parseMode: "base",
  12626. ns: 0,
  12627. delimiters: [`{{`, `}}`],
  12628. getNamespace: () => 0,
  12629. isVoidTag: NO,
  12630. isPreTag: NO,
  12631. isCustomElement: NO,
  12632. onError: defaultOnError,
  12633. onWarn: defaultOnWarn,
  12634. comments: true,
  12635. prefixIdentifiers: false
  12636. };
  12637. let currentOptions = defaultParserOptions;
  12638. let currentRoot = null;
  12639. let currentInput = "";
  12640. let currentOpenTag = null;
  12641. let currentProp = null;
  12642. let currentAttrValue = "";
  12643. let currentAttrStartIndex = -1;
  12644. let currentAttrEndIndex = -1;
  12645. let inPre = 0;
  12646. let inVPre = false;
  12647. let currentVPreBoundary = null;
  12648. const stack = [];
  12649. const tokenizer = new Tokenizer(stack, {
  12650. onerr: emitError,
  12651. ontext(start, end) {
  12652. onText(getSlice(start, end), start, end);
  12653. },
  12654. ontextentity(char, start, end) {
  12655. onText(char, start, end);
  12656. },
  12657. oninterpolation(start, end) {
  12658. if (inVPre) {
  12659. return onText(getSlice(start, end), start, end);
  12660. }
  12661. let innerStart = start + tokenizer.delimiterOpen.length;
  12662. let innerEnd = end - tokenizer.delimiterClose.length;
  12663. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  12664. innerStart++;
  12665. }
  12666. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  12667. innerEnd--;
  12668. }
  12669. let exp = getSlice(innerStart, innerEnd);
  12670. if (exp.includes("&")) {
  12671. {
  12672. exp = currentOptions.decodeEntities(exp, false);
  12673. }
  12674. }
  12675. addNode({
  12676. type: 5,
  12677. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  12678. loc: getLoc(start, end)
  12679. });
  12680. },
  12681. onopentagname(start, end) {
  12682. const name = getSlice(start, end);
  12683. currentOpenTag = {
  12684. type: 1,
  12685. tag: name,
  12686. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  12687. tagType: 0,
  12688. // will be refined on tag close
  12689. props: [],
  12690. children: [],
  12691. loc: getLoc(start - 1, end),
  12692. codegenNode: void 0
  12693. };
  12694. },
  12695. onopentagend(end) {
  12696. endOpenTag(end);
  12697. },
  12698. onclosetag(start, end) {
  12699. const name = getSlice(start, end);
  12700. if (!currentOptions.isVoidTag(name)) {
  12701. let found = false;
  12702. for (let i = 0; i < stack.length; i++) {
  12703. const e = stack[i];
  12704. if (e.tag.toLowerCase() === name.toLowerCase()) {
  12705. found = true;
  12706. if (i > 0) {
  12707. emitError(24, stack[0].loc.start.offset);
  12708. }
  12709. for (let j = 0; j <= i; j++) {
  12710. const el = stack.shift();
  12711. onCloseTag(el, end, j < i);
  12712. }
  12713. break;
  12714. }
  12715. }
  12716. if (!found) {
  12717. emitError(23, backTrack(start, 60));
  12718. }
  12719. }
  12720. },
  12721. onselfclosingtag(end) {
  12722. var _a;
  12723. const name = currentOpenTag.tag;
  12724. currentOpenTag.isSelfClosing = true;
  12725. endOpenTag(end);
  12726. if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
  12727. onCloseTag(stack.shift(), end);
  12728. }
  12729. },
  12730. onattribname(start, end) {
  12731. currentProp = {
  12732. type: 6,
  12733. name: getSlice(start, end),
  12734. nameLoc: getLoc(start, end),
  12735. value: void 0,
  12736. loc: getLoc(start)
  12737. };
  12738. },
  12739. ondirname(start, end) {
  12740. const raw = getSlice(start, end);
  12741. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  12742. if (!inVPre && name === "") {
  12743. emitError(26, start);
  12744. }
  12745. if (inVPre || name === "") {
  12746. currentProp = {
  12747. type: 6,
  12748. name: raw,
  12749. nameLoc: getLoc(start, end),
  12750. value: void 0,
  12751. loc: getLoc(start)
  12752. };
  12753. } else {
  12754. currentProp = {
  12755. type: 7,
  12756. name,
  12757. rawName: raw,
  12758. exp: void 0,
  12759. arg: void 0,
  12760. modifiers: raw === "." ? ["prop"] : [],
  12761. loc: getLoc(start)
  12762. };
  12763. if (name === "pre") {
  12764. inVPre = tokenizer.inVPre = true;
  12765. currentVPreBoundary = currentOpenTag;
  12766. const props = currentOpenTag.props;
  12767. for (let i = 0; i < props.length; i++) {
  12768. if (props[i].type === 7) {
  12769. props[i] = dirToAttr(props[i]);
  12770. }
  12771. }
  12772. }
  12773. }
  12774. },
  12775. ondirarg(start, end) {
  12776. if (start === end)
  12777. return;
  12778. const arg = getSlice(start, end);
  12779. if (inVPre) {
  12780. currentProp.name += arg;
  12781. setLocEnd(currentProp.nameLoc, end);
  12782. } else {
  12783. const isStatic = arg[0] !== `[`;
  12784. currentProp.arg = createExp(
  12785. isStatic ? arg : arg.slice(1, -1),
  12786. isStatic,
  12787. getLoc(start, end),
  12788. isStatic ? 3 : 0
  12789. );
  12790. }
  12791. },
  12792. ondirmodifier(start, end) {
  12793. const mod = getSlice(start, end);
  12794. if (inVPre) {
  12795. currentProp.name += "." + mod;
  12796. setLocEnd(currentProp.nameLoc, end);
  12797. } else if (currentProp.name === "slot") {
  12798. const arg = currentProp.arg;
  12799. if (arg) {
  12800. arg.content += "." + mod;
  12801. setLocEnd(arg.loc, end);
  12802. }
  12803. } else {
  12804. currentProp.modifiers.push(mod);
  12805. }
  12806. },
  12807. onattribdata(start, end) {
  12808. currentAttrValue += getSlice(start, end);
  12809. if (currentAttrStartIndex < 0)
  12810. currentAttrStartIndex = start;
  12811. currentAttrEndIndex = end;
  12812. },
  12813. onattribentity(char, start, end) {
  12814. currentAttrValue += char;
  12815. if (currentAttrStartIndex < 0)
  12816. currentAttrStartIndex = start;
  12817. currentAttrEndIndex = end;
  12818. },
  12819. onattribnameend(end) {
  12820. const start = currentProp.loc.start.offset;
  12821. const name = getSlice(start, end);
  12822. if (currentProp.type === 7) {
  12823. currentProp.rawName = name;
  12824. }
  12825. if (currentOpenTag.props.some(
  12826. (p) => (p.type === 7 ? p.rawName : p.name) === name
  12827. )) {
  12828. emitError(2, start);
  12829. }
  12830. },
  12831. onattribend(quote, end) {
  12832. if (currentOpenTag && currentProp) {
  12833. setLocEnd(currentProp.loc, end);
  12834. if (quote !== 0) {
  12835. if (currentAttrValue.includes("&")) {
  12836. currentAttrValue = currentOptions.decodeEntities(
  12837. currentAttrValue,
  12838. true
  12839. );
  12840. }
  12841. if (currentProp.type === 6) {
  12842. if (currentProp.name === "class") {
  12843. currentAttrValue = condense(currentAttrValue).trim();
  12844. }
  12845. if (quote === 1 && !currentAttrValue) {
  12846. emitError(13, end);
  12847. }
  12848. currentProp.value = {
  12849. type: 2,
  12850. content: currentAttrValue,
  12851. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  12852. };
  12853. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  12854. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  12855. }
  12856. } else {
  12857. let expParseMode = 0 /* Normal */;
  12858. currentProp.exp = createExp(
  12859. currentAttrValue,
  12860. false,
  12861. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  12862. 0,
  12863. expParseMode
  12864. );
  12865. if (currentProp.name === "for") {
  12866. currentProp.forParseResult = parseForExpression(currentProp.exp);
  12867. }
  12868. }
  12869. }
  12870. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  12871. currentOpenTag.props.push(currentProp);
  12872. }
  12873. }
  12874. currentAttrValue = "";
  12875. currentAttrStartIndex = currentAttrEndIndex = -1;
  12876. },
  12877. oncomment(start, end) {
  12878. if (currentOptions.comments) {
  12879. addNode({
  12880. type: 3,
  12881. content: getSlice(start, end),
  12882. loc: getLoc(start - 4, end + 3)
  12883. });
  12884. }
  12885. },
  12886. onend() {
  12887. const end = currentInput.length;
  12888. if (tokenizer.state !== 1) {
  12889. switch (tokenizer.state) {
  12890. case 5:
  12891. case 8:
  12892. emitError(5, end);
  12893. break;
  12894. case 3:
  12895. case 4:
  12896. emitError(
  12897. 25,
  12898. tokenizer.sectionStart
  12899. );
  12900. break;
  12901. case 28:
  12902. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  12903. emitError(6, end);
  12904. } else {
  12905. emitError(7, end);
  12906. }
  12907. break;
  12908. case 6:
  12909. case 7:
  12910. case 9:
  12911. case 11:
  12912. case 12:
  12913. case 13:
  12914. case 14:
  12915. case 15:
  12916. case 16:
  12917. case 17:
  12918. case 18:
  12919. case 19:
  12920. case 20:
  12921. case 21:
  12922. emitError(9, end);
  12923. break;
  12924. }
  12925. }
  12926. for (let index = 0; index < stack.length; index++) {
  12927. onCloseTag(stack[index], end - 1);
  12928. emitError(24, stack[index].loc.start.offset);
  12929. }
  12930. },
  12931. oncdata(start, end) {
  12932. if (stack[0].ns !== 0) {
  12933. onText(getSlice(start, end), start, end);
  12934. } else {
  12935. emitError(1, start - 9);
  12936. }
  12937. },
  12938. onprocessinginstruction(start) {
  12939. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12940. emitError(
  12941. 21,
  12942. start - 1
  12943. );
  12944. }
  12945. }
  12946. });
  12947. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  12948. const stripParensRE = /^\(|\)$/g;
  12949. function parseForExpression(input) {
  12950. const loc = input.loc;
  12951. const exp = input.content;
  12952. const inMatch = exp.match(forAliasRE);
  12953. if (!inMatch)
  12954. return;
  12955. const [, LHS, RHS] = inMatch;
  12956. const createAliasExpression = (content, offset, asParam = false) => {
  12957. const start = loc.start.offset + offset;
  12958. const end = start + content.length;
  12959. return createExp(
  12960. content,
  12961. false,
  12962. getLoc(start, end),
  12963. 0,
  12964. asParam ? 1 /* Params */ : 0 /* Normal */
  12965. );
  12966. };
  12967. const result = {
  12968. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  12969. value: void 0,
  12970. key: void 0,
  12971. index: void 0,
  12972. finalized: false
  12973. };
  12974. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  12975. const trimmedOffset = LHS.indexOf(valueContent);
  12976. const iteratorMatch = valueContent.match(forIteratorRE);
  12977. if (iteratorMatch) {
  12978. valueContent = valueContent.replace(forIteratorRE, "").trim();
  12979. const keyContent = iteratorMatch[1].trim();
  12980. let keyOffset;
  12981. if (keyContent) {
  12982. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  12983. result.key = createAliasExpression(keyContent, keyOffset, true);
  12984. }
  12985. if (iteratorMatch[2]) {
  12986. const indexContent = iteratorMatch[2].trim();
  12987. if (indexContent) {
  12988. result.index = createAliasExpression(
  12989. indexContent,
  12990. exp.indexOf(
  12991. indexContent,
  12992. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  12993. ),
  12994. true
  12995. );
  12996. }
  12997. }
  12998. }
  12999. if (valueContent) {
  13000. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  13001. }
  13002. return result;
  13003. }
  13004. function getSlice(start, end) {
  13005. return currentInput.slice(start, end);
  13006. }
  13007. function endOpenTag(end) {
  13008. if (tokenizer.inSFCRoot) {
  13009. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  13010. }
  13011. addNode(currentOpenTag);
  13012. const { tag, ns } = currentOpenTag;
  13013. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13014. inPre++;
  13015. }
  13016. if (currentOptions.isVoidTag(tag)) {
  13017. onCloseTag(currentOpenTag, end);
  13018. } else {
  13019. stack.unshift(currentOpenTag);
  13020. if (ns === 1 || ns === 2) {
  13021. tokenizer.inXML = true;
  13022. }
  13023. }
  13024. currentOpenTag = null;
  13025. }
  13026. function onText(content, start, end) {
  13027. var _a;
  13028. {
  13029. const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
  13030. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  13031. content = currentOptions.decodeEntities(content, false);
  13032. }
  13033. }
  13034. const parent = stack[0] || currentRoot;
  13035. const lastNode = parent.children[parent.children.length - 1];
  13036. if ((lastNode == null ? void 0 : lastNode.type) === 2) {
  13037. lastNode.content += content;
  13038. setLocEnd(lastNode.loc, end);
  13039. } else {
  13040. parent.children.push({
  13041. type: 2,
  13042. content,
  13043. loc: getLoc(start, end)
  13044. });
  13045. }
  13046. }
  13047. function onCloseTag(el, end, isImplied = false) {
  13048. if (isImplied) {
  13049. setLocEnd(el.loc, backTrack(end, 60));
  13050. } else {
  13051. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  13052. }
  13053. if (tokenizer.inSFCRoot) {
  13054. if (el.children.length) {
  13055. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  13056. } else {
  13057. el.innerLoc.end = extend({}, el.innerLoc.start);
  13058. }
  13059. el.innerLoc.source = getSlice(
  13060. el.innerLoc.start.offset,
  13061. el.innerLoc.end.offset
  13062. );
  13063. }
  13064. const { tag, ns } = el;
  13065. if (!inVPre) {
  13066. if (tag === "slot") {
  13067. el.tagType = 2;
  13068. } else if (isFragmentTemplate(el)) {
  13069. el.tagType = 3;
  13070. } else if (isComponent(el)) {
  13071. el.tagType = 1;
  13072. }
  13073. }
  13074. if (!tokenizer.inRCDATA) {
  13075. el.children = condenseWhitespace(el.children, el.tag);
  13076. }
  13077. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13078. inPre--;
  13079. }
  13080. if (currentVPreBoundary === el) {
  13081. inVPre = tokenizer.inVPre = false;
  13082. currentVPreBoundary = null;
  13083. }
  13084. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  13085. tokenizer.inXML = false;
  13086. }
  13087. }
  13088. function lookAhead(index, c) {
  13089. let i = index;
  13090. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
  13091. i++;
  13092. return i;
  13093. }
  13094. function backTrack(index, c) {
  13095. let i = index;
  13096. while (currentInput.charCodeAt(i) !== c && i >= 0)
  13097. i--;
  13098. return i;
  13099. }
  13100. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  13101. function isFragmentTemplate({ tag, props }) {
  13102. if (tag === "template") {
  13103. for (let i = 0; i < props.length; i++) {
  13104. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  13105. return true;
  13106. }
  13107. }
  13108. }
  13109. return false;
  13110. }
  13111. function isComponent({ tag, props }) {
  13112. var _a;
  13113. if (currentOptions.isCustomElement(tag)) {
  13114. return false;
  13115. }
  13116. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  13117. return true;
  13118. }
  13119. for (let i = 0; i < props.length; i++) {
  13120. const p = props[i];
  13121. if (p.type === 6) {
  13122. if (p.name === "is" && p.value) {
  13123. if (p.value.content.startsWith("vue:")) {
  13124. return true;
  13125. }
  13126. }
  13127. }
  13128. }
  13129. return false;
  13130. }
  13131. function isUpperCase(c) {
  13132. return c > 64 && c < 91;
  13133. }
  13134. const windowsNewlineRE = /\r\n/g;
  13135. function condenseWhitespace(nodes, tag) {
  13136. var _a, _b;
  13137. const shouldCondense = currentOptions.whitespace !== "preserve";
  13138. let removedWhitespace = false;
  13139. for (let i = 0; i < nodes.length; i++) {
  13140. const node = nodes[i];
  13141. if (node.type === 2) {
  13142. if (!inPre) {
  13143. if (isAllWhitespace(node.content)) {
  13144. const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
  13145. const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
  13146. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  13147. removedWhitespace = true;
  13148. nodes[i] = null;
  13149. } else {
  13150. node.content = " ";
  13151. }
  13152. } else if (shouldCondense) {
  13153. node.content = condense(node.content);
  13154. }
  13155. } else {
  13156. node.content = node.content.replace(windowsNewlineRE, "\n");
  13157. }
  13158. }
  13159. }
  13160. if (inPre && tag && currentOptions.isPreTag(tag)) {
  13161. const first = nodes[0];
  13162. if (first && first.type === 2) {
  13163. first.content = first.content.replace(/^\r?\n/, "");
  13164. }
  13165. }
  13166. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  13167. }
  13168. function isAllWhitespace(str) {
  13169. for (let i = 0; i < str.length; i++) {
  13170. if (!isWhitespace(str.charCodeAt(i))) {
  13171. return false;
  13172. }
  13173. }
  13174. return true;
  13175. }
  13176. function hasNewlineChar(str) {
  13177. for (let i = 0; i < str.length; i++) {
  13178. const c = str.charCodeAt(i);
  13179. if (c === 10 || c === 13) {
  13180. return true;
  13181. }
  13182. }
  13183. return false;
  13184. }
  13185. function condense(str) {
  13186. let ret = "";
  13187. let prevCharIsWhitespace = false;
  13188. for (let i = 0; i < str.length; i++) {
  13189. if (isWhitespace(str.charCodeAt(i))) {
  13190. if (!prevCharIsWhitespace) {
  13191. ret += " ";
  13192. prevCharIsWhitespace = true;
  13193. }
  13194. } else {
  13195. ret += str[i];
  13196. prevCharIsWhitespace = false;
  13197. }
  13198. }
  13199. return ret;
  13200. }
  13201. function addNode(node) {
  13202. (stack[0] || currentRoot).children.push(node);
  13203. }
  13204. function getLoc(start, end) {
  13205. return {
  13206. start: tokenizer.getPos(start),
  13207. // @ts-expect-error allow late attachment
  13208. end: end == null ? end : tokenizer.getPos(end),
  13209. // @ts-expect-error allow late attachment
  13210. source: end == null ? end : getSlice(start, end)
  13211. };
  13212. }
  13213. function setLocEnd(loc, end) {
  13214. loc.end = tokenizer.getPos(end);
  13215. loc.source = getSlice(loc.start.offset, end);
  13216. }
  13217. function dirToAttr(dir) {
  13218. const attr = {
  13219. type: 6,
  13220. name: dir.rawName,
  13221. nameLoc: getLoc(
  13222. dir.loc.start.offset,
  13223. dir.loc.start.offset + dir.rawName.length
  13224. ),
  13225. value: void 0,
  13226. loc: dir.loc
  13227. };
  13228. if (dir.exp) {
  13229. const loc = dir.exp.loc;
  13230. if (loc.end.offset < dir.loc.end.offset) {
  13231. loc.start.offset--;
  13232. loc.start.column--;
  13233. loc.end.offset++;
  13234. loc.end.column++;
  13235. }
  13236. attr.value = {
  13237. type: 2,
  13238. content: dir.exp.content,
  13239. loc
  13240. };
  13241. }
  13242. return attr;
  13243. }
  13244. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  13245. const exp = createSimpleExpression(content, isStatic, loc, constType);
  13246. return exp;
  13247. }
  13248. function emitError(code, index, message) {
  13249. currentOptions.onError(
  13250. createCompilerError(code, getLoc(index, index), void 0, message)
  13251. );
  13252. }
  13253. function reset() {
  13254. tokenizer.reset();
  13255. currentOpenTag = null;
  13256. currentProp = null;
  13257. currentAttrValue = "";
  13258. currentAttrStartIndex = -1;
  13259. currentAttrEndIndex = -1;
  13260. stack.length = 0;
  13261. }
  13262. function baseParse(input, options) {
  13263. reset();
  13264. currentInput = input;
  13265. currentOptions = extend({}, defaultParserOptions);
  13266. if (options) {
  13267. let key;
  13268. for (key in options) {
  13269. if (options[key] != null) {
  13270. currentOptions[key] = options[key];
  13271. }
  13272. }
  13273. }
  13274. {
  13275. if (!currentOptions.decodeEntities) {
  13276. throw new Error(
  13277. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  13278. );
  13279. }
  13280. }
  13281. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  13282. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  13283. const delimiters = options == null ? void 0 : options.delimiters;
  13284. if (delimiters) {
  13285. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  13286. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  13287. }
  13288. const root = currentRoot = createRoot([], input);
  13289. tokenizer.parse(currentInput);
  13290. root.loc = getLoc(0, input.length);
  13291. root.children = condenseWhitespace(root.children);
  13292. currentRoot = null;
  13293. return root;
  13294. }
  13295. function hoistStatic(root, context) {
  13296. walk(
  13297. root,
  13298. context,
  13299. // Root node is unfortunately non-hoistable due to potential parent
  13300. // fallthrough attributes.
  13301. isSingleElementRoot(root, root.children[0])
  13302. );
  13303. }
  13304. function isSingleElementRoot(root, child) {
  13305. const { children } = root;
  13306. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  13307. }
  13308. function walk(node, context, doNotHoistNode = false) {
  13309. const { children } = node;
  13310. const originalCount = children.length;
  13311. let hoistedCount = 0;
  13312. for (let i = 0; i < children.length; i++) {
  13313. const child = children[i];
  13314. if (child.type === 1 && child.tagType === 0) {
  13315. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  13316. if (constantType > 0) {
  13317. if (constantType >= 2) {
  13318. child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
  13319. child.codegenNode = context.hoist(child.codegenNode);
  13320. hoistedCount++;
  13321. continue;
  13322. }
  13323. } else {
  13324. const codegenNode = child.codegenNode;
  13325. if (codegenNode.type === 13) {
  13326. const flag = getPatchFlag(codegenNode);
  13327. if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  13328. const props = getNodeProps(child);
  13329. if (props) {
  13330. codegenNode.props = context.hoist(props);
  13331. }
  13332. }
  13333. if (codegenNode.dynamicProps) {
  13334. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  13335. }
  13336. }
  13337. }
  13338. }
  13339. if (child.type === 1) {
  13340. const isComponent = child.tagType === 1;
  13341. if (isComponent) {
  13342. context.scopes.vSlot++;
  13343. }
  13344. walk(child, context);
  13345. if (isComponent) {
  13346. context.scopes.vSlot--;
  13347. }
  13348. } else if (child.type === 11) {
  13349. walk(child, context, child.children.length === 1);
  13350. } else if (child.type === 9) {
  13351. for (let i2 = 0; i2 < child.branches.length; i2++) {
  13352. walk(
  13353. child.branches[i2],
  13354. context,
  13355. child.branches[i2].children.length === 1
  13356. );
  13357. }
  13358. }
  13359. }
  13360. if (hoistedCount && context.transformHoist) {
  13361. context.transformHoist(children, context, node);
  13362. }
  13363. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  13364. const hoisted = context.hoist(
  13365. createArrayExpression(node.codegenNode.children)
  13366. );
  13367. if (context.hmr) {
  13368. hoisted.content = `[...${hoisted.content}]`;
  13369. }
  13370. node.codegenNode.children = hoisted;
  13371. }
  13372. }
  13373. function getConstantType(node, context) {
  13374. const { constantCache } = context;
  13375. switch (node.type) {
  13376. case 1:
  13377. if (node.tagType !== 0) {
  13378. return 0;
  13379. }
  13380. const cached = constantCache.get(node);
  13381. if (cached !== void 0) {
  13382. return cached;
  13383. }
  13384. const codegenNode = node.codegenNode;
  13385. if (codegenNode.type !== 13) {
  13386. return 0;
  13387. }
  13388. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
  13389. return 0;
  13390. }
  13391. const flag = getPatchFlag(codegenNode);
  13392. if (!flag) {
  13393. let returnType2 = 3;
  13394. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  13395. if (generatedPropsType === 0) {
  13396. constantCache.set(node, 0);
  13397. return 0;
  13398. }
  13399. if (generatedPropsType < returnType2) {
  13400. returnType2 = generatedPropsType;
  13401. }
  13402. for (let i = 0; i < node.children.length; i++) {
  13403. const childType = getConstantType(node.children[i], context);
  13404. if (childType === 0) {
  13405. constantCache.set(node, 0);
  13406. return 0;
  13407. }
  13408. if (childType < returnType2) {
  13409. returnType2 = childType;
  13410. }
  13411. }
  13412. if (returnType2 > 1) {
  13413. for (let i = 0; i < node.props.length; i++) {
  13414. const p = node.props[i];
  13415. if (p.type === 7 && p.name === "bind" && p.exp) {
  13416. const expType = getConstantType(p.exp, context);
  13417. if (expType === 0) {
  13418. constantCache.set(node, 0);
  13419. return 0;
  13420. }
  13421. if (expType < returnType2) {
  13422. returnType2 = expType;
  13423. }
  13424. }
  13425. }
  13426. }
  13427. if (codegenNode.isBlock) {
  13428. for (let i = 0; i < node.props.length; i++) {
  13429. const p = node.props[i];
  13430. if (p.type === 7) {
  13431. constantCache.set(node, 0);
  13432. return 0;
  13433. }
  13434. }
  13435. context.removeHelper(OPEN_BLOCK);
  13436. context.removeHelper(
  13437. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  13438. );
  13439. codegenNode.isBlock = false;
  13440. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  13441. }
  13442. constantCache.set(node, returnType2);
  13443. return returnType2;
  13444. } else {
  13445. constantCache.set(node, 0);
  13446. return 0;
  13447. }
  13448. case 2:
  13449. case 3:
  13450. return 3;
  13451. case 9:
  13452. case 11:
  13453. case 10:
  13454. return 0;
  13455. case 5:
  13456. case 12:
  13457. return getConstantType(node.content, context);
  13458. case 4:
  13459. return node.constType;
  13460. case 8:
  13461. let returnType = 3;
  13462. for (let i = 0; i < node.children.length; i++) {
  13463. const child = node.children[i];
  13464. if (isString(child) || isSymbol(child)) {
  13465. continue;
  13466. }
  13467. const childType = getConstantType(child, context);
  13468. if (childType === 0) {
  13469. return 0;
  13470. } else if (childType < returnType) {
  13471. returnType = childType;
  13472. }
  13473. }
  13474. return returnType;
  13475. default:
  13476. return 0;
  13477. }
  13478. }
  13479. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  13480. NORMALIZE_CLASS,
  13481. NORMALIZE_STYLE,
  13482. NORMALIZE_PROPS,
  13483. GUARD_REACTIVE_PROPS
  13484. ]);
  13485. function getConstantTypeOfHelperCall(value, context) {
  13486. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  13487. const arg = value.arguments[0];
  13488. if (arg.type === 4) {
  13489. return getConstantType(arg, context);
  13490. } else if (arg.type === 14) {
  13491. return getConstantTypeOfHelperCall(arg, context);
  13492. }
  13493. }
  13494. return 0;
  13495. }
  13496. function getGeneratedPropsConstantType(node, context) {
  13497. let returnType = 3;
  13498. const props = getNodeProps(node);
  13499. if (props && props.type === 15) {
  13500. const { properties } = props;
  13501. for (let i = 0; i < properties.length; i++) {
  13502. const { key, value } = properties[i];
  13503. const keyType = getConstantType(key, context);
  13504. if (keyType === 0) {
  13505. return keyType;
  13506. }
  13507. if (keyType < returnType) {
  13508. returnType = keyType;
  13509. }
  13510. let valueType;
  13511. if (value.type === 4) {
  13512. valueType = getConstantType(value, context);
  13513. } else if (value.type === 14) {
  13514. valueType = getConstantTypeOfHelperCall(value, context);
  13515. } else {
  13516. valueType = 0;
  13517. }
  13518. if (valueType === 0) {
  13519. return valueType;
  13520. }
  13521. if (valueType < returnType) {
  13522. returnType = valueType;
  13523. }
  13524. }
  13525. }
  13526. return returnType;
  13527. }
  13528. function getNodeProps(node) {
  13529. const codegenNode = node.codegenNode;
  13530. if (codegenNode.type === 13) {
  13531. return codegenNode.props;
  13532. }
  13533. }
  13534. function getPatchFlag(node) {
  13535. const flag = node.patchFlag;
  13536. return flag ? parseInt(flag, 10) : void 0;
  13537. }
  13538. function createTransformContext(root, {
  13539. filename = "",
  13540. prefixIdentifiers = false,
  13541. hoistStatic: hoistStatic2 = false,
  13542. hmr = false,
  13543. cacheHandlers = false,
  13544. nodeTransforms = [],
  13545. directiveTransforms = {},
  13546. transformHoist = null,
  13547. isBuiltInComponent = NOOP,
  13548. isCustomElement = NOOP,
  13549. expressionPlugins = [],
  13550. scopeId = null,
  13551. slotted = true,
  13552. ssr = false,
  13553. inSSR = false,
  13554. ssrCssVars = ``,
  13555. bindingMetadata = EMPTY_OBJ,
  13556. inline = false,
  13557. isTS = false,
  13558. onError = defaultOnError,
  13559. onWarn = defaultOnWarn,
  13560. compatConfig
  13561. }) {
  13562. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  13563. const context = {
  13564. // options
  13565. filename,
  13566. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  13567. prefixIdentifiers,
  13568. hoistStatic: hoistStatic2,
  13569. hmr,
  13570. cacheHandlers,
  13571. nodeTransforms,
  13572. directiveTransforms,
  13573. transformHoist,
  13574. isBuiltInComponent,
  13575. isCustomElement,
  13576. expressionPlugins,
  13577. scopeId,
  13578. slotted,
  13579. ssr,
  13580. inSSR,
  13581. ssrCssVars,
  13582. bindingMetadata,
  13583. inline,
  13584. isTS,
  13585. onError,
  13586. onWarn,
  13587. compatConfig,
  13588. // state
  13589. root,
  13590. helpers: /* @__PURE__ */ new Map(),
  13591. components: /* @__PURE__ */ new Set(),
  13592. directives: /* @__PURE__ */ new Set(),
  13593. hoists: [],
  13594. imports: [],
  13595. constantCache: /* @__PURE__ */ new WeakMap(),
  13596. temps: 0,
  13597. cached: 0,
  13598. identifiers: /* @__PURE__ */ Object.create(null),
  13599. scopes: {
  13600. vFor: 0,
  13601. vSlot: 0,
  13602. vPre: 0,
  13603. vOnce: 0
  13604. },
  13605. parent: null,
  13606. currentNode: root,
  13607. childIndex: 0,
  13608. inVOnce: false,
  13609. // methods
  13610. helper(name) {
  13611. const count = context.helpers.get(name) || 0;
  13612. context.helpers.set(name, count + 1);
  13613. return name;
  13614. },
  13615. removeHelper(name) {
  13616. const count = context.helpers.get(name);
  13617. if (count) {
  13618. const currentCount = count - 1;
  13619. if (!currentCount) {
  13620. context.helpers.delete(name);
  13621. } else {
  13622. context.helpers.set(name, currentCount);
  13623. }
  13624. }
  13625. },
  13626. helperString(name) {
  13627. return `_${helperNameMap[context.helper(name)]}`;
  13628. },
  13629. replaceNode(node) {
  13630. {
  13631. if (!context.currentNode) {
  13632. throw new Error(`Node being replaced is already removed.`);
  13633. }
  13634. if (!context.parent) {
  13635. throw new Error(`Cannot replace root node.`);
  13636. }
  13637. }
  13638. context.parent.children[context.childIndex] = context.currentNode = node;
  13639. },
  13640. removeNode(node) {
  13641. if (!context.parent) {
  13642. throw new Error(`Cannot remove root node.`);
  13643. }
  13644. const list = context.parent.children;
  13645. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  13646. if (removalIndex < 0) {
  13647. throw new Error(`node being removed is not a child of current parent`);
  13648. }
  13649. if (!node || node === context.currentNode) {
  13650. context.currentNode = null;
  13651. context.onNodeRemoved();
  13652. } else {
  13653. if (context.childIndex > removalIndex) {
  13654. context.childIndex--;
  13655. context.onNodeRemoved();
  13656. }
  13657. }
  13658. context.parent.children.splice(removalIndex, 1);
  13659. },
  13660. onNodeRemoved: NOOP,
  13661. addIdentifiers(exp) {
  13662. },
  13663. removeIdentifiers(exp) {
  13664. },
  13665. hoist(exp) {
  13666. if (isString(exp))
  13667. exp = createSimpleExpression(exp);
  13668. context.hoists.push(exp);
  13669. const identifier = createSimpleExpression(
  13670. `_hoisted_${context.hoists.length}`,
  13671. false,
  13672. exp.loc,
  13673. 2
  13674. );
  13675. identifier.hoisted = exp;
  13676. return identifier;
  13677. },
  13678. cache(exp, isVNode = false) {
  13679. return createCacheExpression(context.cached++, exp, isVNode);
  13680. }
  13681. };
  13682. return context;
  13683. }
  13684. function transform(root, options) {
  13685. const context = createTransformContext(root, options);
  13686. traverseNode(root, context);
  13687. if (options.hoistStatic) {
  13688. hoistStatic(root, context);
  13689. }
  13690. if (!options.ssr) {
  13691. createRootCodegen(root, context);
  13692. }
  13693. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  13694. root.components = [...context.components];
  13695. root.directives = [...context.directives];
  13696. root.imports = context.imports;
  13697. root.hoists = context.hoists;
  13698. root.temps = context.temps;
  13699. root.cached = context.cached;
  13700. root.transformed = true;
  13701. }
  13702. function createRootCodegen(root, context) {
  13703. const { helper } = context;
  13704. const { children } = root;
  13705. if (children.length === 1) {
  13706. const child = children[0];
  13707. if (isSingleElementRoot(root, child) && child.codegenNode) {
  13708. const codegenNode = child.codegenNode;
  13709. if (codegenNode.type === 13) {
  13710. convertToBlock(codegenNode, context);
  13711. }
  13712. root.codegenNode = codegenNode;
  13713. } else {
  13714. root.codegenNode = child;
  13715. }
  13716. } else if (children.length > 1) {
  13717. let patchFlag = 64;
  13718. let patchFlagText = PatchFlagNames[64];
  13719. if (children.filter((c) => c.type !== 3).length === 1) {
  13720. patchFlag |= 2048;
  13721. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13722. }
  13723. root.codegenNode = createVNodeCall(
  13724. context,
  13725. helper(FRAGMENT),
  13726. void 0,
  13727. root.children,
  13728. patchFlag + (` /* ${patchFlagText} */` ),
  13729. void 0,
  13730. void 0,
  13731. true,
  13732. void 0,
  13733. false
  13734. );
  13735. } else ;
  13736. }
  13737. function traverseChildren(parent, context) {
  13738. let i = 0;
  13739. const nodeRemoved = () => {
  13740. i--;
  13741. };
  13742. for (; i < parent.children.length; i++) {
  13743. const child = parent.children[i];
  13744. if (isString(child))
  13745. continue;
  13746. context.parent = parent;
  13747. context.childIndex = i;
  13748. context.onNodeRemoved = nodeRemoved;
  13749. traverseNode(child, context);
  13750. }
  13751. }
  13752. function traverseNode(node, context) {
  13753. context.currentNode = node;
  13754. const { nodeTransforms } = context;
  13755. const exitFns = [];
  13756. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  13757. const onExit = nodeTransforms[i2](node, context);
  13758. if (onExit) {
  13759. if (isArray(onExit)) {
  13760. exitFns.push(...onExit);
  13761. } else {
  13762. exitFns.push(onExit);
  13763. }
  13764. }
  13765. if (!context.currentNode) {
  13766. return;
  13767. } else {
  13768. node = context.currentNode;
  13769. }
  13770. }
  13771. switch (node.type) {
  13772. case 3:
  13773. if (!context.ssr) {
  13774. context.helper(CREATE_COMMENT);
  13775. }
  13776. break;
  13777. case 5:
  13778. if (!context.ssr) {
  13779. context.helper(TO_DISPLAY_STRING);
  13780. }
  13781. break;
  13782. case 9:
  13783. for (let i2 = 0; i2 < node.branches.length; i2++) {
  13784. traverseNode(node.branches[i2], context);
  13785. }
  13786. break;
  13787. case 10:
  13788. case 11:
  13789. case 1:
  13790. case 0:
  13791. traverseChildren(node, context);
  13792. break;
  13793. }
  13794. context.currentNode = node;
  13795. let i = exitFns.length;
  13796. while (i--) {
  13797. exitFns[i]();
  13798. }
  13799. }
  13800. function createStructuralDirectiveTransform(name, fn) {
  13801. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  13802. return (node, context) => {
  13803. if (node.type === 1) {
  13804. const { props } = node;
  13805. if (node.tagType === 3 && props.some(isVSlot)) {
  13806. return;
  13807. }
  13808. const exitFns = [];
  13809. for (let i = 0; i < props.length; i++) {
  13810. const prop = props[i];
  13811. if (prop.type === 7 && matches(prop.name)) {
  13812. props.splice(i, 1);
  13813. i--;
  13814. const onExit = fn(node, prop, context);
  13815. if (onExit)
  13816. exitFns.push(onExit);
  13817. }
  13818. }
  13819. return exitFns;
  13820. }
  13821. };
  13822. }
  13823. const PURE_ANNOTATION = `/*#__PURE__*/`;
  13824. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  13825. function createCodegenContext(ast, {
  13826. mode = "function",
  13827. prefixIdentifiers = mode === "module",
  13828. sourceMap = false,
  13829. filename = `template.vue.html`,
  13830. scopeId = null,
  13831. optimizeImports = false,
  13832. runtimeGlobalName = `Vue`,
  13833. runtimeModuleName = `vue`,
  13834. ssrRuntimeModuleName = "vue/server-renderer",
  13835. ssr = false,
  13836. isTS = false,
  13837. inSSR = false
  13838. }) {
  13839. const context = {
  13840. mode,
  13841. prefixIdentifiers,
  13842. sourceMap,
  13843. filename,
  13844. scopeId,
  13845. optimizeImports,
  13846. runtimeGlobalName,
  13847. runtimeModuleName,
  13848. ssrRuntimeModuleName,
  13849. ssr,
  13850. isTS,
  13851. inSSR,
  13852. source: ast.source,
  13853. code: ``,
  13854. column: 1,
  13855. line: 1,
  13856. offset: 0,
  13857. indentLevel: 0,
  13858. pure: false,
  13859. map: void 0,
  13860. helper(key) {
  13861. return `_${helperNameMap[key]}`;
  13862. },
  13863. push(code, newlineIndex = -2 /* None */, node) {
  13864. context.code += code;
  13865. },
  13866. indent() {
  13867. newline(++context.indentLevel);
  13868. },
  13869. deindent(withoutNewLine = false) {
  13870. if (withoutNewLine) {
  13871. --context.indentLevel;
  13872. } else {
  13873. newline(--context.indentLevel);
  13874. }
  13875. },
  13876. newline() {
  13877. newline(context.indentLevel);
  13878. }
  13879. };
  13880. function newline(n) {
  13881. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  13882. }
  13883. return context;
  13884. }
  13885. function generate(ast, options = {}) {
  13886. const context = createCodegenContext(ast, options);
  13887. if (options.onContextCreated)
  13888. options.onContextCreated(context);
  13889. const {
  13890. mode,
  13891. push,
  13892. prefixIdentifiers,
  13893. indent,
  13894. deindent,
  13895. newline,
  13896. scopeId,
  13897. ssr
  13898. } = context;
  13899. const helpers = Array.from(ast.helpers);
  13900. const hasHelpers = helpers.length > 0;
  13901. const useWithBlock = !prefixIdentifiers && mode !== "module";
  13902. const preambleContext = context;
  13903. {
  13904. genFunctionPreamble(ast, preambleContext);
  13905. }
  13906. const functionName = ssr ? `ssrRender` : `render`;
  13907. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  13908. const signature = args.join(", ");
  13909. {
  13910. push(`function ${functionName}(${signature}) {`);
  13911. }
  13912. indent();
  13913. if (useWithBlock) {
  13914. push(`with (_ctx) {`);
  13915. indent();
  13916. if (hasHelpers) {
  13917. push(
  13918. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  13919. `,
  13920. -1 /* End */
  13921. );
  13922. newline();
  13923. }
  13924. }
  13925. if (ast.components.length) {
  13926. genAssets(ast.components, "component", context);
  13927. if (ast.directives.length || ast.temps > 0) {
  13928. newline();
  13929. }
  13930. }
  13931. if (ast.directives.length) {
  13932. genAssets(ast.directives, "directive", context);
  13933. if (ast.temps > 0) {
  13934. newline();
  13935. }
  13936. }
  13937. if (ast.temps > 0) {
  13938. push(`let `);
  13939. for (let i = 0; i < ast.temps; i++) {
  13940. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  13941. }
  13942. }
  13943. if (ast.components.length || ast.directives.length || ast.temps) {
  13944. push(`
  13945. `, 0 /* Start */);
  13946. newline();
  13947. }
  13948. if (!ssr) {
  13949. push(`return `);
  13950. }
  13951. if (ast.codegenNode) {
  13952. genNode(ast.codegenNode, context);
  13953. } else {
  13954. push(`null`);
  13955. }
  13956. if (useWithBlock) {
  13957. deindent();
  13958. push(`}`);
  13959. }
  13960. deindent();
  13961. push(`}`);
  13962. return {
  13963. ast,
  13964. code: context.code,
  13965. preamble: ``,
  13966. map: context.map ? context.map.toJSON() : void 0
  13967. };
  13968. }
  13969. function genFunctionPreamble(ast, context) {
  13970. const {
  13971. ssr,
  13972. prefixIdentifiers,
  13973. push,
  13974. newline,
  13975. runtimeModuleName,
  13976. runtimeGlobalName,
  13977. ssrRuntimeModuleName
  13978. } = context;
  13979. const VueBinding = runtimeGlobalName;
  13980. const helpers = Array.from(ast.helpers);
  13981. if (helpers.length > 0) {
  13982. {
  13983. push(`const _Vue = ${VueBinding}
  13984. `, -1 /* End */);
  13985. if (ast.hoists.length) {
  13986. const staticHelpers = [
  13987. CREATE_VNODE,
  13988. CREATE_ELEMENT_VNODE,
  13989. CREATE_COMMENT,
  13990. CREATE_TEXT,
  13991. CREATE_STATIC
  13992. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  13993. push(`const { ${staticHelpers} } = _Vue
  13994. `, -1 /* End */);
  13995. }
  13996. }
  13997. }
  13998. genHoists(ast.hoists, context);
  13999. newline();
  14000. push(`return `);
  14001. }
  14002. function genAssets(assets, type, { helper, push, newline, isTS }) {
  14003. const resolver = helper(
  14004. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  14005. );
  14006. for (let i = 0; i < assets.length; i++) {
  14007. let id = assets[i];
  14008. const maybeSelfReference = id.endsWith("__self");
  14009. if (maybeSelfReference) {
  14010. id = id.slice(0, -6);
  14011. }
  14012. push(
  14013. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  14014. );
  14015. if (i < assets.length - 1) {
  14016. newline();
  14017. }
  14018. }
  14019. }
  14020. function genHoists(hoists, context) {
  14021. if (!hoists.length) {
  14022. return;
  14023. }
  14024. context.pure = true;
  14025. const { push, newline, helper, scopeId, mode } = context;
  14026. newline();
  14027. for (let i = 0; i < hoists.length; i++) {
  14028. const exp = hoists[i];
  14029. if (exp) {
  14030. push(
  14031. `const _hoisted_${i + 1} = ${``}`
  14032. );
  14033. genNode(exp, context);
  14034. newline();
  14035. }
  14036. }
  14037. context.pure = false;
  14038. }
  14039. function isText(n) {
  14040. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  14041. }
  14042. function genNodeListAsArray(nodes, context) {
  14043. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  14044. context.push(`[`);
  14045. multilines && context.indent();
  14046. genNodeList(nodes, context, multilines);
  14047. multilines && context.deindent();
  14048. context.push(`]`);
  14049. }
  14050. function genNodeList(nodes, context, multilines = false, comma = true) {
  14051. const { push, newline } = context;
  14052. for (let i = 0; i < nodes.length; i++) {
  14053. const node = nodes[i];
  14054. if (isString(node)) {
  14055. push(node, -3 /* Unknown */);
  14056. } else if (isArray(node)) {
  14057. genNodeListAsArray(node, context);
  14058. } else {
  14059. genNode(node, context);
  14060. }
  14061. if (i < nodes.length - 1) {
  14062. if (multilines) {
  14063. comma && push(",");
  14064. newline();
  14065. } else {
  14066. comma && push(", ");
  14067. }
  14068. }
  14069. }
  14070. }
  14071. function genNode(node, context) {
  14072. if (isString(node)) {
  14073. context.push(node, -3 /* Unknown */);
  14074. return;
  14075. }
  14076. if (isSymbol(node)) {
  14077. context.push(context.helper(node));
  14078. return;
  14079. }
  14080. switch (node.type) {
  14081. case 1:
  14082. case 9:
  14083. case 11:
  14084. assert(
  14085. node.codegenNode != null,
  14086. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  14087. );
  14088. genNode(node.codegenNode, context);
  14089. break;
  14090. case 2:
  14091. genText(node, context);
  14092. break;
  14093. case 4:
  14094. genExpression(node, context);
  14095. break;
  14096. case 5:
  14097. genInterpolation(node, context);
  14098. break;
  14099. case 12:
  14100. genNode(node.codegenNode, context);
  14101. break;
  14102. case 8:
  14103. genCompoundExpression(node, context);
  14104. break;
  14105. case 3:
  14106. genComment(node, context);
  14107. break;
  14108. case 13:
  14109. genVNodeCall(node, context);
  14110. break;
  14111. case 14:
  14112. genCallExpression(node, context);
  14113. break;
  14114. case 15:
  14115. genObjectExpression(node, context);
  14116. break;
  14117. case 17:
  14118. genArrayExpression(node, context);
  14119. break;
  14120. case 18:
  14121. genFunctionExpression(node, context);
  14122. break;
  14123. case 19:
  14124. genConditionalExpression(node, context);
  14125. break;
  14126. case 20:
  14127. genCacheExpression(node, context);
  14128. break;
  14129. case 21:
  14130. genNodeList(node.body, context, true, false);
  14131. break;
  14132. case 22:
  14133. break;
  14134. case 23:
  14135. break;
  14136. case 24:
  14137. break;
  14138. case 25:
  14139. break;
  14140. case 26:
  14141. break;
  14142. case 10:
  14143. break;
  14144. default:
  14145. {
  14146. assert(false, `unhandled codegen node type: ${node.type}`);
  14147. const exhaustiveCheck = node;
  14148. return exhaustiveCheck;
  14149. }
  14150. }
  14151. }
  14152. function genText(node, context) {
  14153. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  14154. }
  14155. function genExpression(node, context) {
  14156. const { content, isStatic } = node;
  14157. context.push(
  14158. isStatic ? JSON.stringify(content) : content,
  14159. -3 /* Unknown */,
  14160. node
  14161. );
  14162. }
  14163. function genInterpolation(node, context) {
  14164. const { push, helper, pure } = context;
  14165. if (pure)
  14166. push(PURE_ANNOTATION);
  14167. push(`${helper(TO_DISPLAY_STRING)}(`);
  14168. genNode(node.content, context);
  14169. push(`)`);
  14170. }
  14171. function genCompoundExpression(node, context) {
  14172. for (let i = 0; i < node.children.length; i++) {
  14173. const child = node.children[i];
  14174. if (isString(child)) {
  14175. context.push(child, -3 /* Unknown */);
  14176. } else {
  14177. genNode(child, context);
  14178. }
  14179. }
  14180. }
  14181. function genExpressionAsPropertyKey(node, context) {
  14182. const { push } = context;
  14183. if (node.type === 8) {
  14184. push(`[`);
  14185. genCompoundExpression(node, context);
  14186. push(`]`);
  14187. } else if (node.isStatic) {
  14188. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  14189. push(text, -2 /* None */, node);
  14190. } else {
  14191. push(`[${node.content}]`, -3 /* Unknown */, node);
  14192. }
  14193. }
  14194. function genComment(node, context) {
  14195. const { push, helper, pure } = context;
  14196. if (pure) {
  14197. push(PURE_ANNOTATION);
  14198. }
  14199. push(
  14200. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  14201. -3 /* Unknown */,
  14202. node
  14203. );
  14204. }
  14205. function genVNodeCall(node, context) {
  14206. const { push, helper, pure } = context;
  14207. const {
  14208. tag,
  14209. props,
  14210. children,
  14211. patchFlag,
  14212. dynamicProps,
  14213. directives,
  14214. isBlock,
  14215. disableTracking,
  14216. isComponent
  14217. } = node;
  14218. if (directives) {
  14219. push(helper(WITH_DIRECTIVES) + `(`);
  14220. }
  14221. if (isBlock) {
  14222. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  14223. }
  14224. if (pure) {
  14225. push(PURE_ANNOTATION);
  14226. }
  14227. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  14228. push(helper(callHelper) + `(`, -2 /* None */, node);
  14229. genNodeList(
  14230. genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
  14231. context
  14232. );
  14233. push(`)`);
  14234. if (isBlock) {
  14235. push(`)`);
  14236. }
  14237. if (directives) {
  14238. push(`, `);
  14239. genNode(directives, context);
  14240. push(`)`);
  14241. }
  14242. }
  14243. function genNullableArgs(args) {
  14244. let i = args.length;
  14245. while (i--) {
  14246. if (args[i] != null)
  14247. break;
  14248. }
  14249. return args.slice(0, i + 1).map((arg) => arg || `null`);
  14250. }
  14251. function genCallExpression(node, context) {
  14252. const { push, helper, pure } = context;
  14253. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  14254. if (pure) {
  14255. push(PURE_ANNOTATION);
  14256. }
  14257. push(callee + `(`, -2 /* None */, node);
  14258. genNodeList(node.arguments, context);
  14259. push(`)`);
  14260. }
  14261. function genObjectExpression(node, context) {
  14262. const { push, indent, deindent, newline } = context;
  14263. const { properties } = node;
  14264. if (!properties.length) {
  14265. push(`{}`, -2 /* None */, node);
  14266. return;
  14267. }
  14268. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  14269. push(multilines ? `{` : `{ `);
  14270. multilines && indent();
  14271. for (let i = 0; i < properties.length; i++) {
  14272. const { key, value } = properties[i];
  14273. genExpressionAsPropertyKey(key, context);
  14274. push(`: `);
  14275. genNode(value, context);
  14276. if (i < properties.length - 1) {
  14277. push(`,`);
  14278. newline();
  14279. }
  14280. }
  14281. multilines && deindent();
  14282. push(multilines ? `}` : ` }`);
  14283. }
  14284. function genArrayExpression(node, context) {
  14285. genNodeListAsArray(node.elements, context);
  14286. }
  14287. function genFunctionExpression(node, context) {
  14288. const { push, indent, deindent } = context;
  14289. const { params, returns, body, newline, isSlot } = node;
  14290. if (isSlot) {
  14291. push(`_${helperNameMap[WITH_CTX]}(`);
  14292. }
  14293. push(`(`, -2 /* None */, node);
  14294. if (isArray(params)) {
  14295. genNodeList(params, context);
  14296. } else if (params) {
  14297. genNode(params, context);
  14298. }
  14299. push(`) => `);
  14300. if (newline || body) {
  14301. push(`{`);
  14302. indent();
  14303. }
  14304. if (returns) {
  14305. if (newline) {
  14306. push(`return `);
  14307. }
  14308. if (isArray(returns)) {
  14309. genNodeListAsArray(returns, context);
  14310. } else {
  14311. genNode(returns, context);
  14312. }
  14313. } else if (body) {
  14314. genNode(body, context);
  14315. }
  14316. if (newline || body) {
  14317. deindent();
  14318. push(`}`);
  14319. }
  14320. if (isSlot) {
  14321. push(`)`);
  14322. }
  14323. }
  14324. function genConditionalExpression(node, context) {
  14325. const { test, consequent, alternate, newline: needNewline } = node;
  14326. const { push, indent, deindent, newline } = context;
  14327. if (test.type === 4) {
  14328. const needsParens = !isSimpleIdentifier(test.content);
  14329. needsParens && push(`(`);
  14330. genExpression(test, context);
  14331. needsParens && push(`)`);
  14332. } else {
  14333. push(`(`);
  14334. genNode(test, context);
  14335. push(`)`);
  14336. }
  14337. needNewline && indent();
  14338. context.indentLevel++;
  14339. needNewline || push(` `);
  14340. push(`? `);
  14341. genNode(consequent, context);
  14342. context.indentLevel--;
  14343. needNewline && newline();
  14344. needNewline || push(` `);
  14345. push(`: `);
  14346. const isNested = alternate.type === 19;
  14347. if (!isNested) {
  14348. context.indentLevel++;
  14349. }
  14350. genNode(alternate, context);
  14351. if (!isNested) {
  14352. context.indentLevel--;
  14353. }
  14354. needNewline && deindent(
  14355. true
  14356. /* without newline */
  14357. );
  14358. }
  14359. function genCacheExpression(node, context) {
  14360. const { push, helper, indent, deindent, newline } = context;
  14361. push(`_cache[${node.index}] || (`);
  14362. if (node.isVNode) {
  14363. indent();
  14364. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  14365. newline();
  14366. }
  14367. push(`_cache[${node.index}] = `);
  14368. genNode(node.value, context);
  14369. if (node.isVNode) {
  14370. push(`,`);
  14371. newline();
  14372. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  14373. newline();
  14374. push(`_cache[${node.index}]`);
  14375. deindent();
  14376. }
  14377. push(`)`);
  14378. }
  14379. const prohibitedKeywordRE = new RegExp(
  14380. "\\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"
  14381. );
  14382. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  14383. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  14384. const exp = node.content;
  14385. if (!exp.trim()) {
  14386. return;
  14387. }
  14388. try {
  14389. new Function(
  14390. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  14391. );
  14392. } catch (e) {
  14393. let message = e.message;
  14394. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  14395. if (keywordMatch) {
  14396. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  14397. }
  14398. context.onError(
  14399. createCompilerError(
  14400. 45,
  14401. node.loc,
  14402. void 0,
  14403. message
  14404. )
  14405. );
  14406. }
  14407. }
  14408. const transformExpression = (node, context) => {
  14409. if (node.type === 5) {
  14410. node.content = processExpression(
  14411. node.content,
  14412. context
  14413. );
  14414. } else if (node.type === 1) {
  14415. for (let i = 0; i < node.props.length; i++) {
  14416. const dir = node.props[i];
  14417. if (dir.type === 7 && dir.name !== "for") {
  14418. const exp = dir.exp;
  14419. const arg = dir.arg;
  14420. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  14421. dir.exp = processExpression(
  14422. exp,
  14423. context,
  14424. // slot args must be processed as function params
  14425. dir.name === "slot"
  14426. );
  14427. }
  14428. if (arg && arg.type === 4 && !arg.isStatic) {
  14429. dir.arg = processExpression(arg, context);
  14430. }
  14431. }
  14432. }
  14433. }
  14434. };
  14435. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  14436. {
  14437. {
  14438. validateBrowserExpression(node, context, asParams, asRawStatements);
  14439. }
  14440. return node;
  14441. }
  14442. }
  14443. const transformIf = createStructuralDirectiveTransform(
  14444. /^(if|else|else-if)$/,
  14445. (node, dir, context) => {
  14446. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  14447. const siblings = context.parent.children;
  14448. let i = siblings.indexOf(ifNode);
  14449. let key = 0;
  14450. while (i-- >= 0) {
  14451. const sibling = siblings[i];
  14452. if (sibling && sibling.type === 9) {
  14453. key += sibling.branches.length;
  14454. }
  14455. }
  14456. return () => {
  14457. if (isRoot) {
  14458. ifNode.codegenNode = createCodegenNodeForBranch(
  14459. branch,
  14460. key,
  14461. context
  14462. );
  14463. } else {
  14464. const parentCondition = getParentCondition(ifNode.codegenNode);
  14465. parentCondition.alternate = createCodegenNodeForBranch(
  14466. branch,
  14467. key + ifNode.branches.length - 1,
  14468. context
  14469. );
  14470. }
  14471. };
  14472. });
  14473. }
  14474. );
  14475. function processIf(node, dir, context, processCodegen) {
  14476. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  14477. const loc = dir.exp ? dir.exp.loc : node.loc;
  14478. context.onError(
  14479. createCompilerError(28, dir.loc)
  14480. );
  14481. dir.exp = createSimpleExpression(`true`, false, loc);
  14482. }
  14483. if (dir.exp) {
  14484. validateBrowserExpression(dir.exp, context);
  14485. }
  14486. if (dir.name === "if") {
  14487. const branch = createIfBranch(node, dir);
  14488. const ifNode = {
  14489. type: 9,
  14490. loc: node.loc,
  14491. branches: [branch]
  14492. };
  14493. context.replaceNode(ifNode);
  14494. if (processCodegen) {
  14495. return processCodegen(ifNode, branch, true);
  14496. }
  14497. } else {
  14498. const siblings = context.parent.children;
  14499. const comments = [];
  14500. let i = siblings.indexOf(node);
  14501. while (i-- >= -1) {
  14502. const sibling = siblings[i];
  14503. if (sibling && sibling.type === 3) {
  14504. context.removeNode(sibling);
  14505. comments.unshift(sibling);
  14506. continue;
  14507. }
  14508. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  14509. context.removeNode(sibling);
  14510. continue;
  14511. }
  14512. if (sibling && sibling.type === 9) {
  14513. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  14514. context.onError(
  14515. createCompilerError(30, node.loc)
  14516. );
  14517. }
  14518. context.removeNode();
  14519. const branch = createIfBranch(node, dir);
  14520. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  14521. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  14522. branch.children = [...comments, ...branch.children];
  14523. }
  14524. {
  14525. const key = branch.userKey;
  14526. if (key) {
  14527. sibling.branches.forEach(({ userKey }) => {
  14528. if (isSameKey(userKey, key)) {
  14529. context.onError(
  14530. createCompilerError(
  14531. 29,
  14532. branch.userKey.loc
  14533. )
  14534. );
  14535. }
  14536. });
  14537. }
  14538. }
  14539. sibling.branches.push(branch);
  14540. const onExit = processCodegen && processCodegen(sibling, branch, false);
  14541. traverseNode(branch, context);
  14542. if (onExit)
  14543. onExit();
  14544. context.currentNode = null;
  14545. } else {
  14546. context.onError(
  14547. createCompilerError(30, node.loc)
  14548. );
  14549. }
  14550. break;
  14551. }
  14552. }
  14553. }
  14554. function createIfBranch(node, dir) {
  14555. const isTemplateIf = node.tagType === 3;
  14556. return {
  14557. type: 10,
  14558. loc: node.loc,
  14559. condition: dir.name === "else" ? void 0 : dir.exp,
  14560. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  14561. userKey: findProp(node, `key`),
  14562. isTemplateIf
  14563. };
  14564. }
  14565. function createCodegenNodeForBranch(branch, keyIndex, context) {
  14566. if (branch.condition) {
  14567. return createConditionalExpression(
  14568. branch.condition,
  14569. createChildrenCodegenNode(branch, keyIndex, context),
  14570. // make sure to pass in asBlock: true so that the comment node call
  14571. // closes the current block.
  14572. createCallExpression(context.helper(CREATE_COMMENT), [
  14573. '"v-if"' ,
  14574. "true"
  14575. ])
  14576. );
  14577. } else {
  14578. return createChildrenCodegenNode(branch, keyIndex, context);
  14579. }
  14580. }
  14581. function createChildrenCodegenNode(branch, keyIndex, context) {
  14582. const { helper } = context;
  14583. const keyProperty = createObjectProperty(
  14584. `key`,
  14585. createSimpleExpression(
  14586. `${keyIndex}`,
  14587. false,
  14588. locStub,
  14589. 2
  14590. )
  14591. );
  14592. const { children } = branch;
  14593. const firstChild = children[0];
  14594. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  14595. if (needFragmentWrapper) {
  14596. if (children.length === 1 && firstChild.type === 11) {
  14597. const vnodeCall = firstChild.codegenNode;
  14598. injectProp(vnodeCall, keyProperty, context);
  14599. return vnodeCall;
  14600. } else {
  14601. let patchFlag = 64;
  14602. let patchFlagText = PatchFlagNames[64];
  14603. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  14604. patchFlag |= 2048;
  14605. patchFlagText += `, ${PatchFlagNames[2048]}`;
  14606. }
  14607. return createVNodeCall(
  14608. context,
  14609. helper(FRAGMENT),
  14610. createObjectExpression([keyProperty]),
  14611. children,
  14612. patchFlag + (` /* ${patchFlagText} */` ),
  14613. void 0,
  14614. void 0,
  14615. true,
  14616. false,
  14617. false,
  14618. branch.loc
  14619. );
  14620. }
  14621. } else {
  14622. const ret = firstChild.codegenNode;
  14623. const vnodeCall = getMemoedVNodeCall(ret);
  14624. if (vnodeCall.type === 13) {
  14625. convertToBlock(vnodeCall, context);
  14626. }
  14627. injectProp(vnodeCall, keyProperty, context);
  14628. return ret;
  14629. }
  14630. }
  14631. function isSameKey(a, b) {
  14632. if (!a || a.type !== b.type) {
  14633. return false;
  14634. }
  14635. if (a.type === 6) {
  14636. if (a.value.content !== b.value.content) {
  14637. return false;
  14638. }
  14639. } else {
  14640. const exp = a.exp;
  14641. const branchExp = b.exp;
  14642. if (exp.type !== branchExp.type) {
  14643. return false;
  14644. }
  14645. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  14646. return false;
  14647. }
  14648. }
  14649. return true;
  14650. }
  14651. function getParentCondition(node) {
  14652. while (true) {
  14653. if (node.type === 19) {
  14654. if (node.alternate.type === 19) {
  14655. node = node.alternate;
  14656. } else {
  14657. return node;
  14658. }
  14659. } else if (node.type === 20) {
  14660. node = node.value;
  14661. }
  14662. }
  14663. }
  14664. const transformFor = createStructuralDirectiveTransform(
  14665. "for",
  14666. (node, dir, context) => {
  14667. const { helper, removeHelper } = context;
  14668. return processFor(node, dir, context, (forNode) => {
  14669. const renderExp = createCallExpression(helper(RENDER_LIST), [
  14670. forNode.source
  14671. ]);
  14672. const isTemplate = isTemplateNode(node);
  14673. const memo = findDir(node, "memo");
  14674. const keyProp = findProp(node, `key`);
  14675. const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
  14676. const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
  14677. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  14678. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  14679. forNode.codegenNode = createVNodeCall(
  14680. context,
  14681. helper(FRAGMENT),
  14682. void 0,
  14683. renderExp,
  14684. fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ),
  14685. void 0,
  14686. void 0,
  14687. true,
  14688. !isStableFragment,
  14689. false,
  14690. node.loc
  14691. );
  14692. return () => {
  14693. let childBlock;
  14694. const { children } = forNode;
  14695. if (isTemplate) {
  14696. node.children.some((c) => {
  14697. if (c.type === 1) {
  14698. const key = findProp(c, "key");
  14699. if (key) {
  14700. context.onError(
  14701. createCompilerError(
  14702. 33,
  14703. key.loc
  14704. )
  14705. );
  14706. return true;
  14707. }
  14708. }
  14709. });
  14710. }
  14711. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  14712. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  14713. if (slotOutlet) {
  14714. childBlock = slotOutlet.codegenNode;
  14715. if (isTemplate && keyProperty) {
  14716. injectProp(childBlock, keyProperty, context);
  14717. }
  14718. } else if (needFragmentWrapper) {
  14719. childBlock = createVNodeCall(
  14720. context,
  14721. helper(FRAGMENT),
  14722. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  14723. node.children,
  14724. 64 + (` /* ${PatchFlagNames[64]} */` ),
  14725. void 0,
  14726. void 0,
  14727. true,
  14728. void 0,
  14729. false
  14730. );
  14731. } else {
  14732. childBlock = children[0].codegenNode;
  14733. if (isTemplate && keyProperty) {
  14734. injectProp(childBlock, keyProperty, context);
  14735. }
  14736. if (childBlock.isBlock !== !isStableFragment) {
  14737. if (childBlock.isBlock) {
  14738. removeHelper(OPEN_BLOCK);
  14739. removeHelper(
  14740. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  14741. );
  14742. } else {
  14743. removeHelper(
  14744. getVNodeHelper(context.inSSR, childBlock.isComponent)
  14745. );
  14746. }
  14747. }
  14748. childBlock.isBlock = !isStableFragment;
  14749. if (childBlock.isBlock) {
  14750. helper(OPEN_BLOCK);
  14751. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  14752. } else {
  14753. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  14754. }
  14755. }
  14756. if (memo) {
  14757. const loop = createFunctionExpression(
  14758. createForLoopParams(forNode.parseResult, [
  14759. createSimpleExpression(`_cached`)
  14760. ])
  14761. );
  14762. loop.body = createBlockStatement([
  14763. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  14764. createCompoundExpression([
  14765. `if (_cached`,
  14766. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  14767. ` && ${context.helperString(
  14768. IS_MEMO_SAME
  14769. )}(_cached, _memo)) return _cached`
  14770. ]),
  14771. createCompoundExpression([`const _item = `, childBlock]),
  14772. createSimpleExpression(`_item.memo = _memo`),
  14773. createSimpleExpression(`return _item`)
  14774. ]);
  14775. renderExp.arguments.push(
  14776. loop,
  14777. createSimpleExpression(`_cache`),
  14778. createSimpleExpression(String(context.cached++))
  14779. );
  14780. } else {
  14781. renderExp.arguments.push(
  14782. createFunctionExpression(
  14783. createForLoopParams(forNode.parseResult),
  14784. childBlock,
  14785. true
  14786. )
  14787. );
  14788. }
  14789. };
  14790. });
  14791. }
  14792. );
  14793. function processFor(node, dir, context, processCodegen) {
  14794. if (!dir.exp) {
  14795. context.onError(
  14796. createCompilerError(31, dir.loc)
  14797. );
  14798. return;
  14799. }
  14800. const parseResult = dir.forParseResult;
  14801. if (!parseResult) {
  14802. context.onError(
  14803. createCompilerError(32, dir.loc)
  14804. );
  14805. return;
  14806. }
  14807. finalizeForParseResult(parseResult, context);
  14808. const { addIdentifiers, removeIdentifiers, scopes } = context;
  14809. const { source, value, key, index } = parseResult;
  14810. const forNode = {
  14811. type: 11,
  14812. loc: dir.loc,
  14813. source,
  14814. valueAlias: value,
  14815. keyAlias: key,
  14816. objectIndexAlias: index,
  14817. parseResult,
  14818. children: isTemplateNode(node) ? node.children : [node]
  14819. };
  14820. context.replaceNode(forNode);
  14821. scopes.vFor++;
  14822. const onExit = processCodegen && processCodegen(forNode);
  14823. return () => {
  14824. scopes.vFor--;
  14825. if (onExit)
  14826. onExit();
  14827. };
  14828. }
  14829. function finalizeForParseResult(result, context) {
  14830. if (result.finalized)
  14831. return;
  14832. {
  14833. validateBrowserExpression(result.source, context);
  14834. if (result.key) {
  14835. validateBrowserExpression(
  14836. result.key,
  14837. context,
  14838. true
  14839. );
  14840. }
  14841. if (result.index) {
  14842. validateBrowserExpression(
  14843. result.index,
  14844. context,
  14845. true
  14846. );
  14847. }
  14848. if (result.value) {
  14849. validateBrowserExpression(
  14850. result.value,
  14851. context,
  14852. true
  14853. );
  14854. }
  14855. }
  14856. result.finalized = true;
  14857. }
  14858. function createForLoopParams({ value, key, index }, memoArgs = []) {
  14859. return createParamsList([value, key, index, ...memoArgs]);
  14860. }
  14861. function createParamsList(args) {
  14862. let i = args.length;
  14863. while (i--) {
  14864. if (args[i])
  14865. break;
  14866. }
  14867. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  14868. }
  14869. const defaultFallback = createSimpleExpression(`undefined`, false);
  14870. const trackSlotScopes = (node, context) => {
  14871. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  14872. const vSlot = findDir(node, "slot");
  14873. if (vSlot) {
  14874. vSlot.exp;
  14875. context.scopes.vSlot++;
  14876. return () => {
  14877. context.scopes.vSlot--;
  14878. };
  14879. }
  14880. }
  14881. };
  14882. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  14883. props,
  14884. children,
  14885. false,
  14886. true,
  14887. children.length ? children[0].loc : loc
  14888. );
  14889. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  14890. context.helper(WITH_CTX);
  14891. const { children, loc } = node;
  14892. const slotsProperties = [];
  14893. const dynamicSlots = [];
  14894. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  14895. const onComponentSlot = findDir(node, "slot", true);
  14896. if (onComponentSlot) {
  14897. const { arg, exp } = onComponentSlot;
  14898. if (arg && !isStaticExp(arg)) {
  14899. hasDynamicSlots = true;
  14900. }
  14901. slotsProperties.push(
  14902. createObjectProperty(
  14903. arg || createSimpleExpression("default", true),
  14904. buildSlotFn(exp, void 0, children, loc)
  14905. )
  14906. );
  14907. }
  14908. let hasTemplateSlots = false;
  14909. let hasNamedDefaultSlot = false;
  14910. const implicitDefaultChildren = [];
  14911. const seenSlotNames = /* @__PURE__ */ new Set();
  14912. let conditionalBranchIndex = 0;
  14913. for (let i = 0; i < children.length; i++) {
  14914. const slotElement = children[i];
  14915. let slotDir;
  14916. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  14917. if (slotElement.type !== 3) {
  14918. implicitDefaultChildren.push(slotElement);
  14919. }
  14920. continue;
  14921. }
  14922. if (onComponentSlot) {
  14923. context.onError(
  14924. createCompilerError(37, slotDir.loc)
  14925. );
  14926. break;
  14927. }
  14928. hasTemplateSlots = true;
  14929. const { children: slotChildren, loc: slotLoc } = slotElement;
  14930. const {
  14931. arg: slotName = createSimpleExpression(`default`, true),
  14932. exp: slotProps,
  14933. loc: dirLoc
  14934. } = slotDir;
  14935. let staticSlotName;
  14936. if (isStaticExp(slotName)) {
  14937. staticSlotName = slotName ? slotName.content : `default`;
  14938. } else {
  14939. hasDynamicSlots = true;
  14940. }
  14941. const vFor = findDir(slotElement, "for");
  14942. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  14943. let vIf;
  14944. let vElse;
  14945. if (vIf = findDir(slotElement, "if")) {
  14946. hasDynamicSlots = true;
  14947. dynamicSlots.push(
  14948. createConditionalExpression(
  14949. vIf.exp,
  14950. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  14951. defaultFallback
  14952. )
  14953. );
  14954. } else if (vElse = findDir(
  14955. slotElement,
  14956. /^else(-if)?$/,
  14957. true
  14958. /* allowEmpty */
  14959. )) {
  14960. let j = i;
  14961. let prev;
  14962. while (j--) {
  14963. prev = children[j];
  14964. if (prev.type !== 3) {
  14965. break;
  14966. }
  14967. }
  14968. if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
  14969. children.splice(i, 1);
  14970. i--;
  14971. let conditional = dynamicSlots[dynamicSlots.length - 1];
  14972. while (conditional.alternate.type === 19) {
  14973. conditional = conditional.alternate;
  14974. }
  14975. conditional.alternate = vElse.exp ? createConditionalExpression(
  14976. vElse.exp,
  14977. buildDynamicSlot(
  14978. slotName,
  14979. slotFunction,
  14980. conditionalBranchIndex++
  14981. ),
  14982. defaultFallback
  14983. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  14984. } else {
  14985. context.onError(
  14986. createCompilerError(30, vElse.loc)
  14987. );
  14988. }
  14989. } else if (vFor) {
  14990. hasDynamicSlots = true;
  14991. const parseResult = vFor.forParseResult;
  14992. if (parseResult) {
  14993. finalizeForParseResult(parseResult, context);
  14994. dynamicSlots.push(
  14995. createCallExpression(context.helper(RENDER_LIST), [
  14996. parseResult.source,
  14997. createFunctionExpression(
  14998. createForLoopParams(parseResult),
  14999. buildDynamicSlot(slotName, slotFunction),
  15000. true
  15001. )
  15002. ])
  15003. );
  15004. } else {
  15005. context.onError(
  15006. createCompilerError(
  15007. 32,
  15008. vFor.loc
  15009. )
  15010. );
  15011. }
  15012. } else {
  15013. if (staticSlotName) {
  15014. if (seenSlotNames.has(staticSlotName)) {
  15015. context.onError(
  15016. createCompilerError(
  15017. 38,
  15018. dirLoc
  15019. )
  15020. );
  15021. continue;
  15022. }
  15023. seenSlotNames.add(staticSlotName);
  15024. if (staticSlotName === "default") {
  15025. hasNamedDefaultSlot = true;
  15026. }
  15027. }
  15028. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  15029. }
  15030. }
  15031. if (!onComponentSlot) {
  15032. const buildDefaultSlotProperty = (props, children2) => {
  15033. const fn = buildSlotFn(props, void 0, children2, loc);
  15034. return createObjectProperty(`default`, fn);
  15035. };
  15036. if (!hasTemplateSlots) {
  15037. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  15038. } else if (implicitDefaultChildren.length && // #3766
  15039. // with whitespace: 'preserve', whitespaces between slots will end up in
  15040. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  15041. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  15042. if (hasNamedDefaultSlot) {
  15043. context.onError(
  15044. createCompilerError(
  15045. 39,
  15046. implicitDefaultChildren[0].loc
  15047. )
  15048. );
  15049. } else {
  15050. slotsProperties.push(
  15051. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  15052. );
  15053. }
  15054. }
  15055. }
  15056. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  15057. let slots = createObjectExpression(
  15058. slotsProperties.concat(
  15059. createObjectProperty(
  15060. `_`,
  15061. // 2 = compiled but dynamic = can skip normalization, but must run diff
  15062. // 1 = compiled and static = can skip normalization AND diff as optimized
  15063. createSimpleExpression(
  15064. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  15065. false
  15066. )
  15067. )
  15068. ),
  15069. loc
  15070. );
  15071. if (dynamicSlots.length) {
  15072. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  15073. slots,
  15074. createArrayExpression(dynamicSlots)
  15075. ]);
  15076. }
  15077. return {
  15078. slots,
  15079. hasDynamicSlots
  15080. };
  15081. }
  15082. function buildDynamicSlot(name, fn, index) {
  15083. const props = [
  15084. createObjectProperty(`name`, name),
  15085. createObjectProperty(`fn`, fn)
  15086. ];
  15087. if (index != null) {
  15088. props.push(
  15089. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  15090. );
  15091. }
  15092. return createObjectExpression(props);
  15093. }
  15094. function hasForwardedSlots(children) {
  15095. for (let i = 0; i < children.length; i++) {
  15096. const child = children[i];
  15097. switch (child.type) {
  15098. case 1:
  15099. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  15100. return true;
  15101. }
  15102. break;
  15103. case 9:
  15104. if (hasForwardedSlots(child.branches))
  15105. return true;
  15106. break;
  15107. case 10:
  15108. case 11:
  15109. if (hasForwardedSlots(child.children))
  15110. return true;
  15111. break;
  15112. }
  15113. }
  15114. return false;
  15115. }
  15116. function isNonWhitespaceContent(node) {
  15117. if (node.type !== 2 && node.type !== 12)
  15118. return true;
  15119. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  15120. }
  15121. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  15122. const transformElement = (node, context) => {
  15123. return function postTransformElement() {
  15124. node = context.currentNode;
  15125. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  15126. return;
  15127. }
  15128. const { tag, props } = node;
  15129. const isComponent = node.tagType === 1;
  15130. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  15131. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  15132. let vnodeProps;
  15133. let vnodeChildren;
  15134. let vnodePatchFlag;
  15135. let patchFlag = 0;
  15136. let vnodeDynamicProps;
  15137. let dynamicPropNames;
  15138. let vnodeDirectives;
  15139. let shouldUseBlock = (
  15140. // dynamic component may resolve to plain elements
  15141. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  15142. // updates inside get proper isSVG flag at runtime. (#639, #643)
  15143. // This is technically web-specific, but splitting the logic out of core
  15144. // leads to too much unnecessary complexity.
  15145. (tag === "svg" || tag === "foreignObject")
  15146. );
  15147. if (props.length > 0) {
  15148. const propsBuildResult = buildProps(
  15149. node,
  15150. context,
  15151. void 0,
  15152. isComponent,
  15153. isDynamicComponent
  15154. );
  15155. vnodeProps = propsBuildResult.props;
  15156. patchFlag = propsBuildResult.patchFlag;
  15157. dynamicPropNames = propsBuildResult.dynamicPropNames;
  15158. const directives = propsBuildResult.directives;
  15159. vnodeDirectives = directives && directives.length ? createArrayExpression(
  15160. directives.map((dir) => buildDirectiveArgs(dir, context))
  15161. ) : void 0;
  15162. if (propsBuildResult.shouldUseBlock) {
  15163. shouldUseBlock = true;
  15164. }
  15165. }
  15166. if (node.children.length > 0) {
  15167. if (vnodeTag === KEEP_ALIVE) {
  15168. shouldUseBlock = true;
  15169. patchFlag |= 1024;
  15170. if (node.children.length > 1) {
  15171. context.onError(
  15172. createCompilerError(46, {
  15173. start: node.children[0].loc.start,
  15174. end: node.children[node.children.length - 1].loc.end,
  15175. source: ""
  15176. })
  15177. );
  15178. }
  15179. }
  15180. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  15181. vnodeTag !== TELEPORT && // explained above.
  15182. vnodeTag !== KEEP_ALIVE;
  15183. if (shouldBuildAsSlots) {
  15184. const { slots, hasDynamicSlots } = buildSlots(node, context);
  15185. vnodeChildren = slots;
  15186. if (hasDynamicSlots) {
  15187. patchFlag |= 1024;
  15188. }
  15189. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  15190. const child = node.children[0];
  15191. const type = child.type;
  15192. const hasDynamicTextChild = type === 5 || type === 8;
  15193. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  15194. patchFlag |= 1;
  15195. }
  15196. if (hasDynamicTextChild || type === 2) {
  15197. vnodeChildren = child;
  15198. } else {
  15199. vnodeChildren = node.children;
  15200. }
  15201. } else {
  15202. vnodeChildren = node.children;
  15203. }
  15204. }
  15205. if (patchFlag !== 0) {
  15206. {
  15207. if (patchFlag < 0) {
  15208. vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15209. } else {
  15210. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15211. vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
  15212. }
  15213. }
  15214. if (dynamicPropNames && dynamicPropNames.length) {
  15215. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  15216. }
  15217. }
  15218. node.codegenNode = createVNodeCall(
  15219. context,
  15220. vnodeTag,
  15221. vnodeProps,
  15222. vnodeChildren,
  15223. vnodePatchFlag,
  15224. vnodeDynamicProps,
  15225. vnodeDirectives,
  15226. !!shouldUseBlock,
  15227. false,
  15228. isComponent,
  15229. node.loc
  15230. );
  15231. };
  15232. };
  15233. function resolveComponentType(node, context, ssr = false) {
  15234. let { tag } = node;
  15235. const isExplicitDynamic = isComponentTag(tag);
  15236. const isProp = findProp(
  15237. node,
  15238. "is",
  15239. false,
  15240. true
  15241. /* allow empty */
  15242. );
  15243. if (isProp) {
  15244. if (isExplicitDynamic || false) {
  15245. let exp;
  15246. if (isProp.type === 6) {
  15247. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  15248. } else {
  15249. exp = isProp.exp;
  15250. if (!exp) {
  15251. exp = createSimpleExpression(`is`, false, isProp.loc);
  15252. }
  15253. }
  15254. if (exp) {
  15255. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  15256. exp
  15257. ]);
  15258. }
  15259. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  15260. tag = isProp.value.content.slice(4);
  15261. }
  15262. }
  15263. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  15264. if (builtIn) {
  15265. if (!ssr)
  15266. context.helper(builtIn);
  15267. return builtIn;
  15268. }
  15269. context.helper(RESOLVE_COMPONENT);
  15270. context.components.add(tag);
  15271. return toValidAssetId(tag, `component`);
  15272. }
  15273. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  15274. const { tag, loc: elementLoc, children } = node;
  15275. let properties = [];
  15276. const mergeArgs = [];
  15277. const runtimeDirectives = [];
  15278. const hasChildren = children.length > 0;
  15279. let shouldUseBlock = false;
  15280. let patchFlag = 0;
  15281. let hasRef = false;
  15282. let hasClassBinding = false;
  15283. let hasStyleBinding = false;
  15284. let hasHydrationEventBinding = false;
  15285. let hasDynamicKeys = false;
  15286. let hasVnodeHook = false;
  15287. const dynamicPropNames = [];
  15288. const pushMergeArg = (arg) => {
  15289. if (properties.length) {
  15290. mergeArgs.push(
  15291. createObjectExpression(dedupeProperties(properties), elementLoc)
  15292. );
  15293. properties = [];
  15294. }
  15295. if (arg)
  15296. mergeArgs.push(arg);
  15297. };
  15298. const analyzePatchFlag = ({ key, value }) => {
  15299. if (isStaticExp(key)) {
  15300. const name = key.content;
  15301. const isEventHandler = isOn(name);
  15302. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  15303. // dedicated fast path.
  15304. name.toLowerCase() !== "onclick" && // omit v-model handlers
  15305. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  15306. !isReservedProp(name)) {
  15307. hasHydrationEventBinding = true;
  15308. }
  15309. if (isEventHandler && isReservedProp(name)) {
  15310. hasVnodeHook = true;
  15311. }
  15312. if (isEventHandler && value.type === 14) {
  15313. value = value.arguments[0];
  15314. }
  15315. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  15316. return;
  15317. }
  15318. if (name === "ref") {
  15319. hasRef = true;
  15320. } else if (name === "class") {
  15321. hasClassBinding = true;
  15322. } else if (name === "style") {
  15323. hasStyleBinding = true;
  15324. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  15325. dynamicPropNames.push(name);
  15326. }
  15327. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  15328. dynamicPropNames.push(name);
  15329. }
  15330. } else {
  15331. hasDynamicKeys = true;
  15332. }
  15333. };
  15334. for (let i = 0; i < props.length; i++) {
  15335. const prop = props[i];
  15336. if (prop.type === 6) {
  15337. const { loc, name, nameLoc, value } = prop;
  15338. let isStatic = true;
  15339. if (name === "ref") {
  15340. hasRef = true;
  15341. if (context.scopes.vFor > 0) {
  15342. properties.push(
  15343. createObjectProperty(
  15344. createSimpleExpression("ref_for", true),
  15345. createSimpleExpression("true")
  15346. )
  15347. );
  15348. }
  15349. }
  15350. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  15351. continue;
  15352. }
  15353. properties.push(
  15354. createObjectProperty(
  15355. createSimpleExpression(name, true, nameLoc),
  15356. createSimpleExpression(
  15357. value ? value.content : "",
  15358. isStatic,
  15359. value ? value.loc : loc
  15360. )
  15361. )
  15362. );
  15363. } else {
  15364. const { name, arg, exp, loc, modifiers } = prop;
  15365. const isVBind = name === "bind";
  15366. const isVOn = name === "on";
  15367. if (name === "slot") {
  15368. if (!isComponent) {
  15369. context.onError(
  15370. createCompilerError(40, loc)
  15371. );
  15372. }
  15373. continue;
  15374. }
  15375. if (name === "once" || name === "memo") {
  15376. continue;
  15377. }
  15378. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  15379. continue;
  15380. }
  15381. if (isVOn && ssr) {
  15382. continue;
  15383. }
  15384. if (
  15385. // #938: elements with dynamic keys should be forced into blocks
  15386. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  15387. // before children
  15388. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  15389. ) {
  15390. shouldUseBlock = true;
  15391. }
  15392. if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
  15393. properties.push(
  15394. createObjectProperty(
  15395. createSimpleExpression("ref_for", true),
  15396. createSimpleExpression("true")
  15397. )
  15398. );
  15399. }
  15400. if (!arg && (isVBind || isVOn)) {
  15401. hasDynamicKeys = true;
  15402. if (exp) {
  15403. if (isVBind) {
  15404. pushMergeArg();
  15405. mergeArgs.push(exp);
  15406. } else {
  15407. pushMergeArg({
  15408. type: 14,
  15409. loc,
  15410. callee: context.helper(TO_HANDLERS),
  15411. arguments: isComponent ? [exp] : [exp, `true`]
  15412. });
  15413. }
  15414. } else {
  15415. context.onError(
  15416. createCompilerError(
  15417. isVBind ? 34 : 35,
  15418. loc
  15419. )
  15420. );
  15421. }
  15422. continue;
  15423. }
  15424. if (isVBind && modifiers.includes("prop")) {
  15425. patchFlag |= 32;
  15426. }
  15427. const directiveTransform = context.directiveTransforms[name];
  15428. if (directiveTransform) {
  15429. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  15430. !ssr && props2.forEach(analyzePatchFlag);
  15431. if (isVOn && arg && !isStaticExp(arg)) {
  15432. pushMergeArg(createObjectExpression(props2, elementLoc));
  15433. } else {
  15434. properties.push(...props2);
  15435. }
  15436. if (needRuntime) {
  15437. runtimeDirectives.push(prop);
  15438. if (isSymbol(needRuntime)) {
  15439. directiveImportMap.set(prop, needRuntime);
  15440. }
  15441. }
  15442. } else if (!isBuiltInDirective(name)) {
  15443. runtimeDirectives.push(prop);
  15444. if (hasChildren) {
  15445. shouldUseBlock = true;
  15446. }
  15447. }
  15448. }
  15449. }
  15450. let propsExpression = void 0;
  15451. if (mergeArgs.length) {
  15452. pushMergeArg();
  15453. if (mergeArgs.length > 1) {
  15454. propsExpression = createCallExpression(
  15455. context.helper(MERGE_PROPS),
  15456. mergeArgs,
  15457. elementLoc
  15458. );
  15459. } else {
  15460. propsExpression = mergeArgs[0];
  15461. }
  15462. } else if (properties.length) {
  15463. propsExpression = createObjectExpression(
  15464. dedupeProperties(properties),
  15465. elementLoc
  15466. );
  15467. }
  15468. if (hasDynamicKeys) {
  15469. patchFlag |= 16;
  15470. } else {
  15471. if (hasClassBinding && !isComponent) {
  15472. patchFlag |= 2;
  15473. }
  15474. if (hasStyleBinding && !isComponent) {
  15475. patchFlag |= 4;
  15476. }
  15477. if (dynamicPropNames.length) {
  15478. patchFlag |= 8;
  15479. }
  15480. if (hasHydrationEventBinding) {
  15481. patchFlag |= 32;
  15482. }
  15483. }
  15484. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  15485. patchFlag |= 512;
  15486. }
  15487. if (!context.inSSR && propsExpression) {
  15488. switch (propsExpression.type) {
  15489. case 15:
  15490. let classKeyIndex = -1;
  15491. let styleKeyIndex = -1;
  15492. let hasDynamicKey = false;
  15493. for (let i = 0; i < propsExpression.properties.length; i++) {
  15494. const key = propsExpression.properties[i].key;
  15495. if (isStaticExp(key)) {
  15496. if (key.content === "class") {
  15497. classKeyIndex = i;
  15498. } else if (key.content === "style") {
  15499. styleKeyIndex = i;
  15500. }
  15501. } else if (!key.isHandlerKey) {
  15502. hasDynamicKey = true;
  15503. }
  15504. }
  15505. const classProp = propsExpression.properties[classKeyIndex];
  15506. const styleProp = propsExpression.properties[styleKeyIndex];
  15507. if (!hasDynamicKey) {
  15508. if (classProp && !isStaticExp(classProp.value)) {
  15509. classProp.value = createCallExpression(
  15510. context.helper(NORMALIZE_CLASS),
  15511. [classProp.value]
  15512. );
  15513. }
  15514. if (styleProp && // the static style is compiled into an object,
  15515. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  15516. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  15517. // v-bind:style with static literal object
  15518. styleProp.value.type === 17)) {
  15519. styleProp.value = createCallExpression(
  15520. context.helper(NORMALIZE_STYLE),
  15521. [styleProp.value]
  15522. );
  15523. }
  15524. } else {
  15525. propsExpression = createCallExpression(
  15526. context.helper(NORMALIZE_PROPS),
  15527. [propsExpression]
  15528. );
  15529. }
  15530. break;
  15531. case 14:
  15532. break;
  15533. default:
  15534. propsExpression = createCallExpression(
  15535. context.helper(NORMALIZE_PROPS),
  15536. [
  15537. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  15538. propsExpression
  15539. ])
  15540. ]
  15541. );
  15542. break;
  15543. }
  15544. }
  15545. return {
  15546. props: propsExpression,
  15547. directives: runtimeDirectives,
  15548. patchFlag,
  15549. dynamicPropNames,
  15550. shouldUseBlock
  15551. };
  15552. }
  15553. function dedupeProperties(properties) {
  15554. const knownProps = /* @__PURE__ */ new Map();
  15555. const deduped = [];
  15556. for (let i = 0; i < properties.length; i++) {
  15557. const prop = properties[i];
  15558. if (prop.key.type === 8 || !prop.key.isStatic) {
  15559. deduped.push(prop);
  15560. continue;
  15561. }
  15562. const name = prop.key.content;
  15563. const existing = knownProps.get(name);
  15564. if (existing) {
  15565. if (name === "style" || name === "class" || isOn(name)) {
  15566. mergeAsArray(existing, prop);
  15567. }
  15568. } else {
  15569. knownProps.set(name, prop);
  15570. deduped.push(prop);
  15571. }
  15572. }
  15573. return deduped;
  15574. }
  15575. function mergeAsArray(existing, incoming) {
  15576. if (existing.value.type === 17) {
  15577. existing.value.elements.push(incoming.value);
  15578. } else {
  15579. existing.value = createArrayExpression(
  15580. [existing.value, incoming.value],
  15581. existing.loc
  15582. );
  15583. }
  15584. }
  15585. function buildDirectiveArgs(dir, context) {
  15586. const dirArgs = [];
  15587. const runtime = directiveImportMap.get(dir);
  15588. if (runtime) {
  15589. dirArgs.push(context.helperString(runtime));
  15590. } else {
  15591. {
  15592. context.helper(RESOLVE_DIRECTIVE);
  15593. context.directives.add(dir.name);
  15594. dirArgs.push(toValidAssetId(dir.name, `directive`));
  15595. }
  15596. }
  15597. const { loc } = dir;
  15598. if (dir.exp)
  15599. dirArgs.push(dir.exp);
  15600. if (dir.arg) {
  15601. if (!dir.exp) {
  15602. dirArgs.push(`void 0`);
  15603. }
  15604. dirArgs.push(dir.arg);
  15605. }
  15606. if (Object.keys(dir.modifiers).length) {
  15607. if (!dir.arg) {
  15608. if (!dir.exp) {
  15609. dirArgs.push(`void 0`);
  15610. }
  15611. dirArgs.push(`void 0`);
  15612. }
  15613. const trueExpression = createSimpleExpression(`true`, false, loc);
  15614. dirArgs.push(
  15615. createObjectExpression(
  15616. dir.modifiers.map(
  15617. (modifier) => createObjectProperty(modifier, trueExpression)
  15618. ),
  15619. loc
  15620. )
  15621. );
  15622. }
  15623. return createArrayExpression(dirArgs, dir.loc);
  15624. }
  15625. function stringifyDynamicPropNames(props) {
  15626. let propsNamesString = `[`;
  15627. for (let i = 0, l = props.length; i < l; i++) {
  15628. propsNamesString += JSON.stringify(props[i]);
  15629. if (i < l - 1)
  15630. propsNamesString += ", ";
  15631. }
  15632. return propsNamesString + `]`;
  15633. }
  15634. function isComponentTag(tag) {
  15635. return tag === "component" || tag === "Component";
  15636. }
  15637. const transformSlotOutlet = (node, context) => {
  15638. if (isSlotOutlet(node)) {
  15639. const { children, loc } = node;
  15640. const { slotName, slotProps } = processSlotOutlet(node, context);
  15641. const slotArgs = [
  15642. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  15643. slotName,
  15644. "{}",
  15645. "undefined",
  15646. "true"
  15647. ];
  15648. let expectedLen = 2;
  15649. if (slotProps) {
  15650. slotArgs[2] = slotProps;
  15651. expectedLen = 3;
  15652. }
  15653. if (children.length) {
  15654. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  15655. expectedLen = 4;
  15656. }
  15657. if (context.scopeId && !context.slotted) {
  15658. expectedLen = 5;
  15659. }
  15660. slotArgs.splice(expectedLen);
  15661. node.codegenNode = createCallExpression(
  15662. context.helper(RENDER_SLOT),
  15663. slotArgs,
  15664. loc
  15665. );
  15666. }
  15667. };
  15668. function processSlotOutlet(node, context) {
  15669. let slotName = `"default"`;
  15670. let slotProps = void 0;
  15671. const nonNameProps = [];
  15672. for (let i = 0; i < node.props.length; i++) {
  15673. const p = node.props[i];
  15674. if (p.type === 6) {
  15675. if (p.value) {
  15676. if (p.name === "name") {
  15677. slotName = JSON.stringify(p.value.content);
  15678. } else {
  15679. p.name = camelize(p.name);
  15680. nonNameProps.push(p);
  15681. }
  15682. }
  15683. } else {
  15684. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  15685. if (p.exp) {
  15686. slotName = p.exp;
  15687. } else if (p.arg && p.arg.type === 4) {
  15688. const name = camelize(p.arg.content);
  15689. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  15690. }
  15691. } else {
  15692. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  15693. p.arg.content = camelize(p.arg.content);
  15694. }
  15695. nonNameProps.push(p);
  15696. }
  15697. }
  15698. }
  15699. if (nonNameProps.length > 0) {
  15700. const { props, directives } = buildProps(
  15701. node,
  15702. context,
  15703. nonNameProps,
  15704. false,
  15705. false
  15706. );
  15707. slotProps = props;
  15708. if (directives.length) {
  15709. context.onError(
  15710. createCompilerError(
  15711. 36,
  15712. directives[0].loc
  15713. )
  15714. );
  15715. }
  15716. }
  15717. return {
  15718. slotName,
  15719. slotProps
  15720. };
  15721. }
  15722. const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  15723. const transformOn$1 = (dir, node, context, augmentor) => {
  15724. const { loc, modifiers, arg } = dir;
  15725. if (!dir.exp && !modifiers.length) {
  15726. context.onError(createCompilerError(35, loc));
  15727. }
  15728. let eventName;
  15729. if (arg.type === 4) {
  15730. if (arg.isStatic) {
  15731. let rawName = arg.content;
  15732. if (rawName.startsWith("vnode")) {
  15733. context.onError(createCompilerError(51, arg.loc));
  15734. }
  15735. if (rawName.startsWith("vue:")) {
  15736. rawName = `vnode-${rawName.slice(4)}`;
  15737. }
  15738. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  15739. // for non-element and vnode lifecycle event listeners, auto convert
  15740. // it to camelCase. See issue #2249
  15741. toHandlerKey(camelize(rawName))
  15742. ) : (
  15743. // preserve case for plain element listeners that have uppercase
  15744. // letters, as these may be custom elements' custom events
  15745. `on:${rawName}`
  15746. );
  15747. eventName = createSimpleExpression(eventString, true, arg.loc);
  15748. } else {
  15749. eventName = createCompoundExpression([
  15750. `${context.helperString(TO_HANDLER_KEY)}(`,
  15751. arg,
  15752. `)`
  15753. ]);
  15754. }
  15755. } else {
  15756. eventName = arg;
  15757. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  15758. eventName.children.push(`)`);
  15759. }
  15760. let exp = dir.exp;
  15761. if (exp && !exp.content.trim()) {
  15762. exp = void 0;
  15763. }
  15764. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  15765. if (exp) {
  15766. const isMemberExp = isMemberExpression(exp.content);
  15767. const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
  15768. const hasMultipleStatements = exp.content.includes(`;`);
  15769. {
  15770. validateBrowserExpression(
  15771. exp,
  15772. context,
  15773. false,
  15774. hasMultipleStatements
  15775. );
  15776. }
  15777. if (isInlineStatement || shouldCache && isMemberExp) {
  15778. exp = createCompoundExpression([
  15779. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  15780. exp,
  15781. hasMultipleStatements ? `}` : `)`
  15782. ]);
  15783. }
  15784. }
  15785. let ret = {
  15786. props: [
  15787. createObjectProperty(
  15788. eventName,
  15789. exp || createSimpleExpression(`() => {}`, false, loc)
  15790. )
  15791. ]
  15792. };
  15793. if (augmentor) {
  15794. ret = augmentor(ret);
  15795. }
  15796. if (shouldCache) {
  15797. ret.props[0].value = context.cache(ret.props[0].value);
  15798. }
  15799. ret.props.forEach((p) => p.key.isHandlerKey = true);
  15800. return ret;
  15801. };
  15802. const transformBind = (dir, _node, context) => {
  15803. const { modifiers, loc } = dir;
  15804. const arg = dir.arg;
  15805. let { exp } = dir;
  15806. if (exp && exp.type === 4 && !exp.content.trim()) {
  15807. {
  15808. exp = void 0;
  15809. }
  15810. }
  15811. if (!exp) {
  15812. if (arg.type !== 4 || !arg.isStatic) {
  15813. context.onError(
  15814. createCompilerError(
  15815. 52,
  15816. arg.loc
  15817. )
  15818. );
  15819. return {
  15820. props: [
  15821. createObjectProperty(arg, createSimpleExpression("", true, loc))
  15822. ]
  15823. };
  15824. }
  15825. const propName = camelize(arg.content);
  15826. exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
  15827. }
  15828. if (arg.type !== 4) {
  15829. arg.children.unshift(`(`);
  15830. arg.children.push(`) || ""`);
  15831. } else if (!arg.isStatic) {
  15832. arg.content = `${arg.content} || ""`;
  15833. }
  15834. if (modifiers.includes("camel")) {
  15835. if (arg.type === 4) {
  15836. if (arg.isStatic) {
  15837. arg.content = camelize(arg.content);
  15838. } else {
  15839. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  15840. }
  15841. } else {
  15842. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  15843. arg.children.push(`)`);
  15844. }
  15845. }
  15846. if (!context.inSSR) {
  15847. if (modifiers.includes("prop")) {
  15848. injectPrefix(arg, ".");
  15849. }
  15850. if (modifiers.includes("attr")) {
  15851. injectPrefix(arg, "^");
  15852. }
  15853. }
  15854. return {
  15855. props: [createObjectProperty(arg, exp)]
  15856. };
  15857. };
  15858. const injectPrefix = (arg, prefix) => {
  15859. if (arg.type === 4) {
  15860. if (arg.isStatic) {
  15861. arg.content = prefix + arg.content;
  15862. } else {
  15863. arg.content = `\`${prefix}\${${arg.content}}\``;
  15864. }
  15865. } else {
  15866. arg.children.unshift(`'${prefix}' + (`);
  15867. arg.children.push(`)`);
  15868. }
  15869. };
  15870. const transformText = (node, context) => {
  15871. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  15872. return () => {
  15873. const children = node.children;
  15874. let currentContainer = void 0;
  15875. let hasText = false;
  15876. for (let i = 0; i < children.length; i++) {
  15877. const child = children[i];
  15878. if (isText$1(child)) {
  15879. hasText = true;
  15880. for (let j = i + 1; j < children.length; j++) {
  15881. const next = children[j];
  15882. if (isText$1(next)) {
  15883. if (!currentContainer) {
  15884. currentContainer = children[i] = createCompoundExpression(
  15885. [child],
  15886. child.loc
  15887. );
  15888. }
  15889. currentContainer.children.push(` + `, next);
  15890. children.splice(j, 1);
  15891. j--;
  15892. } else {
  15893. currentContainer = void 0;
  15894. break;
  15895. }
  15896. }
  15897. }
  15898. }
  15899. if (!hasText || // if this is a plain element with a single text child, leave it
  15900. // as-is since the runtime has dedicated fast path for this by directly
  15901. // setting textContent of the element.
  15902. // for component root it's always normalized anyway.
  15903. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  15904. // custom directives can potentially add DOM elements arbitrarily,
  15905. // we need to avoid setting textContent of the element at runtime
  15906. // to avoid accidentally overwriting the DOM elements added
  15907. // by the user through custom directives.
  15908. !node.props.find(
  15909. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  15910. ) && // in compat mode, <template> tags with no special directives
  15911. // will be rendered as a fragment so its children must be
  15912. // converted into vnodes.
  15913. true)) {
  15914. return;
  15915. }
  15916. for (let i = 0; i < children.length; i++) {
  15917. const child = children[i];
  15918. if (isText$1(child) || child.type === 8) {
  15919. const callArgs = [];
  15920. if (child.type !== 2 || child.content !== " ") {
  15921. callArgs.push(child);
  15922. }
  15923. if (!context.ssr && getConstantType(child, context) === 0) {
  15924. callArgs.push(
  15925. 1 + (` /* ${PatchFlagNames[1]} */` )
  15926. );
  15927. }
  15928. children[i] = {
  15929. type: 12,
  15930. content: child,
  15931. loc: child.loc,
  15932. codegenNode: createCallExpression(
  15933. context.helper(CREATE_TEXT),
  15934. callArgs
  15935. )
  15936. };
  15937. }
  15938. }
  15939. };
  15940. }
  15941. };
  15942. const seen$1 = /* @__PURE__ */ new WeakSet();
  15943. const transformOnce = (node, context) => {
  15944. if (node.type === 1 && findDir(node, "once", true)) {
  15945. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  15946. return;
  15947. }
  15948. seen$1.add(node);
  15949. context.inVOnce = true;
  15950. context.helper(SET_BLOCK_TRACKING);
  15951. return () => {
  15952. context.inVOnce = false;
  15953. const cur = context.currentNode;
  15954. if (cur.codegenNode) {
  15955. cur.codegenNode = context.cache(
  15956. cur.codegenNode,
  15957. true
  15958. /* isVNode */
  15959. );
  15960. }
  15961. };
  15962. }
  15963. };
  15964. const transformModel$1 = (dir, node, context) => {
  15965. const { exp, arg } = dir;
  15966. if (!exp) {
  15967. context.onError(
  15968. createCompilerError(41, dir.loc)
  15969. );
  15970. return createTransformProps();
  15971. }
  15972. const rawExp = exp.loc.source;
  15973. const expString = exp.type === 4 ? exp.content : rawExp;
  15974. const bindingType = context.bindingMetadata[rawExp];
  15975. if (bindingType === "props" || bindingType === "props-aliased") {
  15976. context.onError(createCompilerError(44, exp.loc));
  15977. return createTransformProps();
  15978. }
  15979. const maybeRef = false;
  15980. if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
  15981. context.onError(
  15982. createCompilerError(42, exp.loc)
  15983. );
  15984. return createTransformProps();
  15985. }
  15986. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  15987. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  15988. let assignmentExp;
  15989. const eventArg = context.isTS ? `($event: any)` : `$event`;
  15990. {
  15991. assignmentExp = createCompoundExpression([
  15992. `${eventArg} => ((`,
  15993. exp,
  15994. `) = $event)`
  15995. ]);
  15996. }
  15997. const props = [
  15998. // modelValue: foo
  15999. createObjectProperty(propName, dir.exp),
  16000. // "onUpdate:modelValue": $event => (foo = $event)
  16001. createObjectProperty(eventName, assignmentExp)
  16002. ];
  16003. if (dir.modifiers.length && node.tagType === 1) {
  16004. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  16005. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  16006. props.push(
  16007. createObjectProperty(
  16008. modifiersKey,
  16009. createSimpleExpression(
  16010. `{ ${modifiers} }`,
  16011. false,
  16012. dir.loc,
  16013. 2
  16014. )
  16015. )
  16016. );
  16017. }
  16018. return createTransformProps(props);
  16019. };
  16020. function createTransformProps(props = []) {
  16021. return { props };
  16022. }
  16023. const seen = /* @__PURE__ */ new WeakSet();
  16024. const transformMemo = (node, context) => {
  16025. if (node.type === 1) {
  16026. const dir = findDir(node, "memo");
  16027. if (!dir || seen.has(node)) {
  16028. return;
  16029. }
  16030. seen.add(node);
  16031. return () => {
  16032. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  16033. if (codegenNode && codegenNode.type === 13) {
  16034. if (node.tagType !== 1) {
  16035. convertToBlock(codegenNode, context);
  16036. }
  16037. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  16038. dir.exp,
  16039. createFunctionExpression(void 0, codegenNode),
  16040. `_cache`,
  16041. String(context.cached++)
  16042. ]);
  16043. }
  16044. };
  16045. }
  16046. };
  16047. function getBaseTransformPreset(prefixIdentifiers) {
  16048. return [
  16049. [
  16050. transformOnce,
  16051. transformIf,
  16052. transformMemo,
  16053. transformFor,
  16054. ...[],
  16055. ...[transformExpression] ,
  16056. transformSlotOutlet,
  16057. transformElement,
  16058. trackSlotScopes,
  16059. transformText
  16060. ],
  16061. {
  16062. on: transformOn$1,
  16063. bind: transformBind,
  16064. model: transformModel$1
  16065. }
  16066. ];
  16067. }
  16068. function baseCompile(source, options = {}) {
  16069. const onError = options.onError || defaultOnError;
  16070. const isModuleMode = options.mode === "module";
  16071. {
  16072. if (options.prefixIdentifiers === true) {
  16073. onError(createCompilerError(47));
  16074. } else if (isModuleMode) {
  16075. onError(createCompilerError(48));
  16076. }
  16077. }
  16078. const prefixIdentifiers = false;
  16079. if (options.cacheHandlers) {
  16080. onError(createCompilerError(49));
  16081. }
  16082. if (options.scopeId && !isModuleMode) {
  16083. onError(createCompilerError(50));
  16084. }
  16085. const resolvedOptions = extend({}, options, {
  16086. prefixIdentifiers
  16087. });
  16088. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  16089. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  16090. transform(
  16091. ast,
  16092. extend({}, resolvedOptions, {
  16093. nodeTransforms: [
  16094. ...nodeTransforms,
  16095. ...options.nodeTransforms || []
  16096. // user transforms
  16097. ],
  16098. directiveTransforms: extend(
  16099. {},
  16100. directiveTransforms,
  16101. options.directiveTransforms || {}
  16102. // user transforms
  16103. )
  16104. })
  16105. );
  16106. return generate(ast, resolvedOptions);
  16107. }
  16108. const noopDirectiveTransform = () => ({ props: [] });
  16109. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  16110. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  16111. const V_MODEL_TEXT = Symbol(`vModelText` );
  16112. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  16113. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  16114. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  16115. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  16116. const V_SHOW = Symbol(`vShow` );
  16117. const TRANSITION = Symbol(`Transition` );
  16118. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  16119. registerRuntimeHelpers({
  16120. [V_MODEL_RADIO]: `vModelRadio`,
  16121. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  16122. [V_MODEL_TEXT]: `vModelText`,
  16123. [V_MODEL_SELECT]: `vModelSelect`,
  16124. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  16125. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  16126. [V_ON_WITH_KEYS]: `withKeys`,
  16127. [V_SHOW]: `vShow`,
  16128. [TRANSITION]: `Transition`,
  16129. [TRANSITION_GROUP]: `TransitionGroup`
  16130. });
  16131. let decoder;
  16132. function decodeHtmlBrowser(raw, asAttr = false) {
  16133. if (!decoder) {
  16134. decoder = document.createElement("div");
  16135. }
  16136. if (asAttr) {
  16137. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  16138. return decoder.children[0].getAttribute("foo");
  16139. } else {
  16140. decoder.innerHTML = raw;
  16141. return decoder.textContent;
  16142. }
  16143. }
  16144. const parserOptions = {
  16145. parseMode: "html",
  16146. isVoidTag,
  16147. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  16148. isPreTag: (tag) => tag === "pre",
  16149. decodeEntities: decodeHtmlBrowser ,
  16150. isBuiltInComponent: (tag) => {
  16151. if (tag === "Transition" || tag === "transition") {
  16152. return TRANSITION;
  16153. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  16154. return TRANSITION_GROUP;
  16155. }
  16156. },
  16157. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  16158. getNamespace(tag, parent, rootNamespace) {
  16159. let ns = parent ? parent.ns : rootNamespace;
  16160. if (parent && ns === 2) {
  16161. if (parent.tag === "annotation-xml") {
  16162. if (tag === "svg") {
  16163. return 1;
  16164. }
  16165. if (parent.props.some(
  16166. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  16167. )) {
  16168. ns = 0;
  16169. }
  16170. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  16171. ns = 0;
  16172. }
  16173. } else if (parent && ns === 1) {
  16174. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  16175. ns = 0;
  16176. }
  16177. }
  16178. if (ns === 0) {
  16179. if (tag === "svg") {
  16180. return 1;
  16181. }
  16182. if (tag === "math") {
  16183. return 2;
  16184. }
  16185. }
  16186. return ns;
  16187. }
  16188. };
  16189. const transformStyle = (node) => {
  16190. if (node.type === 1) {
  16191. node.props.forEach((p, i) => {
  16192. if (p.type === 6 && p.name === "style" && p.value) {
  16193. node.props[i] = {
  16194. type: 7,
  16195. name: `bind`,
  16196. arg: createSimpleExpression(`style`, true, p.loc),
  16197. exp: parseInlineCSS(p.value.content, p.loc),
  16198. modifiers: [],
  16199. loc: p.loc
  16200. };
  16201. }
  16202. });
  16203. }
  16204. };
  16205. const parseInlineCSS = (cssText, loc) => {
  16206. const normalized = parseStringStyle(cssText);
  16207. return createSimpleExpression(
  16208. JSON.stringify(normalized),
  16209. false,
  16210. loc,
  16211. 3
  16212. );
  16213. };
  16214. function createDOMCompilerError(code, loc) {
  16215. return createCompilerError(
  16216. code,
  16217. loc,
  16218. DOMErrorMessages
  16219. );
  16220. }
  16221. const DOMErrorMessages = {
  16222. [53]: `v-html is missing expression.`,
  16223. [54]: `v-html will override element children.`,
  16224. [55]: `v-text is missing expression.`,
  16225. [56]: `v-text will override element children.`,
  16226. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  16227. [58]: `v-model argument is not supported on plain elements.`,
  16228. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  16229. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  16230. [61]: `v-show is missing expression.`,
  16231. [62]: `<Transition> expects exactly one child element or component.`,
  16232. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  16233. };
  16234. const transformVHtml = (dir, node, context) => {
  16235. const { exp, loc } = dir;
  16236. if (!exp) {
  16237. context.onError(
  16238. createDOMCompilerError(53, loc)
  16239. );
  16240. }
  16241. if (node.children.length) {
  16242. context.onError(
  16243. createDOMCompilerError(54, loc)
  16244. );
  16245. node.children.length = 0;
  16246. }
  16247. return {
  16248. props: [
  16249. createObjectProperty(
  16250. createSimpleExpression(`innerHTML`, true, loc),
  16251. exp || createSimpleExpression("", true)
  16252. )
  16253. ]
  16254. };
  16255. };
  16256. const transformVText = (dir, node, context) => {
  16257. const { exp, loc } = dir;
  16258. if (!exp) {
  16259. context.onError(
  16260. createDOMCompilerError(55, loc)
  16261. );
  16262. }
  16263. if (node.children.length) {
  16264. context.onError(
  16265. createDOMCompilerError(56, loc)
  16266. );
  16267. node.children.length = 0;
  16268. }
  16269. return {
  16270. props: [
  16271. createObjectProperty(
  16272. createSimpleExpression(`textContent`, true),
  16273. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  16274. context.helperString(TO_DISPLAY_STRING),
  16275. [exp],
  16276. loc
  16277. ) : createSimpleExpression("", true)
  16278. )
  16279. ]
  16280. };
  16281. };
  16282. const transformModel = (dir, node, context) => {
  16283. const baseResult = transformModel$1(dir, node, context);
  16284. if (!baseResult.props.length || node.tagType === 1) {
  16285. return baseResult;
  16286. }
  16287. if (dir.arg) {
  16288. context.onError(
  16289. createDOMCompilerError(
  16290. 58,
  16291. dir.arg.loc
  16292. )
  16293. );
  16294. }
  16295. function checkDuplicatedValue() {
  16296. const value = findDir(node, "bind");
  16297. if (value && isStaticArgOf(value.arg, "value")) {
  16298. context.onError(
  16299. createDOMCompilerError(
  16300. 60,
  16301. value.loc
  16302. )
  16303. );
  16304. }
  16305. }
  16306. const { tag } = node;
  16307. const isCustomElement = context.isCustomElement(tag);
  16308. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  16309. let directiveToUse = V_MODEL_TEXT;
  16310. let isInvalidType = false;
  16311. if (tag === "input" || isCustomElement) {
  16312. const type = findProp(node, `type`);
  16313. if (type) {
  16314. if (type.type === 7) {
  16315. directiveToUse = V_MODEL_DYNAMIC;
  16316. } else if (type.value) {
  16317. switch (type.value.content) {
  16318. case "radio":
  16319. directiveToUse = V_MODEL_RADIO;
  16320. break;
  16321. case "checkbox":
  16322. directiveToUse = V_MODEL_CHECKBOX;
  16323. break;
  16324. case "file":
  16325. isInvalidType = true;
  16326. context.onError(
  16327. createDOMCompilerError(
  16328. 59,
  16329. dir.loc
  16330. )
  16331. );
  16332. break;
  16333. default:
  16334. checkDuplicatedValue();
  16335. break;
  16336. }
  16337. }
  16338. } else if (hasDynamicKeyVBind(node)) {
  16339. directiveToUse = V_MODEL_DYNAMIC;
  16340. } else {
  16341. checkDuplicatedValue();
  16342. }
  16343. } else if (tag === "select") {
  16344. directiveToUse = V_MODEL_SELECT;
  16345. } else {
  16346. checkDuplicatedValue();
  16347. }
  16348. if (!isInvalidType) {
  16349. baseResult.needRuntime = context.helper(directiveToUse);
  16350. }
  16351. } else {
  16352. context.onError(
  16353. createDOMCompilerError(
  16354. 57,
  16355. dir.loc
  16356. )
  16357. );
  16358. }
  16359. baseResult.props = baseResult.props.filter(
  16360. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  16361. );
  16362. return baseResult;
  16363. };
  16364. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  16365. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  16366. // event propagation management
  16367. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  16368. );
  16369. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  16370. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  16371. `onkeyup,onkeydown,onkeypress`,
  16372. true
  16373. );
  16374. const resolveModifiers = (key, modifiers, context, loc) => {
  16375. const keyModifiers = [];
  16376. const nonKeyModifiers = [];
  16377. const eventOptionModifiers = [];
  16378. for (let i = 0; i < modifiers.length; i++) {
  16379. const modifier = modifiers[i];
  16380. if (isEventOptionModifier(modifier)) {
  16381. eventOptionModifiers.push(modifier);
  16382. } else {
  16383. if (maybeKeyModifier(modifier)) {
  16384. if (isStaticExp(key)) {
  16385. if (isKeyboardEvent(key.content)) {
  16386. keyModifiers.push(modifier);
  16387. } else {
  16388. nonKeyModifiers.push(modifier);
  16389. }
  16390. } else {
  16391. keyModifiers.push(modifier);
  16392. nonKeyModifiers.push(modifier);
  16393. }
  16394. } else {
  16395. if (isNonKeyModifier(modifier)) {
  16396. nonKeyModifiers.push(modifier);
  16397. } else {
  16398. keyModifiers.push(modifier);
  16399. }
  16400. }
  16401. }
  16402. }
  16403. return {
  16404. keyModifiers,
  16405. nonKeyModifiers,
  16406. eventOptionModifiers
  16407. };
  16408. };
  16409. const transformClick = (key, event) => {
  16410. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  16411. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  16412. `(`,
  16413. key,
  16414. `) === "onClick" ? "${event}" : (`,
  16415. key,
  16416. `)`
  16417. ]) : key;
  16418. };
  16419. const transformOn = (dir, node, context) => {
  16420. return transformOn$1(dir, node, context, (baseResult) => {
  16421. const { modifiers } = dir;
  16422. if (!modifiers.length)
  16423. return baseResult;
  16424. let { key, value: handlerExp } = baseResult.props[0];
  16425. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  16426. if (nonKeyModifiers.includes("right")) {
  16427. key = transformClick(key, `onContextmenu`);
  16428. }
  16429. if (nonKeyModifiers.includes("middle")) {
  16430. key = transformClick(key, `onMouseup`);
  16431. }
  16432. if (nonKeyModifiers.length) {
  16433. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  16434. handlerExp,
  16435. JSON.stringify(nonKeyModifiers)
  16436. ]);
  16437. }
  16438. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  16439. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  16440. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  16441. handlerExp,
  16442. JSON.stringify(keyModifiers)
  16443. ]);
  16444. }
  16445. if (eventOptionModifiers.length) {
  16446. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  16447. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  16448. }
  16449. return {
  16450. props: [createObjectProperty(key, handlerExp)]
  16451. };
  16452. });
  16453. };
  16454. const transformShow = (dir, node, context) => {
  16455. const { exp, loc } = dir;
  16456. if (!exp) {
  16457. context.onError(
  16458. createDOMCompilerError(61, loc)
  16459. );
  16460. }
  16461. return {
  16462. props: [],
  16463. needRuntime: context.helper(V_SHOW)
  16464. };
  16465. };
  16466. const transformTransition = (node, context) => {
  16467. if (node.type === 1 && node.tagType === 1) {
  16468. const component = context.isBuiltInComponent(node.tag);
  16469. if (component === TRANSITION) {
  16470. return () => {
  16471. if (!node.children.length) {
  16472. return;
  16473. }
  16474. if (hasMultipleChildren(node)) {
  16475. context.onError(
  16476. createDOMCompilerError(
  16477. 62,
  16478. {
  16479. start: node.children[0].loc.start,
  16480. end: node.children[node.children.length - 1].loc.end,
  16481. source: ""
  16482. }
  16483. )
  16484. );
  16485. }
  16486. const child = node.children[0];
  16487. if (child.type === 1) {
  16488. for (const p of child.props) {
  16489. if (p.type === 7 && p.name === "show") {
  16490. node.props.push({
  16491. type: 6,
  16492. name: "persisted",
  16493. nameLoc: node.loc,
  16494. value: void 0,
  16495. loc: node.loc
  16496. });
  16497. }
  16498. }
  16499. }
  16500. };
  16501. }
  16502. }
  16503. };
  16504. function hasMultipleChildren(node) {
  16505. const children = node.children = node.children.filter(
  16506. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  16507. );
  16508. const child = children[0];
  16509. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  16510. }
  16511. const ignoreSideEffectTags = (node, context) => {
  16512. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  16513. context.onError(
  16514. createDOMCompilerError(
  16515. 63,
  16516. node.loc
  16517. )
  16518. );
  16519. context.removeNode();
  16520. }
  16521. };
  16522. const DOMNodeTransforms = [
  16523. transformStyle,
  16524. ...[transformTransition]
  16525. ];
  16526. const DOMDirectiveTransforms = {
  16527. cloak: noopDirectiveTransform,
  16528. html: transformVHtml,
  16529. text: transformVText,
  16530. model: transformModel,
  16531. // override compiler-core
  16532. on: transformOn,
  16533. // override compiler-core
  16534. show: transformShow
  16535. };
  16536. function compile(src, options = {}) {
  16537. return baseCompile(
  16538. src,
  16539. extend({}, parserOptions, options, {
  16540. nodeTransforms: [
  16541. // ignore <script> and <tag>
  16542. // this is not put inside DOMNodeTransforms because that list is used
  16543. // by compiler-ssr to generate vnode fallback branches
  16544. ignoreSideEffectTags,
  16545. ...DOMNodeTransforms,
  16546. ...options.nodeTransforms || []
  16547. ],
  16548. directiveTransforms: extend(
  16549. {},
  16550. DOMDirectiveTransforms,
  16551. options.directiveTransforms || {}
  16552. ),
  16553. transformHoist: null
  16554. })
  16555. );
  16556. }
  16557. {
  16558. initDev();
  16559. }
  16560. const compileCache = /* @__PURE__ */ new WeakMap();
  16561. function getCache(options) {
  16562. let c = compileCache.get(options != null ? options : EMPTY_OBJ);
  16563. if (!c) {
  16564. c = /* @__PURE__ */ Object.create(null);
  16565. compileCache.set(options != null ? options : EMPTY_OBJ, c);
  16566. }
  16567. return c;
  16568. }
  16569. function compileToFunction(template, options) {
  16570. if (!isString(template)) {
  16571. if (template.nodeType) {
  16572. template = template.innerHTML;
  16573. } else {
  16574. warn(`invalid template option: `, template);
  16575. return NOOP;
  16576. }
  16577. }
  16578. const key = template;
  16579. const cache = getCache(options);
  16580. const cached = cache[key];
  16581. if (cached) {
  16582. return cached;
  16583. }
  16584. if (template[0] === "#") {
  16585. const el = document.querySelector(template);
  16586. if (!el) {
  16587. warn(`Template element not found or is empty: ${template}`);
  16588. }
  16589. template = el ? el.innerHTML : ``;
  16590. }
  16591. const opts = extend(
  16592. {
  16593. hoistStatic: true,
  16594. onError: onError ,
  16595. onWarn: (e) => onError(e, true)
  16596. },
  16597. options
  16598. );
  16599. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  16600. opts.isCustomElement = (tag) => !!customElements.get(tag);
  16601. }
  16602. const { code } = compile(template, opts);
  16603. function onError(err, asWarning = false) {
  16604. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  16605. const codeFrame = err.loc && generateCodeFrame(
  16606. template,
  16607. err.loc.start.offset,
  16608. err.loc.end.offset
  16609. );
  16610. warn(codeFrame ? `${message}
  16611. ${codeFrame}` : message);
  16612. }
  16613. const render = new Function("Vue", code)(runtimeDom);
  16614. render._rc = true;
  16615. return cache[key] = render;
  16616. }
  16617. registerRuntimeCompiler(compileToFunction);
  16618. 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, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, 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, 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, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };