399e1d5645aacd6f51bafbb221da3941a03a69f340eac76cbbd7ac17116ef13166cda1e9b4253370bf1ba7a84eb8c2b7b7aacea716d910cd7858fdf8913eae 555 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249
  1. /**
  2. * vue v3.5.21
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. var Vue = (function (exports) {
  7. 'use strict';
  8. // @__NO_SIDE_EFFECTS__
  9. function makeMap(str) {
  10. const map = /* @__PURE__ */ Object.create(null);
  11. for (const key of str.split(",")) map[key] = 1;
  12. return (val) => val in map;
  13. }
  14. const EMPTY_OBJ = Object.freeze({}) ;
  15. const EMPTY_ARR = Object.freeze([]) ;
  16. const NOOP = () => {
  17. };
  18. const NO = () => false;
  19. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  20. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  21. const isModelListener = (key) => key.startsWith("onUpdate:");
  22. const extend = Object.assign;
  23. const remove = (arr, el) => {
  24. const i = arr.indexOf(el);
  25. if (i > -1) {
  26. arr.splice(i, 1);
  27. }
  28. };
  29. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  30. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  31. const isArray = Array.isArray;
  32. const isMap = (val) => toTypeString(val) === "[object Map]";
  33. const isSet = (val) => toTypeString(val) === "[object Set]";
  34. const isDate = (val) => toTypeString(val) === "[object Date]";
  35. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  36. const isFunction = (val) => typeof val === "function";
  37. const isString = (val) => typeof val === "string";
  38. const isSymbol = (val) => typeof val === "symbol";
  39. const isObject = (val) => val !== null && typeof val === "object";
  40. const isPromise = (val) => {
  41. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  42. };
  43. const objectToString = Object.prototype.toString;
  44. const toTypeString = (value) => objectToString.call(value);
  45. const toRawType = (value) => {
  46. return toTypeString(value).slice(8, -1);
  47. };
  48. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  49. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  50. const isReservedProp = /* @__PURE__ */ makeMap(
  51. // the leading comma is intentional so empty string "" is also included
  52. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  53. );
  54. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  55. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  56. );
  57. const cacheStringFunction = (fn) => {
  58. const cache = /* @__PURE__ */ Object.create(null);
  59. return ((str) => {
  60. const hit = cache[str];
  61. return hit || (cache[str] = fn(str));
  62. });
  63. };
  64. const camelizeRE = /-\w/g;
  65. const camelize = cacheStringFunction(
  66. (str) => {
  67. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  68. }
  69. );
  70. const hyphenateRE = /\B([A-Z])/g;
  71. const hyphenate = cacheStringFunction(
  72. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  73. );
  74. const capitalize = cacheStringFunction((str) => {
  75. return str.charAt(0).toUpperCase() + str.slice(1);
  76. });
  77. const toHandlerKey = cacheStringFunction(
  78. (str) => {
  79. const s = str ? `on${capitalize(str)}` : ``;
  80. return s;
  81. }
  82. );
  83. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  84. const invokeArrayFns = (fns, ...arg) => {
  85. for (let i = 0; i < fns.length; i++) {
  86. fns[i](...arg);
  87. }
  88. };
  89. const def = (obj, key, value, writable = false) => {
  90. Object.defineProperty(obj, key, {
  91. configurable: true,
  92. enumerable: false,
  93. writable,
  94. value
  95. });
  96. };
  97. const looseToNumber = (val) => {
  98. const n = parseFloat(val);
  99. return isNaN(n) ? val : n;
  100. };
  101. const toNumber = (val) => {
  102. const n = isString(val) ? Number(val) : NaN;
  103. return isNaN(n) ? val : n;
  104. };
  105. let _globalThis;
  106. const getGlobalThis = () => {
  107. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  108. };
  109. function genCacheKey(source, options) {
  110. return source + JSON.stringify(
  111. options,
  112. (_, val) => typeof val === "function" ? val.toString() : val
  113. );
  114. }
  115. const PatchFlagNames = {
  116. [1]: `TEXT`,
  117. [2]: `CLASS`,
  118. [4]: `STYLE`,
  119. [8]: `PROPS`,
  120. [16]: `FULL_PROPS`,
  121. [32]: `NEED_HYDRATION`,
  122. [64]: `STABLE_FRAGMENT`,
  123. [128]: `KEYED_FRAGMENT`,
  124. [256]: `UNKEYED_FRAGMENT`,
  125. [512]: `NEED_PATCH`,
  126. [1024]: `DYNAMIC_SLOTS`,
  127. [2048]: `DEV_ROOT_FRAGMENT`,
  128. [-1]: `CACHED`,
  129. [-2]: `BAIL`
  130. };
  131. const slotFlagsText = {
  132. [1]: "STABLE",
  133. [2]: "DYNAMIC",
  134. [3]: "FORWARDED"
  135. };
  136. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  137. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  138. const range = 2;
  139. function generateCodeFrame(source, start = 0, end = source.length) {
  140. start = Math.max(0, Math.min(start, source.length));
  141. end = Math.max(0, Math.min(end, source.length));
  142. if (start > end) return "";
  143. let lines = source.split(/(\r?\n)/);
  144. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  145. lines = lines.filter((_, idx) => idx % 2 === 0);
  146. let count = 0;
  147. const res = [];
  148. for (let i = 0; i < lines.length; i++) {
  149. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  150. if (count >= start) {
  151. for (let j = i - range; j <= i + range || end > count; j++) {
  152. if (j < 0 || j >= lines.length) continue;
  153. const line = j + 1;
  154. res.push(
  155. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  156. );
  157. const lineLength = lines[j].length;
  158. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  159. if (j === i) {
  160. const pad = start - (count - (lineLength + newLineSeqLength));
  161. const length = Math.max(
  162. 1,
  163. end > count ? lineLength - pad : end - start
  164. );
  165. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  166. } else if (j > i) {
  167. if (end > count) {
  168. const length = Math.max(Math.min(end - count, lineLength), 1);
  169. res.push(` | ` + "^".repeat(length));
  170. }
  171. count += lineLength + newLineSeqLength;
  172. }
  173. }
  174. break;
  175. }
  176. }
  177. return res.join("\n");
  178. }
  179. function normalizeStyle(value) {
  180. if (isArray(value)) {
  181. const res = {};
  182. for (let i = 0; i < value.length; i++) {
  183. const item = value[i];
  184. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  185. if (normalized) {
  186. for (const key in normalized) {
  187. res[key] = normalized[key];
  188. }
  189. }
  190. }
  191. return res;
  192. } else if (isString(value) || isObject(value)) {
  193. return value;
  194. }
  195. }
  196. const listDelimiterRE = /;(?![^(]*\))/g;
  197. const propertyDelimiterRE = /:([^]+)/;
  198. const styleCommentRE = /\/\*[^]*?\*\//g;
  199. function parseStringStyle(cssText) {
  200. const ret = {};
  201. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  202. if (item) {
  203. const tmp = item.split(propertyDelimiterRE);
  204. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  205. }
  206. });
  207. return ret;
  208. }
  209. function stringifyStyle(styles) {
  210. if (!styles) return "";
  211. if (isString(styles)) return styles;
  212. let ret = "";
  213. for (const key in styles) {
  214. const value = styles[key];
  215. if (isString(value) || typeof value === "number") {
  216. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  217. ret += `${normalizedKey}:${value};`;
  218. }
  219. }
  220. return ret;
  221. }
  222. function normalizeClass(value) {
  223. let res = "";
  224. if (isString(value)) {
  225. res = value;
  226. } else if (isArray(value)) {
  227. for (let i = 0; i < value.length; i++) {
  228. const normalized = normalizeClass(value[i]);
  229. if (normalized) {
  230. res += normalized + " ";
  231. }
  232. }
  233. } else if (isObject(value)) {
  234. for (const name in value) {
  235. if (value[name]) {
  236. res += name + " ";
  237. }
  238. }
  239. }
  240. return res.trim();
  241. }
  242. function normalizeProps(props) {
  243. if (!props) return null;
  244. let { class: klass, style } = props;
  245. if (klass && !isString(klass)) {
  246. props.class = normalizeClass(klass);
  247. }
  248. if (style) {
  249. props.style = normalizeStyle(style);
  250. }
  251. return props;
  252. }
  253. 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";
  254. 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";
  255. 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";
  256. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  257. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  258. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  259. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  260. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  261. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  262. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  263. const isBooleanAttr = /* @__PURE__ */ makeMap(
  264. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  265. );
  266. function includeBooleanAttr(value) {
  267. return !!value || value === "";
  268. }
  269. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  270. `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`
  271. );
  272. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  273. `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`
  274. );
  275. function isRenderableAttrValue(value) {
  276. if (value == null) {
  277. return false;
  278. }
  279. const type = typeof value;
  280. return type === "string" || type === "number" || type === "boolean";
  281. }
  282. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  283. function getEscapedCssVarName(key, doubleEscape) {
  284. return key.replace(
  285. cssVarNameEscapeSymbolsRE,
  286. (s) => `\\${s}`
  287. );
  288. }
  289. function looseCompareArrays(a, b) {
  290. if (a.length !== b.length) return false;
  291. let equal = true;
  292. for (let i = 0; equal && i < a.length; i++) {
  293. equal = looseEqual(a[i], b[i]);
  294. }
  295. return equal;
  296. }
  297. function looseEqual(a, b) {
  298. if (a === b) return true;
  299. let aValidType = isDate(a);
  300. let bValidType = isDate(b);
  301. if (aValidType || bValidType) {
  302. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  303. }
  304. aValidType = isSymbol(a);
  305. bValidType = isSymbol(b);
  306. if (aValidType || bValidType) {
  307. return a === b;
  308. }
  309. aValidType = isArray(a);
  310. bValidType = isArray(b);
  311. if (aValidType || bValidType) {
  312. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  313. }
  314. aValidType = isObject(a);
  315. bValidType = isObject(b);
  316. if (aValidType || bValidType) {
  317. if (!aValidType || !bValidType) {
  318. return false;
  319. }
  320. const aKeysCount = Object.keys(a).length;
  321. const bKeysCount = Object.keys(b).length;
  322. if (aKeysCount !== bKeysCount) {
  323. return false;
  324. }
  325. for (const key in a) {
  326. const aHasKey = a.hasOwnProperty(key);
  327. const bHasKey = b.hasOwnProperty(key);
  328. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  329. return false;
  330. }
  331. }
  332. }
  333. return String(a) === String(b);
  334. }
  335. function looseIndexOf(arr, val) {
  336. return arr.findIndex((item) => looseEqual(item, val));
  337. }
  338. const isRef$1 = (val) => {
  339. return !!(val && val["__v_isRef"] === true);
  340. };
  341. const toDisplayString = (val) => {
  342. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  343. };
  344. const replacer = (_key, val) => {
  345. if (isRef$1(val)) {
  346. return replacer(_key, val.value);
  347. } else if (isMap(val)) {
  348. return {
  349. [`Map(${val.size})`]: [...val.entries()].reduce(
  350. (entries, [key, val2], i) => {
  351. entries[stringifySymbol(key, i) + " =>"] = val2;
  352. return entries;
  353. },
  354. {}
  355. )
  356. };
  357. } else if (isSet(val)) {
  358. return {
  359. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  360. };
  361. } else if (isSymbol(val)) {
  362. return stringifySymbol(val);
  363. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  364. return String(val);
  365. }
  366. return val;
  367. };
  368. const stringifySymbol = (v, i = "") => {
  369. var _a;
  370. return (
  371. // Symbol.description in es2019+ so we need to cast here to pass
  372. // the lib: es2016 check
  373. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  374. );
  375. };
  376. function normalizeCssVarValue(value) {
  377. if (value == null) {
  378. return "initial";
  379. }
  380. if (typeof value === "string") {
  381. return value === "" ? " " : value;
  382. }
  383. if (typeof value !== "number" || !Number.isFinite(value)) {
  384. {
  385. console.warn(
  386. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  387. value
  388. );
  389. }
  390. }
  391. return String(value);
  392. }
  393. function warn$2(msg, ...args) {
  394. console.warn(`[Vue warn] ${msg}`, ...args);
  395. }
  396. let activeEffectScope;
  397. class EffectScope {
  398. constructor(detached = false) {
  399. this.detached = detached;
  400. /**
  401. * @internal
  402. */
  403. this._active = true;
  404. /**
  405. * @internal track `on` calls, allow `on` call multiple times
  406. */
  407. this._on = 0;
  408. /**
  409. * @internal
  410. */
  411. this.effects = [];
  412. /**
  413. * @internal
  414. */
  415. this.cleanups = [];
  416. this._isPaused = false;
  417. this.parent = activeEffectScope;
  418. if (!detached && activeEffectScope) {
  419. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  420. this
  421. ) - 1;
  422. }
  423. }
  424. get active() {
  425. return this._active;
  426. }
  427. pause() {
  428. if (this._active) {
  429. this._isPaused = true;
  430. let i, l;
  431. if (this.scopes) {
  432. for (i = 0, l = this.scopes.length; i < l; i++) {
  433. this.scopes[i].pause();
  434. }
  435. }
  436. for (i = 0, l = this.effects.length; i < l; i++) {
  437. this.effects[i].pause();
  438. }
  439. }
  440. }
  441. /**
  442. * Resumes the effect scope, including all child scopes and effects.
  443. */
  444. resume() {
  445. if (this._active) {
  446. if (this._isPaused) {
  447. this._isPaused = false;
  448. let i, l;
  449. if (this.scopes) {
  450. for (i = 0, l = this.scopes.length; i < l; i++) {
  451. this.scopes[i].resume();
  452. }
  453. }
  454. for (i = 0, l = this.effects.length; i < l; i++) {
  455. this.effects[i].resume();
  456. }
  457. }
  458. }
  459. }
  460. run(fn) {
  461. if (this._active) {
  462. const currentEffectScope = activeEffectScope;
  463. try {
  464. activeEffectScope = this;
  465. return fn();
  466. } finally {
  467. activeEffectScope = currentEffectScope;
  468. }
  469. } else {
  470. warn$2(`cannot run an inactive effect scope.`);
  471. }
  472. }
  473. /**
  474. * This should only be called on non-detached scopes
  475. * @internal
  476. */
  477. on() {
  478. if (++this._on === 1) {
  479. this.prevScope = activeEffectScope;
  480. activeEffectScope = this;
  481. }
  482. }
  483. /**
  484. * This should only be called on non-detached scopes
  485. * @internal
  486. */
  487. off() {
  488. if (this._on > 0 && --this._on === 0) {
  489. activeEffectScope = this.prevScope;
  490. this.prevScope = void 0;
  491. }
  492. }
  493. stop(fromParent) {
  494. if (this._active) {
  495. this._active = false;
  496. let i, l;
  497. for (i = 0, l = this.effects.length; i < l; i++) {
  498. this.effects[i].stop();
  499. }
  500. this.effects.length = 0;
  501. for (i = 0, l = this.cleanups.length; i < l; i++) {
  502. this.cleanups[i]();
  503. }
  504. this.cleanups.length = 0;
  505. if (this.scopes) {
  506. for (i = 0, l = this.scopes.length; i < l; i++) {
  507. this.scopes[i].stop(true);
  508. }
  509. this.scopes.length = 0;
  510. }
  511. if (!this.detached && this.parent && !fromParent) {
  512. const last = this.parent.scopes.pop();
  513. if (last && last !== this) {
  514. this.parent.scopes[this.index] = last;
  515. last.index = this.index;
  516. }
  517. }
  518. this.parent = void 0;
  519. }
  520. }
  521. }
  522. function effectScope(detached) {
  523. return new EffectScope(detached);
  524. }
  525. function getCurrentScope() {
  526. return activeEffectScope;
  527. }
  528. function onScopeDispose(fn, failSilently = false) {
  529. if (activeEffectScope) {
  530. activeEffectScope.cleanups.push(fn);
  531. } else if (!failSilently) {
  532. warn$2(
  533. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  534. );
  535. }
  536. }
  537. let activeSub;
  538. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  539. class ReactiveEffect {
  540. constructor(fn) {
  541. this.fn = fn;
  542. /**
  543. * @internal
  544. */
  545. this.deps = void 0;
  546. /**
  547. * @internal
  548. */
  549. this.depsTail = void 0;
  550. /**
  551. * @internal
  552. */
  553. this.flags = 1 | 4;
  554. /**
  555. * @internal
  556. */
  557. this.next = void 0;
  558. /**
  559. * @internal
  560. */
  561. this.cleanup = void 0;
  562. this.scheduler = void 0;
  563. if (activeEffectScope && activeEffectScope.active) {
  564. activeEffectScope.effects.push(this);
  565. }
  566. }
  567. pause() {
  568. this.flags |= 64;
  569. }
  570. resume() {
  571. if (this.flags & 64) {
  572. this.flags &= -65;
  573. if (pausedQueueEffects.has(this)) {
  574. pausedQueueEffects.delete(this);
  575. this.trigger();
  576. }
  577. }
  578. }
  579. /**
  580. * @internal
  581. */
  582. notify() {
  583. if (this.flags & 2 && !(this.flags & 32)) {
  584. return;
  585. }
  586. if (!(this.flags & 8)) {
  587. batch(this);
  588. }
  589. }
  590. run() {
  591. if (!(this.flags & 1)) {
  592. return this.fn();
  593. }
  594. this.flags |= 2;
  595. cleanupEffect(this);
  596. prepareDeps(this);
  597. const prevEffect = activeSub;
  598. const prevShouldTrack = shouldTrack;
  599. activeSub = this;
  600. shouldTrack = true;
  601. try {
  602. return this.fn();
  603. } finally {
  604. if (activeSub !== this) {
  605. warn$2(
  606. "Active effect was not restored correctly - this is likely a Vue internal bug."
  607. );
  608. }
  609. cleanupDeps(this);
  610. activeSub = prevEffect;
  611. shouldTrack = prevShouldTrack;
  612. this.flags &= -3;
  613. }
  614. }
  615. stop() {
  616. if (this.flags & 1) {
  617. for (let link = this.deps; link; link = link.nextDep) {
  618. removeSub(link);
  619. }
  620. this.deps = this.depsTail = void 0;
  621. cleanupEffect(this);
  622. this.onStop && this.onStop();
  623. this.flags &= -2;
  624. }
  625. }
  626. trigger() {
  627. if (this.flags & 64) {
  628. pausedQueueEffects.add(this);
  629. } else if (this.scheduler) {
  630. this.scheduler();
  631. } else {
  632. this.runIfDirty();
  633. }
  634. }
  635. /**
  636. * @internal
  637. */
  638. runIfDirty() {
  639. if (isDirty(this)) {
  640. this.run();
  641. }
  642. }
  643. get dirty() {
  644. return isDirty(this);
  645. }
  646. }
  647. let batchDepth = 0;
  648. let batchedSub;
  649. let batchedComputed;
  650. function batch(sub, isComputed = false) {
  651. sub.flags |= 8;
  652. if (isComputed) {
  653. sub.next = batchedComputed;
  654. batchedComputed = sub;
  655. return;
  656. }
  657. sub.next = batchedSub;
  658. batchedSub = sub;
  659. }
  660. function startBatch() {
  661. batchDepth++;
  662. }
  663. function endBatch() {
  664. if (--batchDepth > 0) {
  665. return;
  666. }
  667. if (batchedComputed) {
  668. let e = batchedComputed;
  669. batchedComputed = void 0;
  670. while (e) {
  671. const next = e.next;
  672. e.next = void 0;
  673. e.flags &= -9;
  674. e = next;
  675. }
  676. }
  677. let error;
  678. while (batchedSub) {
  679. let e = batchedSub;
  680. batchedSub = void 0;
  681. while (e) {
  682. const next = e.next;
  683. e.next = void 0;
  684. e.flags &= -9;
  685. if (e.flags & 1) {
  686. try {
  687. ;
  688. e.trigger();
  689. } catch (err) {
  690. if (!error) error = err;
  691. }
  692. }
  693. e = next;
  694. }
  695. }
  696. if (error) throw error;
  697. }
  698. function prepareDeps(sub) {
  699. for (let link = sub.deps; link; link = link.nextDep) {
  700. link.version = -1;
  701. link.prevActiveLink = link.dep.activeLink;
  702. link.dep.activeLink = link;
  703. }
  704. }
  705. function cleanupDeps(sub) {
  706. let head;
  707. let tail = sub.depsTail;
  708. let link = tail;
  709. while (link) {
  710. const prev = link.prevDep;
  711. if (link.version === -1) {
  712. if (link === tail) tail = prev;
  713. removeSub(link);
  714. removeDep(link);
  715. } else {
  716. head = link;
  717. }
  718. link.dep.activeLink = link.prevActiveLink;
  719. link.prevActiveLink = void 0;
  720. link = prev;
  721. }
  722. sub.deps = head;
  723. sub.depsTail = tail;
  724. }
  725. function isDirty(sub) {
  726. for (let link = sub.deps; link; link = link.nextDep) {
  727. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  728. return true;
  729. }
  730. }
  731. if (sub._dirty) {
  732. return true;
  733. }
  734. return false;
  735. }
  736. function refreshComputed(computed) {
  737. if (computed.flags & 4 && !(computed.flags & 16)) {
  738. return;
  739. }
  740. computed.flags &= -17;
  741. if (computed.globalVersion === globalVersion) {
  742. return;
  743. }
  744. computed.globalVersion = globalVersion;
  745. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  746. return;
  747. }
  748. computed.flags |= 2;
  749. const dep = computed.dep;
  750. const prevSub = activeSub;
  751. const prevShouldTrack = shouldTrack;
  752. activeSub = computed;
  753. shouldTrack = true;
  754. try {
  755. prepareDeps(computed);
  756. const value = computed.fn(computed._value);
  757. if (dep.version === 0 || hasChanged(value, computed._value)) {
  758. computed.flags |= 128;
  759. computed._value = value;
  760. dep.version++;
  761. }
  762. } catch (err) {
  763. dep.version++;
  764. throw err;
  765. } finally {
  766. activeSub = prevSub;
  767. shouldTrack = prevShouldTrack;
  768. cleanupDeps(computed);
  769. computed.flags &= -3;
  770. }
  771. }
  772. function removeSub(link, soft = false) {
  773. const { dep, prevSub, nextSub } = link;
  774. if (prevSub) {
  775. prevSub.nextSub = nextSub;
  776. link.prevSub = void 0;
  777. }
  778. if (nextSub) {
  779. nextSub.prevSub = prevSub;
  780. link.nextSub = void 0;
  781. }
  782. if (dep.subsHead === link) {
  783. dep.subsHead = nextSub;
  784. }
  785. if (dep.subs === link) {
  786. dep.subs = prevSub;
  787. if (!prevSub && dep.computed) {
  788. dep.computed.flags &= -5;
  789. for (let l = dep.computed.deps; l; l = l.nextDep) {
  790. removeSub(l, true);
  791. }
  792. }
  793. }
  794. if (!soft && !--dep.sc && dep.map) {
  795. dep.map.delete(dep.key);
  796. }
  797. }
  798. function removeDep(link) {
  799. const { prevDep, nextDep } = link;
  800. if (prevDep) {
  801. prevDep.nextDep = nextDep;
  802. link.prevDep = void 0;
  803. }
  804. if (nextDep) {
  805. nextDep.prevDep = prevDep;
  806. link.nextDep = void 0;
  807. }
  808. }
  809. function effect(fn, options) {
  810. if (fn.effect instanceof ReactiveEffect) {
  811. fn = fn.effect.fn;
  812. }
  813. const e = new ReactiveEffect(fn);
  814. if (options) {
  815. extend(e, options);
  816. }
  817. try {
  818. e.run();
  819. } catch (err) {
  820. e.stop();
  821. throw err;
  822. }
  823. const runner = e.run.bind(e);
  824. runner.effect = e;
  825. return runner;
  826. }
  827. function stop(runner) {
  828. runner.effect.stop();
  829. }
  830. let shouldTrack = true;
  831. const trackStack = [];
  832. function pauseTracking() {
  833. trackStack.push(shouldTrack);
  834. shouldTrack = false;
  835. }
  836. function resetTracking() {
  837. const last = trackStack.pop();
  838. shouldTrack = last === void 0 ? true : last;
  839. }
  840. function cleanupEffect(e) {
  841. const { cleanup } = e;
  842. e.cleanup = void 0;
  843. if (cleanup) {
  844. const prevSub = activeSub;
  845. activeSub = void 0;
  846. try {
  847. cleanup();
  848. } finally {
  849. activeSub = prevSub;
  850. }
  851. }
  852. }
  853. let globalVersion = 0;
  854. class Link {
  855. constructor(sub, dep) {
  856. this.sub = sub;
  857. this.dep = dep;
  858. this.version = dep.version;
  859. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  860. }
  861. }
  862. class Dep {
  863. // TODO isolatedDeclarations "__v_skip"
  864. constructor(computed) {
  865. this.computed = computed;
  866. this.version = 0;
  867. /**
  868. * Link between this dep and the current active effect
  869. */
  870. this.activeLink = void 0;
  871. /**
  872. * Doubly linked list representing the subscribing effects (tail)
  873. */
  874. this.subs = void 0;
  875. /**
  876. * For object property deps cleanup
  877. */
  878. this.map = void 0;
  879. this.key = void 0;
  880. /**
  881. * Subscriber counter
  882. */
  883. this.sc = 0;
  884. /**
  885. * @internal
  886. */
  887. this.__v_skip = true;
  888. {
  889. this.subsHead = void 0;
  890. }
  891. }
  892. track(debugInfo) {
  893. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  894. return;
  895. }
  896. let link = this.activeLink;
  897. if (link === void 0 || link.sub !== activeSub) {
  898. link = this.activeLink = new Link(activeSub, this);
  899. if (!activeSub.deps) {
  900. activeSub.deps = activeSub.depsTail = link;
  901. } else {
  902. link.prevDep = activeSub.depsTail;
  903. activeSub.depsTail.nextDep = link;
  904. activeSub.depsTail = link;
  905. }
  906. addSub(link);
  907. } else if (link.version === -1) {
  908. link.version = this.version;
  909. if (link.nextDep) {
  910. const next = link.nextDep;
  911. next.prevDep = link.prevDep;
  912. if (link.prevDep) {
  913. link.prevDep.nextDep = next;
  914. }
  915. link.prevDep = activeSub.depsTail;
  916. link.nextDep = void 0;
  917. activeSub.depsTail.nextDep = link;
  918. activeSub.depsTail = link;
  919. if (activeSub.deps === link) {
  920. activeSub.deps = next;
  921. }
  922. }
  923. }
  924. if (activeSub.onTrack) {
  925. activeSub.onTrack(
  926. extend(
  927. {
  928. effect: activeSub
  929. },
  930. debugInfo
  931. )
  932. );
  933. }
  934. return link;
  935. }
  936. trigger(debugInfo) {
  937. this.version++;
  938. globalVersion++;
  939. this.notify(debugInfo);
  940. }
  941. notify(debugInfo) {
  942. startBatch();
  943. try {
  944. if (true) {
  945. for (let head = this.subsHead; head; head = head.nextSub) {
  946. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  947. head.sub.onTrigger(
  948. extend(
  949. {
  950. effect: head.sub
  951. },
  952. debugInfo
  953. )
  954. );
  955. }
  956. }
  957. }
  958. for (let link = this.subs; link; link = link.prevSub) {
  959. if (link.sub.notify()) {
  960. ;
  961. link.sub.dep.notify();
  962. }
  963. }
  964. } finally {
  965. endBatch();
  966. }
  967. }
  968. }
  969. function addSub(link) {
  970. link.dep.sc++;
  971. if (link.sub.flags & 4) {
  972. const computed = link.dep.computed;
  973. if (computed && !link.dep.subs) {
  974. computed.flags |= 4 | 16;
  975. for (let l = computed.deps; l; l = l.nextDep) {
  976. addSub(l);
  977. }
  978. }
  979. const currentTail = link.dep.subs;
  980. if (currentTail !== link) {
  981. link.prevSub = currentTail;
  982. if (currentTail) currentTail.nextSub = link;
  983. }
  984. if (link.dep.subsHead === void 0) {
  985. link.dep.subsHead = link;
  986. }
  987. link.dep.subs = link;
  988. }
  989. }
  990. const targetMap = /* @__PURE__ */ new WeakMap();
  991. const ITERATE_KEY = Symbol(
  992. "Object iterate"
  993. );
  994. const MAP_KEY_ITERATE_KEY = Symbol(
  995. "Map keys iterate"
  996. );
  997. const ARRAY_ITERATE_KEY = Symbol(
  998. "Array iterate"
  999. );
  1000. function track(target, type, key) {
  1001. if (shouldTrack && activeSub) {
  1002. let depsMap = targetMap.get(target);
  1003. if (!depsMap) {
  1004. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  1005. }
  1006. let dep = depsMap.get(key);
  1007. if (!dep) {
  1008. depsMap.set(key, dep = new Dep());
  1009. dep.map = depsMap;
  1010. dep.key = key;
  1011. }
  1012. {
  1013. dep.track({
  1014. target,
  1015. type,
  1016. key
  1017. });
  1018. }
  1019. }
  1020. }
  1021. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  1022. const depsMap = targetMap.get(target);
  1023. if (!depsMap) {
  1024. globalVersion++;
  1025. return;
  1026. }
  1027. const run = (dep) => {
  1028. if (dep) {
  1029. {
  1030. dep.trigger({
  1031. target,
  1032. type,
  1033. key,
  1034. newValue,
  1035. oldValue,
  1036. oldTarget
  1037. });
  1038. }
  1039. }
  1040. };
  1041. startBatch();
  1042. if (type === "clear") {
  1043. depsMap.forEach(run);
  1044. } else {
  1045. const targetIsArray = isArray(target);
  1046. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1047. if (targetIsArray && key === "length") {
  1048. const newLength = Number(newValue);
  1049. depsMap.forEach((dep, key2) => {
  1050. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1051. run(dep);
  1052. }
  1053. });
  1054. } else {
  1055. if (key !== void 0 || depsMap.has(void 0)) {
  1056. run(depsMap.get(key));
  1057. }
  1058. if (isArrayIndex) {
  1059. run(depsMap.get(ARRAY_ITERATE_KEY));
  1060. }
  1061. switch (type) {
  1062. case "add":
  1063. if (!targetIsArray) {
  1064. run(depsMap.get(ITERATE_KEY));
  1065. if (isMap(target)) {
  1066. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1067. }
  1068. } else if (isArrayIndex) {
  1069. run(depsMap.get("length"));
  1070. }
  1071. break;
  1072. case "delete":
  1073. if (!targetIsArray) {
  1074. run(depsMap.get(ITERATE_KEY));
  1075. if (isMap(target)) {
  1076. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1077. }
  1078. }
  1079. break;
  1080. case "set":
  1081. if (isMap(target)) {
  1082. run(depsMap.get(ITERATE_KEY));
  1083. }
  1084. break;
  1085. }
  1086. }
  1087. }
  1088. endBatch();
  1089. }
  1090. function getDepFromReactive(object, key) {
  1091. const depMap = targetMap.get(object);
  1092. return depMap && depMap.get(key);
  1093. }
  1094. function reactiveReadArray(array) {
  1095. const raw = toRaw(array);
  1096. if (raw === array) return raw;
  1097. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1098. return isShallow(array) ? raw : raw.map(toReactive);
  1099. }
  1100. function shallowReadArray(arr) {
  1101. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1102. return arr;
  1103. }
  1104. const arrayInstrumentations = {
  1105. __proto__: null,
  1106. [Symbol.iterator]() {
  1107. return iterator(this, Symbol.iterator, toReactive);
  1108. },
  1109. concat(...args) {
  1110. return reactiveReadArray(this).concat(
  1111. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1112. );
  1113. },
  1114. entries() {
  1115. return iterator(this, "entries", (value) => {
  1116. value[1] = toReactive(value[1]);
  1117. return value;
  1118. });
  1119. },
  1120. every(fn, thisArg) {
  1121. return apply(this, "every", fn, thisArg, void 0, arguments);
  1122. },
  1123. filter(fn, thisArg) {
  1124. return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
  1125. },
  1126. find(fn, thisArg) {
  1127. return apply(this, "find", fn, thisArg, toReactive, arguments);
  1128. },
  1129. findIndex(fn, thisArg) {
  1130. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1131. },
  1132. findLast(fn, thisArg) {
  1133. return apply(this, "findLast", fn, thisArg, toReactive, arguments);
  1134. },
  1135. findLastIndex(fn, thisArg) {
  1136. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1137. },
  1138. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1139. forEach(fn, thisArg) {
  1140. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1141. },
  1142. includes(...args) {
  1143. return searchProxy(this, "includes", args);
  1144. },
  1145. indexOf(...args) {
  1146. return searchProxy(this, "indexOf", args);
  1147. },
  1148. join(separator) {
  1149. return reactiveReadArray(this).join(separator);
  1150. },
  1151. // keys() iterator only reads `length`, no optimization required
  1152. lastIndexOf(...args) {
  1153. return searchProxy(this, "lastIndexOf", args);
  1154. },
  1155. map(fn, thisArg) {
  1156. return apply(this, "map", fn, thisArg, void 0, arguments);
  1157. },
  1158. pop() {
  1159. return noTracking(this, "pop");
  1160. },
  1161. push(...args) {
  1162. return noTracking(this, "push", args);
  1163. },
  1164. reduce(fn, ...args) {
  1165. return reduce(this, "reduce", fn, args);
  1166. },
  1167. reduceRight(fn, ...args) {
  1168. return reduce(this, "reduceRight", fn, args);
  1169. },
  1170. shift() {
  1171. return noTracking(this, "shift");
  1172. },
  1173. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1174. some(fn, thisArg) {
  1175. return apply(this, "some", fn, thisArg, void 0, arguments);
  1176. },
  1177. splice(...args) {
  1178. return noTracking(this, "splice", args);
  1179. },
  1180. toReversed() {
  1181. return reactiveReadArray(this).toReversed();
  1182. },
  1183. toSorted(comparer) {
  1184. return reactiveReadArray(this).toSorted(comparer);
  1185. },
  1186. toSpliced(...args) {
  1187. return reactiveReadArray(this).toSpliced(...args);
  1188. },
  1189. unshift(...args) {
  1190. return noTracking(this, "unshift", args);
  1191. },
  1192. values() {
  1193. return iterator(this, "values", toReactive);
  1194. }
  1195. };
  1196. function iterator(self, method, wrapValue) {
  1197. const arr = shallowReadArray(self);
  1198. const iter = arr[method]();
  1199. if (arr !== self && !isShallow(self)) {
  1200. iter._next = iter.next;
  1201. iter.next = () => {
  1202. const result = iter._next();
  1203. if (result.value) {
  1204. result.value = wrapValue(result.value);
  1205. }
  1206. return result;
  1207. };
  1208. }
  1209. return iter;
  1210. }
  1211. const arrayProto = Array.prototype;
  1212. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1213. const arr = shallowReadArray(self);
  1214. const needsWrap = arr !== self && !isShallow(self);
  1215. const methodFn = arr[method];
  1216. if (methodFn !== arrayProto[method]) {
  1217. const result2 = methodFn.apply(self, args);
  1218. return needsWrap ? toReactive(result2) : result2;
  1219. }
  1220. let wrappedFn = fn;
  1221. if (arr !== self) {
  1222. if (needsWrap) {
  1223. wrappedFn = function(item, index) {
  1224. return fn.call(this, toReactive(item), index, self);
  1225. };
  1226. } else if (fn.length > 2) {
  1227. wrappedFn = function(item, index) {
  1228. return fn.call(this, item, index, self);
  1229. };
  1230. }
  1231. }
  1232. const result = methodFn.call(arr, wrappedFn, thisArg);
  1233. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1234. }
  1235. function reduce(self, method, fn, args) {
  1236. const arr = shallowReadArray(self);
  1237. let wrappedFn = fn;
  1238. if (arr !== self) {
  1239. if (!isShallow(self)) {
  1240. wrappedFn = function(acc, item, index) {
  1241. return fn.call(this, acc, toReactive(item), index, self);
  1242. };
  1243. } else if (fn.length > 3) {
  1244. wrappedFn = function(acc, item, index) {
  1245. return fn.call(this, acc, item, index, self);
  1246. };
  1247. }
  1248. }
  1249. return arr[method](wrappedFn, ...args);
  1250. }
  1251. function searchProxy(self, method, args) {
  1252. const arr = toRaw(self);
  1253. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1254. const res = arr[method](...args);
  1255. if ((res === -1 || res === false) && isProxy(args[0])) {
  1256. args[0] = toRaw(args[0]);
  1257. return arr[method](...args);
  1258. }
  1259. return res;
  1260. }
  1261. function noTracking(self, method, args = []) {
  1262. pauseTracking();
  1263. startBatch();
  1264. const res = toRaw(self)[method].apply(self, args);
  1265. endBatch();
  1266. resetTracking();
  1267. return res;
  1268. }
  1269. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1270. const builtInSymbols = new Set(
  1271. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1272. );
  1273. function hasOwnProperty(key) {
  1274. if (!isSymbol(key)) key = String(key);
  1275. const obj = toRaw(this);
  1276. track(obj, "has", key);
  1277. return obj.hasOwnProperty(key);
  1278. }
  1279. class BaseReactiveHandler {
  1280. constructor(_isReadonly = false, _isShallow = false) {
  1281. this._isReadonly = _isReadonly;
  1282. this._isShallow = _isShallow;
  1283. }
  1284. get(target, key, receiver) {
  1285. if (key === "__v_skip") return target["__v_skip"];
  1286. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1287. if (key === "__v_isReactive") {
  1288. return !isReadonly2;
  1289. } else if (key === "__v_isReadonly") {
  1290. return isReadonly2;
  1291. } else if (key === "__v_isShallow") {
  1292. return isShallow2;
  1293. } else if (key === "__v_raw") {
  1294. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1295. // this means the receiver is a user proxy of the reactive proxy
  1296. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1297. return target;
  1298. }
  1299. return;
  1300. }
  1301. const targetIsArray = isArray(target);
  1302. if (!isReadonly2) {
  1303. let fn;
  1304. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1305. return fn;
  1306. }
  1307. if (key === "hasOwnProperty") {
  1308. return hasOwnProperty;
  1309. }
  1310. }
  1311. const res = Reflect.get(
  1312. target,
  1313. key,
  1314. // if this is a proxy wrapping a ref, return methods using the raw ref
  1315. // as receiver so that we don't have to call `toRaw` on the ref in all
  1316. // its class methods
  1317. isRef(target) ? target : receiver
  1318. );
  1319. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1320. return res;
  1321. }
  1322. if (!isReadonly2) {
  1323. track(target, "get", key);
  1324. }
  1325. if (isShallow2) {
  1326. return res;
  1327. }
  1328. if (isRef(res)) {
  1329. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1330. }
  1331. if (isObject(res)) {
  1332. return isReadonly2 ? readonly(res) : reactive(res);
  1333. }
  1334. return res;
  1335. }
  1336. }
  1337. class MutableReactiveHandler extends BaseReactiveHandler {
  1338. constructor(isShallow2 = false) {
  1339. super(false, isShallow2);
  1340. }
  1341. set(target, key, value, receiver) {
  1342. let oldValue = target[key];
  1343. if (!this._isShallow) {
  1344. const isOldValueReadonly = isReadonly(oldValue);
  1345. if (!isShallow(value) && !isReadonly(value)) {
  1346. oldValue = toRaw(oldValue);
  1347. value = toRaw(value);
  1348. }
  1349. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  1350. if (isOldValueReadonly) {
  1351. {
  1352. warn$2(
  1353. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1354. target[key]
  1355. );
  1356. }
  1357. return true;
  1358. } else {
  1359. oldValue.value = value;
  1360. return true;
  1361. }
  1362. }
  1363. }
  1364. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  1365. const result = Reflect.set(
  1366. target,
  1367. key,
  1368. value,
  1369. isRef(target) ? target : receiver
  1370. );
  1371. if (target === toRaw(receiver)) {
  1372. if (!hadKey) {
  1373. trigger(target, "add", key, value);
  1374. } else if (hasChanged(value, oldValue)) {
  1375. trigger(target, "set", key, value, oldValue);
  1376. }
  1377. }
  1378. return result;
  1379. }
  1380. deleteProperty(target, key) {
  1381. const hadKey = hasOwn(target, key);
  1382. const oldValue = target[key];
  1383. const result = Reflect.deleteProperty(target, key);
  1384. if (result && hadKey) {
  1385. trigger(target, "delete", key, void 0, oldValue);
  1386. }
  1387. return result;
  1388. }
  1389. has(target, key) {
  1390. const result = Reflect.has(target, key);
  1391. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1392. track(target, "has", key);
  1393. }
  1394. return result;
  1395. }
  1396. ownKeys(target) {
  1397. track(
  1398. target,
  1399. "iterate",
  1400. isArray(target) ? "length" : ITERATE_KEY
  1401. );
  1402. return Reflect.ownKeys(target);
  1403. }
  1404. }
  1405. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1406. constructor(isShallow2 = false) {
  1407. super(true, isShallow2);
  1408. }
  1409. set(target, key) {
  1410. {
  1411. warn$2(
  1412. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1413. target
  1414. );
  1415. }
  1416. return true;
  1417. }
  1418. deleteProperty(target, key) {
  1419. {
  1420. warn$2(
  1421. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1422. target
  1423. );
  1424. }
  1425. return true;
  1426. }
  1427. }
  1428. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1429. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1430. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1431. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1432. const toShallow = (value) => value;
  1433. const getProto = (v) => Reflect.getPrototypeOf(v);
  1434. function createIterableMethod(method, isReadonly2, isShallow2) {
  1435. return function(...args) {
  1436. const target = this["__v_raw"];
  1437. const rawTarget = toRaw(target);
  1438. const targetIsMap = isMap(rawTarget);
  1439. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1440. const isKeyOnly = method === "keys" && targetIsMap;
  1441. const innerIterator = target[method](...args);
  1442. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1443. !isReadonly2 && track(
  1444. rawTarget,
  1445. "iterate",
  1446. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1447. );
  1448. return {
  1449. // iterator protocol
  1450. next() {
  1451. const { value, done } = innerIterator.next();
  1452. return done ? { value, done } : {
  1453. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1454. done
  1455. };
  1456. },
  1457. // iterable protocol
  1458. [Symbol.iterator]() {
  1459. return this;
  1460. }
  1461. };
  1462. };
  1463. }
  1464. function createReadonlyMethod(type) {
  1465. return function(...args) {
  1466. {
  1467. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1468. warn$2(
  1469. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1470. toRaw(this)
  1471. );
  1472. }
  1473. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1474. };
  1475. }
  1476. function createInstrumentations(readonly, shallow) {
  1477. const instrumentations = {
  1478. get(key) {
  1479. const target = this["__v_raw"];
  1480. const rawTarget = toRaw(target);
  1481. const rawKey = toRaw(key);
  1482. if (!readonly) {
  1483. if (hasChanged(key, rawKey)) {
  1484. track(rawTarget, "get", key);
  1485. }
  1486. track(rawTarget, "get", rawKey);
  1487. }
  1488. const { has } = getProto(rawTarget);
  1489. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1490. if (has.call(rawTarget, key)) {
  1491. return wrap(target.get(key));
  1492. } else if (has.call(rawTarget, rawKey)) {
  1493. return wrap(target.get(rawKey));
  1494. } else if (target !== rawTarget) {
  1495. target.get(key);
  1496. }
  1497. },
  1498. get size() {
  1499. const target = this["__v_raw"];
  1500. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1501. return target.size;
  1502. },
  1503. has(key) {
  1504. const target = this["__v_raw"];
  1505. const rawTarget = toRaw(target);
  1506. const rawKey = toRaw(key);
  1507. if (!readonly) {
  1508. if (hasChanged(key, rawKey)) {
  1509. track(rawTarget, "has", key);
  1510. }
  1511. track(rawTarget, "has", rawKey);
  1512. }
  1513. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1514. },
  1515. forEach(callback, thisArg) {
  1516. const observed = this;
  1517. const target = observed["__v_raw"];
  1518. const rawTarget = toRaw(target);
  1519. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1520. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1521. return target.forEach((value, key) => {
  1522. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1523. });
  1524. }
  1525. };
  1526. extend(
  1527. instrumentations,
  1528. readonly ? {
  1529. add: createReadonlyMethod("add"),
  1530. set: createReadonlyMethod("set"),
  1531. delete: createReadonlyMethod("delete"),
  1532. clear: createReadonlyMethod("clear")
  1533. } : {
  1534. add(value) {
  1535. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1536. value = toRaw(value);
  1537. }
  1538. const target = toRaw(this);
  1539. const proto = getProto(target);
  1540. const hadKey = proto.has.call(target, value);
  1541. if (!hadKey) {
  1542. target.add(value);
  1543. trigger(target, "add", value, value);
  1544. }
  1545. return this;
  1546. },
  1547. set(key, value) {
  1548. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1549. value = toRaw(value);
  1550. }
  1551. const target = toRaw(this);
  1552. const { has, get } = getProto(target);
  1553. let hadKey = has.call(target, key);
  1554. if (!hadKey) {
  1555. key = toRaw(key);
  1556. hadKey = has.call(target, key);
  1557. } else {
  1558. checkIdentityKeys(target, has, key);
  1559. }
  1560. const oldValue = get.call(target, key);
  1561. target.set(key, value);
  1562. if (!hadKey) {
  1563. trigger(target, "add", key, value);
  1564. } else if (hasChanged(value, oldValue)) {
  1565. trigger(target, "set", key, value, oldValue);
  1566. }
  1567. return this;
  1568. },
  1569. delete(key) {
  1570. const target = toRaw(this);
  1571. const { has, get } = getProto(target);
  1572. let hadKey = has.call(target, key);
  1573. if (!hadKey) {
  1574. key = toRaw(key);
  1575. hadKey = has.call(target, key);
  1576. } else {
  1577. checkIdentityKeys(target, has, key);
  1578. }
  1579. const oldValue = get ? get.call(target, key) : void 0;
  1580. const result = target.delete(key);
  1581. if (hadKey) {
  1582. trigger(target, "delete", key, void 0, oldValue);
  1583. }
  1584. return result;
  1585. },
  1586. clear() {
  1587. const target = toRaw(this);
  1588. const hadItems = target.size !== 0;
  1589. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1590. const result = target.clear();
  1591. if (hadItems) {
  1592. trigger(
  1593. target,
  1594. "clear",
  1595. void 0,
  1596. void 0,
  1597. oldTarget
  1598. );
  1599. }
  1600. return result;
  1601. }
  1602. }
  1603. );
  1604. const iteratorMethods = [
  1605. "keys",
  1606. "values",
  1607. "entries",
  1608. Symbol.iterator
  1609. ];
  1610. iteratorMethods.forEach((method) => {
  1611. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1612. });
  1613. return instrumentations;
  1614. }
  1615. function createInstrumentationGetter(isReadonly2, shallow) {
  1616. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1617. return (target, key, receiver) => {
  1618. if (key === "__v_isReactive") {
  1619. return !isReadonly2;
  1620. } else if (key === "__v_isReadonly") {
  1621. return isReadonly2;
  1622. } else if (key === "__v_raw") {
  1623. return target;
  1624. }
  1625. return Reflect.get(
  1626. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1627. key,
  1628. receiver
  1629. );
  1630. };
  1631. }
  1632. const mutableCollectionHandlers = {
  1633. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1634. };
  1635. const shallowCollectionHandlers = {
  1636. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1637. };
  1638. const readonlyCollectionHandlers = {
  1639. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1640. };
  1641. const shallowReadonlyCollectionHandlers = {
  1642. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1643. };
  1644. function checkIdentityKeys(target, has, key) {
  1645. const rawKey = toRaw(key);
  1646. if (rawKey !== key && has.call(target, rawKey)) {
  1647. const type = toRawType(target);
  1648. warn$2(
  1649. `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.`
  1650. );
  1651. }
  1652. }
  1653. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1654. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1655. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1656. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1657. function targetTypeMap(rawType) {
  1658. switch (rawType) {
  1659. case "Object":
  1660. case "Array":
  1661. return 1 /* COMMON */;
  1662. case "Map":
  1663. case "Set":
  1664. case "WeakMap":
  1665. case "WeakSet":
  1666. return 2 /* COLLECTION */;
  1667. default:
  1668. return 0 /* INVALID */;
  1669. }
  1670. }
  1671. function getTargetType(value) {
  1672. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1673. }
  1674. function reactive(target) {
  1675. if (isReadonly(target)) {
  1676. return target;
  1677. }
  1678. return createReactiveObject(
  1679. target,
  1680. false,
  1681. mutableHandlers,
  1682. mutableCollectionHandlers,
  1683. reactiveMap
  1684. );
  1685. }
  1686. function shallowReactive(target) {
  1687. return createReactiveObject(
  1688. target,
  1689. false,
  1690. shallowReactiveHandlers,
  1691. shallowCollectionHandlers,
  1692. shallowReactiveMap
  1693. );
  1694. }
  1695. function readonly(target) {
  1696. return createReactiveObject(
  1697. target,
  1698. true,
  1699. readonlyHandlers,
  1700. readonlyCollectionHandlers,
  1701. readonlyMap
  1702. );
  1703. }
  1704. function shallowReadonly(target) {
  1705. return createReactiveObject(
  1706. target,
  1707. true,
  1708. shallowReadonlyHandlers,
  1709. shallowReadonlyCollectionHandlers,
  1710. shallowReadonlyMap
  1711. );
  1712. }
  1713. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1714. if (!isObject(target)) {
  1715. {
  1716. warn$2(
  1717. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1718. target
  1719. )}`
  1720. );
  1721. }
  1722. return target;
  1723. }
  1724. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1725. return target;
  1726. }
  1727. const targetType = getTargetType(target);
  1728. if (targetType === 0 /* INVALID */) {
  1729. return target;
  1730. }
  1731. const existingProxy = proxyMap.get(target);
  1732. if (existingProxy) {
  1733. return existingProxy;
  1734. }
  1735. const proxy = new Proxy(
  1736. target,
  1737. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1738. );
  1739. proxyMap.set(target, proxy);
  1740. return proxy;
  1741. }
  1742. function isReactive(value) {
  1743. if (isReadonly(value)) {
  1744. return isReactive(value["__v_raw"]);
  1745. }
  1746. return !!(value && value["__v_isReactive"]);
  1747. }
  1748. function isReadonly(value) {
  1749. return !!(value && value["__v_isReadonly"]);
  1750. }
  1751. function isShallow(value) {
  1752. return !!(value && value["__v_isShallow"]);
  1753. }
  1754. function isProxy(value) {
  1755. return value ? !!value["__v_raw"] : false;
  1756. }
  1757. function toRaw(observed) {
  1758. const raw = observed && observed["__v_raw"];
  1759. return raw ? toRaw(raw) : observed;
  1760. }
  1761. function markRaw(value) {
  1762. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1763. def(value, "__v_skip", true);
  1764. }
  1765. return value;
  1766. }
  1767. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1768. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1769. function isRef(r) {
  1770. return r ? r["__v_isRef"] === true : false;
  1771. }
  1772. function ref(value) {
  1773. return createRef(value, false);
  1774. }
  1775. function shallowRef(value) {
  1776. return createRef(value, true);
  1777. }
  1778. function createRef(rawValue, shallow) {
  1779. if (isRef(rawValue)) {
  1780. return rawValue;
  1781. }
  1782. return new RefImpl(rawValue, shallow);
  1783. }
  1784. class RefImpl {
  1785. constructor(value, isShallow2) {
  1786. this.dep = new Dep();
  1787. this["__v_isRef"] = true;
  1788. this["__v_isShallow"] = false;
  1789. this._rawValue = isShallow2 ? value : toRaw(value);
  1790. this._value = isShallow2 ? value : toReactive(value);
  1791. this["__v_isShallow"] = isShallow2;
  1792. }
  1793. get value() {
  1794. {
  1795. this.dep.track({
  1796. target: this,
  1797. type: "get",
  1798. key: "value"
  1799. });
  1800. }
  1801. return this._value;
  1802. }
  1803. set value(newValue) {
  1804. const oldValue = this._rawValue;
  1805. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1806. newValue = useDirectValue ? newValue : toRaw(newValue);
  1807. if (hasChanged(newValue, oldValue)) {
  1808. this._rawValue = newValue;
  1809. this._value = useDirectValue ? newValue : toReactive(newValue);
  1810. {
  1811. this.dep.trigger({
  1812. target: this,
  1813. type: "set",
  1814. key: "value",
  1815. newValue,
  1816. oldValue
  1817. });
  1818. }
  1819. }
  1820. }
  1821. }
  1822. function triggerRef(ref2) {
  1823. if (ref2.dep) {
  1824. {
  1825. ref2.dep.trigger({
  1826. target: ref2,
  1827. type: "set",
  1828. key: "value",
  1829. newValue: ref2._value
  1830. });
  1831. }
  1832. }
  1833. }
  1834. function unref(ref2) {
  1835. return isRef(ref2) ? ref2.value : ref2;
  1836. }
  1837. function toValue(source) {
  1838. return isFunction(source) ? source() : unref(source);
  1839. }
  1840. const shallowUnwrapHandlers = {
  1841. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1842. set: (target, key, value, receiver) => {
  1843. const oldValue = target[key];
  1844. if (isRef(oldValue) && !isRef(value)) {
  1845. oldValue.value = value;
  1846. return true;
  1847. } else {
  1848. return Reflect.set(target, key, value, receiver);
  1849. }
  1850. }
  1851. };
  1852. function proxyRefs(objectWithRefs) {
  1853. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1854. }
  1855. class CustomRefImpl {
  1856. constructor(factory) {
  1857. this["__v_isRef"] = true;
  1858. this._value = void 0;
  1859. const dep = this.dep = new Dep();
  1860. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1861. this._get = get;
  1862. this._set = set;
  1863. }
  1864. get value() {
  1865. return this._value = this._get();
  1866. }
  1867. set value(newVal) {
  1868. this._set(newVal);
  1869. }
  1870. }
  1871. function customRef(factory) {
  1872. return new CustomRefImpl(factory);
  1873. }
  1874. function toRefs(object) {
  1875. if (!isProxy(object)) {
  1876. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1877. }
  1878. const ret = isArray(object) ? new Array(object.length) : {};
  1879. for (const key in object) {
  1880. ret[key] = propertyToRef(object, key);
  1881. }
  1882. return ret;
  1883. }
  1884. class ObjectRefImpl {
  1885. constructor(_object, _key, _defaultValue) {
  1886. this._object = _object;
  1887. this._key = _key;
  1888. this._defaultValue = _defaultValue;
  1889. this["__v_isRef"] = true;
  1890. this._value = void 0;
  1891. }
  1892. get value() {
  1893. const val = this._object[this._key];
  1894. return this._value = val === void 0 ? this._defaultValue : val;
  1895. }
  1896. set value(newVal) {
  1897. this._object[this._key] = newVal;
  1898. }
  1899. get dep() {
  1900. return getDepFromReactive(toRaw(this._object), this._key);
  1901. }
  1902. }
  1903. class GetterRefImpl {
  1904. constructor(_getter) {
  1905. this._getter = _getter;
  1906. this["__v_isRef"] = true;
  1907. this["__v_isReadonly"] = true;
  1908. this._value = void 0;
  1909. }
  1910. get value() {
  1911. return this._value = this._getter();
  1912. }
  1913. }
  1914. function toRef(source, key, defaultValue) {
  1915. if (isRef(source)) {
  1916. return source;
  1917. } else if (isFunction(source)) {
  1918. return new GetterRefImpl(source);
  1919. } else if (isObject(source) && arguments.length > 1) {
  1920. return propertyToRef(source, key, defaultValue);
  1921. } else {
  1922. return ref(source);
  1923. }
  1924. }
  1925. function propertyToRef(source, key, defaultValue) {
  1926. const val = source[key];
  1927. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1928. }
  1929. class ComputedRefImpl {
  1930. constructor(fn, setter, isSSR) {
  1931. this.fn = fn;
  1932. this.setter = setter;
  1933. /**
  1934. * @internal
  1935. */
  1936. this._value = void 0;
  1937. /**
  1938. * @internal
  1939. */
  1940. this.dep = new Dep(this);
  1941. /**
  1942. * @internal
  1943. */
  1944. this.__v_isRef = true;
  1945. // TODO isolatedDeclarations "__v_isReadonly"
  1946. // A computed is also a subscriber that tracks other deps
  1947. /**
  1948. * @internal
  1949. */
  1950. this.deps = void 0;
  1951. /**
  1952. * @internal
  1953. */
  1954. this.depsTail = void 0;
  1955. /**
  1956. * @internal
  1957. */
  1958. this.flags = 16;
  1959. /**
  1960. * @internal
  1961. */
  1962. this.globalVersion = globalVersion - 1;
  1963. /**
  1964. * @internal
  1965. */
  1966. this.next = void 0;
  1967. // for backwards compat
  1968. this.effect = this;
  1969. this["__v_isReadonly"] = !setter;
  1970. this.isSSR = isSSR;
  1971. }
  1972. /**
  1973. * @internal
  1974. */
  1975. notify() {
  1976. this.flags |= 16;
  1977. if (!(this.flags & 8) && // avoid infinite self recursion
  1978. activeSub !== this) {
  1979. batch(this, true);
  1980. return true;
  1981. }
  1982. }
  1983. get value() {
  1984. const link = this.dep.track({
  1985. target: this,
  1986. type: "get",
  1987. key: "value"
  1988. }) ;
  1989. refreshComputed(this);
  1990. if (link) {
  1991. link.version = this.dep.version;
  1992. }
  1993. return this._value;
  1994. }
  1995. set value(newValue) {
  1996. if (this.setter) {
  1997. this.setter(newValue);
  1998. } else {
  1999. warn$2("Write operation failed: computed value is readonly");
  2000. }
  2001. }
  2002. }
  2003. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2004. let getter;
  2005. let setter;
  2006. if (isFunction(getterOrOptions)) {
  2007. getter = getterOrOptions;
  2008. } else {
  2009. getter = getterOrOptions.get;
  2010. setter = getterOrOptions.set;
  2011. }
  2012. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  2013. if (debugOptions && !isSSR) {
  2014. cRef.onTrack = debugOptions.onTrack;
  2015. cRef.onTrigger = debugOptions.onTrigger;
  2016. }
  2017. return cRef;
  2018. }
  2019. const TrackOpTypes = {
  2020. "GET": "get",
  2021. "HAS": "has",
  2022. "ITERATE": "iterate"
  2023. };
  2024. const TriggerOpTypes = {
  2025. "SET": "set",
  2026. "ADD": "add",
  2027. "DELETE": "delete",
  2028. "CLEAR": "clear"
  2029. };
  2030. const INITIAL_WATCHER_VALUE = {};
  2031. const cleanupMap = /* @__PURE__ */ new WeakMap();
  2032. let activeWatcher = void 0;
  2033. function getCurrentWatcher() {
  2034. return activeWatcher;
  2035. }
  2036. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2037. if (owner) {
  2038. let cleanups = cleanupMap.get(owner);
  2039. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2040. cleanups.push(cleanupFn);
  2041. } else if (!failSilently) {
  2042. warn$2(
  2043. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2044. );
  2045. }
  2046. }
  2047. function watch$1(source, cb, options = EMPTY_OBJ) {
  2048. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2049. const warnInvalidSource = (s) => {
  2050. (options.onWarn || warn$2)(
  2051. `Invalid watch source: `,
  2052. s,
  2053. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2054. );
  2055. };
  2056. const reactiveGetter = (source2) => {
  2057. if (deep) return source2;
  2058. if (isShallow(source2) || deep === false || deep === 0)
  2059. return traverse(source2, 1);
  2060. return traverse(source2);
  2061. };
  2062. let effect;
  2063. let getter;
  2064. let cleanup;
  2065. let boundCleanup;
  2066. let forceTrigger = false;
  2067. let isMultiSource = false;
  2068. if (isRef(source)) {
  2069. getter = () => source.value;
  2070. forceTrigger = isShallow(source);
  2071. } else if (isReactive(source)) {
  2072. getter = () => reactiveGetter(source);
  2073. forceTrigger = true;
  2074. } else if (isArray(source)) {
  2075. isMultiSource = true;
  2076. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2077. getter = () => source.map((s) => {
  2078. if (isRef(s)) {
  2079. return s.value;
  2080. } else if (isReactive(s)) {
  2081. return reactiveGetter(s);
  2082. } else if (isFunction(s)) {
  2083. return call ? call(s, 2) : s();
  2084. } else {
  2085. warnInvalidSource(s);
  2086. }
  2087. });
  2088. } else if (isFunction(source)) {
  2089. if (cb) {
  2090. getter = call ? () => call(source, 2) : source;
  2091. } else {
  2092. getter = () => {
  2093. if (cleanup) {
  2094. pauseTracking();
  2095. try {
  2096. cleanup();
  2097. } finally {
  2098. resetTracking();
  2099. }
  2100. }
  2101. const currentEffect = activeWatcher;
  2102. activeWatcher = effect;
  2103. try {
  2104. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2105. } finally {
  2106. activeWatcher = currentEffect;
  2107. }
  2108. };
  2109. }
  2110. } else {
  2111. getter = NOOP;
  2112. warnInvalidSource(source);
  2113. }
  2114. if (cb && deep) {
  2115. const baseGetter = getter;
  2116. const depth = deep === true ? Infinity : deep;
  2117. getter = () => traverse(baseGetter(), depth);
  2118. }
  2119. const scope = getCurrentScope();
  2120. const watchHandle = () => {
  2121. effect.stop();
  2122. if (scope && scope.active) {
  2123. remove(scope.effects, effect);
  2124. }
  2125. };
  2126. if (once && cb) {
  2127. const _cb = cb;
  2128. cb = (...args) => {
  2129. _cb(...args);
  2130. watchHandle();
  2131. };
  2132. }
  2133. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2134. const job = (immediateFirstRun) => {
  2135. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2136. return;
  2137. }
  2138. if (cb) {
  2139. const newValue = effect.run();
  2140. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2141. if (cleanup) {
  2142. cleanup();
  2143. }
  2144. const currentWatcher = activeWatcher;
  2145. activeWatcher = effect;
  2146. try {
  2147. const args = [
  2148. newValue,
  2149. // pass undefined as the old value when it's changed for the first time
  2150. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2151. boundCleanup
  2152. ];
  2153. oldValue = newValue;
  2154. call ? call(cb, 3, args) : (
  2155. // @ts-expect-error
  2156. cb(...args)
  2157. );
  2158. } finally {
  2159. activeWatcher = currentWatcher;
  2160. }
  2161. }
  2162. } else {
  2163. effect.run();
  2164. }
  2165. };
  2166. if (augmentJob) {
  2167. augmentJob(job);
  2168. }
  2169. effect = new ReactiveEffect(getter);
  2170. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2171. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2172. cleanup = effect.onStop = () => {
  2173. const cleanups = cleanupMap.get(effect);
  2174. if (cleanups) {
  2175. if (call) {
  2176. call(cleanups, 4);
  2177. } else {
  2178. for (const cleanup2 of cleanups) cleanup2();
  2179. }
  2180. cleanupMap.delete(effect);
  2181. }
  2182. };
  2183. {
  2184. effect.onTrack = options.onTrack;
  2185. effect.onTrigger = options.onTrigger;
  2186. }
  2187. if (cb) {
  2188. if (immediate) {
  2189. job(true);
  2190. } else {
  2191. oldValue = effect.run();
  2192. }
  2193. } else if (scheduler) {
  2194. scheduler(job.bind(null, true), true);
  2195. } else {
  2196. effect.run();
  2197. }
  2198. watchHandle.pause = effect.pause.bind(effect);
  2199. watchHandle.resume = effect.resume.bind(effect);
  2200. watchHandle.stop = watchHandle;
  2201. return watchHandle;
  2202. }
  2203. function traverse(value, depth = Infinity, seen) {
  2204. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2205. return value;
  2206. }
  2207. seen = seen || /* @__PURE__ */ new Map();
  2208. if ((seen.get(value) || 0) >= depth) {
  2209. return value;
  2210. }
  2211. seen.set(value, depth);
  2212. depth--;
  2213. if (isRef(value)) {
  2214. traverse(value.value, depth, seen);
  2215. } else if (isArray(value)) {
  2216. for (let i = 0; i < value.length; i++) {
  2217. traverse(value[i], depth, seen);
  2218. }
  2219. } else if (isSet(value) || isMap(value)) {
  2220. value.forEach((v) => {
  2221. traverse(v, depth, seen);
  2222. });
  2223. } else if (isPlainObject(value)) {
  2224. for (const key in value) {
  2225. traverse(value[key], depth, seen);
  2226. }
  2227. for (const key of Object.getOwnPropertySymbols(value)) {
  2228. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2229. traverse(value[key], depth, seen);
  2230. }
  2231. }
  2232. }
  2233. return value;
  2234. }
  2235. const stack$1 = [];
  2236. function pushWarningContext(vnode) {
  2237. stack$1.push(vnode);
  2238. }
  2239. function popWarningContext() {
  2240. stack$1.pop();
  2241. }
  2242. let isWarning = false;
  2243. function warn$1(msg, ...args) {
  2244. if (isWarning) return;
  2245. isWarning = true;
  2246. pauseTracking();
  2247. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2248. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2249. const trace = getComponentTrace();
  2250. if (appWarnHandler) {
  2251. callWithErrorHandling(
  2252. appWarnHandler,
  2253. instance,
  2254. 11,
  2255. [
  2256. // eslint-disable-next-line no-restricted-syntax
  2257. msg + args.map((a) => {
  2258. var _a, _b;
  2259. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2260. }).join(""),
  2261. instance && instance.proxy,
  2262. trace.map(
  2263. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2264. ).join("\n"),
  2265. trace
  2266. ]
  2267. );
  2268. } else {
  2269. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2270. if (trace.length && // avoid spamming console during tests
  2271. true) {
  2272. warnArgs.push(`
  2273. `, ...formatTrace(trace));
  2274. }
  2275. console.warn(...warnArgs);
  2276. }
  2277. resetTracking();
  2278. isWarning = false;
  2279. }
  2280. function getComponentTrace() {
  2281. let currentVNode = stack$1[stack$1.length - 1];
  2282. if (!currentVNode) {
  2283. return [];
  2284. }
  2285. const normalizedStack = [];
  2286. while (currentVNode) {
  2287. const last = normalizedStack[0];
  2288. if (last && last.vnode === currentVNode) {
  2289. last.recurseCount++;
  2290. } else {
  2291. normalizedStack.push({
  2292. vnode: currentVNode,
  2293. recurseCount: 0
  2294. });
  2295. }
  2296. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2297. currentVNode = parentInstance && parentInstance.vnode;
  2298. }
  2299. return normalizedStack;
  2300. }
  2301. function formatTrace(trace) {
  2302. const logs = [];
  2303. trace.forEach((entry, i) => {
  2304. logs.push(...i === 0 ? [] : [`
  2305. `], ...formatTraceEntry(entry));
  2306. });
  2307. return logs;
  2308. }
  2309. function formatTraceEntry({ vnode, recurseCount }) {
  2310. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2311. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2312. const open = ` at <${formatComponentName(
  2313. vnode.component,
  2314. vnode.type,
  2315. isRoot
  2316. )}`;
  2317. const close = `>` + postfix;
  2318. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2319. }
  2320. function formatProps(props) {
  2321. const res = [];
  2322. const keys = Object.keys(props);
  2323. keys.slice(0, 3).forEach((key) => {
  2324. res.push(...formatProp(key, props[key]));
  2325. });
  2326. if (keys.length > 3) {
  2327. res.push(` ...`);
  2328. }
  2329. return res;
  2330. }
  2331. function formatProp(key, value, raw) {
  2332. if (isString(value)) {
  2333. value = JSON.stringify(value);
  2334. return raw ? value : [`${key}=${value}`];
  2335. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2336. return raw ? value : [`${key}=${value}`];
  2337. } else if (isRef(value)) {
  2338. value = formatProp(key, toRaw(value.value), true);
  2339. return raw ? value : [`${key}=Ref<`, value, `>`];
  2340. } else if (isFunction(value)) {
  2341. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2342. } else {
  2343. value = toRaw(value);
  2344. return raw ? value : [`${key}=`, value];
  2345. }
  2346. }
  2347. function assertNumber(val, type) {
  2348. if (val === void 0) {
  2349. return;
  2350. } else if (typeof val !== "number") {
  2351. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2352. } else if (isNaN(val)) {
  2353. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2354. }
  2355. }
  2356. const ErrorCodes = {
  2357. "SETUP_FUNCTION": 0,
  2358. "0": "SETUP_FUNCTION",
  2359. "RENDER_FUNCTION": 1,
  2360. "1": "RENDER_FUNCTION",
  2361. "NATIVE_EVENT_HANDLER": 5,
  2362. "5": "NATIVE_EVENT_HANDLER",
  2363. "COMPONENT_EVENT_HANDLER": 6,
  2364. "6": "COMPONENT_EVENT_HANDLER",
  2365. "VNODE_HOOK": 7,
  2366. "7": "VNODE_HOOK",
  2367. "DIRECTIVE_HOOK": 8,
  2368. "8": "DIRECTIVE_HOOK",
  2369. "TRANSITION_HOOK": 9,
  2370. "9": "TRANSITION_HOOK",
  2371. "APP_ERROR_HANDLER": 10,
  2372. "10": "APP_ERROR_HANDLER",
  2373. "APP_WARN_HANDLER": 11,
  2374. "11": "APP_WARN_HANDLER",
  2375. "FUNCTION_REF": 12,
  2376. "12": "FUNCTION_REF",
  2377. "ASYNC_COMPONENT_LOADER": 13,
  2378. "13": "ASYNC_COMPONENT_LOADER",
  2379. "SCHEDULER": 14,
  2380. "14": "SCHEDULER",
  2381. "COMPONENT_UPDATE": 15,
  2382. "15": "COMPONENT_UPDATE",
  2383. "APP_UNMOUNT_CLEANUP": 16,
  2384. "16": "APP_UNMOUNT_CLEANUP"
  2385. };
  2386. const ErrorTypeStrings$1 = {
  2387. ["sp"]: "serverPrefetch hook",
  2388. ["bc"]: "beforeCreate hook",
  2389. ["c"]: "created hook",
  2390. ["bm"]: "beforeMount hook",
  2391. ["m"]: "mounted hook",
  2392. ["bu"]: "beforeUpdate hook",
  2393. ["u"]: "updated",
  2394. ["bum"]: "beforeUnmount hook",
  2395. ["um"]: "unmounted hook",
  2396. ["a"]: "activated hook",
  2397. ["da"]: "deactivated hook",
  2398. ["ec"]: "errorCaptured hook",
  2399. ["rtc"]: "renderTracked hook",
  2400. ["rtg"]: "renderTriggered hook",
  2401. [0]: "setup function",
  2402. [1]: "render function",
  2403. [2]: "watcher getter",
  2404. [3]: "watcher callback",
  2405. [4]: "watcher cleanup function",
  2406. [5]: "native event handler",
  2407. [6]: "component event handler",
  2408. [7]: "vnode hook",
  2409. [8]: "directive hook",
  2410. [9]: "transition hook",
  2411. [10]: "app errorHandler",
  2412. [11]: "app warnHandler",
  2413. [12]: "ref function",
  2414. [13]: "async component loader",
  2415. [14]: "scheduler flush",
  2416. [15]: "component update",
  2417. [16]: "app unmount cleanup function"
  2418. };
  2419. function callWithErrorHandling(fn, instance, type, args) {
  2420. try {
  2421. return args ? fn(...args) : fn();
  2422. } catch (err) {
  2423. handleError(err, instance, type);
  2424. }
  2425. }
  2426. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2427. if (isFunction(fn)) {
  2428. const res = callWithErrorHandling(fn, instance, type, args);
  2429. if (res && isPromise(res)) {
  2430. res.catch((err) => {
  2431. handleError(err, instance, type);
  2432. });
  2433. }
  2434. return res;
  2435. }
  2436. if (isArray(fn)) {
  2437. const values = [];
  2438. for (let i = 0; i < fn.length; i++) {
  2439. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2440. }
  2441. return values;
  2442. } else {
  2443. warn$1(
  2444. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2445. );
  2446. }
  2447. }
  2448. function handleError(err, instance, type, throwInDev = true) {
  2449. const contextVNode = instance ? instance.vnode : null;
  2450. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2451. if (instance) {
  2452. let cur = instance.parent;
  2453. const exposedInstance = instance.proxy;
  2454. const errorInfo = ErrorTypeStrings$1[type] ;
  2455. while (cur) {
  2456. const errorCapturedHooks = cur.ec;
  2457. if (errorCapturedHooks) {
  2458. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2459. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2460. return;
  2461. }
  2462. }
  2463. }
  2464. cur = cur.parent;
  2465. }
  2466. if (errorHandler) {
  2467. pauseTracking();
  2468. callWithErrorHandling(errorHandler, null, 10, [
  2469. err,
  2470. exposedInstance,
  2471. errorInfo
  2472. ]);
  2473. resetTracking();
  2474. return;
  2475. }
  2476. }
  2477. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2478. }
  2479. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2480. {
  2481. const info = ErrorTypeStrings$1[type];
  2482. if (contextVNode) {
  2483. pushWarningContext(contextVNode);
  2484. }
  2485. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2486. if (contextVNode) {
  2487. popWarningContext();
  2488. }
  2489. if (throwInDev) {
  2490. throw err;
  2491. } else {
  2492. console.error(err);
  2493. }
  2494. }
  2495. }
  2496. const queue = [];
  2497. let flushIndex = -1;
  2498. const pendingPostFlushCbs = [];
  2499. let activePostFlushCbs = null;
  2500. let postFlushIndex = 0;
  2501. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2502. let currentFlushPromise = null;
  2503. const RECURSION_LIMIT = 100;
  2504. function nextTick(fn) {
  2505. const p = currentFlushPromise || resolvedPromise;
  2506. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2507. }
  2508. function findInsertionIndex(id) {
  2509. let start = flushIndex + 1;
  2510. let end = queue.length;
  2511. while (start < end) {
  2512. const middle = start + end >>> 1;
  2513. const middleJob = queue[middle];
  2514. const middleJobId = getId(middleJob);
  2515. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2516. start = middle + 1;
  2517. } else {
  2518. end = middle;
  2519. }
  2520. }
  2521. return start;
  2522. }
  2523. function queueJob(job) {
  2524. if (!(job.flags & 1)) {
  2525. const jobId = getId(job);
  2526. const lastJob = queue[queue.length - 1];
  2527. if (!lastJob || // fast path when the job id is larger than the tail
  2528. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2529. queue.push(job);
  2530. } else {
  2531. queue.splice(findInsertionIndex(jobId), 0, job);
  2532. }
  2533. job.flags |= 1;
  2534. queueFlush();
  2535. }
  2536. }
  2537. function queueFlush() {
  2538. if (!currentFlushPromise) {
  2539. currentFlushPromise = resolvedPromise.then(flushJobs);
  2540. }
  2541. }
  2542. function queuePostFlushCb(cb) {
  2543. if (!isArray(cb)) {
  2544. if (activePostFlushCbs && cb.id === -1) {
  2545. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2546. } else if (!(cb.flags & 1)) {
  2547. pendingPostFlushCbs.push(cb);
  2548. cb.flags |= 1;
  2549. }
  2550. } else {
  2551. pendingPostFlushCbs.push(...cb);
  2552. }
  2553. queueFlush();
  2554. }
  2555. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2556. {
  2557. seen = seen || /* @__PURE__ */ new Map();
  2558. }
  2559. for (; i < queue.length; i++) {
  2560. const cb = queue[i];
  2561. if (cb && cb.flags & 2) {
  2562. if (instance && cb.id !== instance.uid) {
  2563. continue;
  2564. }
  2565. if (checkRecursiveUpdates(seen, cb)) {
  2566. continue;
  2567. }
  2568. queue.splice(i, 1);
  2569. i--;
  2570. if (cb.flags & 4) {
  2571. cb.flags &= -2;
  2572. }
  2573. cb();
  2574. if (!(cb.flags & 4)) {
  2575. cb.flags &= -2;
  2576. }
  2577. }
  2578. }
  2579. }
  2580. function flushPostFlushCbs(seen) {
  2581. if (pendingPostFlushCbs.length) {
  2582. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2583. (a, b) => getId(a) - getId(b)
  2584. );
  2585. pendingPostFlushCbs.length = 0;
  2586. if (activePostFlushCbs) {
  2587. activePostFlushCbs.push(...deduped);
  2588. return;
  2589. }
  2590. activePostFlushCbs = deduped;
  2591. {
  2592. seen = seen || /* @__PURE__ */ new Map();
  2593. }
  2594. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2595. const cb = activePostFlushCbs[postFlushIndex];
  2596. if (checkRecursiveUpdates(seen, cb)) {
  2597. continue;
  2598. }
  2599. if (cb.flags & 4) {
  2600. cb.flags &= -2;
  2601. }
  2602. if (!(cb.flags & 8)) cb();
  2603. cb.flags &= -2;
  2604. }
  2605. activePostFlushCbs = null;
  2606. postFlushIndex = 0;
  2607. }
  2608. }
  2609. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2610. function flushJobs(seen) {
  2611. {
  2612. seen = seen || /* @__PURE__ */ new Map();
  2613. }
  2614. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2615. try {
  2616. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2617. const job = queue[flushIndex];
  2618. if (job && !(job.flags & 8)) {
  2619. if (check(job)) {
  2620. continue;
  2621. }
  2622. if (job.flags & 4) {
  2623. job.flags &= ~1;
  2624. }
  2625. callWithErrorHandling(
  2626. job,
  2627. job.i,
  2628. job.i ? 15 : 14
  2629. );
  2630. if (!(job.flags & 4)) {
  2631. job.flags &= ~1;
  2632. }
  2633. }
  2634. }
  2635. } finally {
  2636. for (; flushIndex < queue.length; flushIndex++) {
  2637. const job = queue[flushIndex];
  2638. if (job) {
  2639. job.flags &= -2;
  2640. }
  2641. }
  2642. flushIndex = -1;
  2643. queue.length = 0;
  2644. flushPostFlushCbs(seen);
  2645. currentFlushPromise = null;
  2646. if (queue.length || pendingPostFlushCbs.length) {
  2647. flushJobs(seen);
  2648. }
  2649. }
  2650. }
  2651. function checkRecursiveUpdates(seen, fn) {
  2652. const count = seen.get(fn) || 0;
  2653. if (count > RECURSION_LIMIT) {
  2654. const instance = fn.i;
  2655. const componentName = instance && getComponentName(instance.type);
  2656. handleError(
  2657. `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.`,
  2658. null,
  2659. 10
  2660. );
  2661. return true;
  2662. }
  2663. seen.set(fn, count + 1);
  2664. return false;
  2665. }
  2666. let isHmrUpdating = false;
  2667. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2668. {
  2669. const g = getGlobalThis();
  2670. if (!g.__VUE_HMR_RUNTIME__) {
  2671. g.__VUE_HMR_RUNTIME__ = {
  2672. createRecord: tryWrap(createRecord),
  2673. rerender: tryWrap(rerender),
  2674. reload: tryWrap(reload)
  2675. };
  2676. }
  2677. }
  2678. const map = /* @__PURE__ */ new Map();
  2679. function registerHMR(instance) {
  2680. const id = instance.type.__hmrId;
  2681. let record = map.get(id);
  2682. if (!record) {
  2683. createRecord(id, instance.type);
  2684. record = map.get(id);
  2685. }
  2686. record.instances.add(instance);
  2687. }
  2688. function unregisterHMR(instance) {
  2689. map.get(instance.type.__hmrId).instances.delete(instance);
  2690. }
  2691. function createRecord(id, initialDef) {
  2692. if (map.has(id)) {
  2693. return false;
  2694. }
  2695. map.set(id, {
  2696. initialDef: normalizeClassComponent(initialDef),
  2697. instances: /* @__PURE__ */ new Set()
  2698. });
  2699. return true;
  2700. }
  2701. function normalizeClassComponent(component) {
  2702. return isClassComponent(component) ? component.__vccOpts : component;
  2703. }
  2704. function rerender(id, newRender) {
  2705. const record = map.get(id);
  2706. if (!record) {
  2707. return;
  2708. }
  2709. record.initialDef.render = newRender;
  2710. [...record.instances].forEach((instance) => {
  2711. if (newRender) {
  2712. instance.render = newRender;
  2713. normalizeClassComponent(instance.type).render = newRender;
  2714. }
  2715. instance.renderCache = [];
  2716. isHmrUpdating = true;
  2717. if (!(instance.job.flags & 8)) {
  2718. instance.update();
  2719. }
  2720. isHmrUpdating = false;
  2721. });
  2722. }
  2723. function reload(id, newComp) {
  2724. const record = map.get(id);
  2725. if (!record) return;
  2726. newComp = normalizeClassComponent(newComp);
  2727. updateComponentDef(record.initialDef, newComp);
  2728. const instances = [...record.instances];
  2729. for (let i = 0; i < instances.length; i++) {
  2730. const instance = instances[i];
  2731. const oldComp = normalizeClassComponent(instance.type);
  2732. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2733. if (!dirtyInstances) {
  2734. if (oldComp !== record.initialDef) {
  2735. updateComponentDef(oldComp, newComp);
  2736. }
  2737. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2738. }
  2739. dirtyInstances.add(instance);
  2740. instance.appContext.propsCache.delete(instance.type);
  2741. instance.appContext.emitsCache.delete(instance.type);
  2742. instance.appContext.optionsCache.delete(instance.type);
  2743. if (instance.ceReload) {
  2744. dirtyInstances.add(instance);
  2745. instance.ceReload(newComp.styles);
  2746. dirtyInstances.delete(instance);
  2747. } else if (instance.parent) {
  2748. queueJob(() => {
  2749. if (!(instance.job.flags & 8)) {
  2750. isHmrUpdating = true;
  2751. instance.parent.update();
  2752. isHmrUpdating = false;
  2753. dirtyInstances.delete(instance);
  2754. }
  2755. });
  2756. } else if (instance.appContext.reload) {
  2757. instance.appContext.reload();
  2758. } else if (typeof window !== "undefined") {
  2759. window.location.reload();
  2760. } else {
  2761. console.warn(
  2762. "[HMR] Root or manually mounted instance modified. Full reload required."
  2763. );
  2764. }
  2765. if (instance.root.ce && instance !== instance.root) {
  2766. instance.root.ce._removeChildStyle(oldComp);
  2767. }
  2768. }
  2769. queuePostFlushCb(() => {
  2770. hmrDirtyComponents.clear();
  2771. });
  2772. }
  2773. function updateComponentDef(oldComp, newComp) {
  2774. extend(oldComp, newComp);
  2775. for (const key in oldComp) {
  2776. if (key !== "__file" && !(key in newComp)) {
  2777. delete oldComp[key];
  2778. }
  2779. }
  2780. }
  2781. function tryWrap(fn) {
  2782. return (id, arg) => {
  2783. try {
  2784. return fn(id, arg);
  2785. } catch (e) {
  2786. console.error(e);
  2787. console.warn(
  2788. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2789. );
  2790. }
  2791. };
  2792. }
  2793. let devtools$1;
  2794. let buffer = [];
  2795. let devtoolsNotInstalled = false;
  2796. function emit$1(event, ...args) {
  2797. if (devtools$1) {
  2798. devtools$1.emit(event, ...args);
  2799. } else if (!devtoolsNotInstalled) {
  2800. buffer.push({ event, args });
  2801. }
  2802. }
  2803. function setDevtoolsHook$1(hook, target) {
  2804. var _a, _b;
  2805. devtools$1 = hook;
  2806. if (devtools$1) {
  2807. devtools$1.enabled = true;
  2808. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2809. buffer = [];
  2810. } else if (
  2811. // handle late devtools injection - only do this if we are in an actual
  2812. // browser environment to avoid the timer handle stalling test runner exit
  2813. // (#4815)
  2814. typeof window !== "undefined" && // some envs mock window but not fully
  2815. window.HTMLElement && // also exclude jsdom
  2816. // eslint-disable-next-line no-restricted-syntax
  2817. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2818. ) {
  2819. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2820. replay.push((newHook) => {
  2821. setDevtoolsHook$1(newHook, target);
  2822. });
  2823. setTimeout(() => {
  2824. if (!devtools$1) {
  2825. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2826. devtoolsNotInstalled = true;
  2827. buffer = [];
  2828. }
  2829. }, 3e3);
  2830. } else {
  2831. devtoolsNotInstalled = true;
  2832. buffer = [];
  2833. }
  2834. }
  2835. function devtoolsInitApp(app, version) {
  2836. emit$1("app:init" /* APP_INIT */, app, version, {
  2837. Fragment,
  2838. Text,
  2839. Comment,
  2840. Static
  2841. });
  2842. }
  2843. function devtoolsUnmountApp(app) {
  2844. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2845. }
  2846. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2847. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2848. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2849. "component:removed" /* COMPONENT_REMOVED */
  2850. );
  2851. const devtoolsComponentRemoved = (component) => {
  2852. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2853. !devtools$1.cleanupBuffer(component)) {
  2854. _devtoolsComponentRemoved(component);
  2855. }
  2856. };
  2857. // @__NO_SIDE_EFFECTS__
  2858. function createDevtoolsComponentHook(hook) {
  2859. return (component) => {
  2860. emit$1(
  2861. hook,
  2862. component.appContext.app,
  2863. component.uid,
  2864. component.parent ? component.parent.uid : void 0,
  2865. component
  2866. );
  2867. };
  2868. }
  2869. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2870. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2871. function createDevtoolsPerformanceHook(hook) {
  2872. return (component, type, time) => {
  2873. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2874. };
  2875. }
  2876. function devtoolsComponentEmit(component, event, params) {
  2877. emit$1(
  2878. "component:emit" /* COMPONENT_EMIT */,
  2879. component.appContext.app,
  2880. component,
  2881. event,
  2882. params
  2883. );
  2884. }
  2885. let currentRenderingInstance = null;
  2886. let currentScopeId = null;
  2887. function setCurrentRenderingInstance(instance) {
  2888. const prev = currentRenderingInstance;
  2889. currentRenderingInstance = instance;
  2890. currentScopeId = instance && instance.type.__scopeId || null;
  2891. return prev;
  2892. }
  2893. function pushScopeId(id) {
  2894. currentScopeId = id;
  2895. }
  2896. function popScopeId() {
  2897. currentScopeId = null;
  2898. }
  2899. const withScopeId = (_id) => withCtx;
  2900. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2901. if (!ctx) return fn;
  2902. if (fn._n) {
  2903. return fn;
  2904. }
  2905. const renderFnWithContext = (...args) => {
  2906. if (renderFnWithContext._d) {
  2907. setBlockTracking(-1);
  2908. }
  2909. const prevInstance = setCurrentRenderingInstance(ctx);
  2910. let res;
  2911. try {
  2912. res = fn(...args);
  2913. } finally {
  2914. setCurrentRenderingInstance(prevInstance);
  2915. if (renderFnWithContext._d) {
  2916. setBlockTracking(1);
  2917. }
  2918. }
  2919. {
  2920. devtoolsComponentUpdated(ctx);
  2921. }
  2922. return res;
  2923. };
  2924. renderFnWithContext._n = true;
  2925. renderFnWithContext._c = true;
  2926. renderFnWithContext._d = true;
  2927. return renderFnWithContext;
  2928. }
  2929. function validateDirectiveName(name) {
  2930. if (isBuiltInDirective(name)) {
  2931. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2932. }
  2933. }
  2934. function withDirectives(vnode, directives) {
  2935. if (currentRenderingInstance === null) {
  2936. warn$1(`withDirectives can only be used inside render functions.`);
  2937. return vnode;
  2938. }
  2939. const instance = getComponentPublicInstance(currentRenderingInstance);
  2940. const bindings = vnode.dirs || (vnode.dirs = []);
  2941. for (let i = 0; i < directives.length; i++) {
  2942. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2943. if (dir) {
  2944. if (isFunction(dir)) {
  2945. dir = {
  2946. mounted: dir,
  2947. updated: dir
  2948. };
  2949. }
  2950. if (dir.deep) {
  2951. traverse(value);
  2952. }
  2953. bindings.push({
  2954. dir,
  2955. instance,
  2956. value,
  2957. oldValue: void 0,
  2958. arg,
  2959. modifiers
  2960. });
  2961. }
  2962. }
  2963. return vnode;
  2964. }
  2965. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2966. const bindings = vnode.dirs;
  2967. const oldBindings = prevVNode && prevVNode.dirs;
  2968. for (let i = 0; i < bindings.length; i++) {
  2969. const binding = bindings[i];
  2970. if (oldBindings) {
  2971. binding.oldValue = oldBindings[i].value;
  2972. }
  2973. let hook = binding.dir[name];
  2974. if (hook) {
  2975. pauseTracking();
  2976. callWithAsyncErrorHandling(hook, instance, 8, [
  2977. vnode.el,
  2978. binding,
  2979. vnode,
  2980. prevVNode
  2981. ]);
  2982. resetTracking();
  2983. }
  2984. }
  2985. }
  2986. const TeleportEndKey = Symbol("_vte");
  2987. const isTeleport = (type) => type.__isTeleport;
  2988. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  2989. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  2990. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  2991. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  2992. const resolveTarget = (props, select) => {
  2993. const targetSelector = props && props.to;
  2994. if (isString(targetSelector)) {
  2995. if (!select) {
  2996. warn$1(
  2997. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  2998. );
  2999. return null;
  3000. } else {
  3001. const target = select(targetSelector);
  3002. if (!target && !isTeleportDisabled(props)) {
  3003. warn$1(
  3004. `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.`
  3005. );
  3006. }
  3007. return target;
  3008. }
  3009. } else {
  3010. if (!targetSelector && !isTeleportDisabled(props)) {
  3011. warn$1(`Invalid Teleport target: ${targetSelector}`);
  3012. }
  3013. return targetSelector;
  3014. }
  3015. };
  3016. const TeleportImpl = {
  3017. name: "Teleport",
  3018. __isTeleport: true,
  3019. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  3020. const {
  3021. mc: mountChildren,
  3022. pc: patchChildren,
  3023. pbc: patchBlockChildren,
  3024. o: { insert, querySelector, createText, createComment }
  3025. } = internals;
  3026. const disabled = isTeleportDisabled(n2.props);
  3027. let { shapeFlag, children, dynamicChildren } = n2;
  3028. if (isHmrUpdating) {
  3029. optimized = false;
  3030. dynamicChildren = null;
  3031. }
  3032. if (n1 == null) {
  3033. const placeholder = n2.el = createComment("teleport start") ;
  3034. const mainAnchor = n2.anchor = createComment("teleport end") ;
  3035. insert(placeholder, container, anchor);
  3036. insert(mainAnchor, container, anchor);
  3037. const mount = (container2, anchor2) => {
  3038. if (shapeFlag & 16) {
  3039. if (parentComponent && parentComponent.isCE) {
  3040. parentComponent.ce._teleportTarget = container2;
  3041. }
  3042. mountChildren(
  3043. children,
  3044. container2,
  3045. anchor2,
  3046. parentComponent,
  3047. parentSuspense,
  3048. namespace,
  3049. slotScopeIds,
  3050. optimized
  3051. );
  3052. }
  3053. };
  3054. const mountToTarget = () => {
  3055. const target = n2.target = resolveTarget(n2.props, querySelector);
  3056. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  3057. if (target) {
  3058. if (namespace !== "svg" && isTargetSVG(target)) {
  3059. namespace = "svg";
  3060. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3061. namespace = "mathml";
  3062. }
  3063. if (!disabled) {
  3064. mount(target, targetAnchor);
  3065. updateCssVars(n2, false);
  3066. }
  3067. } else if (!disabled) {
  3068. warn$1(
  3069. "Invalid Teleport target on mount:",
  3070. target,
  3071. `(${typeof target})`
  3072. );
  3073. }
  3074. };
  3075. if (disabled) {
  3076. mount(container, mainAnchor);
  3077. updateCssVars(n2, true);
  3078. }
  3079. if (isTeleportDeferred(n2.props)) {
  3080. n2.el.__isMounted = false;
  3081. queuePostRenderEffect(() => {
  3082. mountToTarget();
  3083. delete n2.el.__isMounted;
  3084. }, parentSuspense);
  3085. } else {
  3086. mountToTarget();
  3087. }
  3088. } else {
  3089. if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
  3090. queuePostRenderEffect(() => {
  3091. TeleportImpl.process(
  3092. n1,
  3093. n2,
  3094. container,
  3095. anchor,
  3096. parentComponent,
  3097. parentSuspense,
  3098. namespace,
  3099. slotScopeIds,
  3100. optimized,
  3101. internals
  3102. );
  3103. }, parentSuspense);
  3104. return;
  3105. }
  3106. n2.el = n1.el;
  3107. n2.targetStart = n1.targetStart;
  3108. const mainAnchor = n2.anchor = n1.anchor;
  3109. const target = n2.target = n1.target;
  3110. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3111. const wasDisabled = isTeleportDisabled(n1.props);
  3112. const currentContainer = wasDisabled ? container : target;
  3113. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3114. if (namespace === "svg" || isTargetSVG(target)) {
  3115. namespace = "svg";
  3116. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3117. namespace = "mathml";
  3118. }
  3119. if (dynamicChildren) {
  3120. patchBlockChildren(
  3121. n1.dynamicChildren,
  3122. dynamicChildren,
  3123. currentContainer,
  3124. parentComponent,
  3125. parentSuspense,
  3126. namespace,
  3127. slotScopeIds
  3128. );
  3129. traverseStaticChildren(n1, n2, false);
  3130. } else if (!optimized) {
  3131. patchChildren(
  3132. n1,
  3133. n2,
  3134. currentContainer,
  3135. currentAnchor,
  3136. parentComponent,
  3137. parentSuspense,
  3138. namespace,
  3139. slotScopeIds,
  3140. false
  3141. );
  3142. }
  3143. if (disabled) {
  3144. if (!wasDisabled) {
  3145. moveTeleport(
  3146. n2,
  3147. container,
  3148. mainAnchor,
  3149. internals,
  3150. 1
  3151. );
  3152. } else {
  3153. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3154. n2.props.to = n1.props.to;
  3155. }
  3156. }
  3157. } else {
  3158. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3159. const nextTarget = n2.target = resolveTarget(
  3160. n2.props,
  3161. querySelector
  3162. );
  3163. if (nextTarget) {
  3164. moveTeleport(
  3165. n2,
  3166. nextTarget,
  3167. null,
  3168. internals,
  3169. 0
  3170. );
  3171. } else {
  3172. warn$1(
  3173. "Invalid Teleport target on update:",
  3174. target,
  3175. `(${typeof target})`
  3176. );
  3177. }
  3178. } else if (wasDisabled) {
  3179. moveTeleport(
  3180. n2,
  3181. target,
  3182. targetAnchor,
  3183. internals,
  3184. 1
  3185. );
  3186. }
  3187. }
  3188. updateCssVars(n2, disabled);
  3189. }
  3190. },
  3191. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3192. const {
  3193. shapeFlag,
  3194. children,
  3195. anchor,
  3196. targetStart,
  3197. targetAnchor,
  3198. target,
  3199. props
  3200. } = vnode;
  3201. if (target) {
  3202. hostRemove(targetStart);
  3203. hostRemove(targetAnchor);
  3204. }
  3205. doRemove && hostRemove(anchor);
  3206. if (shapeFlag & 16) {
  3207. const shouldRemove = doRemove || !isTeleportDisabled(props);
  3208. for (let i = 0; i < children.length; i++) {
  3209. const child = children[i];
  3210. unmount(
  3211. child,
  3212. parentComponent,
  3213. parentSuspense,
  3214. shouldRemove,
  3215. !!child.dynamicChildren
  3216. );
  3217. }
  3218. }
  3219. },
  3220. move: moveTeleport,
  3221. hydrate: hydrateTeleport
  3222. };
  3223. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3224. if (moveType === 0) {
  3225. insert(vnode.targetAnchor, container, parentAnchor);
  3226. }
  3227. const { el, anchor, shapeFlag, children, props } = vnode;
  3228. const isReorder = moveType === 2;
  3229. if (isReorder) {
  3230. insert(el, container, parentAnchor);
  3231. }
  3232. if (!isReorder || isTeleportDisabled(props)) {
  3233. if (shapeFlag & 16) {
  3234. for (let i = 0; i < children.length; i++) {
  3235. move(
  3236. children[i],
  3237. container,
  3238. parentAnchor,
  3239. 2
  3240. );
  3241. }
  3242. }
  3243. }
  3244. if (isReorder) {
  3245. insert(anchor, container, parentAnchor);
  3246. }
  3247. }
  3248. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3249. o: { nextSibling, parentNode, querySelector, insert, createText }
  3250. }, hydrateChildren) {
  3251. function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
  3252. vnode2.anchor = hydrateChildren(
  3253. nextSibling(node2),
  3254. vnode2,
  3255. parentNode(node2),
  3256. parentComponent,
  3257. parentSuspense,
  3258. slotScopeIds,
  3259. optimized
  3260. );
  3261. vnode2.targetStart = targetStart;
  3262. vnode2.targetAnchor = targetAnchor;
  3263. }
  3264. const target = vnode.target = resolveTarget(
  3265. vnode.props,
  3266. querySelector
  3267. );
  3268. const disabled = isTeleportDisabled(vnode.props);
  3269. if (target) {
  3270. const targetNode = target._lpa || target.firstChild;
  3271. if (vnode.shapeFlag & 16) {
  3272. if (disabled) {
  3273. hydrateDisabledTeleport(
  3274. node,
  3275. vnode,
  3276. targetNode,
  3277. targetNode && nextSibling(targetNode)
  3278. );
  3279. } else {
  3280. vnode.anchor = nextSibling(node);
  3281. let targetAnchor = targetNode;
  3282. while (targetAnchor) {
  3283. if (targetAnchor && targetAnchor.nodeType === 8) {
  3284. if (targetAnchor.data === "teleport start anchor") {
  3285. vnode.targetStart = targetAnchor;
  3286. } else if (targetAnchor.data === "teleport anchor") {
  3287. vnode.targetAnchor = targetAnchor;
  3288. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3289. break;
  3290. }
  3291. }
  3292. targetAnchor = nextSibling(targetAnchor);
  3293. }
  3294. if (!vnode.targetAnchor) {
  3295. prepareAnchor(target, vnode, createText, insert);
  3296. }
  3297. hydrateChildren(
  3298. targetNode && nextSibling(targetNode),
  3299. vnode,
  3300. target,
  3301. parentComponent,
  3302. parentSuspense,
  3303. slotScopeIds,
  3304. optimized
  3305. );
  3306. }
  3307. }
  3308. updateCssVars(vnode, disabled);
  3309. } else if (disabled) {
  3310. if (vnode.shapeFlag & 16) {
  3311. hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
  3312. }
  3313. }
  3314. return vnode.anchor && nextSibling(vnode.anchor);
  3315. }
  3316. const Teleport = TeleportImpl;
  3317. function updateCssVars(vnode, isDisabled) {
  3318. const ctx = vnode.ctx;
  3319. if (ctx && ctx.ut) {
  3320. let node, anchor;
  3321. if (isDisabled) {
  3322. node = vnode.el;
  3323. anchor = vnode.anchor;
  3324. } else {
  3325. node = vnode.targetStart;
  3326. anchor = vnode.targetAnchor;
  3327. }
  3328. while (node && node !== anchor) {
  3329. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3330. node = node.nextSibling;
  3331. }
  3332. ctx.ut();
  3333. }
  3334. }
  3335. function prepareAnchor(target, vnode, createText, insert) {
  3336. const targetStart = vnode.targetStart = createText("");
  3337. const targetAnchor = vnode.targetAnchor = createText("");
  3338. targetStart[TeleportEndKey] = targetAnchor;
  3339. if (target) {
  3340. insert(targetStart, target);
  3341. insert(targetAnchor, target);
  3342. }
  3343. return targetAnchor;
  3344. }
  3345. const leaveCbKey = Symbol("_leaveCb");
  3346. const enterCbKey$1 = Symbol("_enterCb");
  3347. function useTransitionState() {
  3348. const state = {
  3349. isMounted: false,
  3350. isLeaving: false,
  3351. isUnmounting: false,
  3352. leavingVNodes: /* @__PURE__ */ new Map()
  3353. };
  3354. onMounted(() => {
  3355. state.isMounted = true;
  3356. });
  3357. onBeforeUnmount(() => {
  3358. state.isUnmounting = true;
  3359. });
  3360. return state;
  3361. }
  3362. const TransitionHookValidator = [Function, Array];
  3363. const BaseTransitionPropsValidators = {
  3364. mode: String,
  3365. appear: Boolean,
  3366. persisted: Boolean,
  3367. // enter
  3368. onBeforeEnter: TransitionHookValidator,
  3369. onEnter: TransitionHookValidator,
  3370. onAfterEnter: TransitionHookValidator,
  3371. onEnterCancelled: TransitionHookValidator,
  3372. // leave
  3373. onBeforeLeave: TransitionHookValidator,
  3374. onLeave: TransitionHookValidator,
  3375. onAfterLeave: TransitionHookValidator,
  3376. onLeaveCancelled: TransitionHookValidator,
  3377. // appear
  3378. onBeforeAppear: TransitionHookValidator,
  3379. onAppear: TransitionHookValidator,
  3380. onAfterAppear: TransitionHookValidator,
  3381. onAppearCancelled: TransitionHookValidator
  3382. };
  3383. const recursiveGetSubtree = (instance) => {
  3384. const subTree = instance.subTree;
  3385. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3386. };
  3387. const BaseTransitionImpl = {
  3388. name: `BaseTransition`,
  3389. props: BaseTransitionPropsValidators,
  3390. setup(props, { slots }) {
  3391. const instance = getCurrentInstance();
  3392. const state = useTransitionState();
  3393. return () => {
  3394. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3395. if (!children || !children.length) {
  3396. return;
  3397. }
  3398. const child = findNonCommentChild(children);
  3399. const rawProps = toRaw(props);
  3400. const { mode } = rawProps;
  3401. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3402. warn$1(`invalid <transition> mode: ${mode}`);
  3403. }
  3404. if (state.isLeaving) {
  3405. return emptyPlaceholder(child);
  3406. }
  3407. const innerChild = getInnerChild$1(child);
  3408. if (!innerChild) {
  3409. return emptyPlaceholder(child);
  3410. }
  3411. let enterHooks = resolveTransitionHooks(
  3412. innerChild,
  3413. rawProps,
  3414. state,
  3415. instance,
  3416. // #11061, ensure enterHooks is fresh after clone
  3417. (hooks) => enterHooks = hooks
  3418. );
  3419. if (innerChild.type !== Comment) {
  3420. setTransitionHooks(innerChild, enterHooks);
  3421. }
  3422. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3423. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3424. let leavingHooks = resolveTransitionHooks(
  3425. oldInnerChild,
  3426. rawProps,
  3427. state,
  3428. instance
  3429. );
  3430. setTransitionHooks(oldInnerChild, leavingHooks);
  3431. if (mode === "out-in" && innerChild.type !== Comment) {
  3432. state.isLeaving = true;
  3433. leavingHooks.afterLeave = () => {
  3434. state.isLeaving = false;
  3435. if (!(instance.job.flags & 8)) {
  3436. instance.update();
  3437. }
  3438. delete leavingHooks.afterLeave;
  3439. oldInnerChild = void 0;
  3440. };
  3441. return emptyPlaceholder(child);
  3442. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3443. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3444. const leavingVNodesCache = getLeavingNodesForType(
  3445. state,
  3446. oldInnerChild
  3447. );
  3448. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3449. el[leaveCbKey] = () => {
  3450. earlyRemove();
  3451. el[leaveCbKey] = void 0;
  3452. delete enterHooks.delayedLeave;
  3453. oldInnerChild = void 0;
  3454. };
  3455. enterHooks.delayedLeave = () => {
  3456. delayedLeave();
  3457. delete enterHooks.delayedLeave;
  3458. oldInnerChild = void 0;
  3459. };
  3460. };
  3461. } else {
  3462. oldInnerChild = void 0;
  3463. }
  3464. } else if (oldInnerChild) {
  3465. oldInnerChild = void 0;
  3466. }
  3467. return child;
  3468. };
  3469. }
  3470. };
  3471. function findNonCommentChild(children) {
  3472. let child = children[0];
  3473. if (children.length > 1) {
  3474. let hasFound = false;
  3475. for (const c of children) {
  3476. if (c.type !== Comment) {
  3477. if (hasFound) {
  3478. warn$1(
  3479. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3480. );
  3481. break;
  3482. }
  3483. child = c;
  3484. hasFound = true;
  3485. }
  3486. }
  3487. }
  3488. return child;
  3489. }
  3490. const BaseTransition = BaseTransitionImpl;
  3491. function getLeavingNodesForType(state, vnode) {
  3492. const { leavingVNodes } = state;
  3493. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3494. if (!leavingVNodesCache) {
  3495. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3496. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3497. }
  3498. return leavingVNodesCache;
  3499. }
  3500. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3501. const {
  3502. appear,
  3503. mode,
  3504. persisted = false,
  3505. onBeforeEnter,
  3506. onEnter,
  3507. onAfterEnter,
  3508. onEnterCancelled,
  3509. onBeforeLeave,
  3510. onLeave,
  3511. onAfterLeave,
  3512. onLeaveCancelled,
  3513. onBeforeAppear,
  3514. onAppear,
  3515. onAfterAppear,
  3516. onAppearCancelled
  3517. } = props;
  3518. const key = String(vnode.key);
  3519. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3520. const callHook = (hook, args) => {
  3521. hook && callWithAsyncErrorHandling(
  3522. hook,
  3523. instance,
  3524. 9,
  3525. args
  3526. );
  3527. };
  3528. const callAsyncHook = (hook, args) => {
  3529. const done = args[1];
  3530. callHook(hook, args);
  3531. if (isArray(hook)) {
  3532. if (hook.every((hook2) => hook2.length <= 1)) done();
  3533. } else if (hook.length <= 1) {
  3534. done();
  3535. }
  3536. };
  3537. const hooks = {
  3538. mode,
  3539. persisted,
  3540. beforeEnter(el) {
  3541. let hook = onBeforeEnter;
  3542. if (!state.isMounted) {
  3543. if (appear) {
  3544. hook = onBeforeAppear || onBeforeEnter;
  3545. } else {
  3546. return;
  3547. }
  3548. }
  3549. if (el[leaveCbKey]) {
  3550. el[leaveCbKey](
  3551. true
  3552. /* cancelled */
  3553. );
  3554. }
  3555. const leavingVNode = leavingVNodesCache[key];
  3556. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3557. leavingVNode.el[leaveCbKey]();
  3558. }
  3559. callHook(hook, [el]);
  3560. },
  3561. enter(el) {
  3562. let hook = onEnter;
  3563. let afterHook = onAfterEnter;
  3564. let cancelHook = onEnterCancelled;
  3565. if (!state.isMounted) {
  3566. if (appear) {
  3567. hook = onAppear || onEnter;
  3568. afterHook = onAfterAppear || onAfterEnter;
  3569. cancelHook = onAppearCancelled || onEnterCancelled;
  3570. } else {
  3571. return;
  3572. }
  3573. }
  3574. let called = false;
  3575. const done = el[enterCbKey$1] = (cancelled) => {
  3576. if (called) return;
  3577. called = true;
  3578. if (cancelled) {
  3579. callHook(cancelHook, [el]);
  3580. } else {
  3581. callHook(afterHook, [el]);
  3582. }
  3583. if (hooks.delayedLeave) {
  3584. hooks.delayedLeave();
  3585. }
  3586. el[enterCbKey$1] = void 0;
  3587. };
  3588. if (hook) {
  3589. callAsyncHook(hook, [el, done]);
  3590. } else {
  3591. done();
  3592. }
  3593. },
  3594. leave(el, remove) {
  3595. const key2 = String(vnode.key);
  3596. if (el[enterCbKey$1]) {
  3597. el[enterCbKey$1](
  3598. true
  3599. /* cancelled */
  3600. );
  3601. }
  3602. if (state.isUnmounting) {
  3603. return remove();
  3604. }
  3605. callHook(onBeforeLeave, [el]);
  3606. let called = false;
  3607. const done = el[leaveCbKey] = (cancelled) => {
  3608. if (called) return;
  3609. called = true;
  3610. remove();
  3611. if (cancelled) {
  3612. callHook(onLeaveCancelled, [el]);
  3613. } else {
  3614. callHook(onAfterLeave, [el]);
  3615. }
  3616. el[leaveCbKey] = void 0;
  3617. if (leavingVNodesCache[key2] === vnode) {
  3618. delete leavingVNodesCache[key2];
  3619. }
  3620. };
  3621. leavingVNodesCache[key2] = vnode;
  3622. if (onLeave) {
  3623. callAsyncHook(onLeave, [el, done]);
  3624. } else {
  3625. done();
  3626. }
  3627. },
  3628. clone(vnode2) {
  3629. const hooks2 = resolveTransitionHooks(
  3630. vnode2,
  3631. props,
  3632. state,
  3633. instance,
  3634. postClone
  3635. );
  3636. if (postClone) postClone(hooks2);
  3637. return hooks2;
  3638. }
  3639. };
  3640. return hooks;
  3641. }
  3642. function emptyPlaceholder(vnode) {
  3643. if (isKeepAlive(vnode)) {
  3644. vnode = cloneVNode(vnode);
  3645. vnode.children = null;
  3646. return vnode;
  3647. }
  3648. }
  3649. function getInnerChild$1(vnode) {
  3650. if (!isKeepAlive(vnode)) {
  3651. if (isTeleport(vnode.type) && vnode.children) {
  3652. return findNonCommentChild(vnode.children);
  3653. }
  3654. return vnode;
  3655. }
  3656. if (vnode.component) {
  3657. return vnode.component.subTree;
  3658. }
  3659. const { shapeFlag, children } = vnode;
  3660. if (children) {
  3661. if (shapeFlag & 16) {
  3662. return children[0];
  3663. }
  3664. if (shapeFlag & 32 && isFunction(children.default)) {
  3665. return children.default();
  3666. }
  3667. }
  3668. }
  3669. function setTransitionHooks(vnode, hooks) {
  3670. if (vnode.shapeFlag & 6 && vnode.component) {
  3671. vnode.transition = hooks;
  3672. setTransitionHooks(vnode.component.subTree, hooks);
  3673. } else if (vnode.shapeFlag & 128) {
  3674. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3675. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3676. } else {
  3677. vnode.transition = hooks;
  3678. }
  3679. }
  3680. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3681. let ret = [];
  3682. let keyedFragmentCount = 0;
  3683. for (let i = 0; i < children.length; i++) {
  3684. let child = children[i];
  3685. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3686. if (child.type === Fragment) {
  3687. if (child.patchFlag & 128) keyedFragmentCount++;
  3688. ret = ret.concat(
  3689. getTransitionRawChildren(child.children, keepComment, key)
  3690. );
  3691. } else if (keepComment || child.type !== Comment) {
  3692. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3693. }
  3694. }
  3695. if (keyedFragmentCount > 1) {
  3696. for (let i = 0; i < ret.length; i++) {
  3697. ret[i].patchFlag = -2;
  3698. }
  3699. }
  3700. return ret;
  3701. }
  3702. // @__NO_SIDE_EFFECTS__
  3703. function defineComponent(options, extraOptions) {
  3704. return isFunction(options) ? (
  3705. // #8236: extend call and options.name access are considered side-effects
  3706. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3707. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3708. ) : options;
  3709. }
  3710. function useId() {
  3711. const i = getCurrentInstance();
  3712. if (i) {
  3713. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3714. } else {
  3715. warn$1(
  3716. `useId() is called when there is no active component instance to be associated with.`
  3717. );
  3718. }
  3719. return "";
  3720. }
  3721. function markAsyncBoundary(instance) {
  3722. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3723. }
  3724. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3725. function useTemplateRef(key) {
  3726. const i = getCurrentInstance();
  3727. const r = shallowRef(null);
  3728. if (i) {
  3729. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3730. let desc;
  3731. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  3732. warn$1(`useTemplateRef('${key}') already exists.`);
  3733. } else {
  3734. Object.defineProperty(refs, key, {
  3735. enumerable: true,
  3736. get: () => r.value,
  3737. set: (val) => r.value = val
  3738. });
  3739. }
  3740. } else {
  3741. warn$1(
  3742. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3743. );
  3744. }
  3745. const ret = readonly(r) ;
  3746. {
  3747. knownTemplateRefs.add(ret);
  3748. }
  3749. return ret;
  3750. }
  3751. const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
  3752. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3753. if (isArray(rawRef)) {
  3754. rawRef.forEach(
  3755. (r, i) => setRef(
  3756. r,
  3757. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3758. parentSuspense,
  3759. vnode,
  3760. isUnmount
  3761. )
  3762. );
  3763. return;
  3764. }
  3765. if (isAsyncWrapper(vnode) && !isUnmount) {
  3766. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  3767. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  3768. }
  3769. return;
  3770. }
  3771. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3772. const value = isUnmount ? null : refValue;
  3773. const { i: owner, r: ref } = rawRef;
  3774. if (!owner) {
  3775. warn$1(
  3776. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3777. );
  3778. return;
  3779. }
  3780. const oldRef = oldRawRef && oldRawRef.r;
  3781. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3782. const setupState = owner.setupState;
  3783. const rawSetupState = toRaw(setupState);
  3784. const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
  3785. {
  3786. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3787. warn$1(
  3788. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3789. );
  3790. }
  3791. if (knownTemplateRefs.has(rawSetupState[key])) {
  3792. return false;
  3793. }
  3794. }
  3795. return hasOwn(rawSetupState, key);
  3796. };
  3797. const canSetRef = (ref2) => {
  3798. return !knownTemplateRefs.has(ref2);
  3799. };
  3800. if (oldRef != null && oldRef !== ref) {
  3801. invalidatePendingSetRef(oldRawRef);
  3802. if (isString(oldRef)) {
  3803. refs[oldRef] = null;
  3804. if (canSetSetupRef(oldRef)) {
  3805. setupState[oldRef] = null;
  3806. }
  3807. } else if (isRef(oldRef)) {
  3808. if (canSetRef(oldRef)) {
  3809. oldRef.value = null;
  3810. }
  3811. const oldRawRefAtom = oldRawRef;
  3812. if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
  3813. }
  3814. }
  3815. if (isFunction(ref)) {
  3816. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3817. } else {
  3818. const _isString = isString(ref);
  3819. const _isRef = isRef(ref);
  3820. if (_isString || _isRef) {
  3821. const doSet = () => {
  3822. if (rawRef.f) {
  3823. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
  3824. if (isUnmount) {
  3825. isArray(existing) && remove(existing, refValue);
  3826. } else {
  3827. if (!isArray(existing)) {
  3828. if (_isString) {
  3829. refs[ref] = [refValue];
  3830. if (canSetSetupRef(ref)) {
  3831. setupState[ref] = refs[ref];
  3832. }
  3833. } else {
  3834. const newVal = [refValue];
  3835. if (canSetRef(ref)) {
  3836. ref.value = newVal;
  3837. }
  3838. if (rawRef.k) refs[rawRef.k] = newVal;
  3839. }
  3840. } else if (!existing.includes(refValue)) {
  3841. existing.push(refValue);
  3842. }
  3843. }
  3844. } else if (_isString) {
  3845. refs[ref] = value;
  3846. if (canSetSetupRef(ref)) {
  3847. setupState[ref] = value;
  3848. }
  3849. } else if (_isRef) {
  3850. if (canSetRef(ref)) {
  3851. ref.value = value;
  3852. }
  3853. if (rawRef.k) refs[rawRef.k] = value;
  3854. } else {
  3855. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3856. }
  3857. };
  3858. if (value) {
  3859. const job = () => {
  3860. doSet();
  3861. pendingSetRefMap.delete(rawRef);
  3862. };
  3863. job.id = -1;
  3864. pendingSetRefMap.set(rawRef, job);
  3865. queuePostRenderEffect(job, parentSuspense);
  3866. } else {
  3867. invalidatePendingSetRef(rawRef);
  3868. doSet();
  3869. }
  3870. } else {
  3871. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3872. }
  3873. }
  3874. }
  3875. function invalidatePendingSetRef(rawRef) {
  3876. const pendingSetRef = pendingSetRefMap.get(rawRef);
  3877. if (pendingSetRef) {
  3878. pendingSetRef.flags |= 8;
  3879. pendingSetRefMap.delete(rawRef);
  3880. }
  3881. }
  3882. let hasLoggedMismatchError = false;
  3883. const logMismatchError = () => {
  3884. if (hasLoggedMismatchError) {
  3885. return;
  3886. }
  3887. console.error("Hydration completed but contains mismatches.");
  3888. hasLoggedMismatchError = true;
  3889. };
  3890. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  3891. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  3892. const getContainerType = (container) => {
  3893. if (container.nodeType !== 1) return void 0;
  3894. if (isSVGContainer(container)) return "svg";
  3895. if (isMathMLContainer(container)) return "mathml";
  3896. return void 0;
  3897. };
  3898. const isComment = (node) => node.nodeType === 8;
  3899. function createHydrationFunctions(rendererInternals) {
  3900. const {
  3901. mt: mountComponent,
  3902. p: patch,
  3903. o: {
  3904. patchProp,
  3905. createText,
  3906. nextSibling,
  3907. parentNode,
  3908. remove,
  3909. insert,
  3910. createComment
  3911. }
  3912. } = rendererInternals;
  3913. const hydrate = (vnode, container) => {
  3914. if (!container.hasChildNodes()) {
  3915. warn$1(
  3916. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  3917. );
  3918. patch(null, vnode, container);
  3919. flushPostFlushCbs();
  3920. container._vnode = vnode;
  3921. return;
  3922. }
  3923. hydrateNode(container.firstChild, vnode, null, null, null);
  3924. flushPostFlushCbs();
  3925. container._vnode = vnode;
  3926. };
  3927. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3928. optimized = optimized || !!vnode.dynamicChildren;
  3929. const isFragmentStart = isComment(node) && node.data === "[";
  3930. const onMismatch = () => handleMismatch(
  3931. node,
  3932. vnode,
  3933. parentComponent,
  3934. parentSuspense,
  3935. slotScopeIds,
  3936. isFragmentStart
  3937. );
  3938. const { type, ref, shapeFlag, patchFlag } = vnode;
  3939. let domType = node.nodeType;
  3940. vnode.el = node;
  3941. {
  3942. def(node, "__vnode", vnode, true);
  3943. def(node, "__vueParentComponent", parentComponent, true);
  3944. }
  3945. if (patchFlag === -2) {
  3946. optimized = false;
  3947. vnode.dynamicChildren = null;
  3948. }
  3949. let nextNode = null;
  3950. switch (type) {
  3951. case Text:
  3952. if (domType !== 3) {
  3953. if (vnode.children === "") {
  3954. insert(vnode.el = createText(""), parentNode(node), node);
  3955. nextNode = node;
  3956. } else {
  3957. nextNode = onMismatch();
  3958. }
  3959. } else {
  3960. if (node.data !== vnode.children) {
  3961. warn$1(
  3962. `Hydration text mismatch in`,
  3963. node.parentNode,
  3964. `
  3965. - rendered on server: ${JSON.stringify(
  3966. node.data
  3967. )}
  3968. - expected on client: ${JSON.stringify(vnode.children)}`
  3969. );
  3970. logMismatchError();
  3971. node.data = vnode.children;
  3972. }
  3973. nextNode = nextSibling(node);
  3974. }
  3975. break;
  3976. case Comment:
  3977. if (isTemplateNode(node)) {
  3978. nextNode = nextSibling(node);
  3979. replaceNode(
  3980. vnode.el = node.content.firstChild,
  3981. node,
  3982. parentComponent
  3983. );
  3984. } else if (domType !== 8 || isFragmentStart) {
  3985. nextNode = onMismatch();
  3986. } else {
  3987. nextNode = nextSibling(node);
  3988. }
  3989. break;
  3990. case Static:
  3991. if (isFragmentStart) {
  3992. node = nextSibling(node);
  3993. domType = node.nodeType;
  3994. }
  3995. if (domType === 1 || domType === 3) {
  3996. nextNode = node;
  3997. const needToAdoptContent = !vnode.children.length;
  3998. for (let i = 0; i < vnode.staticCount; i++) {
  3999. if (needToAdoptContent)
  4000. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  4001. if (i === vnode.staticCount - 1) {
  4002. vnode.anchor = nextNode;
  4003. }
  4004. nextNode = nextSibling(nextNode);
  4005. }
  4006. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4007. } else {
  4008. onMismatch();
  4009. }
  4010. break;
  4011. case Fragment:
  4012. if (!isFragmentStart) {
  4013. nextNode = onMismatch();
  4014. } else {
  4015. nextNode = hydrateFragment(
  4016. node,
  4017. vnode,
  4018. parentComponent,
  4019. parentSuspense,
  4020. slotScopeIds,
  4021. optimized
  4022. );
  4023. }
  4024. break;
  4025. default:
  4026. if (shapeFlag & 1) {
  4027. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  4028. nextNode = onMismatch();
  4029. } else {
  4030. nextNode = hydrateElement(
  4031. node,
  4032. vnode,
  4033. parentComponent,
  4034. parentSuspense,
  4035. slotScopeIds,
  4036. optimized
  4037. );
  4038. }
  4039. } else if (shapeFlag & 6) {
  4040. vnode.slotScopeIds = slotScopeIds;
  4041. const container = parentNode(node);
  4042. if (isFragmentStart) {
  4043. nextNode = locateClosingAnchor(node);
  4044. } else if (isComment(node) && node.data === "teleport start") {
  4045. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  4046. } else {
  4047. nextNode = nextSibling(node);
  4048. }
  4049. mountComponent(
  4050. vnode,
  4051. container,
  4052. null,
  4053. parentComponent,
  4054. parentSuspense,
  4055. getContainerType(container),
  4056. optimized
  4057. );
  4058. if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
  4059. let subTree;
  4060. if (isFragmentStart) {
  4061. subTree = createVNode(Fragment);
  4062. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4063. } else {
  4064. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  4065. }
  4066. subTree.el = node;
  4067. vnode.component.subTree = subTree;
  4068. }
  4069. } else if (shapeFlag & 64) {
  4070. if (domType !== 8) {
  4071. nextNode = onMismatch();
  4072. } else {
  4073. nextNode = vnode.type.hydrate(
  4074. node,
  4075. vnode,
  4076. parentComponent,
  4077. parentSuspense,
  4078. slotScopeIds,
  4079. optimized,
  4080. rendererInternals,
  4081. hydrateChildren
  4082. );
  4083. }
  4084. } else if (shapeFlag & 128) {
  4085. nextNode = vnode.type.hydrate(
  4086. node,
  4087. vnode,
  4088. parentComponent,
  4089. parentSuspense,
  4090. getContainerType(parentNode(node)),
  4091. slotScopeIds,
  4092. optimized,
  4093. rendererInternals,
  4094. hydrateNode
  4095. );
  4096. } else {
  4097. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4098. }
  4099. }
  4100. if (ref != null) {
  4101. setRef(ref, null, parentSuspense, vnode);
  4102. }
  4103. return nextNode;
  4104. };
  4105. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4106. optimized = optimized || !!vnode.dynamicChildren;
  4107. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  4108. const forcePatch = type === "input" || type === "option";
  4109. {
  4110. if (dirs) {
  4111. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4112. }
  4113. let needCallTransitionHooks = false;
  4114. if (isTemplateNode(el)) {
  4115. needCallTransitionHooks = needTransition(
  4116. null,
  4117. // no need check parentSuspense in hydration
  4118. transition
  4119. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4120. const content = el.content.firstChild;
  4121. if (needCallTransitionHooks) {
  4122. const cls = content.getAttribute("class");
  4123. if (cls) content.$cls = cls;
  4124. transition.beforeEnter(content);
  4125. }
  4126. replaceNode(content, el, parentComponent);
  4127. vnode.el = el = content;
  4128. }
  4129. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4130. !(props && (props.innerHTML || props.textContent))) {
  4131. let next = hydrateChildren(
  4132. el.firstChild,
  4133. vnode,
  4134. el,
  4135. parentComponent,
  4136. parentSuspense,
  4137. slotScopeIds,
  4138. optimized
  4139. );
  4140. let hasWarned = false;
  4141. while (next) {
  4142. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4143. if (!hasWarned) {
  4144. warn$1(
  4145. `Hydration children mismatch on`,
  4146. el,
  4147. `
  4148. Server rendered element contains more child nodes than client vdom.`
  4149. );
  4150. hasWarned = true;
  4151. }
  4152. logMismatchError();
  4153. }
  4154. const cur = next;
  4155. next = next.nextSibling;
  4156. remove(cur);
  4157. }
  4158. } else if (shapeFlag & 8) {
  4159. let clientText = vnode.children;
  4160. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4161. clientText = clientText.slice(1);
  4162. }
  4163. if (el.textContent !== clientText) {
  4164. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4165. warn$1(
  4166. `Hydration text content mismatch on`,
  4167. el,
  4168. `
  4169. - rendered on server: ${el.textContent}
  4170. - expected on client: ${vnode.children}`
  4171. );
  4172. logMismatchError();
  4173. }
  4174. el.textContent = vnode.children;
  4175. }
  4176. }
  4177. if (props) {
  4178. {
  4179. const isCustomElement = el.tagName.includes("-");
  4180. for (const key in props) {
  4181. if (// #11189 skip if this node has directives that have created hooks
  4182. // as it could have mutated the DOM in any possible way
  4183. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4184. logMismatchError();
  4185. }
  4186. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4187. key[0] === "." || isCustomElement) {
  4188. patchProp(el, key, null, props[key], void 0, parentComponent);
  4189. }
  4190. }
  4191. }
  4192. }
  4193. let vnodeHooks;
  4194. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4195. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4196. }
  4197. if (dirs) {
  4198. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4199. }
  4200. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4201. queueEffectWithSuspense(() => {
  4202. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4203. needCallTransitionHooks && transition.enter(el);
  4204. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4205. }, parentSuspense);
  4206. }
  4207. }
  4208. return el.nextSibling;
  4209. };
  4210. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4211. optimized = optimized || !!parentVNode.dynamicChildren;
  4212. const children = parentVNode.children;
  4213. const l = children.length;
  4214. let hasWarned = false;
  4215. for (let i = 0; i < l; i++) {
  4216. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4217. const isText = vnode.type === Text;
  4218. if (node) {
  4219. if (isText && !optimized) {
  4220. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4221. insert(
  4222. createText(
  4223. node.data.slice(vnode.children.length)
  4224. ),
  4225. container,
  4226. nextSibling(node)
  4227. );
  4228. node.data = vnode.children;
  4229. }
  4230. }
  4231. node = hydrateNode(
  4232. node,
  4233. vnode,
  4234. parentComponent,
  4235. parentSuspense,
  4236. slotScopeIds,
  4237. optimized
  4238. );
  4239. } else if (isText && !vnode.children) {
  4240. insert(vnode.el = createText(""), container);
  4241. } else {
  4242. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4243. if (!hasWarned) {
  4244. warn$1(
  4245. `Hydration children mismatch on`,
  4246. container,
  4247. `
  4248. Server rendered element contains fewer child nodes than client vdom.`
  4249. );
  4250. hasWarned = true;
  4251. }
  4252. logMismatchError();
  4253. }
  4254. patch(
  4255. null,
  4256. vnode,
  4257. container,
  4258. null,
  4259. parentComponent,
  4260. parentSuspense,
  4261. getContainerType(container),
  4262. slotScopeIds
  4263. );
  4264. }
  4265. }
  4266. return node;
  4267. };
  4268. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4269. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4270. if (fragmentSlotScopeIds) {
  4271. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4272. }
  4273. const container = parentNode(node);
  4274. const next = hydrateChildren(
  4275. nextSibling(node),
  4276. vnode,
  4277. container,
  4278. parentComponent,
  4279. parentSuspense,
  4280. slotScopeIds,
  4281. optimized
  4282. );
  4283. if (next && isComment(next) && next.data === "]") {
  4284. return nextSibling(vnode.anchor = next);
  4285. } else {
  4286. logMismatchError();
  4287. insert(vnode.anchor = createComment(`]`), container, next);
  4288. return next;
  4289. }
  4290. };
  4291. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4292. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4293. warn$1(
  4294. `Hydration node mismatch:
  4295. - rendered on server:`,
  4296. node,
  4297. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4298. `
  4299. - expected on client:`,
  4300. vnode.type
  4301. );
  4302. logMismatchError();
  4303. }
  4304. vnode.el = null;
  4305. if (isFragment) {
  4306. const end = locateClosingAnchor(node);
  4307. while (true) {
  4308. const next2 = nextSibling(node);
  4309. if (next2 && next2 !== end) {
  4310. remove(next2);
  4311. } else {
  4312. break;
  4313. }
  4314. }
  4315. }
  4316. const next = nextSibling(node);
  4317. const container = parentNode(node);
  4318. remove(node);
  4319. patch(
  4320. null,
  4321. vnode,
  4322. container,
  4323. next,
  4324. parentComponent,
  4325. parentSuspense,
  4326. getContainerType(container),
  4327. slotScopeIds
  4328. );
  4329. if (parentComponent) {
  4330. parentComponent.vnode.el = vnode.el;
  4331. updateHOCHostEl(parentComponent, vnode.el);
  4332. }
  4333. return next;
  4334. };
  4335. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4336. let match = 0;
  4337. while (node) {
  4338. node = nextSibling(node);
  4339. if (node && isComment(node)) {
  4340. if (node.data === open) match++;
  4341. if (node.data === close) {
  4342. if (match === 0) {
  4343. return nextSibling(node);
  4344. } else {
  4345. match--;
  4346. }
  4347. }
  4348. }
  4349. }
  4350. return node;
  4351. };
  4352. const replaceNode = (newNode, oldNode, parentComponent) => {
  4353. const parentNode2 = oldNode.parentNode;
  4354. if (parentNode2) {
  4355. parentNode2.replaceChild(newNode, oldNode);
  4356. }
  4357. let parent = parentComponent;
  4358. while (parent) {
  4359. if (parent.vnode.el === oldNode) {
  4360. parent.vnode.el = parent.subTree.el = newNode;
  4361. }
  4362. parent = parent.parent;
  4363. }
  4364. };
  4365. const isTemplateNode = (node) => {
  4366. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4367. };
  4368. return [hydrate, hydrateNode];
  4369. }
  4370. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4371. let mismatchType;
  4372. let mismatchKey;
  4373. let actual;
  4374. let expected;
  4375. if (key === "class") {
  4376. if (el.$cls) {
  4377. actual = el.$cls;
  4378. delete el.$cls;
  4379. } else {
  4380. actual = el.getAttribute("class");
  4381. }
  4382. expected = normalizeClass(clientValue);
  4383. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4384. mismatchType = 2 /* CLASS */;
  4385. mismatchKey = `class`;
  4386. }
  4387. } else if (key === "style") {
  4388. actual = el.getAttribute("style") || "";
  4389. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4390. const actualMap = toStyleMap(actual);
  4391. const expectedMap = toStyleMap(expected);
  4392. if (vnode.dirs) {
  4393. for (const { dir, value } of vnode.dirs) {
  4394. if (dir.name === "show" && !value) {
  4395. expectedMap.set("display", "none");
  4396. }
  4397. }
  4398. }
  4399. if (instance) {
  4400. resolveCssVars(instance, vnode, expectedMap);
  4401. }
  4402. if (!isMapEqual(actualMap, expectedMap)) {
  4403. mismatchType = 3 /* STYLE */;
  4404. mismatchKey = "style";
  4405. }
  4406. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4407. if (isBooleanAttr(key)) {
  4408. actual = el.hasAttribute(key);
  4409. expected = includeBooleanAttr(clientValue);
  4410. } else if (clientValue == null) {
  4411. actual = el.hasAttribute(key);
  4412. expected = false;
  4413. } else {
  4414. if (el.hasAttribute(key)) {
  4415. actual = el.getAttribute(key);
  4416. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4417. actual = el.value;
  4418. } else {
  4419. actual = false;
  4420. }
  4421. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4422. }
  4423. if (actual !== expected) {
  4424. mismatchType = 4 /* ATTRIBUTE */;
  4425. mismatchKey = key;
  4426. }
  4427. }
  4428. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4429. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4430. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4431. const postSegment = `
  4432. - rendered on server: ${format(actual)}
  4433. - expected on client: ${format(expected)}
  4434. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4435. You should fix the source of the mismatch.`;
  4436. {
  4437. warn$1(preSegment, el, postSegment);
  4438. }
  4439. return true;
  4440. }
  4441. return false;
  4442. }
  4443. function toClassSet(str) {
  4444. return new Set(str.trim().split(/\s+/));
  4445. }
  4446. function isSetEqual(a, b) {
  4447. if (a.size !== b.size) {
  4448. return false;
  4449. }
  4450. for (const s of a) {
  4451. if (!b.has(s)) {
  4452. return false;
  4453. }
  4454. }
  4455. return true;
  4456. }
  4457. function toStyleMap(str) {
  4458. const styleMap = /* @__PURE__ */ new Map();
  4459. for (const item of str.split(";")) {
  4460. let [key, value] = item.split(":");
  4461. key = key.trim();
  4462. value = value && value.trim();
  4463. if (key && value) {
  4464. styleMap.set(key, value);
  4465. }
  4466. }
  4467. return styleMap;
  4468. }
  4469. function isMapEqual(a, b) {
  4470. if (a.size !== b.size) {
  4471. return false;
  4472. }
  4473. for (const [key, value] of a) {
  4474. if (value !== b.get(key)) {
  4475. return false;
  4476. }
  4477. }
  4478. return true;
  4479. }
  4480. function resolveCssVars(instance, vnode, expectedMap) {
  4481. const root = instance.subTree;
  4482. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4483. const cssVars = instance.getCssVars();
  4484. for (const key in cssVars) {
  4485. const value = normalizeCssVarValue(cssVars[key]);
  4486. expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
  4487. }
  4488. }
  4489. if (vnode === root && instance.parent) {
  4490. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4491. }
  4492. }
  4493. const allowMismatchAttr = "data-allow-mismatch";
  4494. const MismatchTypeString = {
  4495. [0 /* TEXT */]: "text",
  4496. [1 /* CHILDREN */]: "children",
  4497. [2 /* CLASS */]: "class",
  4498. [3 /* STYLE */]: "style",
  4499. [4 /* ATTRIBUTE */]: "attribute"
  4500. };
  4501. function isMismatchAllowed(el, allowedType) {
  4502. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4503. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4504. el = el.parentElement;
  4505. }
  4506. }
  4507. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4508. if (allowedAttr == null) {
  4509. return false;
  4510. } else if (allowedAttr === "") {
  4511. return true;
  4512. } else {
  4513. const list = allowedAttr.split(",");
  4514. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4515. return true;
  4516. }
  4517. return list.includes(MismatchTypeString[allowedType]);
  4518. }
  4519. }
  4520. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4521. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4522. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4523. const id = requestIdleCallback(hydrate, { timeout });
  4524. return () => cancelIdleCallback(id);
  4525. };
  4526. function elementIsVisibleInViewport(el) {
  4527. const { top, left, bottom, right } = el.getBoundingClientRect();
  4528. const { innerHeight, innerWidth } = window;
  4529. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4530. }
  4531. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4532. const ob = new IntersectionObserver((entries) => {
  4533. for (const e of entries) {
  4534. if (!e.isIntersecting) continue;
  4535. ob.disconnect();
  4536. hydrate();
  4537. break;
  4538. }
  4539. }, opts);
  4540. forEach((el) => {
  4541. if (!(el instanceof Element)) return;
  4542. if (elementIsVisibleInViewport(el)) {
  4543. hydrate();
  4544. ob.disconnect();
  4545. return false;
  4546. }
  4547. ob.observe(el);
  4548. });
  4549. return () => ob.disconnect();
  4550. };
  4551. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4552. if (query) {
  4553. const mql = matchMedia(query);
  4554. if (mql.matches) {
  4555. hydrate();
  4556. } else {
  4557. mql.addEventListener("change", hydrate, { once: true });
  4558. return () => mql.removeEventListener("change", hydrate);
  4559. }
  4560. }
  4561. };
  4562. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4563. if (isString(interactions)) interactions = [interactions];
  4564. let hasHydrated = false;
  4565. const doHydrate = (e) => {
  4566. if (!hasHydrated) {
  4567. hasHydrated = true;
  4568. teardown();
  4569. hydrate();
  4570. e.target.dispatchEvent(new e.constructor(e.type, e));
  4571. }
  4572. };
  4573. const teardown = () => {
  4574. forEach((el) => {
  4575. for (const i of interactions) {
  4576. el.removeEventListener(i, doHydrate);
  4577. }
  4578. });
  4579. };
  4580. forEach((el) => {
  4581. for (const i of interactions) {
  4582. el.addEventListener(i, doHydrate, { once: true });
  4583. }
  4584. });
  4585. return teardown;
  4586. };
  4587. function forEachElement(node, cb) {
  4588. if (isComment(node) && node.data === "[") {
  4589. let depth = 1;
  4590. let next = node.nextSibling;
  4591. while (next) {
  4592. if (next.nodeType === 1) {
  4593. const result = cb(next);
  4594. if (result === false) {
  4595. break;
  4596. }
  4597. } else if (isComment(next)) {
  4598. if (next.data === "]") {
  4599. if (--depth === 0) break;
  4600. } else if (next.data === "[") {
  4601. depth++;
  4602. }
  4603. }
  4604. next = next.nextSibling;
  4605. }
  4606. } else {
  4607. cb(node);
  4608. }
  4609. }
  4610. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4611. // @__NO_SIDE_EFFECTS__
  4612. function defineAsyncComponent(source) {
  4613. if (isFunction(source)) {
  4614. source = { loader: source };
  4615. }
  4616. const {
  4617. loader,
  4618. loadingComponent,
  4619. errorComponent,
  4620. delay = 200,
  4621. hydrate: hydrateStrategy,
  4622. timeout,
  4623. // undefined = never times out
  4624. suspensible = true,
  4625. onError: userOnError
  4626. } = source;
  4627. let pendingRequest = null;
  4628. let resolvedComp;
  4629. let retries = 0;
  4630. const retry = () => {
  4631. retries++;
  4632. pendingRequest = null;
  4633. return load();
  4634. };
  4635. const load = () => {
  4636. let thisRequest;
  4637. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4638. err = err instanceof Error ? err : new Error(String(err));
  4639. if (userOnError) {
  4640. return new Promise((resolve, reject) => {
  4641. const userRetry = () => resolve(retry());
  4642. const userFail = () => reject(err);
  4643. userOnError(err, userRetry, userFail, retries + 1);
  4644. });
  4645. } else {
  4646. throw err;
  4647. }
  4648. }).then((comp) => {
  4649. if (thisRequest !== pendingRequest && pendingRequest) {
  4650. return pendingRequest;
  4651. }
  4652. if (!comp) {
  4653. warn$1(
  4654. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4655. );
  4656. }
  4657. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4658. comp = comp.default;
  4659. }
  4660. if (comp && !isObject(comp) && !isFunction(comp)) {
  4661. throw new Error(`Invalid async component load result: ${comp}`);
  4662. }
  4663. resolvedComp = comp;
  4664. return comp;
  4665. }));
  4666. };
  4667. return defineComponent({
  4668. name: "AsyncComponentWrapper",
  4669. __asyncLoader: load,
  4670. __asyncHydrate(el, instance, hydrate) {
  4671. let patched = false;
  4672. (instance.bu || (instance.bu = [])).push(() => patched = true);
  4673. const performHydrate = () => {
  4674. if (patched) {
  4675. {
  4676. warn$1(
  4677. `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
  4678. );
  4679. }
  4680. return;
  4681. }
  4682. hydrate();
  4683. };
  4684. const doHydrate = hydrateStrategy ? () => {
  4685. const teardown = hydrateStrategy(
  4686. performHydrate,
  4687. (cb) => forEachElement(el, cb)
  4688. );
  4689. if (teardown) {
  4690. (instance.bum || (instance.bum = [])).push(teardown);
  4691. }
  4692. } : performHydrate;
  4693. if (resolvedComp) {
  4694. doHydrate();
  4695. } else {
  4696. load().then(() => !instance.isUnmounted && doHydrate());
  4697. }
  4698. },
  4699. get __asyncResolved() {
  4700. return resolvedComp;
  4701. },
  4702. setup() {
  4703. const instance = currentInstance;
  4704. markAsyncBoundary(instance);
  4705. if (resolvedComp) {
  4706. return () => createInnerComp(resolvedComp, instance);
  4707. }
  4708. const onError = (err) => {
  4709. pendingRequest = null;
  4710. handleError(
  4711. err,
  4712. instance,
  4713. 13,
  4714. !errorComponent
  4715. );
  4716. };
  4717. if (suspensible && instance.suspense || false) {
  4718. return load().then((comp) => {
  4719. return () => createInnerComp(comp, instance);
  4720. }).catch((err) => {
  4721. onError(err);
  4722. return () => errorComponent ? createVNode(errorComponent, {
  4723. error: err
  4724. }) : null;
  4725. });
  4726. }
  4727. const loaded = ref(false);
  4728. const error = ref();
  4729. const delayed = ref(!!delay);
  4730. if (delay) {
  4731. setTimeout(() => {
  4732. delayed.value = false;
  4733. }, delay);
  4734. }
  4735. if (timeout != null) {
  4736. setTimeout(() => {
  4737. if (!loaded.value && !error.value) {
  4738. const err = new Error(
  4739. `Async component timed out after ${timeout}ms.`
  4740. );
  4741. onError(err);
  4742. error.value = err;
  4743. }
  4744. }, timeout);
  4745. }
  4746. load().then(() => {
  4747. loaded.value = true;
  4748. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4749. instance.parent.update();
  4750. }
  4751. }).catch((err) => {
  4752. onError(err);
  4753. error.value = err;
  4754. });
  4755. return () => {
  4756. if (loaded.value && resolvedComp) {
  4757. return createInnerComp(resolvedComp, instance);
  4758. } else if (error.value && errorComponent) {
  4759. return createVNode(errorComponent, {
  4760. error: error.value
  4761. });
  4762. } else if (loadingComponent && !delayed.value) {
  4763. return createVNode(loadingComponent);
  4764. }
  4765. };
  4766. }
  4767. });
  4768. }
  4769. function createInnerComp(comp, parent) {
  4770. const { ref: ref2, props, children, ce } = parent.vnode;
  4771. const vnode = createVNode(comp, props, children);
  4772. vnode.ref = ref2;
  4773. vnode.ce = ce;
  4774. delete parent.vnode.ce;
  4775. return vnode;
  4776. }
  4777. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4778. const KeepAliveImpl = {
  4779. name: `KeepAlive`,
  4780. // Marker for special handling inside the renderer. We are not using a ===
  4781. // check directly on KeepAlive in the renderer, because importing it directly
  4782. // would prevent it from being tree-shaken.
  4783. __isKeepAlive: true,
  4784. props: {
  4785. include: [String, RegExp, Array],
  4786. exclude: [String, RegExp, Array],
  4787. max: [String, Number]
  4788. },
  4789. setup(props, { slots }) {
  4790. const instance = getCurrentInstance();
  4791. const sharedContext = instance.ctx;
  4792. const cache = /* @__PURE__ */ new Map();
  4793. const keys = /* @__PURE__ */ new Set();
  4794. let current = null;
  4795. {
  4796. instance.__v_cache = cache;
  4797. }
  4798. const parentSuspense = instance.suspense;
  4799. const {
  4800. renderer: {
  4801. p: patch,
  4802. m: move,
  4803. um: _unmount,
  4804. o: { createElement }
  4805. }
  4806. } = sharedContext;
  4807. const storageContainer = createElement("div");
  4808. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4809. const instance2 = vnode.component;
  4810. move(vnode, container, anchor, 0, parentSuspense);
  4811. patch(
  4812. instance2.vnode,
  4813. vnode,
  4814. container,
  4815. anchor,
  4816. instance2,
  4817. parentSuspense,
  4818. namespace,
  4819. vnode.slotScopeIds,
  4820. optimized
  4821. );
  4822. queuePostRenderEffect(() => {
  4823. instance2.isDeactivated = false;
  4824. if (instance2.a) {
  4825. invokeArrayFns(instance2.a);
  4826. }
  4827. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4828. if (vnodeHook) {
  4829. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4830. }
  4831. }, parentSuspense);
  4832. {
  4833. devtoolsComponentAdded(instance2);
  4834. }
  4835. };
  4836. sharedContext.deactivate = (vnode) => {
  4837. const instance2 = vnode.component;
  4838. invalidateMount(instance2.m);
  4839. invalidateMount(instance2.a);
  4840. move(vnode, storageContainer, null, 1, parentSuspense);
  4841. queuePostRenderEffect(() => {
  4842. if (instance2.da) {
  4843. invokeArrayFns(instance2.da);
  4844. }
  4845. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4846. if (vnodeHook) {
  4847. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4848. }
  4849. instance2.isDeactivated = true;
  4850. }, parentSuspense);
  4851. {
  4852. devtoolsComponentAdded(instance2);
  4853. }
  4854. {
  4855. instance2.__keepAliveStorageContainer = storageContainer;
  4856. }
  4857. };
  4858. function unmount(vnode) {
  4859. resetShapeFlag(vnode);
  4860. _unmount(vnode, instance, parentSuspense, true);
  4861. }
  4862. function pruneCache(filter) {
  4863. cache.forEach((vnode, key) => {
  4864. const name = getComponentName(vnode.type);
  4865. if (name && !filter(name)) {
  4866. pruneCacheEntry(key);
  4867. }
  4868. });
  4869. }
  4870. function pruneCacheEntry(key) {
  4871. const cached = cache.get(key);
  4872. if (cached && (!current || !isSameVNodeType(cached, current))) {
  4873. unmount(cached);
  4874. } else if (current) {
  4875. resetShapeFlag(current);
  4876. }
  4877. cache.delete(key);
  4878. keys.delete(key);
  4879. }
  4880. watch(
  4881. () => [props.include, props.exclude],
  4882. ([include, exclude]) => {
  4883. include && pruneCache((name) => matches(include, name));
  4884. exclude && pruneCache((name) => !matches(exclude, name));
  4885. },
  4886. // prune post-render after `current` has been updated
  4887. { flush: "post", deep: true }
  4888. );
  4889. let pendingCacheKey = null;
  4890. const cacheSubtree = () => {
  4891. if (pendingCacheKey != null) {
  4892. if (isSuspense(instance.subTree.type)) {
  4893. queuePostRenderEffect(() => {
  4894. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4895. }, instance.subTree.suspense);
  4896. } else {
  4897. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4898. }
  4899. }
  4900. };
  4901. onMounted(cacheSubtree);
  4902. onUpdated(cacheSubtree);
  4903. onBeforeUnmount(() => {
  4904. cache.forEach((cached) => {
  4905. const { subTree, suspense } = instance;
  4906. const vnode = getInnerChild(subTree);
  4907. if (cached.type === vnode.type && cached.key === vnode.key) {
  4908. resetShapeFlag(vnode);
  4909. const da = vnode.component.da;
  4910. da && queuePostRenderEffect(da, suspense);
  4911. return;
  4912. }
  4913. unmount(cached);
  4914. });
  4915. });
  4916. return () => {
  4917. pendingCacheKey = null;
  4918. if (!slots.default) {
  4919. return current = null;
  4920. }
  4921. const children = slots.default();
  4922. const rawVNode = children[0];
  4923. if (children.length > 1) {
  4924. {
  4925. warn$1(`KeepAlive should contain exactly one component child.`);
  4926. }
  4927. current = null;
  4928. return children;
  4929. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4930. current = null;
  4931. return rawVNode;
  4932. }
  4933. let vnode = getInnerChild(rawVNode);
  4934. if (vnode.type === Comment) {
  4935. current = null;
  4936. return vnode;
  4937. }
  4938. const comp = vnode.type;
  4939. const name = getComponentName(
  4940. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4941. );
  4942. const { include, exclude, max } = props;
  4943. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4944. vnode.shapeFlag &= -257;
  4945. current = vnode;
  4946. return rawVNode;
  4947. }
  4948. const key = vnode.key == null ? comp : vnode.key;
  4949. const cachedVNode = cache.get(key);
  4950. if (vnode.el) {
  4951. vnode = cloneVNode(vnode);
  4952. if (rawVNode.shapeFlag & 128) {
  4953. rawVNode.ssContent = vnode;
  4954. }
  4955. }
  4956. pendingCacheKey = key;
  4957. if (cachedVNode) {
  4958. vnode.el = cachedVNode.el;
  4959. vnode.component = cachedVNode.component;
  4960. if (vnode.transition) {
  4961. setTransitionHooks(vnode, vnode.transition);
  4962. }
  4963. vnode.shapeFlag |= 512;
  4964. keys.delete(key);
  4965. keys.add(key);
  4966. } else {
  4967. keys.add(key);
  4968. if (max && keys.size > parseInt(max, 10)) {
  4969. pruneCacheEntry(keys.values().next().value);
  4970. }
  4971. }
  4972. vnode.shapeFlag |= 256;
  4973. current = vnode;
  4974. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4975. };
  4976. }
  4977. };
  4978. const KeepAlive = KeepAliveImpl;
  4979. function matches(pattern, name) {
  4980. if (isArray(pattern)) {
  4981. return pattern.some((p) => matches(p, name));
  4982. } else if (isString(pattern)) {
  4983. return pattern.split(",").includes(name);
  4984. } else if (isRegExp(pattern)) {
  4985. pattern.lastIndex = 0;
  4986. return pattern.test(name);
  4987. }
  4988. return false;
  4989. }
  4990. function onActivated(hook, target) {
  4991. registerKeepAliveHook(hook, "a", target);
  4992. }
  4993. function onDeactivated(hook, target) {
  4994. registerKeepAliveHook(hook, "da", target);
  4995. }
  4996. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4997. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4998. let current = target;
  4999. while (current) {
  5000. if (current.isDeactivated) {
  5001. return;
  5002. }
  5003. current = current.parent;
  5004. }
  5005. return hook();
  5006. });
  5007. injectHook(type, wrappedHook, target);
  5008. if (target) {
  5009. let current = target.parent;
  5010. while (current && current.parent) {
  5011. if (isKeepAlive(current.parent.vnode)) {
  5012. injectToKeepAliveRoot(wrappedHook, type, target, current);
  5013. }
  5014. current = current.parent;
  5015. }
  5016. }
  5017. }
  5018. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  5019. const injected = injectHook(
  5020. type,
  5021. hook,
  5022. keepAliveRoot,
  5023. true
  5024. /* prepend */
  5025. );
  5026. onUnmounted(() => {
  5027. remove(keepAliveRoot[type], injected);
  5028. }, target);
  5029. }
  5030. function resetShapeFlag(vnode) {
  5031. vnode.shapeFlag &= -257;
  5032. vnode.shapeFlag &= -513;
  5033. }
  5034. function getInnerChild(vnode) {
  5035. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  5036. }
  5037. function injectHook(type, hook, target = currentInstance, prepend = false) {
  5038. if (target) {
  5039. const hooks = target[type] || (target[type] = []);
  5040. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  5041. pauseTracking();
  5042. const reset = setCurrentInstance(target);
  5043. const res = callWithAsyncErrorHandling(hook, target, type, args);
  5044. reset();
  5045. resetTracking();
  5046. return res;
  5047. });
  5048. if (prepend) {
  5049. hooks.unshift(wrappedHook);
  5050. } else {
  5051. hooks.push(wrappedHook);
  5052. }
  5053. return wrappedHook;
  5054. } else {
  5055. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  5056. warn$1(
  5057. `${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.` )
  5058. );
  5059. }
  5060. }
  5061. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  5062. if (!isInSSRComponentSetup || lifecycle === "sp") {
  5063. injectHook(lifecycle, (...args) => hook(...args), target);
  5064. }
  5065. };
  5066. const onBeforeMount = createHook("bm");
  5067. const onMounted = createHook("m");
  5068. const onBeforeUpdate = createHook(
  5069. "bu"
  5070. );
  5071. const onUpdated = createHook("u");
  5072. const onBeforeUnmount = createHook(
  5073. "bum"
  5074. );
  5075. const onUnmounted = createHook("um");
  5076. const onServerPrefetch = createHook(
  5077. "sp"
  5078. );
  5079. const onRenderTriggered = createHook("rtg");
  5080. const onRenderTracked = createHook("rtc");
  5081. function onErrorCaptured(hook, target = currentInstance) {
  5082. injectHook("ec", hook, target);
  5083. }
  5084. const COMPONENTS = "components";
  5085. const DIRECTIVES = "directives";
  5086. function resolveComponent(name, maybeSelfReference) {
  5087. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  5088. }
  5089. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  5090. function resolveDynamicComponent(component) {
  5091. if (isString(component)) {
  5092. return resolveAsset(COMPONENTS, component, false) || component;
  5093. } else {
  5094. return component || NULL_DYNAMIC_COMPONENT;
  5095. }
  5096. }
  5097. function resolveDirective(name) {
  5098. return resolveAsset(DIRECTIVES, name);
  5099. }
  5100. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5101. const instance = currentRenderingInstance || currentInstance;
  5102. if (instance) {
  5103. const Component = instance.type;
  5104. if (type === COMPONENTS) {
  5105. const selfName = getComponentName(
  5106. Component,
  5107. false
  5108. );
  5109. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5110. return Component;
  5111. }
  5112. }
  5113. const res = (
  5114. // local registration
  5115. // check instance[type] first which is resolved for options API
  5116. resolve(instance[type] || Component[type], name) || // global registration
  5117. resolve(instance.appContext[type], name)
  5118. );
  5119. if (!res && maybeSelfReference) {
  5120. return Component;
  5121. }
  5122. if (warnMissing && !res) {
  5123. const extra = type === COMPONENTS ? `
  5124. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5125. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5126. }
  5127. return res;
  5128. } else {
  5129. warn$1(
  5130. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5131. );
  5132. }
  5133. }
  5134. function resolve(registry, name) {
  5135. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5136. }
  5137. function renderList(source, renderItem, cache, index) {
  5138. let ret;
  5139. const cached = cache && cache[index];
  5140. const sourceIsArray = isArray(source);
  5141. if (sourceIsArray || isString(source)) {
  5142. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5143. let needsWrap = false;
  5144. let isReadonlySource = false;
  5145. if (sourceIsReactiveArray) {
  5146. needsWrap = !isShallow(source);
  5147. isReadonlySource = isReadonly(source);
  5148. source = shallowReadArray(source);
  5149. }
  5150. ret = new Array(source.length);
  5151. for (let i = 0, l = source.length; i < l; i++) {
  5152. ret[i] = renderItem(
  5153. needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
  5154. i,
  5155. void 0,
  5156. cached && cached[i]
  5157. );
  5158. }
  5159. } else if (typeof source === "number") {
  5160. if (!Number.isInteger(source)) {
  5161. warn$1(`The v-for range expect an integer value but got ${source}.`);
  5162. }
  5163. ret = new Array(source);
  5164. for (let i = 0; i < source; i++) {
  5165. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5166. }
  5167. } else if (isObject(source)) {
  5168. if (source[Symbol.iterator]) {
  5169. ret = Array.from(
  5170. source,
  5171. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5172. );
  5173. } else {
  5174. const keys = Object.keys(source);
  5175. ret = new Array(keys.length);
  5176. for (let i = 0, l = keys.length; i < l; i++) {
  5177. const key = keys[i];
  5178. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5179. }
  5180. }
  5181. } else {
  5182. ret = [];
  5183. }
  5184. if (cache) {
  5185. cache[index] = ret;
  5186. }
  5187. return ret;
  5188. }
  5189. function createSlots(slots, dynamicSlots) {
  5190. for (let i = 0; i < dynamicSlots.length; i++) {
  5191. const slot = dynamicSlots[i];
  5192. if (isArray(slot)) {
  5193. for (let j = 0; j < slot.length; j++) {
  5194. slots[slot[j].name] = slot[j].fn;
  5195. }
  5196. } else if (slot) {
  5197. slots[slot.name] = slot.key ? (...args) => {
  5198. const res = slot.fn(...args);
  5199. if (res) res.key = slot.key;
  5200. return res;
  5201. } : slot.fn;
  5202. }
  5203. }
  5204. return slots;
  5205. }
  5206. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5207. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5208. if (name !== "default") props.name = name;
  5209. return openBlock(), createBlock(
  5210. Fragment,
  5211. null,
  5212. [createVNode("slot", props, fallback && fallback())],
  5213. 64
  5214. );
  5215. }
  5216. let slot = slots[name];
  5217. if (slot && slot.length > 1) {
  5218. warn$1(
  5219. `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.`
  5220. );
  5221. slot = () => [];
  5222. }
  5223. if (slot && slot._c) {
  5224. slot._d = false;
  5225. }
  5226. openBlock();
  5227. const validSlotContent = slot && ensureValidVNode(slot(props));
  5228. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5229. // key attached in the `createSlots` helper, respect that
  5230. validSlotContent && validSlotContent.key;
  5231. const rendered = createBlock(
  5232. Fragment,
  5233. {
  5234. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5235. (!validSlotContent && fallback ? "_fb" : "")
  5236. },
  5237. validSlotContent || (fallback ? fallback() : []),
  5238. validSlotContent && slots._ === 1 ? 64 : -2
  5239. );
  5240. if (!noSlotted && rendered.scopeId) {
  5241. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5242. }
  5243. if (slot && slot._c) {
  5244. slot._d = true;
  5245. }
  5246. return rendered;
  5247. }
  5248. function ensureValidVNode(vnodes) {
  5249. return vnodes.some((child) => {
  5250. if (!isVNode(child)) return true;
  5251. if (child.type === Comment) return false;
  5252. if (child.type === Fragment && !ensureValidVNode(child.children))
  5253. return false;
  5254. return true;
  5255. }) ? vnodes : null;
  5256. }
  5257. function toHandlers(obj, preserveCaseIfNecessary) {
  5258. const ret = {};
  5259. if (!isObject(obj)) {
  5260. warn$1(`v-on with no argument expects an object value.`);
  5261. return ret;
  5262. }
  5263. for (const key in obj) {
  5264. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5265. }
  5266. return ret;
  5267. }
  5268. const getPublicInstance = (i) => {
  5269. if (!i) return null;
  5270. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5271. return getPublicInstance(i.parent);
  5272. };
  5273. const publicPropertiesMap = (
  5274. // Move PURE marker to new line to workaround compiler discarding it
  5275. // due to type annotation
  5276. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5277. $: (i) => i,
  5278. $el: (i) => i.vnode.el,
  5279. $data: (i) => i.data,
  5280. $props: (i) => shallowReadonly(i.props) ,
  5281. $attrs: (i) => shallowReadonly(i.attrs) ,
  5282. $slots: (i) => shallowReadonly(i.slots) ,
  5283. $refs: (i) => shallowReadonly(i.refs) ,
  5284. $parent: (i) => getPublicInstance(i.parent),
  5285. $root: (i) => getPublicInstance(i.root),
  5286. $host: (i) => i.ce,
  5287. $emit: (i) => i.emit,
  5288. $options: (i) => resolveMergedOptions(i) ,
  5289. $forceUpdate: (i) => i.f || (i.f = () => {
  5290. queueJob(i.update);
  5291. }),
  5292. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5293. $watch: (i) => instanceWatch.bind(i)
  5294. })
  5295. );
  5296. const isReservedPrefix = (key) => key === "_" || key === "$";
  5297. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5298. const PublicInstanceProxyHandlers = {
  5299. get({ _: instance }, key) {
  5300. if (key === "__v_skip") {
  5301. return true;
  5302. }
  5303. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5304. if (key === "__isVue") {
  5305. return true;
  5306. }
  5307. let normalizedProps;
  5308. if (key[0] !== "$") {
  5309. const n = accessCache[key];
  5310. if (n !== void 0) {
  5311. switch (n) {
  5312. case 1 /* SETUP */:
  5313. return setupState[key];
  5314. case 2 /* DATA */:
  5315. return data[key];
  5316. case 4 /* CONTEXT */:
  5317. return ctx[key];
  5318. case 3 /* PROPS */:
  5319. return props[key];
  5320. }
  5321. } else if (hasSetupBinding(setupState, key)) {
  5322. accessCache[key] = 1 /* SETUP */;
  5323. return setupState[key];
  5324. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5325. accessCache[key] = 2 /* DATA */;
  5326. return data[key];
  5327. } else if (
  5328. // only cache other properties when instance has declared (thus stable)
  5329. // props
  5330. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  5331. ) {
  5332. accessCache[key] = 3 /* PROPS */;
  5333. return props[key];
  5334. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5335. accessCache[key] = 4 /* CONTEXT */;
  5336. return ctx[key];
  5337. } else if (shouldCacheAccess) {
  5338. accessCache[key] = 0 /* OTHER */;
  5339. }
  5340. }
  5341. const publicGetter = publicPropertiesMap[key];
  5342. let cssModule, globalProperties;
  5343. if (publicGetter) {
  5344. if (key === "$attrs") {
  5345. track(instance.attrs, "get", "");
  5346. markAttrsAccessed();
  5347. } else if (key === "$slots") {
  5348. track(instance, "get", key);
  5349. }
  5350. return publicGetter(instance);
  5351. } else if (
  5352. // css module (injected by vue-loader)
  5353. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5354. ) {
  5355. return cssModule;
  5356. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5357. accessCache[key] = 4 /* CONTEXT */;
  5358. return ctx[key];
  5359. } else if (
  5360. // global properties
  5361. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5362. ) {
  5363. {
  5364. return globalProperties[key];
  5365. }
  5366. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5367. // to infinite warning loop
  5368. key.indexOf("__v") !== 0)) {
  5369. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5370. warn$1(
  5371. `Property ${JSON.stringify(
  5372. key
  5373. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5374. );
  5375. } else if (instance === currentRenderingInstance) {
  5376. warn$1(
  5377. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5378. );
  5379. }
  5380. }
  5381. },
  5382. set({ _: instance }, key, value) {
  5383. const { data, setupState, ctx } = instance;
  5384. if (hasSetupBinding(setupState, key)) {
  5385. setupState[key] = value;
  5386. return true;
  5387. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5388. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5389. return false;
  5390. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5391. data[key] = value;
  5392. return true;
  5393. } else if (hasOwn(instance.props, key)) {
  5394. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5395. return false;
  5396. }
  5397. if (key[0] === "$" && key.slice(1) in instance) {
  5398. warn$1(
  5399. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5400. );
  5401. return false;
  5402. } else {
  5403. if (key in instance.appContext.config.globalProperties) {
  5404. Object.defineProperty(ctx, key, {
  5405. enumerable: true,
  5406. configurable: true,
  5407. value
  5408. });
  5409. } else {
  5410. ctx[key] = value;
  5411. }
  5412. }
  5413. return true;
  5414. },
  5415. has({
  5416. _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
  5417. }, key) {
  5418. let normalizedProps, cssModules;
  5419. return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
  5420. },
  5421. defineProperty(target, key, descriptor) {
  5422. if (descriptor.get != null) {
  5423. target._.accessCache[key] = 0;
  5424. } else if (hasOwn(descriptor, "value")) {
  5425. this.set(target, key, descriptor.value, null);
  5426. }
  5427. return Reflect.defineProperty(target, key, descriptor);
  5428. }
  5429. };
  5430. {
  5431. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5432. warn$1(
  5433. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5434. );
  5435. return Reflect.ownKeys(target);
  5436. };
  5437. }
  5438. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5439. get(target, key) {
  5440. if (key === Symbol.unscopables) {
  5441. return;
  5442. }
  5443. return PublicInstanceProxyHandlers.get(target, key, target);
  5444. },
  5445. has(_, key) {
  5446. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5447. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5448. warn$1(
  5449. `Property ${JSON.stringify(
  5450. key
  5451. )} should not start with _ which is a reserved prefix for Vue internals.`
  5452. );
  5453. }
  5454. return has;
  5455. }
  5456. });
  5457. function createDevRenderContext(instance) {
  5458. const target = {};
  5459. Object.defineProperty(target, `_`, {
  5460. configurable: true,
  5461. enumerable: false,
  5462. get: () => instance
  5463. });
  5464. Object.keys(publicPropertiesMap).forEach((key) => {
  5465. Object.defineProperty(target, key, {
  5466. configurable: true,
  5467. enumerable: false,
  5468. get: () => publicPropertiesMap[key](instance),
  5469. // intercepted by the proxy so no need for implementation,
  5470. // but needed to prevent set errors
  5471. set: NOOP
  5472. });
  5473. });
  5474. return target;
  5475. }
  5476. function exposePropsOnRenderContext(instance) {
  5477. const {
  5478. ctx,
  5479. propsOptions: [propsOptions]
  5480. } = instance;
  5481. if (propsOptions) {
  5482. Object.keys(propsOptions).forEach((key) => {
  5483. Object.defineProperty(ctx, key, {
  5484. enumerable: true,
  5485. configurable: true,
  5486. get: () => instance.props[key],
  5487. set: NOOP
  5488. });
  5489. });
  5490. }
  5491. }
  5492. function exposeSetupStateOnRenderContext(instance) {
  5493. const { ctx, setupState } = instance;
  5494. Object.keys(toRaw(setupState)).forEach((key) => {
  5495. if (!setupState.__isScriptSetup) {
  5496. if (isReservedPrefix(key[0])) {
  5497. warn$1(
  5498. `setup() return property ${JSON.stringify(
  5499. key
  5500. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5501. );
  5502. return;
  5503. }
  5504. Object.defineProperty(ctx, key, {
  5505. enumerable: true,
  5506. configurable: true,
  5507. get: () => setupState[key],
  5508. set: NOOP
  5509. });
  5510. }
  5511. });
  5512. }
  5513. const warnRuntimeUsage = (method) => warn$1(
  5514. `${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.`
  5515. );
  5516. function defineProps() {
  5517. {
  5518. warnRuntimeUsage(`defineProps`);
  5519. }
  5520. return null;
  5521. }
  5522. function defineEmits() {
  5523. {
  5524. warnRuntimeUsage(`defineEmits`);
  5525. }
  5526. return null;
  5527. }
  5528. function defineExpose(exposed) {
  5529. {
  5530. warnRuntimeUsage(`defineExpose`);
  5531. }
  5532. }
  5533. function defineOptions(options) {
  5534. {
  5535. warnRuntimeUsage(`defineOptions`);
  5536. }
  5537. }
  5538. function defineSlots() {
  5539. {
  5540. warnRuntimeUsage(`defineSlots`);
  5541. }
  5542. return null;
  5543. }
  5544. function defineModel() {
  5545. {
  5546. warnRuntimeUsage("defineModel");
  5547. }
  5548. }
  5549. function withDefaults(props, defaults) {
  5550. {
  5551. warnRuntimeUsage(`withDefaults`);
  5552. }
  5553. return null;
  5554. }
  5555. function useSlots() {
  5556. return getContext("useSlots").slots;
  5557. }
  5558. function useAttrs() {
  5559. return getContext("useAttrs").attrs;
  5560. }
  5561. function getContext(calledFunctionName) {
  5562. const i = getCurrentInstance();
  5563. if (!i) {
  5564. warn$1(`${calledFunctionName}() called without active instance.`);
  5565. }
  5566. return i.setupContext || (i.setupContext = createSetupContext(i));
  5567. }
  5568. function normalizePropsOrEmits(props) {
  5569. return isArray(props) ? props.reduce(
  5570. (normalized, p) => (normalized[p] = null, normalized),
  5571. {}
  5572. ) : props;
  5573. }
  5574. function mergeDefaults(raw, defaults) {
  5575. const props = normalizePropsOrEmits(raw);
  5576. for (const key in defaults) {
  5577. if (key.startsWith("__skip")) continue;
  5578. let opt = props[key];
  5579. if (opt) {
  5580. if (isArray(opt) || isFunction(opt)) {
  5581. opt = props[key] = { type: opt, default: defaults[key] };
  5582. } else {
  5583. opt.default = defaults[key];
  5584. }
  5585. } else if (opt === null) {
  5586. opt = props[key] = { default: defaults[key] };
  5587. } else {
  5588. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5589. }
  5590. if (opt && defaults[`__skip_${key}`]) {
  5591. opt.skipFactory = true;
  5592. }
  5593. }
  5594. return props;
  5595. }
  5596. function mergeModels(a, b) {
  5597. if (!a || !b) return a || b;
  5598. if (isArray(a) && isArray(b)) return a.concat(b);
  5599. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5600. }
  5601. function createPropsRestProxy(props, excludedKeys) {
  5602. const ret = {};
  5603. for (const key in props) {
  5604. if (!excludedKeys.includes(key)) {
  5605. Object.defineProperty(ret, key, {
  5606. enumerable: true,
  5607. get: () => props[key]
  5608. });
  5609. }
  5610. }
  5611. return ret;
  5612. }
  5613. function withAsyncContext(getAwaitable) {
  5614. const ctx = getCurrentInstance();
  5615. if (!ctx) {
  5616. warn$1(
  5617. `withAsyncContext called without active current instance. This is likely a bug.`
  5618. );
  5619. }
  5620. let awaitable = getAwaitable();
  5621. unsetCurrentInstance();
  5622. if (isPromise(awaitable)) {
  5623. awaitable = awaitable.catch((e) => {
  5624. setCurrentInstance(ctx);
  5625. throw e;
  5626. });
  5627. }
  5628. return [awaitable, () => setCurrentInstance(ctx)];
  5629. }
  5630. function createDuplicateChecker() {
  5631. const cache = /* @__PURE__ */ Object.create(null);
  5632. return (type, key) => {
  5633. if (cache[key]) {
  5634. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5635. } else {
  5636. cache[key] = type;
  5637. }
  5638. };
  5639. }
  5640. let shouldCacheAccess = true;
  5641. function applyOptions(instance) {
  5642. const options = resolveMergedOptions(instance);
  5643. const publicThis = instance.proxy;
  5644. const ctx = instance.ctx;
  5645. shouldCacheAccess = false;
  5646. if (options.beforeCreate) {
  5647. callHook$1(options.beforeCreate, instance, "bc");
  5648. }
  5649. const {
  5650. // state
  5651. data: dataOptions,
  5652. computed: computedOptions,
  5653. methods,
  5654. watch: watchOptions,
  5655. provide: provideOptions,
  5656. inject: injectOptions,
  5657. // lifecycle
  5658. created,
  5659. beforeMount,
  5660. mounted,
  5661. beforeUpdate,
  5662. updated,
  5663. activated,
  5664. deactivated,
  5665. beforeDestroy,
  5666. beforeUnmount,
  5667. destroyed,
  5668. unmounted,
  5669. render,
  5670. renderTracked,
  5671. renderTriggered,
  5672. errorCaptured,
  5673. serverPrefetch,
  5674. // public API
  5675. expose,
  5676. inheritAttrs,
  5677. // assets
  5678. components,
  5679. directives,
  5680. filters
  5681. } = options;
  5682. const checkDuplicateProperties = createDuplicateChecker() ;
  5683. {
  5684. const [propsOptions] = instance.propsOptions;
  5685. if (propsOptions) {
  5686. for (const key in propsOptions) {
  5687. checkDuplicateProperties("Props" /* PROPS */, key);
  5688. }
  5689. }
  5690. }
  5691. if (injectOptions) {
  5692. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5693. }
  5694. if (methods) {
  5695. for (const key in methods) {
  5696. const methodHandler = methods[key];
  5697. if (isFunction(methodHandler)) {
  5698. {
  5699. Object.defineProperty(ctx, key, {
  5700. value: methodHandler.bind(publicThis),
  5701. configurable: true,
  5702. enumerable: true,
  5703. writable: true
  5704. });
  5705. }
  5706. {
  5707. checkDuplicateProperties("Methods" /* METHODS */, key);
  5708. }
  5709. } else {
  5710. warn$1(
  5711. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5712. );
  5713. }
  5714. }
  5715. }
  5716. if (dataOptions) {
  5717. if (!isFunction(dataOptions)) {
  5718. warn$1(
  5719. `The data option must be a function. Plain object usage is no longer supported.`
  5720. );
  5721. }
  5722. const data = dataOptions.call(publicThis, publicThis);
  5723. if (isPromise(data)) {
  5724. warn$1(
  5725. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5726. );
  5727. }
  5728. if (!isObject(data)) {
  5729. warn$1(`data() should return an object.`);
  5730. } else {
  5731. instance.data = reactive(data);
  5732. {
  5733. for (const key in data) {
  5734. checkDuplicateProperties("Data" /* DATA */, key);
  5735. if (!isReservedPrefix(key[0])) {
  5736. Object.defineProperty(ctx, key, {
  5737. configurable: true,
  5738. enumerable: true,
  5739. get: () => data[key],
  5740. set: NOOP
  5741. });
  5742. }
  5743. }
  5744. }
  5745. }
  5746. }
  5747. shouldCacheAccess = true;
  5748. if (computedOptions) {
  5749. for (const key in computedOptions) {
  5750. const opt = computedOptions[key];
  5751. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5752. if (get === NOOP) {
  5753. warn$1(`Computed property "${key}" has no getter.`);
  5754. }
  5755. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5756. warn$1(
  5757. `Write operation failed: computed property "${key}" is readonly.`
  5758. );
  5759. } ;
  5760. const c = computed({
  5761. get,
  5762. set
  5763. });
  5764. Object.defineProperty(ctx, key, {
  5765. enumerable: true,
  5766. configurable: true,
  5767. get: () => c.value,
  5768. set: (v) => c.value = v
  5769. });
  5770. {
  5771. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5772. }
  5773. }
  5774. }
  5775. if (watchOptions) {
  5776. for (const key in watchOptions) {
  5777. createWatcher(watchOptions[key], ctx, publicThis, key);
  5778. }
  5779. }
  5780. if (provideOptions) {
  5781. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5782. Reflect.ownKeys(provides).forEach((key) => {
  5783. provide(key, provides[key]);
  5784. });
  5785. }
  5786. if (created) {
  5787. callHook$1(created, instance, "c");
  5788. }
  5789. function registerLifecycleHook(register, hook) {
  5790. if (isArray(hook)) {
  5791. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5792. } else if (hook) {
  5793. register(hook.bind(publicThis));
  5794. }
  5795. }
  5796. registerLifecycleHook(onBeforeMount, beforeMount);
  5797. registerLifecycleHook(onMounted, mounted);
  5798. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5799. registerLifecycleHook(onUpdated, updated);
  5800. registerLifecycleHook(onActivated, activated);
  5801. registerLifecycleHook(onDeactivated, deactivated);
  5802. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5803. registerLifecycleHook(onRenderTracked, renderTracked);
  5804. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5805. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5806. registerLifecycleHook(onUnmounted, unmounted);
  5807. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5808. if (isArray(expose)) {
  5809. if (expose.length) {
  5810. const exposed = instance.exposed || (instance.exposed = {});
  5811. expose.forEach((key) => {
  5812. Object.defineProperty(exposed, key, {
  5813. get: () => publicThis[key],
  5814. set: (val) => publicThis[key] = val,
  5815. enumerable: true
  5816. });
  5817. });
  5818. } else if (!instance.exposed) {
  5819. instance.exposed = {};
  5820. }
  5821. }
  5822. if (render && instance.render === NOOP) {
  5823. instance.render = render;
  5824. }
  5825. if (inheritAttrs != null) {
  5826. instance.inheritAttrs = inheritAttrs;
  5827. }
  5828. if (components) instance.components = components;
  5829. if (directives) instance.directives = directives;
  5830. }
  5831. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5832. if (isArray(injectOptions)) {
  5833. injectOptions = normalizeInject(injectOptions);
  5834. }
  5835. for (const key in injectOptions) {
  5836. const opt = injectOptions[key];
  5837. let injected;
  5838. if (isObject(opt)) {
  5839. if ("default" in opt) {
  5840. injected = inject(
  5841. opt.from || key,
  5842. opt.default,
  5843. true
  5844. );
  5845. } else {
  5846. injected = inject(opt.from || key);
  5847. }
  5848. } else {
  5849. injected = inject(opt);
  5850. }
  5851. if (isRef(injected)) {
  5852. Object.defineProperty(ctx, key, {
  5853. enumerable: true,
  5854. configurable: true,
  5855. get: () => injected.value,
  5856. set: (v) => injected.value = v
  5857. });
  5858. } else {
  5859. ctx[key] = injected;
  5860. }
  5861. {
  5862. checkDuplicateProperties("Inject" /* INJECT */, key);
  5863. }
  5864. }
  5865. }
  5866. function callHook$1(hook, instance, type) {
  5867. callWithAsyncErrorHandling(
  5868. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5869. instance,
  5870. type
  5871. );
  5872. }
  5873. function createWatcher(raw, ctx, publicThis, key) {
  5874. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5875. if (isString(raw)) {
  5876. const handler = ctx[raw];
  5877. if (isFunction(handler)) {
  5878. {
  5879. watch(getter, handler);
  5880. }
  5881. } else {
  5882. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5883. }
  5884. } else if (isFunction(raw)) {
  5885. {
  5886. watch(getter, raw.bind(publicThis));
  5887. }
  5888. } else if (isObject(raw)) {
  5889. if (isArray(raw)) {
  5890. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5891. } else {
  5892. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5893. if (isFunction(handler)) {
  5894. watch(getter, handler, raw);
  5895. } else {
  5896. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5897. }
  5898. }
  5899. } else {
  5900. warn$1(`Invalid watch option: "${key}"`, raw);
  5901. }
  5902. }
  5903. function resolveMergedOptions(instance) {
  5904. const base = instance.type;
  5905. const { mixins, extends: extendsOptions } = base;
  5906. const {
  5907. mixins: globalMixins,
  5908. optionsCache: cache,
  5909. config: { optionMergeStrategies }
  5910. } = instance.appContext;
  5911. const cached = cache.get(base);
  5912. let resolved;
  5913. if (cached) {
  5914. resolved = cached;
  5915. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5916. {
  5917. resolved = base;
  5918. }
  5919. } else {
  5920. resolved = {};
  5921. if (globalMixins.length) {
  5922. globalMixins.forEach(
  5923. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5924. );
  5925. }
  5926. mergeOptions(resolved, base, optionMergeStrategies);
  5927. }
  5928. if (isObject(base)) {
  5929. cache.set(base, resolved);
  5930. }
  5931. return resolved;
  5932. }
  5933. function mergeOptions(to, from, strats, asMixin = false) {
  5934. const { mixins, extends: extendsOptions } = from;
  5935. if (extendsOptions) {
  5936. mergeOptions(to, extendsOptions, strats, true);
  5937. }
  5938. if (mixins) {
  5939. mixins.forEach(
  5940. (m) => mergeOptions(to, m, strats, true)
  5941. );
  5942. }
  5943. for (const key in from) {
  5944. if (asMixin && key === "expose") {
  5945. warn$1(
  5946. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5947. );
  5948. } else {
  5949. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5950. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5951. }
  5952. }
  5953. return to;
  5954. }
  5955. const internalOptionMergeStrats = {
  5956. data: mergeDataFn,
  5957. props: mergeEmitsOrPropsOptions,
  5958. emits: mergeEmitsOrPropsOptions,
  5959. // objects
  5960. methods: mergeObjectOptions,
  5961. computed: mergeObjectOptions,
  5962. // lifecycle
  5963. beforeCreate: mergeAsArray$1,
  5964. created: mergeAsArray$1,
  5965. beforeMount: mergeAsArray$1,
  5966. mounted: mergeAsArray$1,
  5967. beforeUpdate: mergeAsArray$1,
  5968. updated: mergeAsArray$1,
  5969. beforeDestroy: mergeAsArray$1,
  5970. beforeUnmount: mergeAsArray$1,
  5971. destroyed: mergeAsArray$1,
  5972. unmounted: mergeAsArray$1,
  5973. activated: mergeAsArray$1,
  5974. deactivated: mergeAsArray$1,
  5975. errorCaptured: mergeAsArray$1,
  5976. serverPrefetch: mergeAsArray$1,
  5977. // assets
  5978. components: mergeObjectOptions,
  5979. directives: mergeObjectOptions,
  5980. // watch
  5981. watch: mergeWatchOptions,
  5982. // provide / inject
  5983. provide: mergeDataFn,
  5984. inject: mergeInject
  5985. };
  5986. function mergeDataFn(to, from) {
  5987. if (!from) {
  5988. return to;
  5989. }
  5990. if (!to) {
  5991. return from;
  5992. }
  5993. return function mergedDataFn() {
  5994. return (extend)(
  5995. isFunction(to) ? to.call(this, this) : to,
  5996. isFunction(from) ? from.call(this, this) : from
  5997. );
  5998. };
  5999. }
  6000. function mergeInject(to, from) {
  6001. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  6002. }
  6003. function normalizeInject(raw) {
  6004. if (isArray(raw)) {
  6005. const res = {};
  6006. for (let i = 0; i < raw.length; i++) {
  6007. res[raw[i]] = raw[i];
  6008. }
  6009. return res;
  6010. }
  6011. return raw;
  6012. }
  6013. function mergeAsArray$1(to, from) {
  6014. return to ? [...new Set([].concat(to, from))] : from;
  6015. }
  6016. function mergeObjectOptions(to, from) {
  6017. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  6018. }
  6019. function mergeEmitsOrPropsOptions(to, from) {
  6020. if (to) {
  6021. if (isArray(to) && isArray(from)) {
  6022. return [.../* @__PURE__ */ new Set([...to, ...from])];
  6023. }
  6024. return extend(
  6025. /* @__PURE__ */ Object.create(null),
  6026. normalizePropsOrEmits(to),
  6027. normalizePropsOrEmits(from != null ? from : {})
  6028. );
  6029. } else {
  6030. return from;
  6031. }
  6032. }
  6033. function mergeWatchOptions(to, from) {
  6034. if (!to) return from;
  6035. if (!from) return to;
  6036. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  6037. for (const key in from) {
  6038. merged[key] = mergeAsArray$1(to[key], from[key]);
  6039. }
  6040. return merged;
  6041. }
  6042. function createAppContext() {
  6043. return {
  6044. app: null,
  6045. config: {
  6046. isNativeTag: NO,
  6047. performance: false,
  6048. globalProperties: {},
  6049. optionMergeStrategies: {},
  6050. errorHandler: void 0,
  6051. warnHandler: void 0,
  6052. compilerOptions: {}
  6053. },
  6054. mixins: [],
  6055. components: {},
  6056. directives: {},
  6057. provides: /* @__PURE__ */ Object.create(null),
  6058. optionsCache: /* @__PURE__ */ new WeakMap(),
  6059. propsCache: /* @__PURE__ */ new WeakMap(),
  6060. emitsCache: /* @__PURE__ */ new WeakMap()
  6061. };
  6062. }
  6063. let uid$1 = 0;
  6064. function createAppAPI(render, hydrate) {
  6065. return function createApp(rootComponent, rootProps = null) {
  6066. if (!isFunction(rootComponent)) {
  6067. rootComponent = extend({}, rootComponent);
  6068. }
  6069. if (rootProps != null && !isObject(rootProps)) {
  6070. warn$1(`root props passed to app.mount() must be an object.`);
  6071. rootProps = null;
  6072. }
  6073. const context = createAppContext();
  6074. const installedPlugins = /* @__PURE__ */ new WeakSet();
  6075. const pluginCleanupFns = [];
  6076. let isMounted = false;
  6077. const app = context.app = {
  6078. _uid: uid$1++,
  6079. _component: rootComponent,
  6080. _props: rootProps,
  6081. _container: null,
  6082. _context: context,
  6083. _instance: null,
  6084. version,
  6085. get config() {
  6086. return context.config;
  6087. },
  6088. set config(v) {
  6089. {
  6090. warn$1(
  6091. `app.config cannot be replaced. Modify individual options instead.`
  6092. );
  6093. }
  6094. },
  6095. use(plugin, ...options) {
  6096. if (installedPlugins.has(plugin)) {
  6097. warn$1(`Plugin has already been applied to target app.`);
  6098. } else if (plugin && isFunction(plugin.install)) {
  6099. installedPlugins.add(plugin);
  6100. plugin.install(app, ...options);
  6101. } else if (isFunction(plugin)) {
  6102. installedPlugins.add(plugin);
  6103. plugin(app, ...options);
  6104. } else {
  6105. warn$1(
  6106. `A plugin must either be a function or an object with an "install" function.`
  6107. );
  6108. }
  6109. return app;
  6110. },
  6111. mixin(mixin) {
  6112. {
  6113. if (!context.mixins.includes(mixin)) {
  6114. context.mixins.push(mixin);
  6115. } else {
  6116. warn$1(
  6117. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6118. );
  6119. }
  6120. }
  6121. return app;
  6122. },
  6123. component(name, component) {
  6124. {
  6125. validateComponentName(name, context.config);
  6126. }
  6127. if (!component) {
  6128. return context.components[name];
  6129. }
  6130. if (context.components[name]) {
  6131. warn$1(`Component "${name}" has already been registered in target app.`);
  6132. }
  6133. context.components[name] = component;
  6134. return app;
  6135. },
  6136. directive(name, directive) {
  6137. {
  6138. validateDirectiveName(name);
  6139. }
  6140. if (!directive) {
  6141. return context.directives[name];
  6142. }
  6143. if (context.directives[name]) {
  6144. warn$1(`Directive "${name}" has already been registered in target app.`);
  6145. }
  6146. context.directives[name] = directive;
  6147. return app;
  6148. },
  6149. mount(rootContainer, isHydrate, namespace) {
  6150. if (!isMounted) {
  6151. if (rootContainer.__vue_app__) {
  6152. warn$1(
  6153. `There is already an app instance mounted on the host container.
  6154. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6155. );
  6156. }
  6157. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6158. vnode.appContext = context;
  6159. if (namespace === true) {
  6160. namespace = "svg";
  6161. } else if (namespace === false) {
  6162. namespace = void 0;
  6163. }
  6164. {
  6165. context.reload = () => {
  6166. const cloned = cloneVNode(vnode);
  6167. cloned.el = null;
  6168. render(cloned, rootContainer, namespace);
  6169. };
  6170. }
  6171. if (isHydrate && hydrate) {
  6172. hydrate(vnode, rootContainer);
  6173. } else {
  6174. render(vnode, rootContainer, namespace);
  6175. }
  6176. isMounted = true;
  6177. app._container = rootContainer;
  6178. rootContainer.__vue_app__ = app;
  6179. {
  6180. app._instance = vnode.component;
  6181. devtoolsInitApp(app, version);
  6182. }
  6183. return getComponentPublicInstance(vnode.component);
  6184. } else {
  6185. warn$1(
  6186. `App has already been mounted.
  6187. 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)\``
  6188. );
  6189. }
  6190. },
  6191. onUnmount(cleanupFn) {
  6192. if (typeof cleanupFn !== "function") {
  6193. warn$1(
  6194. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6195. );
  6196. }
  6197. pluginCleanupFns.push(cleanupFn);
  6198. },
  6199. unmount() {
  6200. if (isMounted) {
  6201. callWithAsyncErrorHandling(
  6202. pluginCleanupFns,
  6203. app._instance,
  6204. 16
  6205. );
  6206. render(null, app._container);
  6207. {
  6208. app._instance = null;
  6209. devtoolsUnmountApp(app);
  6210. }
  6211. delete app._container.__vue_app__;
  6212. } else {
  6213. warn$1(`Cannot unmount an app that is not mounted.`);
  6214. }
  6215. },
  6216. provide(key, value) {
  6217. if (key in context.provides) {
  6218. if (hasOwn(context.provides, key)) {
  6219. warn$1(
  6220. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6221. );
  6222. } else {
  6223. warn$1(
  6224. `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
  6225. );
  6226. }
  6227. }
  6228. context.provides[key] = value;
  6229. return app;
  6230. },
  6231. runWithContext(fn) {
  6232. const lastApp = currentApp;
  6233. currentApp = app;
  6234. try {
  6235. return fn();
  6236. } finally {
  6237. currentApp = lastApp;
  6238. }
  6239. }
  6240. };
  6241. return app;
  6242. };
  6243. }
  6244. let currentApp = null;
  6245. function provide(key, value) {
  6246. if (!currentInstance) {
  6247. {
  6248. warn$1(`provide() can only be used inside setup().`);
  6249. }
  6250. } else {
  6251. let provides = currentInstance.provides;
  6252. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  6253. if (parentProvides === provides) {
  6254. provides = currentInstance.provides = Object.create(parentProvides);
  6255. }
  6256. provides[key] = value;
  6257. }
  6258. }
  6259. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  6260. const instance = getCurrentInstance();
  6261. if (instance || currentApp) {
  6262. let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  6263. if (provides && key in provides) {
  6264. return provides[key];
  6265. } else if (arguments.length > 1) {
  6266. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  6267. } else {
  6268. warn$1(`injection "${String(key)}" not found.`);
  6269. }
  6270. } else {
  6271. warn$1(`inject() can only be used inside setup() or functional components.`);
  6272. }
  6273. }
  6274. function hasInjectionContext() {
  6275. return !!(getCurrentInstance() || currentApp);
  6276. }
  6277. const internalObjectProto = {};
  6278. const createInternalObject = () => Object.create(internalObjectProto);
  6279. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  6280. function initProps(instance, rawProps, isStateful, isSSR = false) {
  6281. const props = {};
  6282. const attrs = createInternalObject();
  6283. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  6284. setFullProps(instance, rawProps, props, attrs);
  6285. for (const key in instance.propsOptions[0]) {
  6286. if (!(key in props)) {
  6287. props[key] = void 0;
  6288. }
  6289. }
  6290. {
  6291. validateProps(rawProps || {}, props, instance);
  6292. }
  6293. if (isStateful) {
  6294. instance.props = isSSR ? props : shallowReactive(props);
  6295. } else {
  6296. if (!instance.type.props) {
  6297. instance.props = attrs;
  6298. } else {
  6299. instance.props = props;
  6300. }
  6301. }
  6302. instance.attrs = attrs;
  6303. }
  6304. function isInHmrContext(instance) {
  6305. while (instance) {
  6306. if (instance.type.__hmrId) return true;
  6307. instance = instance.parent;
  6308. }
  6309. }
  6310. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  6311. const {
  6312. props,
  6313. attrs,
  6314. vnode: { patchFlag }
  6315. } = instance;
  6316. const rawCurrentProps = toRaw(props);
  6317. const [options] = instance.propsOptions;
  6318. let hasAttrsChanged = false;
  6319. if (
  6320. // always force full diff in dev
  6321. // - #1942 if hmr is enabled with sfc component
  6322. // - vite#872 non-sfc component used by sfc component
  6323. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  6324. ) {
  6325. if (patchFlag & 8) {
  6326. const propsToUpdate = instance.vnode.dynamicProps;
  6327. for (let i = 0; i < propsToUpdate.length; i++) {
  6328. let key = propsToUpdate[i];
  6329. if (isEmitListener(instance.emitsOptions, key)) {
  6330. continue;
  6331. }
  6332. const value = rawProps[key];
  6333. if (options) {
  6334. if (hasOwn(attrs, key)) {
  6335. if (value !== attrs[key]) {
  6336. attrs[key] = value;
  6337. hasAttrsChanged = true;
  6338. }
  6339. } else {
  6340. const camelizedKey = camelize(key);
  6341. props[camelizedKey] = resolvePropValue(
  6342. options,
  6343. rawCurrentProps,
  6344. camelizedKey,
  6345. value,
  6346. instance,
  6347. false
  6348. );
  6349. }
  6350. } else {
  6351. if (value !== attrs[key]) {
  6352. attrs[key] = value;
  6353. hasAttrsChanged = true;
  6354. }
  6355. }
  6356. }
  6357. }
  6358. } else {
  6359. if (setFullProps(instance, rawProps, props, attrs)) {
  6360. hasAttrsChanged = true;
  6361. }
  6362. let kebabKey;
  6363. for (const key in rawCurrentProps) {
  6364. if (!rawProps || // for camelCase
  6365. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  6366. // and converted to camelCase (#955)
  6367. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  6368. if (options) {
  6369. if (rawPrevProps && // for camelCase
  6370. (rawPrevProps[key] !== void 0 || // for kebab-case
  6371. rawPrevProps[kebabKey] !== void 0)) {
  6372. props[key] = resolvePropValue(
  6373. options,
  6374. rawCurrentProps,
  6375. key,
  6376. void 0,
  6377. instance,
  6378. true
  6379. );
  6380. }
  6381. } else {
  6382. delete props[key];
  6383. }
  6384. }
  6385. }
  6386. if (attrs !== rawCurrentProps) {
  6387. for (const key in attrs) {
  6388. if (!rawProps || !hasOwn(rawProps, key) && true) {
  6389. delete attrs[key];
  6390. hasAttrsChanged = true;
  6391. }
  6392. }
  6393. }
  6394. }
  6395. if (hasAttrsChanged) {
  6396. trigger(instance.attrs, "set", "");
  6397. }
  6398. {
  6399. validateProps(rawProps || {}, props, instance);
  6400. }
  6401. }
  6402. function setFullProps(instance, rawProps, props, attrs) {
  6403. const [options, needCastKeys] = instance.propsOptions;
  6404. let hasAttrsChanged = false;
  6405. let rawCastValues;
  6406. if (rawProps) {
  6407. for (let key in rawProps) {
  6408. if (isReservedProp(key)) {
  6409. continue;
  6410. }
  6411. const value = rawProps[key];
  6412. let camelKey;
  6413. if (options && hasOwn(options, camelKey = camelize(key))) {
  6414. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  6415. props[camelKey] = value;
  6416. } else {
  6417. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  6418. }
  6419. } else if (!isEmitListener(instance.emitsOptions, key)) {
  6420. if (!(key in attrs) || value !== attrs[key]) {
  6421. attrs[key] = value;
  6422. hasAttrsChanged = true;
  6423. }
  6424. }
  6425. }
  6426. }
  6427. if (needCastKeys) {
  6428. const rawCurrentProps = toRaw(props);
  6429. const castValues = rawCastValues || EMPTY_OBJ;
  6430. for (let i = 0; i < needCastKeys.length; i++) {
  6431. const key = needCastKeys[i];
  6432. props[key] = resolvePropValue(
  6433. options,
  6434. rawCurrentProps,
  6435. key,
  6436. castValues[key],
  6437. instance,
  6438. !hasOwn(castValues, key)
  6439. );
  6440. }
  6441. }
  6442. return hasAttrsChanged;
  6443. }
  6444. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  6445. const opt = options[key];
  6446. if (opt != null) {
  6447. const hasDefault = hasOwn(opt, "default");
  6448. if (hasDefault && value === void 0) {
  6449. const defaultValue = opt.default;
  6450. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  6451. const { propsDefaults } = instance;
  6452. if (key in propsDefaults) {
  6453. value = propsDefaults[key];
  6454. } else {
  6455. const reset = setCurrentInstance(instance);
  6456. value = propsDefaults[key] = defaultValue.call(
  6457. null,
  6458. props
  6459. );
  6460. reset();
  6461. }
  6462. } else {
  6463. value = defaultValue;
  6464. }
  6465. if (instance.ce) {
  6466. instance.ce._setProp(key, value);
  6467. }
  6468. }
  6469. if (opt[0 /* shouldCast */]) {
  6470. if (isAbsent && !hasDefault) {
  6471. value = false;
  6472. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  6473. value = true;
  6474. }
  6475. }
  6476. }
  6477. return value;
  6478. }
  6479. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  6480. function normalizePropsOptions(comp, appContext, asMixin = false) {
  6481. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  6482. const cached = cache.get(comp);
  6483. if (cached) {
  6484. return cached;
  6485. }
  6486. const raw = comp.props;
  6487. const normalized = {};
  6488. const needCastKeys = [];
  6489. let hasExtends = false;
  6490. if (!isFunction(comp)) {
  6491. const extendProps = (raw2) => {
  6492. hasExtends = true;
  6493. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  6494. extend(normalized, props);
  6495. if (keys) needCastKeys.push(...keys);
  6496. };
  6497. if (!asMixin && appContext.mixins.length) {
  6498. appContext.mixins.forEach(extendProps);
  6499. }
  6500. if (comp.extends) {
  6501. extendProps(comp.extends);
  6502. }
  6503. if (comp.mixins) {
  6504. comp.mixins.forEach(extendProps);
  6505. }
  6506. }
  6507. if (!raw && !hasExtends) {
  6508. if (isObject(comp)) {
  6509. cache.set(comp, EMPTY_ARR);
  6510. }
  6511. return EMPTY_ARR;
  6512. }
  6513. if (isArray(raw)) {
  6514. for (let i = 0; i < raw.length; i++) {
  6515. if (!isString(raw[i])) {
  6516. warn$1(`props must be strings when using array syntax.`, raw[i]);
  6517. }
  6518. const normalizedKey = camelize(raw[i]);
  6519. if (validatePropName(normalizedKey)) {
  6520. normalized[normalizedKey] = EMPTY_OBJ;
  6521. }
  6522. }
  6523. } else if (raw) {
  6524. if (!isObject(raw)) {
  6525. warn$1(`invalid props options`, raw);
  6526. }
  6527. for (const key in raw) {
  6528. const normalizedKey = camelize(key);
  6529. if (validatePropName(normalizedKey)) {
  6530. const opt = raw[key];
  6531. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  6532. const propType = prop.type;
  6533. let shouldCast = false;
  6534. let shouldCastTrue = true;
  6535. if (isArray(propType)) {
  6536. for (let index = 0; index < propType.length; ++index) {
  6537. const type = propType[index];
  6538. const typeName = isFunction(type) && type.name;
  6539. if (typeName === "Boolean") {
  6540. shouldCast = true;
  6541. break;
  6542. } else if (typeName === "String") {
  6543. shouldCastTrue = false;
  6544. }
  6545. }
  6546. } else {
  6547. shouldCast = isFunction(propType) && propType.name === "Boolean";
  6548. }
  6549. prop[0 /* shouldCast */] = shouldCast;
  6550. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  6551. if (shouldCast || hasOwn(prop, "default")) {
  6552. needCastKeys.push(normalizedKey);
  6553. }
  6554. }
  6555. }
  6556. }
  6557. const res = [normalized, needCastKeys];
  6558. if (isObject(comp)) {
  6559. cache.set(comp, res);
  6560. }
  6561. return res;
  6562. }
  6563. function validatePropName(key) {
  6564. if (key[0] !== "$" && !isReservedProp(key)) {
  6565. return true;
  6566. } else {
  6567. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  6568. }
  6569. return false;
  6570. }
  6571. function getType(ctor) {
  6572. if (ctor === null) {
  6573. return "null";
  6574. }
  6575. if (typeof ctor === "function") {
  6576. return ctor.name || "";
  6577. } else if (typeof ctor === "object") {
  6578. const name = ctor.constructor && ctor.constructor.name;
  6579. return name || "";
  6580. }
  6581. return "";
  6582. }
  6583. function validateProps(rawProps, props, instance) {
  6584. const resolvedValues = toRaw(props);
  6585. const options = instance.propsOptions[0];
  6586. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  6587. for (const key in options) {
  6588. let opt = options[key];
  6589. if (opt == null) continue;
  6590. validateProp(
  6591. key,
  6592. resolvedValues[key],
  6593. opt,
  6594. shallowReadonly(resolvedValues) ,
  6595. !camelizePropsKey.includes(key)
  6596. );
  6597. }
  6598. }
  6599. function validateProp(name, value, prop, props, isAbsent) {
  6600. const { type, required, validator, skipCheck } = prop;
  6601. if (required && isAbsent) {
  6602. warn$1('Missing required prop: "' + name + '"');
  6603. return;
  6604. }
  6605. if (value == null && !required) {
  6606. return;
  6607. }
  6608. if (type != null && type !== true && !skipCheck) {
  6609. let isValid = false;
  6610. const types = isArray(type) ? type : [type];
  6611. const expectedTypes = [];
  6612. for (let i = 0; i < types.length && !isValid; i++) {
  6613. const { valid, expectedType } = assertType(value, types[i]);
  6614. expectedTypes.push(expectedType || "");
  6615. isValid = valid;
  6616. }
  6617. if (!isValid) {
  6618. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  6619. return;
  6620. }
  6621. }
  6622. if (validator && !validator(value, props)) {
  6623. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  6624. }
  6625. }
  6626. const isSimpleType = /* @__PURE__ */ makeMap(
  6627. "String,Number,Boolean,Function,Symbol,BigInt"
  6628. );
  6629. function assertType(value, type) {
  6630. let valid;
  6631. const expectedType = getType(type);
  6632. if (expectedType === "null") {
  6633. valid = value === null;
  6634. } else if (isSimpleType(expectedType)) {
  6635. const t = typeof value;
  6636. valid = t === expectedType.toLowerCase();
  6637. if (!valid && t === "object") {
  6638. valid = value instanceof type;
  6639. }
  6640. } else if (expectedType === "Object") {
  6641. valid = isObject(value);
  6642. } else if (expectedType === "Array") {
  6643. valid = isArray(value);
  6644. } else {
  6645. valid = value instanceof type;
  6646. }
  6647. return {
  6648. valid,
  6649. expectedType
  6650. };
  6651. }
  6652. function getInvalidTypeMessage(name, value, expectedTypes) {
  6653. if (expectedTypes.length === 0) {
  6654. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  6655. }
  6656. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  6657. const expectedType = expectedTypes[0];
  6658. const receivedType = toRawType(value);
  6659. const expectedValue = styleValue(value, expectedType);
  6660. const receivedValue = styleValue(value, receivedType);
  6661. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  6662. message += ` with value ${expectedValue}`;
  6663. }
  6664. message += `, got ${receivedType} `;
  6665. if (isExplicable(receivedType)) {
  6666. message += `with value ${receivedValue}.`;
  6667. }
  6668. return message;
  6669. }
  6670. function styleValue(value, type) {
  6671. if (type === "String") {
  6672. return `"${value}"`;
  6673. } else if (type === "Number") {
  6674. return `${Number(value)}`;
  6675. } else {
  6676. return `${value}`;
  6677. }
  6678. }
  6679. function isExplicable(type) {
  6680. const explicitTypes = ["string", "number", "boolean"];
  6681. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  6682. }
  6683. function isBoolean(...args) {
  6684. return args.some((elem) => elem.toLowerCase() === "boolean");
  6685. }
  6686. const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
  6687. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  6688. const normalizeSlot = (key, rawSlot, ctx) => {
  6689. if (rawSlot._n) {
  6690. return rawSlot;
  6691. }
  6692. const normalized = withCtx((...args) => {
  6693. if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
  6694. warn$1(
  6695. `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.`
  6696. );
  6697. }
  6698. return normalizeSlotValue(rawSlot(...args));
  6699. }, ctx);
  6700. normalized._c = false;
  6701. return normalized;
  6702. };
  6703. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  6704. const ctx = rawSlots._ctx;
  6705. for (const key in rawSlots) {
  6706. if (isInternalKey(key)) continue;
  6707. const value = rawSlots[key];
  6708. if (isFunction(value)) {
  6709. slots[key] = normalizeSlot(key, value, ctx);
  6710. } else if (value != null) {
  6711. {
  6712. warn$1(
  6713. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  6714. );
  6715. }
  6716. const normalized = normalizeSlotValue(value);
  6717. slots[key] = () => normalized;
  6718. }
  6719. }
  6720. };
  6721. const normalizeVNodeSlots = (instance, children) => {
  6722. if (!isKeepAlive(instance.vnode) && true) {
  6723. warn$1(
  6724. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  6725. );
  6726. }
  6727. const normalized = normalizeSlotValue(children);
  6728. instance.slots.default = () => normalized;
  6729. };
  6730. const assignSlots = (slots, children, optimized) => {
  6731. for (const key in children) {
  6732. if (optimized || !isInternalKey(key)) {
  6733. slots[key] = children[key];
  6734. }
  6735. }
  6736. };
  6737. const initSlots = (instance, children, optimized) => {
  6738. const slots = instance.slots = createInternalObject();
  6739. if (instance.vnode.shapeFlag & 32) {
  6740. const type = children._;
  6741. if (type) {
  6742. assignSlots(slots, children, optimized);
  6743. if (optimized) {
  6744. def(slots, "_", type, true);
  6745. }
  6746. } else {
  6747. normalizeObjectSlots(children, slots);
  6748. }
  6749. } else if (children) {
  6750. normalizeVNodeSlots(instance, children);
  6751. }
  6752. };
  6753. const updateSlots = (instance, children, optimized) => {
  6754. const { vnode, slots } = instance;
  6755. let needDeletionCheck = true;
  6756. let deletionComparisonTarget = EMPTY_OBJ;
  6757. if (vnode.shapeFlag & 32) {
  6758. const type = children._;
  6759. if (type) {
  6760. if (isHmrUpdating) {
  6761. assignSlots(slots, children, optimized);
  6762. trigger(instance, "set", "$slots");
  6763. } else if (optimized && type === 1) {
  6764. needDeletionCheck = false;
  6765. } else {
  6766. assignSlots(slots, children, optimized);
  6767. }
  6768. } else {
  6769. needDeletionCheck = !children.$stable;
  6770. normalizeObjectSlots(children, slots);
  6771. }
  6772. deletionComparisonTarget = children;
  6773. } else if (children) {
  6774. normalizeVNodeSlots(instance, children);
  6775. deletionComparisonTarget = { default: 1 };
  6776. }
  6777. if (needDeletionCheck) {
  6778. for (const key in slots) {
  6779. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6780. delete slots[key];
  6781. }
  6782. }
  6783. }
  6784. };
  6785. let supported;
  6786. let perf;
  6787. function startMeasure(instance, type) {
  6788. if (instance.appContext.config.performance && isSupported()) {
  6789. perf.mark(`vue-${type}-${instance.uid}`);
  6790. }
  6791. {
  6792. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6793. }
  6794. }
  6795. function endMeasure(instance, type) {
  6796. if (instance.appContext.config.performance && isSupported()) {
  6797. const startTag = `vue-${type}-${instance.uid}`;
  6798. const endTag = startTag + `:end`;
  6799. const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
  6800. perf.mark(endTag);
  6801. perf.measure(measureName, startTag, endTag);
  6802. perf.clearMeasures(measureName);
  6803. perf.clearMarks(startTag);
  6804. perf.clearMarks(endTag);
  6805. }
  6806. {
  6807. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6808. }
  6809. }
  6810. function isSupported() {
  6811. if (supported !== void 0) {
  6812. return supported;
  6813. }
  6814. if (typeof window !== "undefined" && window.performance) {
  6815. supported = true;
  6816. perf = window.performance;
  6817. } else {
  6818. supported = false;
  6819. }
  6820. return supported;
  6821. }
  6822. const queuePostRenderEffect = queueEffectWithSuspense ;
  6823. function createRenderer(options) {
  6824. return baseCreateRenderer(options);
  6825. }
  6826. function createHydrationRenderer(options) {
  6827. return baseCreateRenderer(options, createHydrationFunctions);
  6828. }
  6829. function baseCreateRenderer(options, createHydrationFns) {
  6830. const target = getGlobalThis();
  6831. target.__VUE__ = true;
  6832. {
  6833. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6834. }
  6835. const {
  6836. insert: hostInsert,
  6837. remove: hostRemove,
  6838. patchProp: hostPatchProp,
  6839. createElement: hostCreateElement,
  6840. createText: hostCreateText,
  6841. createComment: hostCreateComment,
  6842. setText: hostSetText,
  6843. setElementText: hostSetElementText,
  6844. parentNode: hostParentNode,
  6845. nextSibling: hostNextSibling,
  6846. setScopeId: hostSetScopeId = NOOP,
  6847. insertStaticContent: hostInsertStaticContent
  6848. } = options;
  6849. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6850. if (n1 === n2) {
  6851. return;
  6852. }
  6853. if (n1 && !isSameVNodeType(n1, n2)) {
  6854. anchor = getNextHostNode(n1);
  6855. unmount(n1, parentComponent, parentSuspense, true);
  6856. n1 = null;
  6857. }
  6858. if (n2.patchFlag === -2) {
  6859. optimized = false;
  6860. n2.dynamicChildren = null;
  6861. }
  6862. const { type, ref, shapeFlag } = n2;
  6863. switch (type) {
  6864. case Text:
  6865. processText(n1, n2, container, anchor);
  6866. break;
  6867. case Comment:
  6868. processCommentNode(n1, n2, container, anchor);
  6869. break;
  6870. case Static:
  6871. if (n1 == null) {
  6872. mountStaticNode(n2, container, anchor, namespace);
  6873. } else {
  6874. patchStaticNode(n1, n2, container, namespace);
  6875. }
  6876. break;
  6877. case Fragment:
  6878. processFragment(
  6879. n1,
  6880. n2,
  6881. container,
  6882. anchor,
  6883. parentComponent,
  6884. parentSuspense,
  6885. namespace,
  6886. slotScopeIds,
  6887. optimized
  6888. );
  6889. break;
  6890. default:
  6891. if (shapeFlag & 1) {
  6892. processElement(
  6893. n1,
  6894. n2,
  6895. container,
  6896. anchor,
  6897. parentComponent,
  6898. parentSuspense,
  6899. namespace,
  6900. slotScopeIds,
  6901. optimized
  6902. );
  6903. } else if (shapeFlag & 6) {
  6904. processComponent(
  6905. n1,
  6906. n2,
  6907. container,
  6908. anchor,
  6909. parentComponent,
  6910. parentSuspense,
  6911. namespace,
  6912. slotScopeIds,
  6913. optimized
  6914. );
  6915. } else if (shapeFlag & 64) {
  6916. type.process(
  6917. n1,
  6918. n2,
  6919. container,
  6920. anchor,
  6921. parentComponent,
  6922. parentSuspense,
  6923. namespace,
  6924. slotScopeIds,
  6925. optimized,
  6926. internals
  6927. );
  6928. } else if (shapeFlag & 128) {
  6929. type.process(
  6930. n1,
  6931. n2,
  6932. container,
  6933. anchor,
  6934. parentComponent,
  6935. parentSuspense,
  6936. namespace,
  6937. slotScopeIds,
  6938. optimized,
  6939. internals
  6940. );
  6941. } else {
  6942. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6943. }
  6944. }
  6945. if (ref != null && parentComponent) {
  6946. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6947. } else if (ref == null && n1 && n1.ref != null) {
  6948. setRef(n1.ref, null, parentSuspense, n1, true);
  6949. }
  6950. };
  6951. const processText = (n1, n2, container, anchor) => {
  6952. if (n1 == null) {
  6953. hostInsert(
  6954. n2.el = hostCreateText(n2.children),
  6955. container,
  6956. anchor
  6957. );
  6958. } else {
  6959. const el = n2.el = n1.el;
  6960. if (n2.children !== n1.children) {
  6961. hostSetText(el, n2.children);
  6962. }
  6963. }
  6964. };
  6965. const processCommentNode = (n1, n2, container, anchor) => {
  6966. if (n1 == null) {
  6967. hostInsert(
  6968. n2.el = hostCreateComment(n2.children || ""),
  6969. container,
  6970. anchor
  6971. );
  6972. } else {
  6973. n2.el = n1.el;
  6974. }
  6975. };
  6976. const mountStaticNode = (n2, container, anchor, namespace) => {
  6977. [n2.el, n2.anchor] = hostInsertStaticContent(
  6978. n2.children,
  6979. container,
  6980. anchor,
  6981. namespace,
  6982. n2.el,
  6983. n2.anchor
  6984. );
  6985. };
  6986. const patchStaticNode = (n1, n2, container, namespace) => {
  6987. if (n2.children !== n1.children) {
  6988. const anchor = hostNextSibling(n1.anchor);
  6989. removeStaticNode(n1);
  6990. [n2.el, n2.anchor] = hostInsertStaticContent(
  6991. n2.children,
  6992. container,
  6993. anchor,
  6994. namespace
  6995. );
  6996. } else {
  6997. n2.el = n1.el;
  6998. n2.anchor = n1.anchor;
  6999. }
  7000. };
  7001. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  7002. let next;
  7003. while (el && el !== anchor) {
  7004. next = hostNextSibling(el);
  7005. hostInsert(el, container, nextSibling);
  7006. el = next;
  7007. }
  7008. hostInsert(anchor, container, nextSibling);
  7009. };
  7010. const removeStaticNode = ({ el, anchor }) => {
  7011. let next;
  7012. while (el && el !== anchor) {
  7013. next = hostNextSibling(el);
  7014. hostRemove(el);
  7015. el = next;
  7016. }
  7017. hostRemove(anchor);
  7018. };
  7019. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7020. if (n2.type === "svg") {
  7021. namespace = "svg";
  7022. } else if (n2.type === "math") {
  7023. namespace = "mathml";
  7024. }
  7025. if (n1 == null) {
  7026. mountElement(
  7027. n2,
  7028. container,
  7029. anchor,
  7030. parentComponent,
  7031. parentSuspense,
  7032. namespace,
  7033. slotScopeIds,
  7034. optimized
  7035. );
  7036. } else {
  7037. patchElement(
  7038. n1,
  7039. n2,
  7040. parentComponent,
  7041. parentSuspense,
  7042. namespace,
  7043. slotScopeIds,
  7044. optimized
  7045. );
  7046. }
  7047. };
  7048. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7049. let el;
  7050. let vnodeHook;
  7051. const { props, shapeFlag, transition, dirs } = vnode;
  7052. el = vnode.el = hostCreateElement(
  7053. vnode.type,
  7054. namespace,
  7055. props && props.is,
  7056. props
  7057. );
  7058. if (shapeFlag & 8) {
  7059. hostSetElementText(el, vnode.children);
  7060. } else if (shapeFlag & 16) {
  7061. mountChildren(
  7062. vnode.children,
  7063. el,
  7064. null,
  7065. parentComponent,
  7066. parentSuspense,
  7067. resolveChildrenNamespace(vnode, namespace),
  7068. slotScopeIds,
  7069. optimized
  7070. );
  7071. }
  7072. if (dirs) {
  7073. invokeDirectiveHook(vnode, null, parentComponent, "created");
  7074. }
  7075. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  7076. if (props) {
  7077. for (const key in props) {
  7078. if (key !== "value" && !isReservedProp(key)) {
  7079. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  7080. }
  7081. }
  7082. if ("value" in props) {
  7083. hostPatchProp(el, "value", null, props.value, namespace);
  7084. }
  7085. if (vnodeHook = props.onVnodeBeforeMount) {
  7086. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7087. }
  7088. }
  7089. {
  7090. def(el, "__vnode", vnode, true);
  7091. def(el, "__vueParentComponent", parentComponent, true);
  7092. }
  7093. if (dirs) {
  7094. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  7095. }
  7096. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  7097. if (needCallTransitionHooks) {
  7098. transition.beforeEnter(el);
  7099. }
  7100. hostInsert(el, container, anchor);
  7101. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  7102. queuePostRenderEffect(() => {
  7103. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7104. needCallTransitionHooks && transition.enter(el);
  7105. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  7106. }, parentSuspense);
  7107. }
  7108. };
  7109. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  7110. if (scopeId) {
  7111. hostSetScopeId(el, scopeId);
  7112. }
  7113. if (slotScopeIds) {
  7114. for (let i = 0; i < slotScopeIds.length; i++) {
  7115. hostSetScopeId(el, slotScopeIds[i]);
  7116. }
  7117. }
  7118. if (parentComponent) {
  7119. let subTree = parentComponent.subTree;
  7120. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7121. subTree = filterSingleRoot(subTree.children) || subTree;
  7122. }
  7123. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  7124. const parentVNode = parentComponent.vnode;
  7125. setScopeId(
  7126. el,
  7127. parentVNode,
  7128. parentVNode.scopeId,
  7129. parentVNode.slotScopeIds,
  7130. parentComponent.parent
  7131. );
  7132. }
  7133. }
  7134. };
  7135. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7136. for (let i = start; i < children.length; i++) {
  7137. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7138. patch(
  7139. null,
  7140. child,
  7141. container,
  7142. anchor,
  7143. parentComponent,
  7144. parentSuspense,
  7145. namespace,
  7146. slotScopeIds,
  7147. optimized
  7148. );
  7149. }
  7150. };
  7151. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7152. const el = n2.el = n1.el;
  7153. {
  7154. el.__vnode = n2;
  7155. }
  7156. let { patchFlag, dynamicChildren, dirs } = n2;
  7157. patchFlag |= n1.patchFlag & 16;
  7158. const oldProps = n1.props || EMPTY_OBJ;
  7159. const newProps = n2.props || EMPTY_OBJ;
  7160. let vnodeHook;
  7161. parentComponent && toggleRecurse(parentComponent, false);
  7162. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7163. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7164. }
  7165. if (dirs) {
  7166. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7167. }
  7168. parentComponent && toggleRecurse(parentComponent, true);
  7169. if (isHmrUpdating) {
  7170. patchFlag = 0;
  7171. optimized = false;
  7172. dynamicChildren = null;
  7173. }
  7174. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7175. hostSetElementText(el, "");
  7176. }
  7177. if (dynamicChildren) {
  7178. patchBlockChildren(
  7179. n1.dynamicChildren,
  7180. dynamicChildren,
  7181. el,
  7182. parentComponent,
  7183. parentSuspense,
  7184. resolveChildrenNamespace(n2, namespace),
  7185. slotScopeIds
  7186. );
  7187. {
  7188. traverseStaticChildren(n1, n2);
  7189. }
  7190. } else if (!optimized) {
  7191. patchChildren(
  7192. n1,
  7193. n2,
  7194. el,
  7195. null,
  7196. parentComponent,
  7197. parentSuspense,
  7198. resolveChildrenNamespace(n2, namespace),
  7199. slotScopeIds,
  7200. false
  7201. );
  7202. }
  7203. if (patchFlag > 0) {
  7204. if (patchFlag & 16) {
  7205. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7206. } else {
  7207. if (patchFlag & 2) {
  7208. if (oldProps.class !== newProps.class) {
  7209. hostPatchProp(el, "class", null, newProps.class, namespace);
  7210. }
  7211. }
  7212. if (patchFlag & 4) {
  7213. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7214. }
  7215. if (patchFlag & 8) {
  7216. const propsToUpdate = n2.dynamicProps;
  7217. for (let i = 0; i < propsToUpdate.length; i++) {
  7218. const key = propsToUpdate[i];
  7219. const prev = oldProps[key];
  7220. const next = newProps[key];
  7221. if (next !== prev || key === "value") {
  7222. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7223. }
  7224. }
  7225. }
  7226. }
  7227. if (patchFlag & 1) {
  7228. if (n1.children !== n2.children) {
  7229. hostSetElementText(el, n2.children);
  7230. }
  7231. }
  7232. } else if (!optimized && dynamicChildren == null) {
  7233. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7234. }
  7235. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7236. queuePostRenderEffect(() => {
  7237. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7238. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7239. }, parentSuspense);
  7240. }
  7241. };
  7242. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7243. for (let i = 0; i < newChildren.length; i++) {
  7244. const oldVNode = oldChildren[i];
  7245. const newVNode = newChildren[i];
  7246. const container = (
  7247. // oldVNode may be an errored async setup() component inside Suspense
  7248. // which will not have a mounted element
  7249. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7250. // of the Fragment itself so it can move its children.
  7251. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7252. // which also requires the correct parent container
  7253. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7254. oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
  7255. // In other cases, the parent container is not actually used so we
  7256. // just pass the block element here to avoid a DOM parentNode call.
  7257. fallbackContainer
  7258. )
  7259. );
  7260. patch(
  7261. oldVNode,
  7262. newVNode,
  7263. container,
  7264. null,
  7265. parentComponent,
  7266. parentSuspense,
  7267. namespace,
  7268. slotScopeIds,
  7269. true
  7270. );
  7271. }
  7272. };
  7273. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  7274. if (oldProps !== newProps) {
  7275. if (oldProps !== EMPTY_OBJ) {
  7276. for (const key in oldProps) {
  7277. if (!isReservedProp(key) && !(key in newProps)) {
  7278. hostPatchProp(
  7279. el,
  7280. key,
  7281. oldProps[key],
  7282. null,
  7283. namespace,
  7284. parentComponent
  7285. );
  7286. }
  7287. }
  7288. }
  7289. for (const key in newProps) {
  7290. if (isReservedProp(key)) continue;
  7291. const next = newProps[key];
  7292. const prev = oldProps[key];
  7293. if (next !== prev && key !== "value") {
  7294. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7295. }
  7296. }
  7297. if ("value" in newProps) {
  7298. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7299. }
  7300. }
  7301. };
  7302. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7303. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7304. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7305. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7306. if (
  7307. // #5523 dev root fragment may inherit directives
  7308. isHmrUpdating || patchFlag & 2048
  7309. ) {
  7310. patchFlag = 0;
  7311. optimized = false;
  7312. dynamicChildren = null;
  7313. }
  7314. if (fragmentSlotScopeIds) {
  7315. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7316. }
  7317. if (n1 == null) {
  7318. hostInsert(fragmentStartAnchor, container, anchor);
  7319. hostInsert(fragmentEndAnchor, container, anchor);
  7320. mountChildren(
  7321. // #10007
  7322. // such fragment like `<></>` will be compiled into
  7323. // a fragment which doesn't have a children.
  7324. // In this case fallback to an empty array
  7325. n2.children || [],
  7326. container,
  7327. fragmentEndAnchor,
  7328. parentComponent,
  7329. parentSuspense,
  7330. namespace,
  7331. slotScopeIds,
  7332. optimized
  7333. );
  7334. } else {
  7335. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7336. // of renderSlot() with no valid children
  7337. n1.dynamicChildren) {
  7338. patchBlockChildren(
  7339. n1.dynamicChildren,
  7340. dynamicChildren,
  7341. container,
  7342. parentComponent,
  7343. parentSuspense,
  7344. namespace,
  7345. slotScopeIds
  7346. );
  7347. {
  7348. traverseStaticChildren(n1, n2);
  7349. }
  7350. } else {
  7351. patchChildren(
  7352. n1,
  7353. n2,
  7354. container,
  7355. fragmentEndAnchor,
  7356. parentComponent,
  7357. parentSuspense,
  7358. namespace,
  7359. slotScopeIds,
  7360. optimized
  7361. );
  7362. }
  7363. }
  7364. };
  7365. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7366. n2.slotScopeIds = slotScopeIds;
  7367. if (n1 == null) {
  7368. if (n2.shapeFlag & 512) {
  7369. parentComponent.ctx.activate(
  7370. n2,
  7371. container,
  7372. anchor,
  7373. namespace,
  7374. optimized
  7375. );
  7376. } else {
  7377. mountComponent(
  7378. n2,
  7379. container,
  7380. anchor,
  7381. parentComponent,
  7382. parentSuspense,
  7383. namespace,
  7384. optimized
  7385. );
  7386. }
  7387. } else {
  7388. updateComponent(n1, n2, optimized);
  7389. }
  7390. };
  7391. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7392. const instance = (initialVNode.component = createComponentInstance(
  7393. initialVNode,
  7394. parentComponent,
  7395. parentSuspense
  7396. ));
  7397. if (instance.type.__hmrId) {
  7398. registerHMR(instance);
  7399. }
  7400. {
  7401. pushWarningContext(initialVNode);
  7402. startMeasure(instance, `mount`);
  7403. }
  7404. if (isKeepAlive(initialVNode)) {
  7405. instance.ctx.renderer = internals;
  7406. }
  7407. {
  7408. {
  7409. startMeasure(instance, `init`);
  7410. }
  7411. setupComponent(instance, false, optimized);
  7412. {
  7413. endMeasure(instance, `init`);
  7414. }
  7415. }
  7416. if (isHmrUpdating) initialVNode.el = null;
  7417. if (instance.asyncDep) {
  7418. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  7419. if (!initialVNode.el) {
  7420. const placeholder = instance.subTree = createVNode(Comment);
  7421. processCommentNode(null, placeholder, container, anchor);
  7422. initialVNode.placeholder = placeholder.el;
  7423. }
  7424. } else {
  7425. setupRenderEffect(
  7426. instance,
  7427. initialVNode,
  7428. container,
  7429. anchor,
  7430. parentSuspense,
  7431. namespace,
  7432. optimized
  7433. );
  7434. }
  7435. {
  7436. popWarningContext();
  7437. endMeasure(instance, `mount`);
  7438. }
  7439. };
  7440. const updateComponent = (n1, n2, optimized) => {
  7441. const instance = n2.component = n1.component;
  7442. if (shouldUpdateComponent(n1, n2, optimized)) {
  7443. if (instance.asyncDep && !instance.asyncResolved) {
  7444. {
  7445. pushWarningContext(n2);
  7446. }
  7447. updateComponentPreRender(instance, n2, optimized);
  7448. {
  7449. popWarningContext();
  7450. }
  7451. return;
  7452. } else {
  7453. instance.next = n2;
  7454. instance.update();
  7455. }
  7456. } else {
  7457. n2.el = n1.el;
  7458. instance.vnode = n2;
  7459. }
  7460. };
  7461. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7462. const componentUpdateFn = () => {
  7463. if (!instance.isMounted) {
  7464. let vnodeHook;
  7465. const { el, props } = initialVNode;
  7466. const { bm, m, parent, root, type } = instance;
  7467. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7468. toggleRecurse(instance, false);
  7469. if (bm) {
  7470. invokeArrayFns(bm);
  7471. }
  7472. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7473. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7474. }
  7475. toggleRecurse(instance, true);
  7476. if (el && hydrateNode) {
  7477. const hydrateSubTree = () => {
  7478. {
  7479. startMeasure(instance, `render`);
  7480. }
  7481. instance.subTree = renderComponentRoot(instance);
  7482. {
  7483. endMeasure(instance, `render`);
  7484. }
  7485. {
  7486. startMeasure(instance, `hydrate`);
  7487. }
  7488. hydrateNode(
  7489. el,
  7490. instance.subTree,
  7491. instance,
  7492. parentSuspense,
  7493. null
  7494. );
  7495. {
  7496. endMeasure(instance, `hydrate`);
  7497. }
  7498. };
  7499. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  7500. type.__asyncHydrate(
  7501. el,
  7502. instance,
  7503. hydrateSubTree
  7504. );
  7505. } else {
  7506. hydrateSubTree();
  7507. }
  7508. } else {
  7509. if (root.ce && // @ts-expect-error _def is private
  7510. root.ce._def.shadowRoot !== false) {
  7511. root.ce._injectChildStyle(type);
  7512. }
  7513. {
  7514. startMeasure(instance, `render`);
  7515. }
  7516. const subTree = instance.subTree = renderComponentRoot(instance);
  7517. {
  7518. endMeasure(instance, `render`);
  7519. }
  7520. {
  7521. startMeasure(instance, `patch`);
  7522. }
  7523. patch(
  7524. null,
  7525. subTree,
  7526. container,
  7527. anchor,
  7528. instance,
  7529. parentSuspense,
  7530. namespace
  7531. );
  7532. {
  7533. endMeasure(instance, `patch`);
  7534. }
  7535. initialVNode.el = subTree.el;
  7536. }
  7537. if (m) {
  7538. queuePostRenderEffect(m, parentSuspense);
  7539. }
  7540. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7541. const scopedInitialVNode = initialVNode;
  7542. queuePostRenderEffect(
  7543. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7544. parentSuspense
  7545. );
  7546. }
  7547. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7548. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7549. }
  7550. instance.isMounted = true;
  7551. {
  7552. devtoolsComponentAdded(instance);
  7553. }
  7554. initialVNode = container = anchor = null;
  7555. } else {
  7556. let { next, bu, u, parent, vnode } = instance;
  7557. {
  7558. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7559. if (nonHydratedAsyncRoot) {
  7560. if (next) {
  7561. next.el = vnode.el;
  7562. updateComponentPreRender(instance, next, optimized);
  7563. }
  7564. nonHydratedAsyncRoot.asyncDep.then(() => {
  7565. if (!instance.isUnmounted) {
  7566. componentUpdateFn();
  7567. }
  7568. });
  7569. return;
  7570. }
  7571. }
  7572. let originNext = next;
  7573. let vnodeHook;
  7574. {
  7575. pushWarningContext(next || instance.vnode);
  7576. }
  7577. toggleRecurse(instance, false);
  7578. if (next) {
  7579. next.el = vnode.el;
  7580. updateComponentPreRender(instance, next, optimized);
  7581. } else {
  7582. next = vnode;
  7583. }
  7584. if (bu) {
  7585. invokeArrayFns(bu);
  7586. }
  7587. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7588. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7589. }
  7590. toggleRecurse(instance, true);
  7591. {
  7592. startMeasure(instance, `render`);
  7593. }
  7594. const nextTree = renderComponentRoot(instance);
  7595. {
  7596. endMeasure(instance, `render`);
  7597. }
  7598. const prevTree = instance.subTree;
  7599. instance.subTree = nextTree;
  7600. {
  7601. startMeasure(instance, `patch`);
  7602. }
  7603. patch(
  7604. prevTree,
  7605. nextTree,
  7606. // parent may have changed if it's in a teleport
  7607. hostParentNode(prevTree.el),
  7608. // anchor may have changed if it's in a fragment
  7609. getNextHostNode(prevTree),
  7610. instance,
  7611. parentSuspense,
  7612. namespace
  7613. );
  7614. {
  7615. endMeasure(instance, `patch`);
  7616. }
  7617. next.el = nextTree.el;
  7618. if (originNext === null) {
  7619. updateHOCHostEl(instance, nextTree.el);
  7620. }
  7621. if (u) {
  7622. queuePostRenderEffect(u, parentSuspense);
  7623. }
  7624. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7625. queuePostRenderEffect(
  7626. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7627. parentSuspense
  7628. );
  7629. }
  7630. {
  7631. devtoolsComponentUpdated(instance);
  7632. }
  7633. {
  7634. popWarningContext();
  7635. }
  7636. }
  7637. };
  7638. instance.scope.on();
  7639. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  7640. instance.scope.off();
  7641. const update = instance.update = effect.run.bind(effect);
  7642. const job = instance.job = effect.runIfDirty.bind(effect);
  7643. job.i = instance;
  7644. job.id = instance.uid;
  7645. effect.scheduler = () => queueJob(job);
  7646. toggleRecurse(instance, true);
  7647. {
  7648. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7649. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7650. }
  7651. update();
  7652. };
  7653. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7654. nextVNode.component = instance;
  7655. const prevProps = instance.vnode.props;
  7656. instance.vnode = nextVNode;
  7657. instance.next = null;
  7658. updateProps(instance, nextVNode.props, prevProps, optimized);
  7659. updateSlots(instance, nextVNode.children, optimized);
  7660. pauseTracking();
  7661. flushPreFlushCbs(instance);
  7662. resetTracking();
  7663. };
  7664. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7665. const c1 = n1 && n1.children;
  7666. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7667. const c2 = n2.children;
  7668. const { patchFlag, shapeFlag } = n2;
  7669. if (patchFlag > 0) {
  7670. if (patchFlag & 128) {
  7671. patchKeyedChildren(
  7672. c1,
  7673. c2,
  7674. container,
  7675. anchor,
  7676. parentComponent,
  7677. parentSuspense,
  7678. namespace,
  7679. slotScopeIds,
  7680. optimized
  7681. );
  7682. return;
  7683. } else if (patchFlag & 256) {
  7684. patchUnkeyedChildren(
  7685. c1,
  7686. c2,
  7687. container,
  7688. anchor,
  7689. parentComponent,
  7690. parentSuspense,
  7691. namespace,
  7692. slotScopeIds,
  7693. optimized
  7694. );
  7695. return;
  7696. }
  7697. }
  7698. if (shapeFlag & 8) {
  7699. if (prevShapeFlag & 16) {
  7700. unmountChildren(c1, parentComponent, parentSuspense);
  7701. }
  7702. if (c2 !== c1) {
  7703. hostSetElementText(container, c2);
  7704. }
  7705. } else {
  7706. if (prevShapeFlag & 16) {
  7707. if (shapeFlag & 16) {
  7708. patchKeyedChildren(
  7709. c1,
  7710. c2,
  7711. container,
  7712. anchor,
  7713. parentComponent,
  7714. parentSuspense,
  7715. namespace,
  7716. slotScopeIds,
  7717. optimized
  7718. );
  7719. } else {
  7720. unmountChildren(c1, parentComponent, parentSuspense, true);
  7721. }
  7722. } else {
  7723. if (prevShapeFlag & 8) {
  7724. hostSetElementText(container, "");
  7725. }
  7726. if (shapeFlag & 16) {
  7727. mountChildren(
  7728. c2,
  7729. container,
  7730. anchor,
  7731. parentComponent,
  7732. parentSuspense,
  7733. namespace,
  7734. slotScopeIds,
  7735. optimized
  7736. );
  7737. }
  7738. }
  7739. }
  7740. };
  7741. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7742. c1 = c1 || EMPTY_ARR;
  7743. c2 = c2 || EMPTY_ARR;
  7744. const oldLength = c1.length;
  7745. const newLength = c2.length;
  7746. const commonLength = Math.min(oldLength, newLength);
  7747. let i;
  7748. for (i = 0; i < commonLength; i++) {
  7749. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7750. patch(
  7751. c1[i],
  7752. nextChild,
  7753. container,
  7754. null,
  7755. parentComponent,
  7756. parentSuspense,
  7757. namespace,
  7758. slotScopeIds,
  7759. optimized
  7760. );
  7761. }
  7762. if (oldLength > newLength) {
  7763. unmountChildren(
  7764. c1,
  7765. parentComponent,
  7766. parentSuspense,
  7767. true,
  7768. false,
  7769. commonLength
  7770. );
  7771. } else {
  7772. mountChildren(
  7773. c2,
  7774. container,
  7775. anchor,
  7776. parentComponent,
  7777. parentSuspense,
  7778. namespace,
  7779. slotScopeIds,
  7780. optimized,
  7781. commonLength
  7782. );
  7783. }
  7784. };
  7785. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7786. let i = 0;
  7787. const l2 = c2.length;
  7788. let e1 = c1.length - 1;
  7789. let e2 = l2 - 1;
  7790. while (i <= e1 && i <= e2) {
  7791. const n1 = c1[i];
  7792. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7793. if (isSameVNodeType(n1, n2)) {
  7794. patch(
  7795. n1,
  7796. n2,
  7797. container,
  7798. null,
  7799. parentComponent,
  7800. parentSuspense,
  7801. namespace,
  7802. slotScopeIds,
  7803. optimized
  7804. );
  7805. } else {
  7806. break;
  7807. }
  7808. i++;
  7809. }
  7810. while (i <= e1 && i <= e2) {
  7811. const n1 = c1[e1];
  7812. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7813. if (isSameVNodeType(n1, n2)) {
  7814. patch(
  7815. n1,
  7816. n2,
  7817. container,
  7818. null,
  7819. parentComponent,
  7820. parentSuspense,
  7821. namespace,
  7822. slotScopeIds,
  7823. optimized
  7824. );
  7825. } else {
  7826. break;
  7827. }
  7828. e1--;
  7829. e2--;
  7830. }
  7831. if (i > e1) {
  7832. if (i <= e2) {
  7833. const nextPos = e2 + 1;
  7834. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7835. while (i <= e2) {
  7836. patch(
  7837. null,
  7838. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7839. container,
  7840. anchor,
  7841. parentComponent,
  7842. parentSuspense,
  7843. namespace,
  7844. slotScopeIds,
  7845. optimized
  7846. );
  7847. i++;
  7848. }
  7849. }
  7850. } else if (i > e2) {
  7851. while (i <= e1) {
  7852. unmount(c1[i], parentComponent, parentSuspense, true);
  7853. i++;
  7854. }
  7855. } else {
  7856. const s1 = i;
  7857. const s2 = i;
  7858. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7859. for (i = s2; i <= e2; i++) {
  7860. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7861. if (nextChild.key != null) {
  7862. if (keyToNewIndexMap.has(nextChild.key)) {
  7863. warn$1(
  7864. `Duplicate keys found during update:`,
  7865. JSON.stringify(nextChild.key),
  7866. `Make sure keys are unique.`
  7867. );
  7868. }
  7869. keyToNewIndexMap.set(nextChild.key, i);
  7870. }
  7871. }
  7872. let j;
  7873. let patched = 0;
  7874. const toBePatched = e2 - s2 + 1;
  7875. let moved = false;
  7876. let maxNewIndexSoFar = 0;
  7877. const newIndexToOldIndexMap = new Array(toBePatched);
  7878. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  7879. for (i = s1; i <= e1; i++) {
  7880. const prevChild = c1[i];
  7881. if (patched >= toBePatched) {
  7882. unmount(prevChild, parentComponent, parentSuspense, true);
  7883. continue;
  7884. }
  7885. let newIndex;
  7886. if (prevChild.key != null) {
  7887. newIndex = keyToNewIndexMap.get(prevChild.key);
  7888. } else {
  7889. for (j = s2; j <= e2; j++) {
  7890. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7891. newIndex = j;
  7892. break;
  7893. }
  7894. }
  7895. }
  7896. if (newIndex === void 0) {
  7897. unmount(prevChild, parentComponent, parentSuspense, true);
  7898. } else {
  7899. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7900. if (newIndex >= maxNewIndexSoFar) {
  7901. maxNewIndexSoFar = newIndex;
  7902. } else {
  7903. moved = true;
  7904. }
  7905. patch(
  7906. prevChild,
  7907. c2[newIndex],
  7908. container,
  7909. null,
  7910. parentComponent,
  7911. parentSuspense,
  7912. namespace,
  7913. slotScopeIds,
  7914. optimized
  7915. );
  7916. patched++;
  7917. }
  7918. }
  7919. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7920. j = increasingNewIndexSequence.length - 1;
  7921. for (i = toBePatched - 1; i >= 0; i--) {
  7922. const nextIndex = s2 + i;
  7923. const nextChild = c2[nextIndex];
  7924. const anchorVNode = c2[nextIndex + 1];
  7925. const anchor = nextIndex + 1 < l2 ? (
  7926. // #13559, fallback to el placeholder for unresolved async component
  7927. anchorVNode.el || anchorVNode.placeholder
  7928. ) : parentAnchor;
  7929. if (newIndexToOldIndexMap[i] === 0) {
  7930. patch(
  7931. null,
  7932. nextChild,
  7933. container,
  7934. anchor,
  7935. parentComponent,
  7936. parentSuspense,
  7937. namespace,
  7938. slotScopeIds,
  7939. optimized
  7940. );
  7941. } else if (moved) {
  7942. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7943. move(nextChild, container, anchor, 2);
  7944. } else {
  7945. j--;
  7946. }
  7947. }
  7948. }
  7949. }
  7950. };
  7951. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7952. const { el, type, transition, children, shapeFlag } = vnode;
  7953. if (shapeFlag & 6) {
  7954. move(vnode.component.subTree, container, anchor, moveType);
  7955. return;
  7956. }
  7957. if (shapeFlag & 128) {
  7958. vnode.suspense.move(container, anchor, moveType);
  7959. return;
  7960. }
  7961. if (shapeFlag & 64) {
  7962. type.move(vnode, container, anchor, internals);
  7963. return;
  7964. }
  7965. if (type === Fragment) {
  7966. hostInsert(el, container, anchor);
  7967. for (let i = 0; i < children.length; i++) {
  7968. move(children[i], container, anchor, moveType);
  7969. }
  7970. hostInsert(vnode.anchor, container, anchor);
  7971. return;
  7972. }
  7973. if (type === Static) {
  7974. moveStaticNode(vnode, container, anchor);
  7975. return;
  7976. }
  7977. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7978. if (needTransition2) {
  7979. if (moveType === 0) {
  7980. transition.beforeEnter(el);
  7981. hostInsert(el, container, anchor);
  7982. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7983. } else {
  7984. const { leave, delayLeave, afterLeave } = transition;
  7985. const remove2 = () => {
  7986. if (vnode.ctx.isUnmounted) {
  7987. hostRemove(el);
  7988. } else {
  7989. hostInsert(el, container, anchor);
  7990. }
  7991. };
  7992. const performLeave = () => {
  7993. if (el._isLeaving) {
  7994. el[leaveCbKey](
  7995. true
  7996. /* cancelled */
  7997. );
  7998. }
  7999. leave(el, () => {
  8000. remove2();
  8001. afterLeave && afterLeave();
  8002. });
  8003. };
  8004. if (delayLeave) {
  8005. delayLeave(el, remove2, performLeave);
  8006. } else {
  8007. performLeave();
  8008. }
  8009. }
  8010. } else {
  8011. hostInsert(el, container, anchor);
  8012. }
  8013. };
  8014. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  8015. const {
  8016. type,
  8017. props,
  8018. ref,
  8019. children,
  8020. dynamicChildren,
  8021. shapeFlag,
  8022. patchFlag,
  8023. dirs,
  8024. cacheIndex
  8025. } = vnode;
  8026. if (patchFlag === -2) {
  8027. optimized = false;
  8028. }
  8029. if (ref != null) {
  8030. pauseTracking();
  8031. setRef(ref, null, parentSuspense, vnode, true);
  8032. resetTracking();
  8033. }
  8034. if (cacheIndex != null) {
  8035. parentComponent.renderCache[cacheIndex] = void 0;
  8036. }
  8037. if (shapeFlag & 256) {
  8038. parentComponent.ctx.deactivate(vnode);
  8039. return;
  8040. }
  8041. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  8042. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  8043. let vnodeHook;
  8044. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  8045. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8046. }
  8047. if (shapeFlag & 6) {
  8048. unmountComponent(vnode.component, parentSuspense, doRemove);
  8049. } else {
  8050. if (shapeFlag & 128) {
  8051. vnode.suspense.unmount(parentSuspense, doRemove);
  8052. return;
  8053. }
  8054. if (shouldInvokeDirs) {
  8055. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  8056. }
  8057. if (shapeFlag & 64) {
  8058. vnode.type.remove(
  8059. vnode,
  8060. parentComponent,
  8061. parentSuspense,
  8062. internals,
  8063. doRemove
  8064. );
  8065. } else if (dynamicChildren && // #5154
  8066. // when v-once is used inside a block, setBlockTracking(-1) marks the
  8067. // parent block with hasOnce: true
  8068. // so that it doesn't take the fast path during unmount - otherwise
  8069. // components nested in v-once are never unmounted.
  8070. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  8071. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  8072. unmountChildren(
  8073. dynamicChildren,
  8074. parentComponent,
  8075. parentSuspense,
  8076. false,
  8077. true
  8078. );
  8079. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  8080. unmountChildren(children, parentComponent, parentSuspense);
  8081. }
  8082. if (doRemove) {
  8083. remove(vnode);
  8084. }
  8085. }
  8086. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  8087. queuePostRenderEffect(() => {
  8088. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8089. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  8090. }, parentSuspense);
  8091. }
  8092. };
  8093. const remove = (vnode) => {
  8094. const { type, el, anchor, transition } = vnode;
  8095. if (type === Fragment) {
  8096. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  8097. vnode.children.forEach((child) => {
  8098. if (child.type === Comment) {
  8099. hostRemove(child.el);
  8100. } else {
  8101. remove(child);
  8102. }
  8103. });
  8104. } else {
  8105. removeFragment(el, anchor);
  8106. }
  8107. return;
  8108. }
  8109. if (type === Static) {
  8110. removeStaticNode(vnode);
  8111. return;
  8112. }
  8113. const performRemove = () => {
  8114. hostRemove(el);
  8115. if (transition && !transition.persisted && transition.afterLeave) {
  8116. transition.afterLeave();
  8117. }
  8118. };
  8119. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  8120. const { leave, delayLeave } = transition;
  8121. const performLeave = () => leave(el, performRemove);
  8122. if (delayLeave) {
  8123. delayLeave(vnode.el, performRemove, performLeave);
  8124. } else {
  8125. performLeave();
  8126. }
  8127. } else {
  8128. performRemove();
  8129. }
  8130. };
  8131. const removeFragment = (cur, end) => {
  8132. let next;
  8133. while (cur !== end) {
  8134. next = hostNextSibling(cur);
  8135. hostRemove(cur);
  8136. cur = next;
  8137. }
  8138. hostRemove(end);
  8139. };
  8140. const unmountComponent = (instance, parentSuspense, doRemove) => {
  8141. if (instance.type.__hmrId) {
  8142. unregisterHMR(instance);
  8143. }
  8144. const { bum, scope, job, subTree, um, m, a } = instance;
  8145. invalidateMount(m);
  8146. invalidateMount(a);
  8147. if (bum) {
  8148. invokeArrayFns(bum);
  8149. }
  8150. scope.stop();
  8151. if (job) {
  8152. job.flags |= 8;
  8153. unmount(subTree, instance, parentSuspense, doRemove);
  8154. }
  8155. if (um) {
  8156. queuePostRenderEffect(um, parentSuspense);
  8157. }
  8158. queuePostRenderEffect(() => {
  8159. instance.isUnmounted = true;
  8160. }, parentSuspense);
  8161. {
  8162. devtoolsComponentRemoved(instance);
  8163. }
  8164. };
  8165. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8166. for (let i = start; i < children.length; i++) {
  8167. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8168. }
  8169. };
  8170. const getNextHostNode = (vnode) => {
  8171. if (vnode.shapeFlag & 6) {
  8172. return getNextHostNode(vnode.component.subTree);
  8173. }
  8174. if (vnode.shapeFlag & 128) {
  8175. return vnode.suspense.next();
  8176. }
  8177. const el = hostNextSibling(vnode.anchor || vnode.el);
  8178. const teleportEnd = el && el[TeleportEndKey];
  8179. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8180. };
  8181. let isFlushing = false;
  8182. const render = (vnode, container, namespace) => {
  8183. if (vnode == null) {
  8184. if (container._vnode) {
  8185. unmount(container._vnode, null, null, true);
  8186. }
  8187. } else {
  8188. patch(
  8189. container._vnode || null,
  8190. vnode,
  8191. container,
  8192. null,
  8193. null,
  8194. null,
  8195. namespace
  8196. );
  8197. }
  8198. container._vnode = vnode;
  8199. if (!isFlushing) {
  8200. isFlushing = true;
  8201. flushPreFlushCbs();
  8202. flushPostFlushCbs();
  8203. isFlushing = false;
  8204. }
  8205. };
  8206. const internals = {
  8207. p: patch,
  8208. um: unmount,
  8209. m: move,
  8210. r: remove,
  8211. mt: mountComponent,
  8212. mc: mountChildren,
  8213. pc: patchChildren,
  8214. pbc: patchBlockChildren,
  8215. n: getNextHostNode,
  8216. o: options
  8217. };
  8218. let hydrate;
  8219. let hydrateNode;
  8220. if (createHydrationFns) {
  8221. [hydrate, hydrateNode] = createHydrationFns(
  8222. internals
  8223. );
  8224. }
  8225. return {
  8226. render,
  8227. hydrate,
  8228. createApp: createAppAPI(render, hydrate)
  8229. };
  8230. }
  8231. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8232. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8233. }
  8234. function toggleRecurse({ effect, job }, allowed) {
  8235. if (allowed) {
  8236. effect.flags |= 32;
  8237. job.flags |= 4;
  8238. } else {
  8239. effect.flags &= -33;
  8240. job.flags &= -5;
  8241. }
  8242. }
  8243. function needTransition(parentSuspense, transition) {
  8244. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8245. }
  8246. function traverseStaticChildren(n1, n2, shallow = false) {
  8247. const ch1 = n1.children;
  8248. const ch2 = n2.children;
  8249. if (isArray(ch1) && isArray(ch2)) {
  8250. for (let i = 0; i < ch1.length; i++) {
  8251. const c1 = ch1[i];
  8252. let c2 = ch2[i];
  8253. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8254. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8255. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8256. c2.el = c1.el;
  8257. }
  8258. if (!shallow && c2.patchFlag !== -2)
  8259. traverseStaticChildren(c1, c2);
  8260. }
  8261. if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
  8262. c2.patchFlag !== -1) {
  8263. c2.el = c1.el;
  8264. }
  8265. if (c2.type === Comment && !c2.el) {
  8266. c2.el = c1.el;
  8267. }
  8268. {
  8269. c2.el && (c2.el.__vnode = c2);
  8270. }
  8271. }
  8272. }
  8273. }
  8274. function getSequence(arr) {
  8275. const p = arr.slice();
  8276. const result = [0];
  8277. let i, j, u, v, c;
  8278. const len = arr.length;
  8279. for (i = 0; i < len; i++) {
  8280. const arrI = arr[i];
  8281. if (arrI !== 0) {
  8282. j = result[result.length - 1];
  8283. if (arr[j] < arrI) {
  8284. p[i] = j;
  8285. result.push(i);
  8286. continue;
  8287. }
  8288. u = 0;
  8289. v = result.length - 1;
  8290. while (u < v) {
  8291. c = u + v >> 1;
  8292. if (arr[result[c]] < arrI) {
  8293. u = c + 1;
  8294. } else {
  8295. v = c;
  8296. }
  8297. }
  8298. if (arrI < arr[result[u]]) {
  8299. if (u > 0) {
  8300. p[i] = result[u - 1];
  8301. }
  8302. result[u] = i;
  8303. }
  8304. }
  8305. }
  8306. u = result.length;
  8307. v = result[u - 1];
  8308. while (u-- > 0) {
  8309. result[u] = v;
  8310. v = p[v];
  8311. }
  8312. return result;
  8313. }
  8314. function locateNonHydratedAsyncRoot(instance) {
  8315. const subComponent = instance.subTree.component;
  8316. if (subComponent) {
  8317. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8318. return subComponent;
  8319. } else {
  8320. return locateNonHydratedAsyncRoot(subComponent);
  8321. }
  8322. }
  8323. }
  8324. function invalidateMount(hooks) {
  8325. if (hooks) {
  8326. for (let i = 0; i < hooks.length; i++)
  8327. hooks[i].flags |= 8;
  8328. }
  8329. }
  8330. const ssrContextKey = Symbol.for("v-scx");
  8331. const useSSRContext = () => {
  8332. {
  8333. warn$1(`useSSRContext() is not supported in the global build.`);
  8334. }
  8335. };
  8336. function watchEffect(effect, options) {
  8337. return doWatch(effect, null, options);
  8338. }
  8339. function watchPostEffect(effect, options) {
  8340. return doWatch(
  8341. effect,
  8342. null,
  8343. extend({}, options, { flush: "post" })
  8344. );
  8345. }
  8346. function watchSyncEffect(effect, options) {
  8347. return doWatch(
  8348. effect,
  8349. null,
  8350. extend({}, options, { flush: "sync" })
  8351. );
  8352. }
  8353. function watch(source, cb, options) {
  8354. if (!isFunction(cb)) {
  8355. warn$1(
  8356. `\`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.`
  8357. );
  8358. }
  8359. return doWatch(source, cb, options);
  8360. }
  8361. function doWatch(source, cb, options = EMPTY_OBJ) {
  8362. const { immediate, deep, flush, once } = options;
  8363. if (!cb) {
  8364. if (immediate !== void 0) {
  8365. warn$1(
  8366. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  8367. );
  8368. }
  8369. if (deep !== void 0) {
  8370. warn$1(
  8371. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  8372. );
  8373. }
  8374. if (once !== void 0) {
  8375. warn$1(
  8376. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  8377. );
  8378. }
  8379. }
  8380. const baseWatchOptions = extend({}, options);
  8381. baseWatchOptions.onWarn = warn$1;
  8382. const instance = currentInstance;
  8383. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  8384. let isPre = false;
  8385. if (flush === "post") {
  8386. baseWatchOptions.scheduler = (job) => {
  8387. queuePostRenderEffect(job, instance && instance.suspense);
  8388. };
  8389. } else if (flush !== "sync") {
  8390. isPre = true;
  8391. baseWatchOptions.scheduler = (job, isFirstRun) => {
  8392. if (isFirstRun) {
  8393. job();
  8394. } else {
  8395. queueJob(job);
  8396. }
  8397. };
  8398. }
  8399. baseWatchOptions.augmentJob = (job) => {
  8400. if (cb) {
  8401. job.flags |= 4;
  8402. }
  8403. if (isPre) {
  8404. job.flags |= 2;
  8405. if (instance) {
  8406. job.id = instance.uid;
  8407. job.i = instance;
  8408. }
  8409. }
  8410. };
  8411. const watchHandle = watch$1(source, cb, baseWatchOptions);
  8412. return watchHandle;
  8413. }
  8414. function instanceWatch(source, value, options) {
  8415. const publicThis = this.proxy;
  8416. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  8417. let cb;
  8418. if (isFunction(value)) {
  8419. cb = value;
  8420. } else {
  8421. cb = value.handler;
  8422. options = value;
  8423. }
  8424. const reset = setCurrentInstance(this);
  8425. const res = doWatch(getter, cb.bind(publicThis), options);
  8426. reset();
  8427. return res;
  8428. }
  8429. function createPathGetter(ctx, path) {
  8430. const segments = path.split(".");
  8431. return () => {
  8432. let cur = ctx;
  8433. for (let i = 0; i < segments.length && cur; i++) {
  8434. cur = cur[segments[i]];
  8435. }
  8436. return cur;
  8437. };
  8438. }
  8439. function useModel(props, name, options = EMPTY_OBJ) {
  8440. const i = getCurrentInstance();
  8441. if (!i) {
  8442. warn$1(`useModel() called without active instance.`);
  8443. return ref();
  8444. }
  8445. const camelizedName = camelize(name);
  8446. if (!i.propsOptions[0][camelizedName]) {
  8447. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  8448. return ref();
  8449. }
  8450. const hyphenatedName = hyphenate(name);
  8451. const modifiers = getModelModifiers(props, camelizedName);
  8452. const res = customRef((track, trigger) => {
  8453. let localValue;
  8454. let prevSetValue = EMPTY_OBJ;
  8455. let prevEmittedValue;
  8456. watchSyncEffect(() => {
  8457. const propValue = props[camelizedName];
  8458. if (hasChanged(localValue, propValue)) {
  8459. localValue = propValue;
  8460. trigger();
  8461. }
  8462. });
  8463. return {
  8464. get() {
  8465. track();
  8466. return options.get ? options.get(localValue) : localValue;
  8467. },
  8468. set(value) {
  8469. const emittedValue = options.set ? options.set(value) : value;
  8470. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  8471. return;
  8472. }
  8473. const rawProps = i.vnode.props;
  8474. if (!(rawProps && // check if parent has passed v-model
  8475. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  8476. localValue = value;
  8477. trigger();
  8478. }
  8479. i.emit(`update:${name}`, emittedValue);
  8480. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  8481. trigger();
  8482. }
  8483. prevSetValue = value;
  8484. prevEmittedValue = emittedValue;
  8485. }
  8486. };
  8487. });
  8488. res[Symbol.iterator] = () => {
  8489. let i2 = 0;
  8490. return {
  8491. next() {
  8492. if (i2 < 2) {
  8493. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  8494. } else {
  8495. return { done: true };
  8496. }
  8497. }
  8498. };
  8499. };
  8500. return res;
  8501. }
  8502. const getModelModifiers = (props, modelName) => {
  8503. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  8504. };
  8505. function emit(instance, event, ...rawArgs) {
  8506. if (instance.isUnmounted) return;
  8507. const props = instance.vnode.props || EMPTY_OBJ;
  8508. {
  8509. const {
  8510. emitsOptions,
  8511. propsOptions: [propsOptions]
  8512. } = instance;
  8513. if (emitsOptions) {
  8514. if (!(event in emitsOptions) && true) {
  8515. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  8516. warn$1(
  8517. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  8518. );
  8519. }
  8520. } else {
  8521. const validator = emitsOptions[event];
  8522. if (isFunction(validator)) {
  8523. const isValid = validator(...rawArgs);
  8524. if (!isValid) {
  8525. warn$1(
  8526. `Invalid event arguments: event validation failed for event "${event}".`
  8527. );
  8528. }
  8529. }
  8530. }
  8531. }
  8532. }
  8533. let args = rawArgs;
  8534. const isModelListener = event.startsWith("update:");
  8535. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  8536. if (modifiers) {
  8537. if (modifiers.trim) {
  8538. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  8539. }
  8540. if (modifiers.number) {
  8541. args = rawArgs.map(looseToNumber);
  8542. }
  8543. }
  8544. {
  8545. devtoolsComponentEmit(instance, event, args);
  8546. }
  8547. {
  8548. const lowerCaseEvent = event.toLowerCase();
  8549. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  8550. warn$1(
  8551. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  8552. instance,
  8553. instance.type
  8554. )} 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(
  8555. event
  8556. )}" instead of "${event}".`
  8557. );
  8558. }
  8559. }
  8560. let handlerName;
  8561. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  8562. props[handlerName = toHandlerKey(camelize(event))];
  8563. if (!handler && isModelListener) {
  8564. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  8565. }
  8566. if (handler) {
  8567. callWithAsyncErrorHandling(
  8568. handler,
  8569. instance,
  8570. 6,
  8571. args
  8572. );
  8573. }
  8574. const onceHandler = props[handlerName + `Once`];
  8575. if (onceHandler) {
  8576. if (!instance.emitted) {
  8577. instance.emitted = {};
  8578. } else if (instance.emitted[handlerName]) {
  8579. return;
  8580. }
  8581. instance.emitted[handlerName] = true;
  8582. callWithAsyncErrorHandling(
  8583. onceHandler,
  8584. instance,
  8585. 6,
  8586. args
  8587. );
  8588. }
  8589. }
  8590. const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
  8591. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  8592. const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
  8593. const cached = cache.get(comp);
  8594. if (cached !== void 0) {
  8595. return cached;
  8596. }
  8597. const raw = comp.emits;
  8598. let normalized = {};
  8599. let hasExtends = false;
  8600. if (!isFunction(comp)) {
  8601. const extendEmits = (raw2) => {
  8602. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  8603. if (normalizedFromExtend) {
  8604. hasExtends = true;
  8605. extend(normalized, normalizedFromExtend);
  8606. }
  8607. };
  8608. if (!asMixin && appContext.mixins.length) {
  8609. appContext.mixins.forEach(extendEmits);
  8610. }
  8611. if (comp.extends) {
  8612. extendEmits(comp.extends);
  8613. }
  8614. if (comp.mixins) {
  8615. comp.mixins.forEach(extendEmits);
  8616. }
  8617. }
  8618. if (!raw && !hasExtends) {
  8619. if (isObject(comp)) {
  8620. cache.set(comp, null);
  8621. }
  8622. return null;
  8623. }
  8624. if (isArray(raw)) {
  8625. raw.forEach((key) => normalized[key] = null);
  8626. } else {
  8627. extend(normalized, raw);
  8628. }
  8629. if (isObject(comp)) {
  8630. cache.set(comp, normalized);
  8631. }
  8632. return normalized;
  8633. }
  8634. function isEmitListener(options, key) {
  8635. if (!options || !isOn(key)) {
  8636. return false;
  8637. }
  8638. key = key.slice(2).replace(/Once$/, "");
  8639. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  8640. }
  8641. let accessedAttrs = false;
  8642. function markAttrsAccessed() {
  8643. accessedAttrs = true;
  8644. }
  8645. function renderComponentRoot(instance) {
  8646. const {
  8647. type: Component,
  8648. vnode,
  8649. proxy,
  8650. withProxy,
  8651. propsOptions: [propsOptions],
  8652. slots,
  8653. attrs,
  8654. emit,
  8655. render,
  8656. renderCache,
  8657. props,
  8658. data,
  8659. setupState,
  8660. ctx,
  8661. inheritAttrs
  8662. } = instance;
  8663. const prev = setCurrentRenderingInstance(instance);
  8664. let result;
  8665. let fallthroughAttrs;
  8666. {
  8667. accessedAttrs = false;
  8668. }
  8669. try {
  8670. if (vnode.shapeFlag & 4) {
  8671. const proxyToUse = withProxy || proxy;
  8672. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  8673. get(target, key, receiver) {
  8674. warn$1(
  8675. `Property '${String(
  8676. key
  8677. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  8678. );
  8679. return Reflect.get(target, key, receiver);
  8680. }
  8681. }) : proxyToUse;
  8682. result = normalizeVNode(
  8683. render.call(
  8684. thisProxy,
  8685. proxyToUse,
  8686. renderCache,
  8687. true ? shallowReadonly(props) : props,
  8688. setupState,
  8689. data,
  8690. ctx
  8691. )
  8692. );
  8693. fallthroughAttrs = attrs;
  8694. } else {
  8695. const render2 = Component;
  8696. if (attrs === props) {
  8697. markAttrsAccessed();
  8698. }
  8699. result = normalizeVNode(
  8700. render2.length > 1 ? render2(
  8701. true ? shallowReadonly(props) : props,
  8702. true ? {
  8703. get attrs() {
  8704. markAttrsAccessed();
  8705. return shallowReadonly(attrs);
  8706. },
  8707. slots,
  8708. emit
  8709. } : { attrs, slots, emit }
  8710. ) : render2(
  8711. true ? shallowReadonly(props) : props,
  8712. null
  8713. )
  8714. );
  8715. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  8716. }
  8717. } catch (err) {
  8718. blockStack.length = 0;
  8719. handleError(err, instance, 1);
  8720. result = createVNode(Comment);
  8721. }
  8722. let root = result;
  8723. let setRoot = void 0;
  8724. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  8725. [root, setRoot] = getChildRoot(result);
  8726. }
  8727. if (fallthroughAttrs && inheritAttrs !== false) {
  8728. const keys = Object.keys(fallthroughAttrs);
  8729. const { shapeFlag } = root;
  8730. if (keys.length) {
  8731. if (shapeFlag & (1 | 6)) {
  8732. if (propsOptions && keys.some(isModelListener)) {
  8733. fallthroughAttrs = filterModelListeners(
  8734. fallthroughAttrs,
  8735. propsOptions
  8736. );
  8737. }
  8738. root = cloneVNode(root, fallthroughAttrs, false, true);
  8739. } else if (!accessedAttrs && root.type !== Comment) {
  8740. const allAttrs = Object.keys(attrs);
  8741. const eventAttrs = [];
  8742. const extraAttrs = [];
  8743. for (let i = 0, l = allAttrs.length; i < l; i++) {
  8744. const key = allAttrs[i];
  8745. if (isOn(key)) {
  8746. if (!isModelListener(key)) {
  8747. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  8748. }
  8749. } else {
  8750. extraAttrs.push(key);
  8751. }
  8752. }
  8753. if (extraAttrs.length) {
  8754. warn$1(
  8755. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
  8756. );
  8757. }
  8758. if (eventAttrs.length) {
  8759. warn$1(
  8760. `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.`
  8761. );
  8762. }
  8763. }
  8764. }
  8765. }
  8766. if (vnode.dirs) {
  8767. if (!isElementRoot(root)) {
  8768. warn$1(
  8769. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  8770. );
  8771. }
  8772. root = cloneVNode(root, null, false, true);
  8773. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  8774. }
  8775. if (vnode.transition) {
  8776. if (!isElementRoot(root)) {
  8777. warn$1(
  8778. `Component inside <Transition> renders non-element root node that cannot be animated.`
  8779. );
  8780. }
  8781. setTransitionHooks(root, vnode.transition);
  8782. }
  8783. if (setRoot) {
  8784. setRoot(root);
  8785. } else {
  8786. result = root;
  8787. }
  8788. setCurrentRenderingInstance(prev);
  8789. return result;
  8790. }
  8791. const getChildRoot = (vnode) => {
  8792. const rawChildren = vnode.children;
  8793. const dynamicChildren = vnode.dynamicChildren;
  8794. const childRoot = filterSingleRoot(rawChildren, false);
  8795. if (!childRoot) {
  8796. return [vnode, void 0];
  8797. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  8798. return getChildRoot(childRoot);
  8799. }
  8800. const index = rawChildren.indexOf(childRoot);
  8801. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  8802. const setRoot = (updatedRoot) => {
  8803. rawChildren[index] = updatedRoot;
  8804. if (dynamicChildren) {
  8805. if (dynamicIndex > -1) {
  8806. dynamicChildren[dynamicIndex] = updatedRoot;
  8807. } else if (updatedRoot.patchFlag > 0) {
  8808. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  8809. }
  8810. }
  8811. };
  8812. return [normalizeVNode(childRoot), setRoot];
  8813. };
  8814. function filterSingleRoot(children, recurse = true) {
  8815. let singleRoot;
  8816. for (let i = 0; i < children.length; i++) {
  8817. const child = children[i];
  8818. if (isVNode(child)) {
  8819. if (child.type !== Comment || child.children === "v-if") {
  8820. if (singleRoot) {
  8821. return;
  8822. } else {
  8823. singleRoot = child;
  8824. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  8825. return filterSingleRoot(singleRoot.children);
  8826. }
  8827. }
  8828. }
  8829. } else {
  8830. return;
  8831. }
  8832. }
  8833. return singleRoot;
  8834. }
  8835. const getFunctionalFallthrough = (attrs) => {
  8836. let res;
  8837. for (const key in attrs) {
  8838. if (key === "class" || key === "style" || isOn(key)) {
  8839. (res || (res = {}))[key] = attrs[key];
  8840. }
  8841. }
  8842. return res;
  8843. };
  8844. const filterModelListeners = (attrs, props) => {
  8845. const res = {};
  8846. for (const key in attrs) {
  8847. if (!isModelListener(key) || !(key.slice(9) in props)) {
  8848. res[key] = attrs[key];
  8849. }
  8850. }
  8851. return res;
  8852. };
  8853. const isElementRoot = (vnode) => {
  8854. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  8855. };
  8856. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  8857. const { props: prevProps, children: prevChildren, component } = prevVNode;
  8858. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  8859. const emits = component.emitsOptions;
  8860. if ((prevChildren || nextChildren) && isHmrUpdating) {
  8861. return true;
  8862. }
  8863. if (nextVNode.dirs || nextVNode.transition) {
  8864. return true;
  8865. }
  8866. if (optimized && patchFlag >= 0) {
  8867. if (patchFlag & 1024) {
  8868. return true;
  8869. }
  8870. if (patchFlag & 16) {
  8871. if (!prevProps) {
  8872. return !!nextProps;
  8873. }
  8874. return hasPropsChanged(prevProps, nextProps, emits);
  8875. } else if (patchFlag & 8) {
  8876. const dynamicProps = nextVNode.dynamicProps;
  8877. for (let i = 0; i < dynamicProps.length; i++) {
  8878. const key = dynamicProps[i];
  8879. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  8880. return true;
  8881. }
  8882. }
  8883. }
  8884. } else {
  8885. if (prevChildren || nextChildren) {
  8886. if (!nextChildren || !nextChildren.$stable) {
  8887. return true;
  8888. }
  8889. }
  8890. if (prevProps === nextProps) {
  8891. return false;
  8892. }
  8893. if (!prevProps) {
  8894. return !!nextProps;
  8895. }
  8896. if (!nextProps) {
  8897. return true;
  8898. }
  8899. return hasPropsChanged(prevProps, nextProps, emits);
  8900. }
  8901. return false;
  8902. }
  8903. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  8904. const nextKeys = Object.keys(nextProps);
  8905. if (nextKeys.length !== Object.keys(prevProps).length) {
  8906. return true;
  8907. }
  8908. for (let i = 0; i < nextKeys.length; i++) {
  8909. const key = nextKeys[i];
  8910. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  8911. return true;
  8912. }
  8913. }
  8914. return false;
  8915. }
  8916. function updateHOCHostEl({ vnode, parent }, el) {
  8917. while (parent) {
  8918. const root = parent.subTree;
  8919. if (root.suspense && root.suspense.activeBranch === vnode) {
  8920. root.el = vnode.el;
  8921. }
  8922. if (root === vnode) {
  8923. (vnode = parent.vnode).el = el;
  8924. parent = parent.parent;
  8925. } else {
  8926. break;
  8927. }
  8928. }
  8929. }
  8930. const isSuspense = (type) => type.__isSuspense;
  8931. let suspenseId = 0;
  8932. const SuspenseImpl = {
  8933. name: "Suspense",
  8934. // In order to make Suspense tree-shakable, we need to avoid importing it
  8935. // directly in the renderer. The renderer checks for the __isSuspense flag
  8936. // on a vnode's type and calls the `process` method, passing in renderer
  8937. // internals.
  8938. __isSuspense: true,
  8939. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8940. if (n1 == null) {
  8941. mountSuspense(
  8942. n2,
  8943. container,
  8944. anchor,
  8945. parentComponent,
  8946. parentSuspense,
  8947. namespace,
  8948. slotScopeIds,
  8949. optimized,
  8950. rendererInternals
  8951. );
  8952. } else {
  8953. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8954. n2.suspense = n1.suspense;
  8955. n2.suspense.vnode = n2;
  8956. n2.el = n1.el;
  8957. return;
  8958. }
  8959. patchSuspense(
  8960. n1,
  8961. n2,
  8962. container,
  8963. anchor,
  8964. parentComponent,
  8965. namespace,
  8966. slotScopeIds,
  8967. optimized,
  8968. rendererInternals
  8969. );
  8970. }
  8971. },
  8972. hydrate: hydrateSuspense,
  8973. normalize: normalizeSuspenseChildren
  8974. };
  8975. const Suspense = SuspenseImpl ;
  8976. function triggerEvent(vnode, name) {
  8977. const eventListener = vnode.props && vnode.props[name];
  8978. if (isFunction(eventListener)) {
  8979. eventListener();
  8980. }
  8981. }
  8982. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8983. const {
  8984. p: patch,
  8985. o: { createElement }
  8986. } = rendererInternals;
  8987. const hiddenContainer = createElement("div");
  8988. const suspense = vnode.suspense = createSuspenseBoundary(
  8989. vnode,
  8990. parentSuspense,
  8991. parentComponent,
  8992. container,
  8993. hiddenContainer,
  8994. anchor,
  8995. namespace,
  8996. slotScopeIds,
  8997. optimized,
  8998. rendererInternals
  8999. );
  9000. patch(
  9001. null,
  9002. suspense.pendingBranch = vnode.ssContent,
  9003. hiddenContainer,
  9004. null,
  9005. parentComponent,
  9006. suspense,
  9007. namespace,
  9008. slotScopeIds
  9009. );
  9010. if (suspense.deps > 0) {
  9011. triggerEvent(vnode, "onPending");
  9012. triggerEvent(vnode, "onFallback");
  9013. patch(
  9014. null,
  9015. vnode.ssFallback,
  9016. container,
  9017. anchor,
  9018. parentComponent,
  9019. null,
  9020. // fallback tree will not have suspense context
  9021. namespace,
  9022. slotScopeIds
  9023. );
  9024. setActiveBranch(suspense, vnode.ssFallback);
  9025. } else {
  9026. suspense.resolve(false, true);
  9027. }
  9028. }
  9029. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  9030. const suspense = n2.suspense = n1.suspense;
  9031. suspense.vnode = n2;
  9032. n2.el = n1.el;
  9033. const newBranch = n2.ssContent;
  9034. const newFallback = n2.ssFallback;
  9035. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  9036. if (pendingBranch) {
  9037. suspense.pendingBranch = newBranch;
  9038. if (isSameVNodeType(pendingBranch, newBranch)) {
  9039. patch(
  9040. pendingBranch,
  9041. newBranch,
  9042. suspense.hiddenContainer,
  9043. null,
  9044. parentComponent,
  9045. suspense,
  9046. namespace,
  9047. slotScopeIds,
  9048. optimized
  9049. );
  9050. if (suspense.deps <= 0) {
  9051. suspense.resolve();
  9052. } else if (isInFallback) {
  9053. if (!isHydrating) {
  9054. patch(
  9055. activeBranch,
  9056. newFallback,
  9057. container,
  9058. anchor,
  9059. parentComponent,
  9060. null,
  9061. // fallback tree will not have suspense context
  9062. namespace,
  9063. slotScopeIds,
  9064. optimized
  9065. );
  9066. setActiveBranch(suspense, newFallback);
  9067. }
  9068. }
  9069. } else {
  9070. suspense.pendingId = suspenseId++;
  9071. if (isHydrating) {
  9072. suspense.isHydrating = false;
  9073. suspense.activeBranch = pendingBranch;
  9074. } else {
  9075. unmount(pendingBranch, parentComponent, suspense);
  9076. }
  9077. suspense.deps = 0;
  9078. suspense.effects.length = 0;
  9079. suspense.hiddenContainer = createElement("div");
  9080. if (isInFallback) {
  9081. patch(
  9082. null,
  9083. newBranch,
  9084. suspense.hiddenContainer,
  9085. null,
  9086. parentComponent,
  9087. suspense,
  9088. namespace,
  9089. slotScopeIds,
  9090. optimized
  9091. );
  9092. if (suspense.deps <= 0) {
  9093. suspense.resolve();
  9094. } else {
  9095. patch(
  9096. activeBranch,
  9097. newFallback,
  9098. container,
  9099. anchor,
  9100. parentComponent,
  9101. null,
  9102. // fallback tree will not have suspense context
  9103. namespace,
  9104. slotScopeIds,
  9105. optimized
  9106. );
  9107. setActiveBranch(suspense, newFallback);
  9108. }
  9109. } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9110. patch(
  9111. activeBranch,
  9112. newBranch,
  9113. container,
  9114. anchor,
  9115. parentComponent,
  9116. suspense,
  9117. namespace,
  9118. slotScopeIds,
  9119. optimized
  9120. );
  9121. suspense.resolve(true);
  9122. } else {
  9123. patch(
  9124. null,
  9125. newBranch,
  9126. suspense.hiddenContainer,
  9127. null,
  9128. parentComponent,
  9129. suspense,
  9130. namespace,
  9131. slotScopeIds,
  9132. optimized
  9133. );
  9134. if (suspense.deps <= 0) {
  9135. suspense.resolve();
  9136. }
  9137. }
  9138. }
  9139. } else {
  9140. if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9141. patch(
  9142. activeBranch,
  9143. newBranch,
  9144. container,
  9145. anchor,
  9146. parentComponent,
  9147. suspense,
  9148. namespace,
  9149. slotScopeIds,
  9150. optimized
  9151. );
  9152. setActiveBranch(suspense, newBranch);
  9153. } else {
  9154. triggerEvent(n2, "onPending");
  9155. suspense.pendingBranch = newBranch;
  9156. if (newBranch.shapeFlag & 512) {
  9157. suspense.pendingId = newBranch.component.suspenseId;
  9158. } else {
  9159. suspense.pendingId = suspenseId++;
  9160. }
  9161. patch(
  9162. null,
  9163. newBranch,
  9164. suspense.hiddenContainer,
  9165. null,
  9166. parentComponent,
  9167. suspense,
  9168. namespace,
  9169. slotScopeIds,
  9170. optimized
  9171. );
  9172. if (suspense.deps <= 0) {
  9173. suspense.resolve();
  9174. } else {
  9175. const { timeout, pendingId } = suspense;
  9176. if (timeout > 0) {
  9177. setTimeout(() => {
  9178. if (suspense.pendingId === pendingId) {
  9179. suspense.fallback(newFallback);
  9180. }
  9181. }, timeout);
  9182. } else if (timeout === 0) {
  9183. suspense.fallback(newFallback);
  9184. }
  9185. }
  9186. }
  9187. }
  9188. }
  9189. let hasWarned = false;
  9190. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9191. if (!hasWarned) {
  9192. hasWarned = true;
  9193. console[console.info ? "info" : "log"](
  9194. `<Suspense> is an experimental feature and its API will likely change.`
  9195. );
  9196. }
  9197. const {
  9198. p: patch,
  9199. m: move,
  9200. um: unmount,
  9201. n: next,
  9202. o: { parentNode, remove }
  9203. } = rendererInternals;
  9204. let parentSuspenseId;
  9205. const isSuspensible = isVNodeSuspensible(vnode);
  9206. if (isSuspensible) {
  9207. if (parentSuspense && parentSuspense.pendingBranch) {
  9208. parentSuspenseId = parentSuspense.pendingId;
  9209. parentSuspense.deps++;
  9210. }
  9211. }
  9212. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9213. {
  9214. assertNumber(timeout, `Suspense timeout`);
  9215. }
  9216. const initialAnchor = anchor;
  9217. const suspense = {
  9218. vnode,
  9219. parent: parentSuspense,
  9220. parentComponent,
  9221. namespace,
  9222. container,
  9223. hiddenContainer,
  9224. deps: 0,
  9225. pendingId: suspenseId++,
  9226. timeout: typeof timeout === "number" ? timeout : -1,
  9227. activeBranch: null,
  9228. pendingBranch: null,
  9229. isInFallback: !isHydrating,
  9230. isHydrating,
  9231. isUnmounted: false,
  9232. effects: [],
  9233. resolve(resume = false, sync = false) {
  9234. {
  9235. if (!resume && !suspense.pendingBranch) {
  9236. throw new Error(
  9237. `suspense.resolve() is called without a pending branch.`
  9238. );
  9239. }
  9240. if (suspense.isUnmounted) {
  9241. throw new Error(
  9242. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9243. );
  9244. }
  9245. }
  9246. const {
  9247. vnode: vnode2,
  9248. activeBranch,
  9249. pendingBranch,
  9250. pendingId,
  9251. effects,
  9252. parentComponent: parentComponent2,
  9253. container: container2
  9254. } = suspense;
  9255. let delayEnter = false;
  9256. if (suspense.isHydrating) {
  9257. suspense.isHydrating = false;
  9258. } else if (!resume) {
  9259. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9260. if (delayEnter) {
  9261. activeBranch.transition.afterLeave = () => {
  9262. if (pendingId === suspense.pendingId) {
  9263. move(
  9264. pendingBranch,
  9265. container2,
  9266. anchor === initialAnchor ? next(activeBranch) : anchor,
  9267. 0
  9268. );
  9269. queuePostFlushCb(effects);
  9270. }
  9271. };
  9272. }
  9273. if (activeBranch) {
  9274. if (parentNode(activeBranch.el) === container2) {
  9275. anchor = next(activeBranch);
  9276. }
  9277. unmount(activeBranch, parentComponent2, suspense, true);
  9278. }
  9279. if (!delayEnter) {
  9280. move(pendingBranch, container2, anchor, 0);
  9281. }
  9282. }
  9283. setActiveBranch(suspense, pendingBranch);
  9284. suspense.pendingBranch = null;
  9285. suspense.isInFallback = false;
  9286. let parent = suspense.parent;
  9287. let hasUnresolvedAncestor = false;
  9288. while (parent) {
  9289. if (parent.pendingBranch) {
  9290. parent.effects.push(...effects);
  9291. hasUnresolvedAncestor = true;
  9292. break;
  9293. }
  9294. parent = parent.parent;
  9295. }
  9296. if (!hasUnresolvedAncestor && !delayEnter) {
  9297. queuePostFlushCb(effects);
  9298. }
  9299. suspense.effects = [];
  9300. if (isSuspensible) {
  9301. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9302. parentSuspense.deps--;
  9303. if (parentSuspense.deps === 0 && !sync) {
  9304. parentSuspense.resolve();
  9305. }
  9306. }
  9307. }
  9308. triggerEvent(vnode2, "onResolve");
  9309. },
  9310. fallback(fallbackVNode) {
  9311. if (!suspense.pendingBranch) {
  9312. return;
  9313. }
  9314. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9315. triggerEvent(vnode2, "onFallback");
  9316. const anchor2 = next(activeBranch);
  9317. const mountFallback = () => {
  9318. if (!suspense.isInFallback) {
  9319. return;
  9320. }
  9321. patch(
  9322. null,
  9323. fallbackVNode,
  9324. container2,
  9325. anchor2,
  9326. parentComponent2,
  9327. null,
  9328. // fallback tree will not have suspense context
  9329. namespace2,
  9330. slotScopeIds,
  9331. optimized
  9332. );
  9333. setActiveBranch(suspense, fallbackVNode);
  9334. };
  9335. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9336. if (delayEnter) {
  9337. activeBranch.transition.afterLeave = mountFallback;
  9338. }
  9339. suspense.isInFallback = true;
  9340. unmount(
  9341. activeBranch,
  9342. parentComponent2,
  9343. null,
  9344. // no suspense so unmount hooks fire now
  9345. true
  9346. // shouldRemove
  9347. );
  9348. if (!delayEnter) {
  9349. mountFallback();
  9350. }
  9351. },
  9352. move(container2, anchor2, type) {
  9353. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9354. suspense.container = container2;
  9355. },
  9356. next() {
  9357. return suspense.activeBranch && next(suspense.activeBranch);
  9358. },
  9359. registerDep(instance, setupRenderEffect, optimized2) {
  9360. const isInPendingSuspense = !!suspense.pendingBranch;
  9361. if (isInPendingSuspense) {
  9362. suspense.deps++;
  9363. }
  9364. const hydratedEl = instance.vnode.el;
  9365. instance.asyncDep.catch((err) => {
  9366. handleError(err, instance, 0);
  9367. }).then((asyncSetupResult) => {
  9368. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9369. return;
  9370. }
  9371. instance.asyncResolved = true;
  9372. const { vnode: vnode2 } = instance;
  9373. {
  9374. pushWarningContext(vnode2);
  9375. }
  9376. handleSetupResult(instance, asyncSetupResult, false);
  9377. if (hydratedEl) {
  9378. vnode2.el = hydratedEl;
  9379. }
  9380. const placeholder = !hydratedEl && instance.subTree.el;
  9381. setupRenderEffect(
  9382. instance,
  9383. vnode2,
  9384. // component may have been moved before resolve.
  9385. // if this is not a hydration, instance.subTree will be the comment
  9386. // placeholder.
  9387. parentNode(hydratedEl || instance.subTree.el),
  9388. // anchor will not be used if this is hydration, so only need to
  9389. // consider the comment placeholder case.
  9390. hydratedEl ? null : next(instance.subTree),
  9391. suspense,
  9392. namespace,
  9393. optimized2
  9394. );
  9395. if (placeholder) {
  9396. remove(placeholder);
  9397. }
  9398. updateHOCHostEl(instance, vnode2.el);
  9399. {
  9400. popWarningContext();
  9401. }
  9402. if (isInPendingSuspense && --suspense.deps === 0) {
  9403. suspense.resolve();
  9404. }
  9405. });
  9406. },
  9407. unmount(parentSuspense2, doRemove) {
  9408. suspense.isUnmounted = true;
  9409. if (suspense.activeBranch) {
  9410. unmount(
  9411. suspense.activeBranch,
  9412. parentComponent,
  9413. parentSuspense2,
  9414. doRemove
  9415. );
  9416. }
  9417. if (suspense.pendingBranch) {
  9418. unmount(
  9419. suspense.pendingBranch,
  9420. parentComponent,
  9421. parentSuspense2,
  9422. doRemove
  9423. );
  9424. }
  9425. }
  9426. };
  9427. return suspense;
  9428. }
  9429. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9430. const suspense = vnode.suspense = createSuspenseBoundary(
  9431. vnode,
  9432. parentSuspense,
  9433. parentComponent,
  9434. node.parentNode,
  9435. // eslint-disable-next-line no-restricted-globals
  9436. document.createElement("div"),
  9437. null,
  9438. namespace,
  9439. slotScopeIds,
  9440. optimized,
  9441. rendererInternals,
  9442. true
  9443. );
  9444. const result = hydrateNode(
  9445. node,
  9446. suspense.pendingBranch = vnode.ssContent,
  9447. parentComponent,
  9448. suspense,
  9449. slotScopeIds,
  9450. optimized
  9451. );
  9452. if (suspense.deps === 0) {
  9453. suspense.resolve(false, true);
  9454. }
  9455. return result;
  9456. }
  9457. function normalizeSuspenseChildren(vnode) {
  9458. const { shapeFlag, children } = vnode;
  9459. const isSlotChildren = shapeFlag & 32;
  9460. vnode.ssContent = normalizeSuspenseSlot(
  9461. isSlotChildren ? children.default : children
  9462. );
  9463. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9464. }
  9465. function normalizeSuspenseSlot(s) {
  9466. let block;
  9467. if (isFunction(s)) {
  9468. const trackBlock = isBlockTreeEnabled && s._c;
  9469. if (trackBlock) {
  9470. s._d = false;
  9471. openBlock();
  9472. }
  9473. s = s();
  9474. if (trackBlock) {
  9475. s._d = true;
  9476. block = currentBlock;
  9477. closeBlock();
  9478. }
  9479. }
  9480. if (isArray(s)) {
  9481. const singleChild = filterSingleRoot(s);
  9482. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9483. warn$1(`<Suspense> slots expect a single root node.`);
  9484. }
  9485. s = singleChild;
  9486. }
  9487. s = normalizeVNode(s);
  9488. if (block && !s.dynamicChildren) {
  9489. s.dynamicChildren = block.filter((c) => c !== s);
  9490. }
  9491. return s;
  9492. }
  9493. function queueEffectWithSuspense(fn, suspense) {
  9494. if (suspense && suspense.pendingBranch) {
  9495. if (isArray(fn)) {
  9496. suspense.effects.push(...fn);
  9497. } else {
  9498. suspense.effects.push(fn);
  9499. }
  9500. } else {
  9501. queuePostFlushCb(fn);
  9502. }
  9503. }
  9504. function setActiveBranch(suspense, branch) {
  9505. suspense.activeBranch = branch;
  9506. const { vnode, parentComponent } = suspense;
  9507. let el = branch.el;
  9508. while (!el && branch.component) {
  9509. branch = branch.component.subTree;
  9510. el = branch.el;
  9511. }
  9512. vnode.el = el;
  9513. if (parentComponent && parentComponent.subTree === vnode) {
  9514. parentComponent.vnode.el = el;
  9515. updateHOCHostEl(parentComponent, el);
  9516. }
  9517. }
  9518. function isVNodeSuspensible(vnode) {
  9519. const suspensible = vnode.props && vnode.props.suspensible;
  9520. return suspensible != null && suspensible !== false;
  9521. }
  9522. const Fragment = Symbol.for("v-fgt");
  9523. const Text = Symbol.for("v-txt");
  9524. const Comment = Symbol.for("v-cmt");
  9525. const Static = Symbol.for("v-stc");
  9526. const blockStack = [];
  9527. let currentBlock = null;
  9528. function openBlock(disableTracking = false) {
  9529. blockStack.push(currentBlock = disableTracking ? null : []);
  9530. }
  9531. function closeBlock() {
  9532. blockStack.pop();
  9533. currentBlock = blockStack[blockStack.length - 1] || null;
  9534. }
  9535. let isBlockTreeEnabled = 1;
  9536. function setBlockTracking(value, inVOnce = false) {
  9537. isBlockTreeEnabled += value;
  9538. if (value < 0 && currentBlock && inVOnce) {
  9539. currentBlock.hasOnce = true;
  9540. }
  9541. }
  9542. function setupBlock(vnode) {
  9543. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9544. closeBlock();
  9545. if (isBlockTreeEnabled > 0 && currentBlock) {
  9546. currentBlock.push(vnode);
  9547. }
  9548. return vnode;
  9549. }
  9550. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9551. return setupBlock(
  9552. createBaseVNode(
  9553. type,
  9554. props,
  9555. children,
  9556. patchFlag,
  9557. dynamicProps,
  9558. shapeFlag,
  9559. true
  9560. )
  9561. );
  9562. }
  9563. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9564. return setupBlock(
  9565. createVNode(
  9566. type,
  9567. props,
  9568. children,
  9569. patchFlag,
  9570. dynamicProps,
  9571. true
  9572. )
  9573. );
  9574. }
  9575. function isVNode(value) {
  9576. return value ? value.__v_isVNode === true : false;
  9577. }
  9578. function isSameVNodeType(n1, n2) {
  9579. if (n2.shapeFlag & 6 && n1.component) {
  9580. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9581. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9582. n1.shapeFlag &= -257;
  9583. n2.shapeFlag &= -513;
  9584. return false;
  9585. }
  9586. }
  9587. return n1.type === n2.type && n1.key === n2.key;
  9588. }
  9589. let vnodeArgsTransformer;
  9590. function transformVNodeArgs(transformer) {
  9591. vnodeArgsTransformer = transformer;
  9592. }
  9593. const createVNodeWithArgsTransform = (...args) => {
  9594. return _createVNode(
  9595. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9596. );
  9597. };
  9598. const normalizeKey = ({ key }) => key != null ? key : null;
  9599. const normalizeRef = ({
  9600. ref,
  9601. ref_key,
  9602. ref_for
  9603. }) => {
  9604. if (typeof ref === "number") {
  9605. ref = "" + ref;
  9606. }
  9607. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9608. };
  9609. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9610. const vnode = {
  9611. __v_isVNode: true,
  9612. __v_skip: true,
  9613. type,
  9614. props,
  9615. key: props && normalizeKey(props),
  9616. ref: props && normalizeRef(props),
  9617. scopeId: currentScopeId,
  9618. slotScopeIds: null,
  9619. children,
  9620. component: null,
  9621. suspense: null,
  9622. ssContent: null,
  9623. ssFallback: null,
  9624. dirs: null,
  9625. transition: null,
  9626. el: null,
  9627. anchor: null,
  9628. target: null,
  9629. targetStart: null,
  9630. targetAnchor: null,
  9631. staticCount: 0,
  9632. shapeFlag,
  9633. patchFlag,
  9634. dynamicProps,
  9635. dynamicChildren: null,
  9636. appContext: null,
  9637. ctx: currentRenderingInstance
  9638. };
  9639. if (needFullChildrenNormalization) {
  9640. normalizeChildren(vnode, children);
  9641. if (shapeFlag & 128) {
  9642. type.normalize(vnode);
  9643. }
  9644. } else if (children) {
  9645. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9646. }
  9647. if (vnode.key !== vnode.key) {
  9648. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9649. }
  9650. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9651. !isBlockNode && // has current parent block
  9652. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9653. // component nodes also should always be patched, because even if the
  9654. // component doesn't need to update, it needs to persist the instance on to
  9655. // the next vnode so that it can be properly unmounted later.
  9656. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9657. // vnode should not be considered dynamic due to handler caching.
  9658. vnode.patchFlag !== 32) {
  9659. currentBlock.push(vnode);
  9660. }
  9661. return vnode;
  9662. }
  9663. const createVNode = createVNodeWithArgsTransform ;
  9664. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9665. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9666. if (!type) {
  9667. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9668. }
  9669. type = Comment;
  9670. }
  9671. if (isVNode(type)) {
  9672. const cloned = cloneVNode(
  9673. type,
  9674. props,
  9675. true
  9676. /* mergeRef: true */
  9677. );
  9678. if (children) {
  9679. normalizeChildren(cloned, children);
  9680. }
  9681. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9682. if (cloned.shapeFlag & 6) {
  9683. currentBlock[currentBlock.indexOf(type)] = cloned;
  9684. } else {
  9685. currentBlock.push(cloned);
  9686. }
  9687. }
  9688. cloned.patchFlag = -2;
  9689. return cloned;
  9690. }
  9691. if (isClassComponent(type)) {
  9692. type = type.__vccOpts;
  9693. }
  9694. if (props) {
  9695. props = guardReactiveProps(props);
  9696. let { class: klass, style } = props;
  9697. if (klass && !isString(klass)) {
  9698. props.class = normalizeClass(klass);
  9699. }
  9700. if (isObject(style)) {
  9701. if (isProxy(style) && !isArray(style)) {
  9702. style = extend({}, style);
  9703. }
  9704. props.style = normalizeStyle(style);
  9705. }
  9706. }
  9707. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9708. if (shapeFlag & 4 && isProxy(type)) {
  9709. type = toRaw(type);
  9710. warn$1(
  9711. `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\`.`,
  9712. `
  9713. Component that was made reactive: `,
  9714. type
  9715. );
  9716. }
  9717. return createBaseVNode(
  9718. type,
  9719. props,
  9720. children,
  9721. patchFlag,
  9722. dynamicProps,
  9723. shapeFlag,
  9724. isBlockNode,
  9725. true
  9726. );
  9727. }
  9728. function guardReactiveProps(props) {
  9729. if (!props) return null;
  9730. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9731. }
  9732. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9733. const { props, ref, patchFlag, children, transition } = vnode;
  9734. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9735. const cloned = {
  9736. __v_isVNode: true,
  9737. __v_skip: true,
  9738. type: vnode.type,
  9739. props: mergedProps,
  9740. key: mergedProps && normalizeKey(mergedProps),
  9741. ref: extraProps && extraProps.ref ? (
  9742. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9743. // if the vnode itself already has a ref, cloneVNode will need to merge
  9744. // the refs so the single vnode can be set on multiple refs
  9745. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9746. ) : ref,
  9747. scopeId: vnode.scopeId,
  9748. slotScopeIds: vnode.slotScopeIds,
  9749. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9750. target: vnode.target,
  9751. targetStart: vnode.targetStart,
  9752. targetAnchor: vnode.targetAnchor,
  9753. staticCount: vnode.staticCount,
  9754. shapeFlag: vnode.shapeFlag,
  9755. // if the vnode is cloned with extra props, we can no longer assume its
  9756. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9757. // note: preserve flag for fragments since they use the flag for children
  9758. // fast paths only.
  9759. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9760. dynamicProps: vnode.dynamicProps,
  9761. dynamicChildren: vnode.dynamicChildren,
  9762. appContext: vnode.appContext,
  9763. dirs: vnode.dirs,
  9764. transition,
  9765. // These should technically only be non-null on mounted VNodes. However,
  9766. // they *should* be copied for kept-alive vnodes. So we just always copy
  9767. // them since them being non-null during a mount doesn't affect the logic as
  9768. // they will simply be overwritten.
  9769. component: vnode.component,
  9770. suspense: vnode.suspense,
  9771. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9772. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9773. placeholder: vnode.placeholder,
  9774. el: vnode.el,
  9775. anchor: vnode.anchor,
  9776. ctx: vnode.ctx,
  9777. ce: vnode.ce
  9778. };
  9779. if (transition && cloneTransition) {
  9780. setTransitionHooks(
  9781. cloned,
  9782. transition.clone(cloned)
  9783. );
  9784. }
  9785. return cloned;
  9786. }
  9787. function deepCloneVNode(vnode) {
  9788. const cloned = cloneVNode(vnode);
  9789. if (isArray(vnode.children)) {
  9790. cloned.children = vnode.children.map(deepCloneVNode);
  9791. }
  9792. return cloned;
  9793. }
  9794. function createTextVNode(text = " ", flag = 0) {
  9795. return createVNode(Text, null, text, flag);
  9796. }
  9797. function createStaticVNode(content, numberOfNodes) {
  9798. const vnode = createVNode(Static, null, content);
  9799. vnode.staticCount = numberOfNodes;
  9800. return vnode;
  9801. }
  9802. function createCommentVNode(text = "", asBlock = false) {
  9803. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9804. }
  9805. function normalizeVNode(child) {
  9806. if (child == null || typeof child === "boolean") {
  9807. return createVNode(Comment);
  9808. } else if (isArray(child)) {
  9809. return createVNode(
  9810. Fragment,
  9811. null,
  9812. // #3666, avoid reference pollution when reusing vnode
  9813. child.slice()
  9814. );
  9815. } else if (isVNode(child)) {
  9816. return cloneIfMounted(child);
  9817. } else {
  9818. return createVNode(Text, null, String(child));
  9819. }
  9820. }
  9821. function cloneIfMounted(child) {
  9822. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  9823. }
  9824. function normalizeChildren(vnode, children) {
  9825. let type = 0;
  9826. const { shapeFlag } = vnode;
  9827. if (children == null) {
  9828. children = null;
  9829. } else if (isArray(children)) {
  9830. type = 16;
  9831. } else if (typeof children === "object") {
  9832. if (shapeFlag & (1 | 64)) {
  9833. const slot = children.default;
  9834. if (slot) {
  9835. slot._c && (slot._d = false);
  9836. normalizeChildren(vnode, slot());
  9837. slot._c && (slot._d = true);
  9838. }
  9839. return;
  9840. } else {
  9841. type = 32;
  9842. const slotFlag = children._;
  9843. if (!slotFlag && !isInternalObject(children)) {
  9844. children._ctx = currentRenderingInstance;
  9845. } else if (slotFlag === 3 && currentRenderingInstance) {
  9846. if (currentRenderingInstance.slots._ === 1) {
  9847. children._ = 1;
  9848. } else {
  9849. children._ = 2;
  9850. vnode.patchFlag |= 1024;
  9851. }
  9852. }
  9853. }
  9854. } else if (isFunction(children)) {
  9855. children = { default: children, _ctx: currentRenderingInstance };
  9856. type = 32;
  9857. } else {
  9858. children = String(children);
  9859. if (shapeFlag & 64) {
  9860. type = 16;
  9861. children = [createTextVNode(children)];
  9862. } else {
  9863. type = 8;
  9864. }
  9865. }
  9866. vnode.children = children;
  9867. vnode.shapeFlag |= type;
  9868. }
  9869. function mergeProps(...args) {
  9870. const ret = {};
  9871. for (let i = 0; i < args.length; i++) {
  9872. const toMerge = args[i];
  9873. for (const key in toMerge) {
  9874. if (key === "class") {
  9875. if (ret.class !== toMerge.class) {
  9876. ret.class = normalizeClass([ret.class, toMerge.class]);
  9877. }
  9878. } else if (key === "style") {
  9879. ret.style = normalizeStyle([ret.style, toMerge.style]);
  9880. } else if (isOn(key)) {
  9881. const existing = ret[key];
  9882. const incoming = toMerge[key];
  9883. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  9884. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  9885. }
  9886. } else if (key !== "") {
  9887. ret[key] = toMerge[key];
  9888. }
  9889. }
  9890. }
  9891. return ret;
  9892. }
  9893. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  9894. callWithAsyncErrorHandling(hook, instance, 7, [
  9895. vnode,
  9896. prevVNode
  9897. ]);
  9898. }
  9899. const emptyAppContext = createAppContext();
  9900. let uid = 0;
  9901. function createComponentInstance(vnode, parent, suspense) {
  9902. const type = vnode.type;
  9903. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  9904. const instance = {
  9905. uid: uid++,
  9906. vnode,
  9907. type,
  9908. parent,
  9909. appContext,
  9910. root: null,
  9911. // to be immediately set
  9912. next: null,
  9913. subTree: null,
  9914. // will be set synchronously right after creation
  9915. effect: null,
  9916. update: null,
  9917. // will be set synchronously right after creation
  9918. job: null,
  9919. scope: new EffectScope(
  9920. true
  9921. /* detached */
  9922. ),
  9923. render: null,
  9924. proxy: null,
  9925. exposed: null,
  9926. exposeProxy: null,
  9927. withProxy: null,
  9928. provides: parent ? parent.provides : Object.create(appContext.provides),
  9929. ids: parent ? parent.ids : ["", 0, 0],
  9930. accessCache: null,
  9931. renderCache: [],
  9932. // local resolved assets
  9933. components: null,
  9934. directives: null,
  9935. // resolved props and emits options
  9936. propsOptions: normalizePropsOptions(type, appContext),
  9937. emitsOptions: normalizeEmitsOptions(type, appContext),
  9938. // emit
  9939. emit: null,
  9940. // to be set immediately
  9941. emitted: null,
  9942. // props default value
  9943. propsDefaults: EMPTY_OBJ,
  9944. // inheritAttrs
  9945. inheritAttrs: type.inheritAttrs,
  9946. // state
  9947. ctx: EMPTY_OBJ,
  9948. data: EMPTY_OBJ,
  9949. props: EMPTY_OBJ,
  9950. attrs: EMPTY_OBJ,
  9951. slots: EMPTY_OBJ,
  9952. refs: EMPTY_OBJ,
  9953. setupState: EMPTY_OBJ,
  9954. setupContext: null,
  9955. // suspense related
  9956. suspense,
  9957. suspenseId: suspense ? suspense.pendingId : 0,
  9958. asyncDep: null,
  9959. asyncResolved: false,
  9960. // lifecycle hooks
  9961. // not using enums here because it results in computed properties
  9962. isMounted: false,
  9963. isUnmounted: false,
  9964. isDeactivated: false,
  9965. bc: null,
  9966. c: null,
  9967. bm: null,
  9968. m: null,
  9969. bu: null,
  9970. u: null,
  9971. um: null,
  9972. bum: null,
  9973. da: null,
  9974. a: null,
  9975. rtg: null,
  9976. rtc: null,
  9977. ec: null,
  9978. sp: null
  9979. };
  9980. {
  9981. instance.ctx = createDevRenderContext(instance);
  9982. }
  9983. instance.root = parent ? parent.root : instance;
  9984. instance.emit = emit.bind(null, instance);
  9985. if (vnode.ce) {
  9986. vnode.ce(instance);
  9987. }
  9988. return instance;
  9989. }
  9990. let currentInstance = null;
  9991. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9992. let internalSetCurrentInstance;
  9993. let setInSSRSetupState;
  9994. {
  9995. internalSetCurrentInstance = (i) => {
  9996. currentInstance = i;
  9997. };
  9998. setInSSRSetupState = (v) => {
  9999. isInSSRComponentSetup = v;
  10000. };
  10001. }
  10002. const setCurrentInstance = (instance) => {
  10003. const prev = currentInstance;
  10004. internalSetCurrentInstance(instance);
  10005. instance.scope.on();
  10006. return () => {
  10007. instance.scope.off();
  10008. internalSetCurrentInstance(prev);
  10009. };
  10010. };
  10011. const unsetCurrentInstance = () => {
  10012. currentInstance && currentInstance.scope.off();
  10013. internalSetCurrentInstance(null);
  10014. };
  10015. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  10016. function validateComponentName(name, { isNativeTag }) {
  10017. if (isBuiltInTag(name) || isNativeTag(name)) {
  10018. warn$1(
  10019. "Do not use built-in or reserved HTML elements as component id: " + name
  10020. );
  10021. }
  10022. }
  10023. function isStatefulComponent(instance) {
  10024. return instance.vnode.shapeFlag & 4;
  10025. }
  10026. let isInSSRComponentSetup = false;
  10027. function setupComponent(instance, isSSR = false, optimized = false) {
  10028. isSSR && setInSSRSetupState(isSSR);
  10029. const { props, children } = instance.vnode;
  10030. const isStateful = isStatefulComponent(instance);
  10031. initProps(instance, props, isStateful, isSSR);
  10032. initSlots(instance, children, optimized || isSSR);
  10033. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  10034. isSSR && setInSSRSetupState(false);
  10035. return setupResult;
  10036. }
  10037. function setupStatefulComponent(instance, isSSR) {
  10038. var _a;
  10039. const Component = instance.type;
  10040. {
  10041. if (Component.name) {
  10042. validateComponentName(Component.name, instance.appContext.config);
  10043. }
  10044. if (Component.components) {
  10045. const names = Object.keys(Component.components);
  10046. for (let i = 0; i < names.length; i++) {
  10047. validateComponentName(names[i], instance.appContext.config);
  10048. }
  10049. }
  10050. if (Component.directives) {
  10051. const names = Object.keys(Component.directives);
  10052. for (let i = 0; i < names.length; i++) {
  10053. validateDirectiveName(names[i]);
  10054. }
  10055. }
  10056. if (Component.compilerOptions && isRuntimeOnly()) {
  10057. warn$1(
  10058. `"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.`
  10059. );
  10060. }
  10061. }
  10062. instance.accessCache = /* @__PURE__ */ Object.create(null);
  10063. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  10064. {
  10065. exposePropsOnRenderContext(instance);
  10066. }
  10067. const { setup } = Component;
  10068. if (setup) {
  10069. pauseTracking();
  10070. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  10071. const reset = setCurrentInstance(instance);
  10072. const setupResult = callWithErrorHandling(
  10073. setup,
  10074. instance,
  10075. 0,
  10076. [
  10077. shallowReadonly(instance.props) ,
  10078. setupContext
  10079. ]
  10080. );
  10081. const isAsyncSetup = isPromise(setupResult);
  10082. resetTracking();
  10083. reset();
  10084. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  10085. markAsyncBoundary(instance);
  10086. }
  10087. if (isAsyncSetup) {
  10088. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  10089. if (isSSR) {
  10090. return setupResult.then((resolvedResult) => {
  10091. handleSetupResult(instance, resolvedResult, isSSR);
  10092. }).catch((e) => {
  10093. handleError(e, instance, 0);
  10094. });
  10095. } else {
  10096. instance.asyncDep = setupResult;
  10097. if (!instance.suspense) {
  10098. const name = (_a = Component.name) != null ? _a : "Anonymous";
  10099. warn$1(
  10100. `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.`
  10101. );
  10102. }
  10103. }
  10104. } else {
  10105. handleSetupResult(instance, setupResult, isSSR);
  10106. }
  10107. } else {
  10108. finishComponentSetup(instance, isSSR);
  10109. }
  10110. }
  10111. function handleSetupResult(instance, setupResult, isSSR) {
  10112. if (isFunction(setupResult)) {
  10113. {
  10114. instance.render = setupResult;
  10115. }
  10116. } else if (isObject(setupResult)) {
  10117. if (isVNode(setupResult)) {
  10118. warn$1(
  10119. `setup() should not return VNodes directly - return a render function instead.`
  10120. );
  10121. }
  10122. {
  10123. instance.devtoolsRawSetupState = setupResult;
  10124. }
  10125. instance.setupState = proxyRefs(setupResult);
  10126. {
  10127. exposeSetupStateOnRenderContext(instance);
  10128. }
  10129. } else if (setupResult !== void 0) {
  10130. warn$1(
  10131. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10132. );
  10133. }
  10134. finishComponentSetup(instance, isSSR);
  10135. }
  10136. let compile$1;
  10137. let installWithProxy;
  10138. function registerRuntimeCompiler(_compile) {
  10139. compile$1 = _compile;
  10140. installWithProxy = (i) => {
  10141. if (i.render._rc) {
  10142. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10143. }
  10144. };
  10145. }
  10146. const isRuntimeOnly = () => !compile$1;
  10147. function finishComponentSetup(instance, isSSR, skipOptions) {
  10148. const Component = instance.type;
  10149. if (!instance.render) {
  10150. if (!isSSR && compile$1 && !Component.render) {
  10151. const template = Component.template || resolveMergedOptions(instance).template;
  10152. if (template) {
  10153. {
  10154. startMeasure(instance, `compile`);
  10155. }
  10156. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10157. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10158. const finalCompilerOptions = extend(
  10159. extend(
  10160. {
  10161. isCustomElement,
  10162. delimiters
  10163. },
  10164. compilerOptions
  10165. ),
  10166. componentCompilerOptions
  10167. );
  10168. Component.render = compile$1(template, finalCompilerOptions);
  10169. {
  10170. endMeasure(instance, `compile`);
  10171. }
  10172. }
  10173. }
  10174. instance.render = Component.render || NOOP;
  10175. if (installWithProxy) {
  10176. installWithProxy(instance);
  10177. }
  10178. }
  10179. {
  10180. const reset = setCurrentInstance(instance);
  10181. pauseTracking();
  10182. try {
  10183. applyOptions(instance);
  10184. } finally {
  10185. resetTracking();
  10186. reset();
  10187. }
  10188. }
  10189. if (!Component.render && instance.render === NOOP && !isSSR) {
  10190. if (!compile$1 && Component.template) {
  10191. warn$1(
  10192. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  10193. );
  10194. } else {
  10195. warn$1(`Component is missing template or render function: `, Component);
  10196. }
  10197. }
  10198. }
  10199. const attrsProxyHandlers = {
  10200. get(target, key) {
  10201. markAttrsAccessed();
  10202. track(target, "get", "");
  10203. return target[key];
  10204. },
  10205. set() {
  10206. warn$1(`setupContext.attrs is readonly.`);
  10207. return false;
  10208. },
  10209. deleteProperty() {
  10210. warn$1(`setupContext.attrs is readonly.`);
  10211. return false;
  10212. }
  10213. } ;
  10214. function getSlotsProxy(instance) {
  10215. return new Proxy(instance.slots, {
  10216. get(target, key) {
  10217. track(instance, "get", "$slots");
  10218. return target[key];
  10219. }
  10220. });
  10221. }
  10222. function createSetupContext(instance) {
  10223. const expose = (exposed) => {
  10224. {
  10225. if (instance.exposed) {
  10226. warn$1(`expose() should be called only once per setup().`);
  10227. }
  10228. if (exposed != null) {
  10229. let exposedType = typeof exposed;
  10230. if (exposedType === "object") {
  10231. if (isArray(exposed)) {
  10232. exposedType = "array";
  10233. } else if (isRef(exposed)) {
  10234. exposedType = "ref";
  10235. }
  10236. }
  10237. if (exposedType !== "object") {
  10238. warn$1(
  10239. `expose() should be passed a plain object, received ${exposedType}.`
  10240. );
  10241. }
  10242. }
  10243. }
  10244. instance.exposed = exposed || {};
  10245. };
  10246. {
  10247. let attrsProxy;
  10248. let slotsProxy;
  10249. return Object.freeze({
  10250. get attrs() {
  10251. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10252. },
  10253. get slots() {
  10254. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10255. },
  10256. get emit() {
  10257. return (event, ...args) => instance.emit(event, ...args);
  10258. },
  10259. expose
  10260. });
  10261. }
  10262. }
  10263. function getComponentPublicInstance(instance) {
  10264. if (instance.exposed) {
  10265. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10266. get(target, key) {
  10267. if (key in target) {
  10268. return target[key];
  10269. } else if (key in publicPropertiesMap) {
  10270. return publicPropertiesMap[key](instance);
  10271. }
  10272. },
  10273. has(target, key) {
  10274. return key in target || key in publicPropertiesMap;
  10275. }
  10276. }));
  10277. } else {
  10278. return instance.proxy;
  10279. }
  10280. }
  10281. const classifyRE = /(?:^|[-_])\w/g;
  10282. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10283. function getComponentName(Component, includeInferred = true) {
  10284. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10285. }
  10286. function formatComponentName(instance, Component, isRoot = false) {
  10287. let name = getComponentName(Component);
  10288. if (!name && Component.__file) {
  10289. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10290. if (match) {
  10291. name = match[1];
  10292. }
  10293. }
  10294. if (!name && instance && instance.parent) {
  10295. const inferFromRegistry = (registry) => {
  10296. for (const key in registry) {
  10297. if (registry[key] === Component) {
  10298. return key;
  10299. }
  10300. }
  10301. };
  10302. name = inferFromRegistry(
  10303. instance.components || instance.parent.type.components
  10304. ) || inferFromRegistry(instance.appContext.components);
  10305. }
  10306. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10307. }
  10308. function isClassComponent(value) {
  10309. return isFunction(value) && "__vccOpts" in value;
  10310. }
  10311. const computed = (getterOrOptions, debugOptions) => {
  10312. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10313. {
  10314. const i = getCurrentInstance();
  10315. if (i && i.appContext.config.warnRecursiveComputed) {
  10316. c._warnRecursive = true;
  10317. }
  10318. }
  10319. return c;
  10320. };
  10321. function h(type, propsOrChildren, children) {
  10322. const doCreateVNode = (type2, props, children2) => {
  10323. setBlockTracking(-1);
  10324. try {
  10325. return createVNode(type2, props, children2);
  10326. } finally {
  10327. setBlockTracking(1);
  10328. }
  10329. };
  10330. const l = arguments.length;
  10331. if (l === 2) {
  10332. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10333. if (isVNode(propsOrChildren)) {
  10334. return doCreateVNode(type, null, [propsOrChildren]);
  10335. }
  10336. return doCreateVNode(type, propsOrChildren);
  10337. } else {
  10338. return doCreateVNode(type, null, propsOrChildren);
  10339. }
  10340. } else {
  10341. if (l > 3) {
  10342. children = Array.prototype.slice.call(arguments, 2);
  10343. } else if (l === 3 && isVNode(children)) {
  10344. children = [children];
  10345. }
  10346. return doCreateVNode(type, propsOrChildren, children);
  10347. }
  10348. }
  10349. function initCustomFormatter() {
  10350. if (typeof window === "undefined") {
  10351. return;
  10352. }
  10353. const vueStyle = { style: "color:#3ba776" };
  10354. const numberStyle = { style: "color:#1677ff" };
  10355. const stringStyle = { style: "color:#f5222d" };
  10356. const keywordStyle = { style: "color:#eb2f96" };
  10357. const formatter = {
  10358. __vue_custom_formatter: true,
  10359. header(obj) {
  10360. if (!isObject(obj)) {
  10361. return null;
  10362. }
  10363. if (obj.__isVue) {
  10364. return ["div", vueStyle, `VueInstance`];
  10365. } else if (isRef(obj)) {
  10366. pauseTracking();
  10367. const value = obj.value;
  10368. resetTracking();
  10369. return [
  10370. "div",
  10371. {},
  10372. ["span", vueStyle, genRefFlag(obj)],
  10373. "<",
  10374. formatValue(value),
  10375. `>`
  10376. ];
  10377. } else if (isReactive(obj)) {
  10378. return [
  10379. "div",
  10380. {},
  10381. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10382. "<",
  10383. formatValue(obj),
  10384. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10385. ];
  10386. } else if (isReadonly(obj)) {
  10387. return [
  10388. "div",
  10389. {},
  10390. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10391. "<",
  10392. formatValue(obj),
  10393. ">"
  10394. ];
  10395. }
  10396. return null;
  10397. },
  10398. hasBody(obj) {
  10399. return obj && obj.__isVue;
  10400. },
  10401. body(obj) {
  10402. if (obj && obj.__isVue) {
  10403. return [
  10404. "div",
  10405. {},
  10406. ...formatInstance(obj.$)
  10407. ];
  10408. }
  10409. }
  10410. };
  10411. function formatInstance(instance) {
  10412. const blocks = [];
  10413. if (instance.type.props && instance.props) {
  10414. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10415. }
  10416. if (instance.setupState !== EMPTY_OBJ) {
  10417. blocks.push(createInstanceBlock("setup", instance.setupState));
  10418. }
  10419. if (instance.data !== EMPTY_OBJ) {
  10420. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10421. }
  10422. const computed = extractKeys(instance, "computed");
  10423. if (computed) {
  10424. blocks.push(createInstanceBlock("computed", computed));
  10425. }
  10426. const injected = extractKeys(instance, "inject");
  10427. if (injected) {
  10428. blocks.push(createInstanceBlock("injected", injected));
  10429. }
  10430. blocks.push([
  10431. "div",
  10432. {},
  10433. [
  10434. "span",
  10435. {
  10436. style: keywordStyle.style + ";opacity:0.66"
  10437. },
  10438. "$ (internal): "
  10439. ],
  10440. ["object", { object: instance }]
  10441. ]);
  10442. return blocks;
  10443. }
  10444. function createInstanceBlock(type, target) {
  10445. target = extend({}, target);
  10446. if (!Object.keys(target).length) {
  10447. return ["span", {}];
  10448. }
  10449. return [
  10450. "div",
  10451. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10452. [
  10453. "div",
  10454. {
  10455. style: "color:#476582"
  10456. },
  10457. type
  10458. ],
  10459. [
  10460. "div",
  10461. {
  10462. style: "padding-left:1.25em"
  10463. },
  10464. ...Object.keys(target).map((key) => {
  10465. return [
  10466. "div",
  10467. {},
  10468. ["span", keywordStyle, key + ": "],
  10469. formatValue(target[key], false)
  10470. ];
  10471. })
  10472. ]
  10473. ];
  10474. }
  10475. function formatValue(v, asRaw = true) {
  10476. if (typeof v === "number") {
  10477. return ["span", numberStyle, v];
  10478. } else if (typeof v === "string") {
  10479. return ["span", stringStyle, JSON.stringify(v)];
  10480. } else if (typeof v === "boolean") {
  10481. return ["span", keywordStyle, v];
  10482. } else if (isObject(v)) {
  10483. return ["object", { object: asRaw ? toRaw(v) : v }];
  10484. } else {
  10485. return ["span", stringStyle, String(v)];
  10486. }
  10487. }
  10488. function extractKeys(instance, type) {
  10489. const Comp = instance.type;
  10490. if (isFunction(Comp)) {
  10491. return;
  10492. }
  10493. const extracted = {};
  10494. for (const key in instance.ctx) {
  10495. if (isKeyOfType(Comp, key, type)) {
  10496. extracted[key] = instance.ctx[key];
  10497. }
  10498. }
  10499. return extracted;
  10500. }
  10501. function isKeyOfType(Comp, key, type) {
  10502. const opts = Comp[type];
  10503. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10504. return true;
  10505. }
  10506. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10507. return true;
  10508. }
  10509. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10510. return true;
  10511. }
  10512. }
  10513. function genRefFlag(v) {
  10514. if (isShallow(v)) {
  10515. return `ShallowRef`;
  10516. }
  10517. if (v.effect) {
  10518. return `ComputedRef`;
  10519. }
  10520. return `Ref`;
  10521. }
  10522. if (window.devtoolsFormatters) {
  10523. window.devtoolsFormatters.push(formatter);
  10524. } else {
  10525. window.devtoolsFormatters = [formatter];
  10526. }
  10527. }
  10528. function withMemo(memo, render, cache, index) {
  10529. const cached = cache[index];
  10530. if (cached && isMemoSame(cached, memo)) {
  10531. return cached;
  10532. }
  10533. const ret = render();
  10534. ret.memo = memo.slice();
  10535. ret.cacheIndex = index;
  10536. return cache[index] = ret;
  10537. }
  10538. function isMemoSame(cached, memo) {
  10539. const prev = cached.memo;
  10540. if (prev.length != memo.length) {
  10541. return false;
  10542. }
  10543. for (let i = 0; i < prev.length; i++) {
  10544. if (hasChanged(prev[i], memo[i])) {
  10545. return false;
  10546. }
  10547. }
  10548. if (isBlockTreeEnabled > 0 && currentBlock) {
  10549. currentBlock.push(cached);
  10550. }
  10551. return true;
  10552. }
  10553. const version = "3.5.21";
  10554. const warn = warn$1 ;
  10555. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10556. const devtools = devtools$1 ;
  10557. const setDevtoolsHook = setDevtoolsHook$1 ;
  10558. const ssrUtils = null;
  10559. const resolveFilter = null;
  10560. const compatUtils = null;
  10561. const DeprecationTypes = null;
  10562. let policy = void 0;
  10563. const tt = typeof window !== "undefined" && window.trustedTypes;
  10564. if (tt) {
  10565. try {
  10566. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10567. createHTML: (val) => val
  10568. });
  10569. } catch (e) {
  10570. warn(`Error creating trusted types policy: ${e}`);
  10571. }
  10572. }
  10573. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10574. const svgNS = "http://www.w3.org/2000/svg";
  10575. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10576. const doc = typeof document !== "undefined" ? document : null;
  10577. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10578. const nodeOps = {
  10579. insert: (child, parent, anchor) => {
  10580. parent.insertBefore(child, anchor || null);
  10581. },
  10582. remove: (child) => {
  10583. const parent = child.parentNode;
  10584. if (parent) {
  10585. parent.removeChild(child);
  10586. }
  10587. },
  10588. createElement: (tag, namespace, is, props) => {
  10589. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10590. if (tag === "select" && props && props.multiple != null) {
  10591. el.setAttribute("multiple", props.multiple);
  10592. }
  10593. return el;
  10594. },
  10595. createText: (text) => doc.createTextNode(text),
  10596. createComment: (text) => doc.createComment(text),
  10597. setText: (node, text) => {
  10598. node.nodeValue = text;
  10599. },
  10600. setElementText: (el, text) => {
  10601. el.textContent = text;
  10602. },
  10603. parentNode: (node) => node.parentNode,
  10604. nextSibling: (node) => node.nextSibling,
  10605. querySelector: (selector) => doc.querySelector(selector),
  10606. setScopeId(el, id) {
  10607. el.setAttribute(id, "");
  10608. },
  10609. // __UNSAFE__
  10610. // Reason: innerHTML.
  10611. // Static content here can only come from compiled templates.
  10612. // As long as the user only uses trusted templates, this is safe.
  10613. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10614. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10615. if (start && (start === end || start.nextSibling)) {
  10616. while (true) {
  10617. parent.insertBefore(start.cloneNode(true), anchor);
  10618. if (start === end || !(start = start.nextSibling)) break;
  10619. }
  10620. } else {
  10621. templateContainer.innerHTML = unsafeToTrustedHTML(
  10622. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10623. );
  10624. const template = templateContainer.content;
  10625. if (namespace === "svg" || namespace === "mathml") {
  10626. const wrapper = template.firstChild;
  10627. while (wrapper.firstChild) {
  10628. template.appendChild(wrapper.firstChild);
  10629. }
  10630. template.removeChild(wrapper);
  10631. }
  10632. parent.insertBefore(template, anchor);
  10633. }
  10634. return [
  10635. // first
  10636. before ? before.nextSibling : parent.firstChild,
  10637. // last
  10638. anchor ? anchor.previousSibling : parent.lastChild
  10639. ];
  10640. }
  10641. };
  10642. const TRANSITION$1 = "transition";
  10643. const ANIMATION = "animation";
  10644. const vtcKey = Symbol("_vtc");
  10645. const DOMTransitionPropsValidators = {
  10646. name: String,
  10647. type: String,
  10648. css: {
  10649. type: Boolean,
  10650. default: true
  10651. },
  10652. duration: [String, Number, Object],
  10653. enterFromClass: String,
  10654. enterActiveClass: String,
  10655. enterToClass: String,
  10656. appearFromClass: String,
  10657. appearActiveClass: String,
  10658. appearToClass: String,
  10659. leaveFromClass: String,
  10660. leaveActiveClass: String,
  10661. leaveToClass: String
  10662. };
  10663. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10664. {},
  10665. BaseTransitionPropsValidators,
  10666. DOMTransitionPropsValidators
  10667. );
  10668. const decorate$1 = (t) => {
  10669. t.displayName = "Transition";
  10670. t.props = TransitionPropsValidators;
  10671. return t;
  10672. };
  10673. const Transition = /* @__PURE__ */ decorate$1(
  10674. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10675. );
  10676. const callHook = (hook, args = []) => {
  10677. if (isArray(hook)) {
  10678. hook.forEach((h2) => h2(...args));
  10679. } else if (hook) {
  10680. hook(...args);
  10681. }
  10682. };
  10683. const hasExplicitCallback = (hook) => {
  10684. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10685. };
  10686. function resolveTransitionProps(rawProps) {
  10687. const baseProps = {};
  10688. for (const key in rawProps) {
  10689. if (!(key in DOMTransitionPropsValidators)) {
  10690. baseProps[key] = rawProps[key];
  10691. }
  10692. }
  10693. if (rawProps.css === false) {
  10694. return baseProps;
  10695. }
  10696. const {
  10697. name = "v",
  10698. type,
  10699. duration,
  10700. enterFromClass = `${name}-enter-from`,
  10701. enterActiveClass = `${name}-enter-active`,
  10702. enterToClass = `${name}-enter-to`,
  10703. appearFromClass = enterFromClass,
  10704. appearActiveClass = enterActiveClass,
  10705. appearToClass = enterToClass,
  10706. leaveFromClass = `${name}-leave-from`,
  10707. leaveActiveClass = `${name}-leave-active`,
  10708. leaveToClass = `${name}-leave-to`
  10709. } = rawProps;
  10710. const durations = normalizeDuration(duration);
  10711. const enterDuration = durations && durations[0];
  10712. const leaveDuration = durations && durations[1];
  10713. const {
  10714. onBeforeEnter,
  10715. onEnter,
  10716. onEnterCancelled,
  10717. onLeave,
  10718. onLeaveCancelled,
  10719. onBeforeAppear = onBeforeEnter,
  10720. onAppear = onEnter,
  10721. onAppearCancelled = onEnterCancelled
  10722. } = baseProps;
  10723. const finishEnter = (el, isAppear, done, isCancelled) => {
  10724. el._enterCancelled = isCancelled;
  10725. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10726. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10727. done && done();
  10728. };
  10729. const finishLeave = (el, done) => {
  10730. el._isLeaving = false;
  10731. removeTransitionClass(el, leaveFromClass);
  10732. removeTransitionClass(el, leaveToClass);
  10733. removeTransitionClass(el, leaveActiveClass);
  10734. done && done();
  10735. };
  10736. const makeEnterHook = (isAppear) => {
  10737. return (el, done) => {
  10738. const hook = isAppear ? onAppear : onEnter;
  10739. const resolve = () => finishEnter(el, isAppear, done);
  10740. callHook(hook, [el, resolve]);
  10741. nextFrame(() => {
  10742. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10743. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10744. if (!hasExplicitCallback(hook)) {
  10745. whenTransitionEnds(el, type, enterDuration, resolve);
  10746. }
  10747. });
  10748. };
  10749. };
  10750. return extend(baseProps, {
  10751. onBeforeEnter(el) {
  10752. callHook(onBeforeEnter, [el]);
  10753. addTransitionClass(el, enterFromClass);
  10754. addTransitionClass(el, enterActiveClass);
  10755. },
  10756. onBeforeAppear(el) {
  10757. callHook(onBeforeAppear, [el]);
  10758. addTransitionClass(el, appearFromClass);
  10759. addTransitionClass(el, appearActiveClass);
  10760. },
  10761. onEnter: makeEnterHook(false),
  10762. onAppear: makeEnterHook(true),
  10763. onLeave(el, done) {
  10764. el._isLeaving = true;
  10765. const resolve = () => finishLeave(el, done);
  10766. addTransitionClass(el, leaveFromClass);
  10767. if (!el._enterCancelled) {
  10768. forceReflow();
  10769. addTransitionClass(el, leaveActiveClass);
  10770. } else {
  10771. addTransitionClass(el, leaveActiveClass);
  10772. forceReflow();
  10773. }
  10774. nextFrame(() => {
  10775. if (!el._isLeaving) {
  10776. return;
  10777. }
  10778. removeTransitionClass(el, leaveFromClass);
  10779. addTransitionClass(el, leaveToClass);
  10780. if (!hasExplicitCallback(onLeave)) {
  10781. whenTransitionEnds(el, type, leaveDuration, resolve);
  10782. }
  10783. });
  10784. callHook(onLeave, [el, resolve]);
  10785. },
  10786. onEnterCancelled(el) {
  10787. finishEnter(el, false, void 0, true);
  10788. callHook(onEnterCancelled, [el]);
  10789. },
  10790. onAppearCancelled(el) {
  10791. finishEnter(el, true, void 0, true);
  10792. callHook(onAppearCancelled, [el]);
  10793. },
  10794. onLeaveCancelled(el) {
  10795. finishLeave(el);
  10796. callHook(onLeaveCancelled, [el]);
  10797. }
  10798. });
  10799. }
  10800. function normalizeDuration(duration) {
  10801. if (duration == null) {
  10802. return null;
  10803. } else if (isObject(duration)) {
  10804. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  10805. } else {
  10806. const n = NumberOf(duration);
  10807. return [n, n];
  10808. }
  10809. }
  10810. function NumberOf(val) {
  10811. const res = toNumber(val);
  10812. {
  10813. assertNumber(res, "<transition> explicit duration");
  10814. }
  10815. return res;
  10816. }
  10817. function addTransitionClass(el, cls) {
  10818. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  10819. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  10820. }
  10821. function removeTransitionClass(el, cls) {
  10822. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  10823. const _vtc = el[vtcKey];
  10824. if (_vtc) {
  10825. _vtc.delete(cls);
  10826. if (!_vtc.size) {
  10827. el[vtcKey] = void 0;
  10828. }
  10829. }
  10830. }
  10831. function nextFrame(cb) {
  10832. requestAnimationFrame(() => {
  10833. requestAnimationFrame(cb);
  10834. });
  10835. }
  10836. let endId = 0;
  10837. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  10838. const id = el._endId = ++endId;
  10839. const resolveIfNotStale = () => {
  10840. if (id === el._endId) {
  10841. resolve();
  10842. }
  10843. };
  10844. if (explicitTimeout != null) {
  10845. return setTimeout(resolveIfNotStale, explicitTimeout);
  10846. }
  10847. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  10848. if (!type) {
  10849. return resolve();
  10850. }
  10851. const endEvent = type + "end";
  10852. let ended = 0;
  10853. const end = () => {
  10854. el.removeEventListener(endEvent, onEnd);
  10855. resolveIfNotStale();
  10856. };
  10857. const onEnd = (e) => {
  10858. if (e.target === el && ++ended >= propCount) {
  10859. end();
  10860. }
  10861. };
  10862. setTimeout(() => {
  10863. if (ended < propCount) {
  10864. end();
  10865. }
  10866. }, timeout + 1);
  10867. el.addEventListener(endEvent, onEnd);
  10868. }
  10869. function getTransitionInfo(el, expectedType) {
  10870. const styles = window.getComputedStyle(el);
  10871. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  10872. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  10873. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  10874. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  10875. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  10876. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  10877. const animationTimeout = getTimeout(animationDelays, animationDurations);
  10878. let type = null;
  10879. let timeout = 0;
  10880. let propCount = 0;
  10881. if (expectedType === TRANSITION$1) {
  10882. if (transitionTimeout > 0) {
  10883. type = TRANSITION$1;
  10884. timeout = transitionTimeout;
  10885. propCount = transitionDurations.length;
  10886. }
  10887. } else if (expectedType === ANIMATION) {
  10888. if (animationTimeout > 0) {
  10889. type = ANIMATION;
  10890. timeout = animationTimeout;
  10891. propCount = animationDurations.length;
  10892. }
  10893. } else {
  10894. timeout = Math.max(transitionTimeout, animationTimeout);
  10895. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  10896. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  10897. }
  10898. const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
  10899. getStyleProperties(`${TRANSITION$1}Property`).toString()
  10900. );
  10901. return {
  10902. type,
  10903. timeout,
  10904. propCount,
  10905. hasTransform
  10906. };
  10907. }
  10908. function getTimeout(delays, durations) {
  10909. while (delays.length < durations.length) {
  10910. delays = delays.concat(delays);
  10911. }
  10912. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  10913. }
  10914. function toMs(s) {
  10915. if (s === "auto") return 0;
  10916. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  10917. }
  10918. function forceReflow() {
  10919. return document.body.offsetHeight;
  10920. }
  10921. function patchClass(el, value, isSVG) {
  10922. const transitionClasses = el[vtcKey];
  10923. if (transitionClasses) {
  10924. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  10925. }
  10926. if (value == null) {
  10927. el.removeAttribute("class");
  10928. } else if (isSVG) {
  10929. el.setAttribute("class", value);
  10930. } else {
  10931. el.className = value;
  10932. }
  10933. }
  10934. const vShowOriginalDisplay = Symbol("_vod");
  10935. const vShowHidden = Symbol("_vsh");
  10936. const vShow = {
  10937. // used for prop mismatch check during hydration
  10938. name: "show",
  10939. beforeMount(el, { value }, { transition }) {
  10940. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  10941. if (transition && value) {
  10942. transition.beforeEnter(el);
  10943. } else {
  10944. setDisplay(el, value);
  10945. }
  10946. },
  10947. mounted(el, { value }, { transition }) {
  10948. if (transition && value) {
  10949. transition.enter(el);
  10950. }
  10951. },
  10952. updated(el, { value, oldValue }, { transition }) {
  10953. if (!value === !oldValue) return;
  10954. if (transition) {
  10955. if (value) {
  10956. transition.beforeEnter(el);
  10957. setDisplay(el, true);
  10958. transition.enter(el);
  10959. } else {
  10960. transition.leave(el, () => {
  10961. setDisplay(el, false);
  10962. });
  10963. }
  10964. } else {
  10965. setDisplay(el, value);
  10966. }
  10967. },
  10968. beforeUnmount(el, { value }) {
  10969. setDisplay(el, value);
  10970. }
  10971. };
  10972. function setDisplay(el, value) {
  10973. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10974. el[vShowHidden] = !value;
  10975. }
  10976. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10977. function useCssVars(getter) {
  10978. const instance = getCurrentInstance();
  10979. if (!instance) {
  10980. warn(`useCssVars is called without current active component instance.`);
  10981. return;
  10982. }
  10983. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10984. Array.from(
  10985. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10986. ).forEach((node) => setVarsOnNode(node, vars));
  10987. };
  10988. {
  10989. instance.getCssVars = () => getter(instance.proxy);
  10990. }
  10991. const setVars = () => {
  10992. const vars = getter(instance.proxy);
  10993. if (instance.ce) {
  10994. setVarsOnNode(instance.ce, vars);
  10995. } else {
  10996. setVarsOnVNode(instance.subTree, vars);
  10997. }
  10998. updateTeleports(vars);
  10999. };
  11000. onBeforeUpdate(() => {
  11001. queuePostFlushCb(setVars);
  11002. });
  11003. onMounted(() => {
  11004. watch(setVars, NOOP, { flush: "post" });
  11005. const ob = new MutationObserver(setVars);
  11006. ob.observe(instance.subTree.el.parentNode, { childList: true });
  11007. onUnmounted(() => ob.disconnect());
  11008. });
  11009. }
  11010. function setVarsOnVNode(vnode, vars) {
  11011. if (vnode.shapeFlag & 128) {
  11012. const suspense = vnode.suspense;
  11013. vnode = suspense.activeBranch;
  11014. if (suspense.pendingBranch && !suspense.isHydrating) {
  11015. suspense.effects.push(() => {
  11016. setVarsOnVNode(suspense.activeBranch, vars);
  11017. });
  11018. }
  11019. }
  11020. while (vnode.component) {
  11021. vnode = vnode.component.subTree;
  11022. }
  11023. if (vnode.shapeFlag & 1 && vnode.el) {
  11024. setVarsOnNode(vnode.el, vars);
  11025. } else if (vnode.type === Fragment) {
  11026. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  11027. } else if (vnode.type === Static) {
  11028. let { el, anchor } = vnode;
  11029. while (el) {
  11030. setVarsOnNode(el, vars);
  11031. if (el === anchor) break;
  11032. el = el.nextSibling;
  11033. }
  11034. }
  11035. }
  11036. function setVarsOnNode(el, vars) {
  11037. if (el.nodeType === 1) {
  11038. const style = el.style;
  11039. let cssText = "";
  11040. for (const key in vars) {
  11041. const value = normalizeCssVarValue(vars[key]);
  11042. style.setProperty(`--${key}`, value);
  11043. cssText += `--${key}: ${value};`;
  11044. }
  11045. style[CSS_VAR_TEXT] = cssText;
  11046. }
  11047. }
  11048. const displayRE = /(?:^|;)\s*display\s*:/;
  11049. function patchStyle(el, prev, next) {
  11050. const style = el.style;
  11051. const isCssString = isString(next);
  11052. let hasControlledDisplay = false;
  11053. if (next && !isCssString) {
  11054. if (prev) {
  11055. if (!isString(prev)) {
  11056. for (const key in prev) {
  11057. if (next[key] == null) {
  11058. setStyle(style, key, "");
  11059. }
  11060. }
  11061. } else {
  11062. for (const prevStyle of prev.split(";")) {
  11063. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  11064. if (next[key] == null) {
  11065. setStyle(style, key, "");
  11066. }
  11067. }
  11068. }
  11069. }
  11070. for (const key in next) {
  11071. if (key === "display") {
  11072. hasControlledDisplay = true;
  11073. }
  11074. setStyle(style, key, next[key]);
  11075. }
  11076. } else {
  11077. if (isCssString) {
  11078. if (prev !== next) {
  11079. const cssVarText = style[CSS_VAR_TEXT];
  11080. if (cssVarText) {
  11081. next += ";" + cssVarText;
  11082. }
  11083. style.cssText = next;
  11084. hasControlledDisplay = displayRE.test(next);
  11085. }
  11086. } else if (prev) {
  11087. el.removeAttribute("style");
  11088. }
  11089. }
  11090. if (vShowOriginalDisplay in el) {
  11091. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  11092. if (el[vShowHidden]) {
  11093. style.display = "none";
  11094. }
  11095. }
  11096. }
  11097. const semicolonRE = /[^\\];\s*$/;
  11098. const importantRE = /\s*!important$/;
  11099. function setStyle(style, name, val) {
  11100. if (isArray(val)) {
  11101. val.forEach((v) => setStyle(style, name, v));
  11102. } else {
  11103. if (val == null) val = "";
  11104. {
  11105. if (semicolonRE.test(val)) {
  11106. warn(
  11107. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  11108. );
  11109. }
  11110. }
  11111. if (name.startsWith("--")) {
  11112. style.setProperty(name, val);
  11113. } else {
  11114. const prefixed = autoPrefix(style, name);
  11115. if (importantRE.test(val)) {
  11116. style.setProperty(
  11117. hyphenate(prefixed),
  11118. val.replace(importantRE, ""),
  11119. "important"
  11120. );
  11121. } else {
  11122. style[prefixed] = val;
  11123. }
  11124. }
  11125. }
  11126. }
  11127. const prefixes = ["Webkit", "Moz", "ms"];
  11128. const prefixCache = {};
  11129. function autoPrefix(style, rawName) {
  11130. const cached = prefixCache[rawName];
  11131. if (cached) {
  11132. return cached;
  11133. }
  11134. let name = camelize(rawName);
  11135. if (name !== "filter" && name in style) {
  11136. return prefixCache[rawName] = name;
  11137. }
  11138. name = capitalize(name);
  11139. for (let i = 0; i < prefixes.length; i++) {
  11140. const prefixed = prefixes[i] + name;
  11141. if (prefixed in style) {
  11142. return prefixCache[rawName] = prefixed;
  11143. }
  11144. }
  11145. return rawName;
  11146. }
  11147. const xlinkNS = "http://www.w3.org/1999/xlink";
  11148. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11149. if (isSVG && key.startsWith("xlink:")) {
  11150. if (value == null) {
  11151. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11152. } else {
  11153. el.setAttributeNS(xlinkNS, key, value);
  11154. }
  11155. } else {
  11156. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11157. el.removeAttribute(key);
  11158. } else {
  11159. el.setAttribute(
  11160. key,
  11161. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11162. );
  11163. }
  11164. }
  11165. }
  11166. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11167. if (key === "innerHTML" || key === "textContent") {
  11168. if (value != null) {
  11169. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11170. }
  11171. return;
  11172. }
  11173. const tag = el.tagName;
  11174. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11175. !tag.includes("-")) {
  11176. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11177. const newValue = value == null ? (
  11178. // #11647: value should be set as empty string for null and undefined,
  11179. // but <input type="checkbox"> should be set as 'on'.
  11180. el.type === "checkbox" ? "on" : ""
  11181. ) : String(value);
  11182. if (oldValue !== newValue || !("_value" in el)) {
  11183. el.value = newValue;
  11184. }
  11185. if (value == null) {
  11186. el.removeAttribute(key);
  11187. }
  11188. el._value = value;
  11189. return;
  11190. }
  11191. let needRemove = false;
  11192. if (value === "" || value == null) {
  11193. const type = typeof el[key];
  11194. if (type === "boolean") {
  11195. value = includeBooleanAttr(value);
  11196. } else if (value == null && type === "string") {
  11197. value = "";
  11198. needRemove = true;
  11199. } else if (type === "number") {
  11200. value = 0;
  11201. needRemove = true;
  11202. }
  11203. }
  11204. try {
  11205. el[key] = value;
  11206. } catch (e) {
  11207. if (!needRemove) {
  11208. warn(
  11209. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11210. e
  11211. );
  11212. }
  11213. }
  11214. needRemove && el.removeAttribute(attrName || key);
  11215. }
  11216. function addEventListener(el, event, handler, options) {
  11217. el.addEventListener(event, handler, options);
  11218. }
  11219. function removeEventListener(el, event, handler, options) {
  11220. el.removeEventListener(event, handler, options);
  11221. }
  11222. const veiKey = Symbol("_vei");
  11223. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11224. const invokers = el[veiKey] || (el[veiKey] = {});
  11225. const existingInvoker = invokers[rawName];
  11226. if (nextValue && existingInvoker) {
  11227. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11228. } else {
  11229. const [name, options] = parseName(rawName);
  11230. if (nextValue) {
  11231. const invoker = invokers[rawName] = createInvoker(
  11232. sanitizeEventValue(nextValue, rawName) ,
  11233. instance
  11234. );
  11235. addEventListener(el, name, invoker, options);
  11236. } else if (existingInvoker) {
  11237. removeEventListener(el, name, existingInvoker, options);
  11238. invokers[rawName] = void 0;
  11239. }
  11240. }
  11241. }
  11242. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11243. function parseName(name) {
  11244. let options;
  11245. if (optionsModifierRE.test(name)) {
  11246. options = {};
  11247. let m;
  11248. while (m = name.match(optionsModifierRE)) {
  11249. name = name.slice(0, name.length - m[0].length);
  11250. options[m[0].toLowerCase()] = true;
  11251. }
  11252. }
  11253. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11254. return [event, options];
  11255. }
  11256. let cachedNow = 0;
  11257. const p = /* @__PURE__ */ Promise.resolve();
  11258. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11259. function createInvoker(initialValue, instance) {
  11260. const invoker = (e) => {
  11261. if (!e._vts) {
  11262. e._vts = Date.now();
  11263. } else if (e._vts <= invoker.attached) {
  11264. return;
  11265. }
  11266. callWithAsyncErrorHandling(
  11267. patchStopImmediatePropagation(e, invoker.value),
  11268. instance,
  11269. 5,
  11270. [e]
  11271. );
  11272. };
  11273. invoker.value = initialValue;
  11274. invoker.attached = getNow();
  11275. return invoker;
  11276. }
  11277. function sanitizeEventValue(value, propName) {
  11278. if (isFunction(value) || isArray(value)) {
  11279. return value;
  11280. }
  11281. warn(
  11282. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11283. Expected function or array of functions, received type ${typeof value}.`
  11284. );
  11285. return NOOP;
  11286. }
  11287. function patchStopImmediatePropagation(e, value) {
  11288. if (isArray(value)) {
  11289. const originalStop = e.stopImmediatePropagation;
  11290. e.stopImmediatePropagation = () => {
  11291. originalStop.call(e);
  11292. e._stopped = true;
  11293. };
  11294. return value.map(
  11295. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11296. );
  11297. } else {
  11298. return value;
  11299. }
  11300. }
  11301. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11302. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11303. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11304. const isSVG = namespace === "svg";
  11305. if (key === "class") {
  11306. patchClass(el, nextValue, isSVG);
  11307. } else if (key === "style") {
  11308. patchStyle(el, prevValue, nextValue);
  11309. } else if (isOn(key)) {
  11310. if (!isModelListener(key)) {
  11311. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11312. }
  11313. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11314. patchDOMProp(el, key, nextValue);
  11315. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11316. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11317. }
  11318. } else if (
  11319. // #11081 force set props for possible async custom element
  11320. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  11321. ) {
  11322. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11323. } else {
  11324. if (key === "true-value") {
  11325. el._trueValue = nextValue;
  11326. } else if (key === "false-value") {
  11327. el._falseValue = nextValue;
  11328. }
  11329. patchAttr(el, key, nextValue, isSVG);
  11330. }
  11331. };
  11332. function shouldSetAsProp(el, key, value, isSVG) {
  11333. if (isSVG) {
  11334. if (key === "innerHTML" || key === "textContent") {
  11335. return true;
  11336. }
  11337. if (key in el && isNativeOn(key) && isFunction(value)) {
  11338. return true;
  11339. }
  11340. return false;
  11341. }
  11342. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  11343. return false;
  11344. }
  11345. if (key === "form") {
  11346. return false;
  11347. }
  11348. if (key === "list" && el.tagName === "INPUT") {
  11349. return false;
  11350. }
  11351. if (key === "type" && el.tagName === "TEXTAREA") {
  11352. return false;
  11353. }
  11354. if (key === "width" || key === "height") {
  11355. const tag = el.tagName;
  11356. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11357. return false;
  11358. }
  11359. }
  11360. if (isNativeOn(key) && isString(value)) {
  11361. return false;
  11362. }
  11363. return key in el;
  11364. }
  11365. const REMOVAL = {};
  11366. // @__NO_SIDE_EFFECTS__
  11367. function defineCustomElement(options, extraOptions, _createApp) {
  11368. let Comp = defineComponent(options, extraOptions);
  11369. if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
  11370. class VueCustomElement extends VueElement {
  11371. constructor(initialProps) {
  11372. super(Comp, initialProps, _createApp);
  11373. }
  11374. }
  11375. VueCustomElement.def = Comp;
  11376. return VueCustomElement;
  11377. }
  11378. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11379. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11380. });
  11381. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11382. };
  11383. class VueElement extends BaseClass {
  11384. constructor(_def, _props = {}, _createApp = createApp) {
  11385. super();
  11386. this._def = _def;
  11387. this._props = _props;
  11388. this._createApp = _createApp;
  11389. this._isVueCE = true;
  11390. /**
  11391. * @internal
  11392. */
  11393. this._instance = null;
  11394. /**
  11395. * @internal
  11396. */
  11397. this._app = null;
  11398. /**
  11399. * @internal
  11400. */
  11401. this._nonce = this._def.nonce;
  11402. this._connected = false;
  11403. this._resolved = false;
  11404. this._numberProps = null;
  11405. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11406. this._ob = null;
  11407. if (this.shadowRoot && _createApp !== createApp) {
  11408. this._root = this.shadowRoot;
  11409. } else {
  11410. if (this.shadowRoot) {
  11411. warn(
  11412. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11413. );
  11414. }
  11415. if (_def.shadowRoot !== false) {
  11416. this.attachShadow({ mode: "open" });
  11417. this._root = this.shadowRoot;
  11418. } else {
  11419. this._root = this;
  11420. }
  11421. }
  11422. }
  11423. connectedCallback() {
  11424. if (!this.isConnected) return;
  11425. if (!this.shadowRoot && !this._resolved) {
  11426. this._parseSlots();
  11427. }
  11428. this._connected = true;
  11429. let parent = this;
  11430. while (parent = parent && (parent.parentNode || parent.host)) {
  11431. if (parent instanceof VueElement) {
  11432. this._parent = parent;
  11433. break;
  11434. }
  11435. }
  11436. if (!this._instance) {
  11437. if (this._resolved) {
  11438. this._mount(this._def);
  11439. } else {
  11440. if (parent && parent._pendingResolve) {
  11441. this._pendingResolve = parent._pendingResolve.then(() => {
  11442. this._pendingResolve = void 0;
  11443. this._resolveDef();
  11444. });
  11445. } else {
  11446. this._resolveDef();
  11447. }
  11448. }
  11449. }
  11450. }
  11451. _setParent(parent = this._parent) {
  11452. if (parent) {
  11453. this._instance.parent = parent._instance;
  11454. this._inheritParentContext(parent);
  11455. }
  11456. }
  11457. _inheritParentContext(parent = this._parent) {
  11458. if (parent && this._app) {
  11459. Object.setPrototypeOf(
  11460. this._app._context.provides,
  11461. parent._instance.provides
  11462. );
  11463. }
  11464. }
  11465. disconnectedCallback() {
  11466. this._connected = false;
  11467. nextTick(() => {
  11468. if (!this._connected) {
  11469. if (this._ob) {
  11470. this._ob.disconnect();
  11471. this._ob = null;
  11472. }
  11473. this._app && this._app.unmount();
  11474. if (this._instance) this._instance.ce = void 0;
  11475. this._app = this._instance = null;
  11476. }
  11477. });
  11478. }
  11479. /**
  11480. * resolve inner component definition (handle possible async component)
  11481. */
  11482. _resolveDef() {
  11483. if (this._pendingResolve) {
  11484. return;
  11485. }
  11486. for (let i = 0; i < this.attributes.length; i++) {
  11487. this._setAttr(this.attributes[i].name);
  11488. }
  11489. this._ob = new MutationObserver((mutations) => {
  11490. for (const m of mutations) {
  11491. this._setAttr(m.attributeName);
  11492. }
  11493. });
  11494. this._ob.observe(this, { attributes: true });
  11495. const resolve = (def, isAsync = false) => {
  11496. this._resolved = true;
  11497. this._pendingResolve = void 0;
  11498. const { props, styles } = def;
  11499. let numberProps;
  11500. if (props && !isArray(props)) {
  11501. for (const key in props) {
  11502. const opt = props[key];
  11503. if (opt === Number || opt && opt.type === Number) {
  11504. if (key in this._props) {
  11505. this._props[key] = toNumber(this._props[key]);
  11506. }
  11507. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11508. }
  11509. }
  11510. }
  11511. this._numberProps = numberProps;
  11512. this._resolveProps(def);
  11513. if (this.shadowRoot) {
  11514. this._applyStyles(styles);
  11515. } else if (styles) {
  11516. warn(
  11517. "Custom element style injection is not supported when using shadowRoot: false"
  11518. );
  11519. }
  11520. this._mount(def);
  11521. };
  11522. const asyncDef = this._def.__asyncLoader;
  11523. if (asyncDef) {
  11524. this._pendingResolve = asyncDef().then((def) => {
  11525. def.configureApp = this._def.configureApp;
  11526. resolve(this._def = def, true);
  11527. });
  11528. } else {
  11529. resolve(this._def);
  11530. }
  11531. }
  11532. _mount(def) {
  11533. if (!def.name) {
  11534. def.name = "VueElement";
  11535. }
  11536. this._app = this._createApp(def);
  11537. this._inheritParentContext();
  11538. if (def.configureApp) {
  11539. def.configureApp(this._app);
  11540. }
  11541. this._app._ceVNode = this._createVNode();
  11542. this._app.mount(this._root);
  11543. const exposed = this._instance && this._instance.exposed;
  11544. if (!exposed) return;
  11545. for (const key in exposed) {
  11546. if (!hasOwn(this, key)) {
  11547. Object.defineProperty(this, key, {
  11548. // unwrap ref to be consistent with public instance behavior
  11549. get: () => unref(exposed[key])
  11550. });
  11551. } else {
  11552. warn(`Exposed property "${key}" already exists on custom element.`);
  11553. }
  11554. }
  11555. }
  11556. _resolveProps(def) {
  11557. const { props } = def;
  11558. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11559. for (const key of Object.keys(this)) {
  11560. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11561. this._setProp(key, this[key]);
  11562. }
  11563. }
  11564. for (const key of declaredPropKeys.map(camelize)) {
  11565. Object.defineProperty(this, key, {
  11566. get() {
  11567. return this._getProp(key);
  11568. },
  11569. set(val) {
  11570. this._setProp(key, val, true, true);
  11571. }
  11572. });
  11573. }
  11574. }
  11575. _setAttr(key) {
  11576. if (key.startsWith("data-v-")) return;
  11577. const has = this.hasAttribute(key);
  11578. let value = has ? this.getAttribute(key) : REMOVAL;
  11579. const camelKey = camelize(key);
  11580. if (has && this._numberProps && this._numberProps[camelKey]) {
  11581. value = toNumber(value);
  11582. }
  11583. this._setProp(camelKey, value, false, true);
  11584. }
  11585. /**
  11586. * @internal
  11587. */
  11588. _getProp(key) {
  11589. return this._props[key];
  11590. }
  11591. /**
  11592. * @internal
  11593. */
  11594. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11595. if (val !== this._props[key]) {
  11596. if (val === REMOVAL) {
  11597. delete this._props[key];
  11598. } else {
  11599. this._props[key] = val;
  11600. if (key === "key" && this._app) {
  11601. this._app._ceVNode.key = val;
  11602. }
  11603. }
  11604. if (shouldUpdate && this._instance) {
  11605. this._update();
  11606. }
  11607. if (shouldReflect) {
  11608. const ob = this._ob;
  11609. ob && ob.disconnect();
  11610. if (val === true) {
  11611. this.setAttribute(hyphenate(key), "");
  11612. } else if (typeof val === "string" || typeof val === "number") {
  11613. this.setAttribute(hyphenate(key), val + "");
  11614. } else if (!val) {
  11615. this.removeAttribute(hyphenate(key));
  11616. }
  11617. ob && ob.observe(this, { attributes: true });
  11618. }
  11619. }
  11620. }
  11621. _update() {
  11622. const vnode = this._createVNode();
  11623. if (this._app) vnode.appContext = this._app._context;
  11624. render(vnode, this._root);
  11625. }
  11626. _createVNode() {
  11627. const baseProps = {};
  11628. if (!this.shadowRoot) {
  11629. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11630. }
  11631. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11632. if (!this._instance) {
  11633. vnode.ce = (instance) => {
  11634. this._instance = instance;
  11635. instance.ce = this;
  11636. instance.isCE = true;
  11637. {
  11638. instance.ceReload = (newStyles) => {
  11639. if (this._styles) {
  11640. this._styles.forEach((s) => this._root.removeChild(s));
  11641. this._styles.length = 0;
  11642. }
  11643. this._applyStyles(newStyles);
  11644. this._instance = null;
  11645. this._update();
  11646. };
  11647. }
  11648. const dispatch = (event, args) => {
  11649. this.dispatchEvent(
  11650. new CustomEvent(
  11651. event,
  11652. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11653. )
  11654. );
  11655. };
  11656. instance.emit = (event, ...args) => {
  11657. dispatch(event, args);
  11658. if (hyphenate(event) !== event) {
  11659. dispatch(hyphenate(event), args);
  11660. }
  11661. };
  11662. this._setParent();
  11663. };
  11664. }
  11665. return vnode;
  11666. }
  11667. _applyStyles(styles, owner) {
  11668. if (!styles) return;
  11669. if (owner) {
  11670. if (owner === this._def || this._styleChildren.has(owner)) {
  11671. return;
  11672. }
  11673. this._styleChildren.add(owner);
  11674. }
  11675. const nonce = this._nonce;
  11676. for (let i = styles.length - 1; i >= 0; i--) {
  11677. const s = document.createElement("style");
  11678. if (nonce) s.setAttribute("nonce", nonce);
  11679. s.textContent = styles[i];
  11680. this.shadowRoot.prepend(s);
  11681. {
  11682. if (owner) {
  11683. if (owner.__hmrId) {
  11684. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11685. let entry = this._childStyles.get(owner.__hmrId);
  11686. if (!entry) {
  11687. this._childStyles.set(owner.__hmrId, entry = []);
  11688. }
  11689. entry.push(s);
  11690. }
  11691. } else {
  11692. (this._styles || (this._styles = [])).push(s);
  11693. }
  11694. }
  11695. }
  11696. }
  11697. /**
  11698. * Only called when shadowRoot is false
  11699. */
  11700. _parseSlots() {
  11701. const slots = this._slots = {};
  11702. let n;
  11703. while (n = this.firstChild) {
  11704. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11705. (slots[slotName] || (slots[slotName] = [])).push(n);
  11706. this.removeChild(n);
  11707. }
  11708. }
  11709. /**
  11710. * Only called when shadowRoot is false
  11711. */
  11712. _renderSlots() {
  11713. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  11714. const scopeId = this._instance.type.__scopeId;
  11715. for (let i = 0; i < outlets.length; i++) {
  11716. const o = outlets[i];
  11717. const slotName = o.getAttribute("name") || "default";
  11718. const content = this._slots[slotName];
  11719. const parent = o.parentNode;
  11720. if (content) {
  11721. for (const n of content) {
  11722. if (scopeId && n.nodeType === 1) {
  11723. const id = scopeId + "-s";
  11724. const walker = document.createTreeWalker(n, 1);
  11725. n.setAttribute(id, "");
  11726. let child;
  11727. while (child = walker.nextNode()) {
  11728. child.setAttribute(id, "");
  11729. }
  11730. }
  11731. parent.insertBefore(n, o);
  11732. }
  11733. } else {
  11734. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  11735. }
  11736. parent.removeChild(o);
  11737. }
  11738. }
  11739. /**
  11740. * @internal
  11741. */
  11742. _injectChildStyle(comp) {
  11743. this._applyStyles(comp.styles, comp);
  11744. }
  11745. /**
  11746. * @internal
  11747. */
  11748. _removeChildStyle(comp) {
  11749. {
  11750. this._styleChildren.delete(comp);
  11751. if (this._childStyles && comp.__hmrId) {
  11752. const oldStyles = this._childStyles.get(comp.__hmrId);
  11753. if (oldStyles) {
  11754. oldStyles.forEach((s) => this._root.removeChild(s));
  11755. oldStyles.length = 0;
  11756. }
  11757. }
  11758. }
  11759. }
  11760. }
  11761. function useHost(caller) {
  11762. const instance = getCurrentInstance();
  11763. const el = instance && instance.ce;
  11764. if (el) {
  11765. return el;
  11766. } else {
  11767. if (!instance) {
  11768. warn(
  11769. `${caller || "useHost"} called without an active component instance.`
  11770. );
  11771. } else {
  11772. warn(
  11773. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  11774. );
  11775. }
  11776. }
  11777. return null;
  11778. }
  11779. function useShadowRoot() {
  11780. const el = useHost("useShadowRoot") ;
  11781. return el && el.shadowRoot;
  11782. }
  11783. function useCssModule(name = "$style") {
  11784. {
  11785. {
  11786. warn(`useCssModule() is not supported in the global build.`);
  11787. }
  11788. return EMPTY_OBJ;
  11789. }
  11790. }
  11791. const positionMap = /* @__PURE__ */ new WeakMap();
  11792. const newPositionMap = /* @__PURE__ */ new WeakMap();
  11793. const moveCbKey = Symbol("_moveCb");
  11794. const enterCbKey = Symbol("_enterCb");
  11795. const decorate = (t) => {
  11796. delete t.props.mode;
  11797. return t;
  11798. };
  11799. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  11800. name: "TransitionGroup",
  11801. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  11802. tag: String,
  11803. moveClass: String
  11804. }),
  11805. setup(props, { slots }) {
  11806. const instance = getCurrentInstance();
  11807. const state = useTransitionState();
  11808. let prevChildren;
  11809. let children;
  11810. onUpdated(() => {
  11811. if (!prevChildren.length) {
  11812. return;
  11813. }
  11814. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  11815. if (!hasCSSTransform(
  11816. prevChildren[0].el,
  11817. instance.vnode.el,
  11818. moveClass
  11819. )) {
  11820. prevChildren = [];
  11821. return;
  11822. }
  11823. prevChildren.forEach(callPendingCbs);
  11824. prevChildren.forEach(recordPosition);
  11825. const movedChildren = prevChildren.filter(applyTranslation);
  11826. forceReflow();
  11827. movedChildren.forEach((c) => {
  11828. const el = c.el;
  11829. const style = el.style;
  11830. addTransitionClass(el, moveClass);
  11831. style.transform = style.webkitTransform = style.transitionDuration = "";
  11832. const cb = el[moveCbKey] = (e) => {
  11833. if (e && e.target !== el) {
  11834. return;
  11835. }
  11836. if (!e || e.propertyName.endsWith("transform")) {
  11837. el.removeEventListener("transitionend", cb);
  11838. el[moveCbKey] = null;
  11839. removeTransitionClass(el, moveClass);
  11840. }
  11841. };
  11842. el.addEventListener("transitionend", cb);
  11843. });
  11844. prevChildren = [];
  11845. });
  11846. return () => {
  11847. const rawProps = toRaw(props);
  11848. const cssTransitionProps = resolveTransitionProps(rawProps);
  11849. let tag = rawProps.tag || Fragment;
  11850. prevChildren = [];
  11851. if (children) {
  11852. for (let i = 0; i < children.length; i++) {
  11853. const child = children[i];
  11854. if (child.el && child.el instanceof Element) {
  11855. prevChildren.push(child);
  11856. setTransitionHooks(
  11857. child,
  11858. resolveTransitionHooks(
  11859. child,
  11860. cssTransitionProps,
  11861. state,
  11862. instance
  11863. )
  11864. );
  11865. positionMap.set(
  11866. child,
  11867. child.el.getBoundingClientRect()
  11868. );
  11869. }
  11870. }
  11871. }
  11872. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  11873. for (let i = 0; i < children.length; i++) {
  11874. const child = children[i];
  11875. if (child.key != null) {
  11876. setTransitionHooks(
  11877. child,
  11878. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  11879. );
  11880. } else if (child.type !== Text) {
  11881. warn(`<TransitionGroup> children must be keyed.`);
  11882. }
  11883. }
  11884. return createVNode(tag, null, children);
  11885. };
  11886. }
  11887. });
  11888. const TransitionGroup = TransitionGroupImpl;
  11889. function callPendingCbs(c) {
  11890. const el = c.el;
  11891. if (el[moveCbKey]) {
  11892. el[moveCbKey]();
  11893. }
  11894. if (el[enterCbKey]) {
  11895. el[enterCbKey]();
  11896. }
  11897. }
  11898. function recordPosition(c) {
  11899. newPositionMap.set(c, c.el.getBoundingClientRect());
  11900. }
  11901. function applyTranslation(c) {
  11902. const oldPos = positionMap.get(c);
  11903. const newPos = newPositionMap.get(c);
  11904. const dx = oldPos.left - newPos.left;
  11905. const dy = oldPos.top - newPos.top;
  11906. if (dx || dy) {
  11907. const s = c.el.style;
  11908. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  11909. s.transitionDuration = "0s";
  11910. return c;
  11911. }
  11912. }
  11913. function hasCSSTransform(el, root, moveClass) {
  11914. const clone = el.cloneNode();
  11915. const _vtc = el[vtcKey];
  11916. if (_vtc) {
  11917. _vtc.forEach((cls) => {
  11918. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  11919. });
  11920. }
  11921. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  11922. clone.style.display = "none";
  11923. const container = root.nodeType === 1 ? root : root.parentNode;
  11924. container.appendChild(clone);
  11925. const { hasTransform } = getTransitionInfo(clone);
  11926. container.removeChild(clone);
  11927. return hasTransform;
  11928. }
  11929. const getModelAssigner = (vnode) => {
  11930. const fn = vnode.props["onUpdate:modelValue"] || false;
  11931. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  11932. };
  11933. function onCompositionStart(e) {
  11934. e.target.composing = true;
  11935. }
  11936. function onCompositionEnd(e) {
  11937. const target = e.target;
  11938. if (target.composing) {
  11939. target.composing = false;
  11940. target.dispatchEvent(new Event("input"));
  11941. }
  11942. }
  11943. const assignKey = Symbol("_assign");
  11944. const vModelText = {
  11945. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  11946. el[assignKey] = getModelAssigner(vnode);
  11947. const castToNumber = number || vnode.props && vnode.props.type === "number";
  11948. addEventListener(el, lazy ? "change" : "input", (e) => {
  11949. if (e.target.composing) return;
  11950. let domValue = el.value;
  11951. if (trim) {
  11952. domValue = domValue.trim();
  11953. }
  11954. if (castToNumber) {
  11955. domValue = looseToNumber(domValue);
  11956. }
  11957. el[assignKey](domValue);
  11958. });
  11959. if (trim) {
  11960. addEventListener(el, "change", () => {
  11961. el.value = el.value.trim();
  11962. });
  11963. }
  11964. if (!lazy) {
  11965. addEventListener(el, "compositionstart", onCompositionStart);
  11966. addEventListener(el, "compositionend", onCompositionEnd);
  11967. addEventListener(el, "change", onCompositionEnd);
  11968. }
  11969. },
  11970. // set value on mounted so it's after min/max for type="range"
  11971. mounted(el, { value }) {
  11972. el.value = value == null ? "" : value;
  11973. },
  11974. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  11975. el[assignKey] = getModelAssigner(vnode);
  11976. if (el.composing) return;
  11977. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  11978. const newValue = value == null ? "" : value;
  11979. if (elValue === newValue) {
  11980. return;
  11981. }
  11982. if (document.activeElement === el && el.type !== "range") {
  11983. if (lazy && value === oldValue) {
  11984. return;
  11985. }
  11986. if (trim && el.value.trim() === newValue) {
  11987. return;
  11988. }
  11989. }
  11990. el.value = newValue;
  11991. }
  11992. };
  11993. const vModelCheckbox = {
  11994. // #4096 array checkboxes need to be deep traversed
  11995. deep: true,
  11996. created(el, _, vnode) {
  11997. el[assignKey] = getModelAssigner(vnode);
  11998. addEventListener(el, "change", () => {
  11999. const modelValue = el._modelValue;
  12000. const elementValue = getValue(el);
  12001. const checked = el.checked;
  12002. const assign = el[assignKey];
  12003. if (isArray(modelValue)) {
  12004. const index = looseIndexOf(modelValue, elementValue);
  12005. const found = index !== -1;
  12006. if (checked && !found) {
  12007. assign(modelValue.concat(elementValue));
  12008. } else if (!checked && found) {
  12009. const filtered = [...modelValue];
  12010. filtered.splice(index, 1);
  12011. assign(filtered);
  12012. }
  12013. } else if (isSet(modelValue)) {
  12014. const cloned = new Set(modelValue);
  12015. if (checked) {
  12016. cloned.add(elementValue);
  12017. } else {
  12018. cloned.delete(elementValue);
  12019. }
  12020. assign(cloned);
  12021. } else {
  12022. assign(getCheckboxValue(el, checked));
  12023. }
  12024. });
  12025. },
  12026. // set initial checked on mount to wait for true-value/false-value
  12027. mounted: setChecked,
  12028. beforeUpdate(el, binding, vnode) {
  12029. el[assignKey] = getModelAssigner(vnode);
  12030. setChecked(el, binding, vnode);
  12031. }
  12032. };
  12033. function setChecked(el, { value, oldValue }, vnode) {
  12034. el._modelValue = value;
  12035. let checked;
  12036. if (isArray(value)) {
  12037. checked = looseIndexOf(value, vnode.props.value) > -1;
  12038. } else if (isSet(value)) {
  12039. checked = value.has(vnode.props.value);
  12040. } else {
  12041. if (value === oldValue) return;
  12042. checked = looseEqual(value, getCheckboxValue(el, true));
  12043. }
  12044. if (el.checked !== checked) {
  12045. el.checked = checked;
  12046. }
  12047. }
  12048. const vModelRadio = {
  12049. created(el, { value }, vnode) {
  12050. el.checked = looseEqual(value, vnode.props.value);
  12051. el[assignKey] = getModelAssigner(vnode);
  12052. addEventListener(el, "change", () => {
  12053. el[assignKey](getValue(el));
  12054. });
  12055. },
  12056. beforeUpdate(el, { value, oldValue }, vnode) {
  12057. el[assignKey] = getModelAssigner(vnode);
  12058. if (value !== oldValue) {
  12059. el.checked = looseEqual(value, vnode.props.value);
  12060. }
  12061. }
  12062. };
  12063. const vModelSelect = {
  12064. // <select multiple> value need to be deep traversed
  12065. deep: true,
  12066. created(el, { value, modifiers: { number } }, vnode) {
  12067. const isSetModel = isSet(value);
  12068. addEventListener(el, "change", () => {
  12069. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  12070. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  12071. );
  12072. el[assignKey](
  12073. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  12074. );
  12075. el._assigning = true;
  12076. nextTick(() => {
  12077. el._assigning = false;
  12078. });
  12079. });
  12080. el[assignKey] = getModelAssigner(vnode);
  12081. },
  12082. // set value in mounted & updated because <select> relies on its children
  12083. // <option>s.
  12084. mounted(el, { value }) {
  12085. setSelected(el, value);
  12086. },
  12087. beforeUpdate(el, _binding, vnode) {
  12088. el[assignKey] = getModelAssigner(vnode);
  12089. },
  12090. updated(el, { value }) {
  12091. if (!el._assigning) {
  12092. setSelected(el, value);
  12093. }
  12094. }
  12095. };
  12096. function setSelected(el, value) {
  12097. const isMultiple = el.multiple;
  12098. const isArrayValue = isArray(value);
  12099. if (isMultiple && !isArrayValue && !isSet(value)) {
  12100. warn(
  12101. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  12102. );
  12103. return;
  12104. }
  12105. for (let i = 0, l = el.options.length; i < l; i++) {
  12106. const option = el.options[i];
  12107. const optionValue = getValue(option);
  12108. if (isMultiple) {
  12109. if (isArrayValue) {
  12110. const optionType = typeof optionValue;
  12111. if (optionType === "string" || optionType === "number") {
  12112. option.selected = value.some((v) => String(v) === String(optionValue));
  12113. } else {
  12114. option.selected = looseIndexOf(value, optionValue) > -1;
  12115. }
  12116. } else {
  12117. option.selected = value.has(optionValue);
  12118. }
  12119. } else if (looseEqual(getValue(option), value)) {
  12120. if (el.selectedIndex !== i) el.selectedIndex = i;
  12121. return;
  12122. }
  12123. }
  12124. if (!isMultiple && el.selectedIndex !== -1) {
  12125. el.selectedIndex = -1;
  12126. }
  12127. }
  12128. function getValue(el) {
  12129. return "_value" in el ? el._value : el.value;
  12130. }
  12131. function getCheckboxValue(el, checked) {
  12132. const key = checked ? "_trueValue" : "_falseValue";
  12133. return key in el ? el[key] : checked;
  12134. }
  12135. const vModelDynamic = {
  12136. created(el, binding, vnode) {
  12137. callModelHook(el, binding, vnode, null, "created");
  12138. },
  12139. mounted(el, binding, vnode) {
  12140. callModelHook(el, binding, vnode, null, "mounted");
  12141. },
  12142. beforeUpdate(el, binding, vnode, prevVNode) {
  12143. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12144. },
  12145. updated(el, binding, vnode, prevVNode) {
  12146. callModelHook(el, binding, vnode, prevVNode, "updated");
  12147. }
  12148. };
  12149. function resolveDynamicModel(tagName, type) {
  12150. switch (tagName) {
  12151. case "SELECT":
  12152. return vModelSelect;
  12153. case "TEXTAREA":
  12154. return vModelText;
  12155. default:
  12156. switch (type) {
  12157. case "checkbox":
  12158. return vModelCheckbox;
  12159. case "radio":
  12160. return vModelRadio;
  12161. default:
  12162. return vModelText;
  12163. }
  12164. }
  12165. }
  12166. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12167. const modelToUse = resolveDynamicModel(
  12168. el.tagName,
  12169. vnode.props && vnode.props.type
  12170. );
  12171. const fn = modelToUse[hook];
  12172. fn && fn(el, binding, vnode, prevVNode);
  12173. }
  12174. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12175. const modifierGuards = {
  12176. stop: (e) => e.stopPropagation(),
  12177. prevent: (e) => e.preventDefault(),
  12178. self: (e) => e.target !== e.currentTarget,
  12179. ctrl: (e) => !e.ctrlKey,
  12180. shift: (e) => !e.shiftKey,
  12181. alt: (e) => !e.altKey,
  12182. meta: (e) => !e.metaKey,
  12183. left: (e) => "button" in e && e.button !== 0,
  12184. middle: (e) => "button" in e && e.button !== 1,
  12185. right: (e) => "button" in e && e.button !== 2,
  12186. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12187. };
  12188. const withModifiers = (fn, modifiers) => {
  12189. const cache = fn._withMods || (fn._withMods = {});
  12190. const cacheKey = modifiers.join(".");
  12191. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  12192. for (let i = 0; i < modifiers.length; i++) {
  12193. const guard = modifierGuards[modifiers[i]];
  12194. if (guard && guard(event, modifiers)) return;
  12195. }
  12196. return fn(event, ...args);
  12197. }));
  12198. };
  12199. const keyNames = {
  12200. esc: "escape",
  12201. space: " ",
  12202. up: "arrow-up",
  12203. left: "arrow-left",
  12204. right: "arrow-right",
  12205. down: "arrow-down",
  12206. delete: "backspace"
  12207. };
  12208. const withKeys = (fn, modifiers) => {
  12209. const cache = fn._withKeys || (fn._withKeys = {});
  12210. const cacheKey = modifiers.join(".");
  12211. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  12212. if (!("key" in event)) {
  12213. return;
  12214. }
  12215. const eventKey = hyphenate(event.key);
  12216. if (modifiers.some(
  12217. (k) => k === eventKey || keyNames[k] === eventKey
  12218. )) {
  12219. return fn(event);
  12220. }
  12221. }));
  12222. };
  12223. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12224. let renderer;
  12225. let enabledHydration = false;
  12226. function ensureRenderer() {
  12227. return renderer || (renderer = createRenderer(rendererOptions));
  12228. }
  12229. function ensureHydrationRenderer() {
  12230. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12231. enabledHydration = true;
  12232. return renderer;
  12233. }
  12234. const render = ((...args) => {
  12235. ensureRenderer().render(...args);
  12236. });
  12237. const hydrate = ((...args) => {
  12238. ensureHydrationRenderer().hydrate(...args);
  12239. });
  12240. const createApp = ((...args) => {
  12241. const app = ensureRenderer().createApp(...args);
  12242. {
  12243. injectNativeTagCheck(app);
  12244. injectCompilerOptionsCheck(app);
  12245. }
  12246. const { mount } = app;
  12247. app.mount = (containerOrSelector) => {
  12248. const container = normalizeContainer(containerOrSelector);
  12249. if (!container) return;
  12250. const component = app._component;
  12251. if (!isFunction(component) && !component.render && !component.template) {
  12252. component.template = container.innerHTML;
  12253. }
  12254. if (container.nodeType === 1) {
  12255. container.textContent = "";
  12256. }
  12257. const proxy = mount(container, false, resolveRootNamespace(container));
  12258. if (container instanceof Element) {
  12259. container.removeAttribute("v-cloak");
  12260. container.setAttribute("data-v-app", "");
  12261. }
  12262. return proxy;
  12263. };
  12264. return app;
  12265. });
  12266. const createSSRApp = ((...args) => {
  12267. const app = ensureHydrationRenderer().createApp(...args);
  12268. {
  12269. injectNativeTagCheck(app);
  12270. injectCompilerOptionsCheck(app);
  12271. }
  12272. const { mount } = app;
  12273. app.mount = (containerOrSelector) => {
  12274. const container = normalizeContainer(containerOrSelector);
  12275. if (container) {
  12276. return mount(container, true, resolveRootNamespace(container));
  12277. }
  12278. };
  12279. return app;
  12280. });
  12281. function resolveRootNamespace(container) {
  12282. if (container instanceof SVGElement) {
  12283. return "svg";
  12284. }
  12285. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12286. return "mathml";
  12287. }
  12288. }
  12289. function injectNativeTagCheck(app) {
  12290. Object.defineProperty(app.config, "isNativeTag", {
  12291. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12292. writable: false
  12293. });
  12294. }
  12295. function injectCompilerOptionsCheck(app) {
  12296. if (isRuntimeOnly()) {
  12297. const isCustomElement = app.config.isCustomElement;
  12298. Object.defineProperty(app.config, "isCustomElement", {
  12299. get() {
  12300. return isCustomElement;
  12301. },
  12302. set() {
  12303. warn(
  12304. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12305. );
  12306. }
  12307. });
  12308. const compilerOptions = app.config.compilerOptions;
  12309. 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.
  12310. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12311. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12312. - 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`;
  12313. Object.defineProperty(app.config, "compilerOptions", {
  12314. get() {
  12315. warn(msg);
  12316. return compilerOptions;
  12317. },
  12318. set() {
  12319. warn(msg);
  12320. }
  12321. });
  12322. }
  12323. }
  12324. function normalizeContainer(container) {
  12325. if (isString(container)) {
  12326. const res = document.querySelector(container);
  12327. if (!res) {
  12328. warn(
  12329. `Failed to mount app: mount target selector "${container}" returned null.`
  12330. );
  12331. }
  12332. return res;
  12333. }
  12334. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12335. warn(
  12336. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12337. );
  12338. }
  12339. return container;
  12340. }
  12341. const initDirectivesForSSR = NOOP;
  12342. function initDev() {
  12343. {
  12344. {
  12345. console.info(
  12346. `You are running a development build of Vue.
  12347. Make sure to use the production build (*.prod.js) when deploying for production.`
  12348. );
  12349. }
  12350. initCustomFormatter();
  12351. }
  12352. }
  12353. const FRAGMENT = Symbol(`Fragment` );
  12354. const TELEPORT = Symbol(`Teleport` );
  12355. const SUSPENSE = Symbol(`Suspense` );
  12356. const KEEP_ALIVE = Symbol(`KeepAlive` );
  12357. const BASE_TRANSITION = Symbol(
  12358. `BaseTransition`
  12359. );
  12360. const OPEN_BLOCK = Symbol(`openBlock` );
  12361. const CREATE_BLOCK = Symbol(`createBlock` );
  12362. const CREATE_ELEMENT_BLOCK = Symbol(
  12363. `createElementBlock`
  12364. );
  12365. const CREATE_VNODE = Symbol(`createVNode` );
  12366. const CREATE_ELEMENT_VNODE = Symbol(
  12367. `createElementVNode`
  12368. );
  12369. const CREATE_COMMENT = Symbol(
  12370. `createCommentVNode`
  12371. );
  12372. const CREATE_TEXT = Symbol(
  12373. `createTextVNode`
  12374. );
  12375. const CREATE_STATIC = Symbol(
  12376. `createStaticVNode`
  12377. );
  12378. const RESOLVE_COMPONENT = Symbol(
  12379. `resolveComponent`
  12380. );
  12381. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  12382. `resolveDynamicComponent`
  12383. );
  12384. const RESOLVE_DIRECTIVE = Symbol(
  12385. `resolveDirective`
  12386. );
  12387. const RESOLVE_FILTER = Symbol(
  12388. `resolveFilter`
  12389. );
  12390. const WITH_DIRECTIVES = Symbol(
  12391. `withDirectives`
  12392. );
  12393. const RENDER_LIST = Symbol(`renderList` );
  12394. const RENDER_SLOT = Symbol(`renderSlot` );
  12395. const CREATE_SLOTS = Symbol(`createSlots` );
  12396. const TO_DISPLAY_STRING = Symbol(
  12397. `toDisplayString`
  12398. );
  12399. const MERGE_PROPS = Symbol(`mergeProps` );
  12400. const NORMALIZE_CLASS = Symbol(
  12401. `normalizeClass`
  12402. );
  12403. const NORMALIZE_STYLE = Symbol(
  12404. `normalizeStyle`
  12405. );
  12406. const NORMALIZE_PROPS = Symbol(
  12407. `normalizeProps`
  12408. );
  12409. const GUARD_REACTIVE_PROPS = Symbol(
  12410. `guardReactiveProps`
  12411. );
  12412. const TO_HANDLERS = Symbol(`toHandlers` );
  12413. const CAMELIZE = Symbol(`camelize` );
  12414. const CAPITALIZE = Symbol(`capitalize` );
  12415. const TO_HANDLER_KEY = Symbol(
  12416. `toHandlerKey`
  12417. );
  12418. const SET_BLOCK_TRACKING = Symbol(
  12419. `setBlockTracking`
  12420. );
  12421. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  12422. const POP_SCOPE_ID = Symbol(`popScopeId` );
  12423. const WITH_CTX = Symbol(`withCtx` );
  12424. const UNREF = Symbol(`unref` );
  12425. const IS_REF = Symbol(`isRef` );
  12426. const WITH_MEMO = Symbol(`withMemo` );
  12427. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  12428. const helperNameMap = {
  12429. [FRAGMENT]: `Fragment`,
  12430. [TELEPORT]: `Teleport`,
  12431. [SUSPENSE]: `Suspense`,
  12432. [KEEP_ALIVE]: `KeepAlive`,
  12433. [BASE_TRANSITION]: `BaseTransition`,
  12434. [OPEN_BLOCK]: `openBlock`,
  12435. [CREATE_BLOCK]: `createBlock`,
  12436. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  12437. [CREATE_VNODE]: `createVNode`,
  12438. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  12439. [CREATE_COMMENT]: `createCommentVNode`,
  12440. [CREATE_TEXT]: `createTextVNode`,
  12441. [CREATE_STATIC]: `createStaticVNode`,
  12442. [RESOLVE_COMPONENT]: `resolveComponent`,
  12443. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  12444. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  12445. [RESOLVE_FILTER]: `resolveFilter`,
  12446. [WITH_DIRECTIVES]: `withDirectives`,
  12447. [RENDER_LIST]: `renderList`,
  12448. [RENDER_SLOT]: `renderSlot`,
  12449. [CREATE_SLOTS]: `createSlots`,
  12450. [TO_DISPLAY_STRING]: `toDisplayString`,
  12451. [MERGE_PROPS]: `mergeProps`,
  12452. [NORMALIZE_CLASS]: `normalizeClass`,
  12453. [NORMALIZE_STYLE]: `normalizeStyle`,
  12454. [NORMALIZE_PROPS]: `normalizeProps`,
  12455. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  12456. [TO_HANDLERS]: `toHandlers`,
  12457. [CAMELIZE]: `camelize`,
  12458. [CAPITALIZE]: `capitalize`,
  12459. [TO_HANDLER_KEY]: `toHandlerKey`,
  12460. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  12461. [PUSH_SCOPE_ID]: `pushScopeId`,
  12462. [POP_SCOPE_ID]: `popScopeId`,
  12463. [WITH_CTX]: `withCtx`,
  12464. [UNREF]: `unref`,
  12465. [IS_REF]: `isRef`,
  12466. [WITH_MEMO]: `withMemo`,
  12467. [IS_MEMO_SAME]: `isMemoSame`
  12468. };
  12469. function registerRuntimeHelpers(helpers) {
  12470. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  12471. helperNameMap[s] = helpers[s];
  12472. });
  12473. }
  12474. const locStub = {
  12475. start: { line: 1, column: 1, offset: 0 },
  12476. end: { line: 1, column: 1, offset: 0 },
  12477. source: ""
  12478. };
  12479. function createRoot(children, source = "") {
  12480. return {
  12481. type: 0,
  12482. source,
  12483. children,
  12484. helpers: /* @__PURE__ */ new Set(),
  12485. components: [],
  12486. directives: [],
  12487. hoists: [],
  12488. imports: [],
  12489. cached: [],
  12490. temps: 0,
  12491. codegenNode: void 0,
  12492. loc: locStub
  12493. };
  12494. }
  12495. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  12496. if (context) {
  12497. if (isBlock) {
  12498. context.helper(OPEN_BLOCK);
  12499. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  12500. } else {
  12501. context.helper(getVNodeHelper(context.inSSR, isComponent));
  12502. }
  12503. if (directives) {
  12504. context.helper(WITH_DIRECTIVES);
  12505. }
  12506. }
  12507. return {
  12508. type: 13,
  12509. tag,
  12510. props,
  12511. children,
  12512. patchFlag,
  12513. dynamicProps,
  12514. directives,
  12515. isBlock,
  12516. disableTracking,
  12517. isComponent,
  12518. loc
  12519. };
  12520. }
  12521. function createArrayExpression(elements, loc = locStub) {
  12522. return {
  12523. type: 17,
  12524. loc,
  12525. elements
  12526. };
  12527. }
  12528. function createObjectExpression(properties, loc = locStub) {
  12529. return {
  12530. type: 15,
  12531. loc,
  12532. properties
  12533. };
  12534. }
  12535. function createObjectProperty(key, value) {
  12536. return {
  12537. type: 16,
  12538. loc: locStub,
  12539. key: isString(key) ? createSimpleExpression(key, true) : key,
  12540. value
  12541. };
  12542. }
  12543. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  12544. return {
  12545. type: 4,
  12546. loc,
  12547. content,
  12548. isStatic,
  12549. constType: isStatic ? 3 : constType
  12550. };
  12551. }
  12552. function createCompoundExpression(children, loc = locStub) {
  12553. return {
  12554. type: 8,
  12555. loc,
  12556. children
  12557. };
  12558. }
  12559. function createCallExpression(callee, args = [], loc = locStub) {
  12560. return {
  12561. type: 14,
  12562. loc,
  12563. callee,
  12564. arguments: args
  12565. };
  12566. }
  12567. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  12568. return {
  12569. type: 18,
  12570. params,
  12571. returns,
  12572. newline,
  12573. isSlot,
  12574. loc
  12575. };
  12576. }
  12577. function createConditionalExpression(test, consequent, alternate, newline = true) {
  12578. return {
  12579. type: 19,
  12580. test,
  12581. consequent,
  12582. alternate,
  12583. newline,
  12584. loc: locStub
  12585. };
  12586. }
  12587. function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
  12588. return {
  12589. type: 20,
  12590. index,
  12591. value,
  12592. needPauseTracking,
  12593. inVOnce,
  12594. needArraySpread: false,
  12595. loc: locStub
  12596. };
  12597. }
  12598. function createBlockStatement(body) {
  12599. return {
  12600. type: 21,
  12601. body,
  12602. loc: locStub
  12603. };
  12604. }
  12605. function getVNodeHelper(ssr, isComponent) {
  12606. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  12607. }
  12608. function getVNodeBlockHelper(ssr, isComponent) {
  12609. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  12610. }
  12611. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  12612. if (!node.isBlock) {
  12613. node.isBlock = true;
  12614. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  12615. helper(OPEN_BLOCK);
  12616. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  12617. }
  12618. }
  12619. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  12620. const defaultDelimitersClose = new Uint8Array([125, 125]);
  12621. function isTagStartChar(c) {
  12622. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  12623. }
  12624. function isWhitespace(c) {
  12625. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  12626. }
  12627. function isEndOfTagSection(c) {
  12628. return c === 47 || c === 62 || isWhitespace(c);
  12629. }
  12630. function toCharCodes(str) {
  12631. const ret = new Uint8Array(str.length);
  12632. for (let i = 0; i < str.length; i++) {
  12633. ret[i] = str.charCodeAt(i);
  12634. }
  12635. return ret;
  12636. }
  12637. const Sequences = {
  12638. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  12639. // CDATA[
  12640. CdataEnd: new Uint8Array([93, 93, 62]),
  12641. // ]]>
  12642. CommentEnd: new Uint8Array([45, 45, 62]),
  12643. // `-->`
  12644. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  12645. // `<\/script`
  12646. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  12647. // `</style`
  12648. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  12649. // `</title`
  12650. TextareaEnd: new Uint8Array([
  12651. 60,
  12652. 47,
  12653. 116,
  12654. 101,
  12655. 120,
  12656. 116,
  12657. 97,
  12658. 114,
  12659. 101,
  12660. 97
  12661. ])
  12662. // `</textarea
  12663. };
  12664. class Tokenizer {
  12665. constructor(stack, cbs) {
  12666. this.stack = stack;
  12667. this.cbs = cbs;
  12668. /** The current state the tokenizer is in. */
  12669. this.state = 1;
  12670. /** The read buffer. */
  12671. this.buffer = "";
  12672. /** The beginning of the section that is currently being read. */
  12673. this.sectionStart = 0;
  12674. /** The index within the buffer that we are currently looking at. */
  12675. this.index = 0;
  12676. /** The start of the last entity. */
  12677. this.entityStart = 0;
  12678. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  12679. this.baseState = 1;
  12680. /** For special parsing behavior inside of script and style tags. */
  12681. this.inRCDATA = false;
  12682. /** For disabling RCDATA tags handling */
  12683. this.inXML = false;
  12684. /** For disabling interpolation parsing in v-pre */
  12685. this.inVPre = false;
  12686. /** Record newline positions for fast line / column calculation */
  12687. this.newlines = [];
  12688. this.mode = 0;
  12689. this.delimiterOpen = defaultDelimitersOpen;
  12690. this.delimiterClose = defaultDelimitersClose;
  12691. this.delimiterIndex = -1;
  12692. this.currentSequence = void 0;
  12693. this.sequenceIndex = 0;
  12694. }
  12695. get inSFCRoot() {
  12696. return this.mode === 2 && this.stack.length === 0;
  12697. }
  12698. reset() {
  12699. this.state = 1;
  12700. this.mode = 0;
  12701. this.buffer = "";
  12702. this.sectionStart = 0;
  12703. this.index = 0;
  12704. this.baseState = 1;
  12705. this.inRCDATA = false;
  12706. this.currentSequence = void 0;
  12707. this.newlines.length = 0;
  12708. this.delimiterOpen = defaultDelimitersOpen;
  12709. this.delimiterClose = defaultDelimitersClose;
  12710. }
  12711. /**
  12712. * Generate Position object with line / column information using recorded
  12713. * newline positions. We know the index is always going to be an already
  12714. * processed index, so all the newlines up to this index should have been
  12715. * recorded.
  12716. */
  12717. getPos(index) {
  12718. let line = 1;
  12719. let column = index + 1;
  12720. for (let i = this.newlines.length - 1; i >= 0; i--) {
  12721. const newlineIndex = this.newlines[i];
  12722. if (index > newlineIndex) {
  12723. line = i + 2;
  12724. column = index - newlineIndex;
  12725. break;
  12726. }
  12727. }
  12728. return {
  12729. column,
  12730. line,
  12731. offset: index
  12732. };
  12733. }
  12734. peek() {
  12735. return this.buffer.charCodeAt(this.index + 1);
  12736. }
  12737. stateText(c) {
  12738. if (c === 60) {
  12739. if (this.index > this.sectionStart) {
  12740. this.cbs.ontext(this.sectionStart, this.index);
  12741. }
  12742. this.state = 5;
  12743. this.sectionStart = this.index;
  12744. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  12745. this.state = 2;
  12746. this.delimiterIndex = 0;
  12747. this.stateInterpolationOpen(c);
  12748. }
  12749. }
  12750. stateInterpolationOpen(c) {
  12751. if (c === this.delimiterOpen[this.delimiterIndex]) {
  12752. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  12753. const start = this.index + 1 - this.delimiterOpen.length;
  12754. if (start > this.sectionStart) {
  12755. this.cbs.ontext(this.sectionStart, start);
  12756. }
  12757. this.state = 3;
  12758. this.sectionStart = start;
  12759. } else {
  12760. this.delimiterIndex++;
  12761. }
  12762. } else if (this.inRCDATA) {
  12763. this.state = 32;
  12764. this.stateInRCDATA(c);
  12765. } else {
  12766. this.state = 1;
  12767. this.stateText(c);
  12768. }
  12769. }
  12770. stateInterpolation(c) {
  12771. if (c === this.delimiterClose[0]) {
  12772. this.state = 4;
  12773. this.delimiterIndex = 0;
  12774. this.stateInterpolationClose(c);
  12775. }
  12776. }
  12777. stateInterpolationClose(c) {
  12778. if (c === this.delimiterClose[this.delimiterIndex]) {
  12779. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  12780. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  12781. if (this.inRCDATA) {
  12782. this.state = 32;
  12783. } else {
  12784. this.state = 1;
  12785. }
  12786. this.sectionStart = this.index + 1;
  12787. } else {
  12788. this.delimiterIndex++;
  12789. }
  12790. } else {
  12791. this.state = 3;
  12792. this.stateInterpolation(c);
  12793. }
  12794. }
  12795. stateSpecialStartSequence(c) {
  12796. const isEnd = this.sequenceIndex === this.currentSequence.length;
  12797. const isMatch = isEnd ? (
  12798. // If we are at the end of the sequence, make sure the tag name has ended
  12799. isEndOfTagSection(c)
  12800. ) : (
  12801. // Otherwise, do a case-insensitive comparison
  12802. (c | 32) === this.currentSequence[this.sequenceIndex]
  12803. );
  12804. if (!isMatch) {
  12805. this.inRCDATA = false;
  12806. } else if (!isEnd) {
  12807. this.sequenceIndex++;
  12808. return;
  12809. }
  12810. this.sequenceIndex = 0;
  12811. this.state = 6;
  12812. this.stateInTagName(c);
  12813. }
  12814. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  12815. stateInRCDATA(c) {
  12816. if (this.sequenceIndex === this.currentSequence.length) {
  12817. if (c === 62 || isWhitespace(c)) {
  12818. const endOfText = this.index - this.currentSequence.length;
  12819. if (this.sectionStart < endOfText) {
  12820. const actualIndex = this.index;
  12821. this.index = endOfText;
  12822. this.cbs.ontext(this.sectionStart, endOfText);
  12823. this.index = actualIndex;
  12824. }
  12825. this.sectionStart = endOfText + 2;
  12826. this.stateInClosingTagName(c);
  12827. this.inRCDATA = false;
  12828. return;
  12829. }
  12830. this.sequenceIndex = 0;
  12831. }
  12832. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  12833. this.sequenceIndex += 1;
  12834. } else if (this.sequenceIndex === 0) {
  12835. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  12836. if (!this.inVPre && c === this.delimiterOpen[0]) {
  12837. this.state = 2;
  12838. this.delimiterIndex = 0;
  12839. this.stateInterpolationOpen(c);
  12840. }
  12841. } else if (this.fastForwardTo(60)) {
  12842. this.sequenceIndex = 1;
  12843. }
  12844. } else {
  12845. this.sequenceIndex = Number(c === 60);
  12846. }
  12847. }
  12848. stateCDATASequence(c) {
  12849. if (c === Sequences.Cdata[this.sequenceIndex]) {
  12850. if (++this.sequenceIndex === Sequences.Cdata.length) {
  12851. this.state = 28;
  12852. this.currentSequence = Sequences.CdataEnd;
  12853. this.sequenceIndex = 0;
  12854. this.sectionStart = this.index + 1;
  12855. }
  12856. } else {
  12857. this.sequenceIndex = 0;
  12858. this.state = 23;
  12859. this.stateInDeclaration(c);
  12860. }
  12861. }
  12862. /**
  12863. * When we wait for one specific character, we can speed things up
  12864. * by skipping through the buffer until we find it.
  12865. *
  12866. * @returns Whether the character was found.
  12867. */
  12868. fastForwardTo(c) {
  12869. while (++this.index < this.buffer.length) {
  12870. const cc = this.buffer.charCodeAt(this.index);
  12871. if (cc === 10) {
  12872. this.newlines.push(this.index);
  12873. }
  12874. if (cc === c) {
  12875. return true;
  12876. }
  12877. }
  12878. this.index = this.buffer.length - 1;
  12879. return false;
  12880. }
  12881. /**
  12882. * Comments and CDATA end with `-->` and `]]>`.
  12883. *
  12884. * Their common qualities are:
  12885. * - Their end sequences have a distinct character they start with.
  12886. * - That character is then repeated, so we have to check multiple repeats.
  12887. * - All characters but the start character of the sequence can be skipped.
  12888. */
  12889. stateInCommentLike(c) {
  12890. if (c === this.currentSequence[this.sequenceIndex]) {
  12891. if (++this.sequenceIndex === this.currentSequence.length) {
  12892. if (this.currentSequence === Sequences.CdataEnd) {
  12893. this.cbs.oncdata(this.sectionStart, this.index - 2);
  12894. } else {
  12895. this.cbs.oncomment(this.sectionStart, this.index - 2);
  12896. }
  12897. this.sequenceIndex = 0;
  12898. this.sectionStart = this.index + 1;
  12899. this.state = 1;
  12900. }
  12901. } else if (this.sequenceIndex === 0) {
  12902. if (this.fastForwardTo(this.currentSequence[0])) {
  12903. this.sequenceIndex = 1;
  12904. }
  12905. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  12906. this.sequenceIndex = 0;
  12907. }
  12908. }
  12909. startSpecial(sequence, offset) {
  12910. this.enterRCDATA(sequence, offset);
  12911. this.state = 31;
  12912. }
  12913. enterRCDATA(sequence, offset) {
  12914. this.inRCDATA = true;
  12915. this.currentSequence = sequence;
  12916. this.sequenceIndex = offset;
  12917. }
  12918. stateBeforeTagName(c) {
  12919. if (c === 33) {
  12920. this.state = 22;
  12921. this.sectionStart = this.index + 1;
  12922. } else if (c === 63) {
  12923. this.state = 24;
  12924. this.sectionStart = this.index + 1;
  12925. } else if (isTagStartChar(c)) {
  12926. this.sectionStart = this.index;
  12927. if (this.mode === 0) {
  12928. this.state = 6;
  12929. } else if (this.inSFCRoot) {
  12930. this.state = 34;
  12931. } else if (!this.inXML) {
  12932. if (c === 116) {
  12933. this.state = 30;
  12934. } else {
  12935. this.state = c === 115 ? 29 : 6;
  12936. }
  12937. } else {
  12938. this.state = 6;
  12939. }
  12940. } else if (c === 47) {
  12941. this.state = 8;
  12942. } else {
  12943. this.state = 1;
  12944. this.stateText(c);
  12945. }
  12946. }
  12947. stateInTagName(c) {
  12948. if (isEndOfTagSection(c)) {
  12949. this.handleTagName(c);
  12950. }
  12951. }
  12952. stateInSFCRootTagName(c) {
  12953. if (isEndOfTagSection(c)) {
  12954. const tag = this.buffer.slice(this.sectionStart, this.index);
  12955. if (tag !== "template") {
  12956. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  12957. }
  12958. this.handleTagName(c);
  12959. }
  12960. }
  12961. handleTagName(c) {
  12962. this.cbs.onopentagname(this.sectionStart, this.index);
  12963. this.sectionStart = -1;
  12964. this.state = 11;
  12965. this.stateBeforeAttrName(c);
  12966. }
  12967. stateBeforeClosingTagName(c) {
  12968. if (isWhitespace(c)) ; else if (c === 62) {
  12969. {
  12970. this.cbs.onerr(14, this.index);
  12971. }
  12972. this.state = 1;
  12973. this.sectionStart = this.index + 1;
  12974. } else {
  12975. this.state = isTagStartChar(c) ? 9 : 27;
  12976. this.sectionStart = this.index;
  12977. }
  12978. }
  12979. stateInClosingTagName(c) {
  12980. if (c === 62 || isWhitespace(c)) {
  12981. this.cbs.onclosetag(this.sectionStart, this.index);
  12982. this.sectionStart = -1;
  12983. this.state = 10;
  12984. this.stateAfterClosingTagName(c);
  12985. }
  12986. }
  12987. stateAfterClosingTagName(c) {
  12988. if (c === 62) {
  12989. this.state = 1;
  12990. this.sectionStart = this.index + 1;
  12991. }
  12992. }
  12993. stateBeforeAttrName(c) {
  12994. if (c === 62) {
  12995. this.cbs.onopentagend(this.index);
  12996. if (this.inRCDATA) {
  12997. this.state = 32;
  12998. } else {
  12999. this.state = 1;
  13000. }
  13001. this.sectionStart = this.index + 1;
  13002. } else if (c === 47) {
  13003. this.state = 7;
  13004. if (this.peek() !== 62) {
  13005. this.cbs.onerr(22, this.index);
  13006. }
  13007. } else if (c === 60 && this.peek() === 47) {
  13008. this.cbs.onopentagend(this.index);
  13009. this.state = 5;
  13010. this.sectionStart = this.index;
  13011. } else if (!isWhitespace(c)) {
  13012. if (c === 61) {
  13013. this.cbs.onerr(
  13014. 19,
  13015. this.index
  13016. );
  13017. }
  13018. this.handleAttrStart(c);
  13019. }
  13020. }
  13021. handleAttrStart(c) {
  13022. if (c === 118 && this.peek() === 45) {
  13023. this.state = 13;
  13024. this.sectionStart = this.index;
  13025. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  13026. this.cbs.ondirname(this.index, this.index + 1);
  13027. this.state = 14;
  13028. this.sectionStart = this.index + 1;
  13029. } else {
  13030. this.state = 12;
  13031. this.sectionStart = this.index;
  13032. }
  13033. }
  13034. stateInSelfClosingTag(c) {
  13035. if (c === 62) {
  13036. this.cbs.onselfclosingtag(this.index);
  13037. this.state = 1;
  13038. this.sectionStart = this.index + 1;
  13039. this.inRCDATA = false;
  13040. } else if (!isWhitespace(c)) {
  13041. this.state = 11;
  13042. this.stateBeforeAttrName(c);
  13043. }
  13044. }
  13045. stateInAttrName(c) {
  13046. if (c === 61 || isEndOfTagSection(c)) {
  13047. this.cbs.onattribname(this.sectionStart, this.index);
  13048. this.handleAttrNameEnd(c);
  13049. } else if (c === 34 || c === 39 || c === 60) {
  13050. this.cbs.onerr(
  13051. 17,
  13052. this.index
  13053. );
  13054. }
  13055. }
  13056. stateInDirName(c) {
  13057. if (c === 61 || isEndOfTagSection(c)) {
  13058. this.cbs.ondirname(this.sectionStart, this.index);
  13059. this.handleAttrNameEnd(c);
  13060. } else if (c === 58) {
  13061. this.cbs.ondirname(this.sectionStart, this.index);
  13062. this.state = 14;
  13063. this.sectionStart = this.index + 1;
  13064. } else if (c === 46) {
  13065. this.cbs.ondirname(this.sectionStart, this.index);
  13066. this.state = 16;
  13067. this.sectionStart = this.index + 1;
  13068. }
  13069. }
  13070. stateInDirArg(c) {
  13071. if (c === 61 || isEndOfTagSection(c)) {
  13072. this.cbs.ondirarg(this.sectionStart, this.index);
  13073. this.handleAttrNameEnd(c);
  13074. } else if (c === 91) {
  13075. this.state = 15;
  13076. } else if (c === 46) {
  13077. this.cbs.ondirarg(this.sectionStart, this.index);
  13078. this.state = 16;
  13079. this.sectionStart = this.index + 1;
  13080. }
  13081. }
  13082. stateInDynamicDirArg(c) {
  13083. if (c === 93) {
  13084. this.state = 14;
  13085. } else if (c === 61 || isEndOfTagSection(c)) {
  13086. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  13087. this.handleAttrNameEnd(c);
  13088. {
  13089. this.cbs.onerr(
  13090. 27,
  13091. this.index
  13092. );
  13093. }
  13094. }
  13095. }
  13096. stateInDirModifier(c) {
  13097. if (c === 61 || isEndOfTagSection(c)) {
  13098. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13099. this.handleAttrNameEnd(c);
  13100. } else if (c === 46) {
  13101. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13102. this.sectionStart = this.index + 1;
  13103. }
  13104. }
  13105. handleAttrNameEnd(c) {
  13106. this.sectionStart = this.index;
  13107. this.state = 17;
  13108. this.cbs.onattribnameend(this.index);
  13109. this.stateAfterAttrName(c);
  13110. }
  13111. stateAfterAttrName(c) {
  13112. if (c === 61) {
  13113. this.state = 18;
  13114. } else if (c === 47 || c === 62) {
  13115. this.cbs.onattribend(0, this.sectionStart);
  13116. this.sectionStart = -1;
  13117. this.state = 11;
  13118. this.stateBeforeAttrName(c);
  13119. } else if (!isWhitespace(c)) {
  13120. this.cbs.onattribend(0, this.sectionStart);
  13121. this.handleAttrStart(c);
  13122. }
  13123. }
  13124. stateBeforeAttrValue(c) {
  13125. if (c === 34) {
  13126. this.state = 19;
  13127. this.sectionStart = this.index + 1;
  13128. } else if (c === 39) {
  13129. this.state = 20;
  13130. this.sectionStart = this.index + 1;
  13131. } else if (!isWhitespace(c)) {
  13132. this.sectionStart = this.index;
  13133. this.state = 21;
  13134. this.stateInAttrValueNoQuotes(c);
  13135. }
  13136. }
  13137. handleInAttrValue(c, quote) {
  13138. if (c === quote || this.fastForwardTo(quote)) {
  13139. this.cbs.onattribdata(this.sectionStart, this.index);
  13140. this.sectionStart = -1;
  13141. this.cbs.onattribend(
  13142. quote === 34 ? 3 : 2,
  13143. this.index + 1
  13144. );
  13145. this.state = 11;
  13146. }
  13147. }
  13148. stateInAttrValueDoubleQuotes(c) {
  13149. this.handleInAttrValue(c, 34);
  13150. }
  13151. stateInAttrValueSingleQuotes(c) {
  13152. this.handleInAttrValue(c, 39);
  13153. }
  13154. stateInAttrValueNoQuotes(c) {
  13155. if (isWhitespace(c) || c === 62) {
  13156. this.cbs.onattribdata(this.sectionStart, this.index);
  13157. this.sectionStart = -1;
  13158. this.cbs.onattribend(1, this.index);
  13159. this.state = 11;
  13160. this.stateBeforeAttrName(c);
  13161. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  13162. this.cbs.onerr(
  13163. 18,
  13164. this.index
  13165. );
  13166. } else ;
  13167. }
  13168. stateBeforeDeclaration(c) {
  13169. if (c === 91) {
  13170. this.state = 26;
  13171. this.sequenceIndex = 0;
  13172. } else {
  13173. this.state = c === 45 ? 25 : 23;
  13174. }
  13175. }
  13176. stateInDeclaration(c) {
  13177. if (c === 62 || this.fastForwardTo(62)) {
  13178. this.state = 1;
  13179. this.sectionStart = this.index + 1;
  13180. }
  13181. }
  13182. stateInProcessingInstruction(c) {
  13183. if (c === 62 || this.fastForwardTo(62)) {
  13184. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  13185. this.state = 1;
  13186. this.sectionStart = this.index + 1;
  13187. }
  13188. }
  13189. stateBeforeComment(c) {
  13190. if (c === 45) {
  13191. this.state = 28;
  13192. this.currentSequence = Sequences.CommentEnd;
  13193. this.sequenceIndex = 2;
  13194. this.sectionStart = this.index + 1;
  13195. } else {
  13196. this.state = 23;
  13197. }
  13198. }
  13199. stateInSpecialComment(c) {
  13200. if (c === 62 || this.fastForwardTo(62)) {
  13201. this.cbs.oncomment(this.sectionStart, this.index);
  13202. this.state = 1;
  13203. this.sectionStart = this.index + 1;
  13204. }
  13205. }
  13206. stateBeforeSpecialS(c) {
  13207. if (c === Sequences.ScriptEnd[3]) {
  13208. this.startSpecial(Sequences.ScriptEnd, 4);
  13209. } else if (c === Sequences.StyleEnd[3]) {
  13210. this.startSpecial(Sequences.StyleEnd, 4);
  13211. } else {
  13212. this.state = 6;
  13213. this.stateInTagName(c);
  13214. }
  13215. }
  13216. stateBeforeSpecialT(c) {
  13217. if (c === Sequences.TitleEnd[3]) {
  13218. this.startSpecial(Sequences.TitleEnd, 4);
  13219. } else if (c === Sequences.TextareaEnd[3]) {
  13220. this.startSpecial(Sequences.TextareaEnd, 4);
  13221. } else {
  13222. this.state = 6;
  13223. this.stateInTagName(c);
  13224. }
  13225. }
  13226. startEntity() {
  13227. }
  13228. stateInEntity() {
  13229. }
  13230. /**
  13231. * Iterates through the buffer, calling the function corresponding to the current state.
  13232. *
  13233. * States that are more likely to be hit are higher up, as a performance improvement.
  13234. */
  13235. parse(input) {
  13236. this.buffer = input;
  13237. while (this.index < this.buffer.length) {
  13238. const c = this.buffer.charCodeAt(this.index);
  13239. if (c === 10 && this.state !== 33) {
  13240. this.newlines.push(this.index);
  13241. }
  13242. switch (this.state) {
  13243. case 1: {
  13244. this.stateText(c);
  13245. break;
  13246. }
  13247. case 2: {
  13248. this.stateInterpolationOpen(c);
  13249. break;
  13250. }
  13251. case 3: {
  13252. this.stateInterpolation(c);
  13253. break;
  13254. }
  13255. case 4: {
  13256. this.stateInterpolationClose(c);
  13257. break;
  13258. }
  13259. case 31: {
  13260. this.stateSpecialStartSequence(c);
  13261. break;
  13262. }
  13263. case 32: {
  13264. this.stateInRCDATA(c);
  13265. break;
  13266. }
  13267. case 26: {
  13268. this.stateCDATASequence(c);
  13269. break;
  13270. }
  13271. case 19: {
  13272. this.stateInAttrValueDoubleQuotes(c);
  13273. break;
  13274. }
  13275. case 12: {
  13276. this.stateInAttrName(c);
  13277. break;
  13278. }
  13279. case 13: {
  13280. this.stateInDirName(c);
  13281. break;
  13282. }
  13283. case 14: {
  13284. this.stateInDirArg(c);
  13285. break;
  13286. }
  13287. case 15: {
  13288. this.stateInDynamicDirArg(c);
  13289. break;
  13290. }
  13291. case 16: {
  13292. this.stateInDirModifier(c);
  13293. break;
  13294. }
  13295. case 28: {
  13296. this.stateInCommentLike(c);
  13297. break;
  13298. }
  13299. case 27: {
  13300. this.stateInSpecialComment(c);
  13301. break;
  13302. }
  13303. case 11: {
  13304. this.stateBeforeAttrName(c);
  13305. break;
  13306. }
  13307. case 6: {
  13308. this.stateInTagName(c);
  13309. break;
  13310. }
  13311. case 34: {
  13312. this.stateInSFCRootTagName(c);
  13313. break;
  13314. }
  13315. case 9: {
  13316. this.stateInClosingTagName(c);
  13317. break;
  13318. }
  13319. case 5: {
  13320. this.stateBeforeTagName(c);
  13321. break;
  13322. }
  13323. case 17: {
  13324. this.stateAfterAttrName(c);
  13325. break;
  13326. }
  13327. case 20: {
  13328. this.stateInAttrValueSingleQuotes(c);
  13329. break;
  13330. }
  13331. case 18: {
  13332. this.stateBeforeAttrValue(c);
  13333. break;
  13334. }
  13335. case 8: {
  13336. this.stateBeforeClosingTagName(c);
  13337. break;
  13338. }
  13339. case 10: {
  13340. this.stateAfterClosingTagName(c);
  13341. break;
  13342. }
  13343. case 29: {
  13344. this.stateBeforeSpecialS(c);
  13345. break;
  13346. }
  13347. case 30: {
  13348. this.stateBeforeSpecialT(c);
  13349. break;
  13350. }
  13351. case 21: {
  13352. this.stateInAttrValueNoQuotes(c);
  13353. break;
  13354. }
  13355. case 7: {
  13356. this.stateInSelfClosingTag(c);
  13357. break;
  13358. }
  13359. case 23: {
  13360. this.stateInDeclaration(c);
  13361. break;
  13362. }
  13363. case 22: {
  13364. this.stateBeforeDeclaration(c);
  13365. break;
  13366. }
  13367. case 25: {
  13368. this.stateBeforeComment(c);
  13369. break;
  13370. }
  13371. case 24: {
  13372. this.stateInProcessingInstruction(c);
  13373. break;
  13374. }
  13375. case 33: {
  13376. this.stateInEntity();
  13377. break;
  13378. }
  13379. }
  13380. this.index++;
  13381. }
  13382. this.cleanup();
  13383. this.finish();
  13384. }
  13385. /**
  13386. * Remove data that has already been consumed from the buffer.
  13387. */
  13388. cleanup() {
  13389. if (this.sectionStart !== this.index) {
  13390. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  13391. this.cbs.ontext(this.sectionStart, this.index);
  13392. this.sectionStart = this.index;
  13393. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  13394. this.cbs.onattribdata(this.sectionStart, this.index);
  13395. this.sectionStart = this.index;
  13396. }
  13397. }
  13398. }
  13399. finish() {
  13400. this.handleTrailingData();
  13401. this.cbs.onend();
  13402. }
  13403. /** Handle any trailing data. */
  13404. handleTrailingData() {
  13405. const endIndex = this.buffer.length;
  13406. if (this.sectionStart >= endIndex) {
  13407. return;
  13408. }
  13409. if (this.state === 28) {
  13410. if (this.currentSequence === Sequences.CdataEnd) {
  13411. this.cbs.oncdata(this.sectionStart, endIndex);
  13412. } else {
  13413. this.cbs.oncomment(this.sectionStart, endIndex);
  13414. }
  13415. } 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 {
  13416. this.cbs.ontext(this.sectionStart, endIndex);
  13417. }
  13418. }
  13419. emitCodePoint(cp, consumed) {
  13420. }
  13421. }
  13422. function defaultOnError(error) {
  13423. throw error;
  13424. }
  13425. function defaultOnWarn(msg) {
  13426. console.warn(`[Vue warn] ${msg.message}`);
  13427. }
  13428. function createCompilerError(code, loc, messages, additionalMessage) {
  13429. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  13430. const error = new SyntaxError(String(msg));
  13431. error.code = code;
  13432. error.loc = loc;
  13433. return error;
  13434. }
  13435. const errorMessages = {
  13436. // parse errors
  13437. [0]: "Illegal comment.",
  13438. [1]: "CDATA section is allowed only in XML context.",
  13439. [2]: "Duplicate attribute.",
  13440. [3]: "End tag cannot have attributes.",
  13441. [4]: "Illegal '/' in tags.",
  13442. [5]: "Unexpected EOF in tag.",
  13443. [6]: "Unexpected EOF in CDATA section.",
  13444. [7]: "Unexpected EOF in comment.",
  13445. [8]: "Unexpected EOF in script.",
  13446. [9]: "Unexpected EOF in tag.",
  13447. [10]: "Incorrectly closed comment.",
  13448. [11]: "Incorrectly opened comment.",
  13449. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  13450. [13]: "Attribute value was expected.",
  13451. [14]: "End tag name was expected.",
  13452. [15]: "Whitespace was expected.",
  13453. [16]: "Unexpected '<!--' in comment.",
  13454. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  13455. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  13456. [19]: "Attribute name cannot start with '='.",
  13457. [21]: "'<?' is allowed only in XML context.",
  13458. [20]: `Unexpected null character.`,
  13459. [22]: "Illegal '/' in tags.",
  13460. // Vue-specific parse errors
  13461. [23]: "Invalid end tag.",
  13462. [24]: "Element is missing end tag.",
  13463. [25]: "Interpolation end sign was not found.",
  13464. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  13465. [26]: "Legal directive name was expected.",
  13466. // transform errors
  13467. [28]: `v-if/v-else-if is missing expression.`,
  13468. [29]: `v-if/else branches must use unique keys.`,
  13469. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  13470. [31]: `v-for is missing expression.`,
  13471. [32]: `v-for has invalid expression.`,
  13472. [33]: `<template v-for> key should be placed on the <template> tag.`,
  13473. [34]: `v-bind is missing expression.`,
  13474. [52]: `v-bind with same-name shorthand only allows static argument.`,
  13475. [35]: `v-on is missing expression.`,
  13476. [36]: `Unexpected custom directive on <slot> outlet.`,
  13477. [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.`,
  13478. [38]: `Duplicate slot names found. `,
  13479. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  13480. [40]: `v-slot can only be used on components or <template> tags.`,
  13481. [41]: `v-model is missing expression.`,
  13482. [42]: `v-model value must be a valid JavaScript member expression.`,
  13483. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  13484. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  13485. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  13486. [45]: `Error parsing JavaScript expression: `,
  13487. [46]: `<KeepAlive> expects exactly one child component.`,
  13488. [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.`,
  13489. // generic errors
  13490. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  13491. [48]: `ES module mode is not supported in this build of compiler.`,
  13492. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  13493. [50]: `"scopeId" option is only supported in module mode.`,
  13494. // just to fulfill types
  13495. [53]: ``
  13496. };
  13497. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  13498. function isCoreComponent(tag) {
  13499. switch (tag) {
  13500. case "Teleport":
  13501. case "teleport":
  13502. return TELEPORT;
  13503. case "Suspense":
  13504. case "suspense":
  13505. return SUSPENSE;
  13506. case "KeepAlive":
  13507. case "keep-alive":
  13508. return KEEP_ALIVE;
  13509. case "BaseTransition":
  13510. case "base-transition":
  13511. return BASE_TRANSITION;
  13512. }
  13513. }
  13514. const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
  13515. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  13516. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  13517. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  13518. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  13519. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  13520. const isMemberExpressionBrowser = (exp) => {
  13521. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  13522. let state = 0 /* inMemberExp */;
  13523. let stateStack = [];
  13524. let currentOpenBracketCount = 0;
  13525. let currentOpenParensCount = 0;
  13526. let currentStringType = null;
  13527. for (let i = 0; i < path.length; i++) {
  13528. const char = path.charAt(i);
  13529. switch (state) {
  13530. case 0 /* inMemberExp */:
  13531. if (char === "[") {
  13532. stateStack.push(state);
  13533. state = 1 /* inBrackets */;
  13534. currentOpenBracketCount++;
  13535. } else if (char === "(") {
  13536. stateStack.push(state);
  13537. state = 2 /* inParens */;
  13538. currentOpenParensCount++;
  13539. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  13540. return false;
  13541. }
  13542. break;
  13543. case 1 /* inBrackets */:
  13544. if (char === `'` || char === `"` || char === "`") {
  13545. stateStack.push(state);
  13546. state = 3 /* inString */;
  13547. currentStringType = char;
  13548. } else if (char === `[`) {
  13549. currentOpenBracketCount++;
  13550. } else if (char === `]`) {
  13551. if (!--currentOpenBracketCount) {
  13552. state = stateStack.pop();
  13553. }
  13554. }
  13555. break;
  13556. case 2 /* inParens */:
  13557. if (char === `'` || char === `"` || char === "`") {
  13558. stateStack.push(state);
  13559. state = 3 /* inString */;
  13560. currentStringType = char;
  13561. } else if (char === `(`) {
  13562. currentOpenParensCount++;
  13563. } else if (char === `)`) {
  13564. if (i === path.length - 1) {
  13565. return false;
  13566. }
  13567. if (!--currentOpenParensCount) {
  13568. state = stateStack.pop();
  13569. }
  13570. }
  13571. break;
  13572. case 3 /* inString */:
  13573. if (char === currentStringType) {
  13574. state = stateStack.pop();
  13575. currentStringType = null;
  13576. }
  13577. break;
  13578. }
  13579. }
  13580. return !currentOpenBracketCount && !currentOpenParensCount;
  13581. };
  13582. const isMemberExpression = isMemberExpressionBrowser ;
  13583. const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  13584. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  13585. const isFnExpression = isFnExpressionBrowser ;
  13586. function assert(condition, msg) {
  13587. if (!condition) {
  13588. throw new Error(msg || `unexpected compiler condition`);
  13589. }
  13590. }
  13591. function findDir(node, name, allowEmpty = false) {
  13592. for (let i = 0; i < node.props.length; i++) {
  13593. const p = node.props[i];
  13594. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  13595. return p;
  13596. }
  13597. }
  13598. }
  13599. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  13600. for (let i = 0; i < node.props.length; i++) {
  13601. const p = node.props[i];
  13602. if (p.type === 6) {
  13603. if (dynamicOnly) continue;
  13604. if (p.name === name && (p.value || allowEmpty)) {
  13605. return p;
  13606. }
  13607. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  13608. return p;
  13609. }
  13610. }
  13611. }
  13612. function isStaticArgOf(arg, name) {
  13613. return !!(arg && isStaticExp(arg) && arg.content === name);
  13614. }
  13615. function hasDynamicKeyVBind(node) {
  13616. return node.props.some(
  13617. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  13618. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  13619. !p.arg.isStatic)
  13620. // v-bind:[foo]
  13621. );
  13622. }
  13623. function isText$1(node) {
  13624. return node.type === 5 || node.type === 2;
  13625. }
  13626. function isVPre(p) {
  13627. return p.type === 7 && p.name === "pre";
  13628. }
  13629. function isVSlot(p) {
  13630. return p.type === 7 && p.name === "slot";
  13631. }
  13632. function isTemplateNode(node) {
  13633. return node.type === 1 && node.tagType === 3;
  13634. }
  13635. function isSlotOutlet(node) {
  13636. return node.type === 1 && node.tagType === 2;
  13637. }
  13638. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  13639. function getUnnormalizedProps(props, callPath = []) {
  13640. if (props && !isString(props) && props.type === 14) {
  13641. const callee = props.callee;
  13642. if (!isString(callee) && propsHelperSet.has(callee)) {
  13643. return getUnnormalizedProps(
  13644. props.arguments[0],
  13645. callPath.concat(props)
  13646. );
  13647. }
  13648. }
  13649. return [props, callPath];
  13650. }
  13651. function injectProp(node, prop, context) {
  13652. let propsWithInjection;
  13653. let props = node.type === 13 ? node.props : node.arguments[2];
  13654. let callPath = [];
  13655. let parentCall;
  13656. if (props && !isString(props) && props.type === 14) {
  13657. const ret = getUnnormalizedProps(props);
  13658. props = ret[0];
  13659. callPath = ret[1];
  13660. parentCall = callPath[callPath.length - 1];
  13661. }
  13662. if (props == null || isString(props)) {
  13663. propsWithInjection = createObjectExpression([prop]);
  13664. } else if (props.type === 14) {
  13665. const first = props.arguments[0];
  13666. if (!isString(first) && first.type === 15) {
  13667. if (!hasProp(prop, first)) {
  13668. first.properties.unshift(prop);
  13669. }
  13670. } else {
  13671. if (props.callee === TO_HANDLERS) {
  13672. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13673. createObjectExpression([prop]),
  13674. props
  13675. ]);
  13676. } else {
  13677. props.arguments.unshift(createObjectExpression([prop]));
  13678. }
  13679. }
  13680. !propsWithInjection && (propsWithInjection = props);
  13681. } else if (props.type === 15) {
  13682. if (!hasProp(prop, props)) {
  13683. props.properties.unshift(prop);
  13684. }
  13685. propsWithInjection = props;
  13686. } else {
  13687. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13688. createObjectExpression([prop]),
  13689. props
  13690. ]);
  13691. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  13692. parentCall = callPath[callPath.length - 2];
  13693. }
  13694. }
  13695. if (node.type === 13) {
  13696. if (parentCall) {
  13697. parentCall.arguments[0] = propsWithInjection;
  13698. } else {
  13699. node.props = propsWithInjection;
  13700. }
  13701. } else {
  13702. if (parentCall) {
  13703. parentCall.arguments[0] = propsWithInjection;
  13704. } else {
  13705. node.arguments[2] = propsWithInjection;
  13706. }
  13707. }
  13708. }
  13709. function hasProp(prop, props) {
  13710. let result = false;
  13711. if (prop.key.type === 4) {
  13712. const propKeyName = prop.key.content;
  13713. result = props.properties.some(
  13714. (p) => p.key.type === 4 && p.key.content === propKeyName
  13715. );
  13716. }
  13717. return result;
  13718. }
  13719. function toValidAssetId(name, type) {
  13720. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  13721. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  13722. })}`;
  13723. }
  13724. function getMemoedVNodeCall(node) {
  13725. if (node.type === 14 && node.callee === WITH_MEMO) {
  13726. return node.arguments[1].returns;
  13727. } else {
  13728. return node;
  13729. }
  13730. }
  13731. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  13732. const defaultParserOptions = {
  13733. parseMode: "base",
  13734. ns: 0,
  13735. delimiters: [`{{`, `}}`],
  13736. getNamespace: () => 0,
  13737. isVoidTag: NO,
  13738. isPreTag: NO,
  13739. isIgnoreNewlineTag: NO,
  13740. isCustomElement: NO,
  13741. onError: defaultOnError,
  13742. onWarn: defaultOnWarn,
  13743. comments: true,
  13744. prefixIdentifiers: false
  13745. };
  13746. let currentOptions = defaultParserOptions;
  13747. let currentRoot = null;
  13748. let currentInput = "";
  13749. let currentOpenTag = null;
  13750. let currentProp = null;
  13751. let currentAttrValue = "";
  13752. let currentAttrStartIndex = -1;
  13753. let currentAttrEndIndex = -1;
  13754. let inPre = 0;
  13755. let inVPre = false;
  13756. let currentVPreBoundary = null;
  13757. const stack = [];
  13758. const tokenizer = new Tokenizer(stack, {
  13759. onerr: emitError,
  13760. ontext(start, end) {
  13761. onText(getSlice(start, end), start, end);
  13762. },
  13763. ontextentity(char, start, end) {
  13764. onText(char, start, end);
  13765. },
  13766. oninterpolation(start, end) {
  13767. if (inVPre) {
  13768. return onText(getSlice(start, end), start, end);
  13769. }
  13770. let innerStart = start + tokenizer.delimiterOpen.length;
  13771. let innerEnd = end - tokenizer.delimiterClose.length;
  13772. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  13773. innerStart++;
  13774. }
  13775. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  13776. innerEnd--;
  13777. }
  13778. let exp = getSlice(innerStart, innerEnd);
  13779. if (exp.includes("&")) {
  13780. {
  13781. exp = currentOptions.decodeEntities(exp, false);
  13782. }
  13783. }
  13784. addNode({
  13785. type: 5,
  13786. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  13787. loc: getLoc(start, end)
  13788. });
  13789. },
  13790. onopentagname(start, end) {
  13791. const name = getSlice(start, end);
  13792. currentOpenTag = {
  13793. type: 1,
  13794. tag: name,
  13795. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  13796. tagType: 0,
  13797. // will be refined on tag close
  13798. props: [],
  13799. children: [],
  13800. loc: getLoc(start - 1, end),
  13801. codegenNode: void 0
  13802. };
  13803. },
  13804. onopentagend(end) {
  13805. endOpenTag(end);
  13806. },
  13807. onclosetag(start, end) {
  13808. const name = getSlice(start, end);
  13809. if (!currentOptions.isVoidTag(name)) {
  13810. let found = false;
  13811. for (let i = 0; i < stack.length; i++) {
  13812. const e = stack[i];
  13813. if (e.tag.toLowerCase() === name.toLowerCase()) {
  13814. found = true;
  13815. if (i > 0) {
  13816. emitError(24, stack[0].loc.start.offset);
  13817. }
  13818. for (let j = 0; j <= i; j++) {
  13819. const el = stack.shift();
  13820. onCloseTag(el, end, j < i);
  13821. }
  13822. break;
  13823. }
  13824. }
  13825. if (!found) {
  13826. emitError(23, backTrack(start, 60));
  13827. }
  13828. }
  13829. },
  13830. onselfclosingtag(end) {
  13831. const name = currentOpenTag.tag;
  13832. currentOpenTag.isSelfClosing = true;
  13833. endOpenTag(end);
  13834. if (stack[0] && stack[0].tag === name) {
  13835. onCloseTag(stack.shift(), end);
  13836. }
  13837. },
  13838. onattribname(start, end) {
  13839. currentProp = {
  13840. type: 6,
  13841. name: getSlice(start, end),
  13842. nameLoc: getLoc(start, end),
  13843. value: void 0,
  13844. loc: getLoc(start)
  13845. };
  13846. },
  13847. ondirname(start, end) {
  13848. const raw = getSlice(start, end);
  13849. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  13850. if (!inVPre && name === "") {
  13851. emitError(26, start);
  13852. }
  13853. if (inVPre || name === "") {
  13854. currentProp = {
  13855. type: 6,
  13856. name: raw,
  13857. nameLoc: getLoc(start, end),
  13858. value: void 0,
  13859. loc: getLoc(start)
  13860. };
  13861. } else {
  13862. currentProp = {
  13863. type: 7,
  13864. name,
  13865. rawName: raw,
  13866. exp: void 0,
  13867. arg: void 0,
  13868. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  13869. loc: getLoc(start)
  13870. };
  13871. if (name === "pre") {
  13872. inVPre = tokenizer.inVPre = true;
  13873. currentVPreBoundary = currentOpenTag;
  13874. const props = currentOpenTag.props;
  13875. for (let i = 0; i < props.length; i++) {
  13876. if (props[i].type === 7) {
  13877. props[i] = dirToAttr(props[i]);
  13878. }
  13879. }
  13880. }
  13881. }
  13882. },
  13883. ondirarg(start, end) {
  13884. if (start === end) return;
  13885. const arg = getSlice(start, end);
  13886. if (inVPre && !isVPre(currentProp)) {
  13887. currentProp.name += arg;
  13888. setLocEnd(currentProp.nameLoc, end);
  13889. } else {
  13890. const isStatic = arg[0] !== `[`;
  13891. currentProp.arg = createExp(
  13892. isStatic ? arg : arg.slice(1, -1),
  13893. isStatic,
  13894. getLoc(start, end),
  13895. isStatic ? 3 : 0
  13896. );
  13897. }
  13898. },
  13899. ondirmodifier(start, end) {
  13900. const mod = getSlice(start, end);
  13901. if (inVPre && !isVPre(currentProp)) {
  13902. currentProp.name += "." + mod;
  13903. setLocEnd(currentProp.nameLoc, end);
  13904. } else if (currentProp.name === "slot") {
  13905. const arg = currentProp.arg;
  13906. if (arg) {
  13907. arg.content += "." + mod;
  13908. setLocEnd(arg.loc, end);
  13909. }
  13910. } else {
  13911. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  13912. currentProp.modifiers.push(exp);
  13913. }
  13914. },
  13915. onattribdata(start, end) {
  13916. currentAttrValue += getSlice(start, end);
  13917. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13918. currentAttrEndIndex = end;
  13919. },
  13920. onattribentity(char, start, end) {
  13921. currentAttrValue += char;
  13922. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13923. currentAttrEndIndex = end;
  13924. },
  13925. onattribnameend(end) {
  13926. const start = currentProp.loc.start.offset;
  13927. const name = getSlice(start, end);
  13928. if (currentProp.type === 7) {
  13929. currentProp.rawName = name;
  13930. }
  13931. if (currentOpenTag.props.some(
  13932. (p) => (p.type === 7 ? p.rawName : p.name) === name
  13933. )) {
  13934. emitError(2, start);
  13935. }
  13936. },
  13937. onattribend(quote, end) {
  13938. if (currentOpenTag && currentProp) {
  13939. setLocEnd(currentProp.loc, end);
  13940. if (quote !== 0) {
  13941. if (currentAttrValue.includes("&")) {
  13942. currentAttrValue = currentOptions.decodeEntities(
  13943. currentAttrValue,
  13944. true
  13945. );
  13946. }
  13947. if (currentProp.type === 6) {
  13948. if (currentProp.name === "class") {
  13949. currentAttrValue = condense(currentAttrValue).trim();
  13950. }
  13951. if (quote === 1 && !currentAttrValue) {
  13952. emitError(13, end);
  13953. }
  13954. currentProp.value = {
  13955. type: 2,
  13956. content: currentAttrValue,
  13957. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  13958. };
  13959. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  13960. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  13961. }
  13962. } else {
  13963. let expParseMode = 0 /* Normal */;
  13964. currentProp.exp = createExp(
  13965. currentAttrValue,
  13966. false,
  13967. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  13968. 0,
  13969. expParseMode
  13970. );
  13971. if (currentProp.name === "for") {
  13972. currentProp.forParseResult = parseForExpression(currentProp.exp);
  13973. }
  13974. }
  13975. }
  13976. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  13977. currentOpenTag.props.push(currentProp);
  13978. }
  13979. }
  13980. currentAttrValue = "";
  13981. currentAttrStartIndex = currentAttrEndIndex = -1;
  13982. },
  13983. oncomment(start, end) {
  13984. if (currentOptions.comments) {
  13985. addNode({
  13986. type: 3,
  13987. content: getSlice(start, end),
  13988. loc: getLoc(start - 4, end + 3)
  13989. });
  13990. }
  13991. },
  13992. onend() {
  13993. const end = currentInput.length;
  13994. if (tokenizer.state !== 1) {
  13995. switch (tokenizer.state) {
  13996. case 5:
  13997. case 8:
  13998. emitError(5, end);
  13999. break;
  14000. case 3:
  14001. case 4:
  14002. emitError(
  14003. 25,
  14004. tokenizer.sectionStart
  14005. );
  14006. break;
  14007. case 28:
  14008. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  14009. emitError(6, end);
  14010. } else {
  14011. emitError(7, end);
  14012. }
  14013. break;
  14014. case 6:
  14015. case 7:
  14016. case 9:
  14017. case 11:
  14018. case 12:
  14019. case 13:
  14020. case 14:
  14021. case 15:
  14022. case 16:
  14023. case 17:
  14024. case 18:
  14025. case 19:
  14026. // "
  14027. case 20:
  14028. // '
  14029. case 21:
  14030. emitError(9, end);
  14031. break;
  14032. }
  14033. }
  14034. for (let index = 0; index < stack.length; index++) {
  14035. onCloseTag(stack[index], end - 1);
  14036. emitError(24, stack[index].loc.start.offset);
  14037. }
  14038. },
  14039. oncdata(start, end) {
  14040. if (stack[0].ns !== 0) {
  14041. onText(getSlice(start, end), start, end);
  14042. } else {
  14043. emitError(1, start - 9);
  14044. }
  14045. },
  14046. onprocessinginstruction(start) {
  14047. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14048. emitError(
  14049. 21,
  14050. start - 1
  14051. );
  14052. }
  14053. }
  14054. });
  14055. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  14056. const stripParensRE = /^\(|\)$/g;
  14057. function parseForExpression(input) {
  14058. const loc = input.loc;
  14059. const exp = input.content;
  14060. const inMatch = exp.match(forAliasRE);
  14061. if (!inMatch) return;
  14062. const [, LHS, RHS] = inMatch;
  14063. const createAliasExpression = (content, offset, asParam = false) => {
  14064. const start = loc.start.offset + offset;
  14065. const end = start + content.length;
  14066. return createExp(
  14067. content,
  14068. false,
  14069. getLoc(start, end),
  14070. 0,
  14071. asParam ? 1 /* Params */ : 0 /* Normal */
  14072. );
  14073. };
  14074. const result = {
  14075. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  14076. value: void 0,
  14077. key: void 0,
  14078. index: void 0,
  14079. finalized: false
  14080. };
  14081. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  14082. const trimmedOffset = LHS.indexOf(valueContent);
  14083. const iteratorMatch = valueContent.match(forIteratorRE);
  14084. if (iteratorMatch) {
  14085. valueContent = valueContent.replace(forIteratorRE, "").trim();
  14086. const keyContent = iteratorMatch[1].trim();
  14087. let keyOffset;
  14088. if (keyContent) {
  14089. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  14090. result.key = createAliasExpression(keyContent, keyOffset, true);
  14091. }
  14092. if (iteratorMatch[2]) {
  14093. const indexContent = iteratorMatch[2].trim();
  14094. if (indexContent) {
  14095. result.index = createAliasExpression(
  14096. indexContent,
  14097. exp.indexOf(
  14098. indexContent,
  14099. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  14100. ),
  14101. true
  14102. );
  14103. }
  14104. }
  14105. }
  14106. if (valueContent) {
  14107. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  14108. }
  14109. return result;
  14110. }
  14111. function getSlice(start, end) {
  14112. return currentInput.slice(start, end);
  14113. }
  14114. function endOpenTag(end) {
  14115. if (tokenizer.inSFCRoot) {
  14116. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  14117. }
  14118. addNode(currentOpenTag);
  14119. const { tag, ns } = currentOpenTag;
  14120. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14121. inPre++;
  14122. }
  14123. if (currentOptions.isVoidTag(tag)) {
  14124. onCloseTag(currentOpenTag, end);
  14125. } else {
  14126. stack.unshift(currentOpenTag);
  14127. if (ns === 1 || ns === 2) {
  14128. tokenizer.inXML = true;
  14129. }
  14130. }
  14131. currentOpenTag = null;
  14132. }
  14133. function onText(content, start, end) {
  14134. {
  14135. const tag = stack[0] && stack[0].tag;
  14136. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  14137. content = currentOptions.decodeEntities(content, false);
  14138. }
  14139. }
  14140. const parent = stack[0] || currentRoot;
  14141. const lastNode = parent.children[parent.children.length - 1];
  14142. if (lastNode && lastNode.type === 2) {
  14143. lastNode.content += content;
  14144. setLocEnd(lastNode.loc, end);
  14145. } else {
  14146. parent.children.push({
  14147. type: 2,
  14148. content,
  14149. loc: getLoc(start, end)
  14150. });
  14151. }
  14152. }
  14153. function onCloseTag(el, end, isImplied = false) {
  14154. if (isImplied) {
  14155. setLocEnd(el.loc, backTrack(end, 60));
  14156. } else {
  14157. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  14158. }
  14159. if (tokenizer.inSFCRoot) {
  14160. if (el.children.length) {
  14161. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  14162. } else {
  14163. el.innerLoc.end = extend({}, el.innerLoc.start);
  14164. }
  14165. el.innerLoc.source = getSlice(
  14166. el.innerLoc.start.offset,
  14167. el.innerLoc.end.offset
  14168. );
  14169. }
  14170. const { tag, ns, children } = el;
  14171. if (!inVPre) {
  14172. if (tag === "slot") {
  14173. el.tagType = 2;
  14174. } else if (isFragmentTemplate(el)) {
  14175. el.tagType = 3;
  14176. } else if (isComponent(el)) {
  14177. el.tagType = 1;
  14178. }
  14179. }
  14180. if (!tokenizer.inRCDATA) {
  14181. el.children = condenseWhitespace(children);
  14182. }
  14183. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  14184. const first = children[0];
  14185. if (first && first.type === 2) {
  14186. first.content = first.content.replace(/^\r?\n/, "");
  14187. }
  14188. }
  14189. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14190. inPre--;
  14191. }
  14192. if (currentVPreBoundary === el) {
  14193. inVPre = tokenizer.inVPre = false;
  14194. currentVPreBoundary = null;
  14195. }
  14196. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14197. tokenizer.inXML = false;
  14198. }
  14199. }
  14200. function lookAhead(index, c) {
  14201. let i = index;
  14202. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  14203. return i;
  14204. }
  14205. function backTrack(index, c) {
  14206. let i = index;
  14207. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  14208. return i;
  14209. }
  14210. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  14211. function isFragmentTemplate({ tag, props }) {
  14212. if (tag === "template") {
  14213. for (let i = 0; i < props.length; i++) {
  14214. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  14215. return true;
  14216. }
  14217. }
  14218. }
  14219. return false;
  14220. }
  14221. function isComponent({ tag, props }) {
  14222. if (currentOptions.isCustomElement(tag)) {
  14223. return false;
  14224. }
  14225. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  14226. return true;
  14227. }
  14228. for (let i = 0; i < props.length; i++) {
  14229. const p = props[i];
  14230. if (p.type === 6) {
  14231. if (p.name === "is" && p.value) {
  14232. if (p.value.content.startsWith("vue:")) {
  14233. return true;
  14234. }
  14235. }
  14236. }
  14237. }
  14238. return false;
  14239. }
  14240. function isUpperCase(c) {
  14241. return c > 64 && c < 91;
  14242. }
  14243. const windowsNewlineRE = /\r\n/g;
  14244. function condenseWhitespace(nodes) {
  14245. const shouldCondense = currentOptions.whitespace !== "preserve";
  14246. let removedWhitespace = false;
  14247. for (let i = 0; i < nodes.length; i++) {
  14248. const node = nodes[i];
  14249. if (node.type === 2) {
  14250. if (!inPre) {
  14251. if (isAllWhitespace(node.content)) {
  14252. const prev = nodes[i - 1] && nodes[i - 1].type;
  14253. const next = nodes[i + 1] && nodes[i + 1].type;
  14254. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  14255. removedWhitespace = true;
  14256. nodes[i] = null;
  14257. } else {
  14258. node.content = " ";
  14259. }
  14260. } else if (shouldCondense) {
  14261. node.content = condense(node.content);
  14262. }
  14263. } else {
  14264. node.content = node.content.replace(windowsNewlineRE, "\n");
  14265. }
  14266. }
  14267. }
  14268. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  14269. }
  14270. function isAllWhitespace(str) {
  14271. for (let i = 0; i < str.length; i++) {
  14272. if (!isWhitespace(str.charCodeAt(i))) {
  14273. return false;
  14274. }
  14275. }
  14276. return true;
  14277. }
  14278. function hasNewlineChar(str) {
  14279. for (let i = 0; i < str.length; i++) {
  14280. const c = str.charCodeAt(i);
  14281. if (c === 10 || c === 13) {
  14282. return true;
  14283. }
  14284. }
  14285. return false;
  14286. }
  14287. function condense(str) {
  14288. let ret = "";
  14289. let prevCharIsWhitespace = false;
  14290. for (let i = 0; i < str.length; i++) {
  14291. if (isWhitespace(str.charCodeAt(i))) {
  14292. if (!prevCharIsWhitespace) {
  14293. ret += " ";
  14294. prevCharIsWhitespace = true;
  14295. }
  14296. } else {
  14297. ret += str[i];
  14298. prevCharIsWhitespace = false;
  14299. }
  14300. }
  14301. return ret;
  14302. }
  14303. function addNode(node) {
  14304. (stack[0] || currentRoot).children.push(node);
  14305. }
  14306. function getLoc(start, end) {
  14307. return {
  14308. start: tokenizer.getPos(start),
  14309. // @ts-expect-error allow late attachment
  14310. end: end == null ? end : tokenizer.getPos(end),
  14311. // @ts-expect-error allow late attachment
  14312. source: end == null ? end : getSlice(start, end)
  14313. };
  14314. }
  14315. function cloneLoc(loc) {
  14316. return getLoc(loc.start.offset, loc.end.offset);
  14317. }
  14318. function setLocEnd(loc, end) {
  14319. loc.end = tokenizer.getPos(end);
  14320. loc.source = getSlice(loc.start.offset, end);
  14321. }
  14322. function dirToAttr(dir) {
  14323. const attr = {
  14324. type: 6,
  14325. name: dir.rawName,
  14326. nameLoc: getLoc(
  14327. dir.loc.start.offset,
  14328. dir.loc.start.offset + dir.rawName.length
  14329. ),
  14330. value: void 0,
  14331. loc: dir.loc
  14332. };
  14333. if (dir.exp) {
  14334. const loc = dir.exp.loc;
  14335. if (loc.end.offset < dir.loc.end.offset) {
  14336. loc.start.offset--;
  14337. loc.start.column--;
  14338. loc.end.offset++;
  14339. loc.end.column++;
  14340. }
  14341. attr.value = {
  14342. type: 2,
  14343. content: dir.exp.content,
  14344. loc
  14345. };
  14346. }
  14347. return attr;
  14348. }
  14349. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  14350. const exp = createSimpleExpression(content, isStatic, loc, constType);
  14351. return exp;
  14352. }
  14353. function emitError(code, index, message) {
  14354. currentOptions.onError(
  14355. createCompilerError(code, getLoc(index, index), void 0, message)
  14356. );
  14357. }
  14358. function reset() {
  14359. tokenizer.reset();
  14360. currentOpenTag = null;
  14361. currentProp = null;
  14362. currentAttrValue = "";
  14363. currentAttrStartIndex = -1;
  14364. currentAttrEndIndex = -1;
  14365. stack.length = 0;
  14366. }
  14367. function baseParse(input, options) {
  14368. reset();
  14369. currentInput = input;
  14370. currentOptions = extend({}, defaultParserOptions);
  14371. if (options) {
  14372. let key;
  14373. for (key in options) {
  14374. if (options[key] != null) {
  14375. currentOptions[key] = options[key];
  14376. }
  14377. }
  14378. }
  14379. {
  14380. if (!currentOptions.decodeEntities) {
  14381. throw new Error(
  14382. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  14383. );
  14384. }
  14385. }
  14386. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  14387. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  14388. const delimiters = options && options.delimiters;
  14389. if (delimiters) {
  14390. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  14391. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  14392. }
  14393. const root = currentRoot = createRoot([], input);
  14394. tokenizer.parse(currentInput);
  14395. root.loc = getLoc(0, input.length);
  14396. root.children = condenseWhitespace(root.children);
  14397. currentRoot = null;
  14398. return root;
  14399. }
  14400. function cacheStatic(root, context) {
  14401. walk(
  14402. root,
  14403. void 0,
  14404. context,
  14405. // Root node is unfortunately non-hoistable due to potential parent
  14406. // fallthrough attributes.
  14407. !!getSingleElementRoot(root)
  14408. );
  14409. }
  14410. function getSingleElementRoot(root) {
  14411. const children = root.children.filter((x) => x.type !== 3);
  14412. return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
  14413. }
  14414. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  14415. const { children } = node;
  14416. const toCache = [];
  14417. for (let i = 0; i < children.length; i++) {
  14418. const child = children[i];
  14419. if (child.type === 1 && child.tagType === 0) {
  14420. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14421. if (constantType > 0) {
  14422. if (constantType >= 2) {
  14423. child.codegenNode.patchFlag = -1;
  14424. toCache.push(child);
  14425. continue;
  14426. }
  14427. } else {
  14428. const codegenNode = child.codegenNode;
  14429. if (codegenNode.type === 13) {
  14430. const flag = codegenNode.patchFlag;
  14431. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  14432. const props = getNodeProps(child);
  14433. if (props) {
  14434. codegenNode.props = context.hoist(props);
  14435. }
  14436. }
  14437. if (codegenNode.dynamicProps) {
  14438. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  14439. }
  14440. }
  14441. }
  14442. } else if (child.type === 12) {
  14443. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14444. if (constantType >= 2) {
  14445. if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
  14446. child.codegenNode.arguments.push(
  14447. -1 + (` /* ${PatchFlagNames[-1]} */` )
  14448. );
  14449. }
  14450. toCache.push(child);
  14451. continue;
  14452. }
  14453. }
  14454. if (child.type === 1) {
  14455. const isComponent = child.tagType === 1;
  14456. if (isComponent) {
  14457. context.scopes.vSlot++;
  14458. }
  14459. walk(child, node, context, false, inFor);
  14460. if (isComponent) {
  14461. context.scopes.vSlot--;
  14462. }
  14463. } else if (child.type === 11) {
  14464. walk(child, node, context, child.children.length === 1, true);
  14465. } else if (child.type === 9) {
  14466. for (let i2 = 0; i2 < child.branches.length; i2++) {
  14467. walk(
  14468. child.branches[i2],
  14469. node,
  14470. context,
  14471. child.branches[i2].children.length === 1,
  14472. inFor
  14473. );
  14474. }
  14475. }
  14476. }
  14477. let cachedAsArray = false;
  14478. if (toCache.length === children.length && node.type === 1) {
  14479. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  14480. node.codegenNode.children = getCacheExpression(
  14481. createArrayExpression(node.codegenNode.children)
  14482. );
  14483. cachedAsArray = true;
  14484. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  14485. const slot = getSlotNode(node.codegenNode, "default");
  14486. if (slot) {
  14487. slot.returns = getCacheExpression(
  14488. createArrayExpression(slot.returns)
  14489. );
  14490. cachedAsArray = true;
  14491. }
  14492. } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
  14493. const slotName = findDir(node, "slot", true);
  14494. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  14495. if (slot) {
  14496. slot.returns = getCacheExpression(
  14497. createArrayExpression(slot.returns)
  14498. );
  14499. cachedAsArray = true;
  14500. }
  14501. }
  14502. }
  14503. if (!cachedAsArray) {
  14504. for (const child of toCache) {
  14505. child.codegenNode = context.cache(child.codegenNode);
  14506. }
  14507. }
  14508. function getCacheExpression(value) {
  14509. const exp = context.cache(value);
  14510. exp.needArraySpread = true;
  14511. return exp;
  14512. }
  14513. function getSlotNode(node2, name) {
  14514. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  14515. const slot = node2.children.properties.find(
  14516. (p) => p.key === name || p.key.content === name
  14517. );
  14518. return slot && slot.value;
  14519. }
  14520. }
  14521. if (toCache.length && context.transformHoist) {
  14522. context.transformHoist(children, context, node);
  14523. }
  14524. }
  14525. function getConstantType(node, context) {
  14526. const { constantCache } = context;
  14527. switch (node.type) {
  14528. case 1:
  14529. if (node.tagType !== 0) {
  14530. return 0;
  14531. }
  14532. const cached = constantCache.get(node);
  14533. if (cached !== void 0) {
  14534. return cached;
  14535. }
  14536. const codegenNode = node.codegenNode;
  14537. if (codegenNode.type !== 13) {
  14538. return 0;
  14539. }
  14540. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  14541. return 0;
  14542. }
  14543. if (codegenNode.patchFlag === void 0) {
  14544. let returnType2 = 3;
  14545. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  14546. if (generatedPropsType === 0) {
  14547. constantCache.set(node, 0);
  14548. return 0;
  14549. }
  14550. if (generatedPropsType < returnType2) {
  14551. returnType2 = generatedPropsType;
  14552. }
  14553. for (let i = 0; i < node.children.length; i++) {
  14554. const childType = getConstantType(node.children[i], context);
  14555. if (childType === 0) {
  14556. constantCache.set(node, 0);
  14557. return 0;
  14558. }
  14559. if (childType < returnType2) {
  14560. returnType2 = childType;
  14561. }
  14562. }
  14563. if (returnType2 > 1) {
  14564. for (let i = 0; i < node.props.length; i++) {
  14565. const p = node.props[i];
  14566. if (p.type === 7 && p.name === "bind" && p.exp) {
  14567. const expType = getConstantType(p.exp, context);
  14568. if (expType === 0) {
  14569. constantCache.set(node, 0);
  14570. return 0;
  14571. }
  14572. if (expType < returnType2) {
  14573. returnType2 = expType;
  14574. }
  14575. }
  14576. }
  14577. }
  14578. if (codegenNode.isBlock) {
  14579. for (let i = 0; i < node.props.length; i++) {
  14580. const p = node.props[i];
  14581. if (p.type === 7) {
  14582. constantCache.set(node, 0);
  14583. return 0;
  14584. }
  14585. }
  14586. context.removeHelper(OPEN_BLOCK);
  14587. context.removeHelper(
  14588. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  14589. );
  14590. codegenNode.isBlock = false;
  14591. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  14592. }
  14593. constantCache.set(node, returnType2);
  14594. return returnType2;
  14595. } else {
  14596. constantCache.set(node, 0);
  14597. return 0;
  14598. }
  14599. case 2:
  14600. case 3:
  14601. return 3;
  14602. case 9:
  14603. case 11:
  14604. case 10:
  14605. return 0;
  14606. case 5:
  14607. case 12:
  14608. return getConstantType(node.content, context);
  14609. case 4:
  14610. return node.constType;
  14611. case 8:
  14612. let returnType = 3;
  14613. for (let i = 0; i < node.children.length; i++) {
  14614. const child = node.children[i];
  14615. if (isString(child) || isSymbol(child)) {
  14616. continue;
  14617. }
  14618. const childType = getConstantType(child, context);
  14619. if (childType === 0) {
  14620. return 0;
  14621. } else if (childType < returnType) {
  14622. returnType = childType;
  14623. }
  14624. }
  14625. return returnType;
  14626. case 20:
  14627. return 2;
  14628. default:
  14629. return 0;
  14630. }
  14631. }
  14632. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  14633. NORMALIZE_CLASS,
  14634. NORMALIZE_STYLE,
  14635. NORMALIZE_PROPS,
  14636. GUARD_REACTIVE_PROPS
  14637. ]);
  14638. function getConstantTypeOfHelperCall(value, context) {
  14639. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  14640. const arg = value.arguments[0];
  14641. if (arg.type === 4) {
  14642. return getConstantType(arg, context);
  14643. } else if (arg.type === 14) {
  14644. return getConstantTypeOfHelperCall(arg, context);
  14645. }
  14646. }
  14647. return 0;
  14648. }
  14649. function getGeneratedPropsConstantType(node, context) {
  14650. let returnType = 3;
  14651. const props = getNodeProps(node);
  14652. if (props && props.type === 15) {
  14653. const { properties } = props;
  14654. for (let i = 0; i < properties.length; i++) {
  14655. const { key, value } = properties[i];
  14656. const keyType = getConstantType(key, context);
  14657. if (keyType === 0) {
  14658. return keyType;
  14659. }
  14660. if (keyType < returnType) {
  14661. returnType = keyType;
  14662. }
  14663. let valueType;
  14664. if (value.type === 4) {
  14665. valueType = getConstantType(value, context);
  14666. } else if (value.type === 14) {
  14667. valueType = getConstantTypeOfHelperCall(value, context);
  14668. } else {
  14669. valueType = 0;
  14670. }
  14671. if (valueType === 0) {
  14672. return valueType;
  14673. }
  14674. if (valueType < returnType) {
  14675. returnType = valueType;
  14676. }
  14677. }
  14678. }
  14679. return returnType;
  14680. }
  14681. function getNodeProps(node) {
  14682. const codegenNode = node.codegenNode;
  14683. if (codegenNode.type === 13) {
  14684. return codegenNode.props;
  14685. }
  14686. }
  14687. function createTransformContext(root, {
  14688. filename = "",
  14689. prefixIdentifiers = false,
  14690. hoistStatic = false,
  14691. hmr = false,
  14692. cacheHandlers = false,
  14693. nodeTransforms = [],
  14694. directiveTransforms = {},
  14695. transformHoist = null,
  14696. isBuiltInComponent = NOOP,
  14697. isCustomElement = NOOP,
  14698. expressionPlugins = [],
  14699. scopeId = null,
  14700. slotted = true,
  14701. ssr = false,
  14702. inSSR = false,
  14703. ssrCssVars = ``,
  14704. bindingMetadata = EMPTY_OBJ,
  14705. inline = false,
  14706. isTS = false,
  14707. onError = defaultOnError,
  14708. onWarn = defaultOnWarn,
  14709. compatConfig
  14710. }) {
  14711. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  14712. const context = {
  14713. // options
  14714. filename,
  14715. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  14716. prefixIdentifiers,
  14717. hoistStatic,
  14718. hmr,
  14719. cacheHandlers,
  14720. nodeTransforms,
  14721. directiveTransforms,
  14722. transformHoist,
  14723. isBuiltInComponent,
  14724. isCustomElement,
  14725. expressionPlugins,
  14726. scopeId,
  14727. slotted,
  14728. ssr,
  14729. inSSR,
  14730. ssrCssVars,
  14731. bindingMetadata,
  14732. inline,
  14733. isTS,
  14734. onError,
  14735. onWarn,
  14736. compatConfig,
  14737. // state
  14738. root,
  14739. helpers: /* @__PURE__ */ new Map(),
  14740. components: /* @__PURE__ */ new Set(),
  14741. directives: /* @__PURE__ */ new Set(),
  14742. hoists: [],
  14743. imports: [],
  14744. cached: [],
  14745. constantCache: /* @__PURE__ */ new WeakMap(),
  14746. temps: 0,
  14747. identifiers: /* @__PURE__ */ Object.create(null),
  14748. scopes: {
  14749. vFor: 0,
  14750. vSlot: 0,
  14751. vPre: 0,
  14752. vOnce: 0
  14753. },
  14754. parent: null,
  14755. grandParent: null,
  14756. currentNode: root,
  14757. childIndex: 0,
  14758. inVOnce: false,
  14759. // methods
  14760. helper(name) {
  14761. const count = context.helpers.get(name) || 0;
  14762. context.helpers.set(name, count + 1);
  14763. return name;
  14764. },
  14765. removeHelper(name) {
  14766. const count = context.helpers.get(name);
  14767. if (count) {
  14768. const currentCount = count - 1;
  14769. if (!currentCount) {
  14770. context.helpers.delete(name);
  14771. } else {
  14772. context.helpers.set(name, currentCount);
  14773. }
  14774. }
  14775. },
  14776. helperString(name) {
  14777. return `_${helperNameMap[context.helper(name)]}`;
  14778. },
  14779. replaceNode(node) {
  14780. {
  14781. if (!context.currentNode) {
  14782. throw new Error(`Node being replaced is already removed.`);
  14783. }
  14784. if (!context.parent) {
  14785. throw new Error(`Cannot replace root node.`);
  14786. }
  14787. }
  14788. context.parent.children[context.childIndex] = context.currentNode = node;
  14789. },
  14790. removeNode(node) {
  14791. if (!context.parent) {
  14792. throw new Error(`Cannot remove root node.`);
  14793. }
  14794. const list = context.parent.children;
  14795. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  14796. if (removalIndex < 0) {
  14797. throw new Error(`node being removed is not a child of current parent`);
  14798. }
  14799. if (!node || node === context.currentNode) {
  14800. context.currentNode = null;
  14801. context.onNodeRemoved();
  14802. } else {
  14803. if (context.childIndex > removalIndex) {
  14804. context.childIndex--;
  14805. context.onNodeRemoved();
  14806. }
  14807. }
  14808. context.parent.children.splice(removalIndex, 1);
  14809. },
  14810. onNodeRemoved: NOOP,
  14811. addIdentifiers(exp) {
  14812. },
  14813. removeIdentifiers(exp) {
  14814. },
  14815. hoist(exp) {
  14816. if (isString(exp)) exp = createSimpleExpression(exp);
  14817. context.hoists.push(exp);
  14818. const identifier = createSimpleExpression(
  14819. `_hoisted_${context.hoists.length}`,
  14820. false,
  14821. exp.loc,
  14822. 2
  14823. );
  14824. identifier.hoisted = exp;
  14825. return identifier;
  14826. },
  14827. cache(exp, isVNode = false, inVOnce = false) {
  14828. const cacheExp = createCacheExpression(
  14829. context.cached.length,
  14830. exp,
  14831. isVNode,
  14832. inVOnce
  14833. );
  14834. context.cached.push(cacheExp);
  14835. return cacheExp;
  14836. }
  14837. };
  14838. return context;
  14839. }
  14840. function transform(root, options) {
  14841. const context = createTransformContext(root, options);
  14842. traverseNode(root, context);
  14843. if (options.hoistStatic) {
  14844. cacheStatic(root, context);
  14845. }
  14846. if (!options.ssr) {
  14847. createRootCodegen(root, context);
  14848. }
  14849. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  14850. root.components = [...context.components];
  14851. root.directives = [...context.directives];
  14852. root.imports = context.imports;
  14853. root.hoists = context.hoists;
  14854. root.temps = context.temps;
  14855. root.cached = context.cached;
  14856. root.transformed = true;
  14857. }
  14858. function createRootCodegen(root, context) {
  14859. const { helper } = context;
  14860. const { children } = root;
  14861. if (children.length === 1) {
  14862. const singleElementRootChild = getSingleElementRoot(root);
  14863. if (singleElementRootChild && singleElementRootChild.codegenNode) {
  14864. const codegenNode = singleElementRootChild.codegenNode;
  14865. if (codegenNode.type === 13) {
  14866. convertToBlock(codegenNode, context);
  14867. }
  14868. root.codegenNode = codegenNode;
  14869. } else {
  14870. root.codegenNode = children[0];
  14871. }
  14872. } else if (children.length > 1) {
  14873. let patchFlag = 64;
  14874. if (children.filter((c) => c.type !== 3).length === 1) {
  14875. patchFlag |= 2048;
  14876. }
  14877. root.codegenNode = createVNodeCall(
  14878. context,
  14879. helper(FRAGMENT),
  14880. void 0,
  14881. root.children,
  14882. patchFlag,
  14883. void 0,
  14884. void 0,
  14885. true,
  14886. void 0,
  14887. false
  14888. );
  14889. } else ;
  14890. }
  14891. function traverseChildren(parent, context) {
  14892. let i = 0;
  14893. const nodeRemoved = () => {
  14894. i--;
  14895. };
  14896. for (; i < parent.children.length; i++) {
  14897. const child = parent.children[i];
  14898. if (isString(child)) continue;
  14899. context.grandParent = context.parent;
  14900. context.parent = parent;
  14901. context.childIndex = i;
  14902. context.onNodeRemoved = nodeRemoved;
  14903. traverseNode(child, context);
  14904. }
  14905. }
  14906. function traverseNode(node, context) {
  14907. context.currentNode = node;
  14908. const { nodeTransforms } = context;
  14909. const exitFns = [];
  14910. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  14911. const onExit = nodeTransforms[i2](node, context);
  14912. if (onExit) {
  14913. if (isArray(onExit)) {
  14914. exitFns.push(...onExit);
  14915. } else {
  14916. exitFns.push(onExit);
  14917. }
  14918. }
  14919. if (!context.currentNode) {
  14920. return;
  14921. } else {
  14922. node = context.currentNode;
  14923. }
  14924. }
  14925. switch (node.type) {
  14926. case 3:
  14927. if (!context.ssr) {
  14928. context.helper(CREATE_COMMENT);
  14929. }
  14930. break;
  14931. case 5:
  14932. if (!context.ssr) {
  14933. context.helper(TO_DISPLAY_STRING);
  14934. }
  14935. break;
  14936. // for container types, further traverse downwards
  14937. case 9:
  14938. for (let i2 = 0; i2 < node.branches.length; i2++) {
  14939. traverseNode(node.branches[i2], context);
  14940. }
  14941. break;
  14942. case 10:
  14943. case 11:
  14944. case 1:
  14945. case 0:
  14946. traverseChildren(node, context);
  14947. break;
  14948. }
  14949. context.currentNode = node;
  14950. let i = exitFns.length;
  14951. while (i--) {
  14952. exitFns[i]();
  14953. }
  14954. }
  14955. function createStructuralDirectiveTransform(name, fn) {
  14956. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  14957. return (node, context) => {
  14958. if (node.type === 1) {
  14959. const { props } = node;
  14960. if (node.tagType === 3 && props.some(isVSlot)) {
  14961. return;
  14962. }
  14963. const exitFns = [];
  14964. for (let i = 0; i < props.length; i++) {
  14965. const prop = props[i];
  14966. if (prop.type === 7 && matches(prop.name)) {
  14967. props.splice(i, 1);
  14968. i--;
  14969. const onExit = fn(node, prop, context);
  14970. if (onExit) exitFns.push(onExit);
  14971. }
  14972. }
  14973. return exitFns;
  14974. }
  14975. };
  14976. }
  14977. const PURE_ANNOTATION = `/*@__PURE__*/`;
  14978. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  14979. function createCodegenContext(ast, {
  14980. mode = "function",
  14981. prefixIdentifiers = mode === "module",
  14982. sourceMap = false,
  14983. filename = `template.vue.html`,
  14984. scopeId = null,
  14985. optimizeImports = false,
  14986. runtimeGlobalName = `Vue`,
  14987. runtimeModuleName = `vue`,
  14988. ssrRuntimeModuleName = "vue/server-renderer",
  14989. ssr = false,
  14990. isTS = false,
  14991. inSSR = false
  14992. }) {
  14993. const context = {
  14994. mode,
  14995. prefixIdentifiers,
  14996. sourceMap,
  14997. filename,
  14998. scopeId,
  14999. optimizeImports,
  15000. runtimeGlobalName,
  15001. runtimeModuleName,
  15002. ssrRuntimeModuleName,
  15003. ssr,
  15004. isTS,
  15005. inSSR,
  15006. source: ast.source,
  15007. code: ``,
  15008. column: 1,
  15009. line: 1,
  15010. offset: 0,
  15011. indentLevel: 0,
  15012. pure: false,
  15013. map: void 0,
  15014. helper(key) {
  15015. return `_${helperNameMap[key]}`;
  15016. },
  15017. push(code, newlineIndex = -2 /* None */, node) {
  15018. context.code += code;
  15019. },
  15020. indent() {
  15021. newline(++context.indentLevel);
  15022. },
  15023. deindent(withoutNewLine = false) {
  15024. if (withoutNewLine) {
  15025. --context.indentLevel;
  15026. } else {
  15027. newline(--context.indentLevel);
  15028. }
  15029. },
  15030. newline() {
  15031. newline(context.indentLevel);
  15032. }
  15033. };
  15034. function newline(n) {
  15035. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  15036. }
  15037. return context;
  15038. }
  15039. function generate(ast, options = {}) {
  15040. const context = createCodegenContext(ast, options);
  15041. if (options.onContextCreated) options.onContextCreated(context);
  15042. const {
  15043. mode,
  15044. push,
  15045. prefixIdentifiers,
  15046. indent,
  15047. deindent,
  15048. newline,
  15049. scopeId,
  15050. ssr
  15051. } = context;
  15052. const helpers = Array.from(ast.helpers);
  15053. const hasHelpers = helpers.length > 0;
  15054. const useWithBlock = !prefixIdentifiers && mode !== "module";
  15055. const preambleContext = context;
  15056. {
  15057. genFunctionPreamble(ast, preambleContext);
  15058. }
  15059. const functionName = ssr ? `ssrRender` : `render`;
  15060. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  15061. const signature = args.join(", ");
  15062. {
  15063. push(`function ${functionName}(${signature}) {`);
  15064. }
  15065. indent();
  15066. if (useWithBlock) {
  15067. push(`with (_ctx) {`);
  15068. indent();
  15069. if (hasHelpers) {
  15070. push(
  15071. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  15072. `,
  15073. -1 /* End */
  15074. );
  15075. newline();
  15076. }
  15077. }
  15078. if (ast.components.length) {
  15079. genAssets(ast.components, "component", context);
  15080. if (ast.directives.length || ast.temps > 0) {
  15081. newline();
  15082. }
  15083. }
  15084. if (ast.directives.length) {
  15085. genAssets(ast.directives, "directive", context);
  15086. if (ast.temps > 0) {
  15087. newline();
  15088. }
  15089. }
  15090. if (ast.temps > 0) {
  15091. push(`let `);
  15092. for (let i = 0; i < ast.temps; i++) {
  15093. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  15094. }
  15095. }
  15096. if (ast.components.length || ast.directives.length || ast.temps) {
  15097. push(`
  15098. `, 0 /* Start */);
  15099. newline();
  15100. }
  15101. if (!ssr) {
  15102. push(`return `);
  15103. }
  15104. if (ast.codegenNode) {
  15105. genNode(ast.codegenNode, context);
  15106. } else {
  15107. push(`null`);
  15108. }
  15109. if (useWithBlock) {
  15110. deindent();
  15111. push(`}`);
  15112. }
  15113. deindent();
  15114. push(`}`);
  15115. return {
  15116. ast,
  15117. code: context.code,
  15118. preamble: ``,
  15119. map: context.map ? context.map.toJSON() : void 0
  15120. };
  15121. }
  15122. function genFunctionPreamble(ast, context) {
  15123. const {
  15124. ssr,
  15125. prefixIdentifiers,
  15126. push,
  15127. newline,
  15128. runtimeModuleName,
  15129. runtimeGlobalName,
  15130. ssrRuntimeModuleName
  15131. } = context;
  15132. const VueBinding = runtimeGlobalName;
  15133. const helpers = Array.from(ast.helpers);
  15134. if (helpers.length > 0) {
  15135. {
  15136. push(`const _Vue = ${VueBinding}
  15137. `, -1 /* End */);
  15138. if (ast.hoists.length) {
  15139. const staticHelpers = [
  15140. CREATE_VNODE,
  15141. CREATE_ELEMENT_VNODE,
  15142. CREATE_COMMENT,
  15143. CREATE_TEXT,
  15144. CREATE_STATIC
  15145. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  15146. push(`const { ${staticHelpers} } = _Vue
  15147. `, -1 /* End */);
  15148. }
  15149. }
  15150. }
  15151. genHoists(ast.hoists, context);
  15152. newline();
  15153. push(`return `);
  15154. }
  15155. function genAssets(assets, type, { helper, push, newline, isTS }) {
  15156. const resolver = helper(
  15157. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  15158. );
  15159. for (let i = 0; i < assets.length; i++) {
  15160. let id = assets[i];
  15161. const maybeSelfReference = id.endsWith("__self");
  15162. if (maybeSelfReference) {
  15163. id = id.slice(0, -6);
  15164. }
  15165. push(
  15166. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  15167. );
  15168. if (i < assets.length - 1) {
  15169. newline();
  15170. }
  15171. }
  15172. }
  15173. function genHoists(hoists, context) {
  15174. if (!hoists.length) {
  15175. return;
  15176. }
  15177. context.pure = true;
  15178. const { push, newline } = context;
  15179. newline();
  15180. for (let i = 0; i < hoists.length; i++) {
  15181. const exp = hoists[i];
  15182. if (exp) {
  15183. push(`const _hoisted_${i + 1} = `);
  15184. genNode(exp, context);
  15185. newline();
  15186. }
  15187. }
  15188. context.pure = false;
  15189. }
  15190. function isText(n) {
  15191. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  15192. }
  15193. function genNodeListAsArray(nodes, context) {
  15194. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  15195. context.push(`[`);
  15196. multilines && context.indent();
  15197. genNodeList(nodes, context, multilines);
  15198. multilines && context.deindent();
  15199. context.push(`]`);
  15200. }
  15201. function genNodeList(nodes, context, multilines = false, comma = true) {
  15202. const { push, newline } = context;
  15203. for (let i = 0; i < nodes.length; i++) {
  15204. const node = nodes[i];
  15205. if (isString(node)) {
  15206. push(node, -3 /* Unknown */);
  15207. } else if (isArray(node)) {
  15208. genNodeListAsArray(node, context);
  15209. } else {
  15210. genNode(node, context);
  15211. }
  15212. if (i < nodes.length - 1) {
  15213. if (multilines) {
  15214. comma && push(",");
  15215. newline();
  15216. } else {
  15217. comma && push(", ");
  15218. }
  15219. }
  15220. }
  15221. }
  15222. function genNode(node, context) {
  15223. if (isString(node)) {
  15224. context.push(node, -3 /* Unknown */);
  15225. return;
  15226. }
  15227. if (isSymbol(node)) {
  15228. context.push(context.helper(node));
  15229. return;
  15230. }
  15231. switch (node.type) {
  15232. case 1:
  15233. case 9:
  15234. case 11:
  15235. assert(
  15236. node.codegenNode != null,
  15237. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  15238. );
  15239. genNode(node.codegenNode, context);
  15240. break;
  15241. case 2:
  15242. genText(node, context);
  15243. break;
  15244. case 4:
  15245. genExpression(node, context);
  15246. break;
  15247. case 5:
  15248. genInterpolation(node, context);
  15249. break;
  15250. case 12:
  15251. genNode(node.codegenNode, context);
  15252. break;
  15253. case 8:
  15254. genCompoundExpression(node, context);
  15255. break;
  15256. case 3:
  15257. genComment(node, context);
  15258. break;
  15259. case 13:
  15260. genVNodeCall(node, context);
  15261. break;
  15262. case 14:
  15263. genCallExpression(node, context);
  15264. break;
  15265. case 15:
  15266. genObjectExpression(node, context);
  15267. break;
  15268. case 17:
  15269. genArrayExpression(node, context);
  15270. break;
  15271. case 18:
  15272. genFunctionExpression(node, context);
  15273. break;
  15274. case 19:
  15275. genConditionalExpression(node, context);
  15276. break;
  15277. case 20:
  15278. genCacheExpression(node, context);
  15279. break;
  15280. case 21:
  15281. genNodeList(node.body, context, true, false);
  15282. break;
  15283. // SSR only types
  15284. case 22:
  15285. break;
  15286. case 23:
  15287. break;
  15288. case 24:
  15289. break;
  15290. case 25:
  15291. break;
  15292. case 26:
  15293. break;
  15294. /* v8 ignore start */
  15295. case 10:
  15296. break;
  15297. default:
  15298. {
  15299. assert(false, `unhandled codegen node type: ${node.type}`);
  15300. const exhaustiveCheck = node;
  15301. return exhaustiveCheck;
  15302. }
  15303. }
  15304. }
  15305. function genText(node, context) {
  15306. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  15307. }
  15308. function genExpression(node, context) {
  15309. const { content, isStatic } = node;
  15310. context.push(
  15311. isStatic ? JSON.stringify(content) : content,
  15312. -3 /* Unknown */,
  15313. node
  15314. );
  15315. }
  15316. function genInterpolation(node, context) {
  15317. const { push, helper, pure } = context;
  15318. if (pure) push(PURE_ANNOTATION);
  15319. push(`${helper(TO_DISPLAY_STRING)}(`);
  15320. genNode(node.content, context);
  15321. push(`)`);
  15322. }
  15323. function genCompoundExpression(node, context) {
  15324. for (let i = 0; i < node.children.length; i++) {
  15325. const child = node.children[i];
  15326. if (isString(child)) {
  15327. context.push(child, -3 /* Unknown */);
  15328. } else {
  15329. genNode(child, context);
  15330. }
  15331. }
  15332. }
  15333. function genExpressionAsPropertyKey(node, context) {
  15334. const { push } = context;
  15335. if (node.type === 8) {
  15336. push(`[`);
  15337. genCompoundExpression(node, context);
  15338. push(`]`);
  15339. } else if (node.isStatic) {
  15340. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  15341. push(text, -2 /* None */, node);
  15342. } else {
  15343. push(`[${node.content}]`, -3 /* Unknown */, node);
  15344. }
  15345. }
  15346. function genComment(node, context) {
  15347. const { push, helper, pure } = context;
  15348. if (pure) {
  15349. push(PURE_ANNOTATION);
  15350. }
  15351. push(
  15352. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  15353. -3 /* Unknown */,
  15354. node
  15355. );
  15356. }
  15357. function genVNodeCall(node, context) {
  15358. const { push, helper, pure } = context;
  15359. const {
  15360. tag,
  15361. props,
  15362. children,
  15363. patchFlag,
  15364. dynamicProps,
  15365. directives,
  15366. isBlock,
  15367. disableTracking,
  15368. isComponent
  15369. } = node;
  15370. let patchFlagString;
  15371. if (patchFlag) {
  15372. {
  15373. if (patchFlag < 0) {
  15374. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15375. } else {
  15376. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15377. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  15378. }
  15379. }
  15380. }
  15381. if (directives) {
  15382. push(helper(WITH_DIRECTIVES) + `(`);
  15383. }
  15384. if (isBlock) {
  15385. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  15386. }
  15387. if (pure) {
  15388. push(PURE_ANNOTATION);
  15389. }
  15390. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  15391. push(helper(callHelper) + `(`, -2 /* None */, node);
  15392. genNodeList(
  15393. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  15394. context
  15395. );
  15396. push(`)`);
  15397. if (isBlock) {
  15398. push(`)`);
  15399. }
  15400. if (directives) {
  15401. push(`, `);
  15402. genNode(directives, context);
  15403. push(`)`);
  15404. }
  15405. }
  15406. function genNullableArgs(args) {
  15407. let i = args.length;
  15408. while (i--) {
  15409. if (args[i] != null) break;
  15410. }
  15411. return args.slice(0, i + 1).map((arg) => arg || `null`);
  15412. }
  15413. function genCallExpression(node, context) {
  15414. const { push, helper, pure } = context;
  15415. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  15416. if (pure) {
  15417. push(PURE_ANNOTATION);
  15418. }
  15419. push(callee + `(`, -2 /* None */, node);
  15420. genNodeList(node.arguments, context);
  15421. push(`)`);
  15422. }
  15423. function genObjectExpression(node, context) {
  15424. const { push, indent, deindent, newline } = context;
  15425. const { properties } = node;
  15426. if (!properties.length) {
  15427. push(`{}`, -2 /* None */, node);
  15428. return;
  15429. }
  15430. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  15431. push(multilines ? `{` : `{ `);
  15432. multilines && indent();
  15433. for (let i = 0; i < properties.length; i++) {
  15434. const { key, value } = properties[i];
  15435. genExpressionAsPropertyKey(key, context);
  15436. push(`: `);
  15437. genNode(value, context);
  15438. if (i < properties.length - 1) {
  15439. push(`,`);
  15440. newline();
  15441. }
  15442. }
  15443. multilines && deindent();
  15444. push(multilines ? `}` : ` }`);
  15445. }
  15446. function genArrayExpression(node, context) {
  15447. genNodeListAsArray(node.elements, context);
  15448. }
  15449. function genFunctionExpression(node, context) {
  15450. const { push, indent, deindent } = context;
  15451. const { params, returns, body, newline, isSlot } = node;
  15452. if (isSlot) {
  15453. push(`_${helperNameMap[WITH_CTX]}(`);
  15454. }
  15455. push(`(`, -2 /* None */, node);
  15456. if (isArray(params)) {
  15457. genNodeList(params, context);
  15458. } else if (params) {
  15459. genNode(params, context);
  15460. }
  15461. push(`) => `);
  15462. if (newline || body) {
  15463. push(`{`);
  15464. indent();
  15465. }
  15466. if (returns) {
  15467. if (newline) {
  15468. push(`return `);
  15469. }
  15470. if (isArray(returns)) {
  15471. genNodeListAsArray(returns, context);
  15472. } else {
  15473. genNode(returns, context);
  15474. }
  15475. } else if (body) {
  15476. genNode(body, context);
  15477. }
  15478. if (newline || body) {
  15479. deindent();
  15480. push(`}`);
  15481. }
  15482. if (isSlot) {
  15483. push(`)`);
  15484. }
  15485. }
  15486. function genConditionalExpression(node, context) {
  15487. const { test, consequent, alternate, newline: needNewline } = node;
  15488. const { push, indent, deindent, newline } = context;
  15489. if (test.type === 4) {
  15490. const needsParens = !isSimpleIdentifier(test.content);
  15491. needsParens && push(`(`);
  15492. genExpression(test, context);
  15493. needsParens && push(`)`);
  15494. } else {
  15495. push(`(`);
  15496. genNode(test, context);
  15497. push(`)`);
  15498. }
  15499. needNewline && indent();
  15500. context.indentLevel++;
  15501. needNewline || push(` `);
  15502. push(`? `);
  15503. genNode(consequent, context);
  15504. context.indentLevel--;
  15505. needNewline && newline();
  15506. needNewline || push(` `);
  15507. push(`: `);
  15508. const isNested = alternate.type === 19;
  15509. if (!isNested) {
  15510. context.indentLevel++;
  15511. }
  15512. genNode(alternate, context);
  15513. if (!isNested) {
  15514. context.indentLevel--;
  15515. }
  15516. needNewline && deindent(
  15517. true
  15518. /* without newline */
  15519. );
  15520. }
  15521. function genCacheExpression(node, context) {
  15522. const { push, helper, indent, deindent, newline } = context;
  15523. const { needPauseTracking, needArraySpread } = node;
  15524. if (needArraySpread) {
  15525. push(`[...(`);
  15526. }
  15527. push(`_cache[${node.index}] || (`);
  15528. if (needPauseTracking) {
  15529. indent();
  15530. push(`${helper(SET_BLOCK_TRACKING)}(-1`);
  15531. if (node.inVOnce) push(`, true`);
  15532. push(`),`);
  15533. newline();
  15534. push(`(`);
  15535. }
  15536. push(`_cache[${node.index}] = `);
  15537. genNode(node.value, context);
  15538. if (needPauseTracking) {
  15539. push(`).cacheIndex = ${node.index},`);
  15540. newline();
  15541. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  15542. newline();
  15543. push(`_cache[${node.index}]`);
  15544. deindent();
  15545. }
  15546. push(`)`);
  15547. if (needArraySpread) {
  15548. push(`)]`);
  15549. }
  15550. }
  15551. const prohibitedKeywordRE = new RegExp(
  15552. "\\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"
  15553. );
  15554. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  15555. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  15556. const exp = node.content;
  15557. if (!exp.trim()) {
  15558. return;
  15559. }
  15560. try {
  15561. new Function(
  15562. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  15563. );
  15564. } catch (e) {
  15565. let message = e.message;
  15566. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  15567. if (keywordMatch) {
  15568. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  15569. }
  15570. context.onError(
  15571. createCompilerError(
  15572. 45,
  15573. node.loc,
  15574. void 0,
  15575. message
  15576. )
  15577. );
  15578. }
  15579. }
  15580. const transformExpression = (node, context) => {
  15581. if (node.type === 5) {
  15582. node.content = processExpression(
  15583. node.content,
  15584. context
  15585. );
  15586. } else if (node.type === 1) {
  15587. const memo = findDir(node, "memo");
  15588. for (let i = 0; i < node.props.length; i++) {
  15589. const dir = node.props[i];
  15590. if (dir.type === 7 && dir.name !== "for") {
  15591. const exp = dir.exp;
  15592. const arg = dir.arg;
  15593. if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
  15594. !(memo && arg && arg.type === 4 && arg.content === "key")) {
  15595. dir.exp = processExpression(
  15596. exp,
  15597. context,
  15598. // slot args must be processed as function params
  15599. dir.name === "slot"
  15600. );
  15601. }
  15602. if (arg && arg.type === 4 && !arg.isStatic) {
  15603. dir.arg = processExpression(arg, context);
  15604. }
  15605. }
  15606. }
  15607. }
  15608. };
  15609. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  15610. {
  15611. {
  15612. validateBrowserExpression(node, context, asParams, asRawStatements);
  15613. }
  15614. return node;
  15615. }
  15616. }
  15617. const transformIf = createStructuralDirectiveTransform(
  15618. /^(?:if|else|else-if)$/,
  15619. (node, dir, context) => {
  15620. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  15621. const siblings = context.parent.children;
  15622. let i = siblings.indexOf(ifNode);
  15623. let key = 0;
  15624. while (i-- >= 0) {
  15625. const sibling = siblings[i];
  15626. if (sibling && sibling.type === 9) {
  15627. key += sibling.branches.length;
  15628. }
  15629. }
  15630. return () => {
  15631. if (isRoot) {
  15632. ifNode.codegenNode = createCodegenNodeForBranch(
  15633. branch,
  15634. key,
  15635. context
  15636. );
  15637. } else {
  15638. const parentCondition = getParentCondition(ifNode.codegenNode);
  15639. parentCondition.alternate = createCodegenNodeForBranch(
  15640. branch,
  15641. key + ifNode.branches.length - 1,
  15642. context
  15643. );
  15644. }
  15645. };
  15646. });
  15647. }
  15648. );
  15649. function processIf(node, dir, context, processCodegen) {
  15650. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  15651. const loc = dir.exp ? dir.exp.loc : node.loc;
  15652. context.onError(
  15653. createCompilerError(28, dir.loc)
  15654. );
  15655. dir.exp = createSimpleExpression(`true`, false, loc);
  15656. }
  15657. if (dir.exp) {
  15658. validateBrowserExpression(dir.exp, context);
  15659. }
  15660. if (dir.name === "if") {
  15661. const branch = createIfBranch(node, dir);
  15662. const ifNode = {
  15663. type: 9,
  15664. loc: cloneLoc(node.loc),
  15665. branches: [branch]
  15666. };
  15667. context.replaceNode(ifNode);
  15668. if (processCodegen) {
  15669. return processCodegen(ifNode, branch, true);
  15670. }
  15671. } else {
  15672. const siblings = context.parent.children;
  15673. const comments = [];
  15674. let i = siblings.indexOf(node);
  15675. while (i-- >= -1) {
  15676. const sibling = siblings[i];
  15677. if (sibling && sibling.type === 3) {
  15678. context.removeNode(sibling);
  15679. comments.unshift(sibling);
  15680. continue;
  15681. }
  15682. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  15683. context.removeNode(sibling);
  15684. continue;
  15685. }
  15686. if (sibling && sibling.type === 9) {
  15687. if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  15688. context.onError(
  15689. createCompilerError(30, node.loc)
  15690. );
  15691. }
  15692. context.removeNode();
  15693. const branch = createIfBranch(node, dir);
  15694. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  15695. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  15696. branch.children = [...comments, ...branch.children];
  15697. }
  15698. {
  15699. const key = branch.userKey;
  15700. if (key) {
  15701. sibling.branches.forEach(({ userKey }) => {
  15702. if (isSameKey(userKey, key)) {
  15703. context.onError(
  15704. createCompilerError(
  15705. 29,
  15706. branch.userKey.loc
  15707. )
  15708. );
  15709. }
  15710. });
  15711. }
  15712. }
  15713. sibling.branches.push(branch);
  15714. const onExit = processCodegen && processCodegen(sibling, branch, false);
  15715. traverseNode(branch, context);
  15716. if (onExit) onExit();
  15717. context.currentNode = null;
  15718. } else {
  15719. context.onError(
  15720. createCompilerError(30, node.loc)
  15721. );
  15722. }
  15723. break;
  15724. }
  15725. }
  15726. }
  15727. function createIfBranch(node, dir) {
  15728. const isTemplateIf = node.tagType === 3;
  15729. return {
  15730. type: 10,
  15731. loc: node.loc,
  15732. condition: dir.name === "else" ? void 0 : dir.exp,
  15733. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  15734. userKey: findProp(node, `key`),
  15735. isTemplateIf
  15736. };
  15737. }
  15738. function createCodegenNodeForBranch(branch, keyIndex, context) {
  15739. if (branch.condition) {
  15740. return createConditionalExpression(
  15741. branch.condition,
  15742. createChildrenCodegenNode(branch, keyIndex, context),
  15743. // make sure to pass in asBlock: true so that the comment node call
  15744. // closes the current block.
  15745. createCallExpression(context.helper(CREATE_COMMENT), [
  15746. '"v-if"' ,
  15747. "true"
  15748. ])
  15749. );
  15750. } else {
  15751. return createChildrenCodegenNode(branch, keyIndex, context);
  15752. }
  15753. }
  15754. function createChildrenCodegenNode(branch, keyIndex, context) {
  15755. const { helper } = context;
  15756. const keyProperty = createObjectProperty(
  15757. `key`,
  15758. createSimpleExpression(
  15759. `${keyIndex}`,
  15760. false,
  15761. locStub,
  15762. 2
  15763. )
  15764. );
  15765. const { children } = branch;
  15766. const firstChild = children[0];
  15767. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  15768. if (needFragmentWrapper) {
  15769. if (children.length === 1 && firstChild.type === 11) {
  15770. const vnodeCall = firstChild.codegenNode;
  15771. injectProp(vnodeCall, keyProperty, context);
  15772. return vnodeCall;
  15773. } else {
  15774. let patchFlag = 64;
  15775. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  15776. patchFlag |= 2048;
  15777. }
  15778. return createVNodeCall(
  15779. context,
  15780. helper(FRAGMENT),
  15781. createObjectExpression([keyProperty]),
  15782. children,
  15783. patchFlag,
  15784. void 0,
  15785. void 0,
  15786. true,
  15787. false,
  15788. false,
  15789. branch.loc
  15790. );
  15791. }
  15792. } else {
  15793. const ret = firstChild.codegenNode;
  15794. const vnodeCall = getMemoedVNodeCall(ret);
  15795. if (vnodeCall.type === 13) {
  15796. convertToBlock(vnodeCall, context);
  15797. }
  15798. injectProp(vnodeCall, keyProperty, context);
  15799. return ret;
  15800. }
  15801. }
  15802. function isSameKey(a, b) {
  15803. if (!a || a.type !== b.type) {
  15804. return false;
  15805. }
  15806. if (a.type === 6) {
  15807. if (a.value.content !== b.value.content) {
  15808. return false;
  15809. }
  15810. } else {
  15811. const exp = a.exp;
  15812. const branchExp = b.exp;
  15813. if (exp.type !== branchExp.type) {
  15814. return false;
  15815. }
  15816. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  15817. return false;
  15818. }
  15819. }
  15820. return true;
  15821. }
  15822. function getParentCondition(node) {
  15823. while (true) {
  15824. if (node.type === 19) {
  15825. if (node.alternate.type === 19) {
  15826. node = node.alternate;
  15827. } else {
  15828. return node;
  15829. }
  15830. } else if (node.type === 20) {
  15831. node = node.value;
  15832. }
  15833. }
  15834. }
  15835. const transformBind = (dir, _node, context) => {
  15836. const { modifiers, loc } = dir;
  15837. const arg = dir.arg;
  15838. let { exp } = dir;
  15839. if (exp && exp.type === 4 && !exp.content.trim()) {
  15840. {
  15841. exp = void 0;
  15842. }
  15843. }
  15844. if (!exp) {
  15845. if (arg.type !== 4 || !arg.isStatic) {
  15846. context.onError(
  15847. createCompilerError(
  15848. 52,
  15849. arg.loc
  15850. )
  15851. );
  15852. return {
  15853. props: [
  15854. createObjectProperty(arg, createSimpleExpression("", true, loc))
  15855. ]
  15856. };
  15857. }
  15858. transformBindShorthand(dir);
  15859. exp = dir.exp;
  15860. }
  15861. if (arg.type !== 4) {
  15862. arg.children.unshift(`(`);
  15863. arg.children.push(`) || ""`);
  15864. } else if (!arg.isStatic) {
  15865. arg.content = arg.content ? `${arg.content} || ""` : `""`;
  15866. }
  15867. if (modifiers.some((mod) => mod.content === "camel")) {
  15868. if (arg.type === 4) {
  15869. if (arg.isStatic) {
  15870. arg.content = camelize(arg.content);
  15871. } else {
  15872. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  15873. }
  15874. } else {
  15875. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  15876. arg.children.push(`)`);
  15877. }
  15878. }
  15879. if (!context.inSSR) {
  15880. if (modifiers.some((mod) => mod.content === "prop")) {
  15881. injectPrefix(arg, ".");
  15882. }
  15883. if (modifiers.some((mod) => mod.content === "attr")) {
  15884. injectPrefix(arg, "^");
  15885. }
  15886. }
  15887. return {
  15888. props: [createObjectProperty(arg, exp)]
  15889. };
  15890. };
  15891. const transformBindShorthand = (dir, context) => {
  15892. const arg = dir.arg;
  15893. const propName = camelize(arg.content);
  15894. dir.exp = createSimpleExpression(propName, false, arg.loc);
  15895. };
  15896. const injectPrefix = (arg, prefix) => {
  15897. if (arg.type === 4) {
  15898. if (arg.isStatic) {
  15899. arg.content = prefix + arg.content;
  15900. } else {
  15901. arg.content = `\`${prefix}\${${arg.content}}\``;
  15902. }
  15903. } else {
  15904. arg.children.unshift(`'${prefix}' + (`);
  15905. arg.children.push(`)`);
  15906. }
  15907. };
  15908. const transformFor = createStructuralDirectiveTransform(
  15909. "for",
  15910. (node, dir, context) => {
  15911. const { helper, removeHelper } = context;
  15912. return processFor(node, dir, context, (forNode) => {
  15913. const renderExp = createCallExpression(helper(RENDER_LIST), [
  15914. forNode.source
  15915. ]);
  15916. const isTemplate = isTemplateNode(node);
  15917. const memo = findDir(node, "memo");
  15918. const keyProp = findProp(node, `key`, false, true);
  15919. const isDirKey = keyProp && keyProp.type === 7;
  15920. if (isDirKey && !keyProp.exp) {
  15921. transformBindShorthand(keyProp);
  15922. }
  15923. let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  15924. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  15925. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  15926. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  15927. forNode.codegenNode = createVNodeCall(
  15928. context,
  15929. helper(FRAGMENT),
  15930. void 0,
  15931. renderExp,
  15932. fragmentFlag,
  15933. void 0,
  15934. void 0,
  15935. true,
  15936. !isStableFragment,
  15937. false,
  15938. node.loc
  15939. );
  15940. return () => {
  15941. let childBlock;
  15942. const { children } = forNode;
  15943. if (isTemplate) {
  15944. node.children.some((c) => {
  15945. if (c.type === 1) {
  15946. const key = findProp(c, "key");
  15947. if (key) {
  15948. context.onError(
  15949. createCompilerError(
  15950. 33,
  15951. key.loc
  15952. )
  15953. );
  15954. return true;
  15955. }
  15956. }
  15957. });
  15958. }
  15959. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  15960. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  15961. if (slotOutlet) {
  15962. childBlock = slotOutlet.codegenNode;
  15963. if (isTemplate && keyProperty) {
  15964. injectProp(childBlock, keyProperty, context);
  15965. }
  15966. } else if (needFragmentWrapper) {
  15967. childBlock = createVNodeCall(
  15968. context,
  15969. helper(FRAGMENT),
  15970. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  15971. node.children,
  15972. 64,
  15973. void 0,
  15974. void 0,
  15975. true,
  15976. void 0,
  15977. false
  15978. );
  15979. } else {
  15980. childBlock = children[0].codegenNode;
  15981. if (isTemplate && keyProperty) {
  15982. injectProp(childBlock, keyProperty, context);
  15983. }
  15984. if (childBlock.isBlock !== !isStableFragment) {
  15985. if (childBlock.isBlock) {
  15986. removeHelper(OPEN_BLOCK);
  15987. removeHelper(
  15988. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  15989. );
  15990. } else {
  15991. removeHelper(
  15992. getVNodeHelper(context.inSSR, childBlock.isComponent)
  15993. );
  15994. }
  15995. }
  15996. childBlock.isBlock = !isStableFragment;
  15997. if (childBlock.isBlock) {
  15998. helper(OPEN_BLOCK);
  15999. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  16000. } else {
  16001. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  16002. }
  16003. }
  16004. if (memo) {
  16005. const loop = createFunctionExpression(
  16006. createForLoopParams(forNode.parseResult, [
  16007. createSimpleExpression(`_cached`)
  16008. ])
  16009. );
  16010. loop.body = createBlockStatement([
  16011. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  16012. createCompoundExpression([
  16013. `if (_cached`,
  16014. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  16015. ` && ${context.helperString(
  16016. IS_MEMO_SAME
  16017. )}(_cached, _memo)) return _cached`
  16018. ]),
  16019. createCompoundExpression([`const _item = `, childBlock]),
  16020. createSimpleExpression(`_item.memo = _memo`),
  16021. createSimpleExpression(`return _item`)
  16022. ]);
  16023. renderExp.arguments.push(
  16024. loop,
  16025. createSimpleExpression(`_cache`),
  16026. createSimpleExpression(String(context.cached.length))
  16027. );
  16028. context.cached.push(null);
  16029. } else {
  16030. renderExp.arguments.push(
  16031. createFunctionExpression(
  16032. createForLoopParams(forNode.parseResult),
  16033. childBlock,
  16034. true
  16035. )
  16036. );
  16037. }
  16038. };
  16039. });
  16040. }
  16041. );
  16042. function processFor(node, dir, context, processCodegen) {
  16043. if (!dir.exp) {
  16044. context.onError(
  16045. createCompilerError(31, dir.loc)
  16046. );
  16047. return;
  16048. }
  16049. const parseResult = dir.forParseResult;
  16050. if (!parseResult) {
  16051. context.onError(
  16052. createCompilerError(32, dir.loc)
  16053. );
  16054. return;
  16055. }
  16056. finalizeForParseResult(parseResult, context);
  16057. const { addIdentifiers, removeIdentifiers, scopes } = context;
  16058. const { source, value, key, index } = parseResult;
  16059. const forNode = {
  16060. type: 11,
  16061. loc: dir.loc,
  16062. source,
  16063. valueAlias: value,
  16064. keyAlias: key,
  16065. objectIndexAlias: index,
  16066. parseResult,
  16067. children: isTemplateNode(node) ? node.children : [node]
  16068. };
  16069. context.replaceNode(forNode);
  16070. scopes.vFor++;
  16071. const onExit = processCodegen && processCodegen(forNode);
  16072. return () => {
  16073. scopes.vFor--;
  16074. if (onExit) onExit();
  16075. };
  16076. }
  16077. function finalizeForParseResult(result, context) {
  16078. if (result.finalized) return;
  16079. {
  16080. validateBrowserExpression(result.source, context);
  16081. if (result.key) {
  16082. validateBrowserExpression(
  16083. result.key,
  16084. context,
  16085. true
  16086. );
  16087. }
  16088. if (result.index) {
  16089. validateBrowserExpression(
  16090. result.index,
  16091. context,
  16092. true
  16093. );
  16094. }
  16095. if (result.value) {
  16096. validateBrowserExpression(
  16097. result.value,
  16098. context,
  16099. true
  16100. );
  16101. }
  16102. }
  16103. result.finalized = true;
  16104. }
  16105. function createForLoopParams({ value, key, index }, memoArgs = []) {
  16106. return createParamsList([value, key, index, ...memoArgs]);
  16107. }
  16108. function createParamsList(args) {
  16109. let i = args.length;
  16110. while (i--) {
  16111. if (args[i]) break;
  16112. }
  16113. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  16114. }
  16115. const defaultFallback = createSimpleExpression(`undefined`, false);
  16116. const trackSlotScopes = (node, context) => {
  16117. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  16118. const vSlot = findDir(node, "slot");
  16119. if (vSlot) {
  16120. vSlot.exp;
  16121. context.scopes.vSlot++;
  16122. return () => {
  16123. context.scopes.vSlot--;
  16124. };
  16125. }
  16126. }
  16127. };
  16128. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  16129. props,
  16130. children,
  16131. false,
  16132. true,
  16133. children.length ? children[0].loc : loc
  16134. );
  16135. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  16136. context.helper(WITH_CTX);
  16137. const { children, loc } = node;
  16138. const slotsProperties = [];
  16139. const dynamicSlots = [];
  16140. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  16141. const onComponentSlot = findDir(node, "slot", true);
  16142. if (onComponentSlot) {
  16143. const { arg, exp } = onComponentSlot;
  16144. if (arg && !isStaticExp(arg)) {
  16145. hasDynamicSlots = true;
  16146. }
  16147. slotsProperties.push(
  16148. createObjectProperty(
  16149. arg || createSimpleExpression("default", true),
  16150. buildSlotFn(exp, void 0, children, loc)
  16151. )
  16152. );
  16153. }
  16154. let hasTemplateSlots = false;
  16155. let hasNamedDefaultSlot = false;
  16156. const implicitDefaultChildren = [];
  16157. const seenSlotNames = /* @__PURE__ */ new Set();
  16158. let conditionalBranchIndex = 0;
  16159. for (let i = 0; i < children.length; i++) {
  16160. const slotElement = children[i];
  16161. let slotDir;
  16162. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  16163. if (slotElement.type !== 3) {
  16164. implicitDefaultChildren.push(slotElement);
  16165. }
  16166. continue;
  16167. }
  16168. if (onComponentSlot) {
  16169. context.onError(
  16170. createCompilerError(37, slotDir.loc)
  16171. );
  16172. break;
  16173. }
  16174. hasTemplateSlots = true;
  16175. const { children: slotChildren, loc: slotLoc } = slotElement;
  16176. const {
  16177. arg: slotName = createSimpleExpression(`default`, true),
  16178. exp: slotProps,
  16179. loc: dirLoc
  16180. } = slotDir;
  16181. let staticSlotName;
  16182. if (isStaticExp(slotName)) {
  16183. staticSlotName = slotName ? slotName.content : `default`;
  16184. } else {
  16185. hasDynamicSlots = true;
  16186. }
  16187. const vFor = findDir(slotElement, "for");
  16188. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  16189. let vIf;
  16190. let vElse;
  16191. if (vIf = findDir(slotElement, "if")) {
  16192. hasDynamicSlots = true;
  16193. dynamicSlots.push(
  16194. createConditionalExpression(
  16195. vIf.exp,
  16196. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  16197. defaultFallback
  16198. )
  16199. );
  16200. } else if (vElse = findDir(
  16201. slotElement,
  16202. /^else(?:-if)?$/,
  16203. true
  16204. /* allowEmpty */
  16205. )) {
  16206. let j = i;
  16207. let prev;
  16208. while (j--) {
  16209. prev = children[j];
  16210. if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
  16211. break;
  16212. }
  16213. }
  16214. if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
  16215. let conditional = dynamicSlots[dynamicSlots.length - 1];
  16216. while (conditional.alternate.type === 19) {
  16217. conditional = conditional.alternate;
  16218. }
  16219. conditional.alternate = vElse.exp ? createConditionalExpression(
  16220. vElse.exp,
  16221. buildDynamicSlot(
  16222. slotName,
  16223. slotFunction,
  16224. conditionalBranchIndex++
  16225. ),
  16226. defaultFallback
  16227. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  16228. } else {
  16229. context.onError(
  16230. createCompilerError(30, vElse.loc)
  16231. );
  16232. }
  16233. } else if (vFor) {
  16234. hasDynamicSlots = true;
  16235. const parseResult = vFor.forParseResult;
  16236. if (parseResult) {
  16237. finalizeForParseResult(parseResult, context);
  16238. dynamicSlots.push(
  16239. createCallExpression(context.helper(RENDER_LIST), [
  16240. parseResult.source,
  16241. createFunctionExpression(
  16242. createForLoopParams(parseResult),
  16243. buildDynamicSlot(slotName, slotFunction),
  16244. true
  16245. )
  16246. ])
  16247. );
  16248. } else {
  16249. context.onError(
  16250. createCompilerError(
  16251. 32,
  16252. vFor.loc
  16253. )
  16254. );
  16255. }
  16256. } else {
  16257. if (staticSlotName) {
  16258. if (seenSlotNames.has(staticSlotName)) {
  16259. context.onError(
  16260. createCompilerError(
  16261. 38,
  16262. dirLoc
  16263. )
  16264. );
  16265. continue;
  16266. }
  16267. seenSlotNames.add(staticSlotName);
  16268. if (staticSlotName === "default") {
  16269. hasNamedDefaultSlot = true;
  16270. }
  16271. }
  16272. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  16273. }
  16274. }
  16275. if (!onComponentSlot) {
  16276. const buildDefaultSlotProperty = (props, children2) => {
  16277. const fn = buildSlotFn(props, void 0, children2, loc);
  16278. return createObjectProperty(`default`, fn);
  16279. };
  16280. if (!hasTemplateSlots) {
  16281. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  16282. } else if (implicitDefaultChildren.length && // #3766
  16283. // with whitespace: 'preserve', whitespaces between slots will end up in
  16284. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  16285. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  16286. if (hasNamedDefaultSlot) {
  16287. context.onError(
  16288. createCompilerError(
  16289. 39,
  16290. implicitDefaultChildren[0].loc
  16291. )
  16292. );
  16293. } else {
  16294. slotsProperties.push(
  16295. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  16296. );
  16297. }
  16298. }
  16299. }
  16300. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  16301. let slots = createObjectExpression(
  16302. slotsProperties.concat(
  16303. createObjectProperty(
  16304. `_`,
  16305. // 2 = compiled but dynamic = can skip normalization, but must run diff
  16306. // 1 = compiled and static = can skip normalization AND diff as optimized
  16307. createSimpleExpression(
  16308. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  16309. false
  16310. )
  16311. )
  16312. ),
  16313. loc
  16314. );
  16315. if (dynamicSlots.length) {
  16316. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  16317. slots,
  16318. createArrayExpression(dynamicSlots)
  16319. ]);
  16320. }
  16321. return {
  16322. slots,
  16323. hasDynamicSlots
  16324. };
  16325. }
  16326. function buildDynamicSlot(name, fn, index) {
  16327. const props = [
  16328. createObjectProperty(`name`, name),
  16329. createObjectProperty(`fn`, fn)
  16330. ];
  16331. if (index != null) {
  16332. props.push(
  16333. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  16334. );
  16335. }
  16336. return createObjectExpression(props);
  16337. }
  16338. function hasForwardedSlots(children) {
  16339. for (let i = 0; i < children.length; i++) {
  16340. const child = children[i];
  16341. switch (child.type) {
  16342. case 1:
  16343. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  16344. return true;
  16345. }
  16346. break;
  16347. case 9:
  16348. if (hasForwardedSlots(child.branches)) return true;
  16349. break;
  16350. case 10:
  16351. case 11:
  16352. if (hasForwardedSlots(child.children)) return true;
  16353. break;
  16354. }
  16355. }
  16356. return false;
  16357. }
  16358. function isNonWhitespaceContent(node) {
  16359. if (node.type !== 2 && node.type !== 12)
  16360. return true;
  16361. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  16362. }
  16363. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  16364. const transformElement = (node, context) => {
  16365. return function postTransformElement() {
  16366. node = context.currentNode;
  16367. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  16368. return;
  16369. }
  16370. const { tag, props } = node;
  16371. const isComponent = node.tagType === 1;
  16372. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  16373. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  16374. let vnodeProps;
  16375. let vnodeChildren;
  16376. let patchFlag = 0;
  16377. let vnodeDynamicProps;
  16378. let dynamicPropNames;
  16379. let vnodeDirectives;
  16380. let shouldUseBlock = (
  16381. // dynamic component may resolve to plain elements
  16382. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  16383. // updates inside get proper isSVG flag at runtime. (#639, #643)
  16384. // This is technically web-specific, but splitting the logic out of core
  16385. // leads to too much unnecessary complexity.
  16386. (tag === "svg" || tag === "foreignObject" || tag === "math")
  16387. );
  16388. if (props.length > 0) {
  16389. const propsBuildResult = buildProps(
  16390. node,
  16391. context,
  16392. void 0,
  16393. isComponent,
  16394. isDynamicComponent
  16395. );
  16396. vnodeProps = propsBuildResult.props;
  16397. patchFlag = propsBuildResult.patchFlag;
  16398. dynamicPropNames = propsBuildResult.dynamicPropNames;
  16399. const directives = propsBuildResult.directives;
  16400. vnodeDirectives = directives && directives.length ? createArrayExpression(
  16401. directives.map((dir) => buildDirectiveArgs(dir, context))
  16402. ) : void 0;
  16403. if (propsBuildResult.shouldUseBlock) {
  16404. shouldUseBlock = true;
  16405. }
  16406. }
  16407. if (node.children.length > 0) {
  16408. if (vnodeTag === KEEP_ALIVE) {
  16409. shouldUseBlock = true;
  16410. patchFlag |= 1024;
  16411. if (node.children.length > 1) {
  16412. context.onError(
  16413. createCompilerError(46, {
  16414. start: node.children[0].loc.start,
  16415. end: node.children[node.children.length - 1].loc.end,
  16416. source: ""
  16417. })
  16418. );
  16419. }
  16420. }
  16421. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  16422. vnodeTag !== TELEPORT && // explained above.
  16423. vnodeTag !== KEEP_ALIVE;
  16424. if (shouldBuildAsSlots) {
  16425. const { slots, hasDynamicSlots } = buildSlots(node, context);
  16426. vnodeChildren = slots;
  16427. if (hasDynamicSlots) {
  16428. patchFlag |= 1024;
  16429. }
  16430. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  16431. const child = node.children[0];
  16432. const type = child.type;
  16433. const hasDynamicTextChild = type === 5 || type === 8;
  16434. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  16435. patchFlag |= 1;
  16436. }
  16437. if (hasDynamicTextChild || type === 2) {
  16438. vnodeChildren = child;
  16439. } else {
  16440. vnodeChildren = node.children;
  16441. }
  16442. } else {
  16443. vnodeChildren = node.children;
  16444. }
  16445. }
  16446. if (dynamicPropNames && dynamicPropNames.length) {
  16447. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  16448. }
  16449. node.codegenNode = createVNodeCall(
  16450. context,
  16451. vnodeTag,
  16452. vnodeProps,
  16453. vnodeChildren,
  16454. patchFlag === 0 ? void 0 : patchFlag,
  16455. vnodeDynamicProps,
  16456. vnodeDirectives,
  16457. !!shouldUseBlock,
  16458. false,
  16459. isComponent,
  16460. node.loc
  16461. );
  16462. };
  16463. };
  16464. function resolveComponentType(node, context, ssr = false) {
  16465. let { tag } = node;
  16466. const isExplicitDynamic = isComponentTag(tag);
  16467. const isProp = findProp(
  16468. node,
  16469. "is",
  16470. false,
  16471. true
  16472. /* allow empty */
  16473. );
  16474. if (isProp) {
  16475. if (isExplicitDynamic || false) {
  16476. let exp;
  16477. if (isProp.type === 6) {
  16478. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  16479. } else {
  16480. exp = isProp.exp;
  16481. if (!exp) {
  16482. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  16483. }
  16484. }
  16485. if (exp) {
  16486. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  16487. exp
  16488. ]);
  16489. }
  16490. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  16491. tag = isProp.value.content.slice(4);
  16492. }
  16493. }
  16494. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  16495. if (builtIn) {
  16496. if (!ssr) context.helper(builtIn);
  16497. return builtIn;
  16498. }
  16499. context.helper(RESOLVE_COMPONENT);
  16500. context.components.add(tag);
  16501. return toValidAssetId(tag, `component`);
  16502. }
  16503. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  16504. const { tag, loc: elementLoc, children } = node;
  16505. let properties = [];
  16506. const mergeArgs = [];
  16507. const runtimeDirectives = [];
  16508. const hasChildren = children.length > 0;
  16509. let shouldUseBlock = false;
  16510. let patchFlag = 0;
  16511. let hasRef = false;
  16512. let hasClassBinding = false;
  16513. let hasStyleBinding = false;
  16514. let hasHydrationEventBinding = false;
  16515. let hasDynamicKeys = false;
  16516. let hasVnodeHook = false;
  16517. const dynamicPropNames = [];
  16518. const pushMergeArg = (arg) => {
  16519. if (properties.length) {
  16520. mergeArgs.push(
  16521. createObjectExpression(dedupeProperties(properties), elementLoc)
  16522. );
  16523. properties = [];
  16524. }
  16525. if (arg) mergeArgs.push(arg);
  16526. };
  16527. const pushRefVForMarker = () => {
  16528. if (context.scopes.vFor > 0) {
  16529. properties.push(
  16530. createObjectProperty(
  16531. createSimpleExpression("ref_for", true),
  16532. createSimpleExpression("true")
  16533. )
  16534. );
  16535. }
  16536. };
  16537. const analyzePatchFlag = ({ key, value }) => {
  16538. if (isStaticExp(key)) {
  16539. const name = key.content;
  16540. const isEventHandler = isOn(name);
  16541. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  16542. // dedicated fast path.
  16543. name.toLowerCase() !== "onclick" && // omit v-model handlers
  16544. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  16545. !isReservedProp(name)) {
  16546. hasHydrationEventBinding = true;
  16547. }
  16548. if (isEventHandler && isReservedProp(name)) {
  16549. hasVnodeHook = true;
  16550. }
  16551. if (isEventHandler && value.type === 14) {
  16552. value = value.arguments[0];
  16553. }
  16554. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  16555. return;
  16556. }
  16557. if (name === "ref") {
  16558. hasRef = true;
  16559. } else if (name === "class") {
  16560. hasClassBinding = true;
  16561. } else if (name === "style") {
  16562. hasStyleBinding = true;
  16563. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  16564. dynamicPropNames.push(name);
  16565. }
  16566. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  16567. dynamicPropNames.push(name);
  16568. }
  16569. } else {
  16570. hasDynamicKeys = true;
  16571. }
  16572. };
  16573. for (let i = 0; i < props.length; i++) {
  16574. const prop = props[i];
  16575. if (prop.type === 6) {
  16576. const { loc, name, nameLoc, value } = prop;
  16577. let isStatic = true;
  16578. if (name === "ref") {
  16579. hasRef = true;
  16580. pushRefVForMarker();
  16581. }
  16582. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  16583. continue;
  16584. }
  16585. properties.push(
  16586. createObjectProperty(
  16587. createSimpleExpression(name, true, nameLoc),
  16588. createSimpleExpression(
  16589. value ? value.content : "",
  16590. isStatic,
  16591. value ? value.loc : loc
  16592. )
  16593. )
  16594. );
  16595. } else {
  16596. const { name, arg, exp, loc, modifiers } = prop;
  16597. const isVBind = name === "bind";
  16598. const isVOn = name === "on";
  16599. if (name === "slot") {
  16600. if (!isComponent) {
  16601. context.onError(
  16602. createCompilerError(40, loc)
  16603. );
  16604. }
  16605. continue;
  16606. }
  16607. if (name === "once" || name === "memo") {
  16608. continue;
  16609. }
  16610. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  16611. continue;
  16612. }
  16613. if (isVOn && ssr) {
  16614. continue;
  16615. }
  16616. if (
  16617. // #938: elements with dynamic keys should be forced into blocks
  16618. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  16619. // before children
  16620. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  16621. ) {
  16622. shouldUseBlock = true;
  16623. }
  16624. if (isVBind && isStaticArgOf(arg, "ref")) {
  16625. pushRefVForMarker();
  16626. }
  16627. if (!arg && (isVBind || isVOn)) {
  16628. hasDynamicKeys = true;
  16629. if (exp) {
  16630. if (isVBind) {
  16631. pushRefVForMarker();
  16632. pushMergeArg();
  16633. mergeArgs.push(exp);
  16634. } else {
  16635. pushMergeArg({
  16636. type: 14,
  16637. loc,
  16638. callee: context.helper(TO_HANDLERS),
  16639. arguments: isComponent ? [exp] : [exp, `true`]
  16640. });
  16641. }
  16642. } else {
  16643. context.onError(
  16644. createCompilerError(
  16645. isVBind ? 34 : 35,
  16646. loc
  16647. )
  16648. );
  16649. }
  16650. continue;
  16651. }
  16652. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  16653. patchFlag |= 32;
  16654. }
  16655. const directiveTransform = context.directiveTransforms[name];
  16656. if (directiveTransform) {
  16657. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  16658. !ssr && props2.forEach(analyzePatchFlag);
  16659. if (isVOn && arg && !isStaticExp(arg)) {
  16660. pushMergeArg(createObjectExpression(props2, elementLoc));
  16661. } else {
  16662. properties.push(...props2);
  16663. }
  16664. if (needRuntime) {
  16665. runtimeDirectives.push(prop);
  16666. if (isSymbol(needRuntime)) {
  16667. directiveImportMap.set(prop, needRuntime);
  16668. }
  16669. }
  16670. } else if (!isBuiltInDirective(name)) {
  16671. runtimeDirectives.push(prop);
  16672. if (hasChildren) {
  16673. shouldUseBlock = true;
  16674. }
  16675. }
  16676. }
  16677. }
  16678. let propsExpression = void 0;
  16679. if (mergeArgs.length) {
  16680. pushMergeArg();
  16681. if (mergeArgs.length > 1) {
  16682. propsExpression = createCallExpression(
  16683. context.helper(MERGE_PROPS),
  16684. mergeArgs,
  16685. elementLoc
  16686. );
  16687. } else {
  16688. propsExpression = mergeArgs[0];
  16689. }
  16690. } else if (properties.length) {
  16691. propsExpression = createObjectExpression(
  16692. dedupeProperties(properties),
  16693. elementLoc
  16694. );
  16695. }
  16696. if (hasDynamicKeys) {
  16697. patchFlag |= 16;
  16698. } else {
  16699. if (hasClassBinding && !isComponent) {
  16700. patchFlag |= 2;
  16701. }
  16702. if (hasStyleBinding && !isComponent) {
  16703. patchFlag |= 4;
  16704. }
  16705. if (dynamicPropNames.length) {
  16706. patchFlag |= 8;
  16707. }
  16708. if (hasHydrationEventBinding) {
  16709. patchFlag |= 32;
  16710. }
  16711. }
  16712. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  16713. patchFlag |= 512;
  16714. }
  16715. if (!context.inSSR && propsExpression) {
  16716. switch (propsExpression.type) {
  16717. case 15:
  16718. let classKeyIndex = -1;
  16719. let styleKeyIndex = -1;
  16720. let hasDynamicKey = false;
  16721. for (let i = 0; i < propsExpression.properties.length; i++) {
  16722. const key = propsExpression.properties[i].key;
  16723. if (isStaticExp(key)) {
  16724. if (key.content === "class") {
  16725. classKeyIndex = i;
  16726. } else if (key.content === "style") {
  16727. styleKeyIndex = i;
  16728. }
  16729. } else if (!key.isHandlerKey) {
  16730. hasDynamicKey = true;
  16731. }
  16732. }
  16733. const classProp = propsExpression.properties[classKeyIndex];
  16734. const styleProp = propsExpression.properties[styleKeyIndex];
  16735. if (!hasDynamicKey) {
  16736. if (classProp && !isStaticExp(classProp.value)) {
  16737. classProp.value = createCallExpression(
  16738. context.helper(NORMALIZE_CLASS),
  16739. [classProp.value]
  16740. );
  16741. }
  16742. if (styleProp && // the static style is compiled into an object,
  16743. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  16744. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  16745. // v-bind:style with static literal object
  16746. styleProp.value.type === 17)) {
  16747. styleProp.value = createCallExpression(
  16748. context.helper(NORMALIZE_STYLE),
  16749. [styleProp.value]
  16750. );
  16751. }
  16752. } else {
  16753. propsExpression = createCallExpression(
  16754. context.helper(NORMALIZE_PROPS),
  16755. [propsExpression]
  16756. );
  16757. }
  16758. break;
  16759. case 14:
  16760. break;
  16761. default:
  16762. propsExpression = createCallExpression(
  16763. context.helper(NORMALIZE_PROPS),
  16764. [
  16765. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  16766. propsExpression
  16767. ])
  16768. ]
  16769. );
  16770. break;
  16771. }
  16772. }
  16773. return {
  16774. props: propsExpression,
  16775. directives: runtimeDirectives,
  16776. patchFlag,
  16777. dynamicPropNames,
  16778. shouldUseBlock
  16779. };
  16780. }
  16781. function dedupeProperties(properties) {
  16782. const knownProps = /* @__PURE__ */ new Map();
  16783. const deduped = [];
  16784. for (let i = 0; i < properties.length; i++) {
  16785. const prop = properties[i];
  16786. if (prop.key.type === 8 || !prop.key.isStatic) {
  16787. deduped.push(prop);
  16788. continue;
  16789. }
  16790. const name = prop.key.content;
  16791. const existing = knownProps.get(name);
  16792. if (existing) {
  16793. if (name === "style" || name === "class" || isOn(name)) {
  16794. mergeAsArray(existing, prop);
  16795. }
  16796. } else {
  16797. knownProps.set(name, prop);
  16798. deduped.push(prop);
  16799. }
  16800. }
  16801. return deduped;
  16802. }
  16803. function mergeAsArray(existing, incoming) {
  16804. if (existing.value.type === 17) {
  16805. existing.value.elements.push(incoming.value);
  16806. } else {
  16807. existing.value = createArrayExpression(
  16808. [existing.value, incoming.value],
  16809. existing.loc
  16810. );
  16811. }
  16812. }
  16813. function buildDirectiveArgs(dir, context) {
  16814. const dirArgs = [];
  16815. const runtime = directiveImportMap.get(dir);
  16816. if (runtime) {
  16817. dirArgs.push(context.helperString(runtime));
  16818. } else {
  16819. {
  16820. context.helper(RESOLVE_DIRECTIVE);
  16821. context.directives.add(dir.name);
  16822. dirArgs.push(toValidAssetId(dir.name, `directive`));
  16823. }
  16824. }
  16825. const { loc } = dir;
  16826. if (dir.exp) dirArgs.push(dir.exp);
  16827. if (dir.arg) {
  16828. if (!dir.exp) {
  16829. dirArgs.push(`void 0`);
  16830. }
  16831. dirArgs.push(dir.arg);
  16832. }
  16833. if (Object.keys(dir.modifiers).length) {
  16834. if (!dir.arg) {
  16835. if (!dir.exp) {
  16836. dirArgs.push(`void 0`);
  16837. }
  16838. dirArgs.push(`void 0`);
  16839. }
  16840. const trueExpression = createSimpleExpression(`true`, false, loc);
  16841. dirArgs.push(
  16842. createObjectExpression(
  16843. dir.modifiers.map(
  16844. (modifier) => createObjectProperty(modifier, trueExpression)
  16845. ),
  16846. loc
  16847. )
  16848. );
  16849. }
  16850. return createArrayExpression(dirArgs, dir.loc);
  16851. }
  16852. function stringifyDynamicPropNames(props) {
  16853. let propsNamesString = `[`;
  16854. for (let i = 0, l = props.length; i < l; i++) {
  16855. propsNamesString += JSON.stringify(props[i]);
  16856. if (i < l - 1) propsNamesString += ", ";
  16857. }
  16858. return propsNamesString + `]`;
  16859. }
  16860. function isComponentTag(tag) {
  16861. return tag === "component" || tag === "Component";
  16862. }
  16863. const transformSlotOutlet = (node, context) => {
  16864. if (isSlotOutlet(node)) {
  16865. const { children, loc } = node;
  16866. const { slotName, slotProps } = processSlotOutlet(node, context);
  16867. const slotArgs = [
  16868. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  16869. slotName,
  16870. "{}",
  16871. "undefined",
  16872. "true"
  16873. ];
  16874. let expectedLen = 2;
  16875. if (slotProps) {
  16876. slotArgs[2] = slotProps;
  16877. expectedLen = 3;
  16878. }
  16879. if (children.length) {
  16880. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  16881. expectedLen = 4;
  16882. }
  16883. if (context.scopeId && !context.slotted) {
  16884. expectedLen = 5;
  16885. }
  16886. slotArgs.splice(expectedLen);
  16887. node.codegenNode = createCallExpression(
  16888. context.helper(RENDER_SLOT),
  16889. slotArgs,
  16890. loc
  16891. );
  16892. }
  16893. };
  16894. function processSlotOutlet(node, context) {
  16895. let slotName = `"default"`;
  16896. let slotProps = void 0;
  16897. const nonNameProps = [];
  16898. for (let i = 0; i < node.props.length; i++) {
  16899. const p = node.props[i];
  16900. if (p.type === 6) {
  16901. if (p.value) {
  16902. if (p.name === "name") {
  16903. slotName = JSON.stringify(p.value.content);
  16904. } else {
  16905. p.name = camelize(p.name);
  16906. nonNameProps.push(p);
  16907. }
  16908. }
  16909. } else {
  16910. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  16911. if (p.exp) {
  16912. slotName = p.exp;
  16913. } else if (p.arg && p.arg.type === 4) {
  16914. const name = camelize(p.arg.content);
  16915. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  16916. }
  16917. } else {
  16918. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  16919. p.arg.content = camelize(p.arg.content);
  16920. }
  16921. nonNameProps.push(p);
  16922. }
  16923. }
  16924. }
  16925. if (nonNameProps.length > 0) {
  16926. const { props, directives } = buildProps(
  16927. node,
  16928. context,
  16929. nonNameProps,
  16930. false,
  16931. false
  16932. );
  16933. slotProps = props;
  16934. if (directives.length) {
  16935. context.onError(
  16936. createCompilerError(
  16937. 36,
  16938. directives[0].loc
  16939. )
  16940. );
  16941. }
  16942. }
  16943. return {
  16944. slotName,
  16945. slotProps
  16946. };
  16947. }
  16948. const transformOn$1 = (dir, node, context, augmentor) => {
  16949. const { loc, modifiers, arg } = dir;
  16950. if (!dir.exp && !modifiers.length) {
  16951. context.onError(createCompilerError(35, loc));
  16952. }
  16953. let eventName;
  16954. if (arg.type === 4) {
  16955. if (arg.isStatic) {
  16956. let rawName = arg.content;
  16957. if (rawName.startsWith("vnode")) {
  16958. context.onError(createCompilerError(51, arg.loc));
  16959. }
  16960. if (rawName.startsWith("vue:")) {
  16961. rawName = `vnode-${rawName.slice(4)}`;
  16962. }
  16963. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  16964. // for non-element and vnode lifecycle event listeners, auto convert
  16965. // it to camelCase. See issue #2249
  16966. toHandlerKey(camelize(rawName))
  16967. ) : (
  16968. // preserve case for plain element listeners that have uppercase
  16969. // letters, as these may be custom elements' custom events
  16970. `on:${rawName}`
  16971. );
  16972. eventName = createSimpleExpression(eventString, true, arg.loc);
  16973. } else {
  16974. eventName = createCompoundExpression([
  16975. `${context.helperString(TO_HANDLER_KEY)}(`,
  16976. arg,
  16977. `)`
  16978. ]);
  16979. }
  16980. } else {
  16981. eventName = arg;
  16982. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  16983. eventName.children.push(`)`);
  16984. }
  16985. let exp = dir.exp;
  16986. if (exp && !exp.content.trim()) {
  16987. exp = void 0;
  16988. }
  16989. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  16990. if (exp) {
  16991. const isMemberExp = isMemberExpression(exp);
  16992. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  16993. const hasMultipleStatements = exp.content.includes(`;`);
  16994. {
  16995. validateBrowserExpression(
  16996. exp,
  16997. context,
  16998. false,
  16999. hasMultipleStatements
  17000. );
  17001. }
  17002. if (isInlineStatement || shouldCache && isMemberExp) {
  17003. exp = createCompoundExpression([
  17004. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  17005. exp,
  17006. hasMultipleStatements ? `}` : `)`
  17007. ]);
  17008. }
  17009. }
  17010. let ret = {
  17011. props: [
  17012. createObjectProperty(
  17013. eventName,
  17014. exp || createSimpleExpression(`() => {}`, false, loc)
  17015. )
  17016. ]
  17017. };
  17018. if (augmentor) {
  17019. ret = augmentor(ret);
  17020. }
  17021. if (shouldCache) {
  17022. ret.props[0].value = context.cache(ret.props[0].value);
  17023. }
  17024. ret.props.forEach((p) => p.key.isHandlerKey = true);
  17025. return ret;
  17026. };
  17027. const transformText = (node, context) => {
  17028. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  17029. return () => {
  17030. const children = node.children;
  17031. let currentContainer = void 0;
  17032. let hasText = false;
  17033. for (let i = 0; i < children.length; i++) {
  17034. const child = children[i];
  17035. if (isText$1(child)) {
  17036. hasText = true;
  17037. for (let j = i + 1; j < children.length; j++) {
  17038. const next = children[j];
  17039. if (isText$1(next)) {
  17040. if (!currentContainer) {
  17041. currentContainer = children[i] = createCompoundExpression(
  17042. [child],
  17043. child.loc
  17044. );
  17045. }
  17046. currentContainer.children.push(` + `, next);
  17047. children.splice(j, 1);
  17048. j--;
  17049. } else {
  17050. currentContainer = void 0;
  17051. break;
  17052. }
  17053. }
  17054. }
  17055. }
  17056. if (!hasText || // if this is a plain element with a single text child, leave it
  17057. // as-is since the runtime has dedicated fast path for this by directly
  17058. // setting textContent of the element.
  17059. // for component root it's always normalized anyway.
  17060. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  17061. // custom directives can potentially add DOM elements arbitrarily,
  17062. // we need to avoid setting textContent of the element at runtime
  17063. // to avoid accidentally overwriting the DOM elements added
  17064. // by the user through custom directives.
  17065. !node.props.find(
  17066. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  17067. ) && // in compat mode, <template> tags with no special directives
  17068. // will be rendered as a fragment so its children must be
  17069. // converted into vnodes.
  17070. true)) {
  17071. return;
  17072. }
  17073. for (let i = 0; i < children.length; i++) {
  17074. const child = children[i];
  17075. if (isText$1(child) || child.type === 8) {
  17076. const callArgs = [];
  17077. if (child.type !== 2 || child.content !== " ") {
  17078. callArgs.push(child);
  17079. }
  17080. if (!context.ssr && getConstantType(child, context) === 0) {
  17081. callArgs.push(
  17082. 1 + (` /* ${PatchFlagNames[1]} */` )
  17083. );
  17084. }
  17085. children[i] = {
  17086. type: 12,
  17087. content: child,
  17088. loc: child.loc,
  17089. codegenNode: createCallExpression(
  17090. context.helper(CREATE_TEXT),
  17091. callArgs
  17092. )
  17093. };
  17094. }
  17095. }
  17096. };
  17097. }
  17098. };
  17099. const seen$1 = /* @__PURE__ */ new WeakSet();
  17100. const transformOnce = (node, context) => {
  17101. if (node.type === 1 && findDir(node, "once", true)) {
  17102. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  17103. return;
  17104. }
  17105. seen$1.add(node);
  17106. context.inVOnce = true;
  17107. context.helper(SET_BLOCK_TRACKING);
  17108. return () => {
  17109. context.inVOnce = false;
  17110. const cur = context.currentNode;
  17111. if (cur.codegenNode) {
  17112. cur.codegenNode = context.cache(
  17113. cur.codegenNode,
  17114. true,
  17115. true
  17116. );
  17117. }
  17118. };
  17119. }
  17120. };
  17121. const transformModel$1 = (dir, node, context) => {
  17122. const { exp, arg } = dir;
  17123. if (!exp) {
  17124. context.onError(
  17125. createCompilerError(41, dir.loc)
  17126. );
  17127. return createTransformProps();
  17128. }
  17129. const rawExp = exp.loc.source.trim();
  17130. const expString = exp.type === 4 ? exp.content : rawExp;
  17131. const bindingType = context.bindingMetadata[rawExp];
  17132. if (bindingType === "props" || bindingType === "props-aliased") {
  17133. context.onError(createCompilerError(44, exp.loc));
  17134. return createTransformProps();
  17135. }
  17136. if (!expString.trim() || !isMemberExpression(exp) && true) {
  17137. context.onError(
  17138. createCompilerError(42, exp.loc)
  17139. );
  17140. return createTransformProps();
  17141. }
  17142. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  17143. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  17144. let assignmentExp;
  17145. const eventArg = context.isTS ? `($event: any)` : `$event`;
  17146. {
  17147. assignmentExp = createCompoundExpression([
  17148. `${eventArg} => ((`,
  17149. exp,
  17150. `) = $event)`
  17151. ]);
  17152. }
  17153. const props = [
  17154. // modelValue: foo
  17155. createObjectProperty(propName, dir.exp),
  17156. // "onUpdate:modelValue": $event => (foo = $event)
  17157. createObjectProperty(eventName, assignmentExp)
  17158. ];
  17159. if (dir.modifiers.length && node.tagType === 1) {
  17160. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  17161. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  17162. props.push(
  17163. createObjectProperty(
  17164. modifiersKey,
  17165. createSimpleExpression(
  17166. `{ ${modifiers} }`,
  17167. false,
  17168. dir.loc,
  17169. 2
  17170. )
  17171. )
  17172. );
  17173. }
  17174. return createTransformProps(props);
  17175. };
  17176. function createTransformProps(props = []) {
  17177. return { props };
  17178. }
  17179. const seen = /* @__PURE__ */ new WeakSet();
  17180. const transformMemo = (node, context) => {
  17181. if (node.type === 1) {
  17182. const dir = findDir(node, "memo");
  17183. if (!dir || seen.has(node) || context.inSSR) {
  17184. return;
  17185. }
  17186. seen.add(node);
  17187. return () => {
  17188. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  17189. if (codegenNode && codegenNode.type === 13) {
  17190. if (node.tagType !== 1) {
  17191. convertToBlock(codegenNode, context);
  17192. }
  17193. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  17194. dir.exp,
  17195. createFunctionExpression(void 0, codegenNode),
  17196. `_cache`,
  17197. String(context.cached.length)
  17198. ]);
  17199. context.cached.push(null);
  17200. }
  17201. };
  17202. }
  17203. };
  17204. function getBaseTransformPreset(prefixIdentifiers) {
  17205. return [
  17206. [
  17207. transformOnce,
  17208. transformIf,
  17209. transformMemo,
  17210. transformFor,
  17211. ...[],
  17212. ...[transformExpression] ,
  17213. transformSlotOutlet,
  17214. transformElement,
  17215. trackSlotScopes,
  17216. transformText
  17217. ],
  17218. {
  17219. on: transformOn$1,
  17220. bind: transformBind,
  17221. model: transformModel$1
  17222. }
  17223. ];
  17224. }
  17225. function baseCompile(source, options = {}) {
  17226. const onError = options.onError || defaultOnError;
  17227. const isModuleMode = options.mode === "module";
  17228. {
  17229. if (options.prefixIdentifiers === true) {
  17230. onError(createCompilerError(47));
  17231. } else if (isModuleMode) {
  17232. onError(createCompilerError(48));
  17233. }
  17234. }
  17235. const prefixIdentifiers = false;
  17236. if (options.cacheHandlers) {
  17237. onError(createCompilerError(49));
  17238. }
  17239. if (options.scopeId && !isModuleMode) {
  17240. onError(createCompilerError(50));
  17241. }
  17242. const resolvedOptions = extend({}, options, {
  17243. prefixIdentifiers
  17244. });
  17245. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  17246. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  17247. transform(
  17248. ast,
  17249. extend({}, resolvedOptions, {
  17250. nodeTransforms: [
  17251. ...nodeTransforms,
  17252. ...options.nodeTransforms || []
  17253. // user transforms
  17254. ],
  17255. directiveTransforms: extend(
  17256. {},
  17257. directiveTransforms,
  17258. options.directiveTransforms || {}
  17259. // user transforms
  17260. )
  17261. })
  17262. );
  17263. return generate(ast, resolvedOptions);
  17264. }
  17265. const noopDirectiveTransform = () => ({ props: [] });
  17266. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  17267. const V_MODEL_CHECKBOX = Symbol(
  17268. `vModelCheckbox`
  17269. );
  17270. const V_MODEL_TEXT = Symbol(`vModelText` );
  17271. const V_MODEL_SELECT = Symbol(
  17272. `vModelSelect`
  17273. );
  17274. const V_MODEL_DYNAMIC = Symbol(
  17275. `vModelDynamic`
  17276. );
  17277. const V_ON_WITH_MODIFIERS = Symbol(
  17278. `vOnModifiersGuard`
  17279. );
  17280. const V_ON_WITH_KEYS = Symbol(
  17281. `vOnKeysGuard`
  17282. );
  17283. const V_SHOW = Symbol(`vShow` );
  17284. const TRANSITION = Symbol(`Transition` );
  17285. const TRANSITION_GROUP = Symbol(
  17286. `TransitionGroup`
  17287. );
  17288. registerRuntimeHelpers({
  17289. [V_MODEL_RADIO]: `vModelRadio`,
  17290. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  17291. [V_MODEL_TEXT]: `vModelText`,
  17292. [V_MODEL_SELECT]: `vModelSelect`,
  17293. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  17294. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  17295. [V_ON_WITH_KEYS]: `withKeys`,
  17296. [V_SHOW]: `vShow`,
  17297. [TRANSITION]: `Transition`,
  17298. [TRANSITION_GROUP]: `TransitionGroup`
  17299. });
  17300. let decoder;
  17301. function decodeHtmlBrowser(raw, asAttr = false) {
  17302. if (!decoder) {
  17303. decoder = document.createElement("div");
  17304. }
  17305. if (asAttr) {
  17306. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  17307. return decoder.children[0].getAttribute("foo");
  17308. } else {
  17309. decoder.innerHTML = raw;
  17310. return decoder.textContent;
  17311. }
  17312. }
  17313. const parserOptions = {
  17314. parseMode: "html",
  17315. isVoidTag,
  17316. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  17317. isPreTag: (tag) => tag === "pre",
  17318. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  17319. decodeEntities: decodeHtmlBrowser ,
  17320. isBuiltInComponent: (tag) => {
  17321. if (tag === "Transition" || tag === "transition") {
  17322. return TRANSITION;
  17323. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  17324. return TRANSITION_GROUP;
  17325. }
  17326. },
  17327. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  17328. getNamespace(tag, parent, rootNamespace) {
  17329. let ns = parent ? parent.ns : rootNamespace;
  17330. if (parent && ns === 2) {
  17331. if (parent.tag === "annotation-xml") {
  17332. if (tag === "svg") {
  17333. return 1;
  17334. }
  17335. if (parent.props.some(
  17336. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  17337. )) {
  17338. ns = 0;
  17339. }
  17340. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  17341. ns = 0;
  17342. }
  17343. } else if (parent && ns === 1) {
  17344. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  17345. ns = 0;
  17346. }
  17347. }
  17348. if (ns === 0) {
  17349. if (tag === "svg") {
  17350. return 1;
  17351. }
  17352. if (tag === "math") {
  17353. return 2;
  17354. }
  17355. }
  17356. return ns;
  17357. }
  17358. };
  17359. const transformStyle = (node) => {
  17360. if (node.type === 1) {
  17361. node.props.forEach((p, i) => {
  17362. if (p.type === 6 && p.name === "style" && p.value) {
  17363. node.props[i] = {
  17364. type: 7,
  17365. name: `bind`,
  17366. arg: createSimpleExpression(`style`, true, p.loc),
  17367. exp: parseInlineCSS(p.value.content, p.loc),
  17368. modifiers: [],
  17369. loc: p.loc
  17370. };
  17371. }
  17372. });
  17373. }
  17374. };
  17375. const parseInlineCSS = (cssText, loc) => {
  17376. const normalized = parseStringStyle(cssText);
  17377. return createSimpleExpression(
  17378. JSON.stringify(normalized),
  17379. false,
  17380. loc,
  17381. 3
  17382. );
  17383. };
  17384. function createDOMCompilerError(code, loc) {
  17385. return createCompilerError(
  17386. code,
  17387. loc,
  17388. DOMErrorMessages
  17389. );
  17390. }
  17391. const DOMErrorMessages = {
  17392. [53]: `v-html is missing expression.`,
  17393. [54]: `v-html will override element children.`,
  17394. [55]: `v-text is missing expression.`,
  17395. [56]: `v-text will override element children.`,
  17396. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  17397. [58]: `v-model argument is not supported on plain elements.`,
  17398. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  17399. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  17400. [61]: `v-show is missing expression.`,
  17401. [62]: `<Transition> expects exactly one child element or component.`,
  17402. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  17403. };
  17404. const transformVHtml = (dir, node, context) => {
  17405. const { exp, loc } = dir;
  17406. if (!exp) {
  17407. context.onError(
  17408. createDOMCompilerError(53, loc)
  17409. );
  17410. }
  17411. if (node.children.length) {
  17412. context.onError(
  17413. createDOMCompilerError(54, loc)
  17414. );
  17415. node.children.length = 0;
  17416. }
  17417. return {
  17418. props: [
  17419. createObjectProperty(
  17420. createSimpleExpression(`innerHTML`, true, loc),
  17421. exp || createSimpleExpression("", true)
  17422. )
  17423. ]
  17424. };
  17425. };
  17426. const transformVText = (dir, node, context) => {
  17427. const { exp, loc } = dir;
  17428. if (!exp) {
  17429. context.onError(
  17430. createDOMCompilerError(55, loc)
  17431. );
  17432. }
  17433. if (node.children.length) {
  17434. context.onError(
  17435. createDOMCompilerError(56, loc)
  17436. );
  17437. node.children.length = 0;
  17438. }
  17439. return {
  17440. props: [
  17441. createObjectProperty(
  17442. createSimpleExpression(`textContent`, true),
  17443. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  17444. context.helperString(TO_DISPLAY_STRING),
  17445. [exp],
  17446. loc
  17447. ) : createSimpleExpression("", true)
  17448. )
  17449. ]
  17450. };
  17451. };
  17452. const transformModel = (dir, node, context) => {
  17453. const baseResult = transformModel$1(dir, node, context);
  17454. if (!baseResult.props.length || node.tagType === 1) {
  17455. return baseResult;
  17456. }
  17457. if (dir.arg) {
  17458. context.onError(
  17459. createDOMCompilerError(
  17460. 58,
  17461. dir.arg.loc
  17462. )
  17463. );
  17464. }
  17465. function checkDuplicatedValue() {
  17466. const value = findDir(node, "bind");
  17467. if (value && isStaticArgOf(value.arg, "value")) {
  17468. context.onError(
  17469. createDOMCompilerError(
  17470. 60,
  17471. value.loc
  17472. )
  17473. );
  17474. }
  17475. }
  17476. const { tag } = node;
  17477. const isCustomElement = context.isCustomElement(tag);
  17478. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  17479. let directiveToUse = V_MODEL_TEXT;
  17480. let isInvalidType = false;
  17481. if (tag === "input" || isCustomElement) {
  17482. const type = findProp(node, `type`);
  17483. if (type) {
  17484. if (type.type === 7) {
  17485. directiveToUse = V_MODEL_DYNAMIC;
  17486. } else if (type.value) {
  17487. switch (type.value.content) {
  17488. case "radio":
  17489. directiveToUse = V_MODEL_RADIO;
  17490. break;
  17491. case "checkbox":
  17492. directiveToUse = V_MODEL_CHECKBOX;
  17493. break;
  17494. case "file":
  17495. isInvalidType = true;
  17496. context.onError(
  17497. createDOMCompilerError(
  17498. 59,
  17499. dir.loc
  17500. )
  17501. );
  17502. break;
  17503. default:
  17504. checkDuplicatedValue();
  17505. break;
  17506. }
  17507. }
  17508. } else if (hasDynamicKeyVBind(node)) {
  17509. directiveToUse = V_MODEL_DYNAMIC;
  17510. } else {
  17511. checkDuplicatedValue();
  17512. }
  17513. } else if (tag === "select") {
  17514. directiveToUse = V_MODEL_SELECT;
  17515. } else {
  17516. checkDuplicatedValue();
  17517. }
  17518. if (!isInvalidType) {
  17519. baseResult.needRuntime = context.helper(directiveToUse);
  17520. }
  17521. } else {
  17522. context.onError(
  17523. createDOMCompilerError(
  17524. 57,
  17525. dir.loc
  17526. )
  17527. );
  17528. }
  17529. baseResult.props = baseResult.props.filter(
  17530. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  17531. );
  17532. return baseResult;
  17533. };
  17534. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  17535. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  17536. // event propagation management
  17537. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  17538. );
  17539. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  17540. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  17541. const resolveModifiers = (key, modifiers, context, loc) => {
  17542. const keyModifiers = [];
  17543. const nonKeyModifiers = [];
  17544. const eventOptionModifiers = [];
  17545. for (let i = 0; i < modifiers.length; i++) {
  17546. const modifier = modifiers[i].content;
  17547. if (isEventOptionModifier(modifier)) {
  17548. eventOptionModifiers.push(modifier);
  17549. } else {
  17550. if (maybeKeyModifier(modifier)) {
  17551. if (isStaticExp(key)) {
  17552. if (isKeyboardEvent(key.content.toLowerCase())) {
  17553. keyModifiers.push(modifier);
  17554. } else {
  17555. nonKeyModifiers.push(modifier);
  17556. }
  17557. } else {
  17558. keyModifiers.push(modifier);
  17559. nonKeyModifiers.push(modifier);
  17560. }
  17561. } else {
  17562. if (isNonKeyModifier(modifier)) {
  17563. nonKeyModifiers.push(modifier);
  17564. } else {
  17565. keyModifiers.push(modifier);
  17566. }
  17567. }
  17568. }
  17569. }
  17570. return {
  17571. keyModifiers,
  17572. nonKeyModifiers,
  17573. eventOptionModifiers
  17574. };
  17575. };
  17576. const transformClick = (key, event) => {
  17577. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  17578. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  17579. `(`,
  17580. key,
  17581. `) === "onClick" ? "${event}" : (`,
  17582. key,
  17583. `)`
  17584. ]) : key;
  17585. };
  17586. const transformOn = (dir, node, context) => {
  17587. return transformOn$1(dir, node, context, (baseResult) => {
  17588. const { modifiers } = dir;
  17589. if (!modifiers.length) return baseResult;
  17590. let { key, value: handlerExp } = baseResult.props[0];
  17591. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  17592. if (nonKeyModifiers.includes("right")) {
  17593. key = transformClick(key, `onContextmenu`);
  17594. }
  17595. if (nonKeyModifiers.includes("middle")) {
  17596. key = transformClick(key, `onMouseup`);
  17597. }
  17598. if (nonKeyModifiers.length) {
  17599. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  17600. handlerExp,
  17601. JSON.stringify(nonKeyModifiers)
  17602. ]);
  17603. }
  17604. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  17605. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  17606. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  17607. handlerExp,
  17608. JSON.stringify(keyModifiers)
  17609. ]);
  17610. }
  17611. if (eventOptionModifiers.length) {
  17612. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  17613. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  17614. }
  17615. return {
  17616. props: [createObjectProperty(key, handlerExp)]
  17617. };
  17618. });
  17619. };
  17620. const transformShow = (dir, node, context) => {
  17621. const { exp, loc } = dir;
  17622. if (!exp) {
  17623. context.onError(
  17624. createDOMCompilerError(61, loc)
  17625. );
  17626. }
  17627. return {
  17628. props: [],
  17629. needRuntime: context.helper(V_SHOW)
  17630. };
  17631. };
  17632. const transformTransition = (node, context) => {
  17633. if (node.type === 1 && node.tagType === 1) {
  17634. const component = context.isBuiltInComponent(node.tag);
  17635. if (component === TRANSITION) {
  17636. return () => {
  17637. if (!node.children.length) {
  17638. return;
  17639. }
  17640. if (hasMultipleChildren(node)) {
  17641. context.onError(
  17642. createDOMCompilerError(
  17643. 62,
  17644. {
  17645. start: node.children[0].loc.start,
  17646. end: node.children[node.children.length - 1].loc.end,
  17647. source: ""
  17648. }
  17649. )
  17650. );
  17651. }
  17652. const child = node.children[0];
  17653. if (child.type === 1) {
  17654. for (const p of child.props) {
  17655. if (p.type === 7 && p.name === "show") {
  17656. node.props.push({
  17657. type: 6,
  17658. name: "persisted",
  17659. nameLoc: node.loc,
  17660. value: void 0,
  17661. loc: node.loc
  17662. });
  17663. }
  17664. }
  17665. }
  17666. };
  17667. }
  17668. }
  17669. };
  17670. function hasMultipleChildren(node) {
  17671. const children = node.children = node.children.filter(
  17672. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  17673. );
  17674. const child = children[0];
  17675. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  17676. }
  17677. const ignoreSideEffectTags = (node, context) => {
  17678. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  17679. context.onError(
  17680. createDOMCompilerError(
  17681. 63,
  17682. node.loc
  17683. )
  17684. );
  17685. context.removeNode();
  17686. }
  17687. };
  17688. function isValidHTMLNesting(parent, child) {
  17689. if (parent === "template") {
  17690. return true;
  17691. }
  17692. if (parent in onlyValidChildren) {
  17693. return onlyValidChildren[parent].has(child);
  17694. }
  17695. if (child in onlyValidParents) {
  17696. return onlyValidParents[child].has(parent);
  17697. }
  17698. if (parent in knownInvalidChildren) {
  17699. if (knownInvalidChildren[parent].has(child)) return false;
  17700. }
  17701. if (child in knownInvalidParents) {
  17702. if (knownInvalidParents[child].has(parent)) return false;
  17703. }
  17704. return true;
  17705. }
  17706. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  17707. const emptySet = /* @__PURE__ */ new Set([]);
  17708. const onlyValidChildren = {
  17709. head: /* @__PURE__ */ new Set([
  17710. "base",
  17711. "basefront",
  17712. "bgsound",
  17713. "link",
  17714. "meta",
  17715. "title",
  17716. "noscript",
  17717. "noframes",
  17718. "style",
  17719. "script",
  17720. "template"
  17721. ]),
  17722. optgroup: /* @__PURE__ */ new Set(["option"]),
  17723. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  17724. // table
  17725. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  17726. tr: /* @__PURE__ */ new Set(["td", "th"]),
  17727. colgroup: /* @__PURE__ */ new Set(["col"]),
  17728. tbody: /* @__PURE__ */ new Set(["tr"]),
  17729. thead: /* @__PURE__ */ new Set(["tr"]),
  17730. tfoot: /* @__PURE__ */ new Set(["tr"]),
  17731. // these elements can not have any children elements
  17732. script: emptySet,
  17733. iframe: emptySet,
  17734. option: emptySet,
  17735. textarea: emptySet,
  17736. style: emptySet,
  17737. title: emptySet
  17738. };
  17739. const onlyValidParents = {
  17740. // sections
  17741. html: emptySet,
  17742. body: /* @__PURE__ */ new Set(["html"]),
  17743. head: /* @__PURE__ */ new Set(["html"]),
  17744. // table
  17745. td: /* @__PURE__ */ new Set(["tr"]),
  17746. colgroup: /* @__PURE__ */ new Set(["table"]),
  17747. caption: /* @__PURE__ */ new Set(["table"]),
  17748. tbody: /* @__PURE__ */ new Set(["table"]),
  17749. tfoot: /* @__PURE__ */ new Set(["table"]),
  17750. col: /* @__PURE__ */ new Set(["colgroup"]),
  17751. th: /* @__PURE__ */ new Set(["tr"]),
  17752. thead: /* @__PURE__ */ new Set(["table"]),
  17753. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  17754. // data list
  17755. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  17756. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  17757. // other
  17758. figcaption: /* @__PURE__ */ new Set(["figure"]),
  17759. // li: new Set(["ul", "ol"]),
  17760. summary: /* @__PURE__ */ new Set(["details"]),
  17761. area: /* @__PURE__ */ new Set(["map"])
  17762. };
  17763. const knownInvalidChildren = {
  17764. p: /* @__PURE__ */ new Set([
  17765. "address",
  17766. "article",
  17767. "aside",
  17768. "blockquote",
  17769. "center",
  17770. "details",
  17771. "dialog",
  17772. "dir",
  17773. "div",
  17774. "dl",
  17775. "fieldset",
  17776. "figure",
  17777. "footer",
  17778. "form",
  17779. "h1",
  17780. "h2",
  17781. "h3",
  17782. "h4",
  17783. "h5",
  17784. "h6",
  17785. "header",
  17786. "hgroup",
  17787. "hr",
  17788. "li",
  17789. "main",
  17790. "nav",
  17791. "menu",
  17792. "ol",
  17793. "p",
  17794. "pre",
  17795. "section",
  17796. "table",
  17797. "ul"
  17798. ]),
  17799. svg: /* @__PURE__ */ new Set([
  17800. "b",
  17801. "blockquote",
  17802. "br",
  17803. "code",
  17804. "dd",
  17805. "div",
  17806. "dl",
  17807. "dt",
  17808. "em",
  17809. "embed",
  17810. "h1",
  17811. "h2",
  17812. "h3",
  17813. "h4",
  17814. "h5",
  17815. "h6",
  17816. "hr",
  17817. "i",
  17818. "img",
  17819. "li",
  17820. "menu",
  17821. "meta",
  17822. "ol",
  17823. "p",
  17824. "pre",
  17825. "ruby",
  17826. "s",
  17827. "small",
  17828. "span",
  17829. "strong",
  17830. "sub",
  17831. "sup",
  17832. "table",
  17833. "u",
  17834. "ul",
  17835. "var"
  17836. ])
  17837. };
  17838. const knownInvalidParents = {
  17839. a: /* @__PURE__ */ new Set(["a"]),
  17840. button: /* @__PURE__ */ new Set(["button"]),
  17841. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  17842. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  17843. form: /* @__PURE__ */ new Set(["form"]),
  17844. li: /* @__PURE__ */ new Set(["li"]),
  17845. h1: headings,
  17846. h2: headings,
  17847. h3: headings,
  17848. h4: headings,
  17849. h5: headings,
  17850. h6: headings
  17851. };
  17852. const validateHtmlNesting = (node, context) => {
  17853. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  17854. const error = new SyntaxError(
  17855. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  17856. );
  17857. error.loc = node.loc;
  17858. context.onWarn(error);
  17859. }
  17860. };
  17861. const DOMNodeTransforms = [
  17862. transformStyle,
  17863. ...[transformTransition, validateHtmlNesting]
  17864. ];
  17865. const DOMDirectiveTransforms = {
  17866. cloak: noopDirectiveTransform,
  17867. html: transformVHtml,
  17868. text: transformVText,
  17869. model: transformModel,
  17870. // override compiler-core
  17871. on: transformOn,
  17872. // override compiler-core
  17873. show: transformShow
  17874. };
  17875. function compile(src, options = {}) {
  17876. return baseCompile(
  17877. src,
  17878. extend({}, parserOptions, options, {
  17879. nodeTransforms: [
  17880. // ignore <script> and <tag>
  17881. // this is not put inside DOMNodeTransforms because that list is used
  17882. // by compiler-ssr to generate vnode fallback branches
  17883. ignoreSideEffectTags,
  17884. ...DOMNodeTransforms,
  17885. ...options.nodeTransforms || []
  17886. ],
  17887. directiveTransforms: extend(
  17888. {},
  17889. DOMDirectiveTransforms,
  17890. options.directiveTransforms || {}
  17891. ),
  17892. transformHoist: null
  17893. })
  17894. );
  17895. }
  17896. {
  17897. initDev();
  17898. }
  17899. const compileCache = /* @__PURE__ */ Object.create(null);
  17900. function compileToFunction(template, options) {
  17901. if (!isString(template)) {
  17902. if (template.nodeType) {
  17903. template = template.innerHTML;
  17904. } else {
  17905. warn(`invalid template option: `, template);
  17906. return NOOP;
  17907. }
  17908. }
  17909. const key = genCacheKey(template, options);
  17910. const cached = compileCache[key];
  17911. if (cached) {
  17912. return cached;
  17913. }
  17914. if (template[0] === "#") {
  17915. const el = document.querySelector(template);
  17916. if (!el) {
  17917. warn(`Template element not found or is empty: ${template}`);
  17918. }
  17919. template = el ? el.innerHTML : ``;
  17920. }
  17921. const opts = extend(
  17922. {
  17923. hoistStatic: true,
  17924. onError: onError ,
  17925. onWarn: (e) => onError(e, true)
  17926. },
  17927. options
  17928. );
  17929. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  17930. opts.isCustomElement = (tag) => !!customElements.get(tag);
  17931. }
  17932. const { code } = compile(template, opts);
  17933. function onError(err, asWarning = false) {
  17934. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  17935. const codeFrame = err.loc && generateCodeFrame(
  17936. template,
  17937. err.loc.start.offset,
  17938. err.loc.end.offset
  17939. );
  17940. warn(codeFrame ? `${message}
  17941. ${codeFrame}` : message);
  17942. }
  17943. const render = new Function(code)() ;
  17944. render._rc = true;
  17945. return compileCache[key] = render;
  17946. }
  17947. registerRuntimeCompiler(compileToFunction);
  17948. exports.BaseTransition = BaseTransition;
  17949. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  17950. exports.Comment = Comment;
  17951. exports.DeprecationTypes = DeprecationTypes;
  17952. exports.EffectScope = EffectScope;
  17953. exports.ErrorCodes = ErrorCodes;
  17954. exports.ErrorTypeStrings = ErrorTypeStrings;
  17955. exports.Fragment = Fragment;
  17956. exports.KeepAlive = KeepAlive;
  17957. exports.ReactiveEffect = ReactiveEffect;
  17958. exports.Static = Static;
  17959. exports.Suspense = Suspense;
  17960. exports.Teleport = Teleport;
  17961. exports.Text = Text;
  17962. exports.TrackOpTypes = TrackOpTypes;
  17963. exports.Transition = Transition;
  17964. exports.TransitionGroup = TransitionGroup;
  17965. exports.TriggerOpTypes = TriggerOpTypes;
  17966. exports.VueElement = VueElement;
  17967. exports.assertNumber = assertNumber;
  17968. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  17969. exports.callWithErrorHandling = callWithErrorHandling;
  17970. exports.camelize = camelize;
  17971. exports.capitalize = capitalize;
  17972. exports.cloneVNode = cloneVNode;
  17973. exports.compatUtils = compatUtils;
  17974. exports.compile = compileToFunction;
  17975. exports.computed = computed;
  17976. exports.createApp = createApp;
  17977. exports.createBlock = createBlock;
  17978. exports.createCommentVNode = createCommentVNode;
  17979. exports.createElementBlock = createElementBlock;
  17980. exports.createElementVNode = createBaseVNode;
  17981. exports.createHydrationRenderer = createHydrationRenderer;
  17982. exports.createPropsRestProxy = createPropsRestProxy;
  17983. exports.createRenderer = createRenderer;
  17984. exports.createSSRApp = createSSRApp;
  17985. exports.createSlots = createSlots;
  17986. exports.createStaticVNode = createStaticVNode;
  17987. exports.createTextVNode = createTextVNode;
  17988. exports.createVNode = createVNode;
  17989. exports.customRef = customRef;
  17990. exports.defineAsyncComponent = defineAsyncComponent;
  17991. exports.defineComponent = defineComponent;
  17992. exports.defineCustomElement = defineCustomElement;
  17993. exports.defineEmits = defineEmits;
  17994. exports.defineExpose = defineExpose;
  17995. exports.defineModel = defineModel;
  17996. exports.defineOptions = defineOptions;
  17997. exports.defineProps = defineProps;
  17998. exports.defineSSRCustomElement = defineSSRCustomElement;
  17999. exports.defineSlots = defineSlots;
  18000. exports.devtools = devtools;
  18001. exports.effect = effect;
  18002. exports.effectScope = effectScope;
  18003. exports.getCurrentInstance = getCurrentInstance;
  18004. exports.getCurrentScope = getCurrentScope;
  18005. exports.getCurrentWatcher = getCurrentWatcher;
  18006. exports.getTransitionRawChildren = getTransitionRawChildren;
  18007. exports.guardReactiveProps = guardReactiveProps;
  18008. exports.h = h;
  18009. exports.handleError = handleError;
  18010. exports.hasInjectionContext = hasInjectionContext;
  18011. exports.hydrate = hydrate;
  18012. exports.hydrateOnIdle = hydrateOnIdle;
  18013. exports.hydrateOnInteraction = hydrateOnInteraction;
  18014. exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
  18015. exports.hydrateOnVisible = hydrateOnVisible;
  18016. exports.initCustomFormatter = initCustomFormatter;
  18017. exports.initDirectivesForSSR = initDirectivesForSSR;
  18018. exports.inject = inject;
  18019. exports.isMemoSame = isMemoSame;
  18020. exports.isProxy = isProxy;
  18021. exports.isReactive = isReactive;
  18022. exports.isReadonly = isReadonly;
  18023. exports.isRef = isRef;
  18024. exports.isRuntimeOnly = isRuntimeOnly;
  18025. exports.isShallow = isShallow;
  18026. exports.isVNode = isVNode;
  18027. exports.markRaw = markRaw;
  18028. exports.mergeDefaults = mergeDefaults;
  18029. exports.mergeModels = mergeModels;
  18030. exports.mergeProps = mergeProps;
  18031. exports.nextTick = nextTick;
  18032. exports.normalizeClass = normalizeClass;
  18033. exports.normalizeProps = normalizeProps;
  18034. exports.normalizeStyle = normalizeStyle;
  18035. exports.onActivated = onActivated;
  18036. exports.onBeforeMount = onBeforeMount;
  18037. exports.onBeforeUnmount = onBeforeUnmount;
  18038. exports.onBeforeUpdate = onBeforeUpdate;
  18039. exports.onDeactivated = onDeactivated;
  18040. exports.onErrorCaptured = onErrorCaptured;
  18041. exports.onMounted = onMounted;
  18042. exports.onRenderTracked = onRenderTracked;
  18043. exports.onRenderTriggered = onRenderTriggered;
  18044. exports.onScopeDispose = onScopeDispose;
  18045. exports.onServerPrefetch = onServerPrefetch;
  18046. exports.onUnmounted = onUnmounted;
  18047. exports.onUpdated = onUpdated;
  18048. exports.onWatcherCleanup = onWatcherCleanup;
  18049. exports.openBlock = openBlock;
  18050. exports.popScopeId = popScopeId;
  18051. exports.provide = provide;
  18052. exports.proxyRefs = proxyRefs;
  18053. exports.pushScopeId = pushScopeId;
  18054. exports.queuePostFlushCb = queuePostFlushCb;
  18055. exports.reactive = reactive;
  18056. exports.readonly = readonly;
  18057. exports.ref = ref;
  18058. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  18059. exports.render = render;
  18060. exports.renderList = renderList;
  18061. exports.renderSlot = renderSlot;
  18062. exports.resolveComponent = resolveComponent;
  18063. exports.resolveDirective = resolveDirective;
  18064. exports.resolveDynamicComponent = resolveDynamicComponent;
  18065. exports.resolveFilter = resolveFilter;
  18066. exports.resolveTransitionHooks = resolveTransitionHooks;
  18067. exports.setBlockTracking = setBlockTracking;
  18068. exports.setDevtoolsHook = setDevtoolsHook;
  18069. exports.setTransitionHooks = setTransitionHooks;
  18070. exports.shallowReactive = shallowReactive;
  18071. exports.shallowReadonly = shallowReadonly;
  18072. exports.shallowRef = shallowRef;
  18073. exports.ssrContextKey = ssrContextKey;
  18074. exports.ssrUtils = ssrUtils;
  18075. exports.stop = stop;
  18076. exports.toDisplayString = toDisplayString;
  18077. exports.toHandlerKey = toHandlerKey;
  18078. exports.toHandlers = toHandlers;
  18079. exports.toRaw = toRaw;
  18080. exports.toRef = toRef;
  18081. exports.toRefs = toRefs;
  18082. exports.toValue = toValue;
  18083. exports.transformVNodeArgs = transformVNodeArgs;
  18084. exports.triggerRef = triggerRef;
  18085. exports.unref = unref;
  18086. exports.useAttrs = useAttrs;
  18087. exports.useCssModule = useCssModule;
  18088. exports.useCssVars = useCssVars;
  18089. exports.useHost = useHost;
  18090. exports.useId = useId;
  18091. exports.useModel = useModel;
  18092. exports.useSSRContext = useSSRContext;
  18093. exports.useShadowRoot = useShadowRoot;
  18094. exports.useSlots = useSlots;
  18095. exports.useTemplateRef = useTemplateRef;
  18096. exports.useTransitionState = useTransitionState;
  18097. exports.vModelCheckbox = vModelCheckbox;
  18098. exports.vModelDynamic = vModelDynamic;
  18099. exports.vModelRadio = vModelRadio;
  18100. exports.vModelSelect = vModelSelect;
  18101. exports.vModelText = vModelText;
  18102. exports.vShow = vShow;
  18103. exports.version = version;
  18104. exports.warn = warn;
  18105. exports.watch = watch;
  18106. exports.watchEffect = watchEffect;
  18107. exports.watchPostEffect = watchPostEffect;
  18108. exports.watchSyncEffect = watchSyncEffect;
  18109. exports.withAsyncContext = withAsyncContext;
  18110. exports.withCtx = withCtx;
  18111. exports.withDefaults = withDefaults;
  18112. exports.withDirectives = withDirectives;
  18113. exports.withKeys = withKeys;
  18114. exports.withMemo = withMemo;
  18115. exports.withModifiers = withModifiers;
  18116. exports.withScopeId = withScopeId;
  18117. return exports;
  18118. })({});