vue.esm-browser.js 546 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964
  1. /**
  2. * vue v3.5.41
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. // @__NO_SIDE_EFFECTS__
  7. function makeMap(str) {
  8. const map = /* @__PURE__ */ Object.create(null);
  9. for (const key of str.split(",")) map[key] = 1;
  10. return (val) => val in map;
  11. }
  12. const EMPTY_OBJ = Object.freeze({}) ;
  13. const EMPTY_ARR = Object.freeze([]) ;
  14. const NOOP = () => {
  15. };
  16. const NO = () => false;
  17. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  18. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  19. const isModelListener = (key) => key.startsWith("onUpdate:");
  20. const extend = Object.assign;
  21. const remove = (arr, el) => {
  22. const i = arr.indexOf(el);
  23. if (i > -1) {
  24. arr.splice(i, 1);
  25. }
  26. };
  27. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  28. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  29. const isArray = Array.isArray;
  30. const isMap = (val) => toTypeString(val) === "[object Map]";
  31. const isSet = (val) => toTypeString(val) === "[object Set]";
  32. const isDate = (val) => toTypeString(val) === "[object Date]";
  33. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  34. const isFunction = (val) => typeof val === "function";
  35. const isString = (val) => typeof val === "string";
  36. const isSymbol = (val) => typeof val === "symbol";
  37. const isObject = (val) => val !== null && typeof val === "object";
  38. const isPromise = (val) => {
  39. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  40. };
  41. const objectToString = Object.prototype.toString;
  42. const toTypeString = (value) => objectToString.call(value);
  43. const toRawType = (value) => {
  44. return toTypeString(value).slice(8, -1);
  45. };
  46. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  47. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  48. const isReservedProp = /* @__PURE__ */ makeMap(
  49. // the leading comma is intentional so empty string "" is also included
  50. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  51. );
  52. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  53. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  54. );
  55. const cacheStringFunction = (fn) => {
  56. const cache = /* @__PURE__ */ Object.create(null);
  57. return ((str) => {
  58. const hit = cache[str];
  59. return hit || (cache[str] = fn(str));
  60. });
  61. };
  62. const camelizeRE = /-\w/g;
  63. const camelize = cacheStringFunction(
  64. (str) => {
  65. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  66. }
  67. );
  68. const hyphenateRE = /\B([A-Z])/g;
  69. const hyphenate = cacheStringFunction(
  70. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  71. );
  72. const capitalize = cacheStringFunction((str) => {
  73. return str.charAt(0).toUpperCase() + str.slice(1);
  74. });
  75. const toHandlerKey = cacheStringFunction(
  76. (str) => {
  77. const s = str ? `on${capitalize(str)}` : ``;
  78. return s;
  79. }
  80. );
  81. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  82. const invokeArrayFns = (fns, ...arg) => {
  83. for (let i = 0; i < fns.length; i++) {
  84. fns[i](...arg);
  85. }
  86. };
  87. const def = (obj, key, value, writable = false) => {
  88. Object.defineProperty(obj, key, {
  89. configurable: true,
  90. enumerable: false,
  91. writable,
  92. value
  93. });
  94. };
  95. const looseToNumber = (val) => {
  96. const n = parseFloat(val);
  97. return isNaN(n) ? val : n;
  98. };
  99. const toNumber = (val) => {
  100. const n = isString(val) ? Number(val) : NaN;
  101. return isNaN(n) ? val : n;
  102. };
  103. let _globalThis;
  104. const getGlobalThis = () => {
  105. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  106. };
  107. function genCacheKey(source, options) {
  108. return source + JSON.stringify(
  109. options,
  110. (_, val) => typeof val === "function" ? val.toString() : val
  111. );
  112. }
  113. const PatchFlagNames = {
  114. [1]: `TEXT`,
  115. [2]: `CLASS`,
  116. [4]: `STYLE`,
  117. [8]: `PROPS`,
  118. [16]: `FULL_PROPS`,
  119. [32]: `NEED_HYDRATION`,
  120. [64]: `STABLE_FRAGMENT`,
  121. [128]: `KEYED_FRAGMENT`,
  122. [256]: `UNKEYED_FRAGMENT`,
  123. [512]: `NEED_PATCH`,
  124. [1024]: `DYNAMIC_SLOTS`,
  125. [2048]: `DEV_ROOT_FRAGMENT`,
  126. [-1]: `CACHED`,
  127. [-2]: `BAIL`
  128. };
  129. const slotFlagsText = {
  130. [1]: "STABLE",
  131. [2]: "DYNAMIC",
  132. [3]: "FORWARDED"
  133. };
  134. 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";
  135. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  136. const range = 2;
  137. function generateCodeFrame(source, start = 0, end = source.length) {
  138. start = Math.max(0, Math.min(start, source.length));
  139. end = Math.max(0, Math.min(end, source.length));
  140. if (start > end) return "";
  141. let lines = source.split(/(\r?\n)/);
  142. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  143. lines = lines.filter((_, idx) => idx % 2 === 0);
  144. let count = 0;
  145. const res = [];
  146. for (let i = 0; i < lines.length; i++) {
  147. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  148. if (count >= start) {
  149. for (let j = i - range; j <= i + range || end > count; j++) {
  150. if (j < 0 || j >= lines.length) continue;
  151. const line = j + 1;
  152. res.push(
  153. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  154. );
  155. const lineLength = lines[j].length;
  156. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  157. if (j === i) {
  158. const pad = start - (count - (lineLength + newLineSeqLength));
  159. const length = Math.max(
  160. 1,
  161. end > count ? lineLength - pad : end - start
  162. );
  163. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  164. } else if (j > i) {
  165. if (end > count) {
  166. const length = Math.max(Math.min(end - count, lineLength), 1);
  167. res.push(` | ` + "^".repeat(length));
  168. }
  169. count += lineLength + newLineSeqLength;
  170. }
  171. }
  172. break;
  173. }
  174. }
  175. return res.join("\n");
  176. }
  177. function normalizeStyle(value) {
  178. if (isArray(value)) {
  179. const res = {};
  180. for (let i = 0; i < value.length; i++) {
  181. const item = value[i];
  182. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  183. if (normalized) {
  184. for (const key in normalized) {
  185. res[key] = normalized[key];
  186. }
  187. }
  188. }
  189. return res;
  190. } else if (isString(value) || isObject(value)) {
  191. return value;
  192. }
  193. }
  194. const listDelimiterRE = /;(?![^(]*\))/g;
  195. const propertyDelimiterRE = /:([^]+)/;
  196. const styleCommentRE = /\/\*[^]*?\*\//g;
  197. function parseStringStyle(cssText) {
  198. const ret = {};
  199. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  200. if (item) {
  201. const tmp = item.split(propertyDelimiterRE);
  202. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  203. }
  204. });
  205. return ret;
  206. }
  207. function stringifyStyle(styles) {
  208. if (!styles) return "";
  209. if (isString(styles)) return styles;
  210. let ret = "";
  211. for (const key in styles) {
  212. const value = styles[key];
  213. if (isString(value) || typeof value === "number") {
  214. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  215. ret += `${normalizedKey}:${value};`;
  216. }
  217. }
  218. return ret;
  219. }
  220. function normalizeClass(value) {
  221. let res = "";
  222. if (isString(value)) {
  223. res = value;
  224. } else if (isArray(value)) {
  225. for (let i = 0; i < value.length; i++) {
  226. const normalized = normalizeClass(value[i]);
  227. if (normalized) {
  228. res += normalized + " ";
  229. }
  230. }
  231. } else if (isObject(value)) {
  232. for (const name in value) {
  233. if (value[name]) {
  234. res += name + " ";
  235. }
  236. }
  237. }
  238. return res.trim();
  239. }
  240. function normalizeProps(props) {
  241. if (!props) return null;
  242. let { class: klass, style } = props;
  243. if (klass && !isString(klass)) {
  244. props.class = normalizeClass(klass);
  245. }
  246. if (style) {
  247. props.style = normalizeStyle(style);
  248. }
  249. return props;
  250. }
  251. 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";
  252. 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";
  253. 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";
  254. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  255. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  256. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  257. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  258. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  259. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  260. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  261. const isBooleanAttr = /* @__PURE__ */ makeMap(
  262. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  263. );
  264. function includeBooleanAttr(value) {
  265. return !!value || value === "";
  266. }
  267. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  268. `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`
  269. );
  270. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  271. `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`
  272. );
  273. function isRenderableAttrValue(value) {
  274. if (value == null) {
  275. return false;
  276. }
  277. const type = typeof value;
  278. return type === "string" || type === "number" || type === "boolean";
  279. }
  280. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  281. function getEscapedCssVarName(key, doubleEscape) {
  282. return key.replace(
  283. cssVarNameEscapeSymbolsRE,
  284. (s) => `\\${s}`
  285. );
  286. }
  287. function looseCompareArrays(a, b) {
  288. if (a.length !== b.length) return false;
  289. let equal = true;
  290. for (let i = 0; equal && i < a.length; i++) {
  291. equal = looseEqual(a[i], b[i]);
  292. }
  293. return equal;
  294. }
  295. function looseEqual(a, b) {
  296. if (a === b) return true;
  297. let aValidType = isDate(a);
  298. let bValidType = isDate(b);
  299. if (aValidType || bValidType) {
  300. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  301. }
  302. aValidType = isSymbol(a);
  303. bValidType = isSymbol(b);
  304. if (aValidType || bValidType) {
  305. return a === b;
  306. }
  307. aValidType = isArray(a);
  308. bValidType = isArray(b);
  309. if (aValidType || bValidType) {
  310. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  311. }
  312. aValidType = isObject(a);
  313. bValidType = isObject(b);
  314. if (aValidType || bValidType) {
  315. if (!aValidType || !bValidType) {
  316. return false;
  317. }
  318. const aKeysCount = Object.keys(a).length;
  319. const bKeysCount = Object.keys(b).length;
  320. if (aKeysCount !== bKeysCount) {
  321. return false;
  322. }
  323. for (const key in a) {
  324. const aHasKey = a.hasOwnProperty(key);
  325. const bHasKey = b.hasOwnProperty(key);
  326. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  327. return false;
  328. }
  329. }
  330. }
  331. return String(a) === String(b);
  332. }
  333. function looseIndexOf(arr, val) {
  334. return arr.findIndex((item) => looseEqual(item, val));
  335. }
  336. const isRef$1 = (val) => {
  337. return !!(val && val["__v_isRef"] === true);
  338. };
  339. const toDisplayString = (val) => {
  340. 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);
  341. };
  342. const replacer = (_key, val) => {
  343. if (isRef$1(val)) {
  344. return replacer(_key, val.value);
  345. } else if (isMap(val)) {
  346. return {
  347. [`Map(${val.size})`]: [...val.entries()].reduce(
  348. (entries, [key, val2], i) => {
  349. entries[stringifySymbol(key, i) + " =>"] = val2;
  350. return entries;
  351. },
  352. {}
  353. )
  354. };
  355. } else if (isSet(val)) {
  356. return {
  357. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  358. };
  359. } else if (isSymbol(val)) {
  360. return stringifySymbol(val);
  361. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  362. return String(val);
  363. }
  364. return val;
  365. };
  366. const stringifySymbol = (v, i = "") => {
  367. var _a;
  368. return (
  369. // Symbol.description in es2019+ so we need to cast here to pass
  370. // the lib: es2016 check
  371. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  372. );
  373. };
  374. function normalizeCssVarValue(value) {
  375. if (value == null) {
  376. return "initial";
  377. }
  378. if (typeof value === "string") {
  379. return value === "" ? " " : value;
  380. }
  381. if (typeof value !== "number" || !Number.isFinite(value)) {
  382. {
  383. console.warn(
  384. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  385. value
  386. );
  387. }
  388. }
  389. return String(value);
  390. }
  391. function warn$2(msg, ...args) {
  392. console.warn(`[Vue warn] ${msg}`, ...args);
  393. }
  394. let activeEffectScope;
  395. class EffectScope {
  396. // TODO isolatedDeclarations "__v_skip"
  397. constructor(detached = false) {
  398. this.detached = detached;
  399. /**
  400. * @internal
  401. */
  402. this._active = true;
  403. /**
  404. * @internal track `on` calls, allow `on` call multiple times
  405. */
  406. this._on = 0;
  407. /**
  408. * @internal
  409. */
  410. this.effects = [];
  411. /**
  412. * @internal
  413. */
  414. this.cleanups = [];
  415. this._isPaused = false;
  416. this._warnOnRun = true;
  417. this.__v_skip = true;
  418. if (!detached && activeEffectScope) {
  419. if (activeEffectScope.active) {
  420. this.parent = activeEffectScope;
  421. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  422. this
  423. ) - 1;
  424. } else {
  425. this._active = false;
  426. this._warnOnRun = false;
  427. }
  428. }
  429. }
  430. get active() {
  431. return this._active;
  432. }
  433. pause() {
  434. if (this._active) {
  435. this._isPaused = true;
  436. let i, l;
  437. if (this.scopes) {
  438. const scopes = this.scopes.slice();
  439. for (i = 0, l = scopes.length; i < l; i++) {
  440. scopes[i].pause();
  441. }
  442. }
  443. for (i = 0, l = this.effects.length; i < l; i++) {
  444. this.effects[i].pause();
  445. }
  446. }
  447. }
  448. /**
  449. * Resumes the effect scope, including all child scopes and effects.
  450. */
  451. resume() {
  452. if (this._active) {
  453. if (this._isPaused) {
  454. this._isPaused = false;
  455. let i, l;
  456. if (this.scopes) {
  457. const scopes = this.scopes.slice();
  458. for (i = 0, l = scopes.length; i < l; i++) {
  459. scopes[i].resume();
  460. }
  461. }
  462. const effects = this.effects.slice();
  463. for (i = 0, l = effects.length; i < l; i++) {
  464. effects[i].resume();
  465. }
  466. }
  467. }
  468. }
  469. run(fn) {
  470. if (this._active) {
  471. const currentEffectScope = activeEffectScope;
  472. try {
  473. activeEffectScope = this;
  474. return fn();
  475. } finally {
  476. activeEffectScope = currentEffectScope;
  477. }
  478. } else if (this._warnOnRun) {
  479. warn$2(`cannot run an inactive effect scope.`);
  480. }
  481. }
  482. /**
  483. * This should only be called on non-detached scopes
  484. * @internal
  485. */
  486. on() {
  487. if (++this._on === 1) {
  488. this.prevScope = activeEffectScope;
  489. activeEffectScope = this;
  490. }
  491. }
  492. /**
  493. * This should only be called on non-detached scopes
  494. * @internal
  495. */
  496. off() {
  497. if (this._on > 0 && --this._on === 0) {
  498. if (activeEffectScope === this) {
  499. activeEffectScope = this.prevScope;
  500. } else {
  501. let current = activeEffectScope;
  502. while (current) {
  503. if (current.prevScope === this) {
  504. current.prevScope = this.prevScope;
  505. break;
  506. }
  507. current = current.prevScope;
  508. }
  509. }
  510. this.prevScope = void 0;
  511. }
  512. }
  513. stop(fromParent) {
  514. if (this._active) {
  515. this._active = false;
  516. let i, l;
  517. for (i = 0, l = this.effects.length; i < l; i++) {
  518. this.effects[i].stop();
  519. }
  520. this.effects.length = 0;
  521. for (i = 0, l = this.cleanups.length; i < l; i++) {
  522. this.cleanups[i]();
  523. }
  524. this.cleanups.length = 0;
  525. if (this.scopes) {
  526. const scopes = this.scopes.slice();
  527. for (i = 0, l = scopes.length; i < l; i++) {
  528. scopes[i].stop(true);
  529. }
  530. this.scopes.length = 0;
  531. }
  532. if (!this.detached && this.parent && !fromParent) {
  533. const last = this.parent.scopes.pop();
  534. if (last && last !== this) {
  535. this.parent.scopes[this.index] = last;
  536. last.index = this.index;
  537. }
  538. }
  539. this.parent = void 0;
  540. }
  541. }
  542. }
  543. function effectScope(detached) {
  544. return new EffectScope(detached);
  545. }
  546. function getCurrentScope() {
  547. return activeEffectScope;
  548. }
  549. function onScopeDispose(fn, failSilently = false) {
  550. if (activeEffectScope) {
  551. activeEffectScope.cleanups.push(fn);
  552. } else if (!failSilently) {
  553. warn$2(
  554. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  555. );
  556. }
  557. }
  558. let activeSub;
  559. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  560. class ReactiveEffect {
  561. constructor(fn) {
  562. this.fn = fn;
  563. /**
  564. * @internal
  565. */
  566. this.deps = void 0;
  567. /**
  568. * @internal
  569. */
  570. this.depsTail = void 0;
  571. /**
  572. * @internal
  573. */
  574. this.flags = 1 | 4;
  575. /**
  576. * @internal
  577. */
  578. this.next = void 0;
  579. /**
  580. * @internal
  581. */
  582. this.cleanup = void 0;
  583. this.scheduler = void 0;
  584. if (activeEffectScope) {
  585. if (activeEffectScope.active) {
  586. activeEffectScope.effects.push(this);
  587. } else {
  588. this.flags &= -2;
  589. }
  590. }
  591. }
  592. pause() {
  593. this.flags |= 64;
  594. }
  595. resume() {
  596. if (this.flags & 64) {
  597. this.flags &= -65;
  598. if (pausedQueueEffects.has(this)) {
  599. pausedQueueEffects.delete(this);
  600. this.trigger();
  601. }
  602. }
  603. }
  604. /**
  605. * @internal
  606. */
  607. notify() {
  608. if (this.flags & 2 && !(this.flags & 32)) {
  609. return;
  610. }
  611. if (!(this.flags & 8)) {
  612. batch(this);
  613. }
  614. }
  615. run() {
  616. if (!(this.flags & 1)) {
  617. return this.fn();
  618. }
  619. this.flags |= 2;
  620. cleanupEffect(this);
  621. prepareDeps(this);
  622. const prevEffect = activeSub;
  623. const prevShouldTrack = shouldTrack;
  624. activeSub = this;
  625. shouldTrack = true;
  626. try {
  627. return this.fn();
  628. } finally {
  629. if (activeSub !== this) {
  630. warn$2(
  631. "Active effect was not restored correctly - this is likely a Vue internal bug."
  632. );
  633. }
  634. cleanupDeps(this);
  635. activeSub = prevEffect;
  636. shouldTrack = prevShouldTrack;
  637. this.flags &= -3;
  638. }
  639. }
  640. stop() {
  641. if (this.flags & 1) {
  642. for (let link = this.deps; link; link = link.nextDep) {
  643. removeSub(link);
  644. }
  645. this.deps = this.depsTail = void 0;
  646. cleanupEffect(this);
  647. this.onStop && this.onStop();
  648. this.flags &= -2;
  649. }
  650. }
  651. trigger() {
  652. if (this.flags & 64) {
  653. pausedQueueEffects.add(this);
  654. } else if (this.scheduler) {
  655. this.scheduler();
  656. } else {
  657. this.runIfDirty();
  658. }
  659. }
  660. /**
  661. * @internal
  662. */
  663. runIfDirty() {
  664. if (isDirty(this)) {
  665. this.run();
  666. }
  667. }
  668. get dirty() {
  669. return isDirty(this);
  670. }
  671. }
  672. let batchDepth = 0;
  673. let batchedSub;
  674. let batchedComputed;
  675. function batch(sub, isComputed = false) {
  676. sub.flags |= 8;
  677. if (isComputed) {
  678. sub.next = batchedComputed;
  679. batchedComputed = sub;
  680. return;
  681. }
  682. sub.next = batchedSub;
  683. batchedSub = sub;
  684. }
  685. function startBatch() {
  686. batchDepth++;
  687. }
  688. function endBatch() {
  689. if (--batchDepth > 0) {
  690. return;
  691. }
  692. if (batchedComputed) {
  693. let e = batchedComputed;
  694. batchedComputed = void 0;
  695. while (e) {
  696. const next = e.next;
  697. e.next = void 0;
  698. e.flags &= -9;
  699. e = next;
  700. }
  701. }
  702. let error;
  703. while (batchedSub) {
  704. let e = batchedSub;
  705. batchedSub = void 0;
  706. while (e) {
  707. const next = e.next;
  708. e.next = void 0;
  709. e.flags &= -9;
  710. if (e.flags & 1) {
  711. try {
  712. ;
  713. e.trigger();
  714. } catch (err) {
  715. if (!error) error = err;
  716. }
  717. }
  718. e = next;
  719. }
  720. }
  721. if (error) throw error;
  722. }
  723. function prepareDeps(sub) {
  724. for (let link = sub.deps; link; link = link.nextDep) {
  725. link.version = -1;
  726. link.prevActiveLink = link.dep.activeLink;
  727. link.dep.activeLink = link;
  728. }
  729. }
  730. function cleanupDeps(sub) {
  731. let head;
  732. let tail = sub.depsTail;
  733. let link = tail;
  734. while (link) {
  735. const prev = link.prevDep;
  736. if (link.version === -1) {
  737. if (link === tail) tail = prev;
  738. removeSub(link);
  739. removeDep(link);
  740. } else {
  741. head = link;
  742. }
  743. link.dep.activeLink = link.prevActiveLink;
  744. link.prevActiveLink = void 0;
  745. link = prev;
  746. }
  747. sub.deps = head;
  748. sub.depsTail = tail;
  749. }
  750. function isDirty(sub) {
  751. for (let link = sub.deps; link; link = link.nextDep) {
  752. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  753. return true;
  754. }
  755. }
  756. if (sub._dirty) {
  757. return true;
  758. }
  759. return false;
  760. }
  761. function refreshComputed(computed) {
  762. if (computed.flags & 4 && !(computed.flags & 16)) {
  763. return;
  764. }
  765. computed.flags &= -17;
  766. if (computed.globalVersion === globalVersion) {
  767. return;
  768. }
  769. computed.globalVersion = globalVersion;
  770. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  771. return;
  772. }
  773. computed.flags |= 2;
  774. const dep = computed.dep;
  775. const prevSub = activeSub;
  776. const prevShouldTrack = shouldTrack;
  777. activeSub = computed;
  778. shouldTrack = true;
  779. try {
  780. prepareDeps(computed);
  781. const value = computed.fn(computed._value);
  782. if (dep.version === 0 || hasChanged(value, computed._value)) {
  783. computed.flags |= 128;
  784. computed._value = value;
  785. dep.version++;
  786. }
  787. } catch (err) {
  788. dep.version++;
  789. throw err;
  790. } finally {
  791. activeSub = prevSub;
  792. shouldTrack = prevShouldTrack;
  793. cleanupDeps(computed);
  794. computed.flags &= -3;
  795. }
  796. }
  797. function removeSub(link, soft = false) {
  798. const { dep, prevSub, nextSub } = link;
  799. if (prevSub) {
  800. prevSub.nextSub = nextSub;
  801. link.prevSub = void 0;
  802. }
  803. if (nextSub) {
  804. nextSub.prevSub = prevSub;
  805. link.nextSub = void 0;
  806. }
  807. if (dep.subsHead === link) {
  808. dep.subsHead = nextSub;
  809. }
  810. if (dep.subs === link) {
  811. dep.subs = prevSub;
  812. if (!prevSub && dep.computed) {
  813. dep.computed.flags &= -5;
  814. for (let l = dep.computed.deps; l; l = l.nextDep) {
  815. removeSub(l, true);
  816. }
  817. }
  818. }
  819. if (!soft && !--dep.sc && dep.map) {
  820. dep.map.delete(dep.key);
  821. }
  822. }
  823. function removeDep(link) {
  824. const { prevDep, nextDep } = link;
  825. if (prevDep) {
  826. prevDep.nextDep = nextDep;
  827. link.prevDep = void 0;
  828. }
  829. if (nextDep) {
  830. nextDep.prevDep = prevDep;
  831. link.nextDep = void 0;
  832. }
  833. }
  834. function effect(fn, options) {
  835. if (fn.effect instanceof ReactiveEffect) {
  836. fn = fn.effect.fn;
  837. }
  838. const e = new ReactiveEffect(fn);
  839. if (options) {
  840. extend(e, options);
  841. }
  842. try {
  843. e.run();
  844. } catch (err) {
  845. e.stop();
  846. throw err;
  847. }
  848. const runner = e.run.bind(e);
  849. runner.effect = e;
  850. return runner;
  851. }
  852. function stop(runner) {
  853. runner.effect.stop();
  854. }
  855. let shouldTrack = true;
  856. const trackStack = [];
  857. function pauseTracking() {
  858. trackStack.push(shouldTrack);
  859. shouldTrack = false;
  860. }
  861. function resetTracking() {
  862. const last = trackStack.pop();
  863. shouldTrack = last === void 0 ? true : last;
  864. }
  865. function cleanupEffect(e) {
  866. const { cleanup } = e;
  867. e.cleanup = void 0;
  868. if (cleanup) {
  869. const prevSub = activeSub;
  870. activeSub = void 0;
  871. try {
  872. cleanup();
  873. } finally {
  874. activeSub = prevSub;
  875. }
  876. }
  877. }
  878. let globalVersion = 0;
  879. class Link {
  880. constructor(sub, dep) {
  881. this.sub = sub;
  882. this.dep = dep;
  883. this.version = dep.version;
  884. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  885. }
  886. }
  887. class Dep {
  888. // TODO isolatedDeclarations "__v_skip"
  889. constructor(computed) {
  890. this.computed = computed;
  891. this.version = 0;
  892. /**
  893. * Link between this dep and the current active effect
  894. */
  895. this.activeLink = void 0;
  896. /**
  897. * Doubly linked list representing the subscribing effects (tail)
  898. */
  899. this.subs = void 0;
  900. /**
  901. * For object property deps cleanup
  902. */
  903. this.map = void 0;
  904. this.key = void 0;
  905. /**
  906. * Subscriber counter
  907. */
  908. this.sc = 0;
  909. /**
  910. * @internal
  911. */
  912. this.__v_skip = true;
  913. {
  914. this.subsHead = void 0;
  915. }
  916. }
  917. track(debugInfo) {
  918. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  919. return;
  920. }
  921. let link = this.activeLink;
  922. if (link === void 0 || link.sub !== activeSub) {
  923. link = this.activeLink = new Link(activeSub, this);
  924. if (!activeSub.deps) {
  925. activeSub.deps = activeSub.depsTail = link;
  926. } else {
  927. link.prevDep = activeSub.depsTail;
  928. activeSub.depsTail.nextDep = link;
  929. activeSub.depsTail = link;
  930. }
  931. addSub(link);
  932. } else if (link.version === -1) {
  933. link.version = this.version;
  934. if (link.nextDep) {
  935. const next = link.nextDep;
  936. next.prevDep = link.prevDep;
  937. if (link.prevDep) {
  938. link.prevDep.nextDep = next;
  939. }
  940. link.prevDep = activeSub.depsTail;
  941. link.nextDep = void 0;
  942. activeSub.depsTail.nextDep = link;
  943. activeSub.depsTail = link;
  944. if (activeSub.deps === link) {
  945. activeSub.deps = next;
  946. }
  947. }
  948. }
  949. if (activeSub.onTrack) {
  950. activeSub.onTrack(
  951. extend(
  952. {
  953. effect: activeSub
  954. },
  955. debugInfo
  956. )
  957. );
  958. }
  959. return link;
  960. }
  961. trigger(debugInfo) {
  962. this.version++;
  963. globalVersion++;
  964. this.notify(debugInfo);
  965. }
  966. notify(debugInfo) {
  967. startBatch();
  968. try {
  969. if (true) {
  970. for (let head = this.subsHead; head; head = head.nextSub) {
  971. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  972. head.sub.onTrigger(
  973. extend(
  974. {
  975. effect: head.sub
  976. },
  977. debugInfo
  978. )
  979. );
  980. }
  981. }
  982. }
  983. for (let link = this.subs; link; link = link.prevSub) {
  984. if (link.sub.notify()) {
  985. ;
  986. link.sub.dep.notify();
  987. }
  988. }
  989. } finally {
  990. endBatch();
  991. }
  992. }
  993. }
  994. function addSub(link) {
  995. link.dep.sc++;
  996. if (link.sub.flags & 4) {
  997. const computed = link.dep.computed;
  998. if (computed && !link.dep.subs) {
  999. computed.flags |= 4 | 16;
  1000. for (let l = computed.deps; l; l = l.nextDep) {
  1001. addSub(l);
  1002. }
  1003. }
  1004. const currentTail = link.dep.subs;
  1005. if (currentTail !== link) {
  1006. link.prevSub = currentTail;
  1007. if (currentTail) currentTail.nextSub = link;
  1008. }
  1009. if (link.dep.subsHead === void 0) {
  1010. link.dep.subsHead = link;
  1011. }
  1012. link.dep.subs = link;
  1013. }
  1014. }
  1015. const targetMap = /* @__PURE__ */ new WeakMap();
  1016. const ITERATE_KEY = /* @__PURE__ */ Symbol(
  1017. "Object iterate"
  1018. );
  1019. const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  1020. "Map keys iterate"
  1021. );
  1022. const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  1023. "Array iterate"
  1024. );
  1025. function track(target, type, key) {
  1026. if (shouldTrack && activeSub) {
  1027. let depsMap = targetMap.get(target);
  1028. if (!depsMap) {
  1029. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  1030. }
  1031. let dep = depsMap.get(key);
  1032. if (!dep) {
  1033. depsMap.set(key, dep = new Dep());
  1034. dep.map = depsMap;
  1035. dep.key = key;
  1036. }
  1037. {
  1038. dep.track({
  1039. target,
  1040. type,
  1041. key
  1042. });
  1043. }
  1044. }
  1045. }
  1046. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  1047. const depsMap = targetMap.get(target);
  1048. if (!depsMap) {
  1049. globalVersion++;
  1050. return;
  1051. }
  1052. const run = (dep) => {
  1053. if (dep) {
  1054. {
  1055. dep.trigger({
  1056. target,
  1057. type,
  1058. key,
  1059. newValue,
  1060. oldValue,
  1061. oldTarget
  1062. });
  1063. }
  1064. }
  1065. };
  1066. startBatch();
  1067. if (type === "clear") {
  1068. depsMap.forEach(run);
  1069. } else {
  1070. const targetIsArray = isArray(target);
  1071. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1072. if (targetIsArray && key === "length") {
  1073. const newLength = Number(newValue);
  1074. depsMap.forEach((dep, key2) => {
  1075. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1076. run(dep);
  1077. }
  1078. });
  1079. } else {
  1080. if (key !== void 0 || depsMap.has(void 0)) {
  1081. run(depsMap.get(key));
  1082. }
  1083. if (isArrayIndex) {
  1084. run(depsMap.get(ARRAY_ITERATE_KEY));
  1085. }
  1086. switch (type) {
  1087. case "add":
  1088. if (!targetIsArray) {
  1089. run(depsMap.get(ITERATE_KEY));
  1090. if (isMap(target)) {
  1091. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1092. }
  1093. } else if (isArrayIndex) {
  1094. run(depsMap.get("length"));
  1095. }
  1096. break;
  1097. case "delete":
  1098. if (!targetIsArray) {
  1099. run(depsMap.get(ITERATE_KEY));
  1100. if (isMap(target)) {
  1101. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1102. }
  1103. }
  1104. break;
  1105. case "set":
  1106. if (isMap(target)) {
  1107. run(depsMap.get(ITERATE_KEY));
  1108. }
  1109. break;
  1110. }
  1111. }
  1112. }
  1113. endBatch();
  1114. }
  1115. function getDepFromReactive(object, key) {
  1116. const depMap = targetMap.get(object);
  1117. return depMap && depMap.get(key);
  1118. }
  1119. function reactiveReadArray(array) {
  1120. const raw = toRaw(array);
  1121. if (raw === array) return raw;
  1122. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1123. return isShallow(array) ? raw : raw.map(toReactive);
  1124. }
  1125. function shallowReadArray(arr) {
  1126. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1127. return arr;
  1128. }
  1129. function toWrapped(target, item) {
  1130. if (isReadonly(target)) {
  1131. return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
  1132. }
  1133. return toReactive(item);
  1134. }
  1135. const arrayInstrumentations = {
  1136. __proto__: null,
  1137. [Symbol.iterator]() {
  1138. return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
  1139. },
  1140. concat(...args) {
  1141. return reactiveReadArray(this).concat(
  1142. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1143. );
  1144. },
  1145. entries() {
  1146. return iterator(this, "entries", (value) => {
  1147. value[1] = toWrapped(this, value[1]);
  1148. return value;
  1149. });
  1150. },
  1151. every(fn, thisArg) {
  1152. return apply(this, "every", fn, thisArg, void 0, arguments);
  1153. },
  1154. filter(fn, thisArg) {
  1155. return apply(
  1156. this,
  1157. "filter",
  1158. fn,
  1159. thisArg,
  1160. (v) => v.map((item) => toWrapped(this, item)),
  1161. arguments
  1162. );
  1163. },
  1164. find(fn, thisArg) {
  1165. return apply(
  1166. this,
  1167. "find",
  1168. fn,
  1169. thisArg,
  1170. (item) => toWrapped(this, item),
  1171. arguments
  1172. );
  1173. },
  1174. findIndex(fn, thisArg) {
  1175. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1176. },
  1177. findLast(fn, thisArg) {
  1178. return apply(
  1179. this,
  1180. "findLast",
  1181. fn,
  1182. thisArg,
  1183. (item) => toWrapped(this, item),
  1184. arguments
  1185. );
  1186. },
  1187. findLastIndex(fn, thisArg) {
  1188. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1189. },
  1190. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1191. forEach(fn, thisArg) {
  1192. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1193. },
  1194. includes(...args) {
  1195. return searchProxy(this, "includes", args);
  1196. },
  1197. indexOf(...args) {
  1198. return searchProxy(this, "indexOf", args);
  1199. },
  1200. join(separator) {
  1201. return reactiveReadArray(this).join(separator);
  1202. },
  1203. // keys() iterator only reads `length`, no optimization required
  1204. lastIndexOf(...args) {
  1205. return searchProxy(this, "lastIndexOf", args);
  1206. },
  1207. map(fn, thisArg) {
  1208. return apply(this, "map", fn, thisArg, void 0, arguments);
  1209. },
  1210. pop() {
  1211. return noTracking(this, "pop");
  1212. },
  1213. push(...args) {
  1214. return noTracking(this, "push", args);
  1215. },
  1216. reduce(fn, ...args) {
  1217. return reduce(this, "reduce", fn, args);
  1218. },
  1219. reduceRight(fn, ...args) {
  1220. return reduce(this, "reduceRight", fn, args);
  1221. },
  1222. shift() {
  1223. return noTracking(this, "shift");
  1224. },
  1225. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1226. some(fn, thisArg) {
  1227. return apply(this, "some", fn, thisArg, void 0, arguments);
  1228. },
  1229. splice(...args) {
  1230. return noTracking(this, "splice", args);
  1231. },
  1232. toReversed() {
  1233. return reactiveReadArray(this).toReversed();
  1234. },
  1235. toSorted(comparer) {
  1236. return reactiveReadArray(this).toSorted(comparer);
  1237. },
  1238. toSpliced(...args) {
  1239. return reactiveReadArray(this).toSpliced(...args);
  1240. },
  1241. unshift(...args) {
  1242. return noTracking(this, "unshift", args);
  1243. },
  1244. values() {
  1245. return iterator(this, "values", (item) => toWrapped(this, item));
  1246. }
  1247. };
  1248. function iterator(self, method, wrapValue) {
  1249. const arr = shallowReadArray(self);
  1250. const iter = arr[method]();
  1251. if (arr !== self && !isShallow(self)) {
  1252. iter._next = iter.next;
  1253. iter.next = () => {
  1254. const result = iter._next();
  1255. if (!result.done) {
  1256. result.value = wrapValue(result.value);
  1257. }
  1258. return result;
  1259. };
  1260. }
  1261. return iter;
  1262. }
  1263. const arrayProto = Array.prototype;
  1264. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1265. const arr = shallowReadArray(self);
  1266. const needsWrap = arr !== self && !isShallow(self);
  1267. const methodFn = arr[method];
  1268. if (methodFn !== arrayProto[method]) {
  1269. const result2 = methodFn.apply(self, args);
  1270. return needsWrap ? toReactive(result2) : result2;
  1271. }
  1272. let wrappedFn = fn;
  1273. if (arr !== self) {
  1274. if (needsWrap) {
  1275. wrappedFn = function(item, index) {
  1276. return fn.call(this, toWrapped(self, item), index, self);
  1277. };
  1278. } else if (fn.length > 2) {
  1279. wrappedFn = function(item, index) {
  1280. return fn.call(this, item, index, self);
  1281. };
  1282. }
  1283. }
  1284. const result = methodFn.call(arr, wrappedFn, thisArg);
  1285. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1286. }
  1287. function reduce(self, method, fn, args) {
  1288. const arr = shallowReadArray(self);
  1289. const needsWrap = arr !== self && !isShallow(self);
  1290. let wrappedFn = fn;
  1291. let wrapInitialAccumulator = false;
  1292. if (arr !== self) {
  1293. if (needsWrap) {
  1294. wrapInitialAccumulator = args.length === 0;
  1295. wrappedFn = function(acc, item, index) {
  1296. if (wrapInitialAccumulator) {
  1297. wrapInitialAccumulator = false;
  1298. acc = toWrapped(self, acc);
  1299. }
  1300. return fn.call(this, acc, toWrapped(self, item), index, self);
  1301. };
  1302. } else if (fn.length > 3) {
  1303. wrappedFn = function(acc, item, index) {
  1304. return fn.call(this, acc, item, index, self);
  1305. };
  1306. }
  1307. }
  1308. const result = arr[method](wrappedFn, ...args);
  1309. return wrapInitialAccumulator ? toWrapped(self, result) : result;
  1310. }
  1311. function searchProxy(self, method, args) {
  1312. const arr = toRaw(self);
  1313. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1314. const res = arr[method](...args);
  1315. if ((res === -1 || res === false) && isProxy(args[0])) {
  1316. args[0] = toRaw(args[0]);
  1317. return arr[method](...args);
  1318. }
  1319. return res;
  1320. }
  1321. function noTracking(self, method, args = []) {
  1322. pauseTracking();
  1323. startBatch();
  1324. const res = toRaw(self)[method].apply(self, args);
  1325. endBatch();
  1326. resetTracking();
  1327. return res;
  1328. }
  1329. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1330. const builtInSymbols = new Set(
  1331. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1332. );
  1333. function hasOwnProperty(key) {
  1334. if (!isSymbol(key)) key = String(key);
  1335. const obj = toRaw(this);
  1336. track(obj, "has", key);
  1337. return obj.hasOwnProperty(key);
  1338. }
  1339. class BaseReactiveHandler {
  1340. constructor(_isReadonly = false, _isShallow = false) {
  1341. this._isReadonly = _isReadonly;
  1342. this._isShallow = _isShallow;
  1343. }
  1344. get(target, key, receiver) {
  1345. if (key === "__v_skip") return target["__v_skip"];
  1346. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1347. if (key === "__v_isReactive") {
  1348. return !isReadonly2;
  1349. } else if (key === "__v_isReadonly") {
  1350. return isReadonly2;
  1351. } else if (key === "__v_isShallow") {
  1352. return isShallow2;
  1353. } else if (key === "__v_raw") {
  1354. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1355. // this means the receiver is a user proxy of the reactive proxy
  1356. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1357. return target;
  1358. }
  1359. return;
  1360. }
  1361. const targetIsArray = isArray(target);
  1362. if (!isReadonly2) {
  1363. let fn;
  1364. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1365. return fn;
  1366. }
  1367. if (key === "hasOwnProperty") {
  1368. return hasOwnProperty;
  1369. }
  1370. }
  1371. const res = Reflect.get(
  1372. target,
  1373. key,
  1374. // if this is a proxy wrapping a ref, return methods using the raw ref
  1375. // as receiver so that we don't have to call `toRaw` on the ref in all
  1376. // its class methods
  1377. isRef(target) ? target : receiver
  1378. );
  1379. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1380. return res;
  1381. }
  1382. if (!isReadonly2) {
  1383. track(target, "get", key);
  1384. }
  1385. if (isShallow2) {
  1386. return res;
  1387. }
  1388. if (isRef(res)) {
  1389. const value = targetIsArray && isIntegerKey(key) ? res : res.value;
  1390. return isReadonly2 && isObject(value) ? readonly(value) : value;
  1391. }
  1392. if (isObject(res)) {
  1393. return isReadonly2 ? readonly(res) : reactive(res);
  1394. }
  1395. return res;
  1396. }
  1397. }
  1398. class MutableReactiveHandler extends BaseReactiveHandler {
  1399. constructor(isShallow2 = false) {
  1400. super(false, isShallow2);
  1401. }
  1402. set(target, key, value, receiver) {
  1403. let oldValue = target[key];
  1404. const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
  1405. if (!this._isShallow) {
  1406. const isOldValueReadonly = isReadonly(oldValue);
  1407. if (!isShallow(value) && !isReadonly(value)) {
  1408. oldValue = toRaw(oldValue);
  1409. value = toRaw(value);
  1410. }
  1411. if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
  1412. if (isOldValueReadonly) {
  1413. {
  1414. warn$2(
  1415. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1416. target[key]
  1417. );
  1418. }
  1419. return true;
  1420. } else {
  1421. oldValue.value = value;
  1422. return true;
  1423. }
  1424. }
  1425. }
  1426. const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
  1427. const result = Reflect.set(
  1428. target,
  1429. key,
  1430. value,
  1431. isRef(target) ? target : receiver
  1432. );
  1433. if (target === toRaw(receiver) && result) {
  1434. if (!hadKey) {
  1435. trigger(target, "add", key, value);
  1436. } else if (hasChanged(value, oldValue)) {
  1437. trigger(target, "set", key, value, oldValue);
  1438. }
  1439. }
  1440. return result;
  1441. }
  1442. deleteProperty(target, key) {
  1443. const hadKey = hasOwn(target, key);
  1444. const oldValue = target[key];
  1445. const result = Reflect.deleteProperty(target, key);
  1446. if (result && hadKey) {
  1447. trigger(target, "delete", key, void 0, oldValue);
  1448. }
  1449. return result;
  1450. }
  1451. has(target, key) {
  1452. const result = Reflect.has(target, key);
  1453. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1454. track(target, "has", key);
  1455. }
  1456. return result;
  1457. }
  1458. ownKeys(target) {
  1459. track(
  1460. target,
  1461. "iterate",
  1462. isArray(target) ? "length" : ITERATE_KEY
  1463. );
  1464. return Reflect.ownKeys(target);
  1465. }
  1466. }
  1467. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1468. constructor(isShallow2 = false) {
  1469. super(true, isShallow2);
  1470. }
  1471. set(target, key) {
  1472. {
  1473. warn$2(
  1474. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1475. target
  1476. );
  1477. }
  1478. return true;
  1479. }
  1480. deleteProperty(target, key) {
  1481. {
  1482. warn$2(
  1483. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1484. target
  1485. );
  1486. }
  1487. return true;
  1488. }
  1489. }
  1490. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1491. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1492. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1493. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1494. const toShallow = (value) => value;
  1495. const getProto = (v) => Reflect.getPrototypeOf(v);
  1496. function createIterableMethod(method, isReadonly2, isShallow2) {
  1497. return function(...args) {
  1498. const target = this["__v_raw"];
  1499. const rawTarget = toRaw(target);
  1500. const targetIsMap = isMap(rawTarget);
  1501. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1502. const isKeyOnly = method === "keys" && targetIsMap;
  1503. const innerIterator = target[method](...args);
  1504. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1505. !isReadonly2 && track(
  1506. rawTarget,
  1507. "iterate",
  1508. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1509. );
  1510. return extend(
  1511. // inheriting all iterator properties
  1512. Object.create(innerIterator),
  1513. {
  1514. // iterator protocol
  1515. next() {
  1516. const { value, done } = innerIterator.next();
  1517. return done ? { value, done } : {
  1518. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1519. done
  1520. };
  1521. }
  1522. }
  1523. );
  1524. };
  1525. }
  1526. function createReadonlyMethod(type) {
  1527. return function(...args) {
  1528. {
  1529. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1530. warn$2(
  1531. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1532. toRaw(this)
  1533. );
  1534. }
  1535. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1536. };
  1537. }
  1538. function createInstrumentations(readonly, shallow) {
  1539. const instrumentations = {
  1540. get(key) {
  1541. const target = this["__v_raw"];
  1542. const rawTarget = toRaw(target);
  1543. const rawKey = toRaw(key);
  1544. if (!readonly) {
  1545. if (hasChanged(key, rawKey)) {
  1546. track(rawTarget, "get", key);
  1547. }
  1548. track(rawTarget, "get", rawKey);
  1549. }
  1550. const { has } = getProto(rawTarget);
  1551. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1552. if (has.call(rawTarget, key)) {
  1553. return wrap(target.get(key));
  1554. } else if (has.call(rawTarget, rawKey)) {
  1555. return wrap(target.get(rawKey));
  1556. } else if (target !== rawTarget) {
  1557. target.get(key);
  1558. }
  1559. },
  1560. get size() {
  1561. const target = this["__v_raw"];
  1562. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1563. return target.size;
  1564. },
  1565. has(key) {
  1566. const target = this["__v_raw"];
  1567. const rawTarget = toRaw(target);
  1568. const rawKey = toRaw(key);
  1569. if (!readonly) {
  1570. if (hasChanged(key, rawKey)) {
  1571. track(rawTarget, "has", key);
  1572. }
  1573. track(rawTarget, "has", rawKey);
  1574. }
  1575. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1576. },
  1577. forEach(callback, thisArg) {
  1578. const observed = this;
  1579. const target = observed["__v_raw"];
  1580. const rawTarget = toRaw(target);
  1581. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1582. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1583. return target.forEach((value, key) => {
  1584. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1585. });
  1586. }
  1587. };
  1588. extend(
  1589. instrumentations,
  1590. readonly ? {
  1591. add: createReadonlyMethod("add"),
  1592. set: createReadonlyMethod("set"),
  1593. delete: createReadonlyMethod("delete"),
  1594. clear: createReadonlyMethod("clear")
  1595. } : {
  1596. add(value) {
  1597. const target = toRaw(this);
  1598. const proto = getProto(target);
  1599. const rawValue = toRaw(value);
  1600. const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
  1601. const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
  1602. if (!hadKey) {
  1603. target.add(valueToAdd);
  1604. trigger(target, "add", valueToAdd, valueToAdd);
  1605. }
  1606. return this;
  1607. },
  1608. set(key, value) {
  1609. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1610. value = toRaw(value);
  1611. }
  1612. const target = toRaw(this);
  1613. const { has, get } = getProto(target);
  1614. let hadKey = has.call(target, key);
  1615. if (!hadKey) {
  1616. key = toRaw(key);
  1617. hadKey = has.call(target, key);
  1618. } else {
  1619. checkIdentityKeys(target, has, key);
  1620. }
  1621. const oldValue = get.call(target, key);
  1622. target.set(key, value);
  1623. if (!hadKey) {
  1624. trigger(target, "add", key, value);
  1625. } else if (hasChanged(value, oldValue)) {
  1626. trigger(target, "set", key, value, oldValue);
  1627. }
  1628. return this;
  1629. },
  1630. delete(key) {
  1631. const target = toRaw(this);
  1632. const { has, get } = getProto(target);
  1633. let hadKey = has.call(target, key);
  1634. if (!hadKey) {
  1635. key = toRaw(key);
  1636. hadKey = has.call(target, key);
  1637. } else {
  1638. checkIdentityKeys(target, has, key);
  1639. }
  1640. const oldValue = get ? get.call(target, key) : void 0;
  1641. const result = target.delete(key);
  1642. if (hadKey) {
  1643. trigger(target, "delete", key, void 0, oldValue);
  1644. }
  1645. return result;
  1646. },
  1647. clear() {
  1648. const target = toRaw(this);
  1649. const hadItems = target.size !== 0;
  1650. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1651. const result = target.clear();
  1652. if (hadItems) {
  1653. trigger(
  1654. target,
  1655. "clear",
  1656. void 0,
  1657. void 0,
  1658. oldTarget
  1659. );
  1660. }
  1661. return result;
  1662. }
  1663. }
  1664. );
  1665. const iteratorMethods = [
  1666. "keys",
  1667. "values",
  1668. "entries",
  1669. Symbol.iterator
  1670. ];
  1671. iteratorMethods.forEach((method) => {
  1672. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1673. });
  1674. return instrumentations;
  1675. }
  1676. function createInstrumentationGetter(isReadonly2, shallow) {
  1677. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1678. return (target, key, receiver) => {
  1679. if (key === "__v_isReactive") {
  1680. return !isReadonly2;
  1681. } else if (key === "__v_isReadonly") {
  1682. return isReadonly2;
  1683. } else if (key === "__v_raw") {
  1684. return target;
  1685. }
  1686. return Reflect.get(
  1687. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1688. key,
  1689. receiver
  1690. );
  1691. };
  1692. }
  1693. const mutableCollectionHandlers = {
  1694. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1695. };
  1696. const shallowCollectionHandlers = {
  1697. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1698. };
  1699. const readonlyCollectionHandlers = {
  1700. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1701. };
  1702. const shallowReadonlyCollectionHandlers = {
  1703. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1704. };
  1705. function checkIdentityKeys(target, has, key) {
  1706. const rawKey = toRaw(key);
  1707. if (rawKey !== key && has.call(target, rawKey)) {
  1708. const type = toRawType(target);
  1709. warn$2(
  1710. `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.`
  1711. );
  1712. }
  1713. }
  1714. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1715. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1716. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1717. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1718. function targetTypeMap(rawType) {
  1719. switch (rawType) {
  1720. case "Object":
  1721. case "Array":
  1722. return 1 /* COMMON */;
  1723. case "Map":
  1724. case "Set":
  1725. case "WeakMap":
  1726. case "WeakSet":
  1727. return 2 /* COLLECTION */;
  1728. default:
  1729. return 0 /* INVALID */;
  1730. }
  1731. }
  1732. // @__NO_SIDE_EFFECTS__
  1733. function reactive(target) {
  1734. if (/* @__PURE__ */ isReadonly(target)) {
  1735. return target;
  1736. }
  1737. return createReactiveObject(
  1738. target,
  1739. false,
  1740. mutableHandlers,
  1741. mutableCollectionHandlers,
  1742. reactiveMap
  1743. );
  1744. }
  1745. // @__NO_SIDE_EFFECTS__
  1746. function shallowReactive(target) {
  1747. return createReactiveObject(
  1748. target,
  1749. false,
  1750. shallowReactiveHandlers,
  1751. shallowCollectionHandlers,
  1752. shallowReactiveMap
  1753. );
  1754. }
  1755. // @__NO_SIDE_EFFECTS__
  1756. function readonly(target) {
  1757. return createReactiveObject(
  1758. target,
  1759. true,
  1760. readonlyHandlers,
  1761. readonlyCollectionHandlers,
  1762. readonlyMap
  1763. );
  1764. }
  1765. // @__NO_SIDE_EFFECTS__
  1766. function shallowReadonly(target) {
  1767. return createReactiveObject(
  1768. target,
  1769. true,
  1770. shallowReadonlyHandlers,
  1771. shallowReadonlyCollectionHandlers,
  1772. shallowReadonlyMap
  1773. );
  1774. }
  1775. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1776. if (!isObject(target)) {
  1777. {
  1778. warn$2(
  1779. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1780. target
  1781. )}`
  1782. );
  1783. }
  1784. return target;
  1785. }
  1786. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1787. return target;
  1788. }
  1789. if (target["__v_skip"] || !Object.isExtensible(target)) {
  1790. return target;
  1791. }
  1792. const existingProxy = proxyMap.get(target);
  1793. if (existingProxy) {
  1794. return existingProxy;
  1795. }
  1796. const targetType = targetTypeMap(toRawType(target));
  1797. if (targetType === 0 /* INVALID */) {
  1798. return target;
  1799. }
  1800. const proxy = new Proxy(
  1801. target,
  1802. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1803. );
  1804. proxyMap.set(target, proxy);
  1805. return proxy;
  1806. }
  1807. // @__NO_SIDE_EFFECTS__
  1808. function isReactive(value) {
  1809. if (/* @__PURE__ */ isReadonly(value)) {
  1810. return /* @__PURE__ */ isReactive(value["__v_raw"]);
  1811. }
  1812. return !!(value && value["__v_isReactive"]);
  1813. }
  1814. // @__NO_SIDE_EFFECTS__
  1815. function isReadonly(value) {
  1816. return !!(value && value["__v_isReadonly"]);
  1817. }
  1818. // @__NO_SIDE_EFFECTS__
  1819. function isShallow(value) {
  1820. return !!(value && value["__v_isShallow"]);
  1821. }
  1822. // @__NO_SIDE_EFFECTS__
  1823. function isProxy(value) {
  1824. return value ? !!value["__v_raw"] : false;
  1825. }
  1826. // @__NO_SIDE_EFFECTS__
  1827. function toRaw(observed) {
  1828. const raw = observed && observed["__v_raw"];
  1829. return raw ? /* @__PURE__ */ toRaw(raw) : observed;
  1830. }
  1831. function markRaw(value) {
  1832. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1833. def(value, "__v_skip", true);
  1834. }
  1835. return value;
  1836. }
  1837. const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
  1838. const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
  1839. // @__NO_SIDE_EFFECTS__
  1840. function isRef(r) {
  1841. return r ? r["__v_isRef"] === true : false;
  1842. }
  1843. // @__NO_SIDE_EFFECTS__
  1844. function ref(value) {
  1845. return createRef(value, false);
  1846. }
  1847. // @__NO_SIDE_EFFECTS__
  1848. function shallowRef(value) {
  1849. return createRef(value, true);
  1850. }
  1851. function createRef(rawValue, shallow) {
  1852. if (/* @__PURE__ */ isRef(rawValue)) {
  1853. return rawValue;
  1854. }
  1855. return new RefImpl(rawValue, shallow);
  1856. }
  1857. class RefImpl {
  1858. constructor(value, isShallow2) {
  1859. this.dep = new Dep();
  1860. this["__v_isRef"] = true;
  1861. this["__v_isShallow"] = false;
  1862. this._rawValue = isShallow2 ? value : toRaw(value);
  1863. this._value = isShallow2 ? value : toReactive(value);
  1864. this["__v_isShallow"] = isShallow2;
  1865. }
  1866. get value() {
  1867. {
  1868. this.dep.track({
  1869. target: this,
  1870. type: "get",
  1871. key: "value"
  1872. });
  1873. }
  1874. return this._value;
  1875. }
  1876. set value(newValue) {
  1877. const oldValue = this._rawValue;
  1878. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1879. newValue = useDirectValue ? newValue : toRaw(newValue);
  1880. if (hasChanged(newValue, oldValue)) {
  1881. this._rawValue = newValue;
  1882. this._value = useDirectValue ? newValue : toReactive(newValue);
  1883. {
  1884. this.dep.trigger({
  1885. target: this,
  1886. type: "set",
  1887. key: "value",
  1888. newValue,
  1889. oldValue
  1890. });
  1891. }
  1892. }
  1893. }
  1894. }
  1895. function triggerRef(ref2) {
  1896. if (ref2.dep) {
  1897. {
  1898. ref2.dep.trigger({
  1899. target: ref2,
  1900. type: "set",
  1901. key: "value",
  1902. newValue: ref2._value
  1903. });
  1904. }
  1905. }
  1906. }
  1907. function unref(ref2) {
  1908. return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
  1909. }
  1910. function toValue(source) {
  1911. return isFunction(source) ? source() : unref(source);
  1912. }
  1913. const shallowUnwrapHandlers = {
  1914. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1915. set: (target, key, value, receiver) => {
  1916. const oldValue = target[key];
  1917. if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
  1918. oldValue.value = value;
  1919. return true;
  1920. } else {
  1921. return Reflect.set(target, key, value, receiver);
  1922. }
  1923. }
  1924. };
  1925. function proxyRefs(objectWithRefs) {
  1926. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1927. }
  1928. class CustomRefImpl {
  1929. constructor(factory) {
  1930. this["__v_isRef"] = true;
  1931. this._value = void 0;
  1932. const dep = this.dep = new Dep();
  1933. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1934. this._get = get;
  1935. this._set = set;
  1936. }
  1937. get value() {
  1938. return this._value = this._get();
  1939. }
  1940. set value(newVal) {
  1941. this._set(newVal);
  1942. }
  1943. }
  1944. function customRef(factory) {
  1945. return new CustomRefImpl(factory);
  1946. }
  1947. // @__NO_SIDE_EFFECTS__
  1948. function toRefs(object) {
  1949. if (!isProxy(object)) {
  1950. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1951. }
  1952. const ret = isArray(object) ? new Array(object.length) : {};
  1953. for (const key in object) {
  1954. ret[key] = propertyToRef(object, key);
  1955. }
  1956. return ret;
  1957. }
  1958. class ObjectRefImpl {
  1959. constructor(_object, key, _defaultValue) {
  1960. this._object = _object;
  1961. this._defaultValue = _defaultValue;
  1962. this["__v_isRef"] = true;
  1963. this._value = void 0;
  1964. this._key = isSymbol(key) ? key : String(key);
  1965. this._raw = toRaw(_object);
  1966. let shallow = true;
  1967. let obj = _object;
  1968. if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {
  1969. do {
  1970. shallow = !isProxy(obj) || isShallow(obj);
  1971. } while (shallow && (obj = obj["__v_raw"]));
  1972. }
  1973. this._shallow = shallow;
  1974. }
  1975. get value() {
  1976. let val = this._object[this._key];
  1977. if (this._shallow) {
  1978. val = unref(val);
  1979. }
  1980. return this._value = val === void 0 ? this._defaultValue : val;
  1981. }
  1982. set value(newVal) {
  1983. if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
  1984. const nestedRef = this._object[this._key];
  1985. if (/* @__PURE__ */ isRef(nestedRef)) {
  1986. nestedRef.value = newVal;
  1987. return;
  1988. }
  1989. }
  1990. this._object[this._key] = newVal;
  1991. }
  1992. get dep() {
  1993. return getDepFromReactive(this._raw, this._key);
  1994. }
  1995. }
  1996. class GetterRefImpl {
  1997. constructor(_getter) {
  1998. this._getter = _getter;
  1999. this["__v_isRef"] = true;
  2000. this["__v_isReadonly"] = true;
  2001. this._value = void 0;
  2002. }
  2003. get value() {
  2004. return this._value = this._getter();
  2005. }
  2006. }
  2007. // @__NO_SIDE_EFFECTS__
  2008. function toRef(source, key, defaultValue) {
  2009. if (/* @__PURE__ */ isRef(source)) {
  2010. return source;
  2011. } else if (isFunction(source)) {
  2012. return new GetterRefImpl(source);
  2013. } else if (isObject(source) && arguments.length > 1) {
  2014. return propertyToRef(source, key, defaultValue);
  2015. } else {
  2016. return /* @__PURE__ */ ref(source);
  2017. }
  2018. }
  2019. function propertyToRef(source, key, defaultValue) {
  2020. return new ObjectRefImpl(source, key, defaultValue);
  2021. }
  2022. class ComputedRefImpl {
  2023. constructor(fn, setter, isSSR) {
  2024. this.fn = fn;
  2025. this.setter = setter;
  2026. /**
  2027. * @internal
  2028. */
  2029. this._value = void 0;
  2030. /**
  2031. * @internal
  2032. */
  2033. this.dep = new Dep(this);
  2034. /**
  2035. * @internal
  2036. */
  2037. this.__v_isRef = true;
  2038. // TODO isolatedDeclarations "__v_isReadonly"
  2039. // A computed is also a subscriber that tracks other deps
  2040. /**
  2041. * @internal
  2042. */
  2043. this.deps = void 0;
  2044. /**
  2045. * @internal
  2046. */
  2047. this.depsTail = void 0;
  2048. /**
  2049. * @internal
  2050. */
  2051. this.flags = 16;
  2052. /**
  2053. * @internal
  2054. */
  2055. this.globalVersion = globalVersion - 1;
  2056. /**
  2057. * @internal
  2058. */
  2059. this.next = void 0;
  2060. // for backwards compat
  2061. this.effect = this;
  2062. this["__v_isReadonly"] = !setter;
  2063. this.isSSR = isSSR;
  2064. }
  2065. /**
  2066. * @internal
  2067. */
  2068. notify() {
  2069. this.flags |= 16;
  2070. if (!(this.flags & 8) && // avoid infinite self recursion
  2071. activeSub !== this) {
  2072. batch(this, true);
  2073. return true;
  2074. }
  2075. }
  2076. get value() {
  2077. const link = this.dep.track({
  2078. target: this,
  2079. type: "get",
  2080. key: "value"
  2081. }) ;
  2082. refreshComputed(this);
  2083. if (link) {
  2084. link.version = this.dep.version;
  2085. }
  2086. return this._value;
  2087. }
  2088. set value(newValue) {
  2089. if (this.setter) {
  2090. this.setter(newValue);
  2091. } else {
  2092. warn$2("Write operation failed: computed value is readonly");
  2093. }
  2094. }
  2095. }
  2096. // @__NO_SIDE_EFFECTS__
  2097. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2098. let getter;
  2099. let setter;
  2100. if (isFunction(getterOrOptions)) {
  2101. getter = getterOrOptions;
  2102. } else {
  2103. getter = getterOrOptions.get;
  2104. setter = getterOrOptions.set;
  2105. }
  2106. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  2107. if (debugOptions && !isSSR) {
  2108. cRef.onTrack = debugOptions.onTrack;
  2109. cRef.onTrigger = debugOptions.onTrigger;
  2110. }
  2111. return cRef;
  2112. }
  2113. const TrackOpTypes = {
  2114. "GET": "get",
  2115. "HAS": "has",
  2116. "ITERATE": "iterate"
  2117. };
  2118. const TriggerOpTypes = {
  2119. "SET": "set",
  2120. "ADD": "add",
  2121. "DELETE": "delete",
  2122. "CLEAR": "clear"
  2123. };
  2124. const INITIAL_WATCHER_VALUE = {};
  2125. const cleanupMap = /* @__PURE__ */ new WeakMap();
  2126. let activeWatcher = void 0;
  2127. function getCurrentWatcher() {
  2128. return activeWatcher;
  2129. }
  2130. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2131. if (owner) {
  2132. let cleanups = cleanupMap.get(owner);
  2133. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2134. cleanups.push(cleanupFn);
  2135. } else if (!failSilently) {
  2136. warn$2(
  2137. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2138. );
  2139. }
  2140. }
  2141. function watch$1(source, cb, options = EMPTY_OBJ) {
  2142. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2143. const warnInvalidSource = (s) => {
  2144. (options.onWarn || warn$2)(
  2145. `Invalid watch source: `,
  2146. s,
  2147. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2148. );
  2149. };
  2150. const reactiveGetter = (source2) => {
  2151. if (deep) return source2;
  2152. if (isShallow(source2) || deep === false || deep === 0)
  2153. return traverse(source2, 1);
  2154. return traverse(source2);
  2155. };
  2156. let effect;
  2157. let getter;
  2158. let cleanup;
  2159. let boundCleanup;
  2160. let forceTrigger = false;
  2161. let isMultiSource = false;
  2162. if (isRef(source)) {
  2163. getter = () => source.value;
  2164. forceTrigger = isShallow(source);
  2165. } else if (isReactive(source)) {
  2166. getter = () => reactiveGetter(source);
  2167. forceTrigger = true;
  2168. } else if (isArray(source)) {
  2169. isMultiSource = true;
  2170. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2171. getter = () => source.map((s) => {
  2172. if (isRef(s)) {
  2173. return s.value;
  2174. } else if (isReactive(s)) {
  2175. return reactiveGetter(s);
  2176. } else if (isFunction(s)) {
  2177. return call ? call(s, 2) : s();
  2178. } else {
  2179. warnInvalidSource(s);
  2180. }
  2181. });
  2182. } else if (isFunction(source)) {
  2183. if (cb) {
  2184. getter = call ? () => call(source, 2) : source;
  2185. } else {
  2186. getter = () => {
  2187. if (cleanup) {
  2188. pauseTracking();
  2189. try {
  2190. cleanup();
  2191. } finally {
  2192. resetTracking();
  2193. }
  2194. }
  2195. const currentEffect = activeWatcher;
  2196. activeWatcher = effect;
  2197. try {
  2198. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2199. } finally {
  2200. activeWatcher = currentEffect;
  2201. }
  2202. };
  2203. }
  2204. } else {
  2205. getter = NOOP;
  2206. warnInvalidSource(source);
  2207. }
  2208. if (cb && deep) {
  2209. const baseGetter = getter;
  2210. const depth = deep === true ? Infinity : deep;
  2211. getter = () => traverse(baseGetter(), depth);
  2212. }
  2213. const scope = getCurrentScope();
  2214. const watchHandle = () => {
  2215. effect.stop();
  2216. if (scope && scope.active) {
  2217. remove(scope.effects, effect);
  2218. }
  2219. };
  2220. if (once && cb) {
  2221. const _cb = cb;
  2222. cb = (...args) => {
  2223. const res = _cb(...args);
  2224. watchHandle();
  2225. return res;
  2226. };
  2227. }
  2228. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2229. const job = (immediateFirstRun) => {
  2230. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2231. return;
  2232. }
  2233. if (cb) {
  2234. const newValue = effect.run();
  2235. if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2236. if (cleanup) {
  2237. cleanup();
  2238. }
  2239. const currentWatcher = activeWatcher;
  2240. activeWatcher = effect;
  2241. try {
  2242. const args = [
  2243. newValue,
  2244. // pass undefined as the old value when it's changed for the first time
  2245. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2246. boundCleanup
  2247. ];
  2248. oldValue = newValue;
  2249. call ? call(cb, 3, args) : (
  2250. // @ts-expect-error
  2251. cb(...args)
  2252. );
  2253. } finally {
  2254. activeWatcher = currentWatcher;
  2255. }
  2256. }
  2257. } else {
  2258. effect.run();
  2259. }
  2260. };
  2261. if (augmentJob) {
  2262. augmentJob(job);
  2263. }
  2264. effect = new ReactiveEffect(getter);
  2265. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2266. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2267. cleanup = effect.onStop = () => {
  2268. const cleanups = cleanupMap.get(effect);
  2269. if (cleanups) {
  2270. if (call) {
  2271. call(cleanups, 4);
  2272. } else {
  2273. for (const cleanup2 of cleanups) cleanup2();
  2274. }
  2275. cleanupMap.delete(effect);
  2276. }
  2277. };
  2278. {
  2279. effect.onTrack = options.onTrack;
  2280. effect.onTrigger = options.onTrigger;
  2281. }
  2282. if (cb) {
  2283. if (immediate) {
  2284. job(true);
  2285. } else {
  2286. oldValue = effect.run();
  2287. }
  2288. } else if (scheduler) {
  2289. scheduler(job.bind(null, true), true);
  2290. } else {
  2291. effect.run();
  2292. }
  2293. watchHandle.pause = effect.pause.bind(effect);
  2294. watchHandle.resume = effect.resume.bind(effect);
  2295. watchHandle.stop = watchHandle;
  2296. return watchHandle;
  2297. }
  2298. function traverse(value, depth = Infinity, seen) {
  2299. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2300. return value;
  2301. }
  2302. seen = seen || /* @__PURE__ */ new Map();
  2303. if ((seen.get(value) || 0) >= depth) {
  2304. return value;
  2305. }
  2306. seen.set(value, depth);
  2307. depth--;
  2308. if (isRef(value)) {
  2309. traverse(value.value, depth, seen);
  2310. } else if (isArray(value)) {
  2311. for (let i = 0; i < value.length; i++) {
  2312. traverse(value[i], depth, seen);
  2313. }
  2314. } else if (isSet(value) || isMap(value)) {
  2315. value.forEach((v) => {
  2316. traverse(v, depth, seen);
  2317. });
  2318. } else if (isPlainObject(value)) {
  2319. for (const key in value) {
  2320. traverse(value[key], depth, seen);
  2321. }
  2322. for (const key of Object.getOwnPropertySymbols(value)) {
  2323. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2324. traverse(value[key], depth, seen);
  2325. }
  2326. }
  2327. }
  2328. return value;
  2329. }
  2330. const stack$1 = [];
  2331. function pushWarningContext(vnode) {
  2332. stack$1.push(vnode);
  2333. }
  2334. function popWarningContext() {
  2335. stack$1.pop();
  2336. }
  2337. let isWarning = false;
  2338. function warn$1(msg, ...args) {
  2339. if (isWarning) return;
  2340. isWarning = true;
  2341. pauseTracking();
  2342. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2343. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2344. const trace = getComponentTrace();
  2345. if (appWarnHandler) {
  2346. callWithErrorHandling(
  2347. appWarnHandler,
  2348. instance,
  2349. 11,
  2350. [
  2351. // eslint-disable-next-line no-restricted-syntax
  2352. msg + args.map((a) => {
  2353. var _a, _b;
  2354. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2355. }).join(""),
  2356. instance && instance.proxy,
  2357. trace.map(
  2358. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2359. ).join("\n"),
  2360. trace
  2361. ]
  2362. );
  2363. } else {
  2364. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2365. if (trace.length && // avoid spamming console during tests
  2366. true) {
  2367. warnArgs.push(`
  2368. `, ...formatTrace(trace));
  2369. }
  2370. console.warn(...warnArgs);
  2371. }
  2372. resetTracking();
  2373. isWarning = false;
  2374. }
  2375. function getComponentTrace() {
  2376. let currentVNode = stack$1[stack$1.length - 1];
  2377. if (!currentVNode) {
  2378. return [];
  2379. }
  2380. const normalizedStack = [];
  2381. while (currentVNode) {
  2382. const last = normalizedStack[0];
  2383. if (last && last.vnode === currentVNode) {
  2384. last.recurseCount++;
  2385. } else {
  2386. normalizedStack.push({
  2387. vnode: currentVNode,
  2388. recurseCount: 0
  2389. });
  2390. }
  2391. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2392. currentVNode = parentInstance && parentInstance.vnode;
  2393. }
  2394. return normalizedStack;
  2395. }
  2396. function formatTrace(trace) {
  2397. const logs = [];
  2398. trace.forEach((entry, i) => {
  2399. logs.push(...i === 0 ? [] : [`
  2400. `], ...formatTraceEntry(entry));
  2401. });
  2402. return logs;
  2403. }
  2404. function formatTraceEntry({ vnode, recurseCount }) {
  2405. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2406. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2407. const open = ` at <${formatComponentName(
  2408. vnode.component,
  2409. vnode.type,
  2410. isRoot
  2411. )}`;
  2412. const close = `>` + postfix;
  2413. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2414. }
  2415. function formatProps(props) {
  2416. const res = [];
  2417. const keys = Object.keys(props);
  2418. keys.slice(0, 3).forEach((key) => {
  2419. res.push(...formatProp(key, props[key]));
  2420. });
  2421. if (keys.length > 3) {
  2422. res.push(` ...`);
  2423. }
  2424. return res;
  2425. }
  2426. function formatProp(key, value, raw) {
  2427. if (isString(value)) {
  2428. value = JSON.stringify(value);
  2429. return raw ? value : [`${key}=${value}`];
  2430. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2431. return raw ? value : [`${key}=${value}`];
  2432. } else if (isRef(value)) {
  2433. value = formatProp(key, toRaw(value.value), true);
  2434. return raw ? value : [`${key}=Ref<`, value, `>`];
  2435. } else if (isFunction(value)) {
  2436. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2437. } else {
  2438. value = toRaw(value);
  2439. return raw ? value : [`${key}=`, value];
  2440. }
  2441. }
  2442. function assertNumber(val, type) {
  2443. if (val === void 0) {
  2444. return;
  2445. } else if (typeof val !== "number") {
  2446. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2447. } else if (isNaN(val)) {
  2448. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2449. }
  2450. }
  2451. const ErrorCodes = {
  2452. "SETUP_FUNCTION": 0,
  2453. "0": "SETUP_FUNCTION",
  2454. "RENDER_FUNCTION": 1,
  2455. "1": "RENDER_FUNCTION",
  2456. "NATIVE_EVENT_HANDLER": 5,
  2457. "5": "NATIVE_EVENT_HANDLER",
  2458. "COMPONENT_EVENT_HANDLER": 6,
  2459. "6": "COMPONENT_EVENT_HANDLER",
  2460. "VNODE_HOOK": 7,
  2461. "7": "VNODE_HOOK",
  2462. "DIRECTIVE_HOOK": 8,
  2463. "8": "DIRECTIVE_HOOK",
  2464. "TRANSITION_HOOK": 9,
  2465. "9": "TRANSITION_HOOK",
  2466. "APP_ERROR_HANDLER": 10,
  2467. "10": "APP_ERROR_HANDLER",
  2468. "APP_WARN_HANDLER": 11,
  2469. "11": "APP_WARN_HANDLER",
  2470. "FUNCTION_REF": 12,
  2471. "12": "FUNCTION_REF",
  2472. "ASYNC_COMPONENT_LOADER": 13,
  2473. "13": "ASYNC_COMPONENT_LOADER",
  2474. "SCHEDULER": 14,
  2475. "14": "SCHEDULER",
  2476. "COMPONENT_UPDATE": 15,
  2477. "15": "COMPONENT_UPDATE",
  2478. "APP_UNMOUNT_CLEANUP": 16,
  2479. "16": "APP_UNMOUNT_CLEANUP"
  2480. };
  2481. const ErrorTypeStrings$1 = {
  2482. ["sp"]: "serverPrefetch hook",
  2483. ["bc"]: "beforeCreate hook",
  2484. ["c"]: "created hook",
  2485. ["bm"]: "beforeMount hook",
  2486. ["m"]: "mounted hook",
  2487. ["bu"]: "beforeUpdate hook",
  2488. ["u"]: "updated",
  2489. ["bum"]: "beforeUnmount hook",
  2490. ["um"]: "unmounted hook",
  2491. ["a"]: "activated hook",
  2492. ["da"]: "deactivated hook",
  2493. ["ec"]: "errorCaptured hook",
  2494. ["rtc"]: "renderTracked hook",
  2495. ["rtg"]: "renderTriggered hook",
  2496. [0]: "setup function",
  2497. [1]: "render function",
  2498. [2]: "watcher getter",
  2499. [3]: "watcher callback",
  2500. [4]: "watcher cleanup function",
  2501. [5]: "native event handler",
  2502. [6]: "component event handler",
  2503. [7]: "vnode hook",
  2504. [8]: "directive hook",
  2505. [9]: "transition hook",
  2506. [10]: "app errorHandler",
  2507. [11]: "app warnHandler",
  2508. [12]: "ref function",
  2509. [13]: "async component loader",
  2510. [14]: "scheduler flush",
  2511. [15]: "component update",
  2512. [16]: "app unmount cleanup function"
  2513. };
  2514. function callWithErrorHandling(fn, instance, type, args) {
  2515. try {
  2516. return args ? fn(...args) : fn();
  2517. } catch (err) {
  2518. handleError(err, instance, type);
  2519. }
  2520. }
  2521. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2522. if (isFunction(fn)) {
  2523. const res = callWithErrorHandling(fn, instance, type, args);
  2524. if (res && isPromise(res)) {
  2525. res.catch((err) => {
  2526. handleError(err, instance, type);
  2527. });
  2528. }
  2529. return res;
  2530. }
  2531. if (isArray(fn)) {
  2532. const values = [];
  2533. for (let i = 0; i < fn.length; i++) {
  2534. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2535. }
  2536. return values;
  2537. } else {
  2538. warn$1(
  2539. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2540. );
  2541. }
  2542. }
  2543. function handleError(err, instance, type, throwInDev = true) {
  2544. const contextVNode = instance ? instance.vnode : null;
  2545. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2546. if (instance) {
  2547. let cur = instance.parent;
  2548. const exposedInstance = instance.proxy;
  2549. const errorInfo = ErrorTypeStrings$1[type] ;
  2550. while (cur) {
  2551. const errorCapturedHooks = cur.ec;
  2552. if (errorCapturedHooks) {
  2553. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2554. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2555. return;
  2556. }
  2557. }
  2558. }
  2559. cur = cur.parent;
  2560. }
  2561. if (errorHandler) {
  2562. pauseTracking();
  2563. callWithErrorHandling(errorHandler, null, 10, [
  2564. err,
  2565. exposedInstance,
  2566. errorInfo
  2567. ]);
  2568. resetTracking();
  2569. return;
  2570. }
  2571. }
  2572. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2573. }
  2574. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2575. {
  2576. const info = ErrorTypeStrings$1[type];
  2577. if (contextVNode) {
  2578. pushWarningContext(contextVNode);
  2579. }
  2580. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2581. if (contextVNode) {
  2582. popWarningContext();
  2583. }
  2584. if (throwInDev) {
  2585. throw err;
  2586. } else {
  2587. console.error(err);
  2588. }
  2589. }
  2590. }
  2591. const queue = [];
  2592. let flushIndex = -1;
  2593. const pendingPostFlushCbs = [];
  2594. let activePostFlushCbs = null;
  2595. let postFlushIndex = 0;
  2596. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2597. let currentFlushPromise = null;
  2598. const RECURSION_LIMIT = 100;
  2599. function nextTick(fn) {
  2600. const p = currentFlushPromise || resolvedPromise;
  2601. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2602. }
  2603. function findInsertionIndex(id) {
  2604. let start = flushIndex + 1;
  2605. let end = queue.length;
  2606. while (start < end) {
  2607. const middle = start + end >>> 1;
  2608. const middleJob = queue[middle];
  2609. const middleJobId = getId(middleJob);
  2610. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2611. start = middle + 1;
  2612. } else {
  2613. end = middle;
  2614. }
  2615. }
  2616. return start;
  2617. }
  2618. function queueJob(job) {
  2619. if (!(job.flags & 1)) {
  2620. const jobId = getId(job);
  2621. const lastJob = queue[queue.length - 1];
  2622. if (!lastJob || // fast path when the job id is larger than the tail
  2623. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2624. queue.push(job);
  2625. } else {
  2626. queue.splice(findInsertionIndex(jobId), 0, job);
  2627. }
  2628. job.flags |= 1;
  2629. queueFlush();
  2630. }
  2631. }
  2632. function queueFlush() {
  2633. if (!currentFlushPromise) {
  2634. currentFlushPromise = resolvedPromise.then(flushJobs);
  2635. }
  2636. }
  2637. function queuePostFlushCb(cb) {
  2638. if (!isArray(cb)) {
  2639. if (activePostFlushCbs && cb.id === -1) {
  2640. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2641. } else if (!(cb.flags & 1)) {
  2642. pendingPostFlushCbs.push(cb);
  2643. cb.flags |= 1;
  2644. }
  2645. } else {
  2646. for (let i = 0; i < cb.length; i++) {
  2647. pendingPostFlushCbs.push(cb[i]);
  2648. }
  2649. }
  2650. queueFlush();
  2651. }
  2652. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2653. {
  2654. seen = seen || /* @__PURE__ */ new Map();
  2655. }
  2656. for (; i < queue.length; i++) {
  2657. const cb = queue[i];
  2658. if (cb && cb.flags & 2) {
  2659. if (instance && cb.id !== instance.uid) {
  2660. continue;
  2661. }
  2662. if (checkRecursiveUpdates(seen, cb)) {
  2663. continue;
  2664. }
  2665. queue.splice(i, 1);
  2666. i--;
  2667. if (cb.flags & 4) {
  2668. cb.flags &= -2;
  2669. }
  2670. cb();
  2671. if (!(cb.flags & 4)) {
  2672. cb.flags &= -2;
  2673. }
  2674. }
  2675. }
  2676. }
  2677. function flushPostFlushCbs(seen) {
  2678. if (pendingPostFlushCbs.length) {
  2679. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2680. (a, b) => getId(a) - getId(b)
  2681. );
  2682. pendingPostFlushCbs.length = 0;
  2683. if (activePostFlushCbs) {
  2684. for (let i = 0; i < deduped.length; i++) {
  2685. activePostFlushCbs.push(deduped[i]);
  2686. }
  2687. return;
  2688. }
  2689. activePostFlushCbs = deduped;
  2690. {
  2691. seen = seen || /* @__PURE__ */ new Map();
  2692. }
  2693. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2694. const cb = activePostFlushCbs[postFlushIndex];
  2695. if (checkRecursiveUpdates(seen, cb)) {
  2696. continue;
  2697. }
  2698. if (cb.flags & 4) {
  2699. cb.flags &= -2;
  2700. }
  2701. if (!(cb.flags & 8)) cb();
  2702. cb.flags &= -2;
  2703. }
  2704. activePostFlushCbs = null;
  2705. postFlushIndex = 0;
  2706. }
  2707. }
  2708. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2709. function flushJobs(seen) {
  2710. {
  2711. seen = seen || /* @__PURE__ */ new Map();
  2712. }
  2713. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2714. try {
  2715. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2716. const job = queue[flushIndex];
  2717. if (job && !(job.flags & 8)) {
  2718. if (check(job)) {
  2719. continue;
  2720. }
  2721. if (job.flags & 4) {
  2722. job.flags &= ~1;
  2723. }
  2724. callWithErrorHandling(
  2725. job,
  2726. job.i,
  2727. job.i ? 15 : 14
  2728. );
  2729. if (!(job.flags & 4)) {
  2730. job.flags &= ~1;
  2731. }
  2732. }
  2733. }
  2734. } finally {
  2735. for (; flushIndex < queue.length; flushIndex++) {
  2736. const job = queue[flushIndex];
  2737. if (job) {
  2738. job.flags &= -2;
  2739. }
  2740. }
  2741. flushIndex = -1;
  2742. queue.length = 0;
  2743. flushPostFlushCbs(seen);
  2744. currentFlushPromise = null;
  2745. if (queue.length || pendingPostFlushCbs.length) {
  2746. flushJobs(seen);
  2747. }
  2748. }
  2749. }
  2750. function checkRecursiveUpdates(seen, fn) {
  2751. const count = seen.get(fn) || 0;
  2752. if (count > RECURSION_LIMIT) {
  2753. const instance = fn.i;
  2754. const componentName = instance && getComponentName(instance.type);
  2755. handleError(
  2756. `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.`,
  2757. null,
  2758. 10
  2759. );
  2760. return true;
  2761. }
  2762. seen.set(fn, count + 1);
  2763. return false;
  2764. }
  2765. let isHmrUpdating = false;
  2766. const setHmrUpdating = (v) => {
  2767. try {
  2768. return isHmrUpdating;
  2769. } finally {
  2770. isHmrUpdating = v;
  2771. }
  2772. };
  2773. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2774. {
  2775. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2776. createRecord: tryWrap(createRecord),
  2777. rerender: tryWrap(rerender),
  2778. reload: tryWrap(reload)
  2779. };
  2780. }
  2781. const map = /* @__PURE__ */ new Map();
  2782. function registerHMR(instance) {
  2783. const id = instance.type.__hmrId;
  2784. let record = map.get(id);
  2785. if (!record) {
  2786. createRecord(id, instance.type);
  2787. record = map.get(id);
  2788. }
  2789. record.instances.add(instance);
  2790. }
  2791. function unregisterHMR(instance) {
  2792. map.get(instance.type.__hmrId).instances.delete(instance);
  2793. }
  2794. function createRecord(id, initialDef) {
  2795. if (map.has(id)) {
  2796. return false;
  2797. }
  2798. map.set(id, {
  2799. initialDef: normalizeClassComponent(initialDef),
  2800. instances: /* @__PURE__ */ new Set()
  2801. });
  2802. return true;
  2803. }
  2804. function normalizeClassComponent(component) {
  2805. return isClassComponent(component) ? component.__vccOpts : component;
  2806. }
  2807. function rerender(id, newRender) {
  2808. const record = map.get(id);
  2809. if (!record) {
  2810. return;
  2811. }
  2812. record.initialDef.render = newRender;
  2813. [...record.instances].forEach((instance) => {
  2814. if (newRender) {
  2815. instance.render = newRender;
  2816. normalizeClassComponent(instance.type).render = newRender;
  2817. }
  2818. instance.renderCache = [];
  2819. isHmrUpdating = true;
  2820. if (!(instance.job.flags & 8)) {
  2821. instance.update();
  2822. }
  2823. isHmrUpdating = false;
  2824. });
  2825. }
  2826. function reload(id, newComp) {
  2827. const record = map.get(id);
  2828. if (!record) return;
  2829. newComp = normalizeClassComponent(newComp);
  2830. updateComponentDef(record.initialDef, newComp);
  2831. const instances = [...record.instances];
  2832. for (let i = 0; i < instances.length; i++) {
  2833. const instance = instances[i];
  2834. const oldComp = normalizeClassComponent(instance.type);
  2835. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2836. if (!dirtyInstances) {
  2837. if (oldComp !== record.initialDef) {
  2838. updateComponentDef(oldComp, newComp);
  2839. }
  2840. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2841. }
  2842. dirtyInstances.add(instance);
  2843. instance.appContext.propsCache.delete(instance.type);
  2844. instance.appContext.emitsCache.delete(instance.type);
  2845. instance.appContext.optionsCache.delete(instance.type);
  2846. if (instance.ceReload) {
  2847. dirtyInstances.add(instance);
  2848. instance.ceReload(newComp.styles);
  2849. dirtyInstances.delete(instance);
  2850. } else if (instance.parent) {
  2851. queueJob(() => {
  2852. if (!(instance.job.flags & 8)) {
  2853. isHmrUpdating = true;
  2854. instance.parent.update();
  2855. isHmrUpdating = false;
  2856. dirtyInstances.delete(instance);
  2857. }
  2858. });
  2859. } else if (instance.appContext.reload) {
  2860. instance.appContext.reload();
  2861. } else if (typeof window !== "undefined") {
  2862. window.location.reload();
  2863. } else {
  2864. console.warn(
  2865. "[HMR] Root or manually mounted instance modified. Full reload required."
  2866. );
  2867. }
  2868. if (instance.root.ce && instance !== instance.root) {
  2869. instance.root.ce._removeChildStyle(oldComp);
  2870. }
  2871. }
  2872. queuePostFlushCb(() => {
  2873. hmrDirtyComponents.clear();
  2874. });
  2875. }
  2876. function updateComponentDef(oldComp, newComp) {
  2877. extend(oldComp, newComp);
  2878. for (const key in oldComp) {
  2879. if (key !== "__file" && !(key in newComp)) {
  2880. delete oldComp[key];
  2881. }
  2882. }
  2883. }
  2884. function tryWrap(fn) {
  2885. return (id, arg) => {
  2886. try {
  2887. return fn(id, arg);
  2888. } catch (e) {
  2889. console.error(e);
  2890. console.warn(
  2891. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2892. );
  2893. }
  2894. };
  2895. }
  2896. let devtools$1;
  2897. let buffer = [];
  2898. let devtoolsNotInstalled = false;
  2899. function emit$1(event, ...args) {
  2900. if (devtools$1) {
  2901. devtools$1.emit(event, ...args);
  2902. } else if (!devtoolsNotInstalled) {
  2903. buffer.push({ event, args });
  2904. }
  2905. }
  2906. function setDevtoolsHook$1(hook, target) {
  2907. var _a, _b;
  2908. devtools$1 = hook;
  2909. if (devtools$1) {
  2910. devtools$1.enabled = true;
  2911. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2912. buffer = [];
  2913. } else if (
  2914. // handle late devtools injection - only do this if we are in an actual
  2915. // browser environment to avoid the timer handle stalling test runner exit
  2916. // (#4815)
  2917. typeof window !== "undefined" && // some envs mock window but not fully
  2918. window.HTMLElement && // also exclude jsdom
  2919. // eslint-disable-next-line no-restricted-syntax
  2920. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2921. ) {
  2922. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2923. replay.push((newHook) => {
  2924. setDevtoolsHook$1(newHook, target);
  2925. });
  2926. setTimeout(() => {
  2927. if (!devtools$1) {
  2928. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2929. devtoolsNotInstalled = true;
  2930. buffer = [];
  2931. }
  2932. }, 3e3);
  2933. } else {
  2934. devtoolsNotInstalled = true;
  2935. buffer = [];
  2936. }
  2937. }
  2938. function devtoolsInitApp(app, version) {
  2939. emit$1("app:init" /* APP_INIT */, app, version, {
  2940. Fragment,
  2941. Text,
  2942. Comment,
  2943. Static
  2944. });
  2945. }
  2946. function devtoolsUnmountApp(app) {
  2947. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2948. }
  2949. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2950. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2951. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2952. "component:removed" /* COMPONENT_REMOVED */
  2953. );
  2954. const devtoolsComponentRemoved = (component) => {
  2955. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2956. !devtools$1.cleanupBuffer(component)) {
  2957. _devtoolsComponentRemoved(component);
  2958. }
  2959. };
  2960. // @__NO_SIDE_EFFECTS__
  2961. function createDevtoolsComponentHook(hook) {
  2962. return (component) => {
  2963. emit$1(
  2964. hook,
  2965. component.appContext.app,
  2966. component.uid,
  2967. component.parent ? component.parent.uid : void 0,
  2968. component
  2969. );
  2970. };
  2971. }
  2972. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2973. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2974. function createDevtoolsPerformanceHook(hook) {
  2975. return (component, type, time) => {
  2976. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2977. };
  2978. }
  2979. function devtoolsComponentEmit(component, event, params) {
  2980. emit$1(
  2981. "component:emit" /* COMPONENT_EMIT */,
  2982. component.appContext.app,
  2983. component,
  2984. event,
  2985. params
  2986. );
  2987. }
  2988. let currentRenderingInstance = null;
  2989. let currentScopeId = null;
  2990. function setCurrentRenderingInstance(instance) {
  2991. const prev = currentRenderingInstance;
  2992. currentRenderingInstance = instance;
  2993. currentScopeId = instance && instance.type.__scopeId || null;
  2994. return prev;
  2995. }
  2996. function pushScopeId(id) {
  2997. currentScopeId = id;
  2998. }
  2999. function popScopeId() {
  3000. currentScopeId = null;
  3001. }
  3002. const withScopeId = (_id) => withCtx;
  3003. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  3004. if (!ctx) return fn;
  3005. if (fn._n) {
  3006. return fn;
  3007. }
  3008. const renderFnWithContext = (...args) => {
  3009. if (renderFnWithContext._d) {
  3010. setBlockTracking(-1);
  3011. }
  3012. const prevInstance = setCurrentRenderingInstance(ctx);
  3013. const prevStackSize = blockStack.length;
  3014. let res;
  3015. try {
  3016. res = fn(...args);
  3017. } finally {
  3018. for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
  3019. setCurrentRenderingInstance(prevInstance);
  3020. if (renderFnWithContext._d) {
  3021. setBlockTracking(1);
  3022. }
  3023. }
  3024. {
  3025. devtoolsComponentUpdated(ctx);
  3026. }
  3027. return res;
  3028. };
  3029. renderFnWithContext._n = true;
  3030. renderFnWithContext._c = true;
  3031. renderFnWithContext._d = true;
  3032. return renderFnWithContext;
  3033. }
  3034. function validateDirectiveName(name) {
  3035. if (isBuiltInDirective(name)) {
  3036. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  3037. }
  3038. }
  3039. function withDirectives(vnode, directives) {
  3040. if (currentRenderingInstance === null) {
  3041. warn$1(`withDirectives can only be used inside render functions.`);
  3042. return vnode;
  3043. }
  3044. const instance = getComponentPublicInstance(currentRenderingInstance);
  3045. const bindings = vnode.dirs || (vnode.dirs = []);
  3046. for (let i = 0; i < directives.length; i++) {
  3047. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3048. if (dir) {
  3049. if (isFunction(dir)) {
  3050. dir = {
  3051. mounted: dir,
  3052. updated: dir
  3053. };
  3054. }
  3055. if (dir.deep) {
  3056. traverse(value);
  3057. }
  3058. bindings.push({
  3059. dir,
  3060. instance,
  3061. value,
  3062. oldValue: void 0,
  3063. arg,
  3064. modifiers
  3065. });
  3066. }
  3067. }
  3068. return vnode;
  3069. }
  3070. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3071. const bindings = vnode.dirs;
  3072. const oldBindings = prevVNode && prevVNode.dirs;
  3073. for (let i = 0; i < bindings.length; i++) {
  3074. const binding = bindings[i];
  3075. if (oldBindings) {
  3076. binding.oldValue = oldBindings[i].value;
  3077. }
  3078. let hook = binding.dir[name];
  3079. if (hook) {
  3080. pauseTracking();
  3081. callWithAsyncErrorHandling(hook, instance, 8, [
  3082. vnode.el,
  3083. binding,
  3084. vnode,
  3085. prevVNode
  3086. ]);
  3087. resetTracking();
  3088. }
  3089. }
  3090. }
  3091. function provide(key, value) {
  3092. {
  3093. if (!currentInstance || currentInstance.isMounted) {
  3094. warn$1(`provide() can only be used inside setup().`);
  3095. }
  3096. }
  3097. if (currentInstance) {
  3098. let provides = currentInstance.provides;
  3099. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3100. if (parentProvides === provides) {
  3101. provides = currentInstance.provides = Object.create(parentProvides);
  3102. }
  3103. provides[key] = value;
  3104. }
  3105. }
  3106. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3107. const instance = getCurrentInstance();
  3108. if (instance || currentApp) {
  3109. let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  3110. if (provides && key in provides) {
  3111. return provides[key];
  3112. } else if (arguments.length > 1) {
  3113. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3114. } else {
  3115. warn$1(`injection "${String(key)}" not found.`);
  3116. }
  3117. } else {
  3118. warn$1(`inject() can only be used inside setup() or functional components.`);
  3119. }
  3120. }
  3121. function hasInjectionContext() {
  3122. return !!(getCurrentInstance() || currentApp);
  3123. }
  3124. const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
  3125. const useSSRContext = () => {
  3126. {
  3127. const ctx = inject(ssrContextKey);
  3128. if (!ctx) {
  3129. warn$1(
  3130. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  3131. );
  3132. }
  3133. return ctx;
  3134. }
  3135. };
  3136. function watchEffect(effect, options) {
  3137. return doWatch(effect, null, options);
  3138. }
  3139. function watchPostEffect(effect, options) {
  3140. return doWatch(
  3141. effect,
  3142. null,
  3143. extend({}, options, { flush: "post" })
  3144. );
  3145. }
  3146. function watchSyncEffect(effect, options) {
  3147. return doWatch(
  3148. effect,
  3149. null,
  3150. extend({}, options, { flush: "sync" })
  3151. );
  3152. }
  3153. function watch(source, cb, options) {
  3154. if (!isFunction(cb)) {
  3155. warn$1(
  3156. `\`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.`
  3157. );
  3158. }
  3159. return doWatch(source, cb, options);
  3160. }
  3161. function doWatch(source, cb, options = EMPTY_OBJ) {
  3162. const { immediate, deep, flush, once } = options;
  3163. if (!cb) {
  3164. if (immediate !== void 0) {
  3165. warn$1(
  3166. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3167. );
  3168. }
  3169. if (deep !== void 0) {
  3170. warn$1(
  3171. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3172. );
  3173. }
  3174. if (once !== void 0) {
  3175. warn$1(
  3176. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  3177. );
  3178. }
  3179. }
  3180. const baseWatchOptions = extend({}, options);
  3181. baseWatchOptions.onWarn = warn$1;
  3182. const runsImmediately = cb && immediate || !cb && flush !== "post";
  3183. let ssrCleanup;
  3184. if (isInSSRComponentSetup) {
  3185. if (flush === "sync") {
  3186. const ctx = useSSRContext();
  3187. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  3188. } else if (!runsImmediately) {
  3189. const watchStopHandle = () => {
  3190. };
  3191. watchStopHandle.stop = NOOP;
  3192. watchStopHandle.resume = NOOP;
  3193. watchStopHandle.pause = NOOP;
  3194. return watchStopHandle;
  3195. }
  3196. }
  3197. const instance = currentInstance;
  3198. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  3199. let isPre = false;
  3200. if (flush === "post") {
  3201. baseWatchOptions.scheduler = (job) => {
  3202. queuePostRenderEffect(job, instance && instance.suspense);
  3203. };
  3204. } else if (flush !== "sync") {
  3205. isPre = true;
  3206. baseWatchOptions.scheduler = (job, isFirstRun) => {
  3207. if (isFirstRun) {
  3208. job();
  3209. } else {
  3210. queueJob(job);
  3211. }
  3212. };
  3213. }
  3214. baseWatchOptions.augmentJob = (job) => {
  3215. if (cb) {
  3216. job.flags |= 4;
  3217. }
  3218. if (isPre) {
  3219. job.flags |= 2;
  3220. if (instance) {
  3221. job.id = instance.uid;
  3222. job.i = instance;
  3223. }
  3224. }
  3225. };
  3226. const watchHandle = watch$1(source, cb, baseWatchOptions);
  3227. if (isInSSRComponentSetup) {
  3228. if (ssrCleanup) {
  3229. ssrCleanup.push(watchHandle);
  3230. } else if (runsImmediately) {
  3231. watchHandle();
  3232. }
  3233. }
  3234. return watchHandle;
  3235. }
  3236. function instanceWatch(source, value, options) {
  3237. const publicThis = this.proxy;
  3238. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3239. let cb;
  3240. if (isFunction(value)) {
  3241. cb = value;
  3242. } else {
  3243. cb = value.handler;
  3244. options = value;
  3245. }
  3246. const reset = setCurrentInstance(this);
  3247. const res = doWatch(getter, cb.bind(publicThis), options);
  3248. reset();
  3249. return res;
  3250. }
  3251. function createPathGetter(ctx, path) {
  3252. const segments = path.split(".");
  3253. return () => {
  3254. let cur = ctx;
  3255. for (let i = 0; i < segments.length && cur; i++) {
  3256. cur = cur[segments[i]];
  3257. }
  3258. return cur;
  3259. };
  3260. }
  3261. const pendingMounts = /* @__PURE__ */ new WeakMap();
  3262. const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
  3263. const isTeleport = (type) => type.__isTeleport;
  3264. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  3265. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  3266. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  3267. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  3268. const resolveTarget = (props, select) => {
  3269. const targetSelector = props && props.to;
  3270. if (isString(targetSelector)) {
  3271. if (!select) {
  3272. warn$1(
  3273. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  3274. );
  3275. return null;
  3276. } else {
  3277. const target = select(targetSelector);
  3278. if (!target && !isTeleportDisabled(props)) {
  3279. warn$1(
  3280. `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.`
  3281. );
  3282. }
  3283. return target;
  3284. }
  3285. } else {
  3286. if (!targetSelector && !isTeleportDisabled(props)) {
  3287. warn$1(`Invalid Teleport target: ${targetSelector}`);
  3288. }
  3289. return targetSelector;
  3290. }
  3291. };
  3292. const TeleportImpl = {
  3293. name: "Teleport",
  3294. __isTeleport: true,
  3295. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  3296. const {
  3297. mc: mountChildren,
  3298. pc: patchChildren,
  3299. pbc: patchBlockChildren,
  3300. o: { insert, querySelector, createText, createComment, parentNode }
  3301. } = internals;
  3302. const disabled = isTeleportDisabled(n2.props);
  3303. let { dynamicChildren } = n2;
  3304. if (isHmrUpdating) {
  3305. optimized = false;
  3306. dynamicChildren = null;
  3307. }
  3308. const mount = (vnode, container2, anchor2) => {
  3309. if (vnode.shapeFlag & 16) {
  3310. mountChildren(
  3311. vnode.children,
  3312. container2,
  3313. anchor2,
  3314. parentComponent,
  3315. parentSuspense,
  3316. namespace,
  3317. slotScopeIds,
  3318. optimized
  3319. );
  3320. }
  3321. };
  3322. const mountToTarget = (vnode = n2) => {
  3323. const disabled2 = isTeleportDisabled(vnode.props);
  3324. const target = vnode.target = resolveTarget(vnode.props, querySelector);
  3325. const targetAnchor = prepareAnchor(target, vnode, createText, insert);
  3326. if (target) {
  3327. if (namespace !== "svg" && isTargetSVG(target)) {
  3328. namespace = "svg";
  3329. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3330. namespace = "mathml";
  3331. }
  3332. if (parentComponent && parentComponent.isCE) {
  3333. (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
  3334. }
  3335. if (!disabled2) {
  3336. mount(vnode, target, targetAnchor);
  3337. updateCssVars(vnode, false);
  3338. }
  3339. } else if (!disabled2) {
  3340. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  3341. }
  3342. };
  3343. const queuePendingMount = (vnode) => {
  3344. const mountJob = () => {
  3345. if (pendingMounts.get(vnode) !== mountJob) return;
  3346. pendingMounts.delete(vnode);
  3347. if (isTeleportDisabled(vnode.props)) {
  3348. const mountContainer = parentNode(vnode.el) || container;
  3349. mount(vnode, mountContainer, vnode.anchor);
  3350. updateCssVars(vnode, true);
  3351. }
  3352. mountToTarget(vnode);
  3353. };
  3354. pendingMounts.set(vnode, mountJob);
  3355. queuePostRenderEffect(mountJob, parentSuspense);
  3356. };
  3357. if (n1 == null) {
  3358. const placeholder = n2.el = createComment("teleport start") ;
  3359. const mainAnchor = n2.anchor = createComment("teleport end") ;
  3360. insert(placeholder, container, anchor);
  3361. insert(mainAnchor, container, anchor);
  3362. if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
  3363. queuePendingMount(n2);
  3364. return;
  3365. }
  3366. if (disabled) {
  3367. mount(n2, container, mainAnchor);
  3368. updateCssVars(n2, true);
  3369. }
  3370. mountToTarget();
  3371. } else {
  3372. n2.el = n1.el;
  3373. const mainAnchor = n2.anchor = n1.anchor;
  3374. const pendingMount = pendingMounts.get(n1);
  3375. if (pendingMount) {
  3376. pendingMount.flags |= 8;
  3377. pendingMounts.delete(n1);
  3378. queuePendingMount(n2);
  3379. return;
  3380. }
  3381. n2.targetStart = n1.targetStart;
  3382. const target = n2.target = n1.target;
  3383. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3384. const wasDisabled = isTeleportDisabled(n1.props);
  3385. const currentContainer = wasDisabled ? container : target;
  3386. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3387. if (namespace === "svg" || isTargetSVG(target)) {
  3388. namespace = "svg";
  3389. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3390. namespace = "mathml";
  3391. }
  3392. if (dynamicChildren) {
  3393. patchBlockChildren(
  3394. n1.dynamicChildren,
  3395. dynamicChildren,
  3396. currentContainer,
  3397. parentComponent,
  3398. parentSuspense,
  3399. namespace,
  3400. slotScopeIds
  3401. );
  3402. traverseStaticChildren(n1, n2, false);
  3403. } else if (!optimized) {
  3404. patchChildren(
  3405. n1,
  3406. n2,
  3407. currentContainer,
  3408. currentAnchor,
  3409. parentComponent,
  3410. parentSuspense,
  3411. namespace,
  3412. slotScopeIds,
  3413. false
  3414. );
  3415. }
  3416. if (disabled) {
  3417. if (!wasDisabled) {
  3418. moveTeleport(
  3419. n2,
  3420. container,
  3421. mainAnchor,
  3422. internals,
  3423. 1
  3424. );
  3425. } else {
  3426. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3427. n2.props.to = n1.props.to;
  3428. }
  3429. }
  3430. } else {
  3431. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3432. const nextTarget = resolveTarget(n2.props, querySelector);
  3433. if (nextTarget) {
  3434. n2.target = nextTarget;
  3435. moveTeleport(
  3436. n2,
  3437. nextTarget,
  3438. null,
  3439. internals,
  3440. 0
  3441. );
  3442. } else {
  3443. warn$1(
  3444. "Invalid Teleport target on update:",
  3445. target,
  3446. `(${typeof target})`
  3447. );
  3448. }
  3449. } else if (wasDisabled) {
  3450. moveTeleport(
  3451. n2,
  3452. target,
  3453. targetAnchor,
  3454. internals,
  3455. 1
  3456. );
  3457. }
  3458. }
  3459. updateCssVars(n2, disabled);
  3460. }
  3461. },
  3462. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3463. const {
  3464. shapeFlag,
  3465. children,
  3466. anchor,
  3467. targetStart,
  3468. targetAnchor,
  3469. target,
  3470. props
  3471. } = vnode;
  3472. const disabled = isTeleportDisabled(props);
  3473. const shouldRemove = doRemove || !disabled;
  3474. const pendingMount = pendingMounts.get(vnode);
  3475. if (pendingMount) {
  3476. pendingMount.flags |= 8;
  3477. pendingMounts.delete(vnode);
  3478. }
  3479. if (target) {
  3480. hostRemove(targetStart);
  3481. hostRemove(targetAnchor);
  3482. }
  3483. doRemove && hostRemove(anchor);
  3484. if (!pendingMount && (disabled || target) && shapeFlag & 16) {
  3485. for (let i = 0; i < children.length; i++) {
  3486. const child = children[i];
  3487. unmount(
  3488. child,
  3489. parentComponent,
  3490. parentSuspense,
  3491. shouldRemove,
  3492. !!child.dynamicChildren
  3493. );
  3494. }
  3495. }
  3496. },
  3497. move: moveTeleport,
  3498. hydrate: hydrateTeleport
  3499. };
  3500. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3501. if (moveType === 0) {
  3502. insert(vnode.targetAnchor, container, parentAnchor);
  3503. }
  3504. const { el, anchor, shapeFlag, children, props } = vnode;
  3505. const isReorder = moveType === 2;
  3506. if (isReorder) {
  3507. insert(el, container, parentAnchor);
  3508. }
  3509. if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
  3510. if (shapeFlag & 16) {
  3511. for (let i = 0; i < children.length; i++) {
  3512. move(
  3513. children[i],
  3514. container,
  3515. parentAnchor,
  3516. 2
  3517. );
  3518. }
  3519. }
  3520. }
  3521. if (isReorder) {
  3522. insert(anchor, container, parentAnchor);
  3523. }
  3524. }
  3525. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3526. o: { nextSibling, parentNode, querySelector, insert, createText }
  3527. }, hydrateChildren) {
  3528. function hydrateAnchor(target2, targetNode) {
  3529. let targetAnchor = targetNode;
  3530. while (targetAnchor) {
  3531. if (targetAnchor && targetAnchor.nodeType === 8) {
  3532. if (targetAnchor.data === "teleport start anchor") {
  3533. vnode.targetStart = targetAnchor;
  3534. } else if (targetAnchor.data === "teleport anchor") {
  3535. vnode.targetAnchor = targetAnchor;
  3536. target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3537. break;
  3538. }
  3539. }
  3540. targetAnchor = nextSibling(targetAnchor);
  3541. }
  3542. }
  3543. function hydrateDisabledTeleport(node2, vnode2) {
  3544. vnode2.anchor = hydrateChildren(
  3545. nextSibling(node2),
  3546. vnode2,
  3547. parentNode(node2),
  3548. parentComponent,
  3549. parentSuspense,
  3550. slotScopeIds,
  3551. optimized
  3552. );
  3553. }
  3554. const target = vnode.target = resolveTarget(
  3555. vnode.props,
  3556. querySelector
  3557. );
  3558. const disabled = isTeleportDisabled(vnode.props);
  3559. if (target) {
  3560. const targetNode = target._lpa || target.firstChild;
  3561. if (vnode.shapeFlag & 16) {
  3562. if (disabled) {
  3563. hydrateDisabledTeleport(node, vnode);
  3564. hydrateAnchor(target, targetNode);
  3565. if (!vnode.targetAnchor) {
  3566. prepareAnchor(
  3567. target,
  3568. vnode,
  3569. createText,
  3570. insert,
  3571. // if target is the same as the main view, insert anchors before current node
  3572. // to avoid hydrating mismatch
  3573. parentNode(node) === target ? node : null
  3574. );
  3575. }
  3576. } else {
  3577. vnode.anchor = nextSibling(node);
  3578. hydrateAnchor(target, targetNode);
  3579. if (!vnode.targetAnchor) {
  3580. prepareAnchor(target, vnode, createText, insert);
  3581. }
  3582. hydrateChildren(
  3583. targetNode && nextSibling(targetNode),
  3584. vnode,
  3585. target,
  3586. parentComponent,
  3587. parentSuspense,
  3588. slotScopeIds,
  3589. optimized
  3590. );
  3591. }
  3592. }
  3593. updateCssVars(vnode, disabled);
  3594. } else if (disabled) {
  3595. if (vnode.shapeFlag & 16) {
  3596. hydrateDisabledTeleport(node, vnode);
  3597. vnode.targetStart = node;
  3598. vnode.targetAnchor = nextSibling(node);
  3599. }
  3600. }
  3601. return vnode.anchor && nextSibling(vnode.anchor);
  3602. }
  3603. const Teleport = TeleportImpl;
  3604. function updateCssVars(vnode, isDisabled) {
  3605. const ctx = vnode.ctx;
  3606. if (ctx && ctx.ut) {
  3607. let node, anchor;
  3608. if (isDisabled) {
  3609. node = vnode.el;
  3610. anchor = vnode.anchor;
  3611. } else {
  3612. node = vnode.targetStart;
  3613. anchor = vnode.targetAnchor;
  3614. }
  3615. while (node && node !== anchor) {
  3616. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3617. node = node.nextSibling;
  3618. }
  3619. ctx.ut();
  3620. }
  3621. }
  3622. function prepareAnchor(target, vnode, createText, insert, anchor = null) {
  3623. const targetStart = vnode.targetStart = createText("");
  3624. const targetAnchor = vnode.targetAnchor = createText("");
  3625. targetStart[TeleportEndKey] = targetAnchor;
  3626. if (target) {
  3627. insert(targetStart, target, anchor);
  3628. insert(targetAnchor, target, anchor);
  3629. }
  3630. return targetAnchor;
  3631. }
  3632. const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
  3633. const enterCbKey$1 = /* @__PURE__ */ Symbol("_enterCb");
  3634. function useTransitionState() {
  3635. const state = {
  3636. isMounted: false,
  3637. isLeaving: false,
  3638. isUnmounting: false,
  3639. leavingVNodes: /* @__PURE__ */ new Map()
  3640. };
  3641. onMounted(() => {
  3642. state.isMounted = true;
  3643. });
  3644. onBeforeUnmount(() => {
  3645. state.isUnmounting = true;
  3646. });
  3647. return state;
  3648. }
  3649. const TransitionHookValidator = [Function, Array];
  3650. const BaseTransitionPropsValidators = {
  3651. mode: String,
  3652. appear: Boolean,
  3653. persisted: Boolean,
  3654. // enter
  3655. onBeforeEnter: TransitionHookValidator,
  3656. onEnter: TransitionHookValidator,
  3657. onAfterEnter: TransitionHookValidator,
  3658. onEnterCancelled: TransitionHookValidator,
  3659. // leave
  3660. onBeforeLeave: TransitionHookValidator,
  3661. onLeave: TransitionHookValidator,
  3662. onAfterLeave: TransitionHookValidator,
  3663. onLeaveCancelled: TransitionHookValidator,
  3664. // appear
  3665. onBeforeAppear: TransitionHookValidator,
  3666. onAppear: TransitionHookValidator,
  3667. onAfterAppear: TransitionHookValidator,
  3668. onAppearCancelled: TransitionHookValidator
  3669. };
  3670. const recursiveGetSubtree = (instance) => {
  3671. const subTree = instance.subTree;
  3672. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3673. };
  3674. const BaseTransitionImpl = {
  3675. name: `BaseTransition`,
  3676. props: BaseTransitionPropsValidators,
  3677. setup(props, { slots }) {
  3678. const instance = getCurrentInstance();
  3679. const state = useTransitionState();
  3680. return () => {
  3681. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3682. const child = children && children.length ? findNonCommentChild(children) : (
  3683. // Keep explicit default-slot conditionals on the same transition path
  3684. // as regular v-if branches, which render a comment placeholder.
  3685. instance.subTree ? createCommentVNode() : void 0
  3686. );
  3687. if (!child) {
  3688. return;
  3689. }
  3690. const rawProps = toRaw(props);
  3691. const { mode } = rawProps;
  3692. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3693. warn$1(`invalid <transition> mode: ${mode}`);
  3694. }
  3695. if (state.isLeaving) {
  3696. return emptyPlaceholder(child);
  3697. }
  3698. const innerChild = getInnerChild$1(child);
  3699. if (!innerChild) {
  3700. return emptyPlaceholder(child);
  3701. }
  3702. let enterHooks = resolveTransitionHooks(
  3703. innerChild,
  3704. rawProps,
  3705. state,
  3706. instance,
  3707. // #11061, ensure enterHooks is fresh after clone
  3708. (hooks) => enterHooks = hooks
  3709. );
  3710. if (innerChild.type !== Comment) {
  3711. setTransitionHooks(innerChild, enterHooks);
  3712. }
  3713. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3714. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3715. let leavingHooks = resolveTransitionHooks(
  3716. oldInnerChild,
  3717. rawProps,
  3718. state,
  3719. instance
  3720. );
  3721. setTransitionHooks(oldInnerChild, leavingHooks);
  3722. if (mode === "out-in" && innerChild.type !== Comment) {
  3723. state.isLeaving = true;
  3724. leavingHooks.afterLeave = () => {
  3725. state.isLeaving = false;
  3726. if (!(instance.job.flags & 8)) {
  3727. instance.update();
  3728. }
  3729. delete leavingHooks.afterLeave;
  3730. oldInnerChild = void 0;
  3731. };
  3732. return emptyPlaceholder(child);
  3733. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3734. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3735. const leavingVNodesCache = getLeavingNodesForType(
  3736. state,
  3737. oldInnerChild
  3738. );
  3739. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3740. el[leaveCbKey] = () => {
  3741. earlyRemove();
  3742. el[leaveCbKey] = void 0;
  3743. delete enterHooks.delayedLeave;
  3744. oldInnerChild = void 0;
  3745. };
  3746. enterHooks.delayedLeave = () => {
  3747. delayedLeave();
  3748. delete enterHooks.delayedLeave;
  3749. oldInnerChild = void 0;
  3750. };
  3751. };
  3752. } else {
  3753. oldInnerChild = void 0;
  3754. }
  3755. } else if (oldInnerChild) {
  3756. oldInnerChild = void 0;
  3757. }
  3758. return child;
  3759. };
  3760. }
  3761. };
  3762. function findNonCommentChild(children) {
  3763. let child = children[0];
  3764. if (children.length > 1) {
  3765. let hasFound = false;
  3766. for (const c of children) {
  3767. if (c.type !== Comment) {
  3768. if (hasFound) {
  3769. warn$1(
  3770. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3771. );
  3772. break;
  3773. }
  3774. child = c;
  3775. hasFound = true;
  3776. }
  3777. }
  3778. }
  3779. return child;
  3780. }
  3781. const BaseTransition = BaseTransitionImpl;
  3782. function getLeavingNodesForType(state, vnode) {
  3783. const { leavingVNodes } = state;
  3784. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3785. if (!leavingVNodesCache) {
  3786. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3787. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3788. }
  3789. return leavingVNodesCache;
  3790. }
  3791. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3792. const {
  3793. appear,
  3794. mode,
  3795. persisted = false,
  3796. onBeforeEnter,
  3797. onEnter,
  3798. onAfterEnter,
  3799. onEnterCancelled,
  3800. onBeforeLeave,
  3801. onLeave,
  3802. onAfterLeave,
  3803. onLeaveCancelled,
  3804. onBeforeAppear,
  3805. onAppear,
  3806. onAfterAppear,
  3807. onAppearCancelled
  3808. } = props;
  3809. const key = String(vnode.key);
  3810. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3811. const callHook = (hook, args) => {
  3812. hook && callWithAsyncErrorHandling(
  3813. hook,
  3814. instance,
  3815. 9,
  3816. args
  3817. );
  3818. };
  3819. const callAsyncHook = (hook, args) => {
  3820. const done = args[1];
  3821. callHook(hook, args);
  3822. if (isArray(hook)) {
  3823. if (hook.every((hook2) => hook2.length <= 1)) done();
  3824. } else if (hook.length <= 1) {
  3825. done();
  3826. }
  3827. };
  3828. const hooks = {
  3829. mode,
  3830. persisted,
  3831. beforeEnter(el) {
  3832. let hook = onBeforeEnter;
  3833. if (!state.isMounted) {
  3834. if (appear) {
  3835. hook = onBeforeAppear || onBeforeEnter;
  3836. } else {
  3837. return;
  3838. }
  3839. }
  3840. if (el[leaveCbKey]) {
  3841. el[leaveCbKey](
  3842. true
  3843. /* cancelled */
  3844. );
  3845. }
  3846. const leavingVNode = leavingVNodesCache[key];
  3847. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3848. leavingVNode.el[leaveCbKey]();
  3849. }
  3850. callHook(hook, [el]);
  3851. },
  3852. enter(el) {
  3853. if (!isHmrUpdating && leavingVNodesCache[key] === vnode) return;
  3854. let hook = onEnter;
  3855. let afterHook = onAfterEnter;
  3856. let cancelHook = onEnterCancelled;
  3857. if (!state.isMounted) {
  3858. if (appear) {
  3859. hook = onAppear || onEnter;
  3860. afterHook = onAfterAppear || onAfterEnter;
  3861. cancelHook = onAppearCancelled || onEnterCancelled;
  3862. } else {
  3863. return;
  3864. }
  3865. }
  3866. let called = false;
  3867. el[enterCbKey$1] = (cancelled) => {
  3868. if (called) return;
  3869. called = true;
  3870. if (cancelled) {
  3871. callHook(cancelHook, [el]);
  3872. } else {
  3873. callHook(afterHook, [el]);
  3874. }
  3875. if (hooks.delayedLeave) {
  3876. hooks.delayedLeave();
  3877. }
  3878. el[enterCbKey$1] = void 0;
  3879. };
  3880. const done = el[enterCbKey$1].bind(null, false);
  3881. if (hook) {
  3882. callAsyncHook(hook, [el, done]);
  3883. } else {
  3884. done();
  3885. }
  3886. },
  3887. leave(el, remove) {
  3888. const key2 = String(vnode.key);
  3889. if (el[enterCbKey$1]) {
  3890. el[enterCbKey$1](
  3891. true
  3892. /* cancelled */
  3893. );
  3894. }
  3895. if (state.isUnmounting) {
  3896. return remove();
  3897. }
  3898. callHook(onBeforeLeave, [el]);
  3899. let called = false;
  3900. el[leaveCbKey] = (cancelled) => {
  3901. if (called) return;
  3902. called = true;
  3903. remove();
  3904. if (cancelled) {
  3905. callHook(onLeaveCancelled, [el]);
  3906. } else {
  3907. callHook(onAfterLeave, [el]);
  3908. }
  3909. el[leaveCbKey] = void 0;
  3910. if (leavingVNodesCache[key2] === vnode) {
  3911. delete leavingVNodesCache[key2];
  3912. }
  3913. };
  3914. const done = el[leaveCbKey].bind(null, false);
  3915. leavingVNodesCache[key2] = vnode;
  3916. if (onLeave) {
  3917. callAsyncHook(onLeave, [el, done]);
  3918. } else {
  3919. done();
  3920. }
  3921. },
  3922. clone(vnode2) {
  3923. const hooks2 = resolveTransitionHooks(
  3924. vnode2,
  3925. props,
  3926. state,
  3927. instance,
  3928. postClone
  3929. );
  3930. if (postClone) postClone(hooks2);
  3931. return hooks2;
  3932. }
  3933. };
  3934. return hooks;
  3935. }
  3936. function emptyPlaceholder(vnode) {
  3937. if (isKeepAlive(vnode)) {
  3938. vnode = cloneVNode(vnode);
  3939. vnode.children = null;
  3940. return vnode;
  3941. }
  3942. }
  3943. function getInnerChild$1(vnode) {
  3944. if (!isKeepAlive(vnode)) {
  3945. if (isTeleport(vnode.type) && vnode.children) {
  3946. return findNonCommentChild(vnode.children);
  3947. }
  3948. return vnode;
  3949. }
  3950. if (vnode.component) {
  3951. return vnode.component.subTree;
  3952. }
  3953. const { shapeFlag, children } = vnode;
  3954. if (children) {
  3955. if (shapeFlag & 16) {
  3956. return children[0];
  3957. }
  3958. if (shapeFlag & 32 && isFunction(children.default)) {
  3959. return children.default();
  3960. }
  3961. }
  3962. }
  3963. function setTransitionHooks(vnode, hooks) {
  3964. if (vnode.shapeFlag & 6 && vnode.component) {
  3965. vnode.transition = hooks;
  3966. const subTree = vnode.component.subTree;
  3967. setTransitionHooks(
  3968. isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
  3969. hooks
  3970. );
  3971. } else if (vnode.shapeFlag & 128) {
  3972. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3973. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3974. } else {
  3975. vnode.transition = hooks;
  3976. }
  3977. }
  3978. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3979. let ret = [];
  3980. let keyedFragmentCount = 0;
  3981. for (let i = 0; i < children.length; i++) {
  3982. let child = children[i];
  3983. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3984. if (child.type === Fragment) {
  3985. if (child.patchFlag & 128) keyedFragmentCount++;
  3986. ret = ret.concat(
  3987. getTransitionRawChildren(child.children, keepComment, key)
  3988. );
  3989. } else if (keepComment || child.type !== Comment) {
  3990. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3991. }
  3992. }
  3993. if (keyedFragmentCount > 1) {
  3994. for (let i = 0; i < ret.length; i++) {
  3995. ret[i].patchFlag = -2;
  3996. }
  3997. }
  3998. return ret;
  3999. }
  4000. // @__NO_SIDE_EFFECTS__
  4001. function defineComponent(options, extraOptions) {
  4002. return isFunction(options) ? (
  4003. // #8236: extend call and options.name access are considered side-effects
  4004. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  4005. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  4006. ) : options;
  4007. }
  4008. function useId() {
  4009. const i = getCurrentInstance();
  4010. if (i) {
  4011. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  4012. } else {
  4013. warn$1(
  4014. `useId() is called when there is no active component instance to be associated with.`
  4015. );
  4016. }
  4017. return "";
  4018. }
  4019. function markAsyncBoundary(instance) {
  4020. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  4021. }
  4022. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  4023. function useTemplateRef(key) {
  4024. const i = getCurrentInstance();
  4025. const r = shallowRef(null);
  4026. if (i) {
  4027. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  4028. if (isTemplateRefKey(refs, key)) {
  4029. warn$1(`useTemplateRef('${key}') already exists.`);
  4030. } else {
  4031. Object.defineProperty(refs, key, {
  4032. enumerable: true,
  4033. get: () => r.value,
  4034. set: (val) => r.value = val
  4035. });
  4036. }
  4037. } else {
  4038. warn$1(
  4039. `useTemplateRef() is called when there is no active component instance to be associated with.`
  4040. );
  4041. }
  4042. const ret = readonly(r) ;
  4043. {
  4044. knownTemplateRefs.add(ret);
  4045. }
  4046. return ret;
  4047. }
  4048. function isTemplateRefKey(refs, key) {
  4049. let desc;
  4050. return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
  4051. }
  4052. const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
  4053. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4054. if (isArray(rawRef)) {
  4055. rawRef.forEach(
  4056. (r, i) => setRef(
  4057. r,
  4058. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4059. parentSuspense,
  4060. vnode,
  4061. isUnmount
  4062. )
  4063. );
  4064. return;
  4065. }
  4066. if (isAsyncWrapper(vnode) && !isUnmount) {
  4067. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  4068. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  4069. }
  4070. return;
  4071. }
  4072. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  4073. const value = isUnmount ? null : refValue;
  4074. const { i: owner, r: ref } = rawRef;
  4075. if (!owner) {
  4076. warn$1(
  4077. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4078. );
  4079. return;
  4080. }
  4081. const oldRef = oldRawRef && oldRawRef.r;
  4082. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4083. const setupState = owner.setupState;
  4084. const rawSetupState = toRaw(setupState);
  4085. const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
  4086. {
  4087. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  4088. warn$1(
  4089. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  4090. );
  4091. }
  4092. if (knownTemplateRefs.has(rawSetupState[key])) {
  4093. return false;
  4094. }
  4095. }
  4096. if (isTemplateRefKey(refs, key)) {
  4097. return false;
  4098. }
  4099. return hasOwn(rawSetupState, key);
  4100. };
  4101. const canSetRef = (ref2, key) => {
  4102. if (knownTemplateRefs.has(ref2)) {
  4103. return false;
  4104. }
  4105. if (key && isTemplateRefKey(refs, key)) {
  4106. return false;
  4107. }
  4108. return true;
  4109. };
  4110. if (oldRef != null && oldRef !== ref) {
  4111. invalidatePendingSetRef(oldRawRef);
  4112. if (isString(oldRef)) {
  4113. refs[oldRef] = null;
  4114. if (canSetSetupRef(oldRef)) {
  4115. setupState[oldRef] = null;
  4116. }
  4117. } else if (isRef(oldRef)) {
  4118. const oldRawRefAtom = oldRawRef;
  4119. if (canSetRef(oldRef, oldRawRefAtom.k)) {
  4120. oldRef.value = null;
  4121. }
  4122. if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
  4123. }
  4124. }
  4125. if (isFunction(ref)) {
  4126. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4127. } else {
  4128. const _isString = isString(ref);
  4129. const _isRef = isRef(ref);
  4130. if (_isString || _isRef) {
  4131. const doSet = () => {
  4132. if (rawRef.f) {
  4133. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
  4134. if (isUnmount) {
  4135. isArray(existing) && remove(existing, refValue);
  4136. } else {
  4137. if (!isArray(existing)) {
  4138. if (_isString) {
  4139. refs[ref] = [refValue];
  4140. if (canSetSetupRef(ref)) {
  4141. setupState[ref] = refs[ref];
  4142. }
  4143. } else {
  4144. const newVal = [refValue];
  4145. if (canSetRef(ref, rawRef.k)) {
  4146. ref.value = newVal;
  4147. }
  4148. if (rawRef.k) refs[rawRef.k] = newVal;
  4149. }
  4150. } else if (!existing.includes(refValue)) {
  4151. existing.push(refValue);
  4152. }
  4153. }
  4154. } else if (_isString) {
  4155. refs[ref] = value;
  4156. if (canSetSetupRef(ref)) {
  4157. setupState[ref] = value;
  4158. }
  4159. } else if (_isRef) {
  4160. if (canSetRef(ref, rawRef.k)) {
  4161. ref.value = value;
  4162. }
  4163. if (rawRef.k) refs[rawRef.k] = value;
  4164. } else {
  4165. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4166. }
  4167. };
  4168. if (value) {
  4169. const job = () => {
  4170. doSet();
  4171. pendingSetRefMap.delete(rawRef);
  4172. };
  4173. job.id = -1;
  4174. pendingSetRefMap.set(rawRef, job);
  4175. queuePostRenderEffect(job, parentSuspense);
  4176. } else {
  4177. invalidatePendingSetRef(rawRef);
  4178. doSet();
  4179. }
  4180. } else {
  4181. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4182. }
  4183. }
  4184. }
  4185. function invalidatePendingSetRef(rawRef) {
  4186. const pendingSetRef = pendingSetRefMap.get(rawRef);
  4187. if (pendingSetRef) {
  4188. pendingSetRef.flags |= 8;
  4189. pendingSetRefMap.delete(rawRef);
  4190. }
  4191. }
  4192. let hasLoggedMismatchError = false;
  4193. const logMismatchError = () => {
  4194. if (hasLoggedMismatchError) {
  4195. return;
  4196. }
  4197. console.error("Hydration completed but contains mismatches.");
  4198. hasLoggedMismatchError = true;
  4199. };
  4200. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  4201. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  4202. const getContainerType = (container) => {
  4203. if (container.nodeType !== 1) return void 0;
  4204. if (isSVGContainer(container)) return "svg";
  4205. if (isMathMLContainer(container)) return "mathml";
  4206. return void 0;
  4207. };
  4208. const isComment = (node) => node.nodeType === 8;
  4209. function createHydrationFunctions(rendererInternals) {
  4210. const {
  4211. mt: mountComponent,
  4212. p: patch,
  4213. o: {
  4214. patchProp,
  4215. createText,
  4216. nextSibling,
  4217. parentNode,
  4218. remove,
  4219. insert,
  4220. createComment
  4221. }
  4222. } = rendererInternals;
  4223. const hydrate = (vnode, container) => {
  4224. if (!container.hasChildNodes()) {
  4225. warn$1(
  4226. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  4227. );
  4228. patch(null, vnode, container);
  4229. flushPostFlushCbs();
  4230. container._vnode = vnode;
  4231. return;
  4232. }
  4233. hydrateNode(container.firstChild, vnode, null, null, null);
  4234. flushPostFlushCbs();
  4235. container._vnode = vnode;
  4236. };
  4237. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  4238. optimized = optimized || !!vnode.dynamicChildren;
  4239. const isFragmentStart = isComment(node) && node.data === "[";
  4240. const onMismatch = () => handleMismatch(
  4241. node,
  4242. vnode,
  4243. parentComponent,
  4244. parentSuspense,
  4245. slotScopeIds,
  4246. isFragmentStart
  4247. );
  4248. const { type, ref, shapeFlag, patchFlag } = vnode;
  4249. let domType = node.nodeType;
  4250. vnode.el = node;
  4251. {
  4252. def(node, "__vnode", vnode, true);
  4253. def(node, "__vueParentComponent", parentComponent, true);
  4254. }
  4255. if (patchFlag === -2) {
  4256. optimized = false;
  4257. vnode.dynamicChildren = null;
  4258. }
  4259. let nextNode = null;
  4260. switch (type) {
  4261. case Text:
  4262. if (domType !== 3) {
  4263. if (vnode.children === "") {
  4264. insert(vnode.el = createText(""), parentNode(node), node);
  4265. nextNode = node;
  4266. } else {
  4267. nextNode = onMismatch();
  4268. }
  4269. } else {
  4270. if (node.data !== vnode.children) {
  4271. warn$1(
  4272. `Hydration text mismatch in`,
  4273. node.parentNode,
  4274. `
  4275. - rendered on server: ${JSON.stringify(
  4276. node.data
  4277. )}
  4278. - expected on client: ${JSON.stringify(vnode.children)}`
  4279. );
  4280. logMismatchError();
  4281. node.data = vnode.children;
  4282. }
  4283. nextNode = nextSibling(node);
  4284. }
  4285. break;
  4286. case Comment:
  4287. if (isTemplateNode(node)) {
  4288. nextNode = nextSibling(node);
  4289. replaceNode(
  4290. vnode.el = node.content.firstChild,
  4291. node,
  4292. parentComponent
  4293. );
  4294. } else if (domType !== 8 || isFragmentStart) {
  4295. nextNode = onMismatch();
  4296. } else {
  4297. nextNode = nextSibling(node);
  4298. }
  4299. break;
  4300. case Static:
  4301. if (isFragmentStart) {
  4302. node = nextSibling(node);
  4303. domType = node.nodeType;
  4304. }
  4305. if (domType === 1 || domType === 3) {
  4306. nextNode = node;
  4307. const needToAdoptContent = !vnode.children.length;
  4308. for (let i = 0; i < vnode.staticCount; i++) {
  4309. if (needToAdoptContent)
  4310. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  4311. if (i === vnode.staticCount - 1) {
  4312. vnode.anchor = nextNode;
  4313. }
  4314. nextNode = nextSibling(nextNode);
  4315. }
  4316. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4317. } else {
  4318. onMismatch();
  4319. }
  4320. break;
  4321. case Fragment:
  4322. if (!isFragmentStart) {
  4323. nextNode = onMismatch();
  4324. } else {
  4325. nextNode = hydrateFragment(
  4326. node,
  4327. vnode,
  4328. parentComponent,
  4329. parentSuspense,
  4330. slotScopeIds,
  4331. optimized
  4332. );
  4333. }
  4334. break;
  4335. default:
  4336. if (shapeFlag & 1) {
  4337. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  4338. nextNode = onMismatch();
  4339. } else {
  4340. nextNode = hydrateElement(
  4341. node,
  4342. vnode,
  4343. parentComponent,
  4344. parentSuspense,
  4345. slotScopeIds,
  4346. optimized
  4347. );
  4348. }
  4349. } else if (shapeFlag & 6) {
  4350. vnode.slotScopeIds = slotScopeIds;
  4351. const container = parentNode(node);
  4352. if (isFragmentStart) {
  4353. nextNode = locateClosingAnchor(node);
  4354. } else if (isComment(node) && node.data === "teleport start") {
  4355. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  4356. } else {
  4357. nextNode = nextSibling(node);
  4358. }
  4359. mountComponent(
  4360. vnode,
  4361. container,
  4362. null,
  4363. parentComponent,
  4364. parentSuspense,
  4365. getContainerType(container),
  4366. optimized
  4367. );
  4368. if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
  4369. let subTree;
  4370. if (isFragmentStart) {
  4371. subTree = createVNode(Fragment);
  4372. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4373. } else {
  4374. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  4375. }
  4376. subTree.el = node;
  4377. vnode.component.subTree = subTree;
  4378. }
  4379. } else if (shapeFlag & 64) {
  4380. if (domType !== 8) {
  4381. nextNode = onMismatch();
  4382. } else {
  4383. nextNode = vnode.type.hydrate(
  4384. node,
  4385. vnode,
  4386. parentComponent,
  4387. parentSuspense,
  4388. slotScopeIds,
  4389. optimized,
  4390. rendererInternals,
  4391. hydrateChildren
  4392. );
  4393. }
  4394. } else if (shapeFlag & 128) {
  4395. nextNode = vnode.type.hydrate(
  4396. node,
  4397. vnode,
  4398. parentComponent,
  4399. parentSuspense,
  4400. getContainerType(parentNode(node)),
  4401. slotScopeIds,
  4402. optimized,
  4403. rendererInternals,
  4404. hydrateNode
  4405. );
  4406. } else {
  4407. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4408. }
  4409. }
  4410. if (ref != null) {
  4411. setRef(ref, null, parentSuspense, vnode);
  4412. }
  4413. return nextNode;
  4414. };
  4415. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4416. optimized = optimized || !!vnode.dynamicChildren;
  4417. const {
  4418. type,
  4419. dynamicProps,
  4420. props,
  4421. patchFlag,
  4422. shapeFlag,
  4423. dirs,
  4424. transition
  4425. } = vnode;
  4426. const forcePatch = type === "input" || type === "option";
  4427. {
  4428. if (dirs) {
  4429. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4430. }
  4431. let needCallTransitionHooks = false;
  4432. if (isTemplateNode(el)) {
  4433. needCallTransitionHooks = needTransition(
  4434. null,
  4435. // no need check parentSuspense in hydration
  4436. transition
  4437. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4438. const content = el.content.firstChild;
  4439. if (needCallTransitionHooks) {
  4440. const cls = content.getAttribute("class");
  4441. if (cls) content.$cls = cls;
  4442. transition.beforeEnter(content);
  4443. }
  4444. replaceNode(content, el, parentComponent);
  4445. vnode.el = el = content;
  4446. }
  4447. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4448. !(props && (props.innerHTML || props.textContent))) {
  4449. let next = hydrateChildren(
  4450. el.firstChild,
  4451. vnode,
  4452. el,
  4453. parentComponent,
  4454. parentSuspense,
  4455. slotScopeIds,
  4456. optimized
  4457. );
  4458. if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4459. warn$1(
  4460. `Hydration children mismatch on`,
  4461. el,
  4462. `
  4463. Server rendered element contains more child nodes than client vdom.`
  4464. );
  4465. logMismatchError();
  4466. }
  4467. while (next) {
  4468. const cur = next;
  4469. next = next.nextSibling;
  4470. remove(cur);
  4471. }
  4472. } else if (shapeFlag & 8) {
  4473. let clientText = vnode.children;
  4474. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4475. clientText = clientText.slice(1);
  4476. }
  4477. const { textContent } = el;
  4478. if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
  4479. textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
  4480. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4481. warn$1(
  4482. `Hydration text content mismatch on`,
  4483. el,
  4484. `
  4485. - rendered on server: ${textContent}
  4486. - expected on client: ${clientText}`
  4487. );
  4488. logMismatchError();
  4489. }
  4490. el.textContent = vnode.children;
  4491. }
  4492. }
  4493. if (props) {
  4494. {
  4495. const isCustomElement = el.tagName.includes("-");
  4496. const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
  4497. for (const key in props) {
  4498. if (// #11189 skip if this node has directives that have created hooks
  4499. // as it could have mutated the DOM in any possible way
  4500. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4501. logMismatchError();
  4502. }
  4503. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4504. key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
  4505. if (isUnchangedResourceProp(el, key, props[key])) {
  4506. continue;
  4507. }
  4508. patchProp(el, key, null, props[key], namespace, parentComponent);
  4509. }
  4510. }
  4511. }
  4512. }
  4513. let vnodeHooks;
  4514. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4515. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4516. }
  4517. if (dirs) {
  4518. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4519. }
  4520. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4521. queueEffectWithSuspense(() => {
  4522. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4523. needCallTransitionHooks && transition.enter(el);
  4524. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4525. }, parentSuspense);
  4526. }
  4527. }
  4528. return el.nextSibling;
  4529. };
  4530. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4531. optimized = optimized || !!parentVNode.dynamicChildren;
  4532. const children = parentVNode.children;
  4533. const l = children.length;
  4534. let hasCheckedMismatch = false;
  4535. for (let i = 0; i < l; i++) {
  4536. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4537. const isText = vnode.type === Text;
  4538. if (node) {
  4539. if (isText && !optimized) {
  4540. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4541. insert(
  4542. createText(
  4543. node.data.slice(vnode.children.length)
  4544. ),
  4545. container,
  4546. nextSibling(node)
  4547. );
  4548. node.data = vnode.children;
  4549. }
  4550. }
  4551. node = hydrateNode(
  4552. node,
  4553. vnode,
  4554. parentComponent,
  4555. parentSuspense,
  4556. slotScopeIds,
  4557. optimized
  4558. );
  4559. } else if (isText && !vnode.children) {
  4560. insert(vnode.el = createText(""), container);
  4561. } else {
  4562. if (!hasCheckedMismatch) {
  4563. hasCheckedMismatch = true;
  4564. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4565. warn$1(
  4566. `Hydration children mismatch on`,
  4567. container,
  4568. `
  4569. Server rendered element contains fewer child nodes than client vdom.`
  4570. );
  4571. logMismatchError();
  4572. }
  4573. }
  4574. patch(
  4575. null,
  4576. vnode,
  4577. container,
  4578. null,
  4579. parentComponent,
  4580. parentSuspense,
  4581. getContainerType(container),
  4582. slotScopeIds
  4583. );
  4584. }
  4585. }
  4586. return node;
  4587. };
  4588. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4589. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4590. if (fragmentSlotScopeIds) {
  4591. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4592. }
  4593. const container = parentNode(node);
  4594. const next = hydrateChildren(
  4595. nextSibling(node),
  4596. vnode,
  4597. container,
  4598. parentComponent,
  4599. parentSuspense,
  4600. slotScopeIds,
  4601. optimized
  4602. );
  4603. if (next && isComment(next) && next.data === "]") {
  4604. return nextSibling(vnode.anchor = next);
  4605. } else {
  4606. logMismatchError();
  4607. insert(vnode.anchor = createComment(`]`), container, next);
  4608. return next;
  4609. }
  4610. };
  4611. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4612. if (!isNodeMismatchAllowed(node, vnode)) {
  4613. warn$1(
  4614. `Hydration node mismatch:
  4615. - rendered on server:`,
  4616. node,
  4617. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4618. `
  4619. - expected on client:`,
  4620. vnode.type
  4621. );
  4622. logMismatchError();
  4623. }
  4624. vnode.el = null;
  4625. if (isFragment) {
  4626. const end = locateClosingAnchor(node);
  4627. while (true) {
  4628. const next2 = nextSibling(node);
  4629. if (next2 && next2 !== end) {
  4630. remove(next2);
  4631. } else {
  4632. break;
  4633. }
  4634. }
  4635. }
  4636. const next = nextSibling(node);
  4637. const container = parentNode(node);
  4638. remove(node);
  4639. patch(
  4640. null,
  4641. vnode,
  4642. container,
  4643. next,
  4644. parentComponent,
  4645. parentSuspense,
  4646. getContainerType(container),
  4647. slotScopeIds
  4648. );
  4649. if (parentComponent) {
  4650. parentComponent.vnode.el = vnode.el;
  4651. updateHOCHostEl(parentComponent, vnode.el);
  4652. }
  4653. return next;
  4654. };
  4655. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4656. let match = 0;
  4657. while (node) {
  4658. node = nextSibling(node);
  4659. if (node && isComment(node)) {
  4660. if (node.data === open) match++;
  4661. if (node.data === close) {
  4662. if (match === 0) {
  4663. return nextSibling(node);
  4664. } else {
  4665. match--;
  4666. }
  4667. }
  4668. }
  4669. }
  4670. return node;
  4671. };
  4672. const replaceNode = (newNode, oldNode, parentComponent) => {
  4673. const parentNode2 = oldNode.parentNode;
  4674. if (parentNode2) {
  4675. parentNode2.replaceChild(newNode, oldNode);
  4676. }
  4677. let parent = parentComponent;
  4678. while (parent) {
  4679. if (parent.vnode.el === oldNode) {
  4680. parent.vnode.el = parent.subTree.el = newNode;
  4681. }
  4682. parent = parent.parent;
  4683. }
  4684. };
  4685. const isTemplateNode = (node) => {
  4686. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4687. };
  4688. return [hydrate, hydrateNode];
  4689. }
  4690. const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
  4691. function isUnchangedResourceProp(el, key, clientValue) {
  4692. if (!resourceProps.has(key)) {
  4693. return false;
  4694. }
  4695. return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
  4696. }
  4697. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4698. let mismatchType;
  4699. let mismatchKey;
  4700. let actual;
  4701. let expected;
  4702. if (key === "class") {
  4703. if (el.$cls) {
  4704. actual = el.$cls;
  4705. delete el.$cls;
  4706. } else {
  4707. actual = el.getAttribute("class");
  4708. }
  4709. expected = normalizeClass(clientValue);
  4710. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4711. mismatchType = 2 /* CLASS */;
  4712. mismatchKey = `class`;
  4713. }
  4714. } else if (key === "style") {
  4715. actual = el.getAttribute("style") || "";
  4716. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4717. const actualMap = toStyleMap(actual);
  4718. const expectedMap = toStyleMap(expected);
  4719. if (vnode.dirs) {
  4720. for (const { dir, value } of vnode.dirs) {
  4721. if (dir.name === "show" && !value) {
  4722. expectedMap.set("display", "none");
  4723. }
  4724. }
  4725. }
  4726. if (instance) {
  4727. resolveCssVars(instance, vnode, expectedMap);
  4728. }
  4729. if (!isMapEqual(actualMap, expectedMap)) {
  4730. mismatchType = 3 /* STYLE */;
  4731. mismatchKey = "style";
  4732. }
  4733. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4734. if (key === "hidden") {
  4735. actual = normalizeHiddenValue(el.getAttribute(key));
  4736. expected = normalizeHiddenValue(clientValue);
  4737. } else if (isBooleanAttr(key)) {
  4738. actual = el.hasAttribute(key);
  4739. expected = includeBooleanAttr(clientValue);
  4740. } else if (clientValue == null) {
  4741. actual = el.hasAttribute(key);
  4742. expected = false;
  4743. } else {
  4744. if (el.hasAttribute(key)) {
  4745. actual = el.getAttribute(key);
  4746. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4747. actual = el.value;
  4748. } else {
  4749. actual = false;
  4750. }
  4751. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4752. }
  4753. if (actual !== expected) {
  4754. mismatchType = 4 /* ATTRIBUTE */;
  4755. mismatchKey = key;
  4756. }
  4757. }
  4758. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4759. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4760. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4761. const postSegment = `
  4762. - rendered on server: ${format(actual)}
  4763. - expected on client: ${format(expected)}
  4764. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4765. You should fix the source of the mismatch.`;
  4766. {
  4767. warn$1(preSegment, el, postSegment);
  4768. }
  4769. return true;
  4770. }
  4771. return false;
  4772. }
  4773. function normalizeHiddenValue(value) {
  4774. if (!isRenderableAttrValue(value)) {
  4775. return false;
  4776. }
  4777. if (isString(value)) {
  4778. return value.toLowerCase() === "until-found" ? "until-found" : "";
  4779. }
  4780. return includeBooleanAttr(value) ? "" : false;
  4781. }
  4782. function toClassSet(str) {
  4783. return new Set(str.trim().split(/\s+/));
  4784. }
  4785. function isSetEqual(a, b) {
  4786. if (a.size !== b.size) {
  4787. return false;
  4788. }
  4789. for (const s of a) {
  4790. if (!b.has(s)) {
  4791. return false;
  4792. }
  4793. }
  4794. return true;
  4795. }
  4796. function toStyleMap(str) {
  4797. const styleMap = /* @__PURE__ */ new Map();
  4798. for (const item of str.split(";")) {
  4799. let [key, value] = item.split(":");
  4800. key = key.trim();
  4801. value = value && value.trim();
  4802. if (key && value) {
  4803. styleMap.set(key, value);
  4804. }
  4805. }
  4806. return styleMap;
  4807. }
  4808. function isMapEqual(a, b) {
  4809. if (a.size !== b.size) {
  4810. return false;
  4811. }
  4812. for (const [key, value] of a) {
  4813. if (value !== b.get(key)) {
  4814. return false;
  4815. }
  4816. }
  4817. return true;
  4818. }
  4819. function resolveCssVars(instance, vnode, expectedMap) {
  4820. const root = instance.subTree;
  4821. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4822. const cssVars = instance.getCssVars();
  4823. for (const key in cssVars) {
  4824. const value = normalizeCssVarValue(cssVars[key]);
  4825. expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
  4826. }
  4827. }
  4828. if (vnode === root && instance.parent) {
  4829. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4830. }
  4831. }
  4832. const allowMismatchAttr = "data-allow-mismatch";
  4833. const MismatchTypeString = {
  4834. [0 /* TEXT */]: "text",
  4835. [1 /* CHILDREN */]: "children",
  4836. [2 /* CLASS */]: "class",
  4837. [3 /* STYLE */]: "style",
  4838. [4 /* ATTRIBUTE */]: "attribute"
  4839. };
  4840. function isMismatchAllowed(el, allowedType) {
  4841. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4842. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4843. el = el.parentElement;
  4844. }
  4845. }
  4846. return isMismatchAllowedByAttr(
  4847. el && el.getAttribute(allowMismatchAttr),
  4848. allowedType
  4849. );
  4850. }
  4851. function isMismatchAllowedByAttr(allowedAttr, allowedType) {
  4852. if (allowedAttr == null) {
  4853. return false;
  4854. } else if (allowedAttr === "") {
  4855. return true;
  4856. } else {
  4857. const list = allowedAttr.split(",");
  4858. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4859. return true;
  4860. }
  4861. return list.includes(MismatchTypeString[allowedType]);
  4862. }
  4863. }
  4864. function isNodeMismatchAllowed(node, vnode) {
  4865. return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
  4866. }
  4867. function isMismatchAllowedByNode(node) {
  4868. return node.nodeType === 1 && isMismatchAllowedByAttr(
  4869. node.getAttribute(allowMismatchAttr),
  4870. 1 /* CHILDREN */
  4871. );
  4872. }
  4873. function isMismatchAllowedByVNode({ props }) {
  4874. const allowedAttr = props && props[allowMismatchAttr];
  4875. return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
  4876. }
  4877. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4878. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4879. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4880. const id = requestIdleCallback(hydrate, { timeout });
  4881. return () => cancelIdleCallback(id);
  4882. };
  4883. function elementIsVisibleInViewport(el) {
  4884. const { top, left, bottom, right } = el.getBoundingClientRect();
  4885. const { innerHeight, innerWidth } = window;
  4886. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4887. }
  4888. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4889. const ob = new IntersectionObserver((entries) => {
  4890. for (const e of entries) {
  4891. if (!e.isIntersecting) continue;
  4892. ob.disconnect();
  4893. hydrate();
  4894. break;
  4895. }
  4896. }, opts);
  4897. forEach((el) => {
  4898. if (!(el instanceof Element)) return;
  4899. if (elementIsVisibleInViewport(el)) {
  4900. hydrate();
  4901. ob.disconnect();
  4902. return false;
  4903. }
  4904. ob.observe(el);
  4905. });
  4906. return () => ob.disconnect();
  4907. };
  4908. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4909. if (query) {
  4910. const mql = matchMedia(query);
  4911. if (mql.matches) {
  4912. hydrate();
  4913. } else {
  4914. mql.addEventListener("change", hydrate, { once: true });
  4915. return () => mql.removeEventListener("change", hydrate);
  4916. }
  4917. }
  4918. };
  4919. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4920. if (isString(interactions)) interactions = [interactions];
  4921. let hasHydrated = false;
  4922. const doHydrate = (e) => {
  4923. if (!hasHydrated) {
  4924. hasHydrated = true;
  4925. teardown();
  4926. hydrate();
  4927. e.target.dispatchEvent(new e.constructor(e.type, e));
  4928. }
  4929. };
  4930. const teardown = () => {
  4931. forEach((el) => {
  4932. for (const i of interactions) {
  4933. el.removeEventListener(i, doHydrate);
  4934. }
  4935. });
  4936. };
  4937. forEach((el) => {
  4938. for (const i of interactions) {
  4939. el.addEventListener(i, doHydrate, { once: true });
  4940. }
  4941. });
  4942. return teardown;
  4943. };
  4944. function forEachElement(node, cb) {
  4945. if (isComment(node) && node.data === "[") {
  4946. let depth = 1;
  4947. let next = node.nextSibling;
  4948. while (next) {
  4949. if (next.nodeType === 1) {
  4950. const result = cb(next);
  4951. if (result === false) {
  4952. break;
  4953. }
  4954. } else if (isComment(next)) {
  4955. if (next.data === "]") {
  4956. if (--depth === 0) break;
  4957. } else if (next.data === "[") {
  4958. depth++;
  4959. }
  4960. }
  4961. next = next.nextSibling;
  4962. }
  4963. } else {
  4964. cb(node);
  4965. }
  4966. }
  4967. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4968. // @__NO_SIDE_EFFECTS__
  4969. function defineAsyncComponent(source) {
  4970. if (isFunction(source)) {
  4971. source = { loader: source };
  4972. }
  4973. const {
  4974. loader,
  4975. loadingComponent,
  4976. errorComponent,
  4977. delay = 200,
  4978. hydrate: hydrateStrategy,
  4979. timeout,
  4980. // undefined = never times out
  4981. suspensible = true,
  4982. onError: userOnError
  4983. } = source;
  4984. let pendingRequest = null;
  4985. let resolvedComp;
  4986. let retries = 0;
  4987. const retry = () => {
  4988. retries++;
  4989. pendingRequest = null;
  4990. return load();
  4991. };
  4992. const load = () => {
  4993. let thisRequest;
  4994. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4995. err = err instanceof Error ? err : new Error(String(err));
  4996. if (userOnError) {
  4997. return new Promise((resolve, reject) => {
  4998. const userRetry = () => resolve(retry());
  4999. const userFail = () => reject(err);
  5000. userOnError(err, userRetry, userFail, retries + 1);
  5001. });
  5002. } else {
  5003. throw err;
  5004. }
  5005. }).then((comp) => {
  5006. if (thisRequest !== pendingRequest && pendingRequest) {
  5007. return pendingRequest;
  5008. }
  5009. if (!comp) {
  5010. warn$1(
  5011. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  5012. );
  5013. }
  5014. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  5015. comp = comp.default;
  5016. }
  5017. if (comp && !isObject(comp) && !isFunction(comp)) {
  5018. throw new Error(`Invalid async component load result: ${comp}`);
  5019. }
  5020. resolvedComp = comp;
  5021. return comp;
  5022. }));
  5023. };
  5024. return defineComponent({
  5025. name: "AsyncComponentWrapper",
  5026. __asyncLoader: load,
  5027. __asyncHydrate(el, instance, hydrate) {
  5028. const wasConnected = el.isConnected;
  5029. let patched = false;
  5030. (instance.bu || (instance.bu = [])).push(() => patched = true);
  5031. const performHydrate = () => {
  5032. if (patched) {
  5033. {
  5034. warn$1(
  5035. `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
  5036. );
  5037. }
  5038. return;
  5039. }
  5040. if (!el.parentNode || wasConnected && !el.isConnected) return;
  5041. hydrate();
  5042. };
  5043. const doHydrate = hydrateStrategy ? () => {
  5044. const teardown = hydrateStrategy(
  5045. performHydrate,
  5046. (cb) => forEachElement(el, cb)
  5047. );
  5048. if (teardown) {
  5049. (instance.bum || (instance.bum = [])).push(teardown);
  5050. }
  5051. } : performHydrate;
  5052. if (resolvedComp) {
  5053. doHydrate();
  5054. } else {
  5055. load().then(() => !instance.isUnmounted && doHydrate());
  5056. }
  5057. },
  5058. get __asyncResolved() {
  5059. return resolvedComp;
  5060. },
  5061. setup() {
  5062. const instance = currentInstance;
  5063. markAsyncBoundary(instance);
  5064. if (resolvedComp) {
  5065. return () => createInnerComp(resolvedComp, instance);
  5066. }
  5067. const onError = (err) => {
  5068. pendingRequest = null;
  5069. handleError(
  5070. err,
  5071. instance,
  5072. 13,
  5073. !errorComponent
  5074. );
  5075. };
  5076. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  5077. return load().then((comp) => {
  5078. return () => createInnerComp(comp, instance);
  5079. }).catch((err) => {
  5080. onError(err);
  5081. return () => errorComponent ? createVNode(errorComponent, {
  5082. error: err
  5083. }) : null;
  5084. });
  5085. }
  5086. const loaded = ref(false);
  5087. const error = ref();
  5088. const delayed = ref(!!delay);
  5089. let timeoutTimer;
  5090. let delayTimer;
  5091. onUnmounted(() => {
  5092. if (timeoutTimer != null) clearTimeout(timeoutTimer);
  5093. if (delayTimer != null) clearTimeout(delayTimer);
  5094. });
  5095. if (delay) {
  5096. delayTimer = setTimeout(() => {
  5097. if (instance.isUnmounted) return;
  5098. delayed.value = false;
  5099. }, delay);
  5100. }
  5101. if (timeout != null) {
  5102. timeoutTimer = setTimeout(() => {
  5103. if (instance.isUnmounted) return;
  5104. if (!loaded.value && !error.value) {
  5105. const err = new Error(
  5106. `Async component timed out after ${timeout}ms.`
  5107. );
  5108. onError(err);
  5109. error.value = err;
  5110. }
  5111. }, timeout);
  5112. }
  5113. load().then(() => {
  5114. if (instance.isUnmounted) return;
  5115. loaded.value = true;
  5116. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  5117. instance.parent.update();
  5118. }
  5119. }).catch((err) => {
  5120. if (instance.isUnmounted) {
  5121. pendingRequest = null;
  5122. return;
  5123. }
  5124. onError(err);
  5125. error.value = err;
  5126. });
  5127. return () => {
  5128. if (loaded.value && resolvedComp) {
  5129. return createInnerComp(resolvedComp, instance);
  5130. } else if (error.value && errorComponent) {
  5131. return createVNode(errorComponent, {
  5132. error: error.value
  5133. });
  5134. } else if (loadingComponent && !delayed.value) {
  5135. return createInnerComp(
  5136. loadingComponent,
  5137. instance
  5138. );
  5139. }
  5140. };
  5141. }
  5142. });
  5143. }
  5144. function createInnerComp(comp, parent) {
  5145. const { ref: ref2, props, children, ce } = parent.vnode;
  5146. const vnode = createVNode(comp, props, children);
  5147. vnode.ref = ref2;
  5148. vnode.ce = ce;
  5149. delete parent.vnode.ce;
  5150. return vnode;
  5151. }
  5152. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  5153. const KeepAliveImpl = {
  5154. name: `KeepAlive`,
  5155. // Marker for special handling inside the renderer. We are not using a ===
  5156. // check directly on KeepAlive in the renderer, because importing it directly
  5157. // would prevent it from being tree-shaken.
  5158. __isKeepAlive: true,
  5159. props: {
  5160. include: [String, RegExp, Array],
  5161. exclude: [String, RegExp, Array],
  5162. max: [String, Number]
  5163. },
  5164. setup(props, { slots }) {
  5165. const instance = getCurrentInstance();
  5166. const sharedContext = instance.ctx;
  5167. if (!sharedContext.renderer) {
  5168. return () => {
  5169. const children = slots.default && slots.default();
  5170. return children && children.length === 1 ? children[0] : children;
  5171. };
  5172. }
  5173. const cache = /* @__PURE__ */ new Map();
  5174. const keys = /* @__PURE__ */ new Set();
  5175. let current = null;
  5176. {
  5177. instance.__v_cache = cache;
  5178. }
  5179. const parentSuspense = instance.suspense;
  5180. const {
  5181. renderer: {
  5182. p: patch,
  5183. m: move,
  5184. um: _unmount,
  5185. o: { createElement }
  5186. }
  5187. } = sharedContext;
  5188. const storageContainer = createElement("div");
  5189. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  5190. const instance2 = vnode.component;
  5191. move(vnode, container, anchor, 0, parentSuspense);
  5192. patch(
  5193. instance2.vnode,
  5194. vnode,
  5195. container,
  5196. anchor,
  5197. instance2,
  5198. parentSuspense,
  5199. namespace,
  5200. vnode.slotScopeIds,
  5201. optimized
  5202. );
  5203. queuePostRenderEffect(() => {
  5204. instance2.isDeactivated = false;
  5205. if (instance2.a) {
  5206. invokeArrayFns(instance2.a);
  5207. }
  5208. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  5209. if (vnodeHook) {
  5210. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5211. }
  5212. }, parentSuspense);
  5213. {
  5214. devtoolsComponentAdded(instance2);
  5215. }
  5216. };
  5217. sharedContext.deactivate = (vnode) => {
  5218. const instance2 = vnode.component;
  5219. invalidateMount(instance2.m);
  5220. invalidateMount(instance2.a);
  5221. move(vnode, storageContainer, null, 1, parentSuspense);
  5222. queuePostRenderEffect(() => {
  5223. if (instance2.da) {
  5224. invokeArrayFns(instance2.da);
  5225. }
  5226. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  5227. if (vnodeHook) {
  5228. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5229. }
  5230. instance2.isDeactivated = true;
  5231. }, parentSuspense);
  5232. {
  5233. devtoolsComponentAdded(instance2);
  5234. }
  5235. {
  5236. instance2.__keepAliveStorageContainer = storageContainer;
  5237. }
  5238. };
  5239. function unmount(vnode) {
  5240. resetShapeFlag(vnode);
  5241. _unmount(vnode, instance, parentSuspense, true);
  5242. }
  5243. function pruneCache(filter) {
  5244. cache.forEach((vnode, key) => {
  5245. const name = getComponentName(
  5246. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
  5247. );
  5248. if (name && !filter(name)) {
  5249. pruneCacheEntry(key);
  5250. }
  5251. });
  5252. }
  5253. function pruneCacheEntry(key) {
  5254. const cached = cache.get(key);
  5255. if (cached && (!current || !isSameVNodeType(cached, current))) {
  5256. unmount(cached);
  5257. } else if (current) {
  5258. resetShapeFlag(current);
  5259. }
  5260. cache.delete(key);
  5261. keys.delete(key);
  5262. }
  5263. watch(
  5264. () => [props.include, props.exclude],
  5265. ([include, exclude]) => {
  5266. include && pruneCache((name) => matches(include, name));
  5267. exclude && pruneCache((name) => !matches(exclude, name));
  5268. },
  5269. // prune post-render after `current` has been updated
  5270. { flush: "post", deep: true }
  5271. );
  5272. let pendingCacheKey = null;
  5273. const cacheSubtree = () => {
  5274. if (pendingCacheKey != null) {
  5275. if (isSuspense(instance.subTree.type)) {
  5276. queuePostRenderEffect(() => {
  5277. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  5278. }, instance.subTree.suspense);
  5279. } else {
  5280. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  5281. }
  5282. }
  5283. };
  5284. onMounted(cacheSubtree);
  5285. onUpdated(cacheSubtree);
  5286. onBeforeUnmount(() => {
  5287. cache.forEach((cached) => {
  5288. const { subTree, suspense } = instance;
  5289. const vnode = getInnerChild(subTree);
  5290. if (cached.type === vnode.type && cached.key === vnode.key) {
  5291. resetShapeFlag(vnode);
  5292. const da = vnode.component.da;
  5293. da && queuePostRenderEffect(da, suspense);
  5294. return;
  5295. }
  5296. unmount(cached);
  5297. });
  5298. });
  5299. return () => {
  5300. pendingCacheKey = null;
  5301. if (!slots.default) {
  5302. return current = null;
  5303. }
  5304. const children = slots.default();
  5305. const rawVNode = children[0];
  5306. if (children.length > 1) {
  5307. {
  5308. warn$1(`KeepAlive should contain exactly one component child.`);
  5309. }
  5310. current = null;
  5311. return children;
  5312. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  5313. current = null;
  5314. return rawVNode;
  5315. }
  5316. let vnode = getInnerChild(rawVNode);
  5317. if (vnode.type === Comment) {
  5318. current = null;
  5319. return vnode;
  5320. }
  5321. const comp = vnode.type;
  5322. const name = getComponentName(
  5323. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  5324. );
  5325. const { include, exclude, max } = props;
  5326. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  5327. vnode.shapeFlag &= -257;
  5328. current = vnode;
  5329. return rawVNode;
  5330. }
  5331. const key = vnode.key == null ? comp : vnode.key;
  5332. const cachedVNode = cache.get(key);
  5333. if (vnode.el) {
  5334. vnode = cloneVNode(vnode);
  5335. if (rawVNode.shapeFlag & 128) {
  5336. rawVNode.ssContent = vnode;
  5337. }
  5338. }
  5339. pendingCacheKey = key;
  5340. if (cachedVNode) {
  5341. vnode.el = cachedVNode.el;
  5342. vnode.component = cachedVNode.component;
  5343. if (vnode.transition) {
  5344. setTransitionHooks(vnode, vnode.transition);
  5345. }
  5346. vnode.shapeFlag |= 512;
  5347. keys.delete(key);
  5348. keys.add(key);
  5349. } else {
  5350. keys.add(key);
  5351. if (max && keys.size > parseInt(max, 10)) {
  5352. pruneCacheEntry(keys.values().next().value);
  5353. }
  5354. }
  5355. vnode.shapeFlag |= 256;
  5356. current = vnode;
  5357. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  5358. };
  5359. }
  5360. };
  5361. const KeepAlive = KeepAliveImpl;
  5362. function matches(pattern, name) {
  5363. if (isArray(pattern)) {
  5364. return pattern.some((p) => matches(p, name));
  5365. } else if (isString(pattern)) {
  5366. return pattern.split(",").includes(name);
  5367. } else if (isRegExp(pattern)) {
  5368. pattern.lastIndex = 0;
  5369. return pattern.test(name);
  5370. }
  5371. return false;
  5372. }
  5373. function onActivated(hook, target) {
  5374. registerKeepAliveHook(hook, "a", target);
  5375. }
  5376. function onDeactivated(hook, target) {
  5377. registerKeepAliveHook(hook, "da", target);
  5378. }
  5379. function registerKeepAliveHook(hook, type, target = currentInstance) {
  5380. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  5381. let current = target;
  5382. while (current) {
  5383. if (current.isDeactivated) {
  5384. return;
  5385. }
  5386. current = current.parent;
  5387. }
  5388. return hook();
  5389. });
  5390. injectHook(type, wrappedHook, target);
  5391. if (target) {
  5392. let current = target.parent;
  5393. while (current && current.parent) {
  5394. if (isKeepAlive(current.parent.vnode)) {
  5395. injectToKeepAliveRoot(wrappedHook, type, target, current);
  5396. }
  5397. current = current.parent;
  5398. }
  5399. }
  5400. }
  5401. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  5402. const injected = injectHook(
  5403. type,
  5404. hook,
  5405. keepAliveRoot,
  5406. true
  5407. /* prepend */
  5408. );
  5409. onUnmounted(() => {
  5410. remove(keepAliveRoot[type], injected);
  5411. }, target);
  5412. }
  5413. function resetShapeFlag(vnode) {
  5414. vnode.shapeFlag &= -257;
  5415. vnode.shapeFlag &= -513;
  5416. }
  5417. function getInnerChild(vnode) {
  5418. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  5419. }
  5420. function injectHook(type, hook, target = currentInstance, prepend = false) {
  5421. if (target) {
  5422. const hooks = target[type] || (target[type] = []);
  5423. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  5424. pauseTracking();
  5425. const reset = setCurrentInstance(target);
  5426. const res = callWithAsyncErrorHandling(hook, target, type, args);
  5427. reset();
  5428. resetTracking();
  5429. return res;
  5430. });
  5431. if (prepend) {
  5432. hooks.unshift(wrappedHook);
  5433. } else {
  5434. hooks.push(wrappedHook);
  5435. }
  5436. return wrappedHook;
  5437. } else {
  5438. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  5439. warn$1(
  5440. `${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.` )
  5441. );
  5442. }
  5443. }
  5444. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  5445. if (!isInSSRComponentSetup || lifecycle === "sp") {
  5446. injectHook(lifecycle, (...args) => hook(...args), target);
  5447. }
  5448. };
  5449. const onBeforeMount = createHook("bm");
  5450. const onMounted = createHook("m");
  5451. const onBeforeUpdate = createHook(
  5452. "bu"
  5453. );
  5454. const onUpdated = createHook("u");
  5455. const onBeforeUnmount = createHook(
  5456. "bum"
  5457. );
  5458. const onUnmounted = createHook("um");
  5459. const onServerPrefetch = createHook(
  5460. "sp"
  5461. );
  5462. const onRenderTriggered = createHook("rtg");
  5463. const onRenderTracked = createHook("rtc");
  5464. function onErrorCaptured(hook, target = currentInstance) {
  5465. injectHook("ec", hook, target);
  5466. }
  5467. const COMPONENTS = "components";
  5468. const DIRECTIVES = "directives";
  5469. function resolveComponent(name, maybeSelfReference) {
  5470. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  5471. }
  5472. const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
  5473. function resolveDynamicComponent(component) {
  5474. if (isString(component)) {
  5475. return resolveAsset(COMPONENTS, component, false) || component;
  5476. } else {
  5477. return component || NULL_DYNAMIC_COMPONENT;
  5478. }
  5479. }
  5480. function resolveDirective(name) {
  5481. return resolveAsset(DIRECTIVES, name);
  5482. }
  5483. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5484. const instance = currentRenderingInstance || currentInstance;
  5485. if (instance) {
  5486. const Component = instance.type;
  5487. if (type === COMPONENTS) {
  5488. const selfName = getComponentName(
  5489. Component,
  5490. false
  5491. );
  5492. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5493. return Component;
  5494. }
  5495. }
  5496. const res = (
  5497. // local registration
  5498. // check instance[type] first which is resolved for options API
  5499. resolve(instance[type] || Component[type], name) || // global registration
  5500. resolve(instance.appContext[type], name)
  5501. );
  5502. if (!res && maybeSelfReference) {
  5503. return Component;
  5504. }
  5505. if (warnMissing && !res) {
  5506. const extra = type === COMPONENTS ? `
  5507. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5508. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5509. }
  5510. return res;
  5511. } else {
  5512. warn$1(
  5513. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5514. );
  5515. }
  5516. }
  5517. function resolve(registry, name) {
  5518. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5519. }
  5520. function renderList(source, renderItem, cache, index) {
  5521. let ret;
  5522. const cached = cache && cache[index];
  5523. const sourceIsArray = isArray(source);
  5524. if (sourceIsArray || isString(source)) {
  5525. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5526. let needsWrap = false;
  5527. let isReadonlySource = false;
  5528. if (sourceIsReactiveArray) {
  5529. needsWrap = !isShallow(source);
  5530. isReadonlySource = isReadonly(source);
  5531. source = shallowReadArray(source);
  5532. }
  5533. ret = new Array(source.length);
  5534. for (let i = 0, l = source.length; i < l; i++) {
  5535. ret[i] = renderItem(
  5536. needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
  5537. i,
  5538. void 0,
  5539. cached && cached[i]
  5540. );
  5541. }
  5542. } else if (typeof source === "number") {
  5543. if (!Number.isInteger(source) || source < 0) {
  5544. warn$1(
  5545. `The v-for range expects a positive integer value but got ${source}.`
  5546. );
  5547. ret = [];
  5548. } else {
  5549. ret = new Array(source);
  5550. for (let i = 0; i < source; i++) {
  5551. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5552. }
  5553. }
  5554. } else if (isObject(source)) {
  5555. if (source[Symbol.iterator]) {
  5556. ret = Array.from(
  5557. source,
  5558. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5559. );
  5560. } else {
  5561. const keys = Object.keys(source);
  5562. ret = new Array(keys.length);
  5563. for (let i = 0, l = keys.length; i < l; i++) {
  5564. const key = keys[i];
  5565. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5566. }
  5567. }
  5568. } else {
  5569. ret = [];
  5570. }
  5571. if (cache) {
  5572. cache[index] = ret;
  5573. }
  5574. return ret;
  5575. }
  5576. function createSlots(slots, dynamicSlots) {
  5577. for (let i = 0; i < dynamicSlots.length; i++) {
  5578. const slot = dynamicSlots[i];
  5579. if (isArray(slot)) {
  5580. for (let j = 0; j < slot.length; j++) {
  5581. slots[slot[j].name] = slot[j].fn;
  5582. }
  5583. } else if (slot) {
  5584. slots[slot.name] = slot.key ? (...args) => {
  5585. const res = slot.fn(...args);
  5586. if (res) res.key = slot.key;
  5587. return res;
  5588. } : slot.fn;
  5589. }
  5590. }
  5591. return slots;
  5592. }
  5593. function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
  5594. if (props == null) props = {};
  5595. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5596. const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
  5597. const hasProps = Object.keys(slotProps).length > 0;
  5598. if (name !== "default") slotProps.name = name;
  5599. return openBlock(), createBlock(
  5600. Fragment,
  5601. null,
  5602. [createVNode("slot", slotProps, fallback && fallback())],
  5603. hasProps ? -2 : 64
  5604. );
  5605. }
  5606. let slot = slots[name];
  5607. if (slot && slot.length > 1) {
  5608. warn$1(
  5609. `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.`
  5610. );
  5611. slot = () => [];
  5612. }
  5613. if (slot && slot._c) {
  5614. slot._d = false;
  5615. }
  5616. const prevStackSize = blockStack.length;
  5617. openBlock();
  5618. let rendered;
  5619. try {
  5620. const validSlotContent = slot && ensureValidVNode(slot(props));
  5621. const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
  5622. // key attached in the `createSlots` helper, respect that
  5623. validSlotContent && validSlotContent.key;
  5624. rendered = createBlock(
  5625. Fragment,
  5626. {
  5627. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5628. (!validSlotContent && fallback ? "_fb" : "")
  5629. },
  5630. validSlotContent || (fallback ? fallback() : []),
  5631. validSlotContent && slots._ === 1 ? 64 : -2
  5632. );
  5633. } catch (err) {
  5634. for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
  5635. throw err;
  5636. } finally {
  5637. if (slot && slot._c) {
  5638. slot._d = true;
  5639. }
  5640. }
  5641. if (!noSlotted && rendered.scopeId) {
  5642. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5643. }
  5644. return rendered;
  5645. }
  5646. function ensureValidVNode(vnodes) {
  5647. return vnodes.some((child) => {
  5648. if (!isVNode(child)) return true;
  5649. if (child.type === Comment) return false;
  5650. if (child.type === Fragment && !ensureValidVNode(child.children))
  5651. return false;
  5652. return true;
  5653. }) ? vnodes : null;
  5654. }
  5655. function toHandlers(obj, preserveCaseIfNecessary) {
  5656. const ret = {};
  5657. if (!isObject(obj)) {
  5658. warn$1(`v-on with no argument expects an object value.`);
  5659. return ret;
  5660. }
  5661. for (const key in obj) {
  5662. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5663. }
  5664. return ret;
  5665. }
  5666. const getPublicInstance = (i) => {
  5667. if (!i) return null;
  5668. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5669. return getPublicInstance(i.parent);
  5670. };
  5671. const publicPropertiesMap = (
  5672. // Move PURE marker to new line to workaround compiler discarding it
  5673. // due to type annotation
  5674. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5675. $: (i) => i,
  5676. $el: (i) => i.vnode.el,
  5677. $data: (i) => i.data,
  5678. $props: (i) => shallowReadonly(i.props) ,
  5679. $attrs: (i) => shallowReadonly(i.attrs) ,
  5680. $slots: (i) => shallowReadonly(i.slots) ,
  5681. $refs: (i) => shallowReadonly(i.refs) ,
  5682. $parent: (i) => getPublicInstance(i.parent),
  5683. $root: (i) => getPublicInstance(i.root),
  5684. $host: (i) => i.ce,
  5685. $emit: (i) => i.emit,
  5686. $options: (i) => resolveMergedOptions(i) ,
  5687. $forceUpdate: (i) => i.f || (i.f = () => {
  5688. queueJob(i.update);
  5689. }),
  5690. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5691. $watch: (i) => instanceWatch.bind(i)
  5692. })
  5693. );
  5694. const isReservedPrefix = (key) => key === "_" || key === "$";
  5695. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5696. const PublicInstanceProxyHandlers = {
  5697. get({ _: instance }, key) {
  5698. if (key === "__v_skip") {
  5699. return true;
  5700. }
  5701. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5702. if (key === "__isVue") {
  5703. return true;
  5704. }
  5705. if (key[0] !== "$") {
  5706. const n = accessCache[key];
  5707. if (n !== void 0) {
  5708. switch (n) {
  5709. case 1 /* SETUP */:
  5710. return setupState[key];
  5711. case 2 /* DATA */:
  5712. return data[key];
  5713. case 4 /* CONTEXT */:
  5714. return ctx[key];
  5715. case 3 /* PROPS */:
  5716. return props[key];
  5717. }
  5718. } else if (hasSetupBinding(setupState, key)) {
  5719. accessCache[key] = 1 /* SETUP */;
  5720. return setupState[key];
  5721. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5722. accessCache[key] = 2 /* DATA */;
  5723. return data[key];
  5724. } else if (hasOwn(props, key)) {
  5725. accessCache[key] = 3 /* PROPS */;
  5726. return props[key];
  5727. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5728. accessCache[key] = 4 /* CONTEXT */;
  5729. return ctx[key];
  5730. } else if (shouldCacheAccess) {
  5731. accessCache[key] = 0 /* OTHER */;
  5732. }
  5733. }
  5734. const publicGetter = publicPropertiesMap[key];
  5735. let cssModule, globalProperties;
  5736. if (publicGetter) {
  5737. if (key === "$attrs") {
  5738. track(instance.attrs, "get", "");
  5739. markAttrsAccessed();
  5740. } else if (key === "$slots") {
  5741. track(instance, "get", key);
  5742. }
  5743. return publicGetter(instance);
  5744. } else if (
  5745. // css module (injected by vue-loader)
  5746. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5747. ) {
  5748. return cssModule;
  5749. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5750. accessCache[key] = 4 /* CONTEXT */;
  5751. return ctx[key];
  5752. } else if (
  5753. // global properties
  5754. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5755. ) {
  5756. {
  5757. return globalProperties[key];
  5758. }
  5759. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5760. // to infinite warning loop
  5761. key.indexOf("__v") !== 0)) {
  5762. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5763. warn$1(
  5764. `Property ${JSON.stringify(
  5765. key
  5766. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5767. );
  5768. } else if (instance === currentRenderingInstance) {
  5769. warn$1(
  5770. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5771. );
  5772. }
  5773. }
  5774. },
  5775. set({ _: instance }, key, value) {
  5776. const { data, setupState, ctx } = instance;
  5777. if (hasSetupBinding(setupState, key)) {
  5778. setupState[key] = value;
  5779. return true;
  5780. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5781. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5782. return false;
  5783. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5784. data[key] = value;
  5785. return true;
  5786. } else if (hasOwn(instance.props, key)) {
  5787. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5788. return false;
  5789. }
  5790. if (key[0] === "$" && key.slice(1) in instance) {
  5791. warn$1(
  5792. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5793. );
  5794. return false;
  5795. } else {
  5796. if (key in instance.appContext.config.globalProperties) {
  5797. Object.defineProperty(ctx, key, {
  5798. enumerable: true,
  5799. configurable: true,
  5800. value
  5801. });
  5802. } else {
  5803. ctx[key] = value;
  5804. }
  5805. }
  5806. return true;
  5807. },
  5808. has({
  5809. _: { data, setupState, accessCache, ctx, appContext, props, type }
  5810. }, key) {
  5811. let cssModules;
  5812. return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
  5813. },
  5814. defineProperty(target, key, descriptor) {
  5815. if (descriptor.get != null) {
  5816. target._.accessCache[key] = 0;
  5817. } else if (hasOwn(descriptor, "value")) {
  5818. this.set(target, key, descriptor.value, null);
  5819. }
  5820. return Reflect.defineProperty(target, key, descriptor);
  5821. }
  5822. };
  5823. {
  5824. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5825. warn$1(
  5826. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5827. );
  5828. return Reflect.ownKeys(target);
  5829. };
  5830. }
  5831. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5832. get(target, key) {
  5833. if (key === Symbol.unscopables) {
  5834. return;
  5835. }
  5836. return PublicInstanceProxyHandlers.get(target, key, target);
  5837. },
  5838. has(_, key) {
  5839. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5840. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5841. warn$1(
  5842. `Property ${JSON.stringify(
  5843. key
  5844. )} should not start with _ which is a reserved prefix for Vue internals.`
  5845. );
  5846. }
  5847. return has;
  5848. }
  5849. });
  5850. function createDevRenderContext(instance) {
  5851. const target = {};
  5852. Object.defineProperty(target, `_`, {
  5853. configurable: true,
  5854. enumerable: false,
  5855. get: () => instance
  5856. });
  5857. Object.keys(publicPropertiesMap).forEach((key) => {
  5858. Object.defineProperty(target, key, {
  5859. configurable: true,
  5860. enumerable: false,
  5861. get: () => publicPropertiesMap[key](instance),
  5862. // intercepted by the proxy so no need for implementation,
  5863. // but needed to prevent set errors
  5864. set: NOOP
  5865. });
  5866. });
  5867. return target;
  5868. }
  5869. function exposePropsOnRenderContext(instance) {
  5870. const {
  5871. ctx,
  5872. propsOptions: [propsOptions]
  5873. } = instance;
  5874. if (propsOptions) {
  5875. Object.keys(propsOptions).forEach((key) => {
  5876. Object.defineProperty(ctx, key, {
  5877. enumerable: true,
  5878. configurable: true,
  5879. get: () => instance.props[key],
  5880. set: NOOP
  5881. });
  5882. });
  5883. }
  5884. }
  5885. function exposeSetupStateOnRenderContext(instance) {
  5886. const { ctx, setupState } = instance;
  5887. Object.keys(toRaw(setupState)).forEach((key) => {
  5888. if (!setupState.__isScriptSetup) {
  5889. if (isReservedPrefix(key[0])) {
  5890. warn$1(
  5891. `setup() return property ${JSON.stringify(
  5892. key
  5893. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5894. );
  5895. return;
  5896. }
  5897. Object.defineProperty(ctx, key, {
  5898. enumerable: true,
  5899. configurable: true,
  5900. get: () => setupState[key],
  5901. set: NOOP
  5902. });
  5903. }
  5904. });
  5905. }
  5906. const warnRuntimeUsage = (method) => warn$1(
  5907. `${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.`
  5908. );
  5909. function defineProps() {
  5910. {
  5911. warnRuntimeUsage(`defineProps`);
  5912. }
  5913. return null;
  5914. }
  5915. function defineEmits() {
  5916. {
  5917. warnRuntimeUsage(`defineEmits`);
  5918. }
  5919. return null;
  5920. }
  5921. function defineExpose(exposed) {
  5922. {
  5923. warnRuntimeUsage(`defineExpose`);
  5924. }
  5925. }
  5926. function defineOptions(options) {
  5927. {
  5928. warnRuntimeUsage(`defineOptions`);
  5929. }
  5930. }
  5931. function defineSlots() {
  5932. {
  5933. warnRuntimeUsage(`defineSlots`);
  5934. }
  5935. return null;
  5936. }
  5937. function defineModel() {
  5938. {
  5939. warnRuntimeUsage("defineModel");
  5940. }
  5941. }
  5942. function withDefaults(props, defaults) {
  5943. {
  5944. warnRuntimeUsage(`withDefaults`);
  5945. }
  5946. return null;
  5947. }
  5948. function useSlots() {
  5949. return getContext("useSlots").slots;
  5950. }
  5951. function useAttrs() {
  5952. return getContext("useAttrs").attrs;
  5953. }
  5954. function getContext(calledFunctionName) {
  5955. const i = getCurrentInstance();
  5956. if (!i) {
  5957. warn$1(`${calledFunctionName}() called without active instance.`);
  5958. }
  5959. return i.setupContext || (i.setupContext = createSetupContext(i));
  5960. }
  5961. function normalizePropsOrEmits(props) {
  5962. return isArray(props) ? props.reduce(
  5963. (normalized, p) => (normalized[p] = null, normalized),
  5964. {}
  5965. ) : props;
  5966. }
  5967. function mergeDefaults(raw, defaults) {
  5968. const props = normalizePropsOrEmits(raw);
  5969. for (const key in defaults) {
  5970. if (key.startsWith("__skip")) continue;
  5971. let opt = props[key];
  5972. if (opt) {
  5973. if (isArray(opt) || isFunction(opt)) {
  5974. opt = props[key] = { type: opt, default: defaults[key] };
  5975. } else {
  5976. opt.default = defaults[key];
  5977. }
  5978. } else if (opt === null) {
  5979. opt = props[key] = { default: defaults[key] };
  5980. } else {
  5981. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5982. }
  5983. if (opt && defaults[`__skip_${key}`]) {
  5984. opt.skipFactory = true;
  5985. }
  5986. }
  5987. return props;
  5988. }
  5989. function mergeModels(a, b) {
  5990. if (!a || !b) return a || b;
  5991. if (isArray(a) && isArray(b)) return a.concat(b);
  5992. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5993. }
  5994. function createPropsRestProxy(props, excludedKeys) {
  5995. const ret = {};
  5996. for (const key in props) {
  5997. if (!excludedKeys.includes(key)) {
  5998. Object.defineProperty(ret, key, {
  5999. enumerable: true,
  6000. get: () => props[key]
  6001. });
  6002. }
  6003. }
  6004. return ret;
  6005. }
  6006. function withAsyncContext(getAwaitable) {
  6007. const ctx = getCurrentInstance();
  6008. const inSSRSetup = isInSSRComponentSetup;
  6009. if (!ctx) {
  6010. warn$1(
  6011. `withAsyncContext called without active current instance. This is likely a bug.`
  6012. );
  6013. }
  6014. let awaitable = getAwaitable();
  6015. unsetCurrentInstance();
  6016. if (inSSRSetup) {
  6017. setInSSRSetupState(false);
  6018. }
  6019. const restore = () => {
  6020. setCurrentInstance(ctx);
  6021. if (inSSRSetup) {
  6022. setInSSRSetupState(true);
  6023. }
  6024. };
  6025. const cleanup = () => {
  6026. if (getCurrentInstance() !== ctx) ctx.scope.off();
  6027. unsetCurrentInstance();
  6028. if (inSSRSetup) {
  6029. setInSSRSetupState(false);
  6030. }
  6031. };
  6032. if (isPromise(awaitable)) {
  6033. awaitable = awaitable.catch((e) => {
  6034. restore();
  6035. Promise.resolve().then(() => Promise.resolve().then(cleanup));
  6036. throw e;
  6037. });
  6038. }
  6039. return [
  6040. awaitable,
  6041. () => {
  6042. restore();
  6043. Promise.resolve().then(cleanup);
  6044. }
  6045. ];
  6046. }
  6047. function createDuplicateChecker() {
  6048. const cache = /* @__PURE__ */ Object.create(null);
  6049. return (type, key) => {
  6050. if (cache[key]) {
  6051. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  6052. } else {
  6053. cache[key] = type;
  6054. }
  6055. };
  6056. }
  6057. let shouldCacheAccess = true;
  6058. function applyOptions(instance) {
  6059. const options = resolveMergedOptions(instance);
  6060. const publicThis = instance.proxy;
  6061. const ctx = instance.ctx;
  6062. shouldCacheAccess = false;
  6063. if (options.beforeCreate) {
  6064. callHook$1(options.beforeCreate, instance, "bc");
  6065. }
  6066. const {
  6067. // state
  6068. data: dataOptions,
  6069. computed: computedOptions,
  6070. methods,
  6071. watch: watchOptions,
  6072. provide: provideOptions,
  6073. inject: injectOptions,
  6074. // lifecycle
  6075. created,
  6076. beforeMount,
  6077. mounted,
  6078. beforeUpdate,
  6079. updated,
  6080. activated,
  6081. deactivated,
  6082. beforeDestroy,
  6083. beforeUnmount,
  6084. destroyed,
  6085. unmounted,
  6086. render,
  6087. renderTracked,
  6088. renderTriggered,
  6089. errorCaptured,
  6090. serverPrefetch,
  6091. // public API
  6092. expose,
  6093. inheritAttrs,
  6094. // assets
  6095. components,
  6096. directives,
  6097. filters
  6098. } = options;
  6099. const checkDuplicateProperties = createDuplicateChecker() ;
  6100. {
  6101. const [propsOptions] = instance.propsOptions;
  6102. if (propsOptions) {
  6103. for (const key in propsOptions) {
  6104. checkDuplicateProperties("Props" /* PROPS */, key);
  6105. }
  6106. }
  6107. }
  6108. if (injectOptions) {
  6109. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  6110. }
  6111. if (methods) {
  6112. for (const key in methods) {
  6113. const methodHandler = methods[key];
  6114. if (isFunction(methodHandler)) {
  6115. {
  6116. Object.defineProperty(ctx, key, {
  6117. value: methodHandler.bind(publicThis),
  6118. configurable: true,
  6119. enumerable: true,
  6120. writable: true
  6121. });
  6122. }
  6123. {
  6124. checkDuplicateProperties("Methods" /* METHODS */, key);
  6125. }
  6126. } else {
  6127. warn$1(
  6128. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  6129. );
  6130. }
  6131. }
  6132. }
  6133. if (dataOptions) {
  6134. if (!isFunction(dataOptions)) {
  6135. warn$1(
  6136. `The data option must be a function. Plain object usage is no longer supported.`
  6137. );
  6138. }
  6139. const data = dataOptions.call(publicThis, publicThis);
  6140. if (isPromise(data)) {
  6141. warn$1(
  6142. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  6143. );
  6144. }
  6145. if (!isObject(data)) {
  6146. warn$1(`data() should return an object.`);
  6147. } else {
  6148. instance.data = reactive(data);
  6149. {
  6150. for (const key in data) {
  6151. checkDuplicateProperties("Data" /* DATA */, key);
  6152. if (!isReservedPrefix(key[0])) {
  6153. Object.defineProperty(ctx, key, {
  6154. configurable: true,
  6155. enumerable: true,
  6156. get: () => data[key],
  6157. set: NOOP
  6158. });
  6159. }
  6160. }
  6161. }
  6162. }
  6163. }
  6164. shouldCacheAccess = true;
  6165. if (computedOptions) {
  6166. for (const key in computedOptions) {
  6167. const opt = computedOptions[key];
  6168. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  6169. if (get === NOOP) {
  6170. warn$1(`Computed property "${key}" has no getter.`);
  6171. }
  6172. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  6173. warn$1(
  6174. `Write operation failed: computed property "${key}" is readonly.`
  6175. );
  6176. } ;
  6177. const c = computed({
  6178. get,
  6179. set
  6180. });
  6181. Object.defineProperty(ctx, key, {
  6182. enumerable: true,
  6183. configurable: true,
  6184. get: () => c.value,
  6185. set: (v) => c.value = v
  6186. });
  6187. {
  6188. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  6189. }
  6190. }
  6191. }
  6192. if (watchOptions) {
  6193. for (const key in watchOptions) {
  6194. createWatcher(watchOptions[key], ctx, publicThis, key);
  6195. }
  6196. }
  6197. if (provideOptions) {
  6198. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  6199. Reflect.ownKeys(provides).forEach((key) => {
  6200. provide(key, provides[key]);
  6201. });
  6202. }
  6203. if (created) {
  6204. callHook$1(created, instance, "c");
  6205. }
  6206. function registerLifecycleHook(register, hook) {
  6207. if (isArray(hook)) {
  6208. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  6209. } else if (hook) {
  6210. register(hook.bind(publicThis));
  6211. }
  6212. }
  6213. registerLifecycleHook(onBeforeMount, beforeMount);
  6214. registerLifecycleHook(onMounted, mounted);
  6215. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  6216. registerLifecycleHook(onUpdated, updated);
  6217. registerLifecycleHook(onActivated, activated);
  6218. registerLifecycleHook(onDeactivated, deactivated);
  6219. registerLifecycleHook(onErrorCaptured, errorCaptured);
  6220. registerLifecycleHook(onRenderTracked, renderTracked);
  6221. registerLifecycleHook(onRenderTriggered, renderTriggered);
  6222. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  6223. registerLifecycleHook(onUnmounted, unmounted);
  6224. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  6225. if (isArray(expose)) {
  6226. if (expose.length) {
  6227. const exposed = instance.exposed || (instance.exposed = {});
  6228. expose.forEach((key) => {
  6229. Object.defineProperty(exposed, key, {
  6230. get: () => publicThis[key],
  6231. set: (val) => publicThis[key] = val,
  6232. enumerable: true
  6233. });
  6234. });
  6235. } else if (!instance.exposed) {
  6236. instance.exposed = {};
  6237. }
  6238. }
  6239. if (render && instance.render === NOOP) {
  6240. instance.render = render;
  6241. }
  6242. if (inheritAttrs != null) {
  6243. instance.inheritAttrs = inheritAttrs;
  6244. }
  6245. if (components) instance.components = components;
  6246. if (directives) instance.directives = directives;
  6247. if (serverPrefetch) {
  6248. markAsyncBoundary(instance);
  6249. }
  6250. }
  6251. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  6252. if (isArray(injectOptions)) {
  6253. injectOptions = normalizeInject(injectOptions);
  6254. }
  6255. for (const key in injectOptions) {
  6256. const opt = injectOptions[key];
  6257. let injected;
  6258. if (isObject(opt)) {
  6259. if ("default" in opt) {
  6260. injected = inject(
  6261. opt.from || key,
  6262. opt.default,
  6263. true
  6264. );
  6265. } else {
  6266. injected = inject(opt.from || key);
  6267. }
  6268. } else {
  6269. injected = inject(opt);
  6270. }
  6271. if (isRef(injected)) {
  6272. Object.defineProperty(ctx, key, {
  6273. enumerable: true,
  6274. configurable: true,
  6275. get: () => injected.value,
  6276. set: (v) => injected.value = v
  6277. });
  6278. } else {
  6279. ctx[key] = injected;
  6280. }
  6281. {
  6282. checkDuplicateProperties("Inject" /* INJECT */, key);
  6283. }
  6284. }
  6285. }
  6286. function callHook$1(hook, instance, type) {
  6287. callWithAsyncErrorHandling(
  6288. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  6289. instance,
  6290. type
  6291. );
  6292. }
  6293. function createWatcher(raw, ctx, publicThis, key) {
  6294. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  6295. if (isString(raw)) {
  6296. const handler = ctx[raw];
  6297. if (isFunction(handler)) {
  6298. {
  6299. watch(getter, handler);
  6300. }
  6301. } else {
  6302. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  6303. }
  6304. } else if (isFunction(raw)) {
  6305. {
  6306. watch(getter, raw.bind(publicThis));
  6307. }
  6308. } else if (isObject(raw)) {
  6309. if (isArray(raw)) {
  6310. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  6311. } else {
  6312. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  6313. if (isFunction(handler)) {
  6314. watch(getter, handler, raw);
  6315. } else {
  6316. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  6317. }
  6318. }
  6319. } else {
  6320. warn$1(`Invalid watch option: "${key}"`, raw);
  6321. }
  6322. }
  6323. function resolveMergedOptions(instance) {
  6324. const base = instance.type;
  6325. const { mixins, extends: extendsOptions } = base;
  6326. const {
  6327. mixins: globalMixins,
  6328. optionsCache: cache,
  6329. config: { optionMergeStrategies }
  6330. } = instance.appContext;
  6331. const cached = cache.get(base);
  6332. let resolved;
  6333. if (cached) {
  6334. resolved = cached;
  6335. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  6336. {
  6337. resolved = base;
  6338. }
  6339. } else {
  6340. resolved = {};
  6341. if (globalMixins.length) {
  6342. globalMixins.forEach(
  6343. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  6344. );
  6345. }
  6346. mergeOptions(resolved, base, optionMergeStrategies);
  6347. }
  6348. if (isObject(base)) {
  6349. cache.set(base, resolved);
  6350. }
  6351. return resolved;
  6352. }
  6353. function mergeOptions(to, from, strats, asMixin = false) {
  6354. const { mixins, extends: extendsOptions } = from;
  6355. if (extendsOptions) {
  6356. mergeOptions(to, extendsOptions, strats, true);
  6357. }
  6358. if (mixins) {
  6359. mixins.forEach(
  6360. (m) => mergeOptions(to, m, strats, true)
  6361. );
  6362. }
  6363. for (const key in from) {
  6364. if (asMixin && key === "expose") {
  6365. warn$1(
  6366. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  6367. );
  6368. } else {
  6369. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  6370. to[key] = strat ? strat(to[key], from[key]) : from[key];
  6371. }
  6372. }
  6373. return to;
  6374. }
  6375. const internalOptionMergeStrats = {
  6376. data: mergeDataFn,
  6377. props: mergeEmitsOrPropsOptions,
  6378. emits: mergeEmitsOrPropsOptions,
  6379. // objects
  6380. methods: mergeObjectOptions,
  6381. computed: mergeObjectOptions,
  6382. // lifecycle
  6383. beforeCreate: mergeAsArray$1,
  6384. created: mergeAsArray$1,
  6385. beforeMount: mergeAsArray$1,
  6386. mounted: mergeAsArray$1,
  6387. beforeUpdate: mergeAsArray$1,
  6388. updated: mergeAsArray$1,
  6389. beforeDestroy: mergeAsArray$1,
  6390. beforeUnmount: mergeAsArray$1,
  6391. destroyed: mergeAsArray$1,
  6392. unmounted: mergeAsArray$1,
  6393. activated: mergeAsArray$1,
  6394. deactivated: mergeAsArray$1,
  6395. errorCaptured: mergeAsArray$1,
  6396. serverPrefetch: mergeAsArray$1,
  6397. // assets
  6398. components: mergeObjectOptions,
  6399. directives: mergeObjectOptions,
  6400. // watch
  6401. watch: mergeWatchOptions,
  6402. // provide / inject
  6403. provide: mergeDataFn,
  6404. inject: mergeInject
  6405. };
  6406. function mergeDataFn(to, from) {
  6407. if (!from) {
  6408. return to;
  6409. }
  6410. if (!to) {
  6411. return from;
  6412. }
  6413. return function mergedDataFn() {
  6414. return (extend)(
  6415. isFunction(to) ? to.call(this, this) : to,
  6416. isFunction(from) ? from.call(this, this) : from
  6417. );
  6418. };
  6419. }
  6420. function mergeInject(to, from) {
  6421. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  6422. }
  6423. function normalizeInject(raw) {
  6424. if (isArray(raw)) {
  6425. const res = {};
  6426. for (let i = 0; i < raw.length; i++) {
  6427. res[raw[i]] = raw[i];
  6428. }
  6429. return res;
  6430. }
  6431. return raw;
  6432. }
  6433. function mergeAsArray$1(to, from) {
  6434. return to ? [...new Set([].concat(to, from))] : from;
  6435. }
  6436. function mergeObjectOptions(to, from) {
  6437. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  6438. }
  6439. function mergeEmitsOrPropsOptions(to, from) {
  6440. if (to) {
  6441. if (isArray(to) && isArray(from)) {
  6442. return [.../* @__PURE__ */ new Set([...to, ...from])];
  6443. }
  6444. return extend(
  6445. /* @__PURE__ */ Object.create(null),
  6446. normalizePropsOrEmits(to),
  6447. normalizePropsOrEmits(from != null ? from : {})
  6448. );
  6449. } else {
  6450. return from;
  6451. }
  6452. }
  6453. function mergeWatchOptions(to, from) {
  6454. if (!to) return from;
  6455. if (!from) return to;
  6456. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  6457. for (const key in from) {
  6458. merged[key] = mergeAsArray$1(to[key], from[key]);
  6459. }
  6460. return merged;
  6461. }
  6462. function createAppContext() {
  6463. return {
  6464. app: null,
  6465. config: {
  6466. isNativeTag: NO,
  6467. performance: false,
  6468. globalProperties: {},
  6469. optionMergeStrategies: {},
  6470. errorHandler: void 0,
  6471. warnHandler: void 0,
  6472. compilerOptions: {}
  6473. },
  6474. mixins: [],
  6475. components: {},
  6476. directives: {},
  6477. provides: /* @__PURE__ */ Object.create(null),
  6478. optionsCache: /* @__PURE__ */ new WeakMap(),
  6479. propsCache: /* @__PURE__ */ new WeakMap(),
  6480. emitsCache: /* @__PURE__ */ new WeakMap()
  6481. };
  6482. }
  6483. let uid$1 = 0;
  6484. function createAppAPI(render, hydrate) {
  6485. return function createApp(rootComponent, rootProps = null) {
  6486. if (!isFunction(rootComponent)) {
  6487. rootComponent = extend({}, rootComponent);
  6488. }
  6489. if (rootProps != null && !isObject(rootProps)) {
  6490. warn$1(`root props passed to app.mount() must be an object.`);
  6491. rootProps = null;
  6492. }
  6493. const context = createAppContext();
  6494. const installedPlugins = /* @__PURE__ */ new WeakSet();
  6495. const pluginCleanupFns = [];
  6496. let isMounted = false;
  6497. const app = context.app = {
  6498. _uid: uid$1++,
  6499. _component: rootComponent,
  6500. _props: rootProps,
  6501. _container: null,
  6502. _context: context,
  6503. _instance: null,
  6504. version,
  6505. get config() {
  6506. return context.config;
  6507. },
  6508. set config(v) {
  6509. {
  6510. warn$1(
  6511. `app.config cannot be replaced. Modify individual options instead.`
  6512. );
  6513. }
  6514. },
  6515. use(plugin, ...options) {
  6516. if (installedPlugins.has(plugin)) {
  6517. warn$1(`Plugin has already been applied to target app.`);
  6518. } else if (plugin && isFunction(plugin.install)) {
  6519. installedPlugins.add(plugin);
  6520. plugin.install(app, ...options);
  6521. } else if (isFunction(plugin)) {
  6522. installedPlugins.add(plugin);
  6523. plugin(app, ...options);
  6524. } else {
  6525. warn$1(
  6526. `A plugin must either be a function or an object with an "install" function.`
  6527. );
  6528. }
  6529. return app;
  6530. },
  6531. mixin(mixin) {
  6532. {
  6533. if (!context.mixins.includes(mixin)) {
  6534. context.mixins.push(mixin);
  6535. } else {
  6536. warn$1(
  6537. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6538. );
  6539. }
  6540. }
  6541. return app;
  6542. },
  6543. component(name, component) {
  6544. {
  6545. validateComponentName(name, context.config);
  6546. }
  6547. if (!component) {
  6548. return context.components[name];
  6549. }
  6550. if (context.components[name]) {
  6551. warn$1(`Component "${name}" has already been registered in target app.`);
  6552. }
  6553. context.components[name] = component;
  6554. return app;
  6555. },
  6556. directive(name, directive) {
  6557. {
  6558. validateDirectiveName(name);
  6559. }
  6560. if (!directive) {
  6561. return context.directives[name];
  6562. }
  6563. if (context.directives[name]) {
  6564. warn$1(`Directive "${name}" has already been registered in target app.`);
  6565. }
  6566. context.directives[name] = directive;
  6567. return app;
  6568. },
  6569. mount(rootContainer, isHydrate, namespace) {
  6570. if (!isMounted) {
  6571. if (rootContainer.__vue_app__) {
  6572. warn$1(
  6573. `There is already an app instance mounted on the host container.
  6574. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6575. );
  6576. }
  6577. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6578. vnode.appContext = context;
  6579. if (namespace === true) {
  6580. namespace = "svg";
  6581. } else if (namespace === false) {
  6582. namespace = void 0;
  6583. }
  6584. {
  6585. context.reload = () => {
  6586. const cloned = cloneVNode(vnode);
  6587. cloned.el = null;
  6588. render(cloned, rootContainer, namespace);
  6589. };
  6590. }
  6591. if (isHydrate && hydrate) {
  6592. hydrate(vnode, rootContainer);
  6593. } else {
  6594. render(vnode, rootContainer, namespace);
  6595. }
  6596. isMounted = true;
  6597. app._container = rootContainer;
  6598. rootContainer.__vue_app__ = app;
  6599. {
  6600. app._instance = vnode.component;
  6601. devtoolsInitApp(app, version);
  6602. }
  6603. return getComponentPublicInstance(vnode.component);
  6604. } else {
  6605. warn$1(
  6606. `App has already been mounted.
  6607. 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)\``
  6608. );
  6609. }
  6610. },
  6611. onUnmount(cleanupFn) {
  6612. if (typeof cleanupFn !== "function") {
  6613. warn$1(
  6614. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6615. );
  6616. }
  6617. pluginCleanupFns.push(cleanupFn);
  6618. },
  6619. unmount() {
  6620. if (isMounted) {
  6621. callWithAsyncErrorHandling(
  6622. pluginCleanupFns,
  6623. app._instance,
  6624. 16
  6625. );
  6626. render(null, app._container);
  6627. {
  6628. app._instance = null;
  6629. devtoolsUnmountApp(app);
  6630. }
  6631. delete app._container.__vue_app__;
  6632. } else {
  6633. warn$1(`Cannot unmount an app that is not mounted.`);
  6634. }
  6635. },
  6636. provide(key, value) {
  6637. if (key in context.provides) {
  6638. if (hasOwn(context.provides, key)) {
  6639. warn$1(
  6640. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6641. );
  6642. } else {
  6643. warn$1(
  6644. `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
  6645. );
  6646. }
  6647. }
  6648. context.provides[key] = value;
  6649. return app;
  6650. },
  6651. runWithContext(fn) {
  6652. const lastApp = currentApp;
  6653. currentApp = app;
  6654. try {
  6655. return fn();
  6656. } finally {
  6657. currentApp = lastApp;
  6658. }
  6659. }
  6660. };
  6661. return app;
  6662. };
  6663. }
  6664. let currentApp = null;
  6665. function useModel(props, name, options = EMPTY_OBJ) {
  6666. const i = getCurrentInstance();
  6667. if (!i) {
  6668. warn$1(`useModel() called without active instance.`);
  6669. return ref();
  6670. }
  6671. const camelizedName = camelize(name);
  6672. if (!i.propsOptions[0][camelizedName]) {
  6673. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  6674. return ref();
  6675. }
  6676. const hyphenatedName = hyphenate(name);
  6677. const modifiers = getModelModifiers(props, camelizedName);
  6678. const res = customRef((track, trigger) => {
  6679. let localValue;
  6680. let prevSetValue = EMPTY_OBJ;
  6681. let prevEmittedValue;
  6682. watchSyncEffect(() => {
  6683. const propValue = props[camelizedName];
  6684. if (hasChanged(localValue, propValue)) {
  6685. localValue = propValue;
  6686. trigger();
  6687. }
  6688. });
  6689. return {
  6690. get() {
  6691. track();
  6692. return options.get ? options.get(localValue) : localValue;
  6693. },
  6694. set(value) {
  6695. const emittedValue = options.set ? options.set(value) : value;
  6696. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  6697. return;
  6698. }
  6699. const rawProps = i.vnode.props;
  6700. const hasVModel = !!(rawProps && // check if parent has passed v-model
  6701. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
  6702. if (!hasVModel) {
  6703. localValue = value;
  6704. trigger();
  6705. }
  6706. i.emit(`update:${name}`, emittedValue);
  6707. if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
  6708. // event listeners. If a v-model listener emits an intermediate value
  6709. // and a following listener restores the model to its previous prop
  6710. // value before parent updates are flushed, the parent render can be
  6711. // deduped as having no prop change. Force a local update so DOM state
  6712. // such as an input's value is synchronized back to the current model.
  6713. hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
  6714. trigger();
  6715. }
  6716. prevSetValue = value;
  6717. prevEmittedValue = emittedValue;
  6718. }
  6719. };
  6720. });
  6721. res[Symbol.iterator] = () => {
  6722. let i2 = 0;
  6723. return {
  6724. next() {
  6725. if (i2 < 2) {
  6726. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  6727. } else {
  6728. return { done: true };
  6729. }
  6730. }
  6731. };
  6732. };
  6733. return res;
  6734. }
  6735. const getModelModifiers = (props, modelName) => {
  6736. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  6737. };
  6738. function emit(instance, event, ...rawArgs) {
  6739. if (instance.isUnmounted) return;
  6740. const props = instance.vnode.props || EMPTY_OBJ;
  6741. {
  6742. const {
  6743. emitsOptions,
  6744. propsOptions: [propsOptions]
  6745. } = instance;
  6746. if (emitsOptions) {
  6747. if (!(event in emitsOptions) && true) {
  6748. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  6749. warn$1(
  6750. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  6751. );
  6752. }
  6753. } else {
  6754. const validator = emitsOptions[event];
  6755. if (isFunction(validator)) {
  6756. const isValid = validator(...rawArgs);
  6757. if (!isValid) {
  6758. warn$1(
  6759. `Invalid event arguments: event validation failed for event "${event}".`
  6760. );
  6761. }
  6762. }
  6763. }
  6764. }
  6765. }
  6766. let args = rawArgs;
  6767. const isModelListener = event.startsWith("update:");
  6768. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  6769. if (modifiers) {
  6770. if (modifiers.trim) {
  6771. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  6772. }
  6773. if (modifiers.number) {
  6774. args = rawArgs.map(looseToNumber);
  6775. }
  6776. }
  6777. {
  6778. devtoolsComponentEmit(instance, event, args);
  6779. }
  6780. {
  6781. const lowerCaseEvent = event.toLowerCase();
  6782. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  6783. warn$1(
  6784. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  6785. instance,
  6786. instance.type
  6787. )} 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(
  6788. event
  6789. )}" instead of "${event}".`
  6790. );
  6791. }
  6792. }
  6793. let handlerName;
  6794. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  6795. props[handlerName = toHandlerKey(camelize(event))];
  6796. if (!handler && isModelListener) {
  6797. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  6798. }
  6799. if (handler) {
  6800. callWithAsyncErrorHandling(
  6801. handler,
  6802. instance,
  6803. 6,
  6804. args
  6805. );
  6806. }
  6807. const onceHandler = props[handlerName + `Once`];
  6808. if (onceHandler) {
  6809. if (!instance.emitted) {
  6810. instance.emitted = {};
  6811. } else if (instance.emitted[handlerName]) {
  6812. return;
  6813. }
  6814. instance.emitted[handlerName] = true;
  6815. callWithAsyncErrorHandling(
  6816. onceHandler,
  6817. instance,
  6818. 6,
  6819. args
  6820. );
  6821. }
  6822. }
  6823. const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
  6824. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  6825. const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
  6826. const cached = cache.get(comp);
  6827. if (cached !== void 0) {
  6828. return cached;
  6829. }
  6830. const raw = comp.emits;
  6831. let normalized = {};
  6832. let hasExtends = false;
  6833. if (!isFunction(comp)) {
  6834. const extendEmits = (raw2) => {
  6835. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  6836. if (normalizedFromExtend) {
  6837. hasExtends = true;
  6838. extend(normalized, normalizedFromExtend);
  6839. }
  6840. };
  6841. if (!asMixin && appContext.mixins.length) {
  6842. appContext.mixins.forEach(extendEmits);
  6843. }
  6844. if (comp.extends) {
  6845. extendEmits(comp.extends);
  6846. }
  6847. if (comp.mixins) {
  6848. comp.mixins.forEach(extendEmits);
  6849. }
  6850. }
  6851. if (!raw && !hasExtends) {
  6852. if (isObject(comp)) {
  6853. cache.set(comp, null);
  6854. }
  6855. return null;
  6856. }
  6857. if (isArray(raw)) {
  6858. raw.forEach((key) => normalized[key] = null);
  6859. } else {
  6860. extend(normalized, raw);
  6861. }
  6862. if (isObject(comp)) {
  6863. cache.set(comp, normalized);
  6864. }
  6865. return normalized;
  6866. }
  6867. function isEmitListener(options, key) {
  6868. if (!options || !isOn(key)) {
  6869. return false;
  6870. }
  6871. key = key.slice(2);
  6872. key = key === "Once" ? key : key.replace(/Once$/, "");
  6873. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  6874. }
  6875. let accessedAttrs = false;
  6876. function markAttrsAccessed() {
  6877. accessedAttrs = true;
  6878. }
  6879. function renderComponentRoot(instance) {
  6880. const {
  6881. type: Component,
  6882. vnode,
  6883. proxy,
  6884. withProxy,
  6885. propsOptions: [propsOptions],
  6886. slots,
  6887. attrs,
  6888. emit,
  6889. render,
  6890. renderCache,
  6891. props,
  6892. data,
  6893. setupState,
  6894. ctx,
  6895. inheritAttrs
  6896. } = instance;
  6897. const prev = setCurrentRenderingInstance(instance);
  6898. let result;
  6899. let fallthroughAttrs;
  6900. {
  6901. accessedAttrs = false;
  6902. }
  6903. try {
  6904. if (vnode.shapeFlag & 4) {
  6905. const proxyToUse = withProxy || proxy;
  6906. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  6907. get(target, key, receiver) {
  6908. warn$1(
  6909. `Property '${String(
  6910. key
  6911. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  6912. );
  6913. return Reflect.get(target, key, receiver);
  6914. }
  6915. }) : proxyToUse;
  6916. result = normalizeVNode(
  6917. render.call(
  6918. thisProxy,
  6919. proxyToUse,
  6920. renderCache,
  6921. true ? shallowReadonly(props) : props,
  6922. setupState,
  6923. data,
  6924. ctx
  6925. )
  6926. );
  6927. fallthroughAttrs = attrs;
  6928. } else {
  6929. const render2 = Component;
  6930. if (attrs === props) {
  6931. markAttrsAccessed();
  6932. }
  6933. result = normalizeVNode(
  6934. render2.length > 1 ? render2(
  6935. true ? shallowReadonly(props) : props,
  6936. true ? {
  6937. get attrs() {
  6938. markAttrsAccessed();
  6939. return shallowReadonly(attrs);
  6940. },
  6941. slots,
  6942. emit
  6943. } : { attrs, slots, emit }
  6944. ) : render2(
  6945. true ? shallowReadonly(props) : props,
  6946. null
  6947. )
  6948. );
  6949. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  6950. }
  6951. } catch (err) {
  6952. blockStack.length = 0;
  6953. handleError(err, instance, 1);
  6954. result = createVNode(Comment);
  6955. }
  6956. let root = result;
  6957. let setRoot = void 0;
  6958. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  6959. [root, setRoot] = getChildRoot(result);
  6960. }
  6961. if (fallthroughAttrs && inheritAttrs !== false) {
  6962. const keys = Object.keys(fallthroughAttrs);
  6963. const { shapeFlag } = root;
  6964. if (keys.length) {
  6965. if (shapeFlag & (1 | 6)) {
  6966. if (propsOptions && keys.some(isModelListener)) {
  6967. fallthroughAttrs = filterModelListeners(
  6968. fallthroughAttrs,
  6969. propsOptions
  6970. );
  6971. }
  6972. root = cloneVNode(root, fallthroughAttrs, false, true);
  6973. } else if (!accessedAttrs && root.type !== Comment) {
  6974. const allAttrs = Object.keys(attrs);
  6975. const eventAttrs = [];
  6976. const extraAttrs = [];
  6977. for (let i = 0, l = allAttrs.length; i < l; i++) {
  6978. const key = allAttrs[i];
  6979. if (isOn(key)) {
  6980. if (!isModelListener(key)) {
  6981. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  6982. }
  6983. } else {
  6984. extraAttrs.push(key);
  6985. }
  6986. }
  6987. if (extraAttrs.length) {
  6988. warn$1(
  6989. `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.`
  6990. );
  6991. }
  6992. if (eventAttrs.length) {
  6993. warn$1(
  6994. `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.`
  6995. );
  6996. }
  6997. }
  6998. }
  6999. }
  7000. if (vnode.dirs) {
  7001. if (!isElementRoot(root)) {
  7002. warn$1(
  7003. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  7004. );
  7005. }
  7006. root = cloneVNode(root, null, false, true);
  7007. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  7008. }
  7009. if (vnode.transition) {
  7010. const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
  7011. if (!isElementRoot(child)) {
  7012. warn$1(
  7013. `Component inside <Transition> renders non-element root node that cannot be animated.`
  7014. );
  7015. }
  7016. setTransitionHooks(child, vnode.transition);
  7017. }
  7018. if (setRoot) {
  7019. setRoot(root);
  7020. } else {
  7021. result = root;
  7022. }
  7023. setCurrentRenderingInstance(prev);
  7024. return result;
  7025. }
  7026. const getChildRoot = (vnode) => {
  7027. const rawChildren = vnode.children;
  7028. const dynamicChildren = vnode.dynamicChildren;
  7029. const childRoot = filterSingleRoot(rawChildren, false);
  7030. if (!childRoot) {
  7031. return [vnode, void 0];
  7032. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  7033. return getChildRoot(childRoot);
  7034. }
  7035. const index = rawChildren.indexOf(childRoot);
  7036. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  7037. const setRoot = (updatedRoot) => {
  7038. rawChildren[index] = updatedRoot;
  7039. if (dynamicChildren) {
  7040. if (dynamicIndex > -1) {
  7041. dynamicChildren[dynamicIndex] = updatedRoot;
  7042. } else if (updatedRoot.patchFlag > 0) {
  7043. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  7044. }
  7045. }
  7046. };
  7047. return [normalizeVNode(childRoot), setRoot];
  7048. };
  7049. function filterSingleRoot(children, recurse = true) {
  7050. let singleRoot;
  7051. for (let i = 0; i < children.length; i++) {
  7052. const child = children[i];
  7053. if (isVNode(child)) {
  7054. if (child.type !== Comment || child.children === "v-if") {
  7055. if (singleRoot) {
  7056. return;
  7057. } else {
  7058. singleRoot = child;
  7059. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  7060. return filterSingleRoot(singleRoot.children);
  7061. }
  7062. }
  7063. }
  7064. } else {
  7065. return;
  7066. }
  7067. }
  7068. return singleRoot;
  7069. }
  7070. const getFunctionalFallthrough = (attrs) => {
  7071. let res;
  7072. for (const key in attrs) {
  7073. if (key === "class" || key === "style" || isOn(key)) {
  7074. (res || (res = {}))[key] = attrs[key];
  7075. }
  7076. }
  7077. return res;
  7078. };
  7079. const filterModelListeners = (attrs, props) => {
  7080. const res = {};
  7081. for (const key in attrs) {
  7082. if (!isModelListener(key) || !(key.slice(9) in props)) {
  7083. res[key] = attrs[key];
  7084. }
  7085. }
  7086. return res;
  7087. };
  7088. const isElementRoot = (vnode) => {
  7089. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  7090. };
  7091. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  7092. const { props: prevProps, children: prevChildren, component } = prevVNode;
  7093. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  7094. const emits = component.emitsOptions;
  7095. if ((prevChildren || nextChildren) && isHmrUpdating) {
  7096. return true;
  7097. }
  7098. if (nextVNode.dirs || nextVNode.transition) {
  7099. return true;
  7100. }
  7101. if (optimized && patchFlag >= 0) {
  7102. if (patchFlag & 1024) {
  7103. return true;
  7104. }
  7105. if (patchFlag & 16) {
  7106. if (!prevProps) {
  7107. return !!nextProps;
  7108. }
  7109. return hasPropsChanged(prevProps, nextProps, emits);
  7110. } else if (patchFlag & 8) {
  7111. const dynamicProps = nextVNode.dynamicProps;
  7112. for (let i = 0; i < dynamicProps.length; i++) {
  7113. const key = dynamicProps[i];
  7114. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
  7115. return true;
  7116. }
  7117. }
  7118. }
  7119. } else {
  7120. if (prevChildren || nextChildren) {
  7121. if (!nextChildren || !nextChildren.$stable) {
  7122. return true;
  7123. }
  7124. }
  7125. if (prevProps === nextProps) {
  7126. return false;
  7127. }
  7128. if (!prevProps) {
  7129. return !!nextProps;
  7130. }
  7131. if (!nextProps) {
  7132. return true;
  7133. }
  7134. return hasPropsChanged(prevProps, nextProps, emits);
  7135. }
  7136. return false;
  7137. }
  7138. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  7139. const nextKeys = Object.keys(nextProps);
  7140. if (nextKeys.length !== Object.keys(prevProps).length) {
  7141. return true;
  7142. }
  7143. for (let i = 0; i < nextKeys.length; i++) {
  7144. const key = nextKeys[i];
  7145. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
  7146. return true;
  7147. }
  7148. }
  7149. return false;
  7150. }
  7151. function hasPropValueChanged(nextProps, prevProps, key) {
  7152. const nextProp = nextProps[key];
  7153. const prevProp = prevProps[key];
  7154. if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
  7155. return !looseEqual(nextProp, prevProp);
  7156. }
  7157. return nextProp !== prevProp;
  7158. }
  7159. function updateHOCHostEl({ vnode, parent, suspense }, el) {
  7160. while (parent) {
  7161. const root = parent.subTree;
  7162. if (root.suspense && root.suspense.activeBranch === vnode) {
  7163. root.suspense.vnode.el = root.el = el;
  7164. vnode = root;
  7165. }
  7166. if (root === vnode) {
  7167. (vnode = parent.vnode).el = el;
  7168. parent = parent.parent;
  7169. } else {
  7170. break;
  7171. }
  7172. }
  7173. if (suspense && suspense.activeBranch === vnode) {
  7174. suspense.vnode.el = el;
  7175. }
  7176. }
  7177. const internalObjectProto = {};
  7178. const createInternalObject = () => Object.create(internalObjectProto);
  7179. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  7180. function initProps(instance, rawProps, isStateful, isSSR = false) {
  7181. const props = {};
  7182. const attrs = createInternalObject();
  7183. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  7184. setFullProps(instance, rawProps, props, attrs);
  7185. for (const key in instance.propsOptions[0]) {
  7186. if (!(key in props)) {
  7187. props[key] = void 0;
  7188. }
  7189. }
  7190. {
  7191. validateProps(rawProps || {}, props, instance);
  7192. }
  7193. if (isStateful) {
  7194. instance.props = isSSR ? props : shallowReactive(props);
  7195. } else {
  7196. if (!instance.type.props) {
  7197. instance.props = attrs;
  7198. } else {
  7199. instance.props = props;
  7200. }
  7201. }
  7202. instance.attrs = attrs;
  7203. }
  7204. function isInHmrContext(instance) {
  7205. while (instance) {
  7206. if (instance.type.__hmrId) return true;
  7207. instance = instance.parent;
  7208. }
  7209. }
  7210. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  7211. const {
  7212. props,
  7213. attrs,
  7214. vnode: { patchFlag }
  7215. } = instance;
  7216. const rawCurrentProps = toRaw(props);
  7217. const [options] = instance.propsOptions;
  7218. let hasAttrsChanged = false;
  7219. if (
  7220. // always force full diff in dev
  7221. // - #1942 if hmr is enabled with sfc component
  7222. // - vite#872 non-sfc component used by sfc component
  7223. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  7224. ) {
  7225. if (patchFlag & 8) {
  7226. const propsToUpdate = instance.vnode.dynamicProps;
  7227. for (let i = 0; i < propsToUpdate.length; i++) {
  7228. let key = propsToUpdate[i];
  7229. if (isEmitListener(instance.emitsOptions, key)) {
  7230. continue;
  7231. }
  7232. const value = rawProps[key];
  7233. if (options) {
  7234. if (hasOwn(attrs, key)) {
  7235. if (value !== attrs[key]) {
  7236. attrs[key] = value;
  7237. hasAttrsChanged = true;
  7238. }
  7239. } else {
  7240. const camelizedKey = camelize(key);
  7241. props[camelizedKey] = resolvePropValue(
  7242. options,
  7243. rawCurrentProps,
  7244. camelizedKey,
  7245. value,
  7246. instance,
  7247. false
  7248. );
  7249. }
  7250. } else {
  7251. if (value !== attrs[key]) {
  7252. attrs[key] = value;
  7253. hasAttrsChanged = true;
  7254. }
  7255. }
  7256. }
  7257. }
  7258. } else {
  7259. if (setFullProps(instance, rawProps, props, attrs)) {
  7260. hasAttrsChanged = true;
  7261. }
  7262. let kebabKey;
  7263. for (const key in rawCurrentProps) {
  7264. if (!rawProps || // for camelCase
  7265. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  7266. // and converted to camelCase (#955)
  7267. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  7268. if (options) {
  7269. if (rawPrevProps && // for camelCase
  7270. (rawPrevProps[key] !== void 0 || // for kebab-case
  7271. rawPrevProps[kebabKey] !== void 0)) {
  7272. props[key] = resolvePropValue(
  7273. options,
  7274. rawCurrentProps,
  7275. key,
  7276. void 0,
  7277. instance,
  7278. true
  7279. );
  7280. }
  7281. } else {
  7282. delete props[key];
  7283. }
  7284. }
  7285. }
  7286. if (attrs !== rawCurrentProps) {
  7287. for (const key in attrs) {
  7288. if (!rawProps || !hasOwn(rawProps, key) && true) {
  7289. delete attrs[key];
  7290. hasAttrsChanged = true;
  7291. }
  7292. }
  7293. }
  7294. }
  7295. if (hasAttrsChanged) {
  7296. trigger(instance.attrs, "set", "");
  7297. }
  7298. {
  7299. validateProps(rawProps || {}, props, instance);
  7300. }
  7301. }
  7302. function setFullProps(instance, rawProps, props, attrs) {
  7303. const [options, needCastKeys] = instance.propsOptions;
  7304. let hasAttrsChanged = false;
  7305. let rawCastValues;
  7306. if (rawProps) {
  7307. for (let key in rawProps) {
  7308. if (isReservedProp(key)) {
  7309. continue;
  7310. }
  7311. const value = rawProps[key];
  7312. let camelKey;
  7313. if (options && hasOwn(options, camelKey = camelize(key))) {
  7314. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  7315. props[camelKey] = value;
  7316. } else {
  7317. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  7318. }
  7319. } else if (!isEmitListener(instance.emitsOptions, key)) {
  7320. if (!(key in attrs) || value !== attrs[key]) {
  7321. attrs[key] = value;
  7322. hasAttrsChanged = true;
  7323. }
  7324. }
  7325. }
  7326. }
  7327. if (needCastKeys) {
  7328. const rawCurrentProps = toRaw(props);
  7329. const castValues = rawCastValues || EMPTY_OBJ;
  7330. for (let i = 0; i < needCastKeys.length; i++) {
  7331. const key = needCastKeys[i];
  7332. props[key] = resolvePropValue(
  7333. options,
  7334. rawCurrentProps,
  7335. key,
  7336. castValues[key],
  7337. instance,
  7338. !hasOwn(castValues, key)
  7339. );
  7340. }
  7341. }
  7342. return hasAttrsChanged;
  7343. }
  7344. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  7345. const opt = options[key];
  7346. if (opt != null) {
  7347. const hasDefault = hasOwn(opt, "default");
  7348. if (hasDefault && value === void 0) {
  7349. const defaultValue = opt.default;
  7350. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  7351. const { propsDefaults } = instance;
  7352. if (key in propsDefaults) {
  7353. value = propsDefaults[key];
  7354. } else {
  7355. const reset = setCurrentInstance(instance);
  7356. value = propsDefaults[key] = defaultValue.call(
  7357. null,
  7358. props
  7359. );
  7360. reset();
  7361. }
  7362. } else {
  7363. value = defaultValue;
  7364. }
  7365. if (instance.ce) {
  7366. instance.ce._setProp(key, value);
  7367. }
  7368. }
  7369. if (opt[0 /* shouldCast */]) {
  7370. if (isAbsent && !hasDefault) {
  7371. value = false;
  7372. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  7373. value = true;
  7374. }
  7375. }
  7376. }
  7377. return value;
  7378. }
  7379. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  7380. function normalizePropsOptions(comp, appContext, asMixin = false) {
  7381. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  7382. const cached = cache.get(comp);
  7383. if (cached) {
  7384. return cached;
  7385. }
  7386. const raw = comp.props;
  7387. const normalized = {};
  7388. const needCastKeys = [];
  7389. let hasExtends = false;
  7390. if (!isFunction(comp)) {
  7391. const extendProps = (raw2) => {
  7392. hasExtends = true;
  7393. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  7394. extend(normalized, props);
  7395. if (keys) needCastKeys.push(...keys);
  7396. };
  7397. if (!asMixin && appContext.mixins.length) {
  7398. appContext.mixins.forEach(extendProps);
  7399. }
  7400. if (comp.extends) {
  7401. extendProps(comp.extends);
  7402. }
  7403. if (comp.mixins) {
  7404. comp.mixins.forEach(extendProps);
  7405. }
  7406. }
  7407. if (!raw && !hasExtends) {
  7408. if (isObject(comp)) {
  7409. cache.set(comp, EMPTY_ARR);
  7410. }
  7411. return EMPTY_ARR;
  7412. }
  7413. if (isArray(raw)) {
  7414. for (let i = 0; i < raw.length; i++) {
  7415. if (!isString(raw[i])) {
  7416. warn$1(`props must be strings when using array syntax.`, raw[i]);
  7417. }
  7418. const normalizedKey = camelize(raw[i]);
  7419. if (validatePropName(normalizedKey)) {
  7420. normalized[normalizedKey] = EMPTY_OBJ;
  7421. }
  7422. }
  7423. } else if (raw) {
  7424. if (!isObject(raw)) {
  7425. warn$1(`invalid props options`, raw);
  7426. }
  7427. for (const key in raw) {
  7428. const normalizedKey = camelize(key);
  7429. if (validatePropName(normalizedKey)) {
  7430. const opt = raw[key];
  7431. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  7432. const propType = prop.type;
  7433. let shouldCast = false;
  7434. let shouldCastTrue = true;
  7435. if (isArray(propType)) {
  7436. for (let index = 0; index < propType.length; ++index) {
  7437. const type = propType[index];
  7438. const typeName = isFunction(type) && type.name;
  7439. if (typeName === "Boolean") {
  7440. shouldCast = true;
  7441. break;
  7442. } else if (typeName === "String") {
  7443. shouldCastTrue = false;
  7444. }
  7445. }
  7446. } else {
  7447. shouldCast = isFunction(propType) && propType.name === "Boolean";
  7448. }
  7449. prop[0 /* shouldCast */] = shouldCast;
  7450. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  7451. if (shouldCast || hasOwn(prop, "default")) {
  7452. needCastKeys.push(normalizedKey);
  7453. }
  7454. }
  7455. }
  7456. }
  7457. const res = [normalized, needCastKeys];
  7458. if (isObject(comp)) {
  7459. cache.set(comp, res);
  7460. }
  7461. return res;
  7462. }
  7463. function validatePropName(key) {
  7464. if (key[0] !== "$" && !isReservedProp(key)) {
  7465. return true;
  7466. } else {
  7467. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  7468. }
  7469. return false;
  7470. }
  7471. function getType(ctor) {
  7472. if (ctor === null) {
  7473. return "null";
  7474. }
  7475. if (typeof ctor === "function") {
  7476. return ctor.name || "";
  7477. } else if (typeof ctor === "object") {
  7478. const name = ctor.constructor && ctor.constructor.name;
  7479. return name || "";
  7480. }
  7481. return "";
  7482. }
  7483. function validateProps(rawProps, props, instance) {
  7484. const resolvedValues = toRaw(props);
  7485. const options = instance.propsOptions[0];
  7486. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  7487. for (const key in options) {
  7488. let opt = options[key];
  7489. if (opt == null) continue;
  7490. validateProp(
  7491. key,
  7492. resolvedValues[key],
  7493. opt,
  7494. shallowReadonly(resolvedValues) ,
  7495. !camelizePropsKey.includes(key)
  7496. );
  7497. }
  7498. }
  7499. function validateProp(name, value, prop, props, isAbsent) {
  7500. const { type, required, validator, skipCheck } = prop;
  7501. if (required && isAbsent) {
  7502. warn$1('Missing required prop: "' + name + '"');
  7503. return;
  7504. }
  7505. if (value == null && !required) {
  7506. return;
  7507. }
  7508. if (type != null && type !== true && !skipCheck) {
  7509. let isValid = false;
  7510. const types = isArray(type) ? type : [type];
  7511. const expectedTypes = [];
  7512. for (let i = 0; i < types.length && !isValid; i++) {
  7513. const { valid, expectedType } = assertType(value, types[i]);
  7514. expectedTypes.push(expectedType || "");
  7515. isValid = valid;
  7516. }
  7517. if (!isValid) {
  7518. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  7519. return;
  7520. }
  7521. }
  7522. if (validator && !validator(value, props)) {
  7523. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  7524. }
  7525. }
  7526. const isSimpleType = /* @__PURE__ */ makeMap(
  7527. "String,Number,Boolean,Function,Symbol,BigInt"
  7528. );
  7529. function assertType(value, type) {
  7530. let valid;
  7531. const expectedType = getType(type);
  7532. if (expectedType === "null") {
  7533. valid = value === null;
  7534. } else if (isSimpleType(expectedType)) {
  7535. const t = typeof value;
  7536. valid = t === expectedType.toLowerCase();
  7537. if (!valid && t === "object") {
  7538. valid = value instanceof type;
  7539. }
  7540. } else if (expectedType === "Object") {
  7541. valid = isObject(value);
  7542. } else if (expectedType === "Array") {
  7543. valid = isArray(value);
  7544. } else {
  7545. valid = value instanceof type;
  7546. }
  7547. return {
  7548. valid,
  7549. expectedType
  7550. };
  7551. }
  7552. function getInvalidTypeMessage(name, value, expectedTypes) {
  7553. if (expectedTypes.length === 0) {
  7554. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  7555. }
  7556. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  7557. const expectedType = expectedTypes[0];
  7558. const receivedType = toRawType(value);
  7559. const expectedValue = styleValue(value, expectedType);
  7560. const receivedValue = styleValue(value, receivedType);
  7561. if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
  7562. message += ` with value ${expectedValue}`;
  7563. }
  7564. message += `, got ${receivedType} `;
  7565. if (isExplicable(receivedType)) {
  7566. message += `with value ${receivedValue}.`;
  7567. }
  7568. return message;
  7569. }
  7570. function styleValue(value, type) {
  7571. if (isSymbol(value)) {
  7572. return value.toString();
  7573. } else if (type === "String") {
  7574. return `"${value}"`;
  7575. } else if (type === "Number") {
  7576. return `${Number(value)}`;
  7577. } else {
  7578. return `${value}`;
  7579. }
  7580. }
  7581. function isExplicable(type) {
  7582. const explicitTypes = ["string", "number", "boolean"];
  7583. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  7584. }
  7585. function isCoercible(...args) {
  7586. return args.every((elem) => {
  7587. const value = elem.toLowerCase();
  7588. return value !== "boolean" && value !== "symbol";
  7589. });
  7590. }
  7591. const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
  7592. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  7593. const normalizeSlot = (key, rawSlot, ctx) => {
  7594. if (rawSlot._n) {
  7595. return rawSlot;
  7596. }
  7597. const normalized = withCtx((...args) => {
  7598. if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
  7599. warn$1(
  7600. `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.`
  7601. );
  7602. }
  7603. return normalizeSlotValue(rawSlot(...args));
  7604. }, ctx);
  7605. normalized._c = false;
  7606. return normalized;
  7607. };
  7608. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  7609. const ctx = rawSlots._ctx;
  7610. for (const key in rawSlots) {
  7611. if (isInternalKey(key)) continue;
  7612. const value = rawSlots[key];
  7613. if (isFunction(value)) {
  7614. slots[key] = normalizeSlot(key, value, ctx);
  7615. } else if (value != null) {
  7616. {
  7617. warn$1(
  7618. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  7619. );
  7620. }
  7621. const normalized = normalizeSlotValue(value);
  7622. slots[key] = () => normalized;
  7623. }
  7624. }
  7625. };
  7626. const normalizeVNodeSlots = (instance, children) => {
  7627. if (!isKeepAlive(instance.vnode) && true) {
  7628. warn$1(
  7629. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  7630. );
  7631. }
  7632. const normalized = normalizeSlotValue(children);
  7633. instance.slots.default = () => normalized;
  7634. };
  7635. const assignSlots = (slots, children, optimized) => {
  7636. for (const key in children) {
  7637. if (optimized || !isInternalKey(key)) {
  7638. slots[key] = children[key];
  7639. }
  7640. }
  7641. };
  7642. const initSlots = (instance, children, optimized) => {
  7643. const slots = instance.slots = createInternalObject();
  7644. if (instance.vnode.shapeFlag & 32) {
  7645. const type = children._;
  7646. if (type) {
  7647. assignSlots(slots, children, optimized);
  7648. if (optimized) {
  7649. def(slots, "_", type, true);
  7650. }
  7651. } else {
  7652. normalizeObjectSlots(children, slots);
  7653. }
  7654. } else if (children) {
  7655. normalizeVNodeSlots(instance, children);
  7656. }
  7657. };
  7658. const updateSlots = (instance, children, optimized) => {
  7659. const { vnode, slots } = instance;
  7660. let needDeletionCheck = true;
  7661. let deletionComparisonTarget = EMPTY_OBJ;
  7662. if (vnode.shapeFlag & 32) {
  7663. const type = children._;
  7664. if (type) {
  7665. if (isHmrUpdating) {
  7666. assignSlots(slots, children, optimized);
  7667. trigger(instance, "set", "$slots");
  7668. } else if (optimized && type === 1) {
  7669. needDeletionCheck = false;
  7670. } else {
  7671. assignSlots(slots, children, optimized);
  7672. }
  7673. } else {
  7674. needDeletionCheck = !children.$stable;
  7675. normalizeObjectSlots(children, slots);
  7676. }
  7677. deletionComparisonTarget = children;
  7678. } else if (children) {
  7679. normalizeVNodeSlots(instance, children);
  7680. deletionComparisonTarget = { default: 1 };
  7681. }
  7682. if (needDeletionCheck) {
  7683. for (const key in slots) {
  7684. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  7685. delete slots[key];
  7686. }
  7687. }
  7688. }
  7689. };
  7690. let supported;
  7691. let perf;
  7692. function startMeasure(instance, type) {
  7693. if (instance.appContext.config.performance && isSupported()) {
  7694. perf.mark(`vue-${type}-${instance.uid}`);
  7695. }
  7696. {
  7697. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  7698. }
  7699. }
  7700. function endMeasure(instance, type) {
  7701. if (instance.appContext.config.performance && isSupported()) {
  7702. const startTag = `vue-${type}-${instance.uid}`;
  7703. const endTag = startTag + `:end`;
  7704. const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
  7705. perf.mark(endTag);
  7706. perf.measure(measureName, startTag, endTag);
  7707. perf.clearMeasures(measureName);
  7708. perf.clearMarks(startTag);
  7709. perf.clearMarks(endTag);
  7710. }
  7711. {
  7712. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  7713. }
  7714. }
  7715. function isSupported() {
  7716. if (supported !== void 0) {
  7717. return supported;
  7718. }
  7719. if (typeof window !== "undefined" && window.performance) {
  7720. supported = true;
  7721. perf = window.performance;
  7722. } else {
  7723. supported = false;
  7724. }
  7725. return supported;
  7726. }
  7727. const queuePostRenderEffect = queueEffectWithSuspense ;
  7728. function createRenderer(options) {
  7729. return baseCreateRenderer(options);
  7730. }
  7731. function createHydrationRenderer(options) {
  7732. return baseCreateRenderer(options, createHydrationFunctions);
  7733. }
  7734. function baseCreateRenderer(options, createHydrationFns) {
  7735. const target = getGlobalThis();
  7736. target.__VUE__ = true;
  7737. {
  7738. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  7739. }
  7740. const {
  7741. insert: hostInsert,
  7742. remove: hostRemove,
  7743. patchProp: hostPatchProp,
  7744. createElement: hostCreateElement,
  7745. createText: hostCreateText,
  7746. createComment: hostCreateComment,
  7747. setText: hostSetText,
  7748. setElementText: hostSetElementText,
  7749. parentNode: hostParentNode,
  7750. nextSibling: hostNextSibling,
  7751. setScopeId: hostSetScopeId = NOOP,
  7752. insertStaticContent: hostInsertStaticContent
  7753. } = options;
  7754. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  7755. if (n1 === n2) {
  7756. return;
  7757. }
  7758. if (n1 && !isSameVNodeType(n1, n2)) {
  7759. anchor = getNextHostNode(n1);
  7760. unmount(n1, parentComponent, parentSuspense, true);
  7761. n1 = null;
  7762. }
  7763. if (n2.patchFlag === -2) {
  7764. optimized = false;
  7765. n2.dynamicChildren = null;
  7766. }
  7767. const { type, ref, shapeFlag } = n2;
  7768. switch (type) {
  7769. case Text:
  7770. processText(n1, n2, container, anchor);
  7771. break;
  7772. case Comment:
  7773. processCommentNode(n1, n2, container, anchor);
  7774. break;
  7775. case Static:
  7776. if (n1 == null) {
  7777. mountStaticNode(n2, container, anchor, namespace);
  7778. } else {
  7779. patchStaticNode(n1, n2, container, namespace);
  7780. }
  7781. break;
  7782. case Fragment:
  7783. processFragment(
  7784. n1,
  7785. n2,
  7786. container,
  7787. anchor,
  7788. parentComponent,
  7789. parentSuspense,
  7790. namespace,
  7791. slotScopeIds,
  7792. optimized
  7793. );
  7794. break;
  7795. default:
  7796. if (shapeFlag & 1) {
  7797. processElement(
  7798. n1,
  7799. n2,
  7800. container,
  7801. anchor,
  7802. parentComponent,
  7803. parentSuspense,
  7804. namespace,
  7805. slotScopeIds,
  7806. optimized
  7807. );
  7808. } else if (shapeFlag & 6) {
  7809. processComponent(
  7810. n1,
  7811. n2,
  7812. container,
  7813. anchor,
  7814. parentComponent,
  7815. parentSuspense,
  7816. namespace,
  7817. slotScopeIds,
  7818. optimized
  7819. );
  7820. } else if (shapeFlag & 64) {
  7821. type.process(
  7822. n1,
  7823. n2,
  7824. container,
  7825. anchor,
  7826. parentComponent,
  7827. parentSuspense,
  7828. namespace,
  7829. slotScopeIds,
  7830. optimized,
  7831. internals
  7832. );
  7833. } else if (shapeFlag & 128) {
  7834. type.process(
  7835. n1,
  7836. n2,
  7837. container,
  7838. anchor,
  7839. parentComponent,
  7840. parentSuspense,
  7841. namespace,
  7842. slotScopeIds,
  7843. optimized,
  7844. internals
  7845. );
  7846. } else {
  7847. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  7848. }
  7849. }
  7850. if (ref != null && parentComponent) {
  7851. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  7852. } else if (ref == null && n1 && n1.ref != null) {
  7853. setRef(n1.ref, null, parentSuspense, n1, true);
  7854. }
  7855. };
  7856. const processText = (n1, n2, container, anchor) => {
  7857. if (n1 == null) {
  7858. hostInsert(
  7859. n2.el = hostCreateText(n2.children),
  7860. container,
  7861. anchor
  7862. );
  7863. } else {
  7864. const el = n2.el = n1.el;
  7865. if (n2.children !== n1.children) {
  7866. hostSetText(el, n2.children);
  7867. }
  7868. }
  7869. };
  7870. const processCommentNode = (n1, n2, container, anchor) => {
  7871. if (n1 == null) {
  7872. hostInsert(
  7873. n2.el = hostCreateComment(n2.children || ""),
  7874. container,
  7875. anchor
  7876. );
  7877. } else {
  7878. n2.el = n1.el;
  7879. }
  7880. };
  7881. const mountStaticNode = (n2, container, anchor, namespace) => {
  7882. [n2.el, n2.anchor] = hostInsertStaticContent(
  7883. n2.children,
  7884. container,
  7885. anchor,
  7886. namespace,
  7887. n2.el,
  7888. n2.anchor
  7889. );
  7890. };
  7891. const patchStaticNode = (n1, n2, container, namespace) => {
  7892. if (n2.children !== n1.children) {
  7893. const anchor = hostNextSibling(n1.anchor);
  7894. removeStaticNode(n1);
  7895. [n2.el, n2.anchor] = hostInsertStaticContent(
  7896. n2.children,
  7897. container,
  7898. anchor,
  7899. namespace
  7900. );
  7901. } else {
  7902. n2.el = n1.el;
  7903. n2.anchor = n1.anchor;
  7904. }
  7905. };
  7906. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  7907. let next;
  7908. while (el && el !== anchor) {
  7909. next = hostNextSibling(el);
  7910. hostInsert(el, container, nextSibling);
  7911. el = next;
  7912. }
  7913. hostInsert(anchor, container, nextSibling);
  7914. };
  7915. const removeStaticNode = ({ el, anchor }) => {
  7916. let next;
  7917. while (el && el !== anchor) {
  7918. next = hostNextSibling(el);
  7919. hostRemove(el);
  7920. el = next;
  7921. }
  7922. hostRemove(anchor);
  7923. };
  7924. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7925. if (n2.type === "svg") {
  7926. namespace = "svg";
  7927. } else if (n2.type === "math") {
  7928. namespace = "mathml";
  7929. }
  7930. if (n1 == null) {
  7931. mountElement(
  7932. n2,
  7933. container,
  7934. anchor,
  7935. parentComponent,
  7936. parentSuspense,
  7937. namespace,
  7938. slotScopeIds,
  7939. optimized
  7940. );
  7941. } else {
  7942. const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
  7943. try {
  7944. if (customElement) {
  7945. customElement._beginPatch();
  7946. }
  7947. patchElement(
  7948. n1,
  7949. n2,
  7950. parentComponent,
  7951. parentSuspense,
  7952. namespace,
  7953. slotScopeIds,
  7954. optimized
  7955. );
  7956. } finally {
  7957. if (customElement) {
  7958. customElement._endPatch();
  7959. }
  7960. }
  7961. }
  7962. };
  7963. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7964. let el;
  7965. let vnodeHook;
  7966. const { props, shapeFlag, transition, dirs } = vnode;
  7967. el = vnode.el = hostCreateElement(
  7968. vnode.type,
  7969. namespace,
  7970. props && props.is,
  7971. props
  7972. );
  7973. if (shapeFlag & 8) {
  7974. hostSetElementText(el, vnode.children);
  7975. } else if (shapeFlag & 16) {
  7976. mountChildren(
  7977. vnode.children,
  7978. el,
  7979. null,
  7980. parentComponent,
  7981. parentSuspense,
  7982. resolveChildrenNamespace(vnode, namespace),
  7983. slotScopeIds,
  7984. optimized
  7985. );
  7986. }
  7987. if (dirs) {
  7988. invokeDirectiveHook(vnode, null, parentComponent, "created");
  7989. }
  7990. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  7991. if (props) {
  7992. for (const key in props) {
  7993. if (key !== "value" && !isReservedProp(key)) {
  7994. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  7995. }
  7996. }
  7997. if ("value" in props) {
  7998. hostPatchProp(el, "value", null, props.value, namespace);
  7999. }
  8000. if (vnodeHook = props.onVnodeBeforeMount) {
  8001. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8002. }
  8003. }
  8004. {
  8005. def(el, "__vnode", vnode, true);
  8006. def(el, "__vueParentComponent", parentComponent, true);
  8007. }
  8008. if (dirs) {
  8009. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  8010. }
  8011. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  8012. if (needCallTransitionHooks) {
  8013. transition.beforeEnter(el);
  8014. }
  8015. hostInsert(el, container, anchor);
  8016. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  8017. const isHmr = isHmrUpdating;
  8018. queuePostRenderEffect(() => {
  8019. let prev;
  8020. prev = setHmrUpdating(isHmr);
  8021. try {
  8022. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8023. needCallTransitionHooks && transition.enter(el);
  8024. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  8025. } finally {
  8026. setHmrUpdating(prev);
  8027. }
  8028. }, parentSuspense);
  8029. }
  8030. };
  8031. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  8032. if (scopeId) {
  8033. hostSetScopeId(el, scopeId);
  8034. }
  8035. if (slotScopeIds) {
  8036. for (let i = 0; i < slotScopeIds.length; i++) {
  8037. hostSetScopeId(el, slotScopeIds[i]);
  8038. }
  8039. }
  8040. if (parentComponent) {
  8041. let subTree = parentComponent.subTree;
  8042. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  8043. subTree = filterSingleRoot(subTree.children) || subTree;
  8044. }
  8045. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  8046. const parentVNode = parentComponent.vnode;
  8047. setScopeId(
  8048. el,
  8049. parentVNode,
  8050. parentVNode.scopeId,
  8051. parentVNode.slotScopeIds,
  8052. parentComponent.parent
  8053. );
  8054. }
  8055. }
  8056. };
  8057. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  8058. for (let i = start; i < children.length; i++) {
  8059. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  8060. patch(
  8061. null,
  8062. child,
  8063. container,
  8064. anchor,
  8065. parentComponent,
  8066. parentSuspense,
  8067. namespace,
  8068. slotScopeIds,
  8069. optimized
  8070. );
  8071. }
  8072. };
  8073. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8074. const el = n2.el = n1.el;
  8075. {
  8076. el.__vnode = n2;
  8077. }
  8078. let { patchFlag, dynamicChildren, dirs } = n2;
  8079. patchFlag |= n1.patchFlag & 16;
  8080. const oldProps = n1.props || EMPTY_OBJ;
  8081. const newProps = n2.props || EMPTY_OBJ;
  8082. let vnodeHook;
  8083. parentComponent && toggleRecurse(parentComponent, false);
  8084. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  8085. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  8086. }
  8087. if (dirs) {
  8088. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  8089. }
  8090. parentComponent && toggleRecurse(parentComponent, true);
  8091. if (
  8092. // HMR updated, force full diff
  8093. isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
  8094. // Force full diff when block metadata is unstable.
  8095. dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
  8096. ) {
  8097. patchFlag = 0;
  8098. optimized = false;
  8099. dynamicChildren = null;
  8100. }
  8101. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  8102. hostSetElementText(el, "");
  8103. }
  8104. if (dynamicChildren) {
  8105. patchBlockChildren(
  8106. n1.dynamicChildren,
  8107. dynamicChildren,
  8108. el,
  8109. parentComponent,
  8110. parentSuspense,
  8111. resolveChildrenNamespace(n2, namespace),
  8112. slotScopeIds
  8113. );
  8114. {
  8115. traverseStaticChildren(n1, n2);
  8116. }
  8117. } else if (!optimized) {
  8118. patchChildren(
  8119. n1,
  8120. n2,
  8121. el,
  8122. null,
  8123. parentComponent,
  8124. parentSuspense,
  8125. resolveChildrenNamespace(n2, namespace),
  8126. slotScopeIds,
  8127. false
  8128. );
  8129. }
  8130. if (patchFlag > 0) {
  8131. if (patchFlag & 16) {
  8132. patchProps(el, oldProps, newProps, parentComponent, namespace);
  8133. } else {
  8134. if (patchFlag & 2) {
  8135. if (oldProps.class !== newProps.class) {
  8136. hostPatchProp(el, "class", null, newProps.class, namespace);
  8137. }
  8138. }
  8139. if (patchFlag & 4) {
  8140. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  8141. }
  8142. if (patchFlag & 8) {
  8143. const propsToUpdate = n2.dynamicProps;
  8144. for (let i = 0; i < propsToUpdate.length; i++) {
  8145. const key = propsToUpdate[i];
  8146. const prev = oldProps[key];
  8147. const next = newProps[key];
  8148. if (next !== prev || key === "value") {
  8149. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  8150. }
  8151. }
  8152. }
  8153. }
  8154. if (patchFlag & 1) {
  8155. if (n1.children !== n2.children) {
  8156. hostSetElementText(el, n2.children);
  8157. }
  8158. }
  8159. } else if (!optimized && dynamicChildren == null) {
  8160. patchProps(el, oldProps, newProps, parentComponent, namespace);
  8161. }
  8162. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  8163. queuePostRenderEffect(() => {
  8164. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  8165. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  8166. }, parentSuspense);
  8167. }
  8168. };
  8169. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  8170. for (let i = 0; i < newChildren.length; i++) {
  8171. const oldVNode = oldChildren[i];
  8172. const newVNode = newChildren[i];
  8173. const container = (
  8174. // oldVNode may be an errored async setup() component inside Suspense
  8175. // which will not have a mounted element
  8176. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  8177. // of the Fragment itself so it can move its children.
  8178. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  8179. // which also requires the correct parent container
  8180. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  8181. oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
  8182. // In other cases, the parent container is not actually used so we
  8183. // just pass the block element here to avoid a DOM parentNode call.
  8184. fallbackContainer
  8185. )
  8186. );
  8187. patch(
  8188. oldVNode,
  8189. newVNode,
  8190. container,
  8191. null,
  8192. parentComponent,
  8193. parentSuspense,
  8194. namespace,
  8195. slotScopeIds,
  8196. true
  8197. );
  8198. }
  8199. };
  8200. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  8201. if (oldProps !== newProps) {
  8202. if (oldProps !== EMPTY_OBJ) {
  8203. for (const key in oldProps) {
  8204. if (!isReservedProp(key) && !(key in newProps)) {
  8205. hostPatchProp(
  8206. el,
  8207. key,
  8208. oldProps[key],
  8209. null,
  8210. namespace,
  8211. parentComponent
  8212. );
  8213. }
  8214. }
  8215. }
  8216. for (const key in newProps) {
  8217. if (isReservedProp(key)) continue;
  8218. const next = newProps[key];
  8219. const prev = oldProps[key];
  8220. if (next !== prev && key !== "value") {
  8221. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  8222. }
  8223. }
  8224. if ("value" in newProps) {
  8225. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  8226. }
  8227. }
  8228. };
  8229. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8230. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  8231. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  8232. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  8233. if (
  8234. // #5523 dev root fragment may inherit directives
  8235. isHmrUpdating || patchFlag & 2048
  8236. ) {
  8237. patchFlag = 0;
  8238. optimized = false;
  8239. dynamicChildren = null;
  8240. }
  8241. if (fragmentSlotScopeIds) {
  8242. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  8243. }
  8244. if (n1 == null) {
  8245. hostInsert(fragmentStartAnchor, container, anchor);
  8246. hostInsert(fragmentEndAnchor, container, anchor);
  8247. mountChildren(
  8248. // #10007
  8249. // such fragment like `<></>` will be compiled into
  8250. // a fragment which doesn't have a children.
  8251. // In this case fallback to an empty array
  8252. n2.children || [],
  8253. container,
  8254. fragmentEndAnchor,
  8255. parentComponent,
  8256. parentSuspense,
  8257. namespace,
  8258. slotScopeIds,
  8259. optimized
  8260. );
  8261. } else {
  8262. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  8263. // of renderSlot() with no valid children
  8264. n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
  8265. patchBlockChildren(
  8266. n1.dynamicChildren,
  8267. dynamicChildren,
  8268. container,
  8269. parentComponent,
  8270. parentSuspense,
  8271. namespace,
  8272. slotScopeIds
  8273. );
  8274. {
  8275. traverseStaticChildren(n1, n2);
  8276. }
  8277. } else {
  8278. patchChildren(
  8279. n1,
  8280. n2,
  8281. container,
  8282. fragmentEndAnchor,
  8283. parentComponent,
  8284. parentSuspense,
  8285. namespace,
  8286. slotScopeIds,
  8287. optimized
  8288. );
  8289. }
  8290. }
  8291. };
  8292. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8293. n2.slotScopeIds = slotScopeIds;
  8294. if (n1 == null) {
  8295. if (n2.shapeFlag & 512) {
  8296. parentComponent.ctx.activate(
  8297. n2,
  8298. container,
  8299. anchor,
  8300. namespace,
  8301. optimized
  8302. );
  8303. } else {
  8304. mountComponent(
  8305. n2,
  8306. container,
  8307. anchor,
  8308. parentComponent,
  8309. parentSuspense,
  8310. namespace,
  8311. optimized
  8312. );
  8313. }
  8314. } else {
  8315. updateComponent(n1, n2, optimized);
  8316. }
  8317. };
  8318. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  8319. const instance = (initialVNode.component = createComponentInstance(
  8320. initialVNode,
  8321. parentComponent,
  8322. parentSuspense
  8323. ));
  8324. if (instance.type.__hmrId) {
  8325. registerHMR(instance);
  8326. }
  8327. {
  8328. pushWarningContext(initialVNode);
  8329. startMeasure(instance, `mount`);
  8330. }
  8331. if (isKeepAlive(initialVNode)) {
  8332. instance.ctx.renderer = internals;
  8333. }
  8334. {
  8335. {
  8336. startMeasure(instance, `init`);
  8337. }
  8338. setupComponent(instance, false, optimized);
  8339. {
  8340. endMeasure(instance, `init`);
  8341. }
  8342. }
  8343. if (isHmrUpdating) initialVNode.el = null;
  8344. if (instance.asyncDep) {
  8345. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  8346. if (!initialVNode.el) {
  8347. const placeholder = instance.subTree = createVNode(Comment);
  8348. processCommentNode(null, placeholder, container, anchor);
  8349. initialVNode.placeholder = placeholder.el;
  8350. }
  8351. } else {
  8352. setupRenderEffect(
  8353. instance,
  8354. initialVNode,
  8355. container,
  8356. anchor,
  8357. parentSuspense,
  8358. namespace,
  8359. optimized
  8360. );
  8361. }
  8362. {
  8363. popWarningContext();
  8364. endMeasure(instance, `mount`);
  8365. }
  8366. };
  8367. const updateComponent = (n1, n2, optimized) => {
  8368. const instance = n2.component = n1.component;
  8369. if (shouldUpdateComponent(n1, n2, optimized)) {
  8370. if (instance.asyncDep && !instance.asyncResolved) {
  8371. {
  8372. pushWarningContext(n2);
  8373. }
  8374. updateComponentPreRender(instance, n2, optimized);
  8375. {
  8376. popWarningContext();
  8377. }
  8378. return;
  8379. } else {
  8380. instance.next = n2;
  8381. instance.update();
  8382. }
  8383. } else {
  8384. n2.el = n1.el;
  8385. instance.vnode = n2;
  8386. }
  8387. };
  8388. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  8389. const componentUpdateFn = () => {
  8390. if (!instance.isMounted) {
  8391. let vnodeHook;
  8392. const { el, props } = initialVNode;
  8393. const { bm, m, parent, root, type } = instance;
  8394. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  8395. toggleRecurse(instance, false);
  8396. if (bm) {
  8397. invokeArrayFns(bm);
  8398. }
  8399. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  8400. invokeVNodeHook(vnodeHook, parent, initialVNode);
  8401. }
  8402. toggleRecurse(instance, true);
  8403. if (el && hydrateNode) {
  8404. const hydrateSubTree = () => {
  8405. {
  8406. startMeasure(instance, `render`);
  8407. }
  8408. instance.subTree = renderComponentRoot(instance);
  8409. {
  8410. endMeasure(instance, `render`);
  8411. }
  8412. {
  8413. startMeasure(instance, `hydrate`);
  8414. }
  8415. hydrateNode(
  8416. el,
  8417. instance.subTree,
  8418. instance,
  8419. parentSuspense,
  8420. null
  8421. );
  8422. {
  8423. endMeasure(instance, `hydrate`);
  8424. }
  8425. };
  8426. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  8427. type.__asyncHydrate(
  8428. el,
  8429. instance,
  8430. hydrateSubTree
  8431. );
  8432. } else {
  8433. hydrateSubTree();
  8434. }
  8435. } else {
  8436. if (root.ce && root.ce._hasShadowRoot()) {
  8437. root.ce._injectChildStyle(
  8438. type,
  8439. instance.parent ? instance.parent.type : void 0
  8440. );
  8441. }
  8442. {
  8443. startMeasure(instance, `render`);
  8444. }
  8445. const subTree = instance.subTree = renderComponentRoot(instance);
  8446. {
  8447. endMeasure(instance, `render`);
  8448. }
  8449. {
  8450. startMeasure(instance, `patch`);
  8451. }
  8452. patch(
  8453. null,
  8454. subTree,
  8455. container,
  8456. anchor,
  8457. instance,
  8458. parentSuspense,
  8459. namespace
  8460. );
  8461. {
  8462. endMeasure(instance, `patch`);
  8463. }
  8464. initialVNode.el = subTree.el;
  8465. }
  8466. if (m) {
  8467. queuePostRenderEffect(m, parentSuspense);
  8468. }
  8469. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  8470. const scopedInitialVNode = initialVNode;
  8471. queuePostRenderEffect(
  8472. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  8473. parentSuspense
  8474. );
  8475. }
  8476. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  8477. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  8478. }
  8479. instance.isMounted = true;
  8480. {
  8481. devtoolsComponentAdded(instance);
  8482. }
  8483. initialVNode = container = anchor = null;
  8484. } else {
  8485. let { next, bu, u, parent, vnode } = instance;
  8486. {
  8487. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  8488. if (nonHydratedAsyncRoot) {
  8489. if (next) {
  8490. next.el = vnode.el;
  8491. updateComponentPreRender(instance, next, optimized);
  8492. }
  8493. nonHydratedAsyncRoot.asyncDep.then(() => {
  8494. queuePostRenderEffect(() => {
  8495. if (!instance.isUnmounted) update();
  8496. }, parentSuspense);
  8497. });
  8498. return;
  8499. }
  8500. }
  8501. let originNext = next;
  8502. let vnodeHook;
  8503. {
  8504. pushWarningContext(next || instance.vnode);
  8505. }
  8506. toggleRecurse(instance, false);
  8507. if (next) {
  8508. next.el = vnode.el;
  8509. updateComponentPreRender(instance, next, optimized);
  8510. } else {
  8511. next = vnode;
  8512. }
  8513. if (bu) {
  8514. invokeArrayFns(bu);
  8515. }
  8516. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  8517. invokeVNodeHook(vnodeHook, parent, next, vnode);
  8518. }
  8519. toggleRecurse(instance, true);
  8520. {
  8521. startMeasure(instance, `render`);
  8522. }
  8523. const nextTree = renderComponentRoot(instance);
  8524. {
  8525. endMeasure(instance, `render`);
  8526. }
  8527. const prevTree = instance.subTree;
  8528. instance.subTree = nextTree;
  8529. {
  8530. startMeasure(instance, `patch`);
  8531. }
  8532. patch(
  8533. prevTree,
  8534. nextTree,
  8535. // parent may have changed if it's in a teleport
  8536. hostParentNode(prevTree.el),
  8537. // anchor may have changed if it's in a fragment
  8538. getNextHostNode(prevTree),
  8539. instance,
  8540. parentSuspense,
  8541. namespace
  8542. );
  8543. {
  8544. endMeasure(instance, `patch`);
  8545. }
  8546. next.el = nextTree.el;
  8547. if (originNext === null) {
  8548. updateHOCHostEl(instance, nextTree.el);
  8549. }
  8550. if (u) {
  8551. queuePostRenderEffect(u, parentSuspense);
  8552. }
  8553. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  8554. queuePostRenderEffect(
  8555. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  8556. parentSuspense
  8557. );
  8558. }
  8559. {
  8560. devtoolsComponentUpdated(instance);
  8561. }
  8562. {
  8563. popWarningContext();
  8564. }
  8565. }
  8566. };
  8567. instance.scope.on();
  8568. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  8569. instance.scope.off();
  8570. const update = instance.update = effect.run.bind(effect);
  8571. const job = instance.job = effect.runIfDirty.bind(effect);
  8572. job.i = instance;
  8573. job.id = instance.uid;
  8574. effect.scheduler = () => queueJob(job);
  8575. toggleRecurse(instance, true);
  8576. {
  8577. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  8578. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  8579. }
  8580. update();
  8581. };
  8582. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  8583. nextVNode.component = instance;
  8584. const prevProps = instance.vnode.props;
  8585. instance.vnode = nextVNode;
  8586. instance.next = null;
  8587. updateProps(instance, nextVNode.props, prevProps, optimized);
  8588. updateSlots(instance, nextVNode.children, optimized);
  8589. pauseTracking();
  8590. flushPreFlushCbs(instance);
  8591. resetTracking();
  8592. };
  8593. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  8594. const c1 = n1 && n1.children;
  8595. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  8596. const c2 = n2.children;
  8597. const { patchFlag, shapeFlag } = n2;
  8598. if (patchFlag > 0) {
  8599. if (patchFlag & 128) {
  8600. patchKeyedChildren(
  8601. c1,
  8602. c2,
  8603. container,
  8604. anchor,
  8605. parentComponent,
  8606. parentSuspense,
  8607. namespace,
  8608. slotScopeIds,
  8609. optimized
  8610. );
  8611. return;
  8612. } else if (patchFlag & 256) {
  8613. patchUnkeyedChildren(
  8614. c1,
  8615. c2,
  8616. container,
  8617. anchor,
  8618. parentComponent,
  8619. parentSuspense,
  8620. namespace,
  8621. slotScopeIds,
  8622. optimized
  8623. );
  8624. return;
  8625. }
  8626. }
  8627. if (shapeFlag & 8) {
  8628. if (prevShapeFlag & 16) {
  8629. unmountChildren(c1, parentComponent, parentSuspense);
  8630. }
  8631. if (c2 !== c1) {
  8632. hostSetElementText(container, c2);
  8633. }
  8634. } else {
  8635. if (prevShapeFlag & 16) {
  8636. if (shapeFlag & 16) {
  8637. patchKeyedChildren(
  8638. c1,
  8639. c2,
  8640. container,
  8641. anchor,
  8642. parentComponent,
  8643. parentSuspense,
  8644. namespace,
  8645. slotScopeIds,
  8646. optimized
  8647. );
  8648. } else {
  8649. unmountChildren(c1, parentComponent, parentSuspense, true);
  8650. }
  8651. } else {
  8652. if (prevShapeFlag & 8) {
  8653. hostSetElementText(container, "");
  8654. }
  8655. if (shapeFlag & 16) {
  8656. mountChildren(
  8657. c2,
  8658. container,
  8659. anchor,
  8660. parentComponent,
  8661. parentSuspense,
  8662. namespace,
  8663. slotScopeIds,
  8664. optimized
  8665. );
  8666. }
  8667. }
  8668. }
  8669. };
  8670. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8671. c1 = c1 || EMPTY_ARR;
  8672. c2 = c2 || EMPTY_ARR;
  8673. const oldLength = c1.length;
  8674. const newLength = c2.length;
  8675. const commonLength = Math.min(oldLength, newLength);
  8676. let i;
  8677. for (i = 0; i < commonLength; i++) {
  8678. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8679. patch(
  8680. c1[i],
  8681. nextChild,
  8682. container,
  8683. null,
  8684. parentComponent,
  8685. parentSuspense,
  8686. namespace,
  8687. slotScopeIds,
  8688. optimized
  8689. );
  8690. }
  8691. if (oldLength > newLength) {
  8692. unmountChildren(
  8693. c1,
  8694. parentComponent,
  8695. parentSuspense,
  8696. true,
  8697. false,
  8698. commonLength
  8699. );
  8700. } else {
  8701. mountChildren(
  8702. c2,
  8703. container,
  8704. anchor,
  8705. parentComponent,
  8706. parentSuspense,
  8707. namespace,
  8708. slotScopeIds,
  8709. optimized,
  8710. commonLength
  8711. );
  8712. }
  8713. };
  8714. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8715. let i = 0;
  8716. const l2 = c2.length;
  8717. let e1 = c1.length - 1;
  8718. let e2 = l2 - 1;
  8719. while (i <= e1 && i <= e2) {
  8720. const n1 = c1[i];
  8721. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8722. if (isSameVNodeType(n1, n2)) {
  8723. patch(
  8724. n1,
  8725. n2,
  8726. container,
  8727. null,
  8728. parentComponent,
  8729. parentSuspense,
  8730. namespace,
  8731. slotScopeIds,
  8732. optimized
  8733. );
  8734. } else {
  8735. break;
  8736. }
  8737. i++;
  8738. }
  8739. while (i <= e1 && i <= e2) {
  8740. const n1 = c1[e1];
  8741. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  8742. if (isSameVNodeType(n1, n2)) {
  8743. patch(
  8744. n1,
  8745. n2,
  8746. container,
  8747. null,
  8748. parentComponent,
  8749. parentSuspense,
  8750. namespace,
  8751. slotScopeIds,
  8752. optimized
  8753. );
  8754. } else {
  8755. break;
  8756. }
  8757. e1--;
  8758. e2--;
  8759. }
  8760. if (i > e1) {
  8761. if (i <= e2) {
  8762. const nextPos = e2 + 1;
  8763. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  8764. while (i <= e2) {
  8765. patch(
  8766. null,
  8767. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  8768. container,
  8769. anchor,
  8770. parentComponent,
  8771. parentSuspense,
  8772. namespace,
  8773. slotScopeIds,
  8774. optimized
  8775. );
  8776. i++;
  8777. }
  8778. }
  8779. } else if (i > e2) {
  8780. while (i <= e1) {
  8781. unmount(c1[i], parentComponent, parentSuspense, true);
  8782. i++;
  8783. }
  8784. } else {
  8785. const s1 = i;
  8786. const s2 = i;
  8787. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  8788. for (i = s2; i <= e2; i++) {
  8789. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8790. if (nextChild.key != null) {
  8791. if (keyToNewIndexMap.has(nextChild.key)) {
  8792. warn$1(
  8793. `Duplicate keys found during update:`,
  8794. JSON.stringify(nextChild.key),
  8795. `Make sure keys are unique.`
  8796. );
  8797. }
  8798. keyToNewIndexMap.set(nextChild.key, i);
  8799. }
  8800. }
  8801. let j;
  8802. let patched = 0;
  8803. const toBePatched = e2 - s2 + 1;
  8804. let moved = false;
  8805. let maxNewIndexSoFar = 0;
  8806. const newIndexToOldIndexMap = new Array(toBePatched);
  8807. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  8808. for (i = s1; i <= e1; i++) {
  8809. const prevChild = c1[i];
  8810. if (patched >= toBePatched) {
  8811. unmount(prevChild, parentComponent, parentSuspense, true);
  8812. continue;
  8813. }
  8814. let newIndex;
  8815. if (prevChild.key != null) {
  8816. newIndex = keyToNewIndexMap.get(prevChild.key);
  8817. } else {
  8818. for (j = s2; j <= e2; j++) {
  8819. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  8820. newIndex = j;
  8821. break;
  8822. }
  8823. }
  8824. }
  8825. if (newIndex === void 0) {
  8826. unmount(prevChild, parentComponent, parentSuspense, true);
  8827. } else {
  8828. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  8829. if (newIndex >= maxNewIndexSoFar) {
  8830. maxNewIndexSoFar = newIndex;
  8831. } else {
  8832. moved = true;
  8833. }
  8834. patch(
  8835. prevChild,
  8836. c2[newIndex],
  8837. container,
  8838. null,
  8839. parentComponent,
  8840. parentSuspense,
  8841. namespace,
  8842. slotScopeIds,
  8843. optimized
  8844. );
  8845. patched++;
  8846. }
  8847. }
  8848. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  8849. j = increasingNewIndexSequence.length - 1;
  8850. for (i = toBePatched - 1; i >= 0; i--) {
  8851. const nextIndex = s2 + i;
  8852. const nextChild = c2[nextIndex];
  8853. const anchorVNode = c2[nextIndex + 1];
  8854. const anchor = nextIndex + 1 < l2 ? (
  8855. // #13559, #14173 fallback to el placeholder for unresolved async component
  8856. anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
  8857. ) : parentAnchor;
  8858. if (newIndexToOldIndexMap[i] === 0) {
  8859. patch(
  8860. null,
  8861. nextChild,
  8862. container,
  8863. anchor,
  8864. parentComponent,
  8865. parentSuspense,
  8866. namespace,
  8867. slotScopeIds,
  8868. optimized
  8869. );
  8870. } else if (moved) {
  8871. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  8872. move(nextChild, container, anchor, 2);
  8873. } else {
  8874. j--;
  8875. }
  8876. }
  8877. }
  8878. }
  8879. };
  8880. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  8881. const { el, type, transition, children, shapeFlag } = vnode;
  8882. if (shapeFlag & 6) {
  8883. move(vnode.component.subTree, container, anchor, moveType);
  8884. return;
  8885. }
  8886. if (shapeFlag & 128) {
  8887. vnode.suspense.move(container, anchor, moveType);
  8888. return;
  8889. }
  8890. if (shapeFlag & 64) {
  8891. type.move(vnode, container, anchor, internals);
  8892. return;
  8893. }
  8894. if (type === Fragment) {
  8895. hostInsert(el, container, anchor);
  8896. for (let i = 0; i < children.length; i++) {
  8897. move(children[i], container, anchor, moveType);
  8898. }
  8899. hostInsert(vnode.anchor, container, anchor);
  8900. return;
  8901. }
  8902. if (type === Static) {
  8903. moveStaticNode(vnode, container, anchor);
  8904. return;
  8905. }
  8906. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  8907. if (needTransition2) {
  8908. if (moveType === 0) {
  8909. if (transition.persisted && !el[leaveCbKey]) {
  8910. hostInsert(el, container, anchor);
  8911. } else {
  8912. transition.beforeEnter(el);
  8913. hostInsert(el, container, anchor);
  8914. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  8915. }
  8916. } else {
  8917. const { leave, delayLeave, afterLeave } = transition;
  8918. const remove2 = () => {
  8919. if (vnode.ctx.isUnmounted) {
  8920. hostRemove(el);
  8921. } else {
  8922. hostInsert(el, container, anchor);
  8923. }
  8924. };
  8925. const performLeave = () => {
  8926. const wasLeaving = el._isLeaving || !!el[leaveCbKey];
  8927. if (el._isLeaving) {
  8928. el[leaveCbKey](
  8929. true
  8930. /* cancelled */
  8931. );
  8932. }
  8933. if (transition.persisted && !wasLeaving) {
  8934. remove2();
  8935. } else {
  8936. leave(el, () => {
  8937. remove2();
  8938. afterLeave && afterLeave();
  8939. });
  8940. }
  8941. };
  8942. if (delayLeave) {
  8943. delayLeave(el, remove2, performLeave);
  8944. } else {
  8945. performLeave();
  8946. }
  8947. }
  8948. } else {
  8949. hostInsert(el, container, anchor);
  8950. }
  8951. };
  8952. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  8953. const {
  8954. type,
  8955. props,
  8956. ref,
  8957. children,
  8958. dynamicChildren,
  8959. shapeFlag,
  8960. patchFlag,
  8961. dirs,
  8962. cacheIndex,
  8963. memo
  8964. } = vnode;
  8965. if (patchFlag === -2) {
  8966. optimized = false;
  8967. }
  8968. if (ref != null) {
  8969. pauseTracking();
  8970. setRef(ref, null, parentSuspense, vnode, true);
  8971. resetTracking();
  8972. }
  8973. if (cacheIndex != null) {
  8974. parentComponent.renderCache[cacheIndex] = void 0;
  8975. }
  8976. if (shapeFlag & 256) {
  8977. parentComponent.ctx.deactivate(vnode);
  8978. return;
  8979. }
  8980. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  8981. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  8982. let vnodeHook;
  8983. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  8984. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8985. }
  8986. if (shapeFlag & 6) {
  8987. unmountComponent(vnode.component, parentSuspense, doRemove);
  8988. } else {
  8989. if (shapeFlag & 128) {
  8990. vnode.suspense.unmount(parentSuspense, doRemove);
  8991. return;
  8992. }
  8993. if (shouldInvokeDirs) {
  8994. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  8995. }
  8996. if (shapeFlag & 64) {
  8997. vnode.type.remove(
  8998. vnode,
  8999. parentComponent,
  9000. parentSuspense,
  9001. internals,
  9002. doRemove
  9003. );
  9004. } else if (dynamicChildren && // #5154
  9005. // when v-once is used inside a block, setBlockTracking(-1) marks the
  9006. // parent block with hasOnce: true
  9007. // so that it doesn't take the fast path during unmount - otherwise
  9008. // components nested in v-once are never unmounted.
  9009. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  9010. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  9011. unmountChildren(
  9012. dynamicChildren,
  9013. parentComponent,
  9014. parentSuspense,
  9015. false,
  9016. true
  9017. );
  9018. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  9019. unmountChildren(children, parentComponent, parentSuspense);
  9020. }
  9021. if (doRemove) {
  9022. remove(vnode);
  9023. }
  9024. }
  9025. const shouldInvalidateMemo = memo != null && cacheIndex == null;
  9026. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) {
  9027. queuePostRenderEffect(() => {
  9028. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  9029. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  9030. if (shouldInvalidateMemo) {
  9031. vnode.el = null;
  9032. }
  9033. }, parentSuspense);
  9034. }
  9035. };
  9036. const remove = (vnode) => {
  9037. const { type, el, anchor, transition } = vnode;
  9038. if (type === Fragment) {
  9039. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  9040. vnode.children.forEach((child) => {
  9041. if (child.type === Comment) {
  9042. hostRemove(child.el);
  9043. } else {
  9044. remove(child);
  9045. }
  9046. });
  9047. } else {
  9048. removeFragment(el, anchor);
  9049. }
  9050. return;
  9051. }
  9052. if (type === Static) {
  9053. removeStaticNode(vnode);
  9054. return;
  9055. }
  9056. const performRemove = () => {
  9057. hostRemove(el);
  9058. if (transition && !transition.persisted && transition.afterLeave) {
  9059. transition.afterLeave();
  9060. }
  9061. };
  9062. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  9063. const { leave, delayLeave } = transition;
  9064. const performLeave = () => leave(el, performRemove);
  9065. if (delayLeave) {
  9066. delayLeave(vnode.el, performRemove, performLeave);
  9067. } else {
  9068. performLeave();
  9069. }
  9070. } else {
  9071. performRemove();
  9072. }
  9073. };
  9074. const removeFragment = (cur, end) => {
  9075. let next;
  9076. while (cur !== end) {
  9077. next = hostNextSibling(cur);
  9078. hostRemove(cur);
  9079. cur = next;
  9080. }
  9081. hostRemove(end);
  9082. };
  9083. const unmountComponent = (instance, parentSuspense, doRemove) => {
  9084. if (instance.type.__hmrId) {
  9085. unregisterHMR(instance);
  9086. }
  9087. const { bum, scope, job, subTree, um, m, a } = instance;
  9088. invalidateMount(m);
  9089. invalidateMount(a);
  9090. if (bum) {
  9091. invokeArrayFns(bum);
  9092. }
  9093. scope.stop();
  9094. if (job) {
  9095. job.flags |= 8;
  9096. unmount(subTree, instance, parentSuspense, doRemove);
  9097. }
  9098. if (um) {
  9099. queuePostRenderEffect(um, parentSuspense);
  9100. }
  9101. queuePostRenderEffect(() => {
  9102. instance.isUnmounted = true;
  9103. }, parentSuspense);
  9104. {
  9105. devtoolsComponentRemoved(instance);
  9106. }
  9107. };
  9108. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  9109. for (let i = start; i < children.length; i++) {
  9110. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  9111. }
  9112. };
  9113. const getNextHostNode = (vnode) => {
  9114. if (vnode.shapeFlag & 6) {
  9115. return getNextHostNode(vnode.component.subTree);
  9116. }
  9117. if (vnode.shapeFlag & 128) {
  9118. return vnode.suspense.next();
  9119. }
  9120. const el = hostNextSibling(vnode.anchor || vnode.el);
  9121. const teleportEnd = el && el[TeleportEndKey];
  9122. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  9123. };
  9124. let isFlushing = false;
  9125. const render = (vnode, container, namespace) => {
  9126. let instance;
  9127. if (vnode == null) {
  9128. if (container._vnode) {
  9129. unmount(container._vnode, null, null, true);
  9130. instance = container._vnode.component;
  9131. }
  9132. } else {
  9133. patch(
  9134. container._vnode || null,
  9135. vnode,
  9136. container,
  9137. null,
  9138. null,
  9139. null,
  9140. namespace
  9141. );
  9142. }
  9143. container._vnode = vnode;
  9144. if (!isFlushing) {
  9145. isFlushing = true;
  9146. flushPreFlushCbs(instance);
  9147. flushPostFlushCbs();
  9148. isFlushing = false;
  9149. }
  9150. };
  9151. const internals = {
  9152. p: patch,
  9153. um: unmount,
  9154. m: move,
  9155. r: remove,
  9156. mt: mountComponent,
  9157. mc: mountChildren,
  9158. pc: patchChildren,
  9159. pbc: patchBlockChildren,
  9160. n: getNextHostNode,
  9161. o: options
  9162. };
  9163. let hydrate;
  9164. let hydrateNode;
  9165. if (createHydrationFns) {
  9166. [hydrate, hydrateNode] = createHydrationFns(
  9167. internals
  9168. );
  9169. }
  9170. return {
  9171. render,
  9172. hydrate,
  9173. createApp: createAppAPI(render, hydrate)
  9174. };
  9175. }
  9176. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  9177. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  9178. }
  9179. function toggleRecurse({ effect, job }, allowed) {
  9180. if (allowed) {
  9181. effect.flags |= 32;
  9182. job.flags |= 4;
  9183. } else {
  9184. effect.flags &= -33;
  9185. job.flags &= -5;
  9186. }
  9187. }
  9188. function needTransition(parentSuspense, transition) {
  9189. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  9190. }
  9191. function traverseStaticChildren(n1, n2, shallow = false) {
  9192. const ch1 = n1.children;
  9193. const ch2 = n2.children;
  9194. if (isArray(ch1) && isArray(ch2)) {
  9195. for (let i = 0; i < ch1.length; i++) {
  9196. const c1 = ch1[i];
  9197. let c2 = ch2[i];
  9198. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  9199. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  9200. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  9201. c2.el = c1.el;
  9202. }
  9203. if (!shallow && c2.patchFlag !== -2)
  9204. traverseStaticChildren(c1, c2);
  9205. }
  9206. if (c2.type === Text) {
  9207. if (c2.patchFlag === -1) {
  9208. c2 = ch2[i] = cloneIfMounted(c2);
  9209. }
  9210. c2.el = c1.el;
  9211. }
  9212. if (c2.type === Comment && !c2.el) {
  9213. c2.el = c1.el;
  9214. }
  9215. {
  9216. c2.el && (c2.el.__vnode = c2);
  9217. }
  9218. }
  9219. }
  9220. }
  9221. function getSequence(arr) {
  9222. const p = arr.slice();
  9223. const result = [0];
  9224. let i, j, u, v, c;
  9225. const len = arr.length;
  9226. for (i = 0; i < len; i++) {
  9227. const arrI = arr[i];
  9228. if (arrI !== 0) {
  9229. j = result[result.length - 1];
  9230. if (arr[j] < arrI) {
  9231. p[i] = j;
  9232. result.push(i);
  9233. continue;
  9234. }
  9235. u = 0;
  9236. v = result.length - 1;
  9237. while (u < v) {
  9238. c = u + v >> 1;
  9239. if (arr[result[c]] < arrI) {
  9240. u = c + 1;
  9241. } else {
  9242. v = c;
  9243. }
  9244. }
  9245. if (arrI < arr[result[u]]) {
  9246. if (u > 0) {
  9247. p[i] = result[u - 1];
  9248. }
  9249. result[u] = i;
  9250. }
  9251. }
  9252. }
  9253. u = result.length;
  9254. v = result[u - 1];
  9255. while (u-- > 0) {
  9256. result[u] = v;
  9257. v = p[v];
  9258. }
  9259. return result;
  9260. }
  9261. function locateNonHydratedAsyncRoot(instance) {
  9262. const subComponent = instance.subTree.component;
  9263. if (subComponent) {
  9264. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  9265. return subComponent;
  9266. } else {
  9267. return locateNonHydratedAsyncRoot(subComponent);
  9268. }
  9269. }
  9270. }
  9271. function invalidateMount(hooks) {
  9272. if (hooks) {
  9273. for (let i = 0; i < hooks.length; i++)
  9274. hooks[i].flags |= 8;
  9275. }
  9276. }
  9277. function resolveAsyncComponentPlaceholder(anchorVnode) {
  9278. if (anchorVnode.placeholder) {
  9279. return anchorVnode.placeholder;
  9280. }
  9281. const instance = anchorVnode.component;
  9282. if (instance) {
  9283. return resolveAsyncComponentPlaceholder(instance.subTree);
  9284. }
  9285. return null;
  9286. }
  9287. const isSuspense = (type) => type.__isSuspense;
  9288. let suspenseId = 0;
  9289. const SuspenseImpl = {
  9290. name: "Suspense",
  9291. // In order to make Suspense tree-shakable, we need to avoid importing it
  9292. // directly in the renderer. The renderer checks for the __isSuspense flag
  9293. // on a vnode's type and calls the `process` method, passing in renderer
  9294. // internals.
  9295. __isSuspense: true,
  9296. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9297. if (n1 == null) {
  9298. mountSuspense(
  9299. n2,
  9300. container,
  9301. anchor,
  9302. parentComponent,
  9303. parentSuspense,
  9304. namespace,
  9305. slotScopeIds,
  9306. optimized,
  9307. rendererInternals
  9308. );
  9309. } else {
  9310. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  9311. n2.suspense = n1.suspense;
  9312. n2.suspense.vnode = n2;
  9313. n2.el = n1.el;
  9314. return;
  9315. }
  9316. patchSuspense(
  9317. n1,
  9318. n2,
  9319. container,
  9320. anchor,
  9321. parentComponent,
  9322. namespace,
  9323. slotScopeIds,
  9324. optimized,
  9325. rendererInternals
  9326. );
  9327. }
  9328. },
  9329. hydrate: hydrateSuspense,
  9330. normalize: normalizeSuspenseChildren
  9331. };
  9332. const Suspense = SuspenseImpl ;
  9333. function triggerEvent(vnode, name) {
  9334. const eventListener = vnode.props && vnode.props[name];
  9335. if (isFunction(eventListener)) {
  9336. eventListener();
  9337. }
  9338. }
  9339. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9340. const {
  9341. p: patch,
  9342. o: { createElement }
  9343. } = rendererInternals;
  9344. const hiddenContainer = createElement("div");
  9345. const suspense = vnode.suspense = createSuspenseBoundary(
  9346. vnode,
  9347. parentSuspense,
  9348. parentComponent,
  9349. container,
  9350. hiddenContainer,
  9351. anchor,
  9352. namespace,
  9353. slotScopeIds,
  9354. optimized,
  9355. rendererInternals
  9356. );
  9357. patch(
  9358. null,
  9359. suspense.pendingBranch = vnode.ssContent,
  9360. hiddenContainer,
  9361. null,
  9362. parentComponent,
  9363. suspense,
  9364. namespace,
  9365. slotScopeIds
  9366. );
  9367. if (suspense.deps > 0) {
  9368. triggerEvent(vnode, "onPending");
  9369. triggerEvent(vnode, "onFallback");
  9370. patch(
  9371. null,
  9372. vnode.ssFallback,
  9373. container,
  9374. anchor,
  9375. parentComponent,
  9376. null,
  9377. // fallback tree will not have suspense context
  9378. namespace,
  9379. slotScopeIds
  9380. );
  9381. setActiveBranch(suspense, vnode.ssFallback);
  9382. } else {
  9383. suspense.resolve(false, true);
  9384. }
  9385. }
  9386. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  9387. const suspense = n2.suspense = n1.suspense;
  9388. suspense.vnode = n2;
  9389. n2.el = n1.el;
  9390. const newBranch = n2.ssContent;
  9391. const newFallback = n2.ssFallback;
  9392. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  9393. if (pendingBranch) {
  9394. suspense.pendingBranch = newBranch;
  9395. if (isSameVNodeType(pendingBranch, newBranch)) {
  9396. patch(
  9397. pendingBranch,
  9398. newBranch,
  9399. suspense.hiddenContainer,
  9400. null,
  9401. parentComponent,
  9402. suspense,
  9403. namespace,
  9404. slotScopeIds,
  9405. optimized
  9406. );
  9407. if (suspense.deps <= 0) {
  9408. suspense.resolve();
  9409. } else if (isInFallback) {
  9410. if (!isHydrating) {
  9411. patch(
  9412. activeBranch,
  9413. newFallback,
  9414. container,
  9415. anchor,
  9416. parentComponent,
  9417. null,
  9418. // fallback tree will not have suspense context
  9419. namespace,
  9420. slotScopeIds,
  9421. optimized
  9422. );
  9423. setActiveBranch(suspense, newFallback);
  9424. }
  9425. }
  9426. } else {
  9427. suspense.pendingId = suspenseId++;
  9428. if (isHydrating) {
  9429. suspense.isHydrating = false;
  9430. suspense.activeBranch = pendingBranch;
  9431. } else {
  9432. unmount(pendingBranch, parentComponent, suspense);
  9433. }
  9434. suspense.deps = 0;
  9435. suspense.effects.length = 0;
  9436. suspense.hiddenContainer = createElement("div");
  9437. if (isInFallback) {
  9438. patch(
  9439. null,
  9440. newBranch,
  9441. suspense.hiddenContainer,
  9442. null,
  9443. parentComponent,
  9444. suspense,
  9445. namespace,
  9446. slotScopeIds,
  9447. optimized
  9448. );
  9449. if (suspense.deps <= 0) {
  9450. suspense.resolve();
  9451. } else {
  9452. patch(
  9453. activeBranch,
  9454. newFallback,
  9455. container,
  9456. anchor,
  9457. parentComponent,
  9458. null,
  9459. // fallback tree will not have suspense context
  9460. namespace,
  9461. slotScopeIds,
  9462. optimized
  9463. );
  9464. setActiveBranch(suspense, newFallback);
  9465. }
  9466. } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9467. patch(
  9468. activeBranch,
  9469. newBranch,
  9470. container,
  9471. anchor,
  9472. parentComponent,
  9473. suspense,
  9474. namespace,
  9475. slotScopeIds,
  9476. optimized
  9477. );
  9478. suspense.resolve(true);
  9479. } else {
  9480. patch(
  9481. null,
  9482. newBranch,
  9483. suspense.hiddenContainer,
  9484. null,
  9485. parentComponent,
  9486. suspense,
  9487. namespace,
  9488. slotScopeIds,
  9489. optimized
  9490. );
  9491. if (suspense.deps <= 0) {
  9492. suspense.resolve();
  9493. }
  9494. }
  9495. }
  9496. } else {
  9497. if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9498. patch(
  9499. activeBranch,
  9500. newBranch,
  9501. container,
  9502. anchor,
  9503. parentComponent,
  9504. suspense,
  9505. namespace,
  9506. slotScopeIds,
  9507. optimized
  9508. );
  9509. setActiveBranch(suspense, newBranch);
  9510. } else {
  9511. triggerEvent(n2, "onPending");
  9512. suspense.pendingBranch = newBranch;
  9513. if (newBranch.shapeFlag & 512) {
  9514. suspense.pendingId = newBranch.component.suspenseId;
  9515. } else {
  9516. suspense.pendingId = suspenseId++;
  9517. }
  9518. patch(
  9519. null,
  9520. newBranch,
  9521. suspense.hiddenContainer,
  9522. null,
  9523. parentComponent,
  9524. suspense,
  9525. namespace,
  9526. slotScopeIds,
  9527. optimized
  9528. );
  9529. if (suspense.deps <= 0) {
  9530. suspense.resolve();
  9531. } else {
  9532. const { timeout, pendingId } = suspense;
  9533. if (timeout > 0) {
  9534. setTimeout(() => {
  9535. if (suspense.pendingId === pendingId) {
  9536. suspense.fallback(newFallback);
  9537. }
  9538. }, timeout);
  9539. } else if (timeout === 0) {
  9540. suspense.fallback(newFallback);
  9541. }
  9542. }
  9543. }
  9544. }
  9545. }
  9546. let hasWarned = false;
  9547. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9548. if (!hasWarned) {
  9549. hasWarned = true;
  9550. console[console.info ? "info" : "log"](
  9551. `<Suspense> is an experimental feature and its API will likely change.`
  9552. );
  9553. }
  9554. const {
  9555. p: patch,
  9556. m: move,
  9557. um: unmount,
  9558. n: next,
  9559. o: { parentNode, remove }
  9560. } = rendererInternals;
  9561. let parentSuspenseId;
  9562. const isSuspensible = isVNodeSuspensible(vnode);
  9563. if (isSuspensible) {
  9564. if (parentSuspense && parentSuspense.pendingBranch) {
  9565. parentSuspenseId = parentSuspense.pendingId;
  9566. parentSuspense.deps++;
  9567. }
  9568. }
  9569. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9570. {
  9571. assertNumber(timeout, `Suspense timeout`);
  9572. }
  9573. const initialAnchor = anchor;
  9574. const suspense = {
  9575. vnode,
  9576. parent: parentSuspense,
  9577. parentComponent,
  9578. namespace,
  9579. container,
  9580. hiddenContainer,
  9581. deps: 0,
  9582. pendingId: suspenseId++,
  9583. timeout: typeof timeout === "number" ? timeout : -1,
  9584. activeBranch: null,
  9585. isFallbackMountPending: false,
  9586. pendingBranch: null,
  9587. isInFallback: !isHydrating,
  9588. isHydrating,
  9589. isUnmounted: false,
  9590. effects: [],
  9591. resolve(resume = false, sync = false) {
  9592. {
  9593. if (!resume && !suspense.pendingBranch) {
  9594. throw new Error(
  9595. `suspense.resolve() is called without a pending branch.`
  9596. );
  9597. }
  9598. if (suspense.isUnmounted) {
  9599. throw new Error(
  9600. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9601. );
  9602. }
  9603. }
  9604. const {
  9605. vnode: vnode2,
  9606. activeBranch,
  9607. pendingBranch,
  9608. pendingId,
  9609. effects,
  9610. parentComponent: parentComponent2,
  9611. container: container2,
  9612. isInFallback
  9613. } = suspense;
  9614. let delayEnter = false;
  9615. if (suspense.isHydrating) {
  9616. suspense.isHydrating = false;
  9617. } else if (!resume) {
  9618. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9619. let hasUpdatedAnchor = false;
  9620. if (delayEnter) {
  9621. activeBranch.transition.afterLeave = () => {
  9622. if (pendingId === suspense.pendingId) {
  9623. move(
  9624. pendingBranch,
  9625. container2,
  9626. anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
  9627. 0
  9628. );
  9629. queuePostFlushCb(effects);
  9630. if (isInFallback && vnode2.ssFallback) {
  9631. vnode2.ssFallback.el = null;
  9632. }
  9633. }
  9634. };
  9635. }
  9636. if (activeBranch && !suspense.isFallbackMountPending) {
  9637. if (parentNode(activeBranch.el) === container2) {
  9638. anchor = next(activeBranch);
  9639. hasUpdatedAnchor = true;
  9640. }
  9641. unmount(activeBranch, parentComponent2, suspense, true);
  9642. if (!delayEnter && isInFallback && vnode2.ssFallback) {
  9643. queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense);
  9644. }
  9645. }
  9646. if (!delayEnter) {
  9647. move(pendingBranch, container2, anchor, 0);
  9648. }
  9649. }
  9650. suspense.isFallbackMountPending = false;
  9651. setActiveBranch(suspense, pendingBranch);
  9652. suspense.pendingBranch = null;
  9653. suspense.isInFallback = false;
  9654. let parent = suspense.parent;
  9655. let hasUnresolvedAncestor = false;
  9656. while (parent) {
  9657. if (parent.pendingBranch) {
  9658. for (let i = 0; i < effects.length; i++) {
  9659. parent.effects.push(effects[i]);
  9660. }
  9661. hasUnresolvedAncestor = true;
  9662. break;
  9663. }
  9664. parent = parent.parent;
  9665. }
  9666. if (!hasUnresolvedAncestor && !delayEnter) {
  9667. queuePostFlushCb(effects);
  9668. }
  9669. suspense.effects = [];
  9670. if (isSuspensible) {
  9671. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9672. parentSuspense.deps--;
  9673. if (parentSuspense.deps === 0 && !sync) {
  9674. parentSuspense.resolve();
  9675. }
  9676. }
  9677. }
  9678. triggerEvent(vnode2, "onResolve");
  9679. },
  9680. fallback(fallbackVNode) {
  9681. if (!suspense.pendingBranch) {
  9682. return;
  9683. }
  9684. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9685. triggerEvent(vnode2, "onFallback");
  9686. const anchor2 = next(activeBranch);
  9687. const mountFallback = () => {
  9688. suspense.isFallbackMountPending = false;
  9689. if (!suspense.isInFallback) {
  9690. return;
  9691. }
  9692. patch(
  9693. null,
  9694. fallbackVNode,
  9695. container2,
  9696. anchor2,
  9697. parentComponent2,
  9698. null,
  9699. // fallback tree will not have suspense context
  9700. namespace2,
  9701. slotScopeIds,
  9702. optimized
  9703. );
  9704. setActiveBranch(suspense, fallbackVNode);
  9705. };
  9706. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9707. if (delayEnter) {
  9708. suspense.isFallbackMountPending = true;
  9709. activeBranch.transition.afterLeave = mountFallback;
  9710. }
  9711. suspense.isInFallback = true;
  9712. unmount(
  9713. activeBranch,
  9714. parentComponent2,
  9715. null,
  9716. // no suspense so unmount hooks fire now
  9717. true
  9718. // shouldRemove
  9719. );
  9720. if (!delayEnter) {
  9721. mountFallback();
  9722. }
  9723. },
  9724. move(container2, anchor2, type) {
  9725. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9726. suspense.container = container2;
  9727. },
  9728. next() {
  9729. return suspense.activeBranch && next(suspense.activeBranch);
  9730. },
  9731. registerDep(instance, setupRenderEffect, optimized2) {
  9732. const isInPendingSuspense = !!suspense.pendingBranch;
  9733. if (isInPendingSuspense) {
  9734. suspense.deps++;
  9735. }
  9736. const hydratedEl = instance.vnode.el;
  9737. instance.asyncDep.catch((err) => {
  9738. handleError(err, instance, 0);
  9739. }).then((asyncSetupResult) => {
  9740. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9741. return;
  9742. }
  9743. unsetCurrentInstance();
  9744. instance.asyncResolved = true;
  9745. const { vnode: vnode2 } = instance;
  9746. {
  9747. pushWarningContext(vnode2);
  9748. }
  9749. handleSetupResult(instance, asyncSetupResult, false);
  9750. if (hydratedEl) {
  9751. vnode2.el = hydratedEl;
  9752. }
  9753. const placeholder = !hydratedEl && instance.subTree.el;
  9754. setupRenderEffect(
  9755. instance,
  9756. vnode2,
  9757. // component may have been moved before resolve.
  9758. // if this is not a hydration, instance.subTree will be the comment
  9759. // placeholder.
  9760. parentNode(hydratedEl || instance.subTree.el),
  9761. // anchor will not be used if this is hydration, so only need to
  9762. // consider the comment placeholder case.
  9763. hydratedEl ? null : next(instance.subTree),
  9764. suspense,
  9765. namespace,
  9766. optimized2
  9767. );
  9768. if (placeholder) {
  9769. vnode2.placeholder = null;
  9770. remove(placeholder);
  9771. }
  9772. updateHOCHostEl(instance, vnode2.el);
  9773. {
  9774. popWarningContext();
  9775. }
  9776. if (isInPendingSuspense && --suspense.deps === 0) {
  9777. suspense.resolve();
  9778. }
  9779. });
  9780. },
  9781. unmount(parentSuspense2, doRemove) {
  9782. suspense.isUnmounted = true;
  9783. if (suspense.activeBranch) {
  9784. unmount(
  9785. suspense.activeBranch,
  9786. parentComponent,
  9787. parentSuspense2,
  9788. doRemove
  9789. );
  9790. }
  9791. if (suspense.pendingBranch) {
  9792. unmount(
  9793. suspense.pendingBranch,
  9794. parentComponent,
  9795. parentSuspense2,
  9796. doRemove
  9797. );
  9798. }
  9799. }
  9800. };
  9801. return suspense;
  9802. }
  9803. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9804. const suspense = vnode.suspense = createSuspenseBoundary(
  9805. vnode,
  9806. parentSuspense,
  9807. parentComponent,
  9808. node.parentNode,
  9809. // eslint-disable-next-line no-restricted-globals
  9810. document.createElement("div"),
  9811. null,
  9812. namespace,
  9813. slotScopeIds,
  9814. optimized,
  9815. rendererInternals,
  9816. true
  9817. );
  9818. const result = hydrateNode(
  9819. node,
  9820. suspense.pendingBranch = vnode.ssContent,
  9821. parentComponent,
  9822. suspense,
  9823. slotScopeIds,
  9824. optimized
  9825. );
  9826. if (suspense.deps === 0) {
  9827. suspense.resolve(false, true);
  9828. }
  9829. return result;
  9830. }
  9831. function normalizeSuspenseChildren(vnode) {
  9832. const { shapeFlag, children } = vnode;
  9833. const isSlotChildren = shapeFlag & 32;
  9834. vnode.ssContent = normalizeSuspenseSlot(
  9835. isSlotChildren ? children.default : children
  9836. );
  9837. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9838. }
  9839. function normalizeSuspenseSlot(s) {
  9840. let block;
  9841. if (isFunction(s)) {
  9842. const trackBlock = isBlockTreeEnabled && s._c;
  9843. if (trackBlock) {
  9844. s._d = false;
  9845. openBlock();
  9846. }
  9847. s = s();
  9848. if (trackBlock) {
  9849. s._d = true;
  9850. block = currentBlock;
  9851. closeBlock();
  9852. }
  9853. }
  9854. if (isArray(s)) {
  9855. const singleChild = filterSingleRoot(s);
  9856. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9857. warn$1(`<Suspense> slots expect a single root node.`);
  9858. }
  9859. s = singleChild;
  9860. }
  9861. s = normalizeVNode(s);
  9862. if (block && !s.dynamicChildren) {
  9863. s.dynamicChildren = block.filter((c) => c !== s);
  9864. }
  9865. return s;
  9866. }
  9867. function queueEffectWithSuspense(fn, suspense) {
  9868. if (suspense && suspense.pendingBranch) {
  9869. if (isArray(fn)) {
  9870. suspense.effects.push(...fn);
  9871. } else {
  9872. suspense.effects.push(fn);
  9873. }
  9874. } else {
  9875. queuePostFlushCb(fn);
  9876. }
  9877. }
  9878. function setActiveBranch(suspense, branch) {
  9879. suspense.activeBranch = branch;
  9880. const { vnode, parentComponent } = suspense;
  9881. let el = branch.el;
  9882. while (!el && branch.component) {
  9883. branch = branch.component.subTree;
  9884. el = branch.el;
  9885. }
  9886. vnode.el = el;
  9887. if (parentComponent && parentComponent.subTree === vnode) {
  9888. parentComponent.vnode.el = el;
  9889. updateHOCHostEl(parentComponent, el);
  9890. }
  9891. }
  9892. function isVNodeSuspensible(vnode) {
  9893. const suspensible = vnode.props && vnode.props.suspensible;
  9894. return suspensible != null && suspensible !== false;
  9895. }
  9896. const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
  9897. const Text = /* @__PURE__ */ Symbol.for("v-txt");
  9898. const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
  9899. const Static = /* @__PURE__ */ Symbol.for("v-stc");
  9900. const blockStack = [];
  9901. let currentBlock = null;
  9902. function openBlock(disableTracking = false) {
  9903. blockStack.push(currentBlock = disableTracking ? null : []);
  9904. }
  9905. function closeBlock() {
  9906. blockStack.pop();
  9907. currentBlock = blockStack[blockStack.length - 1] || null;
  9908. }
  9909. let isBlockTreeEnabled = 1;
  9910. function setBlockTracking(value, inVOnce = false) {
  9911. isBlockTreeEnabled += value;
  9912. if (value < 0 && currentBlock && inVOnce) {
  9913. currentBlock.hasOnce = true;
  9914. }
  9915. }
  9916. function setupBlock(vnode) {
  9917. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9918. closeBlock();
  9919. if (isBlockTreeEnabled > 0 && currentBlock) {
  9920. currentBlock.push(vnode);
  9921. }
  9922. return vnode;
  9923. }
  9924. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9925. return setupBlock(
  9926. createBaseVNode(
  9927. type,
  9928. props,
  9929. children,
  9930. patchFlag,
  9931. dynamicProps,
  9932. shapeFlag,
  9933. true
  9934. )
  9935. );
  9936. }
  9937. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9938. return setupBlock(
  9939. createVNode(
  9940. type,
  9941. props,
  9942. children,
  9943. patchFlag,
  9944. dynamicProps,
  9945. true
  9946. )
  9947. );
  9948. }
  9949. function isVNode(value) {
  9950. return value ? value.__v_isVNode === true : false;
  9951. }
  9952. function isSameVNodeType(n1, n2) {
  9953. if (n2.shapeFlag & 6 && n1.component) {
  9954. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9955. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9956. n1.shapeFlag &= -257;
  9957. n2.shapeFlag &= -513;
  9958. return false;
  9959. }
  9960. }
  9961. return n1.type === n2.type && n1.key === n2.key;
  9962. }
  9963. let vnodeArgsTransformer;
  9964. function transformVNodeArgs(transformer) {
  9965. vnodeArgsTransformer = transformer;
  9966. }
  9967. const createVNodeWithArgsTransform = (...args) => {
  9968. return _createVNode(
  9969. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9970. );
  9971. };
  9972. const normalizeKey = ({ key }) => key != null ? key : null;
  9973. const normalizeRef = ({
  9974. ref,
  9975. ref_key,
  9976. ref_for
  9977. }) => {
  9978. if (typeof ref === "number") {
  9979. ref = "" + ref;
  9980. }
  9981. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9982. };
  9983. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9984. const vnode = {
  9985. __v_isVNode: true,
  9986. __v_skip: true,
  9987. type,
  9988. props,
  9989. key: props && normalizeKey(props),
  9990. ref: props && normalizeRef(props),
  9991. scopeId: currentScopeId,
  9992. slotScopeIds: null,
  9993. children,
  9994. component: null,
  9995. suspense: null,
  9996. ssContent: null,
  9997. ssFallback: null,
  9998. dirs: null,
  9999. transition: null,
  10000. el: null,
  10001. anchor: null,
  10002. target: null,
  10003. targetStart: null,
  10004. targetAnchor: null,
  10005. staticCount: 0,
  10006. shapeFlag,
  10007. patchFlag,
  10008. dynamicProps,
  10009. dynamicChildren: null,
  10010. appContext: null,
  10011. ctx: currentRenderingInstance
  10012. };
  10013. if (needFullChildrenNormalization) {
  10014. normalizeChildren(vnode, children);
  10015. if (shapeFlag & 128) {
  10016. type.normalize(vnode);
  10017. }
  10018. } else if (children) {
  10019. vnode.shapeFlag |= isString(children) ? 8 : 16;
  10020. }
  10021. if (vnode.key !== vnode.key) {
  10022. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  10023. }
  10024. if (props && vnode.shapeFlag & 1) {
  10025. const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
  10026. if (overwritingProp && hasContentChildren(vnode.children)) {
  10027. warn$1(
  10028. `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
  10029. );
  10030. }
  10031. }
  10032. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  10033. !isBlockNode && // has current parent block
  10034. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  10035. // component nodes also should always be patched, because even if the
  10036. // component doesn't need to update, it needs to persist the instance on to
  10037. // the next vnode so that it can be properly unmounted later.
  10038. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  10039. // vnode should not be considered dynamic due to handler caching.
  10040. vnode.patchFlag !== 32) {
  10041. currentBlock.push(vnode);
  10042. }
  10043. return vnode;
  10044. }
  10045. function hasContentChildren(children) {
  10046. if (isString(children)) return children !== "";
  10047. if (isArray(children)) return children.length > 0;
  10048. return false;
  10049. }
  10050. const createVNode = createVNodeWithArgsTransform ;
  10051. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  10052. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  10053. if (!type) {
  10054. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  10055. }
  10056. type = Comment;
  10057. }
  10058. if (isVNode(type)) {
  10059. const cloned = cloneVNode(
  10060. type,
  10061. props,
  10062. true
  10063. /* mergeRef: true */
  10064. );
  10065. if (children) {
  10066. normalizeChildren(cloned, children);
  10067. }
  10068. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  10069. if (cloned.shapeFlag & 6) {
  10070. currentBlock[currentBlock.indexOf(type)] = cloned;
  10071. } else {
  10072. currentBlock.push(cloned);
  10073. }
  10074. }
  10075. cloned.patchFlag = -2;
  10076. return cloned;
  10077. }
  10078. if (isClassComponent(type)) {
  10079. type = type.__vccOpts;
  10080. }
  10081. if (props) {
  10082. props = guardReactiveProps(props);
  10083. let { class: klass, style } = props;
  10084. if (klass && !isString(klass)) {
  10085. props.class = normalizeClass(klass);
  10086. }
  10087. if (isObject(style)) {
  10088. if (isProxy(style) && !isArray(style)) {
  10089. style = extend({}, style);
  10090. }
  10091. props.style = normalizeStyle(style);
  10092. }
  10093. }
  10094. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  10095. if (shapeFlag & 4 && isProxy(type)) {
  10096. type = toRaw(type);
  10097. warn$1(
  10098. `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\`.`,
  10099. `
  10100. Component that was made reactive: `,
  10101. type
  10102. );
  10103. }
  10104. return createBaseVNode(
  10105. type,
  10106. props,
  10107. children,
  10108. patchFlag,
  10109. dynamicProps,
  10110. shapeFlag,
  10111. isBlockNode,
  10112. true
  10113. );
  10114. }
  10115. function guardReactiveProps(props) {
  10116. if (!props) return null;
  10117. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  10118. }
  10119. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  10120. const { props, ref, patchFlag, children, transition } = vnode;
  10121. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  10122. const cloned = {
  10123. __v_isVNode: true,
  10124. __v_skip: true,
  10125. type: vnode.type,
  10126. props: mergedProps,
  10127. key: mergedProps && normalizeKey(mergedProps),
  10128. ref: extraProps && extraProps.ref ? (
  10129. // #2078 in the case of <component :is="vnode" ref="extra"/>
  10130. // if the vnode itself already has a ref, cloneVNode will need to merge
  10131. // the refs so the single vnode can be set on multiple refs
  10132. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  10133. ) : ref,
  10134. scopeId: vnode.scopeId,
  10135. slotScopeIds: vnode.slotScopeIds,
  10136. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  10137. target: vnode.target,
  10138. targetStart: vnode.targetStart,
  10139. targetAnchor: vnode.targetAnchor,
  10140. staticCount: vnode.staticCount,
  10141. shapeFlag: vnode.shapeFlag,
  10142. // if the vnode is cloned with extra props, we can no longer assume its
  10143. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  10144. // note: preserve flag for fragments since they use the flag for children
  10145. // fast paths only.
  10146. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  10147. dynamicProps: vnode.dynamicProps,
  10148. dynamicChildren: vnode.dynamicChildren,
  10149. appContext: vnode.appContext,
  10150. dirs: vnode.dirs,
  10151. transition,
  10152. // These should technically only be non-null on mounted VNodes. However,
  10153. // they *should* be copied for kept-alive vnodes. So we just always copy
  10154. // them since them being non-null during a mount doesn't affect the logic as
  10155. // they will simply be overwritten.
  10156. component: vnode.component,
  10157. suspense: vnode.suspense,
  10158. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  10159. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  10160. placeholder: vnode.placeholder,
  10161. el: vnode.el,
  10162. anchor: vnode.anchor,
  10163. ctx: vnode.ctx,
  10164. ce: vnode.ce
  10165. };
  10166. if (transition && cloneTransition) {
  10167. setTransitionHooks(
  10168. cloned,
  10169. transition.clone(cloned)
  10170. );
  10171. }
  10172. return cloned;
  10173. }
  10174. function deepCloneVNode(vnode) {
  10175. const cloned = cloneVNode(vnode);
  10176. if (isArray(vnode.children)) {
  10177. cloned.children = vnode.children.map(deepCloneVNode);
  10178. }
  10179. return cloned;
  10180. }
  10181. function createTextVNode(text = " ", flag = 0) {
  10182. return createVNode(Text, null, text, flag);
  10183. }
  10184. function createStaticVNode(content, numberOfNodes) {
  10185. const vnode = createVNode(Static, null, content);
  10186. vnode.staticCount = numberOfNodes;
  10187. return vnode;
  10188. }
  10189. function createCommentVNode(text = "", asBlock = false) {
  10190. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  10191. }
  10192. function normalizeVNode(child) {
  10193. if (child == null || typeof child === "boolean") {
  10194. return createVNode(Comment);
  10195. } else if (isArray(child)) {
  10196. return createVNode(
  10197. Fragment,
  10198. null,
  10199. // #3666, avoid reference pollution when reusing vnode
  10200. child.slice()
  10201. );
  10202. } else if (isVNode(child)) {
  10203. return cloneIfMounted(child);
  10204. } else {
  10205. return createVNode(Text, null, String(child));
  10206. }
  10207. }
  10208. function cloneIfMounted(child) {
  10209. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  10210. }
  10211. function normalizeChildren(vnode, children) {
  10212. let type = 0;
  10213. const { shapeFlag } = vnode;
  10214. if (children == null) {
  10215. children = null;
  10216. } else if (isArray(children)) {
  10217. type = 16;
  10218. } else if (typeof children === "object") {
  10219. if (shapeFlag & (1 | 64)) {
  10220. const slot = children.default;
  10221. if (slot) {
  10222. slot._c && (slot._d = false);
  10223. normalizeChildren(vnode, slot());
  10224. slot._c && (slot._d = true);
  10225. }
  10226. return;
  10227. } else {
  10228. type = 32;
  10229. const slotFlag = children._;
  10230. if (!slotFlag && !isInternalObject(children)) {
  10231. children._ctx = currentRenderingInstance;
  10232. } else if (slotFlag === 3 && currentRenderingInstance) {
  10233. if (currentRenderingInstance.slots._ === 1) {
  10234. children._ = 1;
  10235. } else {
  10236. children._ = 2;
  10237. vnode.patchFlag |= 1024;
  10238. }
  10239. }
  10240. }
  10241. } else if (isFunction(children)) {
  10242. if (shapeFlag & (1 | 64)) {
  10243. normalizeChildren(vnode, { default: children });
  10244. return;
  10245. }
  10246. children = { default: children, _ctx: currentRenderingInstance };
  10247. type = 32;
  10248. } else {
  10249. children = String(children);
  10250. if (shapeFlag & 64) {
  10251. type = 16;
  10252. children = [createTextVNode(children)];
  10253. } else {
  10254. type = 8;
  10255. }
  10256. }
  10257. vnode.children = children;
  10258. vnode.shapeFlag |= type;
  10259. }
  10260. function mergeProps(...args) {
  10261. const ret = {};
  10262. for (let i = 0; i < args.length; i++) {
  10263. const toMerge = args[i];
  10264. for (const key in toMerge) {
  10265. if (key === "class") {
  10266. if (ret.class !== toMerge.class) {
  10267. ret.class = normalizeClass([ret.class, toMerge.class]);
  10268. }
  10269. } else if (key === "style") {
  10270. ret.style = normalizeStyle([ret.style, toMerge.style]);
  10271. } else if (isOn(key)) {
  10272. const existing = ret[key];
  10273. const incoming = toMerge[key];
  10274. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  10275. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  10276. } else if (incoming == null && existing == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
  10277. // the model listener.
  10278. !isModelListener(key)) {
  10279. ret[key] = incoming;
  10280. }
  10281. } else if (key !== "") {
  10282. ret[key] = toMerge[key];
  10283. }
  10284. }
  10285. }
  10286. return ret;
  10287. }
  10288. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  10289. callWithAsyncErrorHandling(hook, instance, 7, [
  10290. vnode,
  10291. prevVNode
  10292. ]);
  10293. }
  10294. const emptyAppContext = createAppContext();
  10295. let uid = 0;
  10296. function createComponentInstance(vnode, parent, suspense) {
  10297. const type = vnode.type;
  10298. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  10299. const instance = {
  10300. uid: uid++,
  10301. vnode,
  10302. type,
  10303. parent,
  10304. appContext,
  10305. root: null,
  10306. // to be immediately set
  10307. next: null,
  10308. subTree: null,
  10309. // will be set synchronously right after creation
  10310. effect: null,
  10311. update: null,
  10312. // will be set synchronously right after creation
  10313. job: null,
  10314. scope: new EffectScope(
  10315. true
  10316. /* detached */
  10317. ),
  10318. render: null,
  10319. proxy: null,
  10320. exposed: null,
  10321. exposeProxy: null,
  10322. withProxy: null,
  10323. provides: parent ? parent.provides : Object.create(appContext.provides),
  10324. ids: parent ? parent.ids : ["", 0, 0],
  10325. accessCache: null,
  10326. renderCache: [],
  10327. // local resolved assets
  10328. components: null,
  10329. directives: null,
  10330. // resolved props and emits options
  10331. propsOptions: normalizePropsOptions(type, appContext),
  10332. emitsOptions: normalizeEmitsOptions(type, appContext),
  10333. // emit
  10334. emit: null,
  10335. // to be set immediately
  10336. emitted: null,
  10337. // props default value
  10338. propsDefaults: EMPTY_OBJ,
  10339. // inheritAttrs
  10340. inheritAttrs: type.inheritAttrs,
  10341. // state
  10342. ctx: EMPTY_OBJ,
  10343. data: EMPTY_OBJ,
  10344. props: EMPTY_OBJ,
  10345. attrs: EMPTY_OBJ,
  10346. slots: EMPTY_OBJ,
  10347. refs: EMPTY_OBJ,
  10348. setupState: EMPTY_OBJ,
  10349. setupContext: null,
  10350. // suspense related
  10351. suspense,
  10352. suspenseId: suspense ? suspense.pendingId : 0,
  10353. asyncDep: null,
  10354. asyncResolved: false,
  10355. // lifecycle hooks
  10356. // not using enums here because it results in computed properties
  10357. isMounted: false,
  10358. isUnmounted: false,
  10359. isDeactivated: false,
  10360. bc: null,
  10361. c: null,
  10362. bm: null,
  10363. m: null,
  10364. bu: null,
  10365. u: null,
  10366. um: null,
  10367. bum: null,
  10368. da: null,
  10369. a: null,
  10370. rtg: null,
  10371. rtc: null,
  10372. ec: null,
  10373. sp: null
  10374. };
  10375. {
  10376. instance.ctx = createDevRenderContext(instance);
  10377. }
  10378. instance.root = parent ? parent.root : instance;
  10379. instance.emit = emit.bind(null, instance);
  10380. if (vnode.ce) {
  10381. vnode.ce(instance);
  10382. }
  10383. return instance;
  10384. }
  10385. let currentInstance = null;
  10386. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  10387. let internalSetCurrentInstance;
  10388. let setInSSRSetupState;
  10389. {
  10390. const g = getGlobalThis();
  10391. const registerGlobalSetter = (key, setter) => {
  10392. let setters;
  10393. if (!(setters = g[key])) setters = g[key] = [];
  10394. setters.push(setter);
  10395. return (v) => {
  10396. if (setters.length > 1) setters.forEach((set) => set(v));
  10397. else setters[0](v);
  10398. };
  10399. };
  10400. internalSetCurrentInstance = registerGlobalSetter(
  10401. `__VUE_INSTANCE_SETTERS__`,
  10402. (v) => currentInstance = v
  10403. );
  10404. setInSSRSetupState = registerGlobalSetter(
  10405. `__VUE_SSR_SETTERS__`,
  10406. (v) => isInSSRComponentSetup = v
  10407. );
  10408. }
  10409. const setCurrentInstance = (instance) => {
  10410. const prev = currentInstance;
  10411. internalSetCurrentInstance(instance);
  10412. instance.scope.on();
  10413. return () => {
  10414. instance.scope.off();
  10415. internalSetCurrentInstance(prev);
  10416. };
  10417. };
  10418. const unsetCurrentInstance = () => {
  10419. currentInstance && currentInstance.scope.off();
  10420. internalSetCurrentInstance(null);
  10421. };
  10422. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  10423. function validateComponentName(name, { isNativeTag }) {
  10424. if (isBuiltInTag(name) || isNativeTag(name)) {
  10425. warn$1(
  10426. "Do not use built-in or reserved HTML elements as component id: " + name
  10427. );
  10428. }
  10429. }
  10430. function isStatefulComponent(instance) {
  10431. return instance.vnode.shapeFlag & 4;
  10432. }
  10433. let isInSSRComponentSetup = false;
  10434. function setupComponent(instance, isSSR = false, optimized = false) {
  10435. isSSR && setInSSRSetupState(isSSR);
  10436. const { props, children } = instance.vnode;
  10437. const isStateful = isStatefulComponent(instance);
  10438. initProps(instance, props, isStateful, isSSR);
  10439. initSlots(instance, children, optimized || isSSR);
  10440. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  10441. isSSR && setInSSRSetupState(false);
  10442. return setupResult;
  10443. }
  10444. function setupStatefulComponent(instance, isSSR) {
  10445. const Component = instance.type;
  10446. {
  10447. if (Component.name) {
  10448. validateComponentName(Component.name, instance.appContext.config);
  10449. }
  10450. if (Component.components) {
  10451. const names = Object.keys(Component.components);
  10452. for (let i = 0; i < names.length; i++) {
  10453. validateComponentName(names[i], instance.appContext.config);
  10454. }
  10455. }
  10456. if (Component.directives) {
  10457. const names = Object.keys(Component.directives);
  10458. for (let i = 0; i < names.length; i++) {
  10459. validateDirectiveName(names[i]);
  10460. }
  10461. }
  10462. if (Component.compilerOptions && isRuntimeOnly()) {
  10463. warn$1(
  10464. `"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.`
  10465. );
  10466. }
  10467. }
  10468. instance.accessCache = /* @__PURE__ */ Object.create(null);
  10469. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  10470. {
  10471. exposePropsOnRenderContext(instance);
  10472. }
  10473. const { setup } = Component;
  10474. if (setup) {
  10475. pauseTracking();
  10476. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  10477. const reset = setCurrentInstance(instance);
  10478. const setupResult = callWithErrorHandling(
  10479. setup,
  10480. instance,
  10481. 0,
  10482. [
  10483. shallowReadonly(instance.props) ,
  10484. setupContext
  10485. ]
  10486. );
  10487. const isAsyncSetup = isPromise(setupResult);
  10488. resetTracking();
  10489. reset();
  10490. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  10491. markAsyncBoundary(instance);
  10492. }
  10493. if (isAsyncSetup) {
  10494. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  10495. if (isSSR) {
  10496. return setupResult.then((resolvedResult) => {
  10497. setInSSRSetupState(true);
  10498. try {
  10499. handleSetupResult(instance, resolvedResult, isSSR);
  10500. } finally {
  10501. setInSSRSetupState(false);
  10502. }
  10503. }).catch((e) => {
  10504. handleError(e, instance, 0);
  10505. });
  10506. } else {
  10507. instance.asyncDep = setupResult;
  10508. if (!instance.suspense) {
  10509. const name = formatComponentName(instance, Component);
  10510. warn$1(
  10511. `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.`
  10512. );
  10513. }
  10514. }
  10515. } else {
  10516. handleSetupResult(instance, setupResult, isSSR);
  10517. }
  10518. } else {
  10519. finishComponentSetup(instance, isSSR);
  10520. }
  10521. }
  10522. function handleSetupResult(instance, setupResult, isSSR) {
  10523. if (isFunction(setupResult)) {
  10524. if (instance.type.__ssrInlineRender) {
  10525. instance.ssrRender = setupResult;
  10526. } else {
  10527. instance.render = setupResult;
  10528. }
  10529. } else if (isObject(setupResult)) {
  10530. if (isVNode(setupResult)) {
  10531. warn$1(
  10532. `setup() should not return VNodes directly - return a render function instead.`
  10533. );
  10534. }
  10535. {
  10536. instance.devtoolsRawSetupState = setupResult;
  10537. }
  10538. instance.setupState = proxyRefs(setupResult);
  10539. {
  10540. exposeSetupStateOnRenderContext(instance);
  10541. }
  10542. } else if (setupResult !== void 0) {
  10543. warn$1(
  10544. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10545. );
  10546. }
  10547. finishComponentSetup(instance, isSSR);
  10548. }
  10549. let compile$1;
  10550. let installWithProxy;
  10551. function registerRuntimeCompiler(_compile) {
  10552. compile$1 = _compile;
  10553. installWithProxy = (i) => {
  10554. if (i.render._rc) {
  10555. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10556. }
  10557. };
  10558. }
  10559. const isRuntimeOnly = () => !compile$1;
  10560. function finishComponentSetup(instance, isSSR, skipOptions) {
  10561. const Component = instance.type;
  10562. if (!instance.render) {
  10563. if (!isSSR && compile$1 && !Component.render) {
  10564. const template = Component.template || resolveMergedOptions(instance).template;
  10565. if (template) {
  10566. {
  10567. startMeasure(instance, `compile`);
  10568. }
  10569. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10570. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10571. const finalCompilerOptions = extend(
  10572. extend(
  10573. {
  10574. isCustomElement,
  10575. delimiters
  10576. },
  10577. compilerOptions
  10578. ),
  10579. componentCompilerOptions
  10580. );
  10581. Component.render = compile$1(template, finalCompilerOptions);
  10582. {
  10583. endMeasure(instance, `compile`);
  10584. }
  10585. }
  10586. }
  10587. instance.render = Component.render || NOOP;
  10588. if (installWithProxy) {
  10589. installWithProxy(instance);
  10590. }
  10591. }
  10592. {
  10593. const reset = setCurrentInstance(instance);
  10594. pauseTracking();
  10595. try {
  10596. applyOptions(instance);
  10597. } finally {
  10598. resetTracking();
  10599. reset();
  10600. }
  10601. }
  10602. if (!Component.render && instance.render === NOOP && !isSSR) {
  10603. if (!compile$1 && Component.template) {
  10604. warn$1(
  10605. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  10606. );
  10607. } else {
  10608. warn$1(`Component is missing template or render function: `, Component);
  10609. }
  10610. }
  10611. }
  10612. const attrsProxyHandlers = {
  10613. get(target, key) {
  10614. markAttrsAccessed();
  10615. track(target, "get", "");
  10616. return target[key];
  10617. },
  10618. set() {
  10619. warn$1(`setupContext.attrs is readonly.`);
  10620. return false;
  10621. },
  10622. deleteProperty() {
  10623. warn$1(`setupContext.attrs is readonly.`);
  10624. return false;
  10625. }
  10626. } ;
  10627. function getSlotsProxy(instance) {
  10628. return new Proxy(instance.slots, {
  10629. get(target, key) {
  10630. track(instance, "get", "$slots");
  10631. return target[key];
  10632. }
  10633. });
  10634. }
  10635. function createSetupContext(instance) {
  10636. const expose = (exposed) => {
  10637. {
  10638. if (instance.exposed) {
  10639. warn$1(`expose() should be called only once per setup().`);
  10640. }
  10641. if (exposed != null) {
  10642. let exposedType = typeof exposed;
  10643. if (exposedType === "object") {
  10644. if (isArray(exposed)) {
  10645. exposedType = "array";
  10646. } else if (isRef(exposed)) {
  10647. exposedType = "ref";
  10648. }
  10649. }
  10650. if (exposedType !== "object") {
  10651. warn$1(
  10652. `expose() should be passed a plain object, received ${exposedType}.`
  10653. );
  10654. }
  10655. }
  10656. }
  10657. instance.exposed = exposed || {};
  10658. };
  10659. {
  10660. let attrsProxy;
  10661. let slotsProxy;
  10662. return Object.freeze({
  10663. get attrs() {
  10664. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10665. },
  10666. get slots() {
  10667. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10668. },
  10669. get emit() {
  10670. return (event, ...args) => instance.emit(event, ...args);
  10671. },
  10672. expose
  10673. });
  10674. }
  10675. }
  10676. function getComponentPublicInstance(instance) {
  10677. if (instance.exposed) {
  10678. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10679. get(target, key) {
  10680. if (key in target) {
  10681. return target[key];
  10682. } else if (key in publicPropertiesMap) {
  10683. return publicPropertiesMap[key](instance);
  10684. }
  10685. },
  10686. has(target, key) {
  10687. return key in target || key in publicPropertiesMap;
  10688. }
  10689. }));
  10690. } else {
  10691. return instance.proxy;
  10692. }
  10693. }
  10694. const classifyRE = /(?:^|[-_])\w/g;
  10695. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10696. function getComponentName(Component, includeInferred = true) {
  10697. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10698. }
  10699. function formatComponentName(instance, Component, isRoot = false) {
  10700. let name = getComponentName(Component);
  10701. if (!name && Component.__file) {
  10702. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10703. if (match) {
  10704. name = match[1];
  10705. }
  10706. }
  10707. if (!name && instance) {
  10708. const inferFromRegistry = (registry) => {
  10709. for (const key in registry) {
  10710. if (registry[key] === Component) {
  10711. return key;
  10712. }
  10713. }
  10714. };
  10715. name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
  10716. instance.parent.type.components
  10717. ) || inferFromRegistry(instance.appContext.components);
  10718. }
  10719. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10720. }
  10721. function isClassComponent(value) {
  10722. return isFunction(value) && "__vccOpts" in value;
  10723. }
  10724. const computed = (getterOrOptions, debugOptions) => {
  10725. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10726. {
  10727. const i = getCurrentInstance();
  10728. if (i && i.appContext.config.warnRecursiveComputed) {
  10729. c._warnRecursive = true;
  10730. }
  10731. }
  10732. return c;
  10733. };
  10734. function h(type, propsOrChildren, children) {
  10735. try {
  10736. setBlockTracking(-1);
  10737. const l = arguments.length;
  10738. if (l === 2) {
  10739. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10740. if (isVNode(propsOrChildren)) {
  10741. return createVNode(type, null, [propsOrChildren]);
  10742. }
  10743. return createVNode(type, propsOrChildren);
  10744. } else {
  10745. return createVNode(type, null, propsOrChildren);
  10746. }
  10747. } else {
  10748. if (l > 3) {
  10749. children = Array.prototype.slice.call(arguments, 2);
  10750. } else if (l === 3 && isVNode(children)) {
  10751. children = [children];
  10752. }
  10753. return createVNode(type, propsOrChildren, children);
  10754. }
  10755. } finally {
  10756. setBlockTracking(1);
  10757. }
  10758. }
  10759. function initCustomFormatter() {
  10760. if (typeof window === "undefined") {
  10761. return;
  10762. }
  10763. const vueStyle = { style: "color:#3ba776" };
  10764. const numberStyle = { style: "color:#1677ff" };
  10765. const stringStyle = { style: "color:#f5222d" };
  10766. const keywordStyle = { style: "color:#eb2f96" };
  10767. const formatter = {
  10768. __vue_custom_formatter: true,
  10769. header(obj) {
  10770. if (!isObject(obj)) {
  10771. return null;
  10772. }
  10773. if (obj.__isVue) {
  10774. return ["div", vueStyle, `VueInstance`];
  10775. } else if (isRef(obj)) {
  10776. pauseTracking();
  10777. const value = obj.value;
  10778. resetTracking();
  10779. return [
  10780. "div",
  10781. {},
  10782. ["span", vueStyle, genRefFlag(obj)],
  10783. "<",
  10784. formatValue(value),
  10785. `>`
  10786. ];
  10787. } else if (isReactive(obj)) {
  10788. return [
  10789. "div",
  10790. {},
  10791. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10792. "<",
  10793. formatValue(obj),
  10794. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10795. ];
  10796. } else if (isReadonly(obj)) {
  10797. return [
  10798. "div",
  10799. {},
  10800. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10801. "<",
  10802. formatValue(obj),
  10803. ">"
  10804. ];
  10805. }
  10806. return null;
  10807. },
  10808. hasBody(obj) {
  10809. return obj && obj.__isVue;
  10810. },
  10811. body(obj) {
  10812. if (obj && obj.__isVue) {
  10813. return [
  10814. "div",
  10815. {},
  10816. ...formatInstance(obj.$)
  10817. ];
  10818. }
  10819. }
  10820. };
  10821. function formatInstance(instance) {
  10822. const blocks = [];
  10823. if (instance.type.props && instance.props) {
  10824. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10825. }
  10826. if (instance.setupState !== EMPTY_OBJ) {
  10827. blocks.push(createInstanceBlock("setup", instance.setupState));
  10828. }
  10829. if (instance.data !== EMPTY_OBJ) {
  10830. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10831. }
  10832. const computed = extractKeys(instance, "computed");
  10833. if (computed) {
  10834. blocks.push(createInstanceBlock("computed", computed));
  10835. }
  10836. const injected = extractKeys(instance, "inject");
  10837. if (injected) {
  10838. blocks.push(createInstanceBlock("injected", injected));
  10839. }
  10840. blocks.push([
  10841. "div",
  10842. {},
  10843. [
  10844. "span",
  10845. {
  10846. style: keywordStyle.style + ";opacity:0.66"
  10847. },
  10848. "$ (internal): "
  10849. ],
  10850. ["object", { object: instance }]
  10851. ]);
  10852. return blocks;
  10853. }
  10854. function createInstanceBlock(type, target) {
  10855. target = extend({}, target);
  10856. if (!Object.keys(target).length) {
  10857. return ["span", {}];
  10858. }
  10859. return [
  10860. "div",
  10861. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10862. [
  10863. "div",
  10864. {
  10865. style: "color:#476582"
  10866. },
  10867. type
  10868. ],
  10869. [
  10870. "div",
  10871. {
  10872. style: "padding-left:1.25em"
  10873. },
  10874. ...Object.keys(target).map((key) => {
  10875. return [
  10876. "div",
  10877. {},
  10878. ["span", keywordStyle, key + ": "],
  10879. formatValue(target[key], false)
  10880. ];
  10881. })
  10882. ]
  10883. ];
  10884. }
  10885. function formatValue(v, asRaw = true) {
  10886. if (typeof v === "number") {
  10887. return ["span", numberStyle, v];
  10888. } else if (typeof v === "string") {
  10889. return ["span", stringStyle, JSON.stringify(v)];
  10890. } else if (typeof v === "boolean") {
  10891. return ["span", keywordStyle, v];
  10892. } else if (isObject(v)) {
  10893. return ["object", { object: asRaw ? toRaw(v) : v }];
  10894. } else {
  10895. return ["span", stringStyle, String(v)];
  10896. }
  10897. }
  10898. function extractKeys(instance, type) {
  10899. const Comp = instance.type;
  10900. if (isFunction(Comp)) {
  10901. return;
  10902. }
  10903. const extracted = {};
  10904. for (const key in instance.ctx) {
  10905. if (isKeyOfType(Comp, key, type)) {
  10906. extracted[key] = instance.ctx[key];
  10907. }
  10908. }
  10909. return extracted;
  10910. }
  10911. function isKeyOfType(Comp, key, type) {
  10912. const opts = Comp[type];
  10913. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10914. return true;
  10915. }
  10916. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10917. return true;
  10918. }
  10919. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10920. return true;
  10921. }
  10922. }
  10923. function genRefFlag(v) {
  10924. if (isShallow(v)) {
  10925. return `ShallowRef`;
  10926. }
  10927. if (v.effect) {
  10928. return `ComputedRef`;
  10929. }
  10930. return `Ref`;
  10931. }
  10932. if (window.devtoolsFormatters) {
  10933. window.devtoolsFormatters.push(formatter);
  10934. } else {
  10935. window.devtoolsFormatters = [formatter];
  10936. }
  10937. }
  10938. function withMemo(memo, render, cache, index) {
  10939. const cached = cache[index];
  10940. if (cached && isMemoSame(cached, memo)) {
  10941. return cached;
  10942. }
  10943. const ret = render();
  10944. ret.memo = memo.slice();
  10945. ret.cacheIndex = index;
  10946. return cache[index] = ret;
  10947. }
  10948. function isMemoSame(cached, memo) {
  10949. const prev = cached.memo;
  10950. if (prev.length != memo.length) {
  10951. return false;
  10952. }
  10953. for (let i = 0; i < prev.length; i++) {
  10954. if (hasChanged(prev[i], memo[i])) {
  10955. return false;
  10956. }
  10957. }
  10958. if (isBlockTreeEnabled > 0 && currentBlock) {
  10959. currentBlock.push(cached);
  10960. }
  10961. return true;
  10962. }
  10963. const version = "3.5.41";
  10964. const warn = warn$1 ;
  10965. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10966. const devtools = devtools$1 ;
  10967. const setDevtoolsHook = setDevtoolsHook$1 ;
  10968. const _ssrUtils = {
  10969. createComponentInstance,
  10970. setupComponent,
  10971. renderComponentRoot,
  10972. setCurrentRenderingInstance,
  10973. isVNode: isVNode,
  10974. normalizeVNode,
  10975. getComponentPublicInstance,
  10976. ensureValidVNode,
  10977. pushWarningContext,
  10978. popWarningContext
  10979. };
  10980. const ssrUtils = _ssrUtils ;
  10981. const resolveFilter = null;
  10982. const compatUtils = null;
  10983. const DeprecationTypes = null;
  10984. let policy = void 0;
  10985. const tt = typeof window !== "undefined" && window.trustedTypes;
  10986. if (tt) {
  10987. try {
  10988. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10989. createHTML: (val) => val
  10990. });
  10991. } catch (e) {
  10992. warn(`Error creating trusted types policy: ${e}`);
  10993. }
  10994. }
  10995. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10996. const svgNS = "http://www.w3.org/2000/svg";
  10997. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10998. const doc = typeof document !== "undefined" ? document : null;
  10999. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  11000. const nodeOps = {
  11001. insert: (child, parent, anchor) => {
  11002. parent.insertBefore(child, anchor || null);
  11003. },
  11004. remove: (child) => {
  11005. const parent = child.parentNode;
  11006. if (parent) {
  11007. parent.removeChild(child);
  11008. }
  11009. },
  11010. createElement: (tag, namespace, is, props) => {
  11011. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  11012. if (tag === "select" && props && props.multiple != null) {
  11013. el.setAttribute("multiple", props.multiple);
  11014. }
  11015. return el;
  11016. },
  11017. createText: (text) => doc.createTextNode(text),
  11018. createComment: (text) => doc.createComment(text),
  11019. setText: (node, text) => {
  11020. node.nodeValue = text;
  11021. },
  11022. setElementText: (el, text) => {
  11023. el.textContent = text;
  11024. },
  11025. parentNode: (node) => node.parentNode,
  11026. nextSibling: (node) => node.nextSibling,
  11027. querySelector: (selector) => doc.querySelector(selector),
  11028. setScopeId(el, id) {
  11029. el.setAttribute(id, "");
  11030. },
  11031. // __UNSAFE__
  11032. // Reason: innerHTML.
  11033. // Static content here can only come from compiled templates.
  11034. // As long as the user only uses trusted templates, this is safe.
  11035. insertStaticContent(content, parent, anchor, namespace, start, end) {
  11036. const before = anchor ? anchor.previousSibling : parent.lastChild;
  11037. if (start && (start === end || start.nextSibling)) {
  11038. while (true) {
  11039. parent.insertBefore(start.cloneNode(true), anchor);
  11040. if (start === end || !(start = start.nextSibling)) break;
  11041. }
  11042. } else {
  11043. templateContainer.innerHTML = unsafeToTrustedHTML(
  11044. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  11045. );
  11046. const template = templateContainer.content;
  11047. if (namespace === "svg" || namespace === "mathml") {
  11048. const wrapper = template.firstChild;
  11049. while (wrapper.firstChild) {
  11050. template.appendChild(wrapper.firstChild);
  11051. }
  11052. template.removeChild(wrapper);
  11053. }
  11054. parent.insertBefore(template, anchor);
  11055. }
  11056. return [
  11057. // first
  11058. before ? before.nextSibling : parent.firstChild,
  11059. // last
  11060. anchor ? anchor.previousSibling : parent.lastChild
  11061. ];
  11062. }
  11063. };
  11064. const TRANSITION$1 = "transition";
  11065. const ANIMATION = "animation";
  11066. const vtcKey = /* @__PURE__ */ Symbol("_vtc");
  11067. const DOMTransitionPropsValidators = {
  11068. name: String,
  11069. type: String,
  11070. css: {
  11071. type: Boolean,
  11072. default: true
  11073. },
  11074. duration: [String, Number, Object],
  11075. enterFromClass: String,
  11076. enterActiveClass: String,
  11077. enterToClass: String,
  11078. appearFromClass: String,
  11079. appearActiveClass: String,
  11080. appearToClass: String,
  11081. leaveFromClass: String,
  11082. leaveActiveClass: String,
  11083. leaveToClass: String
  11084. };
  11085. const TransitionPropsValidators = /* @__PURE__ */ extend(
  11086. {},
  11087. BaseTransitionPropsValidators,
  11088. DOMTransitionPropsValidators
  11089. );
  11090. const decorate$1 = (t) => {
  11091. t.displayName = "Transition";
  11092. t.props = TransitionPropsValidators;
  11093. return t;
  11094. };
  11095. const Transition = /* @__PURE__ */ decorate$1(
  11096. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  11097. );
  11098. const callHook = (hook, args = []) => {
  11099. if (isArray(hook)) {
  11100. hook.forEach((h2) => h2(...args));
  11101. } else if (hook) {
  11102. hook(...args);
  11103. }
  11104. };
  11105. const hasExplicitCallback = (hook) => {
  11106. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  11107. };
  11108. function resolveTransitionProps(rawProps) {
  11109. const baseProps = {};
  11110. for (const key in rawProps) {
  11111. if (!(key in DOMTransitionPropsValidators)) {
  11112. baseProps[key] = rawProps[key];
  11113. }
  11114. }
  11115. if (rawProps.css === false) {
  11116. return baseProps;
  11117. }
  11118. const {
  11119. name = "v",
  11120. type,
  11121. duration,
  11122. enterFromClass = `${name}-enter-from`,
  11123. enterActiveClass = `${name}-enter-active`,
  11124. enterToClass = `${name}-enter-to`,
  11125. appearFromClass = enterFromClass,
  11126. appearActiveClass = enterActiveClass,
  11127. appearToClass = enterToClass,
  11128. leaveFromClass = `${name}-leave-from`,
  11129. leaveActiveClass = `${name}-leave-active`,
  11130. leaveToClass = `${name}-leave-to`
  11131. } = rawProps;
  11132. const durations = normalizeDuration(duration);
  11133. const enterDuration = durations && durations[0];
  11134. const leaveDuration = durations && durations[1];
  11135. const {
  11136. onBeforeEnter,
  11137. onEnter,
  11138. onEnterCancelled,
  11139. onLeave,
  11140. onLeaveCancelled,
  11141. onBeforeAppear = onBeforeEnter,
  11142. onAppear = onEnter,
  11143. onAppearCancelled = onEnterCancelled
  11144. } = baseProps;
  11145. const finishEnter = (el, isAppear, done, isCancelled) => {
  11146. el._enterCancelled = isCancelled;
  11147. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  11148. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  11149. done && done();
  11150. };
  11151. const finishLeave = (el, done) => {
  11152. el._isLeaving = false;
  11153. removeTransitionClass(el, leaveFromClass);
  11154. removeTransitionClass(el, leaveToClass);
  11155. removeTransitionClass(el, leaveActiveClass);
  11156. done && done();
  11157. };
  11158. const makeEnterHook = (isAppear) => {
  11159. return (el, done) => {
  11160. const hook = isAppear ? onAppear : onEnter;
  11161. const resolve = () => finishEnter(el, isAppear, done);
  11162. callHook(hook, [el, resolve]);
  11163. nextFrame(() => {
  11164. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  11165. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  11166. if (!hasExplicitCallback(hook)) {
  11167. whenTransitionEnds(el, type, enterDuration, resolve);
  11168. }
  11169. });
  11170. };
  11171. };
  11172. return extend(baseProps, {
  11173. onBeforeEnter(el) {
  11174. callHook(onBeforeEnter, [el]);
  11175. addTransitionClass(el, enterFromClass);
  11176. addTransitionClass(el, enterActiveClass);
  11177. },
  11178. onBeforeAppear(el) {
  11179. callHook(onBeforeAppear, [el]);
  11180. addTransitionClass(el, appearFromClass);
  11181. addTransitionClass(el, appearActiveClass);
  11182. },
  11183. onEnter: makeEnterHook(false),
  11184. onAppear: makeEnterHook(true),
  11185. onLeave(el, done) {
  11186. el._isLeaving = true;
  11187. const resolve = () => finishLeave(el, done);
  11188. addTransitionClass(el, leaveFromClass);
  11189. if (!el._enterCancelled) {
  11190. forceReflow(el);
  11191. addTransitionClass(el, leaveActiveClass);
  11192. } else {
  11193. addTransitionClass(el, leaveActiveClass);
  11194. forceReflow(el);
  11195. }
  11196. nextFrame(() => {
  11197. if (!el._isLeaving) {
  11198. return;
  11199. }
  11200. removeTransitionClass(el, leaveFromClass);
  11201. addTransitionClass(el, leaveToClass);
  11202. if (!hasExplicitCallback(onLeave)) {
  11203. whenTransitionEnds(el, type, leaveDuration, resolve);
  11204. }
  11205. });
  11206. callHook(onLeave, [el, resolve]);
  11207. },
  11208. onEnterCancelled(el) {
  11209. finishEnter(el, false, void 0, true);
  11210. callHook(onEnterCancelled, [el]);
  11211. },
  11212. onAppearCancelled(el) {
  11213. finishEnter(el, true, void 0, true);
  11214. callHook(onAppearCancelled, [el]);
  11215. },
  11216. onLeaveCancelled(el) {
  11217. finishLeave(el);
  11218. callHook(onLeaveCancelled, [el]);
  11219. }
  11220. });
  11221. }
  11222. function normalizeDuration(duration) {
  11223. if (duration == null) {
  11224. return null;
  11225. } else if (isObject(duration)) {
  11226. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  11227. } else {
  11228. const n = NumberOf(duration);
  11229. return [n, n];
  11230. }
  11231. }
  11232. function NumberOf(val) {
  11233. const res = toNumber(val);
  11234. {
  11235. assertNumber(res, "<transition> explicit duration");
  11236. }
  11237. return res;
  11238. }
  11239. function addTransitionClass(el, cls) {
  11240. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  11241. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  11242. }
  11243. function removeTransitionClass(el, cls) {
  11244. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  11245. const _vtc = el[vtcKey];
  11246. if (_vtc) {
  11247. _vtc.delete(cls);
  11248. if (!_vtc.size) {
  11249. el[vtcKey] = void 0;
  11250. }
  11251. }
  11252. }
  11253. function nextFrame(cb) {
  11254. requestAnimationFrame(() => {
  11255. requestAnimationFrame(cb);
  11256. });
  11257. }
  11258. let endId = 0;
  11259. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  11260. const id = el._endId = ++endId;
  11261. const resolveIfNotStale = () => {
  11262. if (id === el._endId) {
  11263. resolve();
  11264. }
  11265. };
  11266. if (explicitTimeout != null) {
  11267. return setTimeout(resolveIfNotStale, explicitTimeout);
  11268. }
  11269. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  11270. if (!type) {
  11271. return resolve();
  11272. }
  11273. const endEvent = type + "end";
  11274. let ended = 0;
  11275. const end = () => {
  11276. el.removeEventListener(endEvent, onEnd);
  11277. resolveIfNotStale();
  11278. };
  11279. const onEnd = (e) => {
  11280. if (e.target === el && ++ended >= propCount) {
  11281. end();
  11282. }
  11283. };
  11284. setTimeout(() => {
  11285. if (ended < propCount) {
  11286. end();
  11287. }
  11288. }, timeout + 1);
  11289. el.addEventListener(endEvent, onEnd);
  11290. }
  11291. function getTransitionInfo(el, expectedType) {
  11292. const styles = window.getComputedStyle(el);
  11293. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  11294. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  11295. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  11296. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  11297. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  11298. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  11299. const animationTimeout = getTimeout(animationDelays, animationDurations);
  11300. let type = null;
  11301. let timeout = 0;
  11302. let propCount = 0;
  11303. if (expectedType === TRANSITION$1) {
  11304. if (transitionTimeout > 0) {
  11305. type = TRANSITION$1;
  11306. timeout = transitionTimeout;
  11307. propCount = transitionDurations.length;
  11308. }
  11309. } else if (expectedType === ANIMATION) {
  11310. if (animationTimeout > 0) {
  11311. type = ANIMATION;
  11312. timeout = animationTimeout;
  11313. propCount = animationDurations.length;
  11314. }
  11315. } else {
  11316. timeout = Math.max(transitionTimeout, animationTimeout);
  11317. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  11318. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  11319. }
  11320. const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
  11321. getStyleProperties(`${TRANSITION$1}Property`).toString()
  11322. );
  11323. return {
  11324. type,
  11325. timeout,
  11326. propCount,
  11327. hasTransform
  11328. };
  11329. }
  11330. function getTimeout(delays, durations) {
  11331. while (delays.length < durations.length) {
  11332. delays = delays.concat(delays);
  11333. }
  11334. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  11335. }
  11336. function toMs(s) {
  11337. if (s === "auto") return 0;
  11338. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  11339. }
  11340. function forceReflow(el) {
  11341. const targetDocument = el ? el.ownerDocument : document;
  11342. return targetDocument.body.offsetHeight;
  11343. }
  11344. function patchClass(el, value, isSVG) {
  11345. const transitionClasses = el[vtcKey];
  11346. if (transitionClasses) {
  11347. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  11348. }
  11349. if (value == null) {
  11350. el.removeAttribute("class");
  11351. } else if (isSVG) {
  11352. el.setAttribute("class", value);
  11353. } else {
  11354. el.className = value;
  11355. }
  11356. }
  11357. const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod");
  11358. const vShowHidden = /* @__PURE__ */ Symbol("_vsh");
  11359. const vShow = {
  11360. // used for prop mismatch check during hydration
  11361. name: "show",
  11362. beforeMount(el, { value }, { transition }) {
  11363. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  11364. if (transition && value) {
  11365. transition.beforeEnter(el);
  11366. } else {
  11367. setDisplay(el, value);
  11368. }
  11369. },
  11370. mounted(el, { value }, { transition }) {
  11371. if (transition && value) {
  11372. transition.enter(el);
  11373. }
  11374. },
  11375. updated(el, { value, oldValue }, { transition }) {
  11376. if (!value === !oldValue) return;
  11377. if (transition) {
  11378. if (value) {
  11379. transition.beforeEnter(el);
  11380. setDisplay(el, true);
  11381. transition.enter(el);
  11382. } else {
  11383. transition.leave(el, () => {
  11384. setDisplay(el, false);
  11385. });
  11386. }
  11387. } else {
  11388. setDisplay(el, value);
  11389. }
  11390. },
  11391. beforeUnmount(el, { value }) {
  11392. setDisplay(el, value);
  11393. }
  11394. };
  11395. function setDisplay(el, value) {
  11396. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  11397. el[vShowHidden] = !value;
  11398. }
  11399. function initVShowForSSR() {
  11400. vShow.getSSRProps = ({ value }) => {
  11401. if (!value) {
  11402. return { style: { display: "none" } };
  11403. }
  11404. };
  11405. }
  11406. const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("CSS_VAR_TEXT" );
  11407. function useCssVars(getter) {
  11408. const instance = getCurrentInstance();
  11409. if (!instance) {
  11410. warn(`useCssVars is called without current active component instance.`);
  11411. return;
  11412. }
  11413. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  11414. Array.from(
  11415. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  11416. ).forEach((node) => setVarsOnNode(node, vars));
  11417. };
  11418. {
  11419. instance.getCssVars = () => getter(instance.proxy);
  11420. }
  11421. const setVars = () => {
  11422. const vars = getter(instance.proxy);
  11423. if (instance.ce) {
  11424. setVarsOnNode(instance.ce, vars);
  11425. } else {
  11426. setVarsOnVNode(instance.subTree, vars);
  11427. }
  11428. updateTeleports(vars);
  11429. };
  11430. onBeforeUpdate(() => {
  11431. queuePostFlushCb(setVars);
  11432. });
  11433. onMounted(() => {
  11434. watch(setVars, NOOP, { flush: "post" });
  11435. const ob = new MutationObserver(setVars);
  11436. ob.observe(instance.subTree.el.parentNode, { childList: true });
  11437. onUnmounted(() => ob.disconnect());
  11438. });
  11439. }
  11440. function setVarsOnVNode(vnode, vars) {
  11441. if (vnode.shapeFlag & 128) {
  11442. const suspense = vnode.suspense;
  11443. vnode = suspense.activeBranch;
  11444. if (suspense.pendingBranch && !suspense.isHydrating) {
  11445. suspense.effects.push(() => {
  11446. setVarsOnVNode(suspense.activeBranch, vars);
  11447. });
  11448. }
  11449. }
  11450. while (vnode.component) {
  11451. vnode = vnode.component.subTree;
  11452. }
  11453. if (vnode.shapeFlag & 1 && vnode.el) {
  11454. setVarsOnNode(vnode.el, vars);
  11455. } else if (vnode.type === Fragment) {
  11456. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  11457. } else if (vnode.type === Static) {
  11458. let { el, anchor } = vnode;
  11459. while (el) {
  11460. setVarsOnNode(el, vars);
  11461. if (el === anchor) break;
  11462. el = el.nextSibling;
  11463. }
  11464. }
  11465. }
  11466. function setVarsOnNode(el, vars) {
  11467. if (el.nodeType === 1) {
  11468. const style = el.style;
  11469. let cssText = "";
  11470. for (const key in vars) {
  11471. const value = normalizeCssVarValue(vars[key]);
  11472. style.setProperty(`--${key}`, value);
  11473. cssText += `--${key}: ${value};`;
  11474. }
  11475. style[CSS_VAR_TEXT] = cssText;
  11476. }
  11477. }
  11478. const displayRE = /(?:^|;)\s*display\s*:/;
  11479. function patchStyle(el, prev, next) {
  11480. const style = el.style;
  11481. const isCssString = isString(next);
  11482. let hasControlledDisplay = false;
  11483. if (next && !isCssString) {
  11484. if (prev) {
  11485. if (!isString(prev)) {
  11486. for (const key in prev) {
  11487. if (next[key] == null) {
  11488. setStyle(style, key, "");
  11489. }
  11490. }
  11491. } else {
  11492. for (const prevStyle of prev.split(";")) {
  11493. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  11494. if (next[key] == null) {
  11495. setStyle(style, key, "");
  11496. }
  11497. }
  11498. }
  11499. }
  11500. for (const key in next) {
  11501. if (key === "display") {
  11502. hasControlledDisplay = true;
  11503. }
  11504. const value = next[key];
  11505. if (value != null) {
  11506. if (!shouldPreserveTextareaResizeStyle(
  11507. el,
  11508. key,
  11509. !isString(prev) && prev ? prev[key] : void 0,
  11510. value
  11511. )) {
  11512. setStyle(style, key, value);
  11513. }
  11514. } else {
  11515. setStyle(style, key, "");
  11516. }
  11517. }
  11518. } else {
  11519. if (isCssString) {
  11520. if (prev !== next) {
  11521. const cssVarText = style[CSS_VAR_TEXT];
  11522. if (cssVarText) {
  11523. next += ";" + cssVarText;
  11524. }
  11525. style.cssText = next;
  11526. hasControlledDisplay = displayRE.test(next);
  11527. }
  11528. } else if (prev) {
  11529. el.removeAttribute("style");
  11530. }
  11531. }
  11532. if (vShowOriginalDisplay in el) {
  11533. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  11534. if (el[vShowHidden]) {
  11535. style.display = "none";
  11536. }
  11537. }
  11538. }
  11539. const semicolonRE = /[^\\];\s*$/;
  11540. const importantRE = /\s*!important$/;
  11541. function setStyle(style, name, val) {
  11542. if (isArray(val)) {
  11543. val.forEach((v) => setStyle(style, name, v));
  11544. } else {
  11545. if (val == null) val = "";
  11546. {
  11547. if (semicolonRE.test(val)) {
  11548. warn(
  11549. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  11550. );
  11551. }
  11552. }
  11553. if (name.startsWith("--")) {
  11554. style.setProperty(name, val);
  11555. } else {
  11556. const prefixed = autoPrefix(style, name);
  11557. if (importantRE.test(val)) {
  11558. style.setProperty(
  11559. hyphenate(prefixed),
  11560. val.replace(importantRE, ""),
  11561. "important"
  11562. );
  11563. } else {
  11564. style[prefixed] = val;
  11565. }
  11566. }
  11567. }
  11568. }
  11569. const prefixes = ["Webkit", "Moz", "ms"];
  11570. const prefixCache = {};
  11571. function autoPrefix(style, rawName) {
  11572. const cached = prefixCache[rawName];
  11573. if (cached) {
  11574. return cached;
  11575. }
  11576. let name = camelize(rawName);
  11577. if (name !== "filter" && name in style) {
  11578. return prefixCache[rawName] = name;
  11579. }
  11580. name = capitalize(name);
  11581. for (let i = 0; i < prefixes.length; i++) {
  11582. const prefixed = prefixes[i] + name;
  11583. if (prefixed in style) {
  11584. return prefixCache[rawName] = prefixed;
  11585. }
  11586. }
  11587. return rawName;
  11588. }
  11589. function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
  11590. return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
  11591. }
  11592. const xlinkNS = "http://www.w3.org/1999/xlink";
  11593. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11594. if (isSVG && key.startsWith("xlink:")) {
  11595. if (value == null) {
  11596. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11597. } else {
  11598. el.setAttributeNS(xlinkNS, key, value);
  11599. }
  11600. } else {
  11601. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11602. el.removeAttribute(key);
  11603. } else {
  11604. el.setAttribute(
  11605. key,
  11606. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11607. );
  11608. }
  11609. }
  11610. }
  11611. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11612. if (key === "innerHTML" || key === "textContent") {
  11613. if (value != null) {
  11614. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11615. }
  11616. return;
  11617. }
  11618. const tag = el.tagName;
  11619. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11620. !tag.includes("-")) {
  11621. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11622. const newValue = value == null ? (
  11623. // #11647: value should be set as empty string for null and undefined,
  11624. // but <input type="checkbox"> should be set as 'on'.
  11625. el.type === "checkbox" ? "on" : ""
  11626. ) : String(value);
  11627. if (oldValue !== newValue || !("_value" in el)) {
  11628. el.value = newValue;
  11629. }
  11630. if (value == null) {
  11631. el.removeAttribute(key);
  11632. }
  11633. el._value = value;
  11634. return;
  11635. }
  11636. let needRemove = false;
  11637. if (value === "" || value == null) {
  11638. const type = typeof el[key];
  11639. if (type === "boolean") {
  11640. value = includeBooleanAttr(value);
  11641. } else if (value == null && type === "string") {
  11642. value = "";
  11643. needRemove = true;
  11644. } else if (type === "number") {
  11645. value = 0;
  11646. needRemove = true;
  11647. }
  11648. }
  11649. try {
  11650. el[key] = value;
  11651. } catch (e) {
  11652. if (!needRemove) {
  11653. warn(
  11654. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11655. e
  11656. );
  11657. }
  11658. }
  11659. needRemove && el.removeAttribute(attrName || key);
  11660. }
  11661. function addEventListener(el, event, handler, options) {
  11662. el.addEventListener(event, handler, options);
  11663. }
  11664. function removeEventListener(el, event, handler, options) {
  11665. el.removeEventListener(event, handler, options);
  11666. }
  11667. const veiKey = /* @__PURE__ */ Symbol("_vei");
  11668. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11669. const invokers = el[veiKey] || (el[veiKey] = {});
  11670. const existingInvoker = invokers[rawName];
  11671. if (nextValue && existingInvoker) {
  11672. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11673. } else {
  11674. const [name, options] = parseName(rawName);
  11675. if (nextValue) {
  11676. const invoker = invokers[rawName] = createInvoker(
  11677. sanitizeEventValue(nextValue, rawName) ,
  11678. instance
  11679. );
  11680. addEventListener(el, name, invoker, options);
  11681. } else if (existingInvoker) {
  11682. removeEventListener(el, name, existingInvoker, options);
  11683. invokers[rawName] = void 0;
  11684. }
  11685. }
  11686. }
  11687. const optionsModifierRE = /(Once|Passive|Capture)$/;
  11688. const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
  11689. function parseName(name) {
  11690. let options;
  11691. let m;
  11692. while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
  11693. if (!options) options = {};
  11694. name = name.slice(0, name.length - m[1].length);
  11695. options[m[1].toLowerCase()] = true;
  11696. }
  11697. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11698. return [event, options];
  11699. }
  11700. let cachedNow = 0;
  11701. const p = /* @__PURE__ */ Promise.resolve();
  11702. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11703. function createInvoker(initialValue, instance) {
  11704. const invoker = (e) => {
  11705. if (!e._vts) {
  11706. e._vts = Date.now();
  11707. } else if (e._vts <= invoker.attached) {
  11708. return;
  11709. }
  11710. const value = invoker.value;
  11711. if (isArray(value)) {
  11712. const originalStop = e.stopImmediatePropagation;
  11713. e.stopImmediatePropagation = () => {
  11714. originalStop.call(e);
  11715. e._stopped = true;
  11716. };
  11717. const handlers = value.slice();
  11718. const args = [e];
  11719. for (let i = 0; i < handlers.length; i++) {
  11720. if (e._stopped) {
  11721. break;
  11722. }
  11723. const handler = handlers[i];
  11724. if (handler) {
  11725. callWithAsyncErrorHandling(
  11726. handler,
  11727. instance,
  11728. 5,
  11729. args
  11730. );
  11731. }
  11732. }
  11733. } else {
  11734. callWithAsyncErrorHandling(
  11735. value,
  11736. instance,
  11737. 5,
  11738. [e]
  11739. );
  11740. }
  11741. };
  11742. invoker.value = initialValue;
  11743. invoker.attached = getNow();
  11744. return invoker;
  11745. }
  11746. function sanitizeEventValue(value, propName) {
  11747. if (isFunction(value) || isArray(value)) {
  11748. return value;
  11749. }
  11750. warn(
  11751. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11752. Expected function or array of functions, received type ${typeof value}.`
  11753. );
  11754. return NOOP;
  11755. }
  11756. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11757. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11758. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11759. const isSVG = namespace === "svg";
  11760. if (key === "class") {
  11761. patchClass(el, nextValue, isSVG);
  11762. } else if (key === "style") {
  11763. patchStyle(el, prevValue, nextValue);
  11764. } else if (isOn(key)) {
  11765. if (!isModelListener(key)) {
  11766. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11767. }
  11768. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11769. patchDOMProp(el, key, nextValue);
  11770. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11771. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11772. }
  11773. } else if (
  11774. // #11081 force set props for possible async custom element
  11775. el._isVueCE && // #12408 check if it's declared prop or it's async custom element
  11776. (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
  11777. el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
  11778. ) {
  11779. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11780. } else {
  11781. if (key === "true-value") {
  11782. el._trueValue = nextValue;
  11783. } else if (key === "false-value") {
  11784. el._falseValue = nextValue;
  11785. }
  11786. patchAttr(el, key, nextValue, isSVG);
  11787. }
  11788. };
  11789. function shouldSetAsProp(el, key, value, isSVG) {
  11790. if (isSVG) {
  11791. if (key === "innerHTML" || key === "textContent") {
  11792. return true;
  11793. }
  11794. if (key in el && isNativeOn(key) && isFunction(value)) {
  11795. return true;
  11796. }
  11797. return false;
  11798. }
  11799. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  11800. return false;
  11801. }
  11802. if (key === "sandbox" && el.tagName === "IFRAME") {
  11803. return false;
  11804. }
  11805. if (key === "form") {
  11806. return false;
  11807. }
  11808. if (key === "list" && el.tagName === "INPUT") {
  11809. return false;
  11810. }
  11811. if (key === "type" && el.tagName === "TEXTAREA") {
  11812. return false;
  11813. }
  11814. if (key === "width" || key === "height") {
  11815. const tag = el.tagName;
  11816. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11817. return false;
  11818. }
  11819. }
  11820. if (isNativeOn(key) && isString(value)) {
  11821. return false;
  11822. }
  11823. return key in el;
  11824. }
  11825. function shouldSetAsPropForVueCE(el, key) {
  11826. const props = (
  11827. // @ts-expect-error _def is private
  11828. el._def.props
  11829. );
  11830. if (!props) {
  11831. return false;
  11832. }
  11833. const camelKey = camelize(key);
  11834. return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
  11835. }
  11836. const REMOVAL = {};
  11837. // @__NO_SIDE_EFFECTS__
  11838. function defineCustomElement(options, extraOptions, _createApp) {
  11839. let Comp = defineComponent(options, extraOptions);
  11840. if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
  11841. class VueCustomElement extends VueElement {
  11842. constructor(initialProps) {
  11843. super(Comp, initialProps, _createApp);
  11844. }
  11845. }
  11846. VueCustomElement.def = Comp;
  11847. return VueCustomElement;
  11848. }
  11849. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11850. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11851. });
  11852. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11853. };
  11854. class VueElement extends BaseClass {
  11855. constructor(_def, _props = {}, _createApp = createApp) {
  11856. super();
  11857. this._def = _def;
  11858. this._props = _props;
  11859. this._createApp = _createApp;
  11860. this._isVueCE = true;
  11861. /**
  11862. * @internal
  11863. */
  11864. this._instance = null;
  11865. /**
  11866. * @internal
  11867. */
  11868. this._app = null;
  11869. /**
  11870. * @internal
  11871. */
  11872. this._nonce = this._def.nonce;
  11873. this._connected = false;
  11874. this._resolved = false;
  11875. this._patching = false;
  11876. this._dirty = false;
  11877. this._numberProps = null;
  11878. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11879. this._styleAnchors = /* @__PURE__ */ new WeakMap();
  11880. this._ob = null;
  11881. if (this.shadowRoot && _createApp !== createApp) {
  11882. this._root = this.shadowRoot;
  11883. } else {
  11884. if (this.shadowRoot) {
  11885. warn(
  11886. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11887. );
  11888. }
  11889. if (_def.shadowRoot !== false) {
  11890. this.attachShadow(
  11891. extend({}, _def.shadowRootOptions, {
  11892. mode: "open"
  11893. })
  11894. );
  11895. this._root = this.shadowRoot;
  11896. } else {
  11897. this._root = this;
  11898. }
  11899. }
  11900. }
  11901. connectedCallback() {
  11902. if (!this.isConnected) return;
  11903. if (!this.shadowRoot && !this._resolved) {
  11904. this._parseSlots();
  11905. }
  11906. this._connected = true;
  11907. let parent = this;
  11908. while (parent = parent && // #12479 should check assignedSlot first to get correct parent
  11909. (parent.assignedSlot || parent.parentNode || parent.host)) {
  11910. if (parent instanceof VueElement) {
  11911. this._parent = parent;
  11912. break;
  11913. }
  11914. }
  11915. if (!this._instance) {
  11916. if (this._resolved) {
  11917. this._mount(this._def);
  11918. } else {
  11919. if (parent && parent._pendingResolve) {
  11920. this._pendingResolve = parent._pendingResolve.then(() => {
  11921. this._pendingResolve = void 0;
  11922. if (this.isConnected) {
  11923. return this._resolveDef();
  11924. }
  11925. });
  11926. } else {
  11927. this._resolveDef();
  11928. }
  11929. }
  11930. }
  11931. }
  11932. _setParent(parent = this._parent) {
  11933. if (parent) {
  11934. this._instance.parent = parent._instance;
  11935. this._inheritParentContext(parent);
  11936. }
  11937. }
  11938. _inheritParentContext(parent = this._parent) {
  11939. if (parent && this._app) {
  11940. Object.setPrototypeOf(
  11941. this._app._context.provides,
  11942. parent._instance.provides
  11943. );
  11944. }
  11945. }
  11946. disconnectedCallback() {
  11947. this._connected = false;
  11948. nextTick(() => {
  11949. if (!this._connected) {
  11950. if (this._ob) {
  11951. this._ob.disconnect();
  11952. this._ob = null;
  11953. }
  11954. this._app && this._app.unmount();
  11955. if (this._instance) this._instance.ce = void 0;
  11956. this._app = this._instance = null;
  11957. if (this._teleportTargets) {
  11958. this._teleportTargets.clear();
  11959. this._teleportTargets = void 0;
  11960. }
  11961. }
  11962. });
  11963. }
  11964. _processMutations(mutations) {
  11965. for (const m of mutations) {
  11966. this._setAttr(m.attributeName);
  11967. }
  11968. }
  11969. /**
  11970. * resolve inner component definition (handle possible async component)
  11971. */
  11972. _resolveDef() {
  11973. if (this._pendingResolve) {
  11974. return this._pendingResolve;
  11975. }
  11976. for (let i = 0; i < this.attributes.length; i++) {
  11977. this._setAttr(this.attributes[i].name);
  11978. }
  11979. this._ob = new MutationObserver(this._processMutations.bind(this));
  11980. this._ob.observe(this, { attributes: true });
  11981. const resolve = (def, isAsync = false) => {
  11982. this._resolved = true;
  11983. this._pendingResolve = void 0;
  11984. const { props, styles } = def;
  11985. let numberProps;
  11986. if (props && !isArray(props)) {
  11987. for (const key in props) {
  11988. const opt = props[key];
  11989. if (opt === Number || opt && opt.type === Number) {
  11990. if (key in this._props) {
  11991. this._props[key] = toNumber(this._props[key]);
  11992. }
  11993. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11994. }
  11995. }
  11996. }
  11997. this._numberProps = numberProps;
  11998. this._resolveProps(def);
  11999. if (this.shadowRoot) {
  12000. this._applyStyles(styles);
  12001. } else if (styles) {
  12002. warn(
  12003. "Custom element style injection is not supported when using shadowRoot: false"
  12004. );
  12005. }
  12006. this._mount(def);
  12007. };
  12008. const asyncDef = this._def.__asyncLoader;
  12009. if (asyncDef) {
  12010. this._pendingResolve = asyncDef().then((def) => {
  12011. def.configureApp = this._def.configureApp;
  12012. resolve(this._def = def, true);
  12013. });
  12014. return this._pendingResolve;
  12015. } else {
  12016. resolve(this._def);
  12017. }
  12018. }
  12019. _mount(def) {
  12020. if (!def.name) {
  12021. def.name = "VueElement";
  12022. }
  12023. this._app = this._createApp(def);
  12024. this._inheritParentContext();
  12025. if (def.configureApp) {
  12026. def.configureApp(this._app);
  12027. }
  12028. this._app._ceVNode = this._createVNode();
  12029. this._app.mount(this._root);
  12030. const exposed = this._instance && this._instance.exposed;
  12031. if (!exposed) return;
  12032. for (const key in exposed) {
  12033. if (!hasOwn(this, key)) {
  12034. Object.defineProperty(this, key, {
  12035. // unwrap ref to be consistent with public instance behavior
  12036. get: () => unref(exposed[key])
  12037. });
  12038. } else {
  12039. warn(`Exposed property "${key}" already exists on custom element.`);
  12040. }
  12041. }
  12042. }
  12043. _resolveProps(def) {
  12044. const { props } = def;
  12045. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  12046. for (const key of Object.keys(this)) {
  12047. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  12048. this._setProp(key, this[key]);
  12049. }
  12050. }
  12051. for (const key of declaredPropKeys.map(camelize)) {
  12052. if (key in Object.getPrototypeOf(this)) {
  12053. warn(
  12054. `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
  12055. );
  12056. }
  12057. Object.defineProperty(this, key, {
  12058. get() {
  12059. return this._getProp(key);
  12060. },
  12061. set(val) {
  12062. this._setProp(key, val, true, !this._patching);
  12063. }
  12064. });
  12065. }
  12066. }
  12067. _setAttr(key) {
  12068. if (key.startsWith("data-v-")) return;
  12069. const has = this.hasAttribute(key);
  12070. let value = has ? this.getAttribute(key) : REMOVAL;
  12071. const camelKey = camelize(key);
  12072. if (has && this._numberProps && this._numberProps[camelKey]) {
  12073. value = toNumber(value);
  12074. }
  12075. this._setProp(camelKey, value, false, true);
  12076. }
  12077. /**
  12078. * @internal
  12079. */
  12080. _getProp(key) {
  12081. return this._props[key];
  12082. }
  12083. /**
  12084. * @internal
  12085. */
  12086. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  12087. if (val !== this._props[key]) {
  12088. this._dirty = true;
  12089. if (val === REMOVAL) {
  12090. delete this._props[key];
  12091. } else {
  12092. this._props[key] = val;
  12093. if (key === "key" && this._app) {
  12094. this._app._ceVNode.key = val;
  12095. }
  12096. }
  12097. if (shouldUpdate && this._instance) {
  12098. this._update();
  12099. }
  12100. if (shouldReflect) {
  12101. const ob = this._ob;
  12102. if (ob) {
  12103. this._processMutations(ob.takeRecords());
  12104. ob.disconnect();
  12105. }
  12106. if (val === true) {
  12107. this.setAttribute(hyphenate(key), "");
  12108. } else if (typeof val === "string" || typeof val === "number") {
  12109. this.setAttribute(hyphenate(key), val + "");
  12110. } else if (!val) {
  12111. this.removeAttribute(hyphenate(key));
  12112. }
  12113. ob && ob.observe(this, { attributes: true });
  12114. }
  12115. }
  12116. }
  12117. _update() {
  12118. const vnode = this._createVNode();
  12119. if (this._app) vnode.appContext = this._app._context;
  12120. render(vnode, this._root);
  12121. }
  12122. _createVNode() {
  12123. const baseProps = {};
  12124. if (!this.shadowRoot) {
  12125. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  12126. }
  12127. const vnode = createVNode(this._def, extend(baseProps, this._props));
  12128. if (!this._instance) {
  12129. vnode.ce = (instance) => {
  12130. this._instance = instance;
  12131. instance.ce = this;
  12132. instance.isCE = true;
  12133. {
  12134. instance.ceReload = (newStyles) => {
  12135. if (this._styles) {
  12136. this._styles.forEach((s) => this._root.removeChild(s));
  12137. this._styles.length = 0;
  12138. }
  12139. this._styleAnchors.delete(this._def);
  12140. this._applyStyles(newStyles);
  12141. this._instance = null;
  12142. this._update();
  12143. };
  12144. }
  12145. const dispatch = (event, args) => {
  12146. this.dispatchEvent(
  12147. new CustomEvent(
  12148. event,
  12149. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  12150. )
  12151. );
  12152. };
  12153. instance.emit = (event, ...args) => {
  12154. dispatch(event, args);
  12155. if (hyphenate(event) !== event) {
  12156. dispatch(hyphenate(event), args);
  12157. }
  12158. };
  12159. this._setParent();
  12160. };
  12161. }
  12162. return vnode;
  12163. }
  12164. _applyStyles(styles, owner, parentComp) {
  12165. if (!styles) return;
  12166. if (owner) {
  12167. if (owner === this._def || this._styleChildren.has(owner)) {
  12168. return;
  12169. }
  12170. this._styleChildren.add(owner);
  12171. }
  12172. const nonce = this._nonce;
  12173. const root = this.shadowRoot;
  12174. const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
  12175. let last = null;
  12176. for (let i = styles.length - 1; i >= 0; i--) {
  12177. const s = document.createElement("style");
  12178. if (nonce) s.setAttribute("nonce", nonce);
  12179. s.textContent = styles[i];
  12180. root.insertBefore(s, last || insertionAnchor);
  12181. last = s;
  12182. if (i === 0) {
  12183. if (!parentComp) this._styleAnchors.set(this._def, s);
  12184. if (owner) this._styleAnchors.set(owner, s);
  12185. }
  12186. {
  12187. if (owner) {
  12188. if (owner.__hmrId) {
  12189. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  12190. let entry = this._childStyles.get(owner.__hmrId);
  12191. if (!entry) {
  12192. this._childStyles.set(owner.__hmrId, entry = []);
  12193. }
  12194. entry.push(s);
  12195. }
  12196. } else {
  12197. (this._styles || (this._styles = [])).push(s);
  12198. }
  12199. }
  12200. }
  12201. }
  12202. _getStyleAnchor(comp) {
  12203. if (!comp) {
  12204. return null;
  12205. }
  12206. const anchor = this._styleAnchors.get(comp);
  12207. if (anchor && anchor.parentNode === this.shadowRoot) {
  12208. return anchor;
  12209. }
  12210. if (anchor) {
  12211. this._styleAnchors.delete(comp);
  12212. }
  12213. return null;
  12214. }
  12215. _getRootStyleInsertionAnchor(root) {
  12216. for (let i = 0; i < root.childNodes.length; i++) {
  12217. const node = root.childNodes[i];
  12218. if (!(node instanceof HTMLStyleElement)) {
  12219. return node;
  12220. }
  12221. }
  12222. return null;
  12223. }
  12224. /**
  12225. * Only called when shadowRoot is false
  12226. */
  12227. _parseSlots() {
  12228. const slots = this._slots = {};
  12229. let n;
  12230. while (n = this.firstChild) {
  12231. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  12232. (slots[slotName] || (slots[slotName] = [])).push(n);
  12233. this.removeChild(n);
  12234. }
  12235. }
  12236. /**
  12237. * Only called when shadowRoot is false
  12238. */
  12239. _renderSlots() {
  12240. const outlets = this._getSlots();
  12241. const scopeId = this._instance.type.__scopeId;
  12242. for (let i = 0; i < outlets.length; i++) {
  12243. const o = outlets[i];
  12244. const slotName = o.getAttribute("name") || "default";
  12245. const content = this._slots[slotName];
  12246. const parent = o.parentNode;
  12247. if (content) {
  12248. for (const n of content) {
  12249. if (scopeId && n.nodeType === 1) {
  12250. const id = scopeId + "-s";
  12251. const walker = document.createTreeWalker(n, 1);
  12252. n.setAttribute(id, "");
  12253. let child;
  12254. while (child = walker.nextNode()) {
  12255. child.setAttribute(id, "");
  12256. }
  12257. }
  12258. parent.insertBefore(n, o);
  12259. }
  12260. } else {
  12261. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  12262. }
  12263. parent.removeChild(o);
  12264. }
  12265. }
  12266. /**
  12267. * @internal
  12268. */
  12269. _getSlots() {
  12270. const roots = [this];
  12271. if (this._teleportTargets) {
  12272. roots.push(...this._teleportTargets);
  12273. }
  12274. const slots = /* @__PURE__ */ new Set();
  12275. for (const root of roots) {
  12276. const found = root.querySelectorAll("slot");
  12277. for (let i = 0; i < found.length; i++) {
  12278. slots.add(found[i]);
  12279. }
  12280. }
  12281. return Array.from(slots);
  12282. }
  12283. /**
  12284. * @internal
  12285. */
  12286. _injectChildStyle(comp, parentComp) {
  12287. this._applyStyles(comp.styles, comp, parentComp);
  12288. }
  12289. /**
  12290. * @internal
  12291. */
  12292. _beginPatch() {
  12293. this._patching = true;
  12294. this._dirty = false;
  12295. }
  12296. /**
  12297. * @internal
  12298. */
  12299. _endPatch() {
  12300. this._patching = false;
  12301. if (this._dirty && this._instance) {
  12302. this._update();
  12303. }
  12304. }
  12305. /**
  12306. * @internal
  12307. */
  12308. _hasShadowRoot() {
  12309. return this._def.shadowRoot !== false;
  12310. }
  12311. /**
  12312. * @internal
  12313. */
  12314. _removeChildStyle(comp) {
  12315. {
  12316. this._styleChildren.delete(comp);
  12317. this._styleAnchors.delete(comp);
  12318. if (this._childStyles && comp.__hmrId) {
  12319. const oldStyles = this._childStyles.get(comp.__hmrId);
  12320. if (oldStyles) {
  12321. oldStyles.forEach((s) => this._root.removeChild(s));
  12322. oldStyles.length = 0;
  12323. }
  12324. }
  12325. }
  12326. }
  12327. }
  12328. function useHost(caller) {
  12329. const instance = getCurrentInstance();
  12330. const el = instance && instance.ce;
  12331. if (el) {
  12332. return el;
  12333. } else {
  12334. if (!instance) {
  12335. warn(
  12336. `${caller || "useHost"} called without an active component instance.`
  12337. );
  12338. } else {
  12339. warn(
  12340. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  12341. );
  12342. }
  12343. }
  12344. return null;
  12345. }
  12346. function useShadowRoot() {
  12347. const el = useHost("useShadowRoot") ;
  12348. return el && el.shadowRoot;
  12349. }
  12350. function useCssModule(name = "$style") {
  12351. {
  12352. const instance = getCurrentInstance();
  12353. if (!instance) {
  12354. warn(`useCssModule must be called inside setup()`);
  12355. return EMPTY_OBJ;
  12356. }
  12357. const modules = instance.type.__cssModules;
  12358. if (!modules) {
  12359. warn(`Current instance does not have CSS modules injected.`);
  12360. return EMPTY_OBJ;
  12361. }
  12362. const mod = modules[name];
  12363. if (!mod) {
  12364. warn(`Current instance does not have CSS module named "${name}".`);
  12365. return EMPTY_OBJ;
  12366. }
  12367. return mod;
  12368. }
  12369. }
  12370. const positionMap = /* @__PURE__ */ new WeakMap();
  12371. const newPositionMap = /* @__PURE__ */ new WeakMap();
  12372. const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
  12373. const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
  12374. const decorate = (t) => {
  12375. delete t.props.mode;
  12376. return t;
  12377. };
  12378. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  12379. name: "TransitionGroup",
  12380. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  12381. tag: String,
  12382. moveClass: String
  12383. }),
  12384. setup(props, { slots }) {
  12385. const instance = getCurrentInstance();
  12386. const state = useTransitionState();
  12387. let prevChildren;
  12388. let children;
  12389. onUpdated(() => {
  12390. if (!prevChildren.length) {
  12391. return;
  12392. }
  12393. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  12394. if (!hasCSSTransform(
  12395. prevChildren[0].el,
  12396. instance.vnode.el,
  12397. moveClass
  12398. )) {
  12399. prevChildren = [];
  12400. return;
  12401. }
  12402. prevChildren.forEach(callPendingCbs);
  12403. prevChildren.forEach(recordPosition);
  12404. const movedChildren = prevChildren.filter(applyTranslation);
  12405. forceReflow(instance.vnode.el);
  12406. movedChildren.forEach((c) => {
  12407. const el = c.el;
  12408. const style = el.style;
  12409. addTransitionClass(el, moveClass);
  12410. style.transform = style.webkitTransform = style.transitionDuration = "";
  12411. const cb = el[moveCbKey] = (e) => {
  12412. if (e && e.target !== el) {
  12413. return;
  12414. }
  12415. if (!e || e.propertyName.endsWith("transform")) {
  12416. el.removeEventListener("transitionend", cb);
  12417. el[moveCbKey] = null;
  12418. removeTransitionClass(el, moveClass);
  12419. }
  12420. };
  12421. el.addEventListener("transitionend", cb);
  12422. });
  12423. prevChildren = [];
  12424. });
  12425. return () => {
  12426. const rawProps = toRaw(props);
  12427. const cssTransitionProps = resolveTransitionProps(rawProps);
  12428. let tag = rawProps.tag || Fragment;
  12429. prevChildren = [];
  12430. if (children) {
  12431. for (let i = 0; i < children.length; i++) {
  12432. const child = children[i];
  12433. if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
  12434. !child.el[vShowHidden]) {
  12435. prevChildren.push(child);
  12436. setTransitionHooks(
  12437. child,
  12438. resolveTransitionHooks(
  12439. child,
  12440. cssTransitionProps,
  12441. state,
  12442. instance
  12443. )
  12444. );
  12445. positionMap.set(child, getPosition(child.el));
  12446. }
  12447. }
  12448. }
  12449. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  12450. for (let i = 0; i < children.length; i++) {
  12451. const child = children[i];
  12452. if (child.key != null) {
  12453. setTransitionHooks(
  12454. child,
  12455. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  12456. );
  12457. } else if (child.type !== Text) {
  12458. warn(`<TransitionGroup> children must be keyed.`);
  12459. }
  12460. }
  12461. return createVNode(tag, null, children);
  12462. };
  12463. }
  12464. });
  12465. const TransitionGroup = TransitionGroupImpl;
  12466. function callPendingCbs(c) {
  12467. const el = c.el;
  12468. if (el[moveCbKey]) {
  12469. el[moveCbKey]();
  12470. }
  12471. if (el[enterCbKey]) {
  12472. el[enterCbKey]();
  12473. }
  12474. }
  12475. function recordPosition(c) {
  12476. newPositionMap.set(c, getPosition(c.el));
  12477. }
  12478. function applyTranslation(c) {
  12479. const oldPos = positionMap.get(c);
  12480. const newPos = newPositionMap.get(c);
  12481. const dx = oldPos.left - newPos.left;
  12482. const dy = oldPos.top - newPos.top;
  12483. if (dx || dy) {
  12484. const el = c.el;
  12485. const s = el.style;
  12486. const rect = el.getBoundingClientRect();
  12487. let scaleX = 1;
  12488. let scaleY = 1;
  12489. if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
  12490. if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
  12491. if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
  12492. if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
  12493. if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
  12494. if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
  12495. s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
  12496. s.transitionDuration = "0s";
  12497. return c;
  12498. }
  12499. }
  12500. function getPosition(el) {
  12501. const rect = el.getBoundingClientRect();
  12502. return {
  12503. left: rect.left,
  12504. top: rect.top
  12505. };
  12506. }
  12507. function hasCSSTransform(el, root, moveClass) {
  12508. const clone = el.cloneNode();
  12509. const _vtc = el[vtcKey];
  12510. if (_vtc) {
  12511. _vtc.forEach((cls) => {
  12512. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  12513. });
  12514. }
  12515. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  12516. clone.style.display = "none";
  12517. const container = root.nodeType === 1 ? root : root.parentNode;
  12518. container.appendChild(clone);
  12519. const { hasTransform } = getTransitionInfo(clone);
  12520. container.removeChild(clone);
  12521. return hasTransform;
  12522. }
  12523. const getModelAssigner = (vnode) => {
  12524. const fn = vnode.props["onUpdate:modelValue"] || false;
  12525. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  12526. };
  12527. function onCompositionStart(e) {
  12528. e.target.composing = true;
  12529. }
  12530. function onCompositionEnd(e) {
  12531. const target = e.target;
  12532. if (target.composing) {
  12533. target.composing = false;
  12534. target.dispatchEvent(new Event("input"));
  12535. }
  12536. }
  12537. const assignKey = /* @__PURE__ */ Symbol("_assign");
  12538. const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
  12539. function castValue(value, trim, number) {
  12540. if (trim) value = value.trim();
  12541. if (number) value = looseToNumber(value);
  12542. return value;
  12543. }
  12544. const vModelText = {
  12545. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  12546. if (el.parentNode) {
  12547. if (el.type === "text") {
  12548. el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
  12549. } else if (el.type === "textarea") {
  12550. el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
  12551. }
  12552. }
  12553. el[assignKey] = getModelAssigner(vnode);
  12554. const castToNumber = number || vnode.props && vnode.props.type === "number";
  12555. addEventListener(el, lazy ? "change" : "input", (e) => {
  12556. if (e.target.composing) return;
  12557. el[assignKey](castValue(el.value, trim, castToNumber));
  12558. });
  12559. if (trim || castToNumber) {
  12560. addEventListener(el, "change", () => {
  12561. el.value = castValue(el.value, trim, castToNumber);
  12562. });
  12563. }
  12564. if (!lazy) {
  12565. addEventListener(el, "compositionstart", onCompositionStart);
  12566. addEventListener(el, "compositionend", onCompositionEnd);
  12567. addEventListener(el, "change", onCompositionEnd);
  12568. }
  12569. },
  12570. // set value on mounted so it's after min/max for type="range"
  12571. mounted(el, { value, modifiers: { trim, number } }) {
  12572. const newValue = value == null ? "" : value;
  12573. const initialValue = el[initialValueKey];
  12574. delete el[initialValueKey];
  12575. if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
  12576. el[assignKey](castValue(el.value, trim, number));
  12577. } else {
  12578. el.value = newValue;
  12579. }
  12580. },
  12581. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  12582. el[assignKey] = getModelAssigner(vnode);
  12583. if (el.composing) return;
  12584. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  12585. const newValue = value == null ? "" : value;
  12586. if (elValue === newValue) {
  12587. return;
  12588. }
  12589. const rootNode = el.getRootNode();
  12590. if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
  12591. if (lazy && value === oldValue) {
  12592. return;
  12593. }
  12594. if (trim && el.value.trim() === newValue) {
  12595. return;
  12596. }
  12597. }
  12598. el.value = newValue;
  12599. }
  12600. };
  12601. const vModelCheckbox = {
  12602. // #4096 array checkboxes need to be deep traversed
  12603. deep: true,
  12604. created(el, _, vnode) {
  12605. el[assignKey] = getModelAssigner(vnode);
  12606. addEventListener(el, "change", () => {
  12607. const modelValue = el._modelValue;
  12608. const elementValue = getValue(el);
  12609. const checked = el.checked;
  12610. const assign = el[assignKey];
  12611. if (isArray(modelValue)) {
  12612. const index = looseIndexOf(modelValue, elementValue);
  12613. const found = index !== -1;
  12614. if (checked && !found) {
  12615. assign(modelValue.concat(elementValue));
  12616. } else if (!checked && found) {
  12617. const filtered = [...modelValue];
  12618. filtered.splice(index, 1);
  12619. assign(filtered);
  12620. }
  12621. } else if (isSet(modelValue)) {
  12622. const cloned = new Set(modelValue);
  12623. if (checked) {
  12624. cloned.add(elementValue);
  12625. } else {
  12626. cloned.delete(elementValue);
  12627. }
  12628. assign(cloned);
  12629. } else {
  12630. assign(getCheckboxValue(el, checked));
  12631. }
  12632. });
  12633. },
  12634. // set initial checked on mount to wait for true-value/false-value
  12635. mounted: setChecked,
  12636. beforeUpdate(el, binding, vnode) {
  12637. el[assignKey] = getModelAssigner(vnode);
  12638. setChecked(el, binding, vnode);
  12639. }
  12640. };
  12641. function setChecked(el, { value, oldValue }, vnode) {
  12642. el._modelValue = value;
  12643. let checked;
  12644. if (isArray(value)) {
  12645. checked = looseIndexOf(value, vnode.props.value) > -1;
  12646. } else if (isSet(value)) {
  12647. checked = value.has(vnode.props.value);
  12648. } else {
  12649. if (value === oldValue) return;
  12650. checked = looseEqual(value, getCheckboxValue(el, true));
  12651. }
  12652. if (el.checked !== checked) {
  12653. el.checked = checked;
  12654. }
  12655. }
  12656. const vModelRadio = {
  12657. created(el, { value }, vnode) {
  12658. el.checked = looseEqual(value, vnode.props.value);
  12659. el[assignKey] = getModelAssigner(vnode);
  12660. addEventListener(el, "change", () => {
  12661. el[assignKey](getValue(el));
  12662. });
  12663. },
  12664. beforeUpdate(el, { value, oldValue }, vnode) {
  12665. el[assignKey] = getModelAssigner(vnode);
  12666. if (value !== oldValue) {
  12667. el.checked = looseEqual(value, vnode.props.value);
  12668. }
  12669. }
  12670. };
  12671. const vModelSelect = {
  12672. // <select multiple> value need to be deep traversed
  12673. deep: true,
  12674. created(el, { value, modifiers: { number } }, vnode) {
  12675. el._modelValue = value;
  12676. addEventListener(el, "change", () => {
  12677. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  12678. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  12679. );
  12680. el[assignKey](
  12681. el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
  12682. );
  12683. el._assigning = true;
  12684. nextTick(() => {
  12685. el._assigning = false;
  12686. });
  12687. });
  12688. el[assignKey] = getModelAssigner(vnode);
  12689. },
  12690. // set value in mounted & updated because <select> relies on its children
  12691. // <option>s.
  12692. mounted(el, { value }) {
  12693. setSelected(el, value);
  12694. },
  12695. beforeUpdate(el, { value }, vnode) {
  12696. el._modelValue = value;
  12697. el[assignKey] = getModelAssigner(vnode);
  12698. },
  12699. updated(el, { value }) {
  12700. if (!el._assigning) {
  12701. setSelected(el, value);
  12702. }
  12703. }
  12704. };
  12705. function setSelected(el, value) {
  12706. const isMultiple = el.multiple;
  12707. const isArrayValue = isArray(value);
  12708. if (isMultiple && !isArrayValue && !isSet(value)) {
  12709. warn(
  12710. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  12711. );
  12712. return;
  12713. }
  12714. for (let i = 0, l = el.options.length; i < l; i++) {
  12715. const option = el.options[i];
  12716. const optionValue = getValue(option);
  12717. if (isMultiple) {
  12718. if (isArrayValue) {
  12719. const optionType = typeof optionValue;
  12720. if (optionType === "string" || optionType === "number") {
  12721. option.selected = value.some((v) => String(v) === String(optionValue));
  12722. } else {
  12723. option.selected = looseIndexOf(value, optionValue) > -1;
  12724. }
  12725. } else {
  12726. option.selected = value.has(optionValue);
  12727. }
  12728. } else if (looseEqual(getValue(option), value)) {
  12729. if (el.selectedIndex !== i) el.selectedIndex = i;
  12730. return;
  12731. }
  12732. }
  12733. if (!isMultiple && el.selectedIndex !== -1) {
  12734. el.selectedIndex = -1;
  12735. }
  12736. }
  12737. function getValue(el) {
  12738. return "_value" in el ? el._value : el.value;
  12739. }
  12740. function getCheckboxValue(el, checked) {
  12741. const key = checked ? "_trueValue" : "_falseValue";
  12742. return key in el ? el[key] : checked;
  12743. }
  12744. const vModelDynamic = {
  12745. created(el, binding, vnode) {
  12746. callModelHook(el, binding, vnode, null, "created");
  12747. },
  12748. mounted(el, binding, vnode) {
  12749. callModelHook(el, binding, vnode, null, "mounted");
  12750. },
  12751. beforeUpdate(el, binding, vnode, prevVNode) {
  12752. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12753. },
  12754. updated(el, binding, vnode, prevVNode) {
  12755. callModelHook(el, binding, vnode, prevVNode, "updated");
  12756. }
  12757. };
  12758. function resolveDynamicModel(tagName, type) {
  12759. switch (tagName) {
  12760. case "SELECT":
  12761. return vModelSelect;
  12762. case "TEXTAREA":
  12763. return vModelText;
  12764. default:
  12765. switch (type) {
  12766. case "checkbox":
  12767. return vModelCheckbox;
  12768. case "radio":
  12769. return vModelRadio;
  12770. default:
  12771. return vModelText;
  12772. }
  12773. }
  12774. }
  12775. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12776. const modelToUse = resolveDynamicModel(
  12777. el.tagName,
  12778. vnode.props && vnode.props.type
  12779. );
  12780. const fn = modelToUse[hook];
  12781. fn && fn(el, binding, vnode, prevVNode);
  12782. }
  12783. function initVModelForSSR() {
  12784. vModelText.getSSRProps = ({ value }) => ({ value });
  12785. vModelRadio.getSSRProps = ({ value }, vnode) => {
  12786. if (vnode.props && looseEqual(vnode.props.value, value)) {
  12787. return { checked: true };
  12788. }
  12789. };
  12790. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  12791. if (isArray(value)) {
  12792. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  12793. return { checked: true };
  12794. }
  12795. } else if (isSet(value)) {
  12796. if (vnode.props && value.has(vnode.props.value)) {
  12797. return { checked: true };
  12798. }
  12799. } else if (value) {
  12800. return { checked: true };
  12801. }
  12802. };
  12803. vModelDynamic.getSSRProps = (binding, vnode) => {
  12804. if (typeof vnode.type !== "string") {
  12805. return;
  12806. }
  12807. const modelToUse = resolveDynamicModel(
  12808. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  12809. vnode.type.toUpperCase(),
  12810. vnode.props && vnode.props.type
  12811. );
  12812. if (modelToUse.getSSRProps) {
  12813. return modelToUse.getSSRProps(binding, vnode);
  12814. }
  12815. };
  12816. }
  12817. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12818. const modifierGuards = {
  12819. stop: (e) => e.stopPropagation(),
  12820. prevent: (e) => e.preventDefault(),
  12821. self: (e) => e.target !== e.currentTarget,
  12822. ctrl: (e) => !e.ctrlKey,
  12823. shift: (e) => !e.shiftKey,
  12824. alt: (e) => !e.altKey,
  12825. meta: (e) => !e.metaKey,
  12826. left: (e) => "button" in e && e.button !== 0,
  12827. middle: (e) => "button" in e && e.button !== 1,
  12828. right: (e) => "button" in e && e.button !== 2,
  12829. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12830. };
  12831. const withModifiers = (fn, modifiers) => {
  12832. if (!fn) return fn;
  12833. const cache = fn._withMods || (fn._withMods = {});
  12834. const cacheKey = modifiers.join(".");
  12835. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  12836. for (let i = 0; i < modifiers.length; i++) {
  12837. const guard = modifierGuards[modifiers[i]];
  12838. if (guard && guard(event, modifiers)) return;
  12839. }
  12840. return fn(event, ...args);
  12841. }));
  12842. };
  12843. const keyNames = {
  12844. esc: "escape",
  12845. space: " ",
  12846. up: "arrow-up",
  12847. left: "arrow-left",
  12848. right: "arrow-right",
  12849. down: "arrow-down",
  12850. delete: "backspace"
  12851. };
  12852. const withKeys = (fn, modifiers) => {
  12853. const cache = fn._withKeys || (fn._withKeys = {});
  12854. const cacheKey = modifiers.join(".");
  12855. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  12856. if (!("key" in event)) {
  12857. return;
  12858. }
  12859. const eventKey = hyphenate(event.key);
  12860. if (modifiers.some(
  12861. (k) => k === eventKey || keyNames[k] === eventKey
  12862. )) {
  12863. return fn(event);
  12864. }
  12865. }));
  12866. };
  12867. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12868. let renderer;
  12869. let enabledHydration = false;
  12870. function ensureRenderer() {
  12871. return renderer || (renderer = createRenderer(rendererOptions));
  12872. }
  12873. function ensureHydrationRenderer() {
  12874. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12875. enabledHydration = true;
  12876. return renderer;
  12877. }
  12878. const render = ((...args) => {
  12879. ensureRenderer().render(...args);
  12880. });
  12881. const hydrate = ((...args) => {
  12882. ensureHydrationRenderer().hydrate(...args);
  12883. });
  12884. const createApp = ((...args) => {
  12885. const app = ensureRenderer().createApp(...args);
  12886. {
  12887. injectNativeTagCheck(app);
  12888. injectCompilerOptionsCheck(app);
  12889. }
  12890. const { mount } = app;
  12891. app.mount = (containerOrSelector) => {
  12892. const container = normalizeContainer(containerOrSelector);
  12893. if (!container) return;
  12894. const component = app._component;
  12895. if (!isFunction(component) && !component.render && !component.template) {
  12896. component.template = container.innerHTML;
  12897. }
  12898. if (container.nodeType === 1) {
  12899. container.textContent = "";
  12900. }
  12901. const proxy = mount(container, false, resolveRootNamespace(container));
  12902. if (container instanceof Element) {
  12903. container.removeAttribute("v-cloak");
  12904. container.setAttribute("data-v-app", "");
  12905. }
  12906. return proxy;
  12907. };
  12908. return app;
  12909. });
  12910. const createSSRApp = ((...args) => {
  12911. const app = ensureHydrationRenderer().createApp(...args);
  12912. {
  12913. injectNativeTagCheck(app);
  12914. injectCompilerOptionsCheck(app);
  12915. }
  12916. const { mount } = app;
  12917. app.mount = (containerOrSelector) => {
  12918. const container = normalizeContainer(containerOrSelector);
  12919. if (container) {
  12920. return mount(container, true, resolveRootNamespace(container));
  12921. }
  12922. };
  12923. return app;
  12924. });
  12925. function resolveRootNamespace(container) {
  12926. if (container instanceof SVGElement) {
  12927. return "svg";
  12928. }
  12929. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12930. return "mathml";
  12931. }
  12932. }
  12933. function injectNativeTagCheck(app) {
  12934. Object.defineProperty(app.config, "isNativeTag", {
  12935. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12936. writable: false
  12937. });
  12938. }
  12939. function injectCompilerOptionsCheck(app) {
  12940. if (isRuntimeOnly()) {
  12941. const isCustomElement = app.config.isCustomElement;
  12942. Object.defineProperty(app.config, "isCustomElement", {
  12943. get() {
  12944. return isCustomElement;
  12945. },
  12946. set() {
  12947. warn(
  12948. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12949. );
  12950. }
  12951. });
  12952. const compilerOptions = app.config.compilerOptions;
  12953. 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.
  12954. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12955. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12956. - 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`;
  12957. Object.defineProperty(app.config, "compilerOptions", {
  12958. get() {
  12959. warn(msg);
  12960. return compilerOptions;
  12961. },
  12962. set() {
  12963. warn(msg);
  12964. }
  12965. });
  12966. }
  12967. }
  12968. function normalizeContainer(container) {
  12969. if (isString(container)) {
  12970. const res = document.querySelector(container);
  12971. if (!res) {
  12972. warn(
  12973. `Failed to mount app: mount target selector "${container}" returned null.`
  12974. );
  12975. }
  12976. return res;
  12977. }
  12978. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12979. warn(
  12980. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12981. );
  12982. }
  12983. return container;
  12984. }
  12985. let ssrDirectiveInitialized = false;
  12986. const initDirectivesForSSR = () => {
  12987. if (!ssrDirectiveInitialized) {
  12988. ssrDirectiveInitialized = true;
  12989. initVModelForSSR();
  12990. initVShowForSSR();
  12991. }
  12992. } ;
  12993. var runtimeDom = /*#__PURE__*/Object.freeze({
  12994. __proto__: null,
  12995. BaseTransition: BaseTransition,
  12996. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  12997. Comment: Comment,
  12998. DeprecationTypes: DeprecationTypes,
  12999. EffectScope: EffectScope,
  13000. ErrorCodes: ErrorCodes,
  13001. ErrorTypeStrings: ErrorTypeStrings,
  13002. Fragment: Fragment,
  13003. KeepAlive: KeepAlive,
  13004. ReactiveEffect: ReactiveEffect,
  13005. Static: Static,
  13006. Suspense: Suspense,
  13007. Teleport: Teleport,
  13008. Text: Text,
  13009. TrackOpTypes: TrackOpTypes,
  13010. Transition: Transition,
  13011. TransitionGroup: TransitionGroup,
  13012. TriggerOpTypes: TriggerOpTypes,
  13013. VueElement: VueElement,
  13014. assertNumber: assertNumber,
  13015. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  13016. callWithErrorHandling: callWithErrorHandling,
  13017. camelize: camelize,
  13018. capitalize: capitalize,
  13019. cloneVNode: cloneVNode,
  13020. compatUtils: compatUtils,
  13021. computed: computed,
  13022. createApp: createApp,
  13023. createBlock: createBlock,
  13024. createCommentVNode: createCommentVNode,
  13025. createElementBlock: createElementBlock,
  13026. createElementVNode: createBaseVNode,
  13027. createHydrationRenderer: createHydrationRenderer,
  13028. createPropsRestProxy: createPropsRestProxy,
  13029. createRenderer: createRenderer,
  13030. createSSRApp: createSSRApp,
  13031. createSlots: createSlots,
  13032. createStaticVNode: createStaticVNode,
  13033. createTextVNode: createTextVNode,
  13034. createVNode: createVNode,
  13035. customRef: customRef,
  13036. defineAsyncComponent: defineAsyncComponent,
  13037. defineComponent: defineComponent,
  13038. defineCustomElement: defineCustomElement,
  13039. defineEmits: defineEmits,
  13040. defineExpose: defineExpose,
  13041. defineModel: defineModel,
  13042. defineOptions: defineOptions,
  13043. defineProps: defineProps,
  13044. defineSSRCustomElement: defineSSRCustomElement,
  13045. defineSlots: defineSlots,
  13046. devtools: devtools,
  13047. effect: effect,
  13048. effectScope: effectScope,
  13049. getCurrentInstance: getCurrentInstance,
  13050. getCurrentScope: getCurrentScope,
  13051. getCurrentWatcher: getCurrentWatcher,
  13052. getTransitionRawChildren: getTransitionRawChildren,
  13053. guardReactiveProps: guardReactiveProps,
  13054. h: h,
  13055. handleError: handleError,
  13056. hasInjectionContext: hasInjectionContext,
  13057. hydrate: hydrate,
  13058. hydrateOnIdle: hydrateOnIdle,
  13059. hydrateOnInteraction: hydrateOnInteraction,
  13060. hydrateOnMediaQuery: hydrateOnMediaQuery,
  13061. hydrateOnVisible: hydrateOnVisible,
  13062. initCustomFormatter: initCustomFormatter,
  13063. initDirectivesForSSR: initDirectivesForSSR,
  13064. inject: inject,
  13065. isMemoSame: isMemoSame,
  13066. isProxy: isProxy,
  13067. isReactive: isReactive,
  13068. isReadonly: isReadonly,
  13069. isRef: isRef,
  13070. isRuntimeOnly: isRuntimeOnly,
  13071. isShallow: isShallow,
  13072. isVNode: isVNode,
  13073. markRaw: markRaw,
  13074. mergeDefaults: mergeDefaults,
  13075. mergeModels: mergeModels,
  13076. mergeProps: mergeProps,
  13077. nextTick: nextTick,
  13078. nodeOps: nodeOps,
  13079. normalizeClass: normalizeClass,
  13080. normalizeProps: normalizeProps,
  13081. normalizeStyle: normalizeStyle,
  13082. onActivated: onActivated,
  13083. onBeforeMount: onBeforeMount,
  13084. onBeforeUnmount: onBeforeUnmount,
  13085. onBeforeUpdate: onBeforeUpdate,
  13086. onDeactivated: onDeactivated,
  13087. onErrorCaptured: onErrorCaptured,
  13088. onMounted: onMounted,
  13089. onRenderTracked: onRenderTracked,
  13090. onRenderTriggered: onRenderTriggered,
  13091. onScopeDispose: onScopeDispose,
  13092. onServerPrefetch: onServerPrefetch,
  13093. onUnmounted: onUnmounted,
  13094. onUpdated: onUpdated,
  13095. onWatcherCleanup: onWatcherCleanup,
  13096. openBlock: openBlock,
  13097. patchProp: patchProp,
  13098. popScopeId: popScopeId,
  13099. provide: provide,
  13100. proxyRefs: proxyRefs,
  13101. pushScopeId: pushScopeId,
  13102. queuePostFlushCb: queuePostFlushCb,
  13103. reactive: reactive,
  13104. readonly: readonly,
  13105. ref: ref,
  13106. registerRuntimeCompiler: registerRuntimeCompiler,
  13107. render: render,
  13108. renderList: renderList,
  13109. renderSlot: renderSlot,
  13110. resolveComponent: resolveComponent,
  13111. resolveDirective: resolveDirective,
  13112. resolveDynamicComponent: resolveDynamicComponent,
  13113. resolveFilter: resolveFilter,
  13114. resolveTransitionHooks: resolveTransitionHooks,
  13115. setBlockTracking: setBlockTracking,
  13116. setDevtoolsHook: setDevtoolsHook,
  13117. setTransitionHooks: setTransitionHooks,
  13118. shallowReactive: shallowReactive,
  13119. shallowReadonly: shallowReadonly,
  13120. shallowRef: shallowRef,
  13121. ssrContextKey: ssrContextKey,
  13122. ssrUtils: ssrUtils,
  13123. stop: stop,
  13124. toDisplayString: toDisplayString,
  13125. toHandlerKey: toHandlerKey,
  13126. toHandlers: toHandlers,
  13127. toRaw: toRaw,
  13128. toRef: toRef,
  13129. toRefs: toRefs,
  13130. toValue: toValue,
  13131. transformVNodeArgs: transformVNodeArgs,
  13132. triggerRef: triggerRef,
  13133. unref: unref,
  13134. useAttrs: useAttrs,
  13135. useCssModule: useCssModule,
  13136. useCssVars: useCssVars,
  13137. useHost: useHost,
  13138. useId: useId,
  13139. useModel: useModel,
  13140. useSSRContext: useSSRContext,
  13141. useShadowRoot: useShadowRoot,
  13142. useSlots: useSlots,
  13143. useTemplateRef: useTemplateRef,
  13144. useTransitionState: useTransitionState,
  13145. vModelCheckbox: vModelCheckbox,
  13146. vModelDynamic: vModelDynamic,
  13147. vModelRadio: vModelRadio,
  13148. vModelSelect: vModelSelect,
  13149. vModelText: vModelText,
  13150. vShow: vShow,
  13151. version: version,
  13152. warn: warn,
  13153. watch: watch,
  13154. watchEffect: watchEffect,
  13155. watchPostEffect: watchPostEffect,
  13156. watchSyncEffect: watchSyncEffect,
  13157. withAsyncContext: withAsyncContext,
  13158. withCtx: withCtx,
  13159. withDefaults: withDefaults,
  13160. withDirectives: withDirectives,
  13161. withKeys: withKeys,
  13162. withMemo: withMemo,
  13163. withModifiers: withModifiers,
  13164. withScopeId: withScopeId
  13165. });
  13166. function initDev() {
  13167. {
  13168. {
  13169. console.info(
  13170. `You are running a development build of Vue.
  13171. Make sure to use the production build (*.prod.js) when deploying for production.`
  13172. );
  13173. }
  13174. initCustomFormatter();
  13175. }
  13176. }
  13177. const FRAGMENT = /* @__PURE__ */ Symbol(`Fragment` );
  13178. const TELEPORT = /* @__PURE__ */ Symbol(`Teleport` );
  13179. const SUSPENSE = /* @__PURE__ */ Symbol(`Suspense` );
  13180. const KEEP_ALIVE = /* @__PURE__ */ Symbol(`KeepAlive` );
  13181. const BASE_TRANSITION = /* @__PURE__ */ Symbol(
  13182. `BaseTransition`
  13183. );
  13184. const OPEN_BLOCK = /* @__PURE__ */ Symbol(`openBlock` );
  13185. const CREATE_BLOCK = /* @__PURE__ */ Symbol(`createBlock` );
  13186. const CREATE_ELEMENT_BLOCK = /* @__PURE__ */ Symbol(
  13187. `createElementBlock`
  13188. );
  13189. const CREATE_VNODE = /* @__PURE__ */ Symbol(`createVNode` );
  13190. const CREATE_ELEMENT_VNODE = /* @__PURE__ */ Symbol(
  13191. `createElementVNode`
  13192. );
  13193. const CREATE_COMMENT = /* @__PURE__ */ Symbol(
  13194. `createCommentVNode`
  13195. );
  13196. const CREATE_TEXT = /* @__PURE__ */ Symbol(
  13197. `createTextVNode`
  13198. );
  13199. const CREATE_STATIC = /* @__PURE__ */ Symbol(
  13200. `createStaticVNode`
  13201. );
  13202. const RESOLVE_COMPONENT = /* @__PURE__ */ Symbol(
  13203. `resolveComponent`
  13204. );
  13205. const RESOLVE_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol(
  13206. `resolveDynamicComponent`
  13207. );
  13208. const RESOLVE_DIRECTIVE = /* @__PURE__ */ Symbol(
  13209. `resolveDirective`
  13210. );
  13211. const RESOLVE_FILTER = /* @__PURE__ */ Symbol(
  13212. `resolveFilter`
  13213. );
  13214. const WITH_DIRECTIVES = /* @__PURE__ */ Symbol(
  13215. `withDirectives`
  13216. );
  13217. const RENDER_LIST = /* @__PURE__ */ Symbol(`renderList` );
  13218. const RENDER_SLOT = /* @__PURE__ */ Symbol(`renderSlot` );
  13219. const CREATE_SLOTS = /* @__PURE__ */ Symbol(`createSlots` );
  13220. const TO_DISPLAY_STRING = /* @__PURE__ */ Symbol(
  13221. `toDisplayString`
  13222. );
  13223. const MERGE_PROPS = /* @__PURE__ */ Symbol(`mergeProps` );
  13224. const NORMALIZE_CLASS = /* @__PURE__ */ Symbol(
  13225. `normalizeClass`
  13226. );
  13227. const NORMALIZE_STYLE = /* @__PURE__ */ Symbol(
  13228. `normalizeStyle`
  13229. );
  13230. const NORMALIZE_PROPS = /* @__PURE__ */ Symbol(
  13231. `normalizeProps`
  13232. );
  13233. const GUARD_REACTIVE_PROPS = /* @__PURE__ */ Symbol(
  13234. `guardReactiveProps`
  13235. );
  13236. const TO_HANDLERS = /* @__PURE__ */ Symbol(`toHandlers` );
  13237. const CAMELIZE = /* @__PURE__ */ Symbol(`camelize` );
  13238. const CAPITALIZE = /* @__PURE__ */ Symbol(`capitalize` );
  13239. const TO_HANDLER_KEY = /* @__PURE__ */ Symbol(
  13240. `toHandlerKey`
  13241. );
  13242. const SET_BLOCK_TRACKING = /* @__PURE__ */ Symbol(
  13243. `setBlockTracking`
  13244. );
  13245. const PUSH_SCOPE_ID = /* @__PURE__ */ Symbol(`pushScopeId` );
  13246. const POP_SCOPE_ID = /* @__PURE__ */ Symbol(`popScopeId` );
  13247. const WITH_CTX = /* @__PURE__ */ Symbol(`withCtx` );
  13248. const UNREF = /* @__PURE__ */ Symbol(`unref` );
  13249. const IS_REF = /* @__PURE__ */ Symbol(`isRef` );
  13250. const WITH_MEMO = /* @__PURE__ */ Symbol(`withMemo` );
  13251. const IS_MEMO_SAME = /* @__PURE__ */ Symbol(`isMemoSame` );
  13252. const helperNameMap = {
  13253. [FRAGMENT]: `Fragment`,
  13254. [TELEPORT]: `Teleport`,
  13255. [SUSPENSE]: `Suspense`,
  13256. [KEEP_ALIVE]: `KeepAlive`,
  13257. [BASE_TRANSITION]: `BaseTransition`,
  13258. [OPEN_BLOCK]: `openBlock`,
  13259. [CREATE_BLOCK]: `createBlock`,
  13260. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  13261. [CREATE_VNODE]: `createVNode`,
  13262. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  13263. [CREATE_COMMENT]: `createCommentVNode`,
  13264. [CREATE_TEXT]: `createTextVNode`,
  13265. [CREATE_STATIC]: `createStaticVNode`,
  13266. [RESOLVE_COMPONENT]: `resolveComponent`,
  13267. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  13268. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  13269. [RESOLVE_FILTER]: `resolveFilter`,
  13270. [WITH_DIRECTIVES]: `withDirectives`,
  13271. [RENDER_LIST]: `renderList`,
  13272. [RENDER_SLOT]: `renderSlot`,
  13273. [CREATE_SLOTS]: `createSlots`,
  13274. [TO_DISPLAY_STRING]: `toDisplayString`,
  13275. [MERGE_PROPS]: `mergeProps`,
  13276. [NORMALIZE_CLASS]: `normalizeClass`,
  13277. [NORMALIZE_STYLE]: `normalizeStyle`,
  13278. [NORMALIZE_PROPS]: `normalizeProps`,
  13279. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  13280. [TO_HANDLERS]: `toHandlers`,
  13281. [CAMELIZE]: `camelize`,
  13282. [CAPITALIZE]: `capitalize`,
  13283. [TO_HANDLER_KEY]: `toHandlerKey`,
  13284. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  13285. [PUSH_SCOPE_ID]: `pushScopeId`,
  13286. [POP_SCOPE_ID]: `popScopeId`,
  13287. [WITH_CTX]: `withCtx`,
  13288. [UNREF]: `unref`,
  13289. [IS_REF]: `isRef`,
  13290. [WITH_MEMO]: `withMemo`,
  13291. [IS_MEMO_SAME]: `isMemoSame`
  13292. };
  13293. function registerRuntimeHelpers(helpers) {
  13294. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  13295. helperNameMap[s] = helpers[s];
  13296. });
  13297. }
  13298. const locStub = {
  13299. start: { line: 1, column: 1, offset: 0 },
  13300. end: { line: 1, column: 1, offset: 0 },
  13301. source: ""
  13302. };
  13303. function createRoot(children, source = "") {
  13304. return {
  13305. type: 0,
  13306. source,
  13307. children,
  13308. helpers: /* @__PURE__ */ new Set(),
  13309. components: [],
  13310. directives: [],
  13311. hoists: [],
  13312. imports: [],
  13313. cached: [],
  13314. temps: 0,
  13315. codegenNode: void 0,
  13316. loc: locStub
  13317. };
  13318. }
  13319. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  13320. if (context) {
  13321. if (isBlock) {
  13322. context.helper(OPEN_BLOCK);
  13323. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  13324. } else {
  13325. context.helper(getVNodeHelper(context.inSSR, isComponent));
  13326. }
  13327. if (directives) {
  13328. context.helper(WITH_DIRECTIVES);
  13329. }
  13330. }
  13331. return {
  13332. type: 13,
  13333. tag,
  13334. props,
  13335. children,
  13336. patchFlag,
  13337. dynamicProps,
  13338. directives,
  13339. isBlock,
  13340. disableTracking,
  13341. isComponent,
  13342. loc
  13343. };
  13344. }
  13345. function createArrayExpression(elements, loc = locStub) {
  13346. return {
  13347. type: 17,
  13348. loc,
  13349. elements
  13350. };
  13351. }
  13352. function createObjectExpression(properties, loc = locStub) {
  13353. return {
  13354. type: 15,
  13355. loc,
  13356. properties
  13357. };
  13358. }
  13359. function createObjectProperty(key, value) {
  13360. return {
  13361. type: 16,
  13362. loc: locStub,
  13363. key: isString(key) ? createSimpleExpression(key, true) : key,
  13364. value
  13365. };
  13366. }
  13367. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  13368. return {
  13369. type: 4,
  13370. loc,
  13371. content,
  13372. isStatic,
  13373. constType: isStatic ? 3 : constType
  13374. };
  13375. }
  13376. function createCompoundExpression(children, loc = locStub) {
  13377. return {
  13378. type: 8,
  13379. loc,
  13380. children
  13381. };
  13382. }
  13383. function createCallExpression(callee, args = [], loc = locStub) {
  13384. return {
  13385. type: 14,
  13386. loc,
  13387. callee,
  13388. arguments: args
  13389. };
  13390. }
  13391. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  13392. return {
  13393. type: 18,
  13394. params,
  13395. returns,
  13396. newline,
  13397. isSlot,
  13398. loc
  13399. };
  13400. }
  13401. function createConditionalExpression(test, consequent, alternate, newline = true) {
  13402. return {
  13403. type: 19,
  13404. test,
  13405. consequent,
  13406. alternate,
  13407. newline,
  13408. loc: locStub
  13409. };
  13410. }
  13411. function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
  13412. return {
  13413. type: 20,
  13414. index,
  13415. value,
  13416. needPauseTracking,
  13417. inVOnce,
  13418. needArraySpread: false,
  13419. loc: locStub
  13420. };
  13421. }
  13422. function createBlockStatement(body) {
  13423. return {
  13424. type: 21,
  13425. body,
  13426. loc: locStub
  13427. };
  13428. }
  13429. function getVNodeHelper(ssr, isComponent) {
  13430. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  13431. }
  13432. function getVNodeBlockHelper(ssr, isComponent) {
  13433. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  13434. }
  13435. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  13436. if (!node.isBlock) {
  13437. node.isBlock = true;
  13438. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  13439. helper(OPEN_BLOCK);
  13440. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  13441. }
  13442. }
  13443. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  13444. const defaultDelimitersClose = new Uint8Array([125, 125]);
  13445. function isTagStartChar(c) {
  13446. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  13447. }
  13448. function isWhitespace(c) {
  13449. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  13450. }
  13451. function isEndOfTagSection(c) {
  13452. return c === 47 || c === 62 || isWhitespace(c);
  13453. }
  13454. function toCharCodes(str) {
  13455. const ret = new Uint8Array(str.length);
  13456. for (let i = 0; i < str.length; i++) {
  13457. ret[i] = str.charCodeAt(i);
  13458. }
  13459. return ret;
  13460. }
  13461. const Sequences = {
  13462. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  13463. // CDATA[
  13464. CdataEnd: new Uint8Array([93, 93, 62]),
  13465. // ]]>
  13466. CommentEnd: new Uint8Array([45, 45, 62]),
  13467. // `-->`
  13468. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  13469. // `<\/script`
  13470. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  13471. // `</style`
  13472. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  13473. // `</title`
  13474. TextareaEnd: new Uint8Array([
  13475. 60,
  13476. 47,
  13477. 116,
  13478. 101,
  13479. 120,
  13480. 116,
  13481. 97,
  13482. 114,
  13483. 101,
  13484. 97
  13485. ])
  13486. // `</textarea
  13487. };
  13488. class Tokenizer {
  13489. constructor(stack, cbs) {
  13490. this.stack = stack;
  13491. this.cbs = cbs;
  13492. /** The current state the tokenizer is in. */
  13493. this.state = 1;
  13494. /** The read buffer. */
  13495. this.buffer = "";
  13496. /** The beginning of the section that is currently being read. */
  13497. this.sectionStart = 0;
  13498. /** The index within the buffer that we are currently looking at. */
  13499. this.index = 0;
  13500. /** The start of the last entity. */
  13501. this.entityStart = 0;
  13502. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  13503. this.baseState = 1;
  13504. /** For special parsing behavior inside of script and style tags. */
  13505. this.inRCDATA = false;
  13506. /** For disabling RCDATA tags handling */
  13507. this.inXML = false;
  13508. /** For disabling interpolation parsing in v-pre */
  13509. this.inVPre = false;
  13510. /** Record newline positions for fast line / column calculation */
  13511. this.newlines = [];
  13512. this.mode = 0;
  13513. this.delimiterOpen = defaultDelimitersOpen;
  13514. this.delimiterClose = defaultDelimitersClose;
  13515. this.delimiterIndex = -1;
  13516. this.currentSequence = void 0;
  13517. this.sequenceIndex = 0;
  13518. }
  13519. get inSFCRoot() {
  13520. return this.mode === 2 && this.stack.length === 0;
  13521. }
  13522. reset() {
  13523. this.state = 1;
  13524. this.mode = 0;
  13525. this.buffer = "";
  13526. this.sectionStart = 0;
  13527. this.index = 0;
  13528. this.baseState = 1;
  13529. this.inRCDATA = false;
  13530. this.currentSequence = void 0;
  13531. this.newlines.length = 0;
  13532. this.delimiterOpen = defaultDelimitersOpen;
  13533. this.delimiterClose = defaultDelimitersClose;
  13534. }
  13535. /**
  13536. * Generate Position object with line / column information using recorded
  13537. * newline positions. We know the index is always going to be an already
  13538. * processed index, so all the newlines up to this index should have been
  13539. * recorded.
  13540. */
  13541. getPos(index) {
  13542. let line = 1;
  13543. let column = index + 1;
  13544. const length = this.newlines.length;
  13545. let j = -1;
  13546. if (length > 100) {
  13547. let l = -1;
  13548. let r = length;
  13549. while (l + 1 < r) {
  13550. const m = l + r >>> 1;
  13551. this.newlines[m] < index ? l = m : r = m;
  13552. }
  13553. j = l;
  13554. } else {
  13555. for (let i = length - 1; i >= 0; i--) {
  13556. if (index > this.newlines[i]) {
  13557. j = i;
  13558. break;
  13559. }
  13560. }
  13561. }
  13562. if (j >= 0) {
  13563. line = j + 2;
  13564. column = index - this.newlines[j];
  13565. }
  13566. return {
  13567. column,
  13568. line,
  13569. offset: index
  13570. };
  13571. }
  13572. peek() {
  13573. return this.buffer.charCodeAt(this.index + 1);
  13574. }
  13575. stateText(c) {
  13576. if (c === 60) {
  13577. if (this.index > this.sectionStart) {
  13578. this.cbs.ontext(this.sectionStart, this.index);
  13579. }
  13580. this.state = 5;
  13581. this.sectionStart = this.index;
  13582. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  13583. this.state = 2;
  13584. this.delimiterIndex = 0;
  13585. this.stateInterpolationOpen(c);
  13586. }
  13587. }
  13588. stateInterpolationOpen(c) {
  13589. if (c === this.delimiterOpen[this.delimiterIndex]) {
  13590. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  13591. const start = this.index + 1 - this.delimiterOpen.length;
  13592. if (start > this.sectionStart) {
  13593. this.cbs.ontext(this.sectionStart, start);
  13594. }
  13595. this.state = 3;
  13596. this.sectionStart = start;
  13597. } else {
  13598. this.delimiterIndex++;
  13599. }
  13600. } else if (this.inRCDATA) {
  13601. this.state = 32;
  13602. this.stateInRCDATA(c);
  13603. } else {
  13604. this.state = 1;
  13605. this.stateText(c);
  13606. }
  13607. }
  13608. stateInterpolation(c) {
  13609. if (c === this.delimiterClose[0]) {
  13610. this.state = 4;
  13611. this.delimiterIndex = 0;
  13612. this.stateInterpolationClose(c);
  13613. }
  13614. }
  13615. stateInterpolationClose(c) {
  13616. if (c === this.delimiterClose[this.delimiterIndex]) {
  13617. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  13618. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  13619. if (this.inRCDATA) {
  13620. this.state = 32;
  13621. } else {
  13622. this.state = 1;
  13623. }
  13624. this.sectionStart = this.index + 1;
  13625. } else {
  13626. this.delimiterIndex++;
  13627. }
  13628. } else {
  13629. this.state = 3;
  13630. this.stateInterpolation(c);
  13631. }
  13632. }
  13633. stateSpecialStartSequence(c) {
  13634. const isEnd = this.sequenceIndex === this.currentSequence.length;
  13635. const isMatch = isEnd ? (
  13636. // If we are at the end of the sequence, make sure the tag name has ended
  13637. isEndOfTagSection(c)
  13638. ) : (
  13639. // Otherwise, do a case-insensitive comparison
  13640. (c | 32) === this.currentSequence[this.sequenceIndex]
  13641. );
  13642. if (!isMatch) {
  13643. this.inRCDATA = false;
  13644. } else if (!isEnd) {
  13645. this.sequenceIndex++;
  13646. return;
  13647. }
  13648. this.sequenceIndex = 0;
  13649. this.state = 6;
  13650. this.stateInTagName(c);
  13651. }
  13652. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  13653. stateInRCDATA(c) {
  13654. if (this.sequenceIndex === this.currentSequence.length) {
  13655. if (c === 62 || isWhitespace(c)) {
  13656. const endOfText = this.index - this.currentSequence.length;
  13657. if (this.sectionStart < endOfText) {
  13658. const actualIndex = this.index;
  13659. this.index = endOfText;
  13660. this.cbs.ontext(this.sectionStart, endOfText);
  13661. this.index = actualIndex;
  13662. }
  13663. this.sectionStart = endOfText + 2;
  13664. this.stateInClosingTagName(c);
  13665. this.inRCDATA = false;
  13666. return;
  13667. }
  13668. this.sequenceIndex = 0;
  13669. }
  13670. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  13671. this.sequenceIndex += 1;
  13672. } else if (this.sequenceIndex === 0) {
  13673. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  13674. if (!this.inVPre && c === this.delimiterOpen[0]) {
  13675. this.state = 2;
  13676. this.delimiterIndex = 0;
  13677. this.stateInterpolationOpen(c);
  13678. }
  13679. } else if (this.fastForwardTo(60)) {
  13680. this.sequenceIndex = 1;
  13681. }
  13682. } else {
  13683. this.sequenceIndex = Number(c === 60);
  13684. }
  13685. }
  13686. stateCDATASequence(c) {
  13687. if (c === Sequences.Cdata[this.sequenceIndex]) {
  13688. if (++this.sequenceIndex === Sequences.Cdata.length) {
  13689. this.state = 28;
  13690. this.currentSequence = Sequences.CdataEnd;
  13691. this.sequenceIndex = 0;
  13692. this.sectionStart = this.index + 1;
  13693. }
  13694. } else {
  13695. this.sequenceIndex = 0;
  13696. this.state = 23;
  13697. this.stateInDeclaration(c);
  13698. }
  13699. }
  13700. /**
  13701. * When we wait for one specific character, we can speed things up
  13702. * by skipping through the buffer until we find it.
  13703. *
  13704. * @returns Whether the character was found.
  13705. */
  13706. fastForwardTo(c) {
  13707. while (++this.index < this.buffer.length) {
  13708. const cc = this.buffer.charCodeAt(this.index);
  13709. if (cc === 10) {
  13710. this.newlines.push(this.index);
  13711. }
  13712. if (cc === c) {
  13713. return true;
  13714. }
  13715. }
  13716. this.index = this.buffer.length - 1;
  13717. return false;
  13718. }
  13719. /**
  13720. * Comments and CDATA end with `-->` and `]]>`.
  13721. *
  13722. * Their common qualities are:
  13723. * - Their end sequences have a distinct character they start with.
  13724. * - That character is then repeated, so we have to check multiple repeats.
  13725. * - All characters but the start character of the sequence can be skipped.
  13726. */
  13727. stateInCommentLike(c) {
  13728. if (c === this.currentSequence[this.sequenceIndex]) {
  13729. if (++this.sequenceIndex === this.currentSequence.length) {
  13730. if (this.currentSequence === Sequences.CdataEnd) {
  13731. this.cbs.oncdata(this.sectionStart, this.index - 2);
  13732. } else {
  13733. this.cbs.oncomment(this.sectionStart, this.index - 2);
  13734. }
  13735. this.sequenceIndex = 0;
  13736. this.sectionStart = this.index + 1;
  13737. this.state = 1;
  13738. }
  13739. } else if (this.sequenceIndex === 0) {
  13740. if (this.fastForwardTo(this.currentSequence[0])) {
  13741. this.sequenceIndex = 1;
  13742. }
  13743. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  13744. this.sequenceIndex = 0;
  13745. }
  13746. }
  13747. startSpecial(sequence, offset) {
  13748. this.enterRCDATA(sequence, offset);
  13749. this.state = 31;
  13750. }
  13751. enterRCDATA(sequence, offset) {
  13752. this.inRCDATA = true;
  13753. this.currentSequence = sequence;
  13754. this.sequenceIndex = offset;
  13755. }
  13756. stateBeforeTagName(c) {
  13757. if (c === 33) {
  13758. this.state = 22;
  13759. this.sectionStart = this.index + 1;
  13760. } else if (c === 63) {
  13761. this.state = 24;
  13762. this.sectionStart = this.index + 1;
  13763. } else if (isTagStartChar(c)) {
  13764. this.sectionStart = this.index;
  13765. if (this.mode === 0) {
  13766. this.state = 6;
  13767. } else if (this.inSFCRoot) {
  13768. this.state = 34;
  13769. } else if (!this.inXML) {
  13770. if (c === 116) {
  13771. this.state = 30;
  13772. } else {
  13773. this.state = c === 115 ? 29 : 6;
  13774. }
  13775. } else {
  13776. this.state = 6;
  13777. }
  13778. } else if (c === 47) {
  13779. this.state = 8;
  13780. } else {
  13781. this.state = 1;
  13782. this.stateText(c);
  13783. }
  13784. }
  13785. stateInTagName(c) {
  13786. if (isEndOfTagSection(c)) {
  13787. this.handleTagName(c);
  13788. }
  13789. }
  13790. stateInSFCRootTagName(c) {
  13791. if (isEndOfTagSection(c)) {
  13792. const tag = this.buffer.slice(this.sectionStart, this.index);
  13793. if (tag !== "template") {
  13794. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  13795. }
  13796. this.handleTagName(c);
  13797. }
  13798. }
  13799. handleTagName(c) {
  13800. this.cbs.onopentagname(this.sectionStart, this.index);
  13801. this.sectionStart = -1;
  13802. this.state = 11;
  13803. this.stateBeforeAttrName(c);
  13804. }
  13805. stateBeforeClosingTagName(c) {
  13806. if (isWhitespace(c)) ; else if (c === 62) {
  13807. {
  13808. this.cbs.onerr(14, this.index);
  13809. }
  13810. this.state = 1;
  13811. this.sectionStart = this.index + 1;
  13812. } else {
  13813. this.state = isTagStartChar(c) ? 9 : 27;
  13814. this.sectionStart = this.index;
  13815. }
  13816. }
  13817. stateInClosingTagName(c) {
  13818. if (c === 62 || isWhitespace(c)) {
  13819. this.cbs.onclosetag(this.sectionStart, this.index);
  13820. this.sectionStart = -1;
  13821. this.state = 10;
  13822. this.stateAfterClosingTagName(c);
  13823. }
  13824. }
  13825. stateAfterClosingTagName(c) {
  13826. if (c === 62) {
  13827. this.state = 1;
  13828. this.sectionStart = this.index + 1;
  13829. }
  13830. }
  13831. stateBeforeAttrName(c) {
  13832. if (c === 62) {
  13833. this.cbs.onopentagend(this.index);
  13834. if (this.inRCDATA) {
  13835. this.state = 32;
  13836. } else {
  13837. this.state = 1;
  13838. }
  13839. this.sectionStart = this.index + 1;
  13840. } else if (c === 47) {
  13841. this.state = 7;
  13842. if (this.peek() !== 62) {
  13843. this.cbs.onerr(22, this.index);
  13844. }
  13845. } else if (c === 60 && this.peek() === 47) {
  13846. this.cbs.onopentagend(this.index);
  13847. this.state = 5;
  13848. this.sectionStart = this.index;
  13849. } else if (!isWhitespace(c)) {
  13850. if (c === 61) {
  13851. this.cbs.onerr(
  13852. 19,
  13853. this.index
  13854. );
  13855. }
  13856. this.handleAttrStart(c);
  13857. }
  13858. }
  13859. handleAttrStart(c) {
  13860. if (c === 118 && this.peek() === 45) {
  13861. this.state = 13;
  13862. this.sectionStart = this.index;
  13863. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  13864. this.cbs.ondirname(this.index, this.index + 1);
  13865. this.state = 14;
  13866. this.sectionStart = this.index + 1;
  13867. } else {
  13868. this.state = 12;
  13869. this.sectionStart = this.index;
  13870. }
  13871. }
  13872. stateInSelfClosingTag(c) {
  13873. if (c === 62) {
  13874. this.cbs.onselfclosingtag(this.index);
  13875. this.state = 1;
  13876. this.sectionStart = this.index + 1;
  13877. this.inRCDATA = false;
  13878. } else if (!isWhitespace(c)) {
  13879. this.state = 11;
  13880. this.stateBeforeAttrName(c);
  13881. }
  13882. }
  13883. stateInAttrName(c) {
  13884. if (c === 61 || isEndOfTagSection(c)) {
  13885. this.cbs.onattribname(this.sectionStart, this.index);
  13886. this.handleAttrNameEnd(c);
  13887. } else if (c === 34 || c === 39 || c === 60) {
  13888. this.cbs.onerr(
  13889. 17,
  13890. this.index
  13891. );
  13892. }
  13893. }
  13894. stateInDirName(c) {
  13895. if (c === 61 || isEndOfTagSection(c)) {
  13896. this.cbs.ondirname(this.sectionStart, this.index);
  13897. this.handleAttrNameEnd(c);
  13898. } else if (c === 58) {
  13899. this.cbs.ondirname(this.sectionStart, this.index);
  13900. this.state = 14;
  13901. this.sectionStart = this.index + 1;
  13902. } else if (c === 46) {
  13903. this.cbs.ondirname(this.sectionStart, this.index);
  13904. this.state = 16;
  13905. this.sectionStart = this.index + 1;
  13906. }
  13907. }
  13908. stateInDirArg(c) {
  13909. if (c === 61 || isEndOfTagSection(c)) {
  13910. this.cbs.ondirarg(this.sectionStart, this.index);
  13911. this.handleAttrNameEnd(c);
  13912. } else if (c === 91) {
  13913. this.state = 15;
  13914. } else if (c === 46) {
  13915. this.cbs.ondirarg(this.sectionStart, this.index);
  13916. this.state = 16;
  13917. this.sectionStart = this.index + 1;
  13918. }
  13919. }
  13920. stateInDynamicDirArg(c) {
  13921. if (c === 93) {
  13922. this.state = 14;
  13923. } else if (c === 61 || isEndOfTagSection(c)) {
  13924. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  13925. this.handleAttrNameEnd(c);
  13926. {
  13927. this.cbs.onerr(
  13928. 27,
  13929. this.index
  13930. );
  13931. }
  13932. }
  13933. }
  13934. stateInDirModifier(c) {
  13935. if (c === 61 || isEndOfTagSection(c)) {
  13936. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13937. this.handleAttrNameEnd(c);
  13938. } else if (c === 46) {
  13939. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13940. this.sectionStart = this.index + 1;
  13941. }
  13942. }
  13943. handleAttrNameEnd(c) {
  13944. this.sectionStart = this.index;
  13945. this.state = 17;
  13946. this.cbs.onattribnameend(this.index);
  13947. this.stateAfterAttrName(c);
  13948. }
  13949. stateAfterAttrName(c) {
  13950. if (c === 61) {
  13951. this.state = 18;
  13952. } else if (c === 47 || c === 62) {
  13953. this.cbs.onattribend(0, this.sectionStart);
  13954. this.sectionStart = -1;
  13955. this.state = 11;
  13956. this.stateBeforeAttrName(c);
  13957. } else if (!isWhitespace(c)) {
  13958. this.cbs.onattribend(0, this.sectionStart);
  13959. this.handleAttrStart(c);
  13960. }
  13961. }
  13962. stateBeforeAttrValue(c) {
  13963. if (c === 34) {
  13964. this.state = 19;
  13965. this.sectionStart = this.index + 1;
  13966. } else if (c === 39) {
  13967. this.state = 20;
  13968. this.sectionStart = this.index + 1;
  13969. } else if (!isWhitespace(c)) {
  13970. this.sectionStart = this.index;
  13971. this.state = 21;
  13972. this.stateInAttrValueNoQuotes(c);
  13973. }
  13974. }
  13975. handleInAttrValue(c, quote) {
  13976. if (c === quote || this.fastForwardTo(quote)) {
  13977. this.cbs.onattribdata(this.sectionStart, this.index);
  13978. this.sectionStart = -1;
  13979. this.cbs.onattribend(
  13980. quote === 34 ? 3 : 2,
  13981. this.index + 1
  13982. );
  13983. this.state = 11;
  13984. }
  13985. }
  13986. stateInAttrValueDoubleQuotes(c) {
  13987. this.handleInAttrValue(c, 34);
  13988. }
  13989. stateInAttrValueSingleQuotes(c) {
  13990. this.handleInAttrValue(c, 39);
  13991. }
  13992. stateInAttrValueNoQuotes(c) {
  13993. if (isWhitespace(c) || c === 62) {
  13994. this.cbs.onattribdata(this.sectionStart, this.index);
  13995. this.sectionStart = -1;
  13996. this.cbs.onattribend(1, this.index);
  13997. this.state = 11;
  13998. this.stateBeforeAttrName(c);
  13999. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  14000. this.cbs.onerr(
  14001. 18,
  14002. this.index
  14003. );
  14004. } else ;
  14005. }
  14006. stateBeforeDeclaration(c) {
  14007. if (c === 91) {
  14008. this.state = 26;
  14009. this.sequenceIndex = 0;
  14010. } else {
  14011. this.state = c === 45 ? 25 : 23;
  14012. }
  14013. }
  14014. stateInDeclaration(c) {
  14015. if (c === 62 || this.fastForwardTo(62)) {
  14016. this.state = 1;
  14017. this.sectionStart = this.index + 1;
  14018. }
  14019. }
  14020. stateInProcessingInstruction(c) {
  14021. if (c === 62 || this.fastForwardTo(62)) {
  14022. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  14023. this.state = 1;
  14024. this.sectionStart = this.index + 1;
  14025. }
  14026. }
  14027. stateBeforeComment(c) {
  14028. if (c === 45) {
  14029. this.state = 28;
  14030. this.currentSequence = Sequences.CommentEnd;
  14031. this.sequenceIndex = 2;
  14032. this.sectionStart = this.index + 1;
  14033. } else {
  14034. this.state = 23;
  14035. }
  14036. }
  14037. stateInSpecialComment(c) {
  14038. if (c === 62 || this.fastForwardTo(62)) {
  14039. this.cbs.oncomment(this.sectionStart, this.index);
  14040. this.state = 1;
  14041. this.sectionStart = this.index + 1;
  14042. }
  14043. }
  14044. stateBeforeSpecialS(c) {
  14045. if (c === Sequences.ScriptEnd[3]) {
  14046. this.startSpecial(Sequences.ScriptEnd, 4);
  14047. } else if (c === Sequences.StyleEnd[3]) {
  14048. this.startSpecial(Sequences.StyleEnd, 4);
  14049. } else {
  14050. this.state = 6;
  14051. this.stateInTagName(c);
  14052. }
  14053. }
  14054. stateBeforeSpecialT(c) {
  14055. if (c === Sequences.TitleEnd[3]) {
  14056. this.startSpecial(Sequences.TitleEnd, 4);
  14057. } else if (c === Sequences.TextareaEnd[3]) {
  14058. this.startSpecial(Sequences.TextareaEnd, 4);
  14059. } else {
  14060. this.state = 6;
  14061. this.stateInTagName(c);
  14062. }
  14063. }
  14064. startEntity() {
  14065. }
  14066. stateInEntity() {
  14067. }
  14068. /**
  14069. * Iterates through the buffer, calling the function corresponding to the current state.
  14070. *
  14071. * States that are more likely to be hit are higher up, as a performance improvement.
  14072. */
  14073. parse(input) {
  14074. this.buffer = input;
  14075. while (this.index < this.buffer.length) {
  14076. const c = this.buffer.charCodeAt(this.index);
  14077. if (c === 10 && this.state !== 33) {
  14078. this.newlines.push(this.index);
  14079. }
  14080. switch (this.state) {
  14081. case 1: {
  14082. this.stateText(c);
  14083. break;
  14084. }
  14085. case 2: {
  14086. this.stateInterpolationOpen(c);
  14087. break;
  14088. }
  14089. case 3: {
  14090. this.stateInterpolation(c);
  14091. break;
  14092. }
  14093. case 4: {
  14094. this.stateInterpolationClose(c);
  14095. break;
  14096. }
  14097. case 31: {
  14098. this.stateSpecialStartSequence(c);
  14099. break;
  14100. }
  14101. case 32: {
  14102. this.stateInRCDATA(c);
  14103. break;
  14104. }
  14105. case 26: {
  14106. this.stateCDATASequence(c);
  14107. break;
  14108. }
  14109. case 19: {
  14110. this.stateInAttrValueDoubleQuotes(c);
  14111. break;
  14112. }
  14113. case 12: {
  14114. this.stateInAttrName(c);
  14115. break;
  14116. }
  14117. case 13: {
  14118. this.stateInDirName(c);
  14119. break;
  14120. }
  14121. case 14: {
  14122. this.stateInDirArg(c);
  14123. break;
  14124. }
  14125. case 15: {
  14126. this.stateInDynamicDirArg(c);
  14127. break;
  14128. }
  14129. case 16: {
  14130. this.stateInDirModifier(c);
  14131. break;
  14132. }
  14133. case 28: {
  14134. this.stateInCommentLike(c);
  14135. break;
  14136. }
  14137. case 27: {
  14138. this.stateInSpecialComment(c);
  14139. break;
  14140. }
  14141. case 11: {
  14142. this.stateBeforeAttrName(c);
  14143. break;
  14144. }
  14145. case 6: {
  14146. this.stateInTagName(c);
  14147. break;
  14148. }
  14149. case 34: {
  14150. this.stateInSFCRootTagName(c);
  14151. break;
  14152. }
  14153. case 9: {
  14154. this.stateInClosingTagName(c);
  14155. break;
  14156. }
  14157. case 5: {
  14158. this.stateBeforeTagName(c);
  14159. break;
  14160. }
  14161. case 17: {
  14162. this.stateAfterAttrName(c);
  14163. break;
  14164. }
  14165. case 20: {
  14166. this.stateInAttrValueSingleQuotes(c);
  14167. break;
  14168. }
  14169. case 18: {
  14170. this.stateBeforeAttrValue(c);
  14171. break;
  14172. }
  14173. case 8: {
  14174. this.stateBeforeClosingTagName(c);
  14175. break;
  14176. }
  14177. case 10: {
  14178. this.stateAfterClosingTagName(c);
  14179. break;
  14180. }
  14181. case 29: {
  14182. this.stateBeforeSpecialS(c);
  14183. break;
  14184. }
  14185. case 30: {
  14186. this.stateBeforeSpecialT(c);
  14187. break;
  14188. }
  14189. case 21: {
  14190. this.stateInAttrValueNoQuotes(c);
  14191. break;
  14192. }
  14193. case 7: {
  14194. this.stateInSelfClosingTag(c);
  14195. break;
  14196. }
  14197. case 23: {
  14198. this.stateInDeclaration(c);
  14199. break;
  14200. }
  14201. case 22: {
  14202. this.stateBeforeDeclaration(c);
  14203. break;
  14204. }
  14205. case 25: {
  14206. this.stateBeforeComment(c);
  14207. break;
  14208. }
  14209. case 24: {
  14210. this.stateInProcessingInstruction(c);
  14211. break;
  14212. }
  14213. case 33: {
  14214. this.stateInEntity();
  14215. break;
  14216. }
  14217. }
  14218. this.index++;
  14219. }
  14220. this.cleanup();
  14221. this.finish();
  14222. }
  14223. /**
  14224. * Remove data that has already been consumed from the buffer.
  14225. */
  14226. cleanup() {
  14227. if (this.sectionStart !== this.index) {
  14228. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  14229. this.cbs.ontext(this.sectionStart, this.index);
  14230. this.sectionStart = this.index;
  14231. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  14232. this.cbs.onattribdata(this.sectionStart, this.index);
  14233. this.sectionStart = this.index;
  14234. }
  14235. }
  14236. }
  14237. finish() {
  14238. this.handleTrailingData();
  14239. this.cbs.onend();
  14240. }
  14241. /** Handle any trailing data. */
  14242. handleTrailingData() {
  14243. const endIndex = this.buffer.length;
  14244. if (this.sectionStart >= endIndex) {
  14245. return;
  14246. }
  14247. if (this.state === 28) {
  14248. if (this.currentSequence === Sequences.CdataEnd) {
  14249. this.cbs.oncdata(this.sectionStart, endIndex);
  14250. } else {
  14251. this.cbs.oncomment(this.sectionStart, endIndex);
  14252. }
  14253. } 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 {
  14254. this.cbs.ontext(this.sectionStart, endIndex);
  14255. }
  14256. }
  14257. emitCodePoint(cp, consumed) {
  14258. }
  14259. }
  14260. function defaultOnError(error) {
  14261. throw error;
  14262. }
  14263. function defaultOnWarn(msg) {
  14264. console.warn(`[Vue warn] ${msg.message}`);
  14265. }
  14266. function createCompilerError(code, loc, messages, additionalMessage) {
  14267. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  14268. const error = new SyntaxError(String(msg));
  14269. error.code = code;
  14270. error.loc = loc;
  14271. return error;
  14272. }
  14273. const errorMessages = {
  14274. // parse errors
  14275. [0]: "Illegal comment.",
  14276. [1]: "CDATA section is allowed only in XML context.",
  14277. [2]: "Duplicate attribute.",
  14278. [3]: "End tag cannot have attributes.",
  14279. [4]: "Illegal '/' in tags.",
  14280. [5]: "Unexpected EOF in tag.",
  14281. [6]: "Unexpected EOF in CDATA section.",
  14282. [7]: "Unexpected EOF in comment.",
  14283. [8]: "Unexpected EOF in script.",
  14284. [9]: "Unexpected EOF in tag.",
  14285. [10]: "Incorrectly closed comment.",
  14286. [11]: "Incorrectly opened comment.",
  14287. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  14288. [13]: "Attribute value was expected.",
  14289. [14]: "End tag name was expected.",
  14290. [15]: "Whitespace was expected.",
  14291. [16]: "Unexpected '<!--' in comment.",
  14292. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  14293. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  14294. [19]: "Attribute name cannot start with '='.",
  14295. [21]: "'<?' is allowed only in XML context.",
  14296. [20]: `Unexpected null character.`,
  14297. [22]: "Illegal '/' in tags.",
  14298. // Vue-specific parse errors
  14299. [23]: "Invalid end tag.",
  14300. [24]: "Element is missing end tag.",
  14301. [25]: "Interpolation end sign was not found.",
  14302. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  14303. [26]: "Legal directive name was expected.",
  14304. // transform errors
  14305. [28]: `v-if/v-else-if is missing expression.`,
  14306. [29]: `v-if/else branches must use unique keys.`,
  14307. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  14308. [31]: `v-for is missing expression.`,
  14309. [32]: `v-for has invalid expression.`,
  14310. [33]: `<template v-for> key should be placed on the <template> tag.`,
  14311. [34]: `v-bind is missing expression.`,
  14312. [53]: `v-bind with same-name shorthand only allows static argument.`,
  14313. [35]: `v-on is missing expression.`,
  14314. [36]: `Unexpected custom directive on <slot> outlet.`,
  14315. [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.`,
  14316. [38]: `Duplicate slot names found. `,
  14317. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  14318. [40]: `v-slot can only be used on components or <template> tags.`,
  14319. [41]: `v-model is missing expression.`,
  14320. [42]: `v-model value must be a valid JavaScript member expression.`,
  14321. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  14322. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  14323. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  14324. [45]: `v-model cannot be used on a const binding because it is not writable.`,
  14325. [46]: `Error parsing JavaScript expression: `,
  14326. [47]: `<KeepAlive> expects exactly one child component.`,
  14327. [52]: `@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.`,
  14328. // generic errors
  14329. [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  14330. [49]: `ES module mode is not supported in this build of compiler.`,
  14331. [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  14332. [51]: `"scopeId" option is only supported in module mode.`,
  14333. // just to fulfill types
  14334. [54]: ``
  14335. };
  14336. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  14337. function isCoreComponent(tag) {
  14338. switch (tag) {
  14339. case "Teleport":
  14340. case "teleport":
  14341. return TELEPORT;
  14342. case "Suspense":
  14343. case "suspense":
  14344. return SUSPENSE;
  14345. case "KeepAlive":
  14346. case "keep-alive":
  14347. return KEEP_ALIVE;
  14348. case "BaseTransition":
  14349. case "base-transition":
  14350. return BASE_TRANSITION;
  14351. }
  14352. }
  14353. const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
  14354. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  14355. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  14356. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  14357. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  14358. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  14359. const isMemberExpressionBrowser = (exp) => {
  14360. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  14361. let state = 0 /* inMemberExp */;
  14362. let stateStack = [];
  14363. let currentOpenBracketCount = 0;
  14364. let currentOpenParensCount = 0;
  14365. let currentStringType = null;
  14366. for (let i = 0; i < path.length; i++) {
  14367. const char = path.charAt(i);
  14368. switch (state) {
  14369. case 0 /* inMemberExp */:
  14370. if (char === "[") {
  14371. stateStack.push(state);
  14372. state = 1 /* inBrackets */;
  14373. currentOpenBracketCount++;
  14374. } else if (char === "(") {
  14375. stateStack.push(state);
  14376. state = 2 /* inParens */;
  14377. currentOpenParensCount++;
  14378. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  14379. return false;
  14380. }
  14381. break;
  14382. case 1 /* inBrackets */:
  14383. if (char === `'` || char === `"` || char === "`") {
  14384. stateStack.push(state);
  14385. state = 3 /* inString */;
  14386. currentStringType = char;
  14387. } else if (char === `[`) {
  14388. currentOpenBracketCount++;
  14389. } else if (char === `]`) {
  14390. if (!--currentOpenBracketCount) {
  14391. state = stateStack.pop();
  14392. }
  14393. }
  14394. break;
  14395. case 2 /* inParens */:
  14396. if (char === `'` || char === `"` || char === "`") {
  14397. stateStack.push(state);
  14398. state = 3 /* inString */;
  14399. currentStringType = char;
  14400. } else if (char === `(`) {
  14401. currentOpenParensCount++;
  14402. } else if (char === `)`) {
  14403. if (i === path.length - 1) {
  14404. return false;
  14405. }
  14406. if (!--currentOpenParensCount) {
  14407. state = stateStack.pop();
  14408. }
  14409. }
  14410. break;
  14411. case 3 /* inString */:
  14412. if (char === currentStringType) {
  14413. state = stateStack.pop();
  14414. currentStringType = null;
  14415. }
  14416. break;
  14417. }
  14418. }
  14419. return !currentOpenBracketCount && !currentOpenParensCount;
  14420. };
  14421. const isMemberExpression = isMemberExpressionBrowser ;
  14422. const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  14423. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  14424. const isFnExpression = isFnExpressionBrowser ;
  14425. function assert(condition, msg) {
  14426. if (!condition) {
  14427. throw new Error(msg || `unexpected compiler condition`);
  14428. }
  14429. }
  14430. function findDir(node, name, allowEmpty = false) {
  14431. for (let i = 0; i < node.props.length; i++) {
  14432. const p = node.props[i];
  14433. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  14434. return p;
  14435. }
  14436. }
  14437. }
  14438. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  14439. for (let i = 0; i < node.props.length; i++) {
  14440. const p = node.props[i];
  14441. if (p.type === 6) {
  14442. if (dynamicOnly) continue;
  14443. if (p.name === name && (p.value || allowEmpty)) {
  14444. return p;
  14445. }
  14446. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  14447. return p;
  14448. }
  14449. }
  14450. }
  14451. function isStaticArgOf(arg, name) {
  14452. return !!(arg && isStaticExp(arg) && arg.content === name);
  14453. }
  14454. function hasDynamicKeyVBind(node) {
  14455. return node.props.some(
  14456. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  14457. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  14458. !p.arg.isStatic)
  14459. // v-bind:[foo]
  14460. );
  14461. }
  14462. function isText$1(node) {
  14463. return node.type === 5 || node.type === 2;
  14464. }
  14465. function isVPre(p) {
  14466. return p.type === 7 && p.name === "pre";
  14467. }
  14468. function isVSlot(p) {
  14469. return p.type === 7 && p.name === "slot";
  14470. }
  14471. function isTemplateNode(node) {
  14472. return node.type === 1 && node.tagType === 3;
  14473. }
  14474. function isSlotOutlet(node) {
  14475. return node.type === 1 && node.tagType === 2;
  14476. }
  14477. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  14478. function getUnnormalizedProps(props, callPath = []) {
  14479. if (props && !isString(props) && props.type === 14) {
  14480. const callee = props.callee;
  14481. if (!isString(callee) && propsHelperSet.has(callee)) {
  14482. return getUnnormalizedProps(
  14483. props.arguments[0],
  14484. callPath.concat(props)
  14485. );
  14486. }
  14487. }
  14488. return [props, callPath];
  14489. }
  14490. function injectProp(node, prop, context) {
  14491. if (node.type !== 13 && injectSlotKey(node, prop)) {
  14492. return;
  14493. }
  14494. let propsWithInjection;
  14495. let props = node.type === 13 ? node.props : node.arguments[2];
  14496. let callPath = [];
  14497. let parentCall;
  14498. if (props && !isString(props) && props.type === 14) {
  14499. const ret = getUnnormalizedProps(props);
  14500. props = ret[0];
  14501. callPath = ret[1];
  14502. parentCall = callPath[callPath.length - 1];
  14503. }
  14504. if (props == null || isString(props)) {
  14505. propsWithInjection = createObjectExpression([prop]);
  14506. } else if (props.type === 14) {
  14507. const first = props.arguments[0];
  14508. if (!isString(first) && first.type === 15) {
  14509. if (!hasProp(prop, first)) {
  14510. first.properties.unshift(prop);
  14511. }
  14512. } else {
  14513. if (props.callee === TO_HANDLERS) {
  14514. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  14515. createObjectExpression([prop]),
  14516. props
  14517. ]);
  14518. } else {
  14519. props.arguments.unshift(createObjectExpression([prop]));
  14520. }
  14521. }
  14522. !propsWithInjection && (propsWithInjection = props);
  14523. } else if (props.type === 15) {
  14524. if (!hasProp(prop, props)) {
  14525. props.properties.unshift(prop);
  14526. }
  14527. propsWithInjection = props;
  14528. } else {
  14529. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  14530. createObjectExpression([prop]),
  14531. props
  14532. ]);
  14533. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  14534. parentCall = callPath[callPath.length - 2];
  14535. }
  14536. }
  14537. if (node.type === 13) {
  14538. if (parentCall) {
  14539. parentCall.arguments[0] = propsWithInjection;
  14540. } else {
  14541. node.props = propsWithInjection;
  14542. }
  14543. } else {
  14544. if (parentCall) {
  14545. parentCall.arguments[0] = propsWithInjection;
  14546. } else {
  14547. node.arguments[2] = propsWithInjection;
  14548. }
  14549. }
  14550. }
  14551. function injectSlotKey(node, prop) {
  14552. var _a, _b, _c;
  14553. if (prop.key.type !== 4 || prop.key.content !== "key") {
  14554. return false;
  14555. }
  14556. const props = node.arguments[2];
  14557. if (props && !isString(props)) {
  14558. const [unnormalizedProps] = getUnnormalizedProps(props);
  14559. if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
  14560. return true;
  14561. }
  14562. }
  14563. (_a = node.arguments)[2] || (_a[2] = "{}");
  14564. (_b = node.arguments)[3] || (_b[3] = "undefined");
  14565. (_c = node.arguments)[4] || (_c[4] = "undefined");
  14566. node.arguments[5] = prop.value;
  14567. return true;
  14568. }
  14569. function hasProp(prop, props) {
  14570. let result = false;
  14571. if (prop.key.type === 4) {
  14572. const propKeyName = prop.key.content;
  14573. result = props.properties.some(
  14574. (p) => p.key.type === 4 && p.key.content === propKeyName
  14575. );
  14576. }
  14577. return result;
  14578. }
  14579. function toValidAssetId(name, type) {
  14580. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  14581. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  14582. })}`;
  14583. }
  14584. function getMemoedVNodeCall(node) {
  14585. if (node.type === 14 && node.callee === WITH_MEMO) {
  14586. return node.arguments[1].returns;
  14587. } else {
  14588. return node;
  14589. }
  14590. }
  14591. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  14592. function isAllWhitespace(str) {
  14593. for (let i = 0; i < str.length; i++) {
  14594. if (!isWhitespace(str.charCodeAt(i))) {
  14595. return false;
  14596. }
  14597. }
  14598. return true;
  14599. }
  14600. function isWhitespaceText(node) {
  14601. return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
  14602. }
  14603. function isCommentOrWhitespace(node) {
  14604. return node.type === 3 || isWhitespaceText(node);
  14605. }
  14606. const defaultParserOptions = {
  14607. parseMode: "base",
  14608. ns: 0,
  14609. delimiters: [`{{`, `}}`],
  14610. getNamespace: () => 0,
  14611. isVoidTag: NO,
  14612. isPreTag: NO,
  14613. isIgnoreNewlineTag: NO,
  14614. isCustomElement: NO,
  14615. onError: defaultOnError,
  14616. onWarn: defaultOnWarn,
  14617. comments: true,
  14618. prefixIdentifiers: false
  14619. };
  14620. let currentOptions = defaultParserOptions;
  14621. let currentRoot = null;
  14622. let currentInput = "";
  14623. let currentOpenTag = null;
  14624. let currentProp = null;
  14625. let currentAttrValue = "";
  14626. let currentAttrStartIndex = -1;
  14627. let currentAttrEndIndex = -1;
  14628. let inPre = 0;
  14629. let inVPre = false;
  14630. let currentVPreBoundary = null;
  14631. const stack = [];
  14632. const tokenizer = new Tokenizer(stack, {
  14633. onerr: emitError,
  14634. ontext(start, end) {
  14635. onText(getSlice(start, end), start, end);
  14636. },
  14637. ontextentity(char, start, end) {
  14638. onText(char, start, end);
  14639. },
  14640. oninterpolation(start, end) {
  14641. if (inVPre) {
  14642. return onText(getSlice(start, end), start, end);
  14643. }
  14644. let innerStart = start + tokenizer.delimiterOpen.length;
  14645. let innerEnd = end - tokenizer.delimiterClose.length;
  14646. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  14647. innerStart++;
  14648. }
  14649. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  14650. innerEnd--;
  14651. }
  14652. let exp = getSlice(innerStart, innerEnd);
  14653. if (exp.includes("&")) {
  14654. {
  14655. exp = currentOptions.decodeEntities(exp, false);
  14656. }
  14657. }
  14658. addNode({
  14659. type: 5,
  14660. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  14661. loc: getLoc(start, end)
  14662. });
  14663. },
  14664. onopentagname(start, end) {
  14665. const name = getSlice(start, end);
  14666. currentOpenTag = {
  14667. type: 1,
  14668. tag: name,
  14669. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  14670. tagType: 0,
  14671. // will be refined on tag close
  14672. props: [],
  14673. children: [],
  14674. loc: getLoc(start - 1, end),
  14675. codegenNode: void 0
  14676. };
  14677. },
  14678. onopentagend(end) {
  14679. endOpenTag(end);
  14680. },
  14681. onclosetag(start, end) {
  14682. const name = getSlice(start, end);
  14683. if (!currentOptions.isVoidTag(name)) {
  14684. let found = false;
  14685. for (let i = 0; i < stack.length; i++) {
  14686. const e = stack[i];
  14687. if (e.tag.toLowerCase() === name.toLowerCase()) {
  14688. found = true;
  14689. if (i > 0) {
  14690. emitError(24, stack[0].loc.start.offset);
  14691. }
  14692. for (let j = 0; j <= i; j++) {
  14693. const el = stack.shift();
  14694. onCloseTag(el, end, j < i);
  14695. }
  14696. break;
  14697. }
  14698. }
  14699. if (!found) {
  14700. emitError(23, backTrack(start, 60));
  14701. }
  14702. }
  14703. },
  14704. onselfclosingtag(end) {
  14705. const name = currentOpenTag.tag;
  14706. currentOpenTag.isSelfClosing = true;
  14707. endOpenTag(end);
  14708. if (stack[0] && stack[0].tag === name) {
  14709. onCloseTag(stack.shift(), end);
  14710. }
  14711. },
  14712. onattribname(start, end) {
  14713. currentProp = {
  14714. type: 6,
  14715. name: getSlice(start, end),
  14716. nameLoc: getLoc(start, end),
  14717. value: void 0,
  14718. loc: getLoc(start)
  14719. };
  14720. },
  14721. ondirname(start, end) {
  14722. const raw = getSlice(start, end);
  14723. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  14724. if (!inVPre && name === "") {
  14725. emitError(26, start);
  14726. }
  14727. if (inVPre || name === "") {
  14728. currentProp = {
  14729. type: 6,
  14730. name: raw,
  14731. nameLoc: getLoc(start, end),
  14732. value: void 0,
  14733. loc: getLoc(start)
  14734. };
  14735. } else {
  14736. currentProp = {
  14737. type: 7,
  14738. name,
  14739. rawName: raw,
  14740. exp: void 0,
  14741. arg: void 0,
  14742. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  14743. loc: getLoc(start)
  14744. };
  14745. if (name === "pre") {
  14746. inVPre = tokenizer.inVPre = true;
  14747. currentVPreBoundary = currentOpenTag;
  14748. const props = currentOpenTag.props;
  14749. for (let i = 0; i < props.length; i++) {
  14750. if (props[i].type === 7) {
  14751. props[i] = dirToAttr(props[i]);
  14752. }
  14753. }
  14754. }
  14755. }
  14756. },
  14757. ondirarg(start, end) {
  14758. if (start === end) return;
  14759. const arg = getSlice(start, end);
  14760. if (inVPre && !isVPre(currentProp)) {
  14761. currentProp.name += arg;
  14762. setLocEnd(currentProp.nameLoc, end);
  14763. } else {
  14764. const isStatic = arg[0] !== `[`;
  14765. currentProp.arg = createExp(
  14766. isStatic ? arg : arg.slice(1, -1),
  14767. isStatic,
  14768. getLoc(start, end),
  14769. isStatic ? 3 : 0
  14770. );
  14771. }
  14772. },
  14773. ondirmodifier(start, end) {
  14774. const mod = getSlice(start, end);
  14775. if (inVPre && !isVPre(currentProp)) {
  14776. currentProp.name += "." + mod;
  14777. setLocEnd(currentProp.nameLoc, end);
  14778. } else if (currentProp.name === "slot") {
  14779. const arg = currentProp.arg;
  14780. if (arg) {
  14781. arg.content += "." + mod;
  14782. setLocEnd(arg.loc, end);
  14783. }
  14784. } else {
  14785. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  14786. currentProp.modifiers.push(exp);
  14787. }
  14788. },
  14789. onattribdata(start, end) {
  14790. currentAttrValue += getSlice(start, end);
  14791. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14792. currentAttrEndIndex = end;
  14793. },
  14794. onattribentity(char, start, end) {
  14795. currentAttrValue += char;
  14796. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14797. currentAttrEndIndex = end;
  14798. },
  14799. onattribnameend(end) {
  14800. const start = currentProp.loc.start.offset;
  14801. const name = getSlice(start, end);
  14802. if (currentProp.type === 7) {
  14803. currentProp.rawName = name;
  14804. }
  14805. if (currentOpenTag.props.some(
  14806. (p) => (p.type === 7 ? p.rawName : p.name) === name
  14807. )) {
  14808. emitError(2, start);
  14809. }
  14810. },
  14811. onattribend(quote, end) {
  14812. if (currentOpenTag && currentProp) {
  14813. setLocEnd(currentProp.loc, end);
  14814. if (quote !== 0) {
  14815. if (currentAttrValue.includes("&")) {
  14816. currentAttrValue = currentOptions.decodeEntities(
  14817. currentAttrValue,
  14818. true
  14819. );
  14820. }
  14821. if (currentProp.type === 6) {
  14822. if (currentProp.name === "class") {
  14823. currentAttrValue = condense(currentAttrValue).trim();
  14824. }
  14825. if (quote === 1 && !currentAttrValue) {
  14826. emitError(13, end);
  14827. }
  14828. currentProp.value = {
  14829. type: 2,
  14830. content: currentAttrValue,
  14831. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  14832. };
  14833. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  14834. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  14835. }
  14836. } else {
  14837. let expParseMode = 0 /* Normal */;
  14838. currentProp.exp = createExp(
  14839. currentAttrValue,
  14840. false,
  14841. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  14842. 0,
  14843. expParseMode
  14844. );
  14845. if (currentProp.name === "for") {
  14846. currentProp.forParseResult = parseForExpression(currentProp.exp);
  14847. }
  14848. }
  14849. }
  14850. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  14851. currentOpenTag.props.push(currentProp);
  14852. }
  14853. }
  14854. currentAttrValue = "";
  14855. currentAttrStartIndex = currentAttrEndIndex = -1;
  14856. },
  14857. oncomment(start, end) {
  14858. if (currentOptions.comments) {
  14859. addNode({
  14860. type: 3,
  14861. content: getSlice(start, end),
  14862. loc: getLoc(start - 4, end + 3)
  14863. });
  14864. }
  14865. },
  14866. onend() {
  14867. const end = currentInput.length;
  14868. if (tokenizer.state !== 1) {
  14869. switch (tokenizer.state) {
  14870. case 5:
  14871. case 8:
  14872. emitError(5, end);
  14873. break;
  14874. case 3:
  14875. case 4:
  14876. emitError(
  14877. 25,
  14878. tokenizer.sectionStart
  14879. );
  14880. break;
  14881. case 28:
  14882. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  14883. emitError(6, end);
  14884. } else {
  14885. emitError(7, end);
  14886. }
  14887. break;
  14888. case 6:
  14889. case 7:
  14890. case 9:
  14891. case 11:
  14892. case 12:
  14893. case 13:
  14894. case 14:
  14895. case 15:
  14896. case 16:
  14897. case 17:
  14898. case 18:
  14899. case 19:
  14900. // "
  14901. case 20:
  14902. // '
  14903. case 21:
  14904. emitError(9, end);
  14905. break;
  14906. }
  14907. }
  14908. for (let index = 0; index < stack.length; index++) {
  14909. onCloseTag(stack[index], end - 1);
  14910. emitError(24, stack[index].loc.start.offset);
  14911. }
  14912. },
  14913. oncdata(start, end) {
  14914. if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
  14915. onText(getSlice(start, end), start, end);
  14916. } else {
  14917. emitError(1, start - 9);
  14918. }
  14919. },
  14920. onprocessinginstruction(start) {
  14921. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14922. emitError(
  14923. 21,
  14924. start - 1
  14925. );
  14926. }
  14927. }
  14928. });
  14929. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  14930. const stripParensRE = /^\(|\)$/g;
  14931. function parseForExpression(input) {
  14932. const loc = input.loc;
  14933. const exp = input.content;
  14934. const inMatch = exp.match(forAliasRE);
  14935. if (!inMatch) return;
  14936. const [, LHS, RHS] = inMatch;
  14937. const createAliasExpression = (content, offset, asParam = false) => {
  14938. const start = loc.start.offset + offset;
  14939. const end = start + content.length;
  14940. return createExp(
  14941. content,
  14942. false,
  14943. getLoc(start, end),
  14944. 0,
  14945. asParam ? 1 /* Params */ : 0 /* Normal */
  14946. );
  14947. };
  14948. const result = {
  14949. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  14950. value: void 0,
  14951. key: void 0,
  14952. index: void 0,
  14953. finalized: false
  14954. };
  14955. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  14956. const trimmedOffset = LHS.indexOf(valueContent);
  14957. const iteratorMatch = valueContent.match(forIteratorRE);
  14958. if (iteratorMatch) {
  14959. valueContent = valueContent.replace(forIteratorRE, "").trim();
  14960. const keyContent = iteratorMatch[1].trim();
  14961. let keyOffset;
  14962. if (keyContent) {
  14963. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  14964. result.key = createAliasExpression(keyContent, keyOffset, true);
  14965. }
  14966. if (iteratorMatch[2]) {
  14967. const indexContent = iteratorMatch[2].trim();
  14968. if (indexContent) {
  14969. result.index = createAliasExpression(
  14970. indexContent,
  14971. exp.indexOf(
  14972. indexContent,
  14973. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  14974. ),
  14975. true
  14976. );
  14977. }
  14978. }
  14979. }
  14980. if (valueContent) {
  14981. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  14982. }
  14983. return result;
  14984. }
  14985. function getSlice(start, end) {
  14986. return currentInput.slice(start, end);
  14987. }
  14988. function endOpenTag(end) {
  14989. if (tokenizer.inSFCRoot) {
  14990. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  14991. }
  14992. addNode(currentOpenTag);
  14993. const { tag, ns } = currentOpenTag;
  14994. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14995. inPre++;
  14996. }
  14997. if (currentOptions.isVoidTag(tag)) {
  14998. onCloseTag(currentOpenTag, end);
  14999. } else {
  15000. stack.unshift(currentOpenTag);
  15001. if (ns === 1 || ns === 2) {
  15002. tokenizer.inXML = true;
  15003. }
  15004. }
  15005. currentOpenTag = null;
  15006. }
  15007. function onText(content, start, end) {
  15008. {
  15009. const tag = stack[0] && stack[0].tag;
  15010. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  15011. content = currentOptions.decodeEntities(content, false);
  15012. }
  15013. }
  15014. const parent = stack[0] || currentRoot;
  15015. const lastNode = parent.children[parent.children.length - 1];
  15016. if (lastNode && lastNode.type === 2) {
  15017. lastNode.content += content;
  15018. setLocEnd(lastNode.loc, end);
  15019. } else {
  15020. parent.children.push({
  15021. type: 2,
  15022. content,
  15023. loc: getLoc(start, end)
  15024. });
  15025. }
  15026. }
  15027. function onCloseTag(el, end, isImplied = false) {
  15028. if (isImplied) {
  15029. setLocEnd(el.loc, backTrack(end, 60));
  15030. } else {
  15031. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  15032. }
  15033. if (tokenizer.inSFCRoot) {
  15034. if (el.children.length) {
  15035. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  15036. } else {
  15037. el.innerLoc.end = extend({}, el.innerLoc.start);
  15038. }
  15039. el.innerLoc.source = getSlice(
  15040. el.innerLoc.start.offset,
  15041. el.innerLoc.end.offset
  15042. );
  15043. }
  15044. const { tag, ns, children } = el;
  15045. if (!inVPre) {
  15046. if (tag === "slot") {
  15047. el.tagType = 2;
  15048. } else if (isFragmentTemplate(el)) {
  15049. el.tagType = 3;
  15050. } else if (isComponent(el)) {
  15051. el.tagType = 1;
  15052. }
  15053. }
  15054. if (!tokenizer.inRCDATA) {
  15055. el.children = condenseWhitespace(children);
  15056. }
  15057. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  15058. const first = children[0];
  15059. if (first && first.type === 2) {
  15060. first.content = first.content.replace(/^\r?\n/, "");
  15061. }
  15062. }
  15063. if (ns === 0 && currentOptions.isPreTag(tag)) {
  15064. inPre--;
  15065. }
  15066. if (currentVPreBoundary === el) {
  15067. inVPre = tokenizer.inVPre = false;
  15068. currentVPreBoundary = null;
  15069. }
  15070. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  15071. tokenizer.inXML = false;
  15072. }
  15073. }
  15074. function lookAhead(index, c) {
  15075. let i = index;
  15076. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  15077. return i;
  15078. }
  15079. function backTrack(index, c) {
  15080. let i = index;
  15081. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  15082. return i;
  15083. }
  15084. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  15085. function isFragmentTemplate({ tag, props }) {
  15086. if (tag === "template") {
  15087. for (let i = 0; i < props.length; i++) {
  15088. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  15089. return true;
  15090. }
  15091. }
  15092. }
  15093. return false;
  15094. }
  15095. function isComponent({ tag, props }) {
  15096. if (currentOptions.isCustomElement(tag)) {
  15097. return false;
  15098. }
  15099. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  15100. return true;
  15101. }
  15102. for (let i = 0; i < props.length; i++) {
  15103. const p = props[i];
  15104. if (p.type === 6) {
  15105. if (p.name === "is" && p.value) {
  15106. if (p.value.content.startsWith("vue:")) {
  15107. return true;
  15108. }
  15109. }
  15110. }
  15111. }
  15112. return false;
  15113. }
  15114. function isUpperCase(c) {
  15115. return c > 64 && c < 91;
  15116. }
  15117. const windowsNewlineRE = /\r\n/g;
  15118. function condenseWhitespace(nodes) {
  15119. const shouldCondense = currentOptions.whitespace !== "preserve";
  15120. let removedWhitespace = false;
  15121. for (let i = 0; i < nodes.length; i++) {
  15122. const node = nodes[i];
  15123. if (node.type === 2) {
  15124. if (!inPre) {
  15125. if (isAllWhitespace(node.content)) {
  15126. const prev = nodes[i - 1] && nodes[i - 1].type;
  15127. const next = nodes[i + 1] && nodes[i + 1].type;
  15128. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  15129. removedWhitespace = true;
  15130. nodes[i] = null;
  15131. } else {
  15132. node.content = " ";
  15133. }
  15134. } else if (shouldCondense) {
  15135. node.content = condense(node.content);
  15136. }
  15137. } else {
  15138. node.content = node.content.replace(windowsNewlineRE, "\n");
  15139. }
  15140. }
  15141. }
  15142. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  15143. }
  15144. function hasNewlineChar(str) {
  15145. for (let i = 0; i < str.length; i++) {
  15146. const c = str.charCodeAt(i);
  15147. if (c === 10 || c === 13) {
  15148. return true;
  15149. }
  15150. }
  15151. return false;
  15152. }
  15153. function condense(str) {
  15154. let ret = "";
  15155. let prevCharIsWhitespace = false;
  15156. for (let i = 0; i < str.length; i++) {
  15157. if (isWhitespace(str.charCodeAt(i))) {
  15158. if (!prevCharIsWhitespace) {
  15159. ret += " ";
  15160. prevCharIsWhitespace = true;
  15161. }
  15162. } else {
  15163. ret += str[i];
  15164. prevCharIsWhitespace = false;
  15165. }
  15166. }
  15167. return ret;
  15168. }
  15169. function addNode(node) {
  15170. (stack[0] || currentRoot).children.push(node);
  15171. }
  15172. function getLoc(start, end) {
  15173. return {
  15174. start: tokenizer.getPos(start),
  15175. // @ts-expect-error allow late attachment
  15176. end: end == null ? end : tokenizer.getPos(end),
  15177. // @ts-expect-error allow late attachment
  15178. source: end == null ? end : getSlice(start, end)
  15179. };
  15180. }
  15181. function cloneLoc(loc) {
  15182. return getLoc(loc.start.offset, loc.end.offset);
  15183. }
  15184. function setLocEnd(loc, end) {
  15185. loc.end = tokenizer.getPos(end);
  15186. loc.source = getSlice(loc.start.offset, end);
  15187. }
  15188. function dirToAttr(dir) {
  15189. const attr = {
  15190. type: 6,
  15191. name: dir.rawName,
  15192. nameLoc: getLoc(
  15193. dir.loc.start.offset,
  15194. dir.loc.start.offset + dir.rawName.length
  15195. ),
  15196. value: void 0,
  15197. loc: dir.loc
  15198. };
  15199. if (dir.exp) {
  15200. const loc = dir.exp.loc;
  15201. if (loc.end.offset < dir.loc.end.offset) {
  15202. loc.start.offset--;
  15203. loc.start.column--;
  15204. loc.end.offset++;
  15205. loc.end.column++;
  15206. }
  15207. attr.value = {
  15208. type: 2,
  15209. content: dir.exp.content,
  15210. loc
  15211. };
  15212. }
  15213. return attr;
  15214. }
  15215. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  15216. const exp = createSimpleExpression(content, isStatic, loc, constType);
  15217. return exp;
  15218. }
  15219. function emitError(code, index, message) {
  15220. currentOptions.onError(
  15221. createCompilerError(code, getLoc(index, index), void 0, message)
  15222. );
  15223. }
  15224. function reset() {
  15225. tokenizer.reset();
  15226. currentOpenTag = null;
  15227. currentProp = null;
  15228. currentAttrValue = "";
  15229. currentAttrStartIndex = -1;
  15230. currentAttrEndIndex = -1;
  15231. stack.length = 0;
  15232. }
  15233. function baseParse(input, options) {
  15234. reset();
  15235. currentInput = input;
  15236. currentOptions = extend({}, defaultParserOptions);
  15237. if (options) {
  15238. let key;
  15239. for (key in options) {
  15240. if (options[key] != null) {
  15241. currentOptions[key] = options[key];
  15242. }
  15243. }
  15244. }
  15245. {
  15246. if (!currentOptions.decodeEntities) {
  15247. throw new Error(
  15248. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  15249. );
  15250. }
  15251. }
  15252. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  15253. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  15254. const delimiters = options && options.delimiters;
  15255. if (delimiters) {
  15256. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  15257. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  15258. }
  15259. const root = currentRoot = createRoot([], input);
  15260. tokenizer.parse(currentInput);
  15261. root.loc = getLoc(0, input.length);
  15262. root.children = condenseWhitespace(root.children);
  15263. currentRoot = null;
  15264. return root;
  15265. }
  15266. function cacheStatic(root, context) {
  15267. walk(
  15268. root,
  15269. void 0,
  15270. context,
  15271. // Root node is unfortunately non-hoistable due to potential parent
  15272. // fallthrough attributes.
  15273. !!getSingleElementRoot(root)
  15274. );
  15275. }
  15276. function getSingleElementRoot(root) {
  15277. const children = root.children.filter((x) => x.type !== 3);
  15278. return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
  15279. }
  15280. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  15281. const { children } = node;
  15282. const toCache = [];
  15283. for (let i = 0; i < children.length; i++) {
  15284. const child = children[i];
  15285. if (child.type === 1 && child.tagType === 0) {
  15286. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  15287. if (constantType > 0) {
  15288. if (constantType >= 2) {
  15289. child.codegenNode.patchFlag = -1;
  15290. toCache.push(child);
  15291. continue;
  15292. }
  15293. } else {
  15294. const codegenNode = child.codegenNode;
  15295. if (codegenNode.type === 13) {
  15296. const flag = codegenNode.patchFlag;
  15297. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  15298. const props = getNodeProps(child);
  15299. if (props) {
  15300. codegenNode.props = context.hoist(props);
  15301. }
  15302. }
  15303. if (codegenNode.dynamicProps) {
  15304. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  15305. }
  15306. }
  15307. }
  15308. } else if (child.type === 12) {
  15309. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  15310. if (constantType >= 2) {
  15311. if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
  15312. child.codegenNode.arguments.push(
  15313. -1 + (` /* ${PatchFlagNames[-1]} */` )
  15314. );
  15315. }
  15316. toCache.push(child);
  15317. continue;
  15318. }
  15319. }
  15320. if (child.type === 1) {
  15321. const isComponent = child.tagType === 1;
  15322. if (isComponent) {
  15323. context.scopes.vSlot++;
  15324. }
  15325. walk(child, node, context, false, inFor);
  15326. if (isComponent) {
  15327. context.scopes.vSlot--;
  15328. }
  15329. } else if (child.type === 11) {
  15330. walk(child, node, context, child.children.length === 1, true);
  15331. } else if (child.type === 9) {
  15332. for (let i2 = 0; i2 < child.branches.length; i2++) {
  15333. walk(
  15334. child.branches[i2],
  15335. node,
  15336. context,
  15337. child.branches[i2].children.length === 1,
  15338. inFor
  15339. );
  15340. }
  15341. }
  15342. }
  15343. let cachedAsArray = false;
  15344. if (toCache.length === children.length && node.type === 1) {
  15345. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  15346. node.codegenNode.children = getCacheExpression(
  15347. createArrayExpression(node.codegenNode.children)
  15348. );
  15349. cachedAsArray = true;
  15350. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  15351. const slot = getSlotNode(node.codegenNode, "default");
  15352. if (slot) {
  15353. slot.returns = getCacheExpression(
  15354. createArrayExpression(slot.returns)
  15355. );
  15356. cachedAsArray = true;
  15357. }
  15358. } 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) {
  15359. const slotName = findDir(node, "slot", true);
  15360. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  15361. if (slot) {
  15362. slot.returns = getCacheExpression(
  15363. createArrayExpression(slot.returns)
  15364. );
  15365. cachedAsArray = true;
  15366. }
  15367. }
  15368. }
  15369. if (!cachedAsArray) {
  15370. for (const child of toCache) {
  15371. child.codegenNode = context.cache(child.codegenNode);
  15372. }
  15373. }
  15374. function getCacheExpression(value) {
  15375. const exp = context.cache(value);
  15376. exp.needArraySpread = true;
  15377. return exp;
  15378. }
  15379. function getSlotNode(node2, name) {
  15380. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  15381. const slot = node2.children.properties.find(
  15382. (p) => p.key === name || p.key.content === name
  15383. );
  15384. return slot && slot.value;
  15385. }
  15386. }
  15387. if (toCache.length && context.transformHoist) {
  15388. context.transformHoist(children, context, node);
  15389. }
  15390. }
  15391. function getConstantType(node, context) {
  15392. const { constantCache } = context;
  15393. switch (node.type) {
  15394. case 1:
  15395. if (node.tagType !== 0) {
  15396. return 0;
  15397. }
  15398. const cached = constantCache.get(node);
  15399. if (cached !== void 0) {
  15400. return cached;
  15401. }
  15402. const codegenNode = node.codegenNode;
  15403. if (codegenNode.type !== 13) {
  15404. return 0;
  15405. }
  15406. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  15407. return 0;
  15408. }
  15409. if (codegenNode.patchFlag === void 0) {
  15410. let returnType2 = 3;
  15411. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  15412. if (generatedPropsType === 0) {
  15413. constantCache.set(node, 0);
  15414. return 0;
  15415. }
  15416. if (generatedPropsType < returnType2) {
  15417. returnType2 = generatedPropsType;
  15418. }
  15419. for (let i = 0; i < node.children.length; i++) {
  15420. const childType = getConstantType(node.children[i], context);
  15421. if (childType === 0) {
  15422. constantCache.set(node, 0);
  15423. return 0;
  15424. }
  15425. if (childType < returnType2) {
  15426. returnType2 = childType;
  15427. }
  15428. }
  15429. if (returnType2 > 1) {
  15430. for (let i = 0; i < node.props.length; i++) {
  15431. const p = node.props[i];
  15432. if (p.type === 7 && p.name === "bind" && p.exp) {
  15433. const expType = getConstantType(p.exp, context);
  15434. if (expType === 0) {
  15435. constantCache.set(node, 0);
  15436. return 0;
  15437. }
  15438. if (expType < returnType2) {
  15439. returnType2 = expType;
  15440. }
  15441. }
  15442. }
  15443. }
  15444. if (codegenNode.isBlock) {
  15445. for (let i = 0; i < node.props.length; i++) {
  15446. const p = node.props[i];
  15447. if (p.type === 7) {
  15448. constantCache.set(node, 0);
  15449. return 0;
  15450. }
  15451. }
  15452. context.removeHelper(OPEN_BLOCK);
  15453. context.removeHelper(
  15454. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  15455. );
  15456. codegenNode.isBlock = false;
  15457. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  15458. }
  15459. constantCache.set(node, returnType2);
  15460. return returnType2;
  15461. } else {
  15462. constantCache.set(node, 0);
  15463. return 0;
  15464. }
  15465. case 2:
  15466. case 3:
  15467. return 3;
  15468. case 9:
  15469. case 11:
  15470. case 10:
  15471. return 0;
  15472. case 5:
  15473. case 12:
  15474. return getConstantType(node.content, context);
  15475. case 4:
  15476. return node.constType;
  15477. case 8:
  15478. let returnType = 3;
  15479. for (let i = 0; i < node.children.length; i++) {
  15480. const child = node.children[i];
  15481. if (isString(child) || isSymbol(child)) {
  15482. continue;
  15483. }
  15484. const childType = getConstantType(child, context);
  15485. if (childType === 0) {
  15486. return 0;
  15487. } else if (childType < returnType) {
  15488. returnType = childType;
  15489. }
  15490. }
  15491. return returnType;
  15492. case 20:
  15493. return 2;
  15494. default:
  15495. return 0;
  15496. }
  15497. }
  15498. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  15499. NORMALIZE_CLASS,
  15500. NORMALIZE_STYLE,
  15501. NORMALIZE_PROPS,
  15502. GUARD_REACTIVE_PROPS
  15503. ]);
  15504. function getConstantTypeOfHelperCall(value, context) {
  15505. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  15506. const arg = value.arguments[0];
  15507. if (arg.type === 4) {
  15508. return getConstantType(arg, context);
  15509. } else if (arg.type === 14) {
  15510. return getConstantTypeOfHelperCall(arg, context);
  15511. }
  15512. }
  15513. return 0;
  15514. }
  15515. function getGeneratedPropsConstantType(node, context) {
  15516. let returnType = 3;
  15517. const props = getNodeProps(node);
  15518. if (props && props.type === 15) {
  15519. const { properties } = props;
  15520. for (let i = 0; i < properties.length; i++) {
  15521. const { key, value } = properties[i];
  15522. const keyType = getConstantType(key, context);
  15523. if (keyType === 0) {
  15524. return keyType;
  15525. }
  15526. if (keyType < returnType) {
  15527. returnType = keyType;
  15528. }
  15529. let valueType;
  15530. if (value.type === 4) {
  15531. valueType = getConstantType(value, context);
  15532. } else if (value.type === 14) {
  15533. valueType = getConstantTypeOfHelperCall(value, context);
  15534. } else {
  15535. valueType = 0;
  15536. }
  15537. if (valueType === 0) {
  15538. return valueType;
  15539. }
  15540. if (valueType < returnType) {
  15541. returnType = valueType;
  15542. }
  15543. }
  15544. }
  15545. return returnType;
  15546. }
  15547. function getNodeProps(node) {
  15548. const codegenNode = node.codegenNode;
  15549. if (codegenNode.type === 13) {
  15550. return codegenNode.props;
  15551. }
  15552. }
  15553. function createTransformContext(root, {
  15554. filename = "",
  15555. prefixIdentifiers = false,
  15556. hoistStatic = false,
  15557. hmr = false,
  15558. cacheHandlers = false,
  15559. nodeTransforms = [],
  15560. directiveTransforms = {},
  15561. transformHoist = null,
  15562. isBuiltInComponent = NOOP,
  15563. isCustomElement = NOOP,
  15564. expressionPlugins = [],
  15565. scopeId = null,
  15566. slotted = true,
  15567. ssr = false,
  15568. inSSR = false,
  15569. ssrCssVars = ``,
  15570. bindingMetadata = EMPTY_OBJ,
  15571. inline = false,
  15572. isTS = false,
  15573. onError = defaultOnError,
  15574. onWarn = defaultOnWarn,
  15575. compatConfig
  15576. }) {
  15577. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  15578. const context = {
  15579. // options
  15580. filename,
  15581. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  15582. prefixIdentifiers,
  15583. hoistStatic,
  15584. hmr,
  15585. cacheHandlers,
  15586. nodeTransforms,
  15587. directiveTransforms,
  15588. transformHoist,
  15589. isBuiltInComponent,
  15590. isCustomElement,
  15591. expressionPlugins,
  15592. scopeId,
  15593. slotted,
  15594. ssr,
  15595. inSSR,
  15596. ssrCssVars,
  15597. bindingMetadata,
  15598. inline,
  15599. isTS,
  15600. onError,
  15601. onWarn,
  15602. compatConfig,
  15603. // state
  15604. root,
  15605. helpers: /* @__PURE__ */ new Map(),
  15606. components: /* @__PURE__ */ new Set(),
  15607. directives: /* @__PURE__ */ new Set(),
  15608. hoists: [],
  15609. imports: [],
  15610. cached: [],
  15611. constantCache: /* @__PURE__ */ new WeakMap(),
  15612. vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
  15613. temps: 0,
  15614. identifiers: /* @__PURE__ */ Object.create(null),
  15615. scopes: {
  15616. vFor: 0,
  15617. vSlot: 0,
  15618. vPre: 0,
  15619. vOnce: 0
  15620. },
  15621. parent: null,
  15622. grandParent: null,
  15623. currentNode: root,
  15624. childIndex: 0,
  15625. inVOnce: false,
  15626. // methods
  15627. helper(name) {
  15628. const count = context.helpers.get(name) || 0;
  15629. context.helpers.set(name, count + 1);
  15630. return name;
  15631. },
  15632. removeHelper(name) {
  15633. const count = context.helpers.get(name);
  15634. if (count) {
  15635. const currentCount = count - 1;
  15636. if (!currentCount) {
  15637. context.helpers.delete(name);
  15638. } else {
  15639. context.helpers.set(name, currentCount);
  15640. }
  15641. }
  15642. },
  15643. helperString(name) {
  15644. return `_${helperNameMap[context.helper(name)]}`;
  15645. },
  15646. replaceNode(node) {
  15647. {
  15648. if (!context.currentNode) {
  15649. throw new Error(`Node being replaced is already removed.`);
  15650. }
  15651. if (!context.parent) {
  15652. throw new Error(`Cannot replace root node.`);
  15653. }
  15654. }
  15655. context.parent.children[context.childIndex] = context.currentNode = node;
  15656. },
  15657. removeNode(node) {
  15658. if (!context.parent) {
  15659. throw new Error(`Cannot remove root node.`);
  15660. }
  15661. const list = context.parent.children;
  15662. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  15663. if (removalIndex < 0) {
  15664. throw new Error(`node being removed is not a child of current parent`);
  15665. }
  15666. if (!node || node === context.currentNode) {
  15667. context.currentNode = null;
  15668. context.onNodeRemoved();
  15669. } else {
  15670. if (context.childIndex > removalIndex) {
  15671. context.childIndex--;
  15672. context.onNodeRemoved();
  15673. }
  15674. }
  15675. context.parent.children.splice(removalIndex, 1);
  15676. },
  15677. onNodeRemoved: NOOP,
  15678. addIdentifiers(exp) {
  15679. },
  15680. removeIdentifiers(exp) {
  15681. },
  15682. hoist(exp) {
  15683. if (isString(exp)) exp = createSimpleExpression(exp);
  15684. context.hoists.push(exp);
  15685. const identifier = createSimpleExpression(
  15686. `_hoisted_${context.hoists.length}`,
  15687. false,
  15688. exp.loc,
  15689. 2
  15690. );
  15691. identifier.hoisted = exp;
  15692. return identifier;
  15693. },
  15694. cache(exp, isVNode = false, inVOnce = false) {
  15695. const cacheExp = createCacheExpression(
  15696. context.cached.length,
  15697. exp,
  15698. isVNode,
  15699. inVOnce
  15700. );
  15701. context.cached.push(cacheExp);
  15702. return cacheExp;
  15703. }
  15704. };
  15705. return context;
  15706. }
  15707. function transform(root, options) {
  15708. const context = createTransformContext(root, options);
  15709. traverseNode(root, context);
  15710. if (options.hoistStatic) {
  15711. cacheStatic(root, context);
  15712. }
  15713. if (!options.ssr) {
  15714. createRootCodegen(root, context);
  15715. }
  15716. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  15717. root.components = [...context.components];
  15718. root.directives = [...context.directives];
  15719. root.imports = context.imports;
  15720. root.hoists = context.hoists;
  15721. root.temps = context.temps;
  15722. root.cached = context.cached;
  15723. root.transformed = true;
  15724. }
  15725. function createRootCodegen(root, context) {
  15726. const { helper } = context;
  15727. const { children } = root;
  15728. if (children.length === 1) {
  15729. const singleElementRootChild = getSingleElementRoot(root);
  15730. if (singleElementRootChild && singleElementRootChild.codegenNode) {
  15731. const codegenNode = singleElementRootChild.codegenNode;
  15732. if (codegenNode.type === 13) {
  15733. convertToBlock(codegenNode, context);
  15734. }
  15735. root.codegenNode = codegenNode;
  15736. } else {
  15737. root.codegenNode = children[0];
  15738. }
  15739. } else if (children.length > 1) {
  15740. let patchFlag = 64;
  15741. if (children.filter((c) => c.type !== 3).length === 1) {
  15742. patchFlag |= 2048;
  15743. }
  15744. root.codegenNode = createVNodeCall(
  15745. context,
  15746. helper(FRAGMENT),
  15747. void 0,
  15748. root.children,
  15749. patchFlag,
  15750. void 0,
  15751. void 0,
  15752. true,
  15753. void 0,
  15754. false
  15755. );
  15756. } else ;
  15757. }
  15758. function traverseChildren(parent, context) {
  15759. let i = 0;
  15760. const nodeRemoved = () => {
  15761. i--;
  15762. };
  15763. for (; i < parent.children.length; i++) {
  15764. const child = parent.children[i];
  15765. if (isString(child)) continue;
  15766. context.grandParent = context.parent;
  15767. context.parent = parent;
  15768. context.childIndex = i;
  15769. context.onNodeRemoved = nodeRemoved;
  15770. traverseNode(child, context);
  15771. }
  15772. }
  15773. function traverseNode(node, context) {
  15774. context.currentNode = node;
  15775. const { nodeTransforms } = context;
  15776. const exitFns = [];
  15777. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  15778. const onExit = nodeTransforms[i2](node, context);
  15779. if (onExit) {
  15780. if (isArray(onExit)) {
  15781. exitFns.push(...onExit);
  15782. } else {
  15783. exitFns.push(onExit);
  15784. }
  15785. }
  15786. if (!context.currentNode) {
  15787. return;
  15788. } else {
  15789. node = context.currentNode;
  15790. }
  15791. }
  15792. switch (node.type) {
  15793. case 3:
  15794. if (!context.ssr) {
  15795. context.helper(CREATE_COMMENT);
  15796. }
  15797. break;
  15798. case 5:
  15799. if (!context.ssr) {
  15800. context.helper(TO_DISPLAY_STRING);
  15801. }
  15802. break;
  15803. // for container types, further traverse downwards
  15804. case 9:
  15805. for (let i2 = 0; i2 < node.branches.length; i2++) {
  15806. traverseNode(node.branches[i2], context);
  15807. }
  15808. break;
  15809. case 10:
  15810. case 11:
  15811. case 1:
  15812. case 0:
  15813. traverseChildren(node, context);
  15814. break;
  15815. }
  15816. context.currentNode = node;
  15817. let i = exitFns.length;
  15818. while (i--) {
  15819. exitFns[i]();
  15820. }
  15821. }
  15822. function createStructuralDirectiveTransform(name, fn) {
  15823. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  15824. return (node, context) => {
  15825. if (node.type === 1) {
  15826. const { props } = node;
  15827. if (node.tagType === 3 && props.some(isVSlot)) {
  15828. return;
  15829. }
  15830. const exitFns = [];
  15831. for (let i = 0; i < props.length; i++) {
  15832. const prop = props[i];
  15833. if (prop.type === 7 && matches(prop.name)) {
  15834. props.splice(i, 1);
  15835. i--;
  15836. const onExit = fn(node, prop, context);
  15837. if (onExit) exitFns.push(onExit);
  15838. }
  15839. }
  15840. return exitFns;
  15841. }
  15842. };
  15843. }
  15844. const PURE_ANNOTATION = `/*@__PURE__*/`;
  15845. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  15846. function createCodegenContext(ast, {
  15847. mode = "function",
  15848. prefixIdentifiers = mode === "module",
  15849. sourceMap = false,
  15850. filename = `template.vue.html`,
  15851. scopeId = null,
  15852. optimizeImports = false,
  15853. runtimeGlobalName = `Vue`,
  15854. runtimeModuleName = `vue`,
  15855. ssrRuntimeModuleName = "vue/server-renderer",
  15856. ssr = false,
  15857. isTS = false,
  15858. inSSR = false
  15859. }) {
  15860. const context = {
  15861. mode,
  15862. prefixIdentifiers,
  15863. sourceMap,
  15864. filename,
  15865. scopeId,
  15866. optimizeImports,
  15867. runtimeGlobalName,
  15868. runtimeModuleName,
  15869. ssrRuntimeModuleName,
  15870. ssr,
  15871. isTS,
  15872. inSSR,
  15873. source: ast.source,
  15874. code: ``,
  15875. column: 1,
  15876. line: 1,
  15877. offset: 0,
  15878. indentLevel: 0,
  15879. pure: false,
  15880. map: void 0,
  15881. helper(key) {
  15882. return `_${helperNameMap[key]}`;
  15883. },
  15884. push(code, newlineIndex = -2 /* None */, node) {
  15885. context.code += code;
  15886. },
  15887. indent() {
  15888. newline(++context.indentLevel);
  15889. },
  15890. deindent(withoutNewLine = false) {
  15891. if (withoutNewLine) {
  15892. --context.indentLevel;
  15893. } else {
  15894. newline(--context.indentLevel);
  15895. }
  15896. },
  15897. newline() {
  15898. newline(context.indentLevel);
  15899. }
  15900. };
  15901. function newline(n) {
  15902. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  15903. }
  15904. return context;
  15905. }
  15906. function generate(ast, options = {}) {
  15907. const context = createCodegenContext(ast, options);
  15908. if (options.onContextCreated) options.onContextCreated(context);
  15909. const {
  15910. mode,
  15911. push,
  15912. prefixIdentifiers,
  15913. indent,
  15914. deindent,
  15915. newline,
  15916. scopeId,
  15917. ssr
  15918. } = context;
  15919. const helpers = Array.from(ast.helpers);
  15920. const hasHelpers = helpers.length > 0;
  15921. const useWithBlock = !prefixIdentifiers && mode !== "module";
  15922. const preambleContext = context;
  15923. {
  15924. genFunctionPreamble(ast, preambleContext);
  15925. }
  15926. const functionName = ssr ? `ssrRender` : `render`;
  15927. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  15928. const signature = args.join(", ");
  15929. {
  15930. push(`function ${functionName}(${signature}) {`);
  15931. }
  15932. indent();
  15933. if (useWithBlock) {
  15934. push(`with (_ctx) {`);
  15935. indent();
  15936. if (hasHelpers) {
  15937. push(
  15938. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  15939. `,
  15940. -1 /* End */
  15941. );
  15942. newline();
  15943. }
  15944. }
  15945. if (ast.components.length) {
  15946. genAssets(ast.components, "component", context);
  15947. if (ast.directives.length || ast.temps > 0) {
  15948. newline();
  15949. }
  15950. }
  15951. if (ast.directives.length) {
  15952. genAssets(ast.directives, "directive", context);
  15953. if (ast.temps > 0) {
  15954. newline();
  15955. }
  15956. }
  15957. if (ast.temps > 0) {
  15958. push(`let `);
  15959. for (let i = 0; i < ast.temps; i++) {
  15960. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  15961. }
  15962. }
  15963. if (ast.components.length || ast.directives.length || ast.temps) {
  15964. push(`
  15965. `, 0 /* Start */);
  15966. newline();
  15967. }
  15968. if (!ssr) {
  15969. push(`return `);
  15970. }
  15971. if (ast.codegenNode) {
  15972. genNode(ast.codegenNode, context);
  15973. } else {
  15974. push(`null`);
  15975. }
  15976. if (useWithBlock) {
  15977. deindent();
  15978. push(`}`);
  15979. }
  15980. deindent();
  15981. push(`}`);
  15982. return {
  15983. ast,
  15984. code: context.code,
  15985. preamble: ``,
  15986. map: context.map ? context.map.toJSON() : void 0
  15987. };
  15988. }
  15989. function genFunctionPreamble(ast, context) {
  15990. const {
  15991. ssr,
  15992. prefixIdentifiers,
  15993. push,
  15994. newline,
  15995. runtimeModuleName,
  15996. runtimeGlobalName,
  15997. ssrRuntimeModuleName
  15998. } = context;
  15999. const VueBinding = runtimeGlobalName;
  16000. const helpers = Array.from(ast.helpers);
  16001. if (helpers.length > 0) {
  16002. {
  16003. push(`const _Vue = ${VueBinding}
  16004. `, -1 /* End */);
  16005. if (ast.hoists.length) {
  16006. const staticHelpers = [
  16007. CREATE_VNODE,
  16008. CREATE_ELEMENT_VNODE,
  16009. CREATE_COMMENT,
  16010. CREATE_TEXT,
  16011. CREATE_STATIC
  16012. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  16013. push(`const { ${staticHelpers} } = _Vue
  16014. `, -1 /* End */);
  16015. }
  16016. }
  16017. }
  16018. genHoists(ast.hoists, context);
  16019. newline();
  16020. push(`return `);
  16021. }
  16022. function genAssets(assets, type, { helper, push, newline, isTS }) {
  16023. const resolver = helper(
  16024. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  16025. );
  16026. for (let i = 0; i < assets.length; i++) {
  16027. let id = assets[i];
  16028. const maybeSelfReference = id.endsWith("__self");
  16029. if (maybeSelfReference) {
  16030. id = id.slice(0, -6);
  16031. }
  16032. push(
  16033. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  16034. );
  16035. if (i < assets.length - 1) {
  16036. newline();
  16037. }
  16038. }
  16039. }
  16040. function genHoists(hoists, context) {
  16041. if (!hoists.length) {
  16042. return;
  16043. }
  16044. context.pure = true;
  16045. const { push, newline } = context;
  16046. newline();
  16047. for (let i = 0; i < hoists.length; i++) {
  16048. const exp = hoists[i];
  16049. if (exp) {
  16050. push(`const _hoisted_${i + 1} = `);
  16051. genNode(exp, context);
  16052. newline();
  16053. }
  16054. }
  16055. context.pure = false;
  16056. }
  16057. function isText(n) {
  16058. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  16059. }
  16060. function genNodeListAsArray(nodes, context) {
  16061. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  16062. context.push(`[`);
  16063. multilines && context.indent();
  16064. genNodeList(nodes, context, multilines);
  16065. multilines && context.deindent();
  16066. context.push(`]`);
  16067. }
  16068. function genNodeList(nodes, context, multilines = false, comma = true) {
  16069. const { push, newline } = context;
  16070. for (let i = 0; i < nodes.length; i++) {
  16071. const node = nodes[i];
  16072. if (isString(node)) {
  16073. push(node, -3 /* Unknown */);
  16074. } else if (isArray(node)) {
  16075. genNodeListAsArray(node, context);
  16076. } else {
  16077. genNode(node, context);
  16078. }
  16079. if (i < nodes.length - 1) {
  16080. if (multilines) {
  16081. comma && push(",");
  16082. newline();
  16083. } else {
  16084. comma && push(", ");
  16085. }
  16086. }
  16087. }
  16088. }
  16089. function genNode(node, context) {
  16090. if (isString(node)) {
  16091. context.push(node, -3 /* Unknown */);
  16092. return;
  16093. }
  16094. if (isSymbol(node)) {
  16095. context.push(context.helper(node));
  16096. return;
  16097. }
  16098. switch (node.type) {
  16099. case 1:
  16100. case 9:
  16101. case 11:
  16102. assert(
  16103. node.codegenNode != null,
  16104. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  16105. );
  16106. genNode(node.codegenNode, context);
  16107. break;
  16108. case 2:
  16109. genText(node, context);
  16110. break;
  16111. case 4:
  16112. genExpression(node, context);
  16113. break;
  16114. case 5:
  16115. genInterpolation(node, context);
  16116. break;
  16117. case 12:
  16118. genNode(node.codegenNode, context);
  16119. break;
  16120. case 8:
  16121. genCompoundExpression(node, context);
  16122. break;
  16123. case 3:
  16124. genComment(node, context);
  16125. break;
  16126. case 13:
  16127. genVNodeCall(node, context);
  16128. break;
  16129. case 14:
  16130. genCallExpression(node, context);
  16131. break;
  16132. case 15:
  16133. genObjectExpression(node, context);
  16134. break;
  16135. case 17:
  16136. genArrayExpression(node, context);
  16137. break;
  16138. case 18:
  16139. genFunctionExpression(node, context);
  16140. break;
  16141. case 19:
  16142. genConditionalExpression(node, context);
  16143. break;
  16144. case 20:
  16145. genCacheExpression(node, context);
  16146. break;
  16147. case 21:
  16148. genNodeList(node.body, context, true, false);
  16149. break;
  16150. // SSR only types
  16151. case 22:
  16152. break;
  16153. case 23:
  16154. break;
  16155. case 24:
  16156. break;
  16157. case 25:
  16158. break;
  16159. case 26:
  16160. break;
  16161. /* v8 ignore start */
  16162. case 10:
  16163. break;
  16164. default:
  16165. {
  16166. assert(false, `unhandled codegen node type: ${node.type}`);
  16167. const exhaustiveCheck = node;
  16168. return exhaustiveCheck;
  16169. }
  16170. }
  16171. }
  16172. function genText(node, context) {
  16173. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  16174. }
  16175. function genExpression(node, context) {
  16176. const { content, isStatic } = node;
  16177. context.push(
  16178. isStatic ? JSON.stringify(content) : content,
  16179. -3 /* Unknown */,
  16180. node
  16181. );
  16182. }
  16183. function genInterpolation(node, context) {
  16184. const { push, helper, pure } = context;
  16185. if (pure) push(PURE_ANNOTATION);
  16186. push(`${helper(TO_DISPLAY_STRING)}(`);
  16187. genNode(node.content, context);
  16188. push(`)`);
  16189. }
  16190. function genCompoundExpression(node, context) {
  16191. for (let i = 0; i < node.children.length; i++) {
  16192. const child = node.children[i];
  16193. if (isString(child)) {
  16194. context.push(child, -3 /* Unknown */);
  16195. } else {
  16196. genNode(child, context);
  16197. }
  16198. }
  16199. }
  16200. function genExpressionAsPropertyKey(node, context) {
  16201. const { push } = context;
  16202. if (node.type === 8) {
  16203. push(`[`);
  16204. genCompoundExpression(node, context);
  16205. push(`]`);
  16206. } else if (node.isStatic) {
  16207. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  16208. push(text, -2 /* None */, node);
  16209. } else {
  16210. push(`[${node.content}]`, -3 /* Unknown */, node);
  16211. }
  16212. }
  16213. function genComment(node, context) {
  16214. const { push, helper, pure } = context;
  16215. if (pure) {
  16216. push(PURE_ANNOTATION);
  16217. }
  16218. push(
  16219. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  16220. -3 /* Unknown */,
  16221. node
  16222. );
  16223. }
  16224. function genVNodeCall(node, context) {
  16225. const { push, helper, pure } = context;
  16226. const {
  16227. tag,
  16228. props,
  16229. children,
  16230. patchFlag,
  16231. dynamicProps,
  16232. directives,
  16233. isBlock,
  16234. disableTracking,
  16235. isComponent
  16236. } = node;
  16237. let patchFlagString;
  16238. if (patchFlag) {
  16239. {
  16240. if (patchFlag < 0) {
  16241. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  16242. } else {
  16243. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  16244. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  16245. }
  16246. }
  16247. }
  16248. if (directives) {
  16249. push(helper(WITH_DIRECTIVES) + `(`);
  16250. }
  16251. if (isBlock) {
  16252. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  16253. }
  16254. if (pure) {
  16255. push(PURE_ANNOTATION);
  16256. }
  16257. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  16258. push(helper(callHelper) + `(`, -2 /* None */, node);
  16259. genNodeList(
  16260. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  16261. context
  16262. );
  16263. push(`)`);
  16264. if (isBlock) {
  16265. push(`)`);
  16266. }
  16267. if (directives) {
  16268. push(`, `);
  16269. genNode(directives, context);
  16270. push(`)`);
  16271. }
  16272. }
  16273. function genNullableArgs(args) {
  16274. let i = args.length;
  16275. while (i--) {
  16276. if (args[i] != null) break;
  16277. }
  16278. return args.slice(0, i + 1).map((arg) => arg || `null`);
  16279. }
  16280. function genCallExpression(node, context) {
  16281. const { push, helper, pure } = context;
  16282. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  16283. if (pure) {
  16284. push(PURE_ANNOTATION);
  16285. }
  16286. push(callee + `(`, -2 /* None */, node);
  16287. genNodeList(node.arguments, context);
  16288. push(`)`);
  16289. }
  16290. function genObjectExpression(node, context) {
  16291. const { push, indent, deindent, newline } = context;
  16292. const { properties } = node;
  16293. if (!properties.length) {
  16294. push(`{}`, -2 /* None */, node);
  16295. return;
  16296. }
  16297. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  16298. push(multilines ? `{` : `{ `);
  16299. multilines && indent();
  16300. for (let i = 0; i < properties.length; i++) {
  16301. const { key, value } = properties[i];
  16302. genExpressionAsPropertyKey(key, context);
  16303. push(`: `);
  16304. genNode(value, context);
  16305. if (i < properties.length - 1) {
  16306. push(`,`);
  16307. newline();
  16308. }
  16309. }
  16310. multilines && deindent();
  16311. push(multilines ? `}` : ` }`);
  16312. }
  16313. function genArrayExpression(node, context) {
  16314. genNodeListAsArray(node.elements, context);
  16315. }
  16316. function genFunctionExpression(node, context) {
  16317. const { push, indent, deindent } = context;
  16318. const { params, returns, body, newline, isSlot } = node;
  16319. if (isSlot) {
  16320. push(`_${helperNameMap[WITH_CTX]}(`);
  16321. }
  16322. push(`(`, -2 /* None */, node);
  16323. if (isArray(params)) {
  16324. genNodeList(params, context);
  16325. } else if (params) {
  16326. genNode(params, context);
  16327. }
  16328. push(`) => `);
  16329. if (newline || body) {
  16330. push(`{`);
  16331. indent();
  16332. }
  16333. if (returns) {
  16334. if (newline) {
  16335. push(`return `);
  16336. }
  16337. if (isArray(returns)) {
  16338. genNodeListAsArray(returns, context);
  16339. } else {
  16340. genNode(returns, context);
  16341. }
  16342. } else if (body) {
  16343. genNode(body, context);
  16344. }
  16345. if (newline || body) {
  16346. deindent();
  16347. push(`}`);
  16348. }
  16349. if (isSlot) {
  16350. push(`)`);
  16351. }
  16352. }
  16353. function genConditionalExpression(node, context) {
  16354. const { test, consequent, alternate, newline: needNewline } = node;
  16355. const { push, indent, deindent, newline } = context;
  16356. if (test.type === 4) {
  16357. const needsParens = !isSimpleIdentifier(test.content);
  16358. needsParens && push(`(`);
  16359. genExpression(test, context);
  16360. needsParens && push(`)`);
  16361. } else {
  16362. push(`(`);
  16363. genNode(test, context);
  16364. push(`)`);
  16365. }
  16366. needNewline && indent();
  16367. context.indentLevel++;
  16368. needNewline || push(` `);
  16369. push(`? `);
  16370. genNode(consequent, context);
  16371. context.indentLevel--;
  16372. needNewline && newline();
  16373. needNewline || push(` `);
  16374. push(`: `);
  16375. const isNested = alternate.type === 19;
  16376. if (!isNested) {
  16377. context.indentLevel++;
  16378. }
  16379. genNode(alternate, context);
  16380. if (!isNested) {
  16381. context.indentLevel--;
  16382. }
  16383. needNewline && deindent(
  16384. true
  16385. /* without newline */
  16386. );
  16387. }
  16388. function genCacheExpression(node, context) {
  16389. const { push, helper, indent, deindent, newline } = context;
  16390. const { needPauseTracking, needArraySpread } = node;
  16391. if (needArraySpread) {
  16392. push(`[...(`);
  16393. }
  16394. push(`_cache[${node.index}] || (`);
  16395. if (needPauseTracking) {
  16396. indent();
  16397. push(`${helper(SET_BLOCK_TRACKING)}(-1`);
  16398. if (node.inVOnce) push(`, true`);
  16399. push(`),`);
  16400. newline();
  16401. push(`(`);
  16402. }
  16403. push(`_cache[${node.index}] = `);
  16404. genNode(node.value, context);
  16405. if (needPauseTracking) {
  16406. push(`).cacheIndex = ${node.index},`);
  16407. newline();
  16408. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  16409. newline();
  16410. push(`_cache[${node.index}]`);
  16411. deindent();
  16412. }
  16413. push(`)`);
  16414. if (needArraySpread) {
  16415. push(`)]`);
  16416. }
  16417. }
  16418. const prohibitedKeywordRE = new RegExp(
  16419. "\\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"
  16420. );
  16421. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  16422. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  16423. const exp = node.content;
  16424. if (!exp.trim()) {
  16425. return;
  16426. }
  16427. try {
  16428. new Function(
  16429. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  16430. );
  16431. } catch (e) {
  16432. let message = e.message;
  16433. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  16434. if (keywordMatch) {
  16435. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  16436. }
  16437. context.onError(
  16438. createCompilerError(
  16439. 46,
  16440. node.loc,
  16441. void 0,
  16442. message
  16443. )
  16444. );
  16445. }
  16446. }
  16447. const transformExpression = (node, context) => {
  16448. if (node.type === 5) {
  16449. node.content = processExpression(
  16450. node.content,
  16451. context
  16452. );
  16453. } else if (node.type === 1) {
  16454. const memo = findDir(node, "memo");
  16455. for (let i = 0; i < node.props.length; i++) {
  16456. const dir = node.props[i];
  16457. if (dir.type === 7 && dir.name !== "for") {
  16458. const exp = dir.exp;
  16459. const arg = dir.arg;
  16460. if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
  16461. !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
  16462. dir.exp = processExpression(
  16463. exp,
  16464. context,
  16465. // slot args must be processed as function params
  16466. dir.name === "slot"
  16467. );
  16468. }
  16469. if (arg && arg.type === 4 && !arg.isStatic) {
  16470. dir.arg = processExpression(arg, context);
  16471. }
  16472. }
  16473. }
  16474. }
  16475. };
  16476. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  16477. {
  16478. {
  16479. validateBrowserExpression(node, context, asParams, asRawStatements);
  16480. }
  16481. return node;
  16482. }
  16483. }
  16484. const transformIf = createStructuralDirectiveTransform(
  16485. /^(?:if|else|else-if)$/,
  16486. (node, dir, context) => {
  16487. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  16488. const siblings = context.parent.children;
  16489. let i = siblings.indexOf(ifNode);
  16490. let key = 0;
  16491. while (i-- >= 0) {
  16492. const sibling = siblings[i];
  16493. if (sibling && sibling.type === 9) {
  16494. key += sibling.branches.length;
  16495. }
  16496. }
  16497. return () => {
  16498. if (isRoot) {
  16499. ifNode.codegenNode = createCodegenNodeForBranch(
  16500. branch,
  16501. key,
  16502. context
  16503. );
  16504. } else {
  16505. const parentCondition = getParentCondition(ifNode.codegenNode);
  16506. parentCondition.alternate = createCodegenNodeForBranch(
  16507. branch,
  16508. key + ifNode.branches.length - 1,
  16509. context
  16510. );
  16511. }
  16512. };
  16513. });
  16514. }
  16515. );
  16516. function processIf(node, dir, context, processCodegen) {
  16517. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  16518. const loc = dir.exp ? dir.exp.loc : node.loc;
  16519. context.onError(
  16520. createCompilerError(28, dir.loc)
  16521. );
  16522. dir.exp = createSimpleExpression(`true`, false, loc);
  16523. }
  16524. if (dir.exp) {
  16525. validateBrowserExpression(dir.exp, context);
  16526. }
  16527. if (dir.name === "if") {
  16528. const branch = createIfBranch(node, dir);
  16529. const ifNode = {
  16530. type: 9,
  16531. loc: cloneLoc(node.loc),
  16532. branches: [branch]
  16533. };
  16534. context.replaceNode(ifNode);
  16535. if (processCodegen) {
  16536. return processCodegen(ifNode, branch, true);
  16537. }
  16538. } else {
  16539. const siblings = context.parent.children;
  16540. const comments = [];
  16541. let i = siblings.indexOf(node);
  16542. while (i-- >= -1) {
  16543. const sibling = siblings[i];
  16544. if (sibling && isCommentOrWhitespace(sibling)) {
  16545. context.removeNode(sibling);
  16546. if (sibling.type === 3) {
  16547. comments.unshift(sibling);
  16548. }
  16549. continue;
  16550. }
  16551. if (sibling && sibling.type === 9) {
  16552. if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  16553. context.onError(
  16554. createCompilerError(30, node.loc)
  16555. );
  16556. }
  16557. context.removeNode();
  16558. const branch = createIfBranch(node, dir);
  16559. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  16560. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  16561. branch.children = [...comments, ...branch.children];
  16562. }
  16563. {
  16564. const key = branch.userKey;
  16565. if (key) {
  16566. sibling.branches.forEach(({ userKey }) => {
  16567. if (isSameKey(userKey, key)) {
  16568. context.onError(
  16569. createCompilerError(
  16570. 29,
  16571. branch.userKey.loc
  16572. )
  16573. );
  16574. }
  16575. });
  16576. }
  16577. }
  16578. sibling.branches.push(branch);
  16579. const onExit = processCodegen && processCodegen(sibling, branch, false);
  16580. traverseNode(branch, context);
  16581. if (onExit) onExit();
  16582. context.currentNode = null;
  16583. } else {
  16584. context.onError(
  16585. createCompilerError(30, node.loc)
  16586. );
  16587. }
  16588. break;
  16589. }
  16590. }
  16591. }
  16592. function createIfBranch(node, dir) {
  16593. const isTemplateIf = node.tagType === 3;
  16594. return {
  16595. type: 10,
  16596. loc: node.loc,
  16597. condition: dir.name === "else" ? void 0 : dir.exp,
  16598. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  16599. userKey: findProp(node, `key`),
  16600. isTemplateIf
  16601. };
  16602. }
  16603. function createCodegenNodeForBranch(branch, keyIndex, context) {
  16604. if (branch.condition) {
  16605. return createConditionalExpression(
  16606. branch.condition,
  16607. createChildrenCodegenNode(branch, keyIndex, context),
  16608. // make sure to pass in asBlock: true so that the comment node call
  16609. // closes the current block.
  16610. createCallExpression(context.helper(CREATE_COMMENT), [
  16611. '"v-if"' ,
  16612. "true"
  16613. ])
  16614. );
  16615. } else {
  16616. return createChildrenCodegenNode(branch, keyIndex, context);
  16617. }
  16618. }
  16619. function createChildrenCodegenNode(branch, keyIndex, context) {
  16620. const { helper } = context;
  16621. const keyProperty = createObjectProperty(
  16622. `key`,
  16623. createSimpleExpression(
  16624. `${keyIndex}`,
  16625. false,
  16626. locStub,
  16627. 2
  16628. )
  16629. );
  16630. const { children } = branch;
  16631. const firstChild = children[0];
  16632. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  16633. if (needFragmentWrapper) {
  16634. if (children.length === 1 && firstChild.type === 11) {
  16635. const vnodeCall = firstChild.codegenNode;
  16636. injectProp(vnodeCall, keyProperty, context);
  16637. return vnodeCall;
  16638. } else {
  16639. let patchFlag = 64;
  16640. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  16641. patchFlag |= 2048;
  16642. }
  16643. return createVNodeCall(
  16644. context,
  16645. helper(FRAGMENT),
  16646. createObjectExpression([keyProperty]),
  16647. children,
  16648. patchFlag,
  16649. void 0,
  16650. void 0,
  16651. true,
  16652. false,
  16653. false,
  16654. branch.loc
  16655. );
  16656. }
  16657. } else {
  16658. const ret = firstChild.codegenNode;
  16659. const vnodeCall = getMemoedVNodeCall(ret);
  16660. if (vnodeCall.type === 13) {
  16661. convertToBlock(vnodeCall, context);
  16662. }
  16663. injectProp(vnodeCall, keyProperty, context);
  16664. return ret;
  16665. }
  16666. }
  16667. function isSameKey(a, b) {
  16668. if (!a || a.type !== b.type) {
  16669. return false;
  16670. }
  16671. if (a.type === 6) {
  16672. if (a.value.content !== b.value.content) {
  16673. return false;
  16674. }
  16675. } else {
  16676. const exp = a.exp;
  16677. const branchExp = b.exp;
  16678. if (exp.type !== branchExp.type) {
  16679. return false;
  16680. }
  16681. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  16682. return false;
  16683. }
  16684. }
  16685. return true;
  16686. }
  16687. function getParentCondition(node) {
  16688. while (true) {
  16689. if (node.type === 19) {
  16690. if (node.alternate.type === 19) {
  16691. node = node.alternate;
  16692. } else {
  16693. return node;
  16694. }
  16695. } else if (node.type === 20) {
  16696. node = node.value;
  16697. }
  16698. }
  16699. }
  16700. const transformFor = createStructuralDirectiveTransform(
  16701. "for",
  16702. (node, dir, context) => {
  16703. const { helper, removeHelper } = context;
  16704. return processFor(node, dir, context, (forNode) => {
  16705. const renderExp = createCallExpression(helper(RENDER_LIST), [
  16706. forNode.source
  16707. ]);
  16708. const isTemplate = isTemplateNode(node);
  16709. const memo = findDir(node, "memo");
  16710. const keyProp = findProp(node, `key`, false, true);
  16711. keyProp && keyProp.type === 7;
  16712. let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  16713. const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
  16714. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  16715. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  16716. forNode.codegenNode = createVNodeCall(
  16717. context,
  16718. helper(FRAGMENT),
  16719. void 0,
  16720. renderExp,
  16721. fragmentFlag,
  16722. void 0,
  16723. void 0,
  16724. true,
  16725. !isStableFragment,
  16726. false,
  16727. node.loc
  16728. );
  16729. return () => {
  16730. var _a;
  16731. let childBlock;
  16732. const { children } = forNode;
  16733. if (isTemplate) {
  16734. node.children.some((c) => {
  16735. if (c.type === 1) {
  16736. const key = findProp(c, "key");
  16737. if (key) {
  16738. context.onError(
  16739. createCompilerError(
  16740. 33,
  16741. key.loc
  16742. )
  16743. );
  16744. return true;
  16745. }
  16746. }
  16747. });
  16748. }
  16749. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  16750. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  16751. if (slotOutlet) {
  16752. childBlock = slotOutlet.codegenNode;
  16753. if (isTemplate && keyProperty) {
  16754. injectProp(childBlock, keyProperty, context);
  16755. }
  16756. } else if (needFragmentWrapper) {
  16757. childBlock = createVNodeCall(
  16758. context,
  16759. helper(FRAGMENT),
  16760. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  16761. node.children,
  16762. 64,
  16763. void 0,
  16764. void 0,
  16765. true,
  16766. void 0,
  16767. false
  16768. );
  16769. } else {
  16770. childBlock = children[0].codegenNode;
  16771. if (isTemplate && keyProperty) {
  16772. injectProp(childBlock, keyProperty, context);
  16773. }
  16774. const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
  16775. if (childBlock.isBlock !== shouldUseBlock) {
  16776. if (childBlock.isBlock) {
  16777. removeHelper(OPEN_BLOCK);
  16778. removeHelper(
  16779. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  16780. );
  16781. } else {
  16782. removeHelper(
  16783. getVNodeHelper(context.inSSR, childBlock.isComponent)
  16784. );
  16785. }
  16786. }
  16787. childBlock.isBlock = shouldUseBlock;
  16788. if (childBlock.isBlock) {
  16789. helper(OPEN_BLOCK);
  16790. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  16791. } else {
  16792. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  16793. if (childBlock.needsPatch) {
  16794. childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
  16795. }
  16796. }
  16797. }
  16798. if (memo) {
  16799. const loop = createFunctionExpression(
  16800. createForLoopParams(forNode.parseResult, [
  16801. createSimpleExpression(`_cached`)
  16802. ])
  16803. );
  16804. loop.body = createBlockStatement([
  16805. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  16806. createCompoundExpression([
  16807. `if (_cached && _cached.el`,
  16808. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  16809. ` && ${context.helperString(
  16810. IS_MEMO_SAME
  16811. )}(_cached, _memo)) return _cached`
  16812. ]),
  16813. createCompoundExpression([`const _item = `, childBlock]),
  16814. createSimpleExpression(`_item.memo = _memo`),
  16815. createSimpleExpression(`return _item`)
  16816. ]);
  16817. renderExp.arguments.push(
  16818. loop,
  16819. createSimpleExpression(`_cache`),
  16820. createSimpleExpression(String(context.cached.length))
  16821. );
  16822. context.cached.push(null);
  16823. } else {
  16824. renderExp.arguments.push(
  16825. createFunctionExpression(
  16826. createForLoopParams(forNode.parseResult),
  16827. childBlock,
  16828. true
  16829. )
  16830. );
  16831. }
  16832. };
  16833. });
  16834. }
  16835. );
  16836. function processFor(node, dir, context, processCodegen) {
  16837. if (!dir.exp) {
  16838. context.onError(
  16839. createCompilerError(31, dir.loc)
  16840. );
  16841. return;
  16842. }
  16843. const parseResult = dir.forParseResult;
  16844. if (!parseResult) {
  16845. context.onError(
  16846. createCompilerError(32, dir.loc)
  16847. );
  16848. return;
  16849. }
  16850. finalizeForParseResult(parseResult, context);
  16851. const { addIdentifiers, removeIdentifiers, scopes } = context;
  16852. const { source, value, key, index } = parseResult;
  16853. const forNode = {
  16854. type: 11,
  16855. loc: dir.loc,
  16856. source,
  16857. valueAlias: value,
  16858. keyAlias: key,
  16859. objectIndexAlias: index,
  16860. parseResult,
  16861. children: isTemplateNode(node) ? node.children : [node]
  16862. };
  16863. context.replaceNode(forNode);
  16864. scopes.vFor++;
  16865. const onExit = processCodegen && processCodegen(forNode);
  16866. return () => {
  16867. scopes.vFor--;
  16868. if (onExit) onExit();
  16869. };
  16870. }
  16871. function finalizeForParseResult(result, context) {
  16872. if (result.finalized) return;
  16873. {
  16874. validateBrowserExpression(result.source, context);
  16875. if (result.key) {
  16876. validateBrowserExpression(
  16877. result.key,
  16878. context,
  16879. true
  16880. );
  16881. }
  16882. if (result.index) {
  16883. validateBrowserExpression(
  16884. result.index,
  16885. context,
  16886. true
  16887. );
  16888. }
  16889. if (result.value) {
  16890. validateBrowserExpression(
  16891. result.value,
  16892. context,
  16893. true
  16894. );
  16895. }
  16896. }
  16897. result.finalized = true;
  16898. }
  16899. function createForLoopParams({ value, key, index }, memoArgs = []) {
  16900. return createParamsList([value, key, index, ...memoArgs]);
  16901. }
  16902. function createParamsList(args) {
  16903. let i = args.length;
  16904. while (i--) {
  16905. if (args[i]) break;
  16906. }
  16907. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  16908. }
  16909. const defaultFallback = createSimpleExpression(`undefined`, false);
  16910. const trackSlotScopes = (node, context) => {
  16911. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  16912. const vSlot = findDir(node, "slot");
  16913. if (vSlot) {
  16914. vSlot.exp;
  16915. context.scopes.vSlot++;
  16916. return () => {
  16917. context.scopes.vSlot--;
  16918. };
  16919. }
  16920. }
  16921. };
  16922. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  16923. props,
  16924. children,
  16925. false,
  16926. true,
  16927. children.length ? children[0].loc : loc
  16928. );
  16929. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  16930. context.helper(WITH_CTX);
  16931. const { children, loc } = node;
  16932. const slotsProperties = [];
  16933. const dynamicSlots = [];
  16934. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  16935. const onComponentSlot = findDir(node, "slot", true);
  16936. if (onComponentSlot) {
  16937. const { arg, exp } = onComponentSlot;
  16938. if (arg && !isStaticExp(arg)) {
  16939. hasDynamicSlots = true;
  16940. }
  16941. slotsProperties.push(
  16942. createObjectProperty(
  16943. arg || createSimpleExpression("default", true),
  16944. buildSlotFn(exp, void 0, children, loc)
  16945. )
  16946. );
  16947. }
  16948. let hasTemplateSlots = false;
  16949. let hasNamedDefaultSlot = false;
  16950. const implicitDefaultChildren = [];
  16951. const seenSlotNames = /* @__PURE__ */ new Set();
  16952. let conditionalBranchIndex = 0;
  16953. for (let i = 0; i < children.length; i++) {
  16954. const slotElement = children[i];
  16955. let slotDir;
  16956. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  16957. if (slotElement.type !== 3) {
  16958. implicitDefaultChildren.push(slotElement);
  16959. }
  16960. continue;
  16961. }
  16962. if (onComponentSlot) {
  16963. context.onError(
  16964. createCompilerError(37, slotDir.loc)
  16965. );
  16966. break;
  16967. }
  16968. hasTemplateSlots = true;
  16969. const { children: slotChildren, loc: slotLoc } = slotElement;
  16970. const {
  16971. arg: slotName = createSimpleExpression(`default`, true),
  16972. exp: slotProps,
  16973. loc: dirLoc
  16974. } = slotDir;
  16975. let staticSlotName;
  16976. if (isStaticExp(slotName)) {
  16977. staticSlotName = slotName ? slotName.content : `default`;
  16978. } else {
  16979. hasDynamicSlots = true;
  16980. }
  16981. const vFor = findDir(slotElement, "for");
  16982. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  16983. let vIf;
  16984. let vElse;
  16985. if (vIf = findDir(slotElement, "if")) {
  16986. hasDynamicSlots = true;
  16987. dynamicSlots.push(
  16988. createConditionalExpression(
  16989. vIf.exp,
  16990. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  16991. defaultFallback
  16992. )
  16993. );
  16994. } else if (vElse = findDir(
  16995. slotElement,
  16996. /^else(?:-if)?$/,
  16997. true
  16998. /* allowEmpty */
  16999. )) {
  17000. let j = i;
  17001. let prev;
  17002. while (j--) {
  17003. prev = children[j];
  17004. if (!isCommentOrWhitespace(prev)) {
  17005. break;
  17006. }
  17007. }
  17008. if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
  17009. let conditional = dynamicSlots[dynamicSlots.length - 1];
  17010. while (conditional.alternate.type === 19) {
  17011. conditional = conditional.alternate;
  17012. }
  17013. conditional.alternate = vElse.exp ? createConditionalExpression(
  17014. vElse.exp,
  17015. buildDynamicSlot(
  17016. slotName,
  17017. slotFunction,
  17018. conditionalBranchIndex++
  17019. ),
  17020. defaultFallback
  17021. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  17022. } else {
  17023. context.onError(
  17024. createCompilerError(30, vElse.loc)
  17025. );
  17026. }
  17027. } else if (vFor) {
  17028. hasDynamicSlots = true;
  17029. const parseResult = vFor.forParseResult;
  17030. if (parseResult) {
  17031. finalizeForParseResult(parseResult, context);
  17032. dynamicSlots.push(
  17033. createCallExpression(context.helper(RENDER_LIST), [
  17034. parseResult.source,
  17035. createFunctionExpression(
  17036. createForLoopParams(parseResult),
  17037. buildDynamicSlot(slotName, slotFunction),
  17038. true
  17039. )
  17040. ])
  17041. );
  17042. } else {
  17043. context.onError(
  17044. createCompilerError(
  17045. 32,
  17046. vFor.loc
  17047. )
  17048. );
  17049. }
  17050. } else {
  17051. if (staticSlotName) {
  17052. if (seenSlotNames.has(staticSlotName)) {
  17053. context.onError(
  17054. createCompilerError(
  17055. 38,
  17056. dirLoc
  17057. )
  17058. );
  17059. continue;
  17060. }
  17061. seenSlotNames.add(staticSlotName);
  17062. if (staticSlotName === "default") {
  17063. hasNamedDefaultSlot = true;
  17064. }
  17065. }
  17066. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  17067. }
  17068. }
  17069. if (!onComponentSlot) {
  17070. const buildDefaultSlotProperty = (props, children2) => {
  17071. const fn = buildSlotFn(props, void 0, children2, loc);
  17072. return createObjectProperty(`default`, fn);
  17073. };
  17074. if (!hasTemplateSlots) {
  17075. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  17076. } else if (implicitDefaultChildren.length && // #3766
  17077. // with whitespace: 'preserve', whitespaces between slots will end up in
  17078. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  17079. !implicitDefaultChildren.every(isWhitespaceText)) {
  17080. if (hasNamedDefaultSlot) {
  17081. context.onError(
  17082. createCompilerError(
  17083. 39,
  17084. implicitDefaultChildren[0].loc
  17085. )
  17086. );
  17087. } else {
  17088. slotsProperties.push(
  17089. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  17090. );
  17091. }
  17092. }
  17093. }
  17094. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  17095. let slots = createObjectExpression(
  17096. slotsProperties.concat(
  17097. createObjectProperty(
  17098. `_`,
  17099. // 2 = compiled but dynamic = can skip normalization, but must run diff
  17100. // 1 = compiled and static = can skip normalization AND diff as optimized
  17101. createSimpleExpression(
  17102. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  17103. false
  17104. )
  17105. )
  17106. ),
  17107. loc
  17108. );
  17109. if (dynamicSlots.length) {
  17110. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  17111. slots,
  17112. createArrayExpression(dynamicSlots)
  17113. ]);
  17114. }
  17115. return {
  17116. slots,
  17117. hasDynamicSlots
  17118. };
  17119. }
  17120. function buildDynamicSlot(name, fn, index) {
  17121. const props = [
  17122. createObjectProperty(`name`, name),
  17123. createObjectProperty(`fn`, fn)
  17124. ];
  17125. if (index != null) {
  17126. props.push(
  17127. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  17128. );
  17129. }
  17130. return createObjectExpression(props);
  17131. }
  17132. function hasForwardedSlots(children) {
  17133. for (let i = 0; i < children.length; i++) {
  17134. const child = children[i];
  17135. switch (child.type) {
  17136. case 1:
  17137. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  17138. return true;
  17139. }
  17140. break;
  17141. case 9:
  17142. if (hasForwardedSlots(child.branches)) return true;
  17143. break;
  17144. case 10:
  17145. case 11:
  17146. if (hasForwardedSlots(child.children)) return true;
  17147. break;
  17148. }
  17149. }
  17150. return false;
  17151. }
  17152. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  17153. const transformElement = (node, context) => {
  17154. return function postTransformElement() {
  17155. node = context.currentNode;
  17156. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  17157. return;
  17158. }
  17159. const { tag, props } = node;
  17160. const isComponent = node.tagType === 1;
  17161. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  17162. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  17163. let vnodeProps;
  17164. let vnodeChildren;
  17165. let patchFlag = 0;
  17166. let vnodeDynamicProps;
  17167. let dynamicPropNames;
  17168. let vnodeDirectives;
  17169. let needsPatch = false;
  17170. let isBlockRequired = false;
  17171. let shouldUseBlock = (
  17172. // dynamic component may resolve to plain elements
  17173. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  17174. // updates inside get proper isSVG flag at runtime. (#639, #643)
  17175. // This is technically web-specific, but splitting the logic out of core
  17176. // leads to too much unnecessary complexity.
  17177. (tag === "svg" || tag === "foreignObject" || tag === "math")
  17178. );
  17179. if (props.length > 0) {
  17180. const propsBuildResult = buildProps(
  17181. node,
  17182. context,
  17183. void 0,
  17184. isComponent,
  17185. isDynamicComponent
  17186. );
  17187. vnodeProps = propsBuildResult.props;
  17188. patchFlag = propsBuildResult.patchFlag;
  17189. dynamicPropNames = propsBuildResult.dynamicPropNames;
  17190. needsPatch = propsBuildResult.needsPatch;
  17191. isBlockRequired = propsBuildResult.isBlockRequired;
  17192. const directives = propsBuildResult.directives;
  17193. vnodeDirectives = directives && directives.length ? createArrayExpression(
  17194. directives.map((dir) => buildDirectiveArgs(dir, context))
  17195. ) : void 0;
  17196. if (propsBuildResult.shouldUseBlock) {
  17197. shouldUseBlock = true;
  17198. }
  17199. }
  17200. if (node.children.length > 0) {
  17201. if (vnodeTag === KEEP_ALIVE) {
  17202. shouldUseBlock = true;
  17203. patchFlag |= 1024;
  17204. if (node.children.length > 1) {
  17205. context.onError(
  17206. createCompilerError(47, {
  17207. start: node.children[0].loc.start,
  17208. end: node.children[node.children.length - 1].loc.end,
  17209. source: ""
  17210. })
  17211. );
  17212. }
  17213. }
  17214. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  17215. vnodeTag !== TELEPORT && // explained above.
  17216. vnodeTag !== KEEP_ALIVE;
  17217. if (shouldBuildAsSlots) {
  17218. const { slots, hasDynamicSlots } = buildSlots(node, context);
  17219. vnodeChildren = slots;
  17220. if (hasDynamicSlots) {
  17221. patchFlag |= 1024;
  17222. }
  17223. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  17224. const child = node.children[0];
  17225. const type = child.type;
  17226. const hasDynamicTextChild = type === 5 || type === 8;
  17227. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  17228. patchFlag |= 1;
  17229. }
  17230. if (hasDynamicTextChild || type === 2) {
  17231. vnodeChildren = child;
  17232. } else {
  17233. vnodeChildren = node.children;
  17234. }
  17235. } else {
  17236. vnodeChildren = node.children;
  17237. }
  17238. }
  17239. if (dynamicPropNames && dynamicPropNames.length) {
  17240. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  17241. }
  17242. const vnodeCall = node.codegenNode = createVNodeCall(
  17243. context,
  17244. vnodeTag,
  17245. vnodeProps,
  17246. vnodeChildren,
  17247. patchFlag === 0 ? void 0 : patchFlag,
  17248. vnodeDynamicProps,
  17249. vnodeDirectives,
  17250. !!shouldUseBlock,
  17251. false,
  17252. isComponent,
  17253. node.loc
  17254. );
  17255. needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
  17256. if (needsPatch) {
  17257. vnodeCall.needsPatch = true;
  17258. }
  17259. if (isBlockRequired) {
  17260. vnodeCall.isBlockRequired = true;
  17261. }
  17262. };
  17263. };
  17264. function resolveComponentType(node, context, ssr = false) {
  17265. let { tag } = node;
  17266. const isExplicitDynamic = isComponentTag(tag);
  17267. const isProp = findProp(
  17268. node,
  17269. "is",
  17270. false,
  17271. true
  17272. /* allow empty */
  17273. );
  17274. if (isProp) {
  17275. if (isExplicitDynamic || false) {
  17276. let exp;
  17277. if (isProp.type === 6) {
  17278. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  17279. } else {
  17280. exp = isProp.exp;
  17281. if (!exp) {
  17282. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  17283. }
  17284. }
  17285. if (exp) {
  17286. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  17287. exp
  17288. ]);
  17289. }
  17290. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  17291. tag = isProp.value.content.slice(4);
  17292. }
  17293. }
  17294. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  17295. if (builtIn) {
  17296. if (!ssr) context.helper(builtIn);
  17297. return builtIn;
  17298. }
  17299. context.helper(RESOLVE_COMPONENT);
  17300. context.components.add(tag);
  17301. return toValidAssetId(tag, `component`);
  17302. }
  17303. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  17304. const { tag, loc: elementLoc, children } = node;
  17305. let properties = [];
  17306. const mergeArgs = [];
  17307. const runtimeDirectives = [];
  17308. const hasChildren = children.length > 0;
  17309. let shouldUseBlock = false;
  17310. let isBlockRequired = false;
  17311. let patchFlag = 0;
  17312. let hasRef = false;
  17313. let hasClassBinding = false;
  17314. let hasStyleBinding = false;
  17315. let hasHydrationEventBinding = false;
  17316. let hasDynamicKeys = false;
  17317. let hasVnodeHook = false;
  17318. const dynamicPropNames = [];
  17319. const pushMergeArg = (arg) => {
  17320. if (properties.length) {
  17321. mergeArgs.push(
  17322. createObjectExpression(dedupeProperties(properties), elementLoc)
  17323. );
  17324. properties = [];
  17325. }
  17326. if (arg) mergeArgs.push(arg);
  17327. };
  17328. const pushRefVForMarker = () => {
  17329. if (context.scopes.vFor > 0) {
  17330. properties.push(
  17331. createObjectProperty(
  17332. createSimpleExpression("ref_for", true),
  17333. createSimpleExpression("true")
  17334. )
  17335. );
  17336. }
  17337. };
  17338. const analyzePatchFlag = ({ key, value }) => {
  17339. if (isStaticExp(key)) {
  17340. const name = key.content;
  17341. const isEventHandler = isOn(name);
  17342. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  17343. // dedicated fast path.
  17344. name.toLowerCase() !== "onclick" && // omit v-model handlers
  17345. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  17346. !isReservedProp(name)) {
  17347. hasHydrationEventBinding = true;
  17348. }
  17349. if (isEventHandler && isReservedProp(name)) {
  17350. hasVnodeHook = true;
  17351. }
  17352. if (name === "ref") {
  17353. hasRef = true;
  17354. }
  17355. if (isEventHandler && value.type === 14) {
  17356. value = value.arguments[0];
  17357. }
  17358. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  17359. return;
  17360. }
  17361. if (name === "class") {
  17362. hasClassBinding = true;
  17363. } else if (name === "style") {
  17364. hasStyleBinding = true;
  17365. } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
  17366. dynamicPropNames.push(name);
  17367. }
  17368. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  17369. dynamicPropNames.push(name);
  17370. }
  17371. } else {
  17372. hasDynamicKeys = true;
  17373. }
  17374. };
  17375. for (let i = 0; i < props.length; i++) {
  17376. const prop = props[i];
  17377. if (prop.type === 6) {
  17378. const { loc, name, nameLoc, value } = prop;
  17379. let isStatic = true;
  17380. if (name === "ref") {
  17381. hasRef = true;
  17382. pushRefVForMarker();
  17383. }
  17384. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  17385. continue;
  17386. }
  17387. properties.push(
  17388. createObjectProperty(
  17389. createSimpleExpression(name, true, nameLoc),
  17390. createSimpleExpression(
  17391. value ? value.content : "",
  17392. isStatic,
  17393. value ? value.loc : loc
  17394. )
  17395. )
  17396. );
  17397. } else {
  17398. const { name, arg, exp, loc, modifiers } = prop;
  17399. const isVBind = name === "bind";
  17400. const isVOn = name === "on";
  17401. if (name === "slot") {
  17402. if (!isComponent) {
  17403. context.onError(
  17404. createCompilerError(40, loc)
  17405. );
  17406. }
  17407. continue;
  17408. }
  17409. if (name === "once" || name === "memo") {
  17410. continue;
  17411. }
  17412. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  17413. continue;
  17414. }
  17415. if (isVOn && ssr) {
  17416. continue;
  17417. }
  17418. if (isVBind && isStaticArgOf(arg, "key")) {
  17419. shouldUseBlock = true;
  17420. }
  17421. if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
  17422. shouldUseBlock = true;
  17423. isBlockRequired = true;
  17424. }
  17425. if (isVBind && isStaticArgOf(arg, "ref")) {
  17426. pushRefVForMarker();
  17427. }
  17428. if (!arg && (isVBind || isVOn)) {
  17429. hasDynamicKeys = true;
  17430. if (exp) {
  17431. if (isVBind) {
  17432. pushRefVForMarker();
  17433. pushMergeArg();
  17434. mergeArgs.push(exp);
  17435. } else {
  17436. pushMergeArg({
  17437. type: 14,
  17438. loc,
  17439. callee: context.helper(TO_HANDLERS),
  17440. arguments: isComponent ? [exp] : [exp, `true`]
  17441. });
  17442. }
  17443. } else {
  17444. context.onError(
  17445. createCompilerError(
  17446. isVBind ? 34 : 35,
  17447. loc
  17448. )
  17449. );
  17450. }
  17451. continue;
  17452. }
  17453. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  17454. patchFlag |= 32;
  17455. }
  17456. const directiveTransform = context.directiveTransforms[name];
  17457. if (directiveTransform) {
  17458. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  17459. !ssr && props2.forEach(analyzePatchFlag);
  17460. if (isVOn && arg && !isStaticExp(arg)) {
  17461. pushMergeArg(createObjectExpression(props2, elementLoc));
  17462. } else {
  17463. properties.push(...props2);
  17464. }
  17465. if (needRuntime) {
  17466. runtimeDirectives.push(prop);
  17467. if (isSymbol(needRuntime)) {
  17468. directiveImportMap.set(prop, needRuntime);
  17469. }
  17470. }
  17471. } else if (!isBuiltInDirective(name)) {
  17472. runtimeDirectives.push(prop);
  17473. if (hasChildren) {
  17474. shouldUseBlock = true;
  17475. isBlockRequired = true;
  17476. }
  17477. }
  17478. }
  17479. }
  17480. let propsExpression = void 0;
  17481. if (mergeArgs.length) {
  17482. pushMergeArg();
  17483. if (mergeArgs.length > 1) {
  17484. propsExpression = createCallExpression(
  17485. context.helper(MERGE_PROPS),
  17486. mergeArgs,
  17487. elementLoc
  17488. );
  17489. } else {
  17490. propsExpression = mergeArgs[0];
  17491. }
  17492. } else if (properties.length) {
  17493. propsExpression = createObjectExpression(
  17494. dedupeProperties(properties),
  17495. elementLoc
  17496. );
  17497. }
  17498. if (hasDynamicKeys) {
  17499. patchFlag |= 16;
  17500. } else {
  17501. if (hasClassBinding && !isComponent) {
  17502. patchFlag |= 2;
  17503. }
  17504. if (hasStyleBinding && !isComponent) {
  17505. patchFlag |= 4;
  17506. }
  17507. if (dynamicPropNames.length) {
  17508. patchFlag |= 8;
  17509. }
  17510. if (hasHydrationEventBinding) {
  17511. patchFlag |= 32;
  17512. }
  17513. }
  17514. const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
  17515. if (!shouldUseBlock && needsPatch) {
  17516. patchFlag |= 512;
  17517. }
  17518. if (!context.inSSR && propsExpression) {
  17519. switch (propsExpression.type) {
  17520. case 15:
  17521. let classKeyIndex = -1;
  17522. let styleKeyIndex = -1;
  17523. let hasDynamicKey = false;
  17524. for (let i = 0; i < propsExpression.properties.length; i++) {
  17525. const key = propsExpression.properties[i].key;
  17526. if (isStaticExp(key)) {
  17527. if (key.content === "class") {
  17528. classKeyIndex = i;
  17529. } else if (key.content === "style") {
  17530. styleKeyIndex = i;
  17531. }
  17532. } else if (!key.isHandlerKey) {
  17533. hasDynamicKey = true;
  17534. }
  17535. }
  17536. const classProp = propsExpression.properties[classKeyIndex];
  17537. const styleProp = propsExpression.properties[styleKeyIndex];
  17538. if (!hasDynamicKey) {
  17539. if (classProp && !isStaticExp(classProp.value)) {
  17540. classProp.value = createCallExpression(
  17541. context.helper(NORMALIZE_CLASS),
  17542. [classProp.value]
  17543. );
  17544. }
  17545. if (styleProp && // the static style is compiled into an object,
  17546. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  17547. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  17548. // v-bind:style with static literal object
  17549. styleProp.value.type === 17)) {
  17550. styleProp.value = createCallExpression(
  17551. context.helper(NORMALIZE_STYLE),
  17552. [styleProp.value]
  17553. );
  17554. }
  17555. } else {
  17556. propsExpression = createCallExpression(
  17557. context.helper(NORMALIZE_PROPS),
  17558. [propsExpression]
  17559. );
  17560. }
  17561. break;
  17562. case 14:
  17563. break;
  17564. default:
  17565. propsExpression = createCallExpression(
  17566. context.helper(NORMALIZE_PROPS),
  17567. [
  17568. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  17569. propsExpression
  17570. ])
  17571. ]
  17572. );
  17573. break;
  17574. }
  17575. }
  17576. return {
  17577. props: propsExpression,
  17578. directives: runtimeDirectives,
  17579. patchFlag,
  17580. dynamicPropNames,
  17581. shouldUseBlock,
  17582. needsPatch,
  17583. isBlockRequired
  17584. };
  17585. }
  17586. function dedupeProperties(properties) {
  17587. const knownProps = /* @__PURE__ */ new Map();
  17588. const deduped = [];
  17589. for (let i = 0; i < properties.length; i++) {
  17590. const prop = properties[i];
  17591. if (prop.key.type === 8 || !prop.key.isStatic) {
  17592. deduped.push(prop);
  17593. continue;
  17594. }
  17595. const name = prop.key.content;
  17596. const existing = knownProps.get(name);
  17597. if (existing) {
  17598. if (name === "style" || name === "class" || isOn(name)) {
  17599. mergeAsArray(existing, prop);
  17600. }
  17601. } else {
  17602. knownProps.set(name, prop);
  17603. deduped.push(prop);
  17604. }
  17605. }
  17606. return deduped;
  17607. }
  17608. function mergeAsArray(existing, incoming) {
  17609. if (existing.value.type === 17) {
  17610. existing.value.elements.push(incoming.value);
  17611. } else {
  17612. existing.value = createArrayExpression(
  17613. [existing.value, incoming.value],
  17614. existing.loc
  17615. );
  17616. }
  17617. }
  17618. function buildDirectiveArgs(dir, context) {
  17619. const dirArgs = [];
  17620. const runtime = directiveImportMap.get(dir);
  17621. if (runtime) {
  17622. dirArgs.push(context.helperString(runtime));
  17623. } else {
  17624. {
  17625. context.helper(RESOLVE_DIRECTIVE);
  17626. context.directives.add(dir.name);
  17627. dirArgs.push(toValidAssetId(dir.name, `directive`));
  17628. }
  17629. }
  17630. const { loc } = dir;
  17631. if (dir.exp) dirArgs.push(dir.exp);
  17632. if (dir.arg) {
  17633. if (!dir.exp) {
  17634. dirArgs.push(`void 0`);
  17635. }
  17636. dirArgs.push(dir.arg);
  17637. }
  17638. if (Object.keys(dir.modifiers).length) {
  17639. if (!dir.arg) {
  17640. if (!dir.exp) {
  17641. dirArgs.push(`void 0`);
  17642. }
  17643. dirArgs.push(`void 0`);
  17644. }
  17645. const trueExpression = createSimpleExpression(`true`, false, loc);
  17646. dirArgs.push(
  17647. createObjectExpression(
  17648. dir.modifiers.map(
  17649. (modifier) => createObjectProperty(modifier, trueExpression)
  17650. ),
  17651. loc
  17652. )
  17653. );
  17654. }
  17655. return createArrayExpression(dirArgs, dir.loc);
  17656. }
  17657. function stringifyDynamicPropNames(props) {
  17658. let propsNamesString = `[`;
  17659. for (let i = 0, l = props.length; i < l; i++) {
  17660. propsNamesString += JSON.stringify(props[i]);
  17661. if (i < l - 1) propsNamesString += ", ";
  17662. }
  17663. return propsNamesString + `]`;
  17664. }
  17665. function isComponentTag(tag) {
  17666. return tag === "component" || tag === "Component";
  17667. }
  17668. const transformSlotOutlet = (node, context) => {
  17669. if (isSlotOutlet(node)) {
  17670. const { children, loc } = node;
  17671. const { slotName, slotProps } = processSlotOutlet(node, context);
  17672. const slotArgs = [
  17673. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  17674. slotName,
  17675. "{}",
  17676. "undefined",
  17677. "true"
  17678. ];
  17679. let expectedLen = 2;
  17680. if (slotProps) {
  17681. slotArgs[2] = slotProps;
  17682. expectedLen = 3;
  17683. }
  17684. if (children.length) {
  17685. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  17686. expectedLen = 4;
  17687. }
  17688. if (context.scopeId && !context.slotted) {
  17689. expectedLen = 5;
  17690. }
  17691. slotArgs.splice(expectedLen);
  17692. node.codegenNode = createCallExpression(
  17693. context.helper(RENDER_SLOT),
  17694. slotArgs,
  17695. loc
  17696. );
  17697. }
  17698. };
  17699. function processSlotOutlet(node, context) {
  17700. let slotName = `"default"`;
  17701. let slotProps = void 0;
  17702. const nonNameProps = [];
  17703. for (let i = 0; i < node.props.length; i++) {
  17704. const p = node.props[i];
  17705. if (p.type === 6) {
  17706. if (p.value) {
  17707. if (p.name === "name") {
  17708. slotName = JSON.stringify(p.value.content);
  17709. } else {
  17710. p.name = camelize(p.name);
  17711. nonNameProps.push(p);
  17712. }
  17713. }
  17714. } else {
  17715. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  17716. if (p.exp) {
  17717. slotName = p.exp;
  17718. } else if (p.arg && p.arg.type === 4) {
  17719. const name = camelize(p.arg.content);
  17720. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  17721. }
  17722. } else {
  17723. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  17724. p.arg.content = camelize(p.arg.content);
  17725. }
  17726. nonNameProps.push(p);
  17727. }
  17728. }
  17729. }
  17730. if (nonNameProps.length > 0) {
  17731. const { props, directives } = buildProps(
  17732. node,
  17733. context,
  17734. nonNameProps,
  17735. false,
  17736. false
  17737. );
  17738. slotProps = props;
  17739. if (directives.length) {
  17740. context.onError(
  17741. createCompilerError(
  17742. 36,
  17743. directives[0].loc
  17744. )
  17745. );
  17746. }
  17747. }
  17748. return {
  17749. slotName,
  17750. slotProps
  17751. };
  17752. }
  17753. const transformOn$1 = (dir, node, context, augmentor) => {
  17754. const { loc, modifiers, arg } = dir;
  17755. if (!dir.exp && !modifiers.length) {
  17756. context.onError(createCompilerError(35, loc));
  17757. }
  17758. let eventName;
  17759. if (arg.type === 4) {
  17760. if (arg.isStatic) {
  17761. let rawName = arg.content;
  17762. if (rawName.startsWith("vnode")) {
  17763. context.onError(createCompilerError(52, arg.loc));
  17764. }
  17765. if (rawName.startsWith("vue:")) {
  17766. rawName = `vnode-${rawName.slice(4)}`;
  17767. }
  17768. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  17769. // for non-element and vnode lifecycle event listeners, auto convert
  17770. // it to camelCase. See issue #2249
  17771. toHandlerKey(camelize(rawName))
  17772. ) : (
  17773. // preserve case for plain element listeners that have uppercase
  17774. // letters, as these may be custom elements' custom events
  17775. `on:${rawName}`
  17776. );
  17777. eventName = createSimpleExpression(eventString, true, arg.loc);
  17778. } else {
  17779. eventName = createCompoundExpression([
  17780. `${context.helperString(TO_HANDLER_KEY)}(`,
  17781. arg,
  17782. `)`
  17783. ]);
  17784. }
  17785. } else {
  17786. eventName = arg;
  17787. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  17788. eventName.children.push(`)`);
  17789. }
  17790. let exp = dir.exp;
  17791. if (exp && !exp.content.trim()) {
  17792. exp = void 0;
  17793. }
  17794. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  17795. if (exp) {
  17796. const isMemberExp = isMemberExpression(exp);
  17797. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  17798. const hasMultipleStatements = exp.content.includes(`;`);
  17799. {
  17800. validateBrowserExpression(
  17801. exp,
  17802. context,
  17803. false,
  17804. hasMultipleStatements
  17805. );
  17806. }
  17807. if (isInlineStatement || shouldCache && isMemberExp) {
  17808. exp = createCompoundExpression([
  17809. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  17810. exp,
  17811. hasMultipleStatements ? `}` : `)`
  17812. ]);
  17813. }
  17814. }
  17815. let ret = {
  17816. props: [
  17817. createObjectProperty(
  17818. eventName,
  17819. exp || createSimpleExpression(`() => {}`, false, loc)
  17820. )
  17821. ]
  17822. };
  17823. if (augmentor) {
  17824. ret = augmentor(ret);
  17825. }
  17826. if (shouldCache) {
  17827. ret.props[0].value = context.cache(ret.props[0].value);
  17828. }
  17829. ret.props.forEach((p) => p.key.isHandlerKey = true);
  17830. return ret;
  17831. };
  17832. const transformBind = (dir, _node, context) => {
  17833. const { modifiers, loc } = dir;
  17834. const arg = dir.arg;
  17835. let { exp } = dir;
  17836. if (exp && exp.type === 4 && !exp.content.trim()) {
  17837. {
  17838. exp = void 0;
  17839. }
  17840. }
  17841. if (arg.type !== 4) {
  17842. arg.children.unshift(`(`);
  17843. arg.children.push(`) || ""`);
  17844. } else if (!arg.isStatic) {
  17845. arg.content = arg.content ? `${arg.content} || ""` : `""`;
  17846. }
  17847. if (modifiers.some((mod) => mod.content === "camel")) {
  17848. if (arg.type === 4) {
  17849. if (arg.isStatic) {
  17850. arg.content = camelize(arg.content);
  17851. } else {
  17852. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  17853. }
  17854. } else {
  17855. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  17856. arg.children.push(`)`);
  17857. }
  17858. }
  17859. if (!context.inSSR) {
  17860. if (modifiers.some((mod) => mod.content === "prop")) {
  17861. injectPrefix(arg, ".");
  17862. }
  17863. if (modifiers.some((mod) => mod.content === "attr")) {
  17864. injectPrefix(arg, "^");
  17865. }
  17866. }
  17867. return {
  17868. props: [createObjectProperty(arg, exp)]
  17869. };
  17870. };
  17871. const injectPrefix = (arg, prefix) => {
  17872. if (arg.type === 4) {
  17873. if (arg.isStatic) {
  17874. arg.content = prefix + arg.content;
  17875. } else {
  17876. arg.content = `\`${prefix}\${${arg.content}}\``;
  17877. }
  17878. } else {
  17879. arg.children.unshift(`'${prefix}' + (`);
  17880. arg.children.push(`)`);
  17881. }
  17882. };
  17883. const transformText = (node, context) => {
  17884. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  17885. return () => {
  17886. const children = node.children;
  17887. let currentContainer = void 0;
  17888. let hasText = false;
  17889. for (let i = 0; i < children.length; i++) {
  17890. const child = children[i];
  17891. if (isText$1(child)) {
  17892. hasText = true;
  17893. for (let j = i + 1; j < children.length; j++) {
  17894. const next = children[j];
  17895. if (isText$1(next)) {
  17896. if (!currentContainer) {
  17897. currentContainer = children[i] = createCompoundExpression(
  17898. [child],
  17899. child.loc
  17900. );
  17901. }
  17902. currentContainer.children.push(` + `, next);
  17903. children.splice(j, 1);
  17904. j--;
  17905. } else {
  17906. currentContainer = void 0;
  17907. break;
  17908. }
  17909. }
  17910. }
  17911. }
  17912. if (!hasText || // if this is a plain element with a single text child, leave it
  17913. // as-is since the runtime has dedicated fast path for this by directly
  17914. // setting textContent of the element.
  17915. // for component root it's always normalized anyway.
  17916. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  17917. // custom directives can potentially add DOM elements arbitrarily,
  17918. // we need to avoid setting textContent of the element at runtime
  17919. // to avoid accidentally overwriting the DOM elements added
  17920. // by the user through custom directives.
  17921. !node.props.find(
  17922. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  17923. ) && // in compat mode, <template> tags with no special directives
  17924. // will be rendered as a fragment so its children must be
  17925. // converted into vnodes.
  17926. true)) {
  17927. return;
  17928. }
  17929. for (let i = 0; i < children.length; i++) {
  17930. const child = children[i];
  17931. if (isText$1(child) || child.type === 8) {
  17932. const callArgs = [];
  17933. if (child.type !== 2 || child.content !== " ") {
  17934. callArgs.push(child);
  17935. }
  17936. if (!context.ssr && getConstantType(child, context) === 0) {
  17937. callArgs.push(
  17938. 1 + (` /* ${PatchFlagNames[1]} */` )
  17939. );
  17940. }
  17941. children[i] = {
  17942. type: 12,
  17943. content: child,
  17944. loc: child.loc,
  17945. codegenNode: createCallExpression(
  17946. context.helper(CREATE_TEXT),
  17947. callArgs
  17948. )
  17949. };
  17950. }
  17951. }
  17952. };
  17953. }
  17954. };
  17955. const seen$1 = /* @__PURE__ */ new WeakSet();
  17956. const transformOnce = (node, context) => {
  17957. if (node.type === 1 && findDir(node, "once", true)) {
  17958. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  17959. return;
  17960. }
  17961. seen$1.add(node);
  17962. context.inVOnce = true;
  17963. context.helper(SET_BLOCK_TRACKING);
  17964. return () => {
  17965. context.inVOnce = false;
  17966. const cur = context.currentNode;
  17967. if (cur.codegenNode) {
  17968. cur.codegenNode = context.cache(
  17969. cur.codegenNode,
  17970. true,
  17971. true
  17972. );
  17973. }
  17974. };
  17975. }
  17976. };
  17977. const transformModel$1 = (dir, node, context) => {
  17978. const { exp, arg } = dir;
  17979. if (!exp) {
  17980. context.onError(
  17981. createCompilerError(41, dir.loc)
  17982. );
  17983. return createTransformProps();
  17984. }
  17985. const rawExp = exp.loc.source.trim();
  17986. const expString = exp.type === 4 ? exp.content : rawExp;
  17987. const bindingType = context.bindingMetadata[rawExp];
  17988. if (bindingType === "props" || bindingType === "props-aliased") {
  17989. context.onError(createCompilerError(44, exp.loc));
  17990. return createTransformProps();
  17991. }
  17992. if (bindingType === "literal-const" || bindingType === "setup-const") {
  17993. context.onError(createCompilerError(45, exp.loc));
  17994. return createTransformProps();
  17995. }
  17996. if (!expString.trim() || !isMemberExpression(exp) && true) {
  17997. context.onError(
  17998. createCompilerError(42, exp.loc)
  17999. );
  18000. return createTransformProps();
  18001. }
  18002. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  18003. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  18004. let assignmentExp;
  18005. const eventArg = context.isTS ? `($event: any)` : `$event`;
  18006. {
  18007. assignmentExp = createCompoundExpression([
  18008. `${eventArg} => ((`,
  18009. exp,
  18010. `) = $event)`
  18011. ]);
  18012. }
  18013. const props = [
  18014. // modelValue: foo
  18015. createObjectProperty(propName, dir.exp),
  18016. // "onUpdate:modelValue": $event => (foo = $event)
  18017. createObjectProperty(eventName, assignmentExp)
  18018. ];
  18019. if (dir.modifiers.length && node.tagType === 1) {
  18020. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  18021. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  18022. props.push(
  18023. createObjectProperty(
  18024. modifiersKey,
  18025. createSimpleExpression(
  18026. `{ ${modifiers} }`,
  18027. false,
  18028. dir.loc,
  18029. 2
  18030. )
  18031. )
  18032. );
  18033. }
  18034. return createTransformProps(props);
  18035. };
  18036. function createTransformProps(props = []) {
  18037. return { props };
  18038. }
  18039. const seen = /* @__PURE__ */ new WeakSet();
  18040. const transformMemo = (node, context) => {
  18041. if (node.type === 1) {
  18042. const dir = findDir(node, "memo");
  18043. if (!dir || seen.has(node) || context.inSSR) {
  18044. return;
  18045. }
  18046. seen.add(node);
  18047. return () => {
  18048. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  18049. if (codegenNode && codegenNode.type === 13) {
  18050. if (node.tagType !== 1) {
  18051. convertToBlock(codegenNode, context);
  18052. }
  18053. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  18054. dir.exp,
  18055. createFunctionExpression(void 0, codegenNode),
  18056. `_cache`,
  18057. String(context.cached.length)
  18058. ]);
  18059. context.cached.push(null);
  18060. }
  18061. };
  18062. }
  18063. };
  18064. const transformVBindShorthand = (node, context) => {
  18065. if (node.type === 1) {
  18066. for (const prop of node.props) {
  18067. if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
  18068. prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
  18069. const arg = prop.arg;
  18070. if (arg.type !== 4 || !arg.isStatic) {
  18071. context.onError(
  18072. createCompilerError(
  18073. 53,
  18074. arg.loc
  18075. )
  18076. );
  18077. prop.exp = createSimpleExpression("", true, arg.loc);
  18078. } else {
  18079. const propName = camelize(arg.content);
  18080. if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
  18081. propName[0] === "-") {
  18082. prop.exp = createSimpleExpression(propName, false, arg.loc);
  18083. }
  18084. }
  18085. }
  18086. }
  18087. }
  18088. };
  18089. function getBaseTransformPreset(prefixIdentifiers) {
  18090. return [
  18091. [
  18092. transformVBindShorthand,
  18093. transformOnce,
  18094. transformIf,
  18095. transformMemo,
  18096. transformFor,
  18097. ...[],
  18098. ...[transformExpression] ,
  18099. transformSlotOutlet,
  18100. transformElement,
  18101. trackSlotScopes,
  18102. transformText
  18103. ],
  18104. {
  18105. on: transformOn$1,
  18106. bind: transformBind,
  18107. model: transformModel$1
  18108. }
  18109. ];
  18110. }
  18111. function baseCompile(source, options = {}) {
  18112. const onError = options.onError || defaultOnError;
  18113. const isModuleMode = options.mode === "module";
  18114. {
  18115. if (options.prefixIdentifiers === true) {
  18116. onError(createCompilerError(48));
  18117. } else if (isModuleMode) {
  18118. onError(createCompilerError(49));
  18119. }
  18120. }
  18121. const prefixIdentifiers = false;
  18122. if (options.cacheHandlers) {
  18123. onError(createCompilerError(50));
  18124. }
  18125. if (options.scopeId && !isModuleMode) {
  18126. onError(createCompilerError(51));
  18127. }
  18128. const resolvedOptions = extend({}, options, {
  18129. prefixIdentifiers
  18130. });
  18131. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  18132. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  18133. transform(
  18134. ast,
  18135. extend({}, resolvedOptions, {
  18136. nodeTransforms: [
  18137. ...nodeTransforms,
  18138. ...options.nodeTransforms || []
  18139. // user transforms
  18140. ],
  18141. directiveTransforms: extend(
  18142. {},
  18143. directiveTransforms,
  18144. options.directiveTransforms || {}
  18145. // user transforms
  18146. )
  18147. })
  18148. );
  18149. return generate(ast, resolvedOptions);
  18150. }
  18151. const noopDirectiveTransform = () => ({ props: [] });
  18152. const V_MODEL_RADIO = /* @__PURE__ */ Symbol(`vModelRadio` );
  18153. const V_MODEL_CHECKBOX = /* @__PURE__ */ Symbol(
  18154. `vModelCheckbox`
  18155. );
  18156. const V_MODEL_TEXT = /* @__PURE__ */ Symbol(`vModelText` );
  18157. const V_MODEL_SELECT = /* @__PURE__ */ Symbol(
  18158. `vModelSelect`
  18159. );
  18160. const V_MODEL_DYNAMIC = /* @__PURE__ */ Symbol(
  18161. `vModelDynamic`
  18162. );
  18163. const V_ON_WITH_MODIFIERS = /* @__PURE__ */ Symbol(
  18164. `vOnModifiersGuard`
  18165. );
  18166. const V_ON_WITH_KEYS = /* @__PURE__ */ Symbol(
  18167. `vOnKeysGuard`
  18168. );
  18169. const V_SHOW = /* @__PURE__ */ Symbol(`vShow` );
  18170. const TRANSITION = /* @__PURE__ */ Symbol(`Transition` );
  18171. const TRANSITION_GROUP = /* @__PURE__ */ Symbol(
  18172. `TransitionGroup`
  18173. );
  18174. registerRuntimeHelpers({
  18175. [V_MODEL_RADIO]: `vModelRadio`,
  18176. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  18177. [V_MODEL_TEXT]: `vModelText`,
  18178. [V_MODEL_SELECT]: `vModelSelect`,
  18179. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  18180. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  18181. [V_ON_WITH_KEYS]: `withKeys`,
  18182. [V_SHOW]: `vShow`,
  18183. [TRANSITION]: `Transition`,
  18184. [TRANSITION_GROUP]: `TransitionGroup`
  18185. });
  18186. let decoder;
  18187. function decodeHtmlBrowser(raw, asAttr = false) {
  18188. if (!decoder) {
  18189. decoder = document.createElement("div");
  18190. }
  18191. if (asAttr) {
  18192. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  18193. return decoder.children[0].getAttribute("foo");
  18194. } else {
  18195. decoder.innerHTML = raw;
  18196. return decoder.textContent;
  18197. }
  18198. }
  18199. const parserOptions = {
  18200. parseMode: "html",
  18201. isVoidTag,
  18202. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  18203. isPreTag: (tag) => tag === "pre",
  18204. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  18205. decodeEntities: decodeHtmlBrowser ,
  18206. isBuiltInComponent: (tag) => {
  18207. if (tag === "Transition" || tag === "transition") {
  18208. return TRANSITION;
  18209. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  18210. return TRANSITION_GROUP;
  18211. }
  18212. },
  18213. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  18214. getNamespace(tag, parent, rootNamespace) {
  18215. let ns = parent ? parent.ns : rootNamespace;
  18216. if (parent && ns === 2) {
  18217. if (parent.tag === "annotation-xml") {
  18218. if (tag === "svg") {
  18219. return 1;
  18220. }
  18221. if (parent.props.some(
  18222. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  18223. )) {
  18224. ns = 0;
  18225. }
  18226. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  18227. ns = 0;
  18228. }
  18229. } else if (parent && ns === 1) {
  18230. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  18231. ns = 0;
  18232. }
  18233. }
  18234. if (ns === 0) {
  18235. if (tag === "svg") {
  18236. return 1;
  18237. }
  18238. if (tag === "math") {
  18239. return 2;
  18240. }
  18241. }
  18242. return ns;
  18243. }
  18244. };
  18245. const transformStyle = (node) => {
  18246. if (node.type === 1) {
  18247. node.props.forEach((p, i) => {
  18248. if (p.type === 6 && p.name === "style" && p.value) {
  18249. node.props[i] = {
  18250. type: 7,
  18251. name: `bind`,
  18252. arg: createSimpleExpression(`style`, true, p.loc),
  18253. exp: parseInlineCSS(p.value.content, p.loc),
  18254. modifiers: [],
  18255. loc: p.loc
  18256. };
  18257. }
  18258. });
  18259. }
  18260. };
  18261. const parseInlineCSS = (cssText, loc) => {
  18262. const normalized = parseStringStyle(cssText);
  18263. return createSimpleExpression(
  18264. JSON.stringify(normalized),
  18265. false,
  18266. loc,
  18267. 3
  18268. );
  18269. };
  18270. function createDOMCompilerError(code, loc) {
  18271. return createCompilerError(
  18272. code,
  18273. loc,
  18274. DOMErrorMessages
  18275. );
  18276. }
  18277. const DOMErrorMessages = {
  18278. [54]: `v-html is missing expression.`,
  18279. [55]: `v-html will override element children.`,
  18280. [56]: `v-text is missing expression.`,
  18281. [57]: `v-text will override element children.`,
  18282. [58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  18283. [59]: `v-model argument is not supported on plain elements.`,
  18284. [60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  18285. [61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  18286. [62]: `v-show is missing expression.`,
  18287. [63]: `<Transition> expects exactly one child element or component.`,
  18288. [64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  18289. };
  18290. const transformVHtml = (dir, node, context) => {
  18291. const { exp, loc } = dir;
  18292. if (!exp) {
  18293. context.onError(
  18294. createDOMCompilerError(54, loc)
  18295. );
  18296. }
  18297. if (node.children.length) {
  18298. context.onError(
  18299. createDOMCompilerError(55, loc)
  18300. );
  18301. node.children.length = 0;
  18302. }
  18303. return {
  18304. props: [
  18305. createObjectProperty(
  18306. createSimpleExpression(`innerHTML`, true, loc),
  18307. exp || createSimpleExpression("", true)
  18308. )
  18309. ]
  18310. };
  18311. };
  18312. const transformVText = (dir, node, context) => {
  18313. const { exp, loc } = dir;
  18314. if (!exp) {
  18315. context.onError(
  18316. createDOMCompilerError(56, loc)
  18317. );
  18318. }
  18319. if (node.children.length) {
  18320. context.onError(
  18321. createDOMCompilerError(57, loc)
  18322. );
  18323. node.children.length = 0;
  18324. }
  18325. return {
  18326. props: [
  18327. createObjectProperty(
  18328. createSimpleExpression(`textContent`, true),
  18329. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  18330. context.helperString(TO_DISPLAY_STRING),
  18331. [exp],
  18332. loc
  18333. ) : createSimpleExpression("", true)
  18334. )
  18335. ]
  18336. };
  18337. };
  18338. const transformModel = (dir, node, context) => {
  18339. const baseResult = transformModel$1(dir, node, context);
  18340. if (!baseResult.props.length || node.tagType === 1) {
  18341. return baseResult;
  18342. }
  18343. if (dir.arg) {
  18344. context.onError(
  18345. createDOMCompilerError(
  18346. 59,
  18347. dir.arg.loc
  18348. )
  18349. );
  18350. }
  18351. function checkDuplicatedValue() {
  18352. const value = findDir(node, "bind");
  18353. if (value && isStaticArgOf(value.arg, "value")) {
  18354. context.onError(
  18355. createDOMCompilerError(
  18356. 61,
  18357. value.loc
  18358. )
  18359. );
  18360. }
  18361. }
  18362. const { tag } = node;
  18363. const isCustomElement = context.isCustomElement(tag);
  18364. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  18365. let directiveToUse = V_MODEL_TEXT;
  18366. let isInvalidType = false;
  18367. if (tag === "input" || isCustomElement) {
  18368. const type = findProp(node, `type`);
  18369. if (type) {
  18370. if (type.type === 7) {
  18371. directiveToUse = V_MODEL_DYNAMIC;
  18372. } else if (type.value) {
  18373. switch (type.value.content) {
  18374. case "radio":
  18375. directiveToUse = V_MODEL_RADIO;
  18376. break;
  18377. case "checkbox":
  18378. directiveToUse = V_MODEL_CHECKBOX;
  18379. break;
  18380. case "file":
  18381. isInvalidType = true;
  18382. context.onError(
  18383. createDOMCompilerError(
  18384. 60,
  18385. dir.loc
  18386. )
  18387. );
  18388. break;
  18389. default:
  18390. checkDuplicatedValue();
  18391. break;
  18392. }
  18393. }
  18394. } else if (hasDynamicKeyVBind(node)) {
  18395. directiveToUse = V_MODEL_DYNAMIC;
  18396. } else {
  18397. checkDuplicatedValue();
  18398. }
  18399. } else if (tag === "select") {
  18400. directiveToUse = V_MODEL_SELECT;
  18401. } else {
  18402. checkDuplicatedValue();
  18403. }
  18404. if (!isInvalidType) {
  18405. baseResult.needRuntime = context.helper(directiveToUse);
  18406. }
  18407. } else {
  18408. context.onError(
  18409. createDOMCompilerError(
  18410. 58,
  18411. dir.loc
  18412. )
  18413. );
  18414. }
  18415. baseResult.props = baseResult.props.filter(
  18416. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  18417. );
  18418. return baseResult;
  18419. };
  18420. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  18421. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  18422. // event propagation management
  18423. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  18424. );
  18425. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  18426. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  18427. const resolveModifiers = (key, modifiers, context, loc) => {
  18428. const keyModifiers = [];
  18429. const nonKeyModifiers = [];
  18430. const eventOptionModifiers = [];
  18431. for (let i = 0; i < modifiers.length; i++) {
  18432. const modifier = modifiers[i].content;
  18433. if (isEventOptionModifier(modifier)) {
  18434. eventOptionModifiers.push(modifier);
  18435. } else {
  18436. if (maybeKeyModifier(modifier)) {
  18437. if (isStaticExp(key)) {
  18438. if (isKeyboardEvent(key.content.toLowerCase())) {
  18439. keyModifiers.push(modifier);
  18440. } else {
  18441. nonKeyModifiers.push(modifier);
  18442. }
  18443. } else {
  18444. keyModifiers.push(modifier);
  18445. nonKeyModifiers.push(modifier);
  18446. }
  18447. } else {
  18448. if (isNonKeyModifier(modifier)) {
  18449. nonKeyModifiers.push(modifier);
  18450. } else {
  18451. keyModifiers.push(modifier);
  18452. }
  18453. }
  18454. }
  18455. }
  18456. return {
  18457. keyModifiers,
  18458. nonKeyModifiers,
  18459. eventOptionModifiers
  18460. };
  18461. };
  18462. const transformClick = (key, event) => {
  18463. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  18464. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  18465. `(`,
  18466. key,
  18467. `) === "onClick" ? "${event}" : (`,
  18468. key,
  18469. `)`
  18470. ]) : key;
  18471. };
  18472. const transformOn = (dir, node, context) => {
  18473. return transformOn$1(dir, node, context, (baseResult) => {
  18474. const { modifiers } = dir;
  18475. if (!modifiers.length) return baseResult;
  18476. let { key, value: handlerExp } = baseResult.props[0];
  18477. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  18478. if (nonKeyModifiers.includes("right")) {
  18479. key = transformClick(key, `onContextmenu`);
  18480. }
  18481. if (nonKeyModifiers.includes("middle")) {
  18482. key = transformClick(key, `onMouseup`);
  18483. }
  18484. if (nonKeyModifiers.length) {
  18485. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  18486. handlerExp,
  18487. JSON.stringify(nonKeyModifiers)
  18488. ]);
  18489. }
  18490. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  18491. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  18492. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  18493. handlerExp,
  18494. JSON.stringify(keyModifiers)
  18495. ]);
  18496. }
  18497. if (eventOptionModifiers.length) {
  18498. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  18499. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  18500. }
  18501. return {
  18502. props: [createObjectProperty(key, handlerExp)]
  18503. };
  18504. });
  18505. };
  18506. const transformShow = (dir, node, context) => {
  18507. const { exp, loc } = dir;
  18508. if (!exp) {
  18509. context.onError(
  18510. createDOMCompilerError(62, loc)
  18511. );
  18512. }
  18513. return {
  18514. props: [],
  18515. needRuntime: context.helper(V_SHOW)
  18516. };
  18517. };
  18518. const transformTransition = (node, context) => {
  18519. if (node.type === 1 && node.tagType === 1) {
  18520. const component = context.isBuiltInComponent(node.tag);
  18521. if (component === TRANSITION) {
  18522. return () => {
  18523. if (!node.children.length) {
  18524. return;
  18525. }
  18526. if (hasMultipleChildren(node)) {
  18527. context.onError(
  18528. createDOMCompilerError(
  18529. 63,
  18530. {
  18531. start: node.children[0].loc.start,
  18532. end: node.children[node.children.length - 1].loc.end,
  18533. source: ""
  18534. }
  18535. )
  18536. );
  18537. }
  18538. const child = node.children[0];
  18539. if (child.type === 1) {
  18540. for (const p of child.props) {
  18541. if (p.type === 7 && p.name === "show") {
  18542. node.props.push({
  18543. type: 6,
  18544. name: "persisted",
  18545. nameLoc: node.loc,
  18546. value: void 0,
  18547. loc: node.loc
  18548. });
  18549. }
  18550. }
  18551. }
  18552. };
  18553. }
  18554. }
  18555. };
  18556. function hasMultipleChildren(node) {
  18557. const children = node.children = node.children.filter(
  18558. (c) => !isCommentOrWhitespace(c)
  18559. );
  18560. const child = children[0];
  18561. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  18562. }
  18563. const ignoreSideEffectTags = (node, context) => {
  18564. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  18565. context.onError(
  18566. createDOMCompilerError(
  18567. 64,
  18568. node.loc
  18569. )
  18570. );
  18571. context.removeNode();
  18572. }
  18573. };
  18574. function isValidHTMLNesting(parent, child) {
  18575. if (parent === "template") {
  18576. return true;
  18577. }
  18578. if (parent in onlyValidChildren) {
  18579. return onlyValidChildren[parent].has(child);
  18580. }
  18581. if (child in onlyValidParents) {
  18582. return onlyValidParents[child].has(parent);
  18583. }
  18584. if (parent in knownInvalidChildren) {
  18585. if (knownInvalidChildren[parent].has(child)) return false;
  18586. }
  18587. if (child in knownInvalidParents) {
  18588. if (knownInvalidParents[child].has(parent)) return false;
  18589. }
  18590. return true;
  18591. }
  18592. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  18593. const emptySet = /* @__PURE__ */ new Set([]);
  18594. const onlyValidChildren = {
  18595. head: /* @__PURE__ */ new Set([
  18596. "base",
  18597. "basefront",
  18598. "bgsound",
  18599. "link",
  18600. "meta",
  18601. "title",
  18602. "noscript",
  18603. "noframes",
  18604. "style",
  18605. "script",
  18606. "template"
  18607. ]),
  18608. optgroup: /* @__PURE__ */ new Set(["option"]),
  18609. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  18610. // table
  18611. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  18612. tr: /* @__PURE__ */ new Set(["td", "th"]),
  18613. colgroup: /* @__PURE__ */ new Set(["col"]),
  18614. tbody: /* @__PURE__ */ new Set(["tr"]),
  18615. thead: /* @__PURE__ */ new Set(["tr"]),
  18616. tfoot: /* @__PURE__ */ new Set(["tr"]),
  18617. // these elements can not have any children elements
  18618. script: emptySet,
  18619. iframe: emptySet,
  18620. option: emptySet,
  18621. textarea: emptySet,
  18622. style: emptySet,
  18623. title: emptySet
  18624. };
  18625. const onlyValidParents = {
  18626. // sections
  18627. html: emptySet,
  18628. body: /* @__PURE__ */ new Set(["html"]),
  18629. head: /* @__PURE__ */ new Set(["html"]),
  18630. // table
  18631. td: /* @__PURE__ */ new Set(["tr"]),
  18632. colgroup: /* @__PURE__ */ new Set(["table"]),
  18633. caption: /* @__PURE__ */ new Set(["table"]),
  18634. tbody: /* @__PURE__ */ new Set(["table"]),
  18635. tfoot: /* @__PURE__ */ new Set(["table"]),
  18636. col: /* @__PURE__ */ new Set(["colgroup"]),
  18637. th: /* @__PURE__ */ new Set(["tr"]),
  18638. thead: /* @__PURE__ */ new Set(["table"]),
  18639. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  18640. // data list
  18641. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  18642. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  18643. // other
  18644. figcaption: /* @__PURE__ */ new Set(["figure"]),
  18645. // li: new Set(["ul", "ol"]),
  18646. summary: /* @__PURE__ */ new Set(["details"]),
  18647. area: /* @__PURE__ */ new Set(["map"])
  18648. };
  18649. const knownInvalidChildren = {
  18650. p: /* @__PURE__ */ new Set([
  18651. "address",
  18652. "article",
  18653. "aside",
  18654. "blockquote",
  18655. "center",
  18656. "details",
  18657. "dialog",
  18658. "dir",
  18659. "div",
  18660. "dl",
  18661. "fieldset",
  18662. "figure",
  18663. "footer",
  18664. "form",
  18665. "h1",
  18666. "h2",
  18667. "h3",
  18668. "h4",
  18669. "h5",
  18670. "h6",
  18671. "header",
  18672. "hgroup",
  18673. "hr",
  18674. "li",
  18675. "main",
  18676. "nav",
  18677. "menu",
  18678. "ol",
  18679. "p",
  18680. "pre",
  18681. "section",
  18682. "table",
  18683. "ul"
  18684. ]),
  18685. svg: /* @__PURE__ */ new Set([
  18686. "b",
  18687. "blockquote",
  18688. "br",
  18689. "code",
  18690. "dd",
  18691. "div",
  18692. "dl",
  18693. "dt",
  18694. "em",
  18695. "embed",
  18696. "h1",
  18697. "h2",
  18698. "h3",
  18699. "h4",
  18700. "h5",
  18701. "h6",
  18702. "hr",
  18703. "i",
  18704. "img",
  18705. "li",
  18706. "menu",
  18707. "meta",
  18708. "ol",
  18709. "p",
  18710. "pre",
  18711. "ruby",
  18712. "s",
  18713. "small",
  18714. "span",
  18715. "strong",
  18716. "sub",
  18717. "sup",
  18718. "table",
  18719. "u",
  18720. "ul",
  18721. "var"
  18722. ])
  18723. };
  18724. const knownInvalidParents = {
  18725. a: /* @__PURE__ */ new Set(["a"]),
  18726. button: /* @__PURE__ */ new Set(["button"]),
  18727. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  18728. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  18729. form: /* @__PURE__ */ new Set(["form"]),
  18730. li: /* @__PURE__ */ new Set(["li"]),
  18731. h1: headings,
  18732. h2: headings,
  18733. h3: headings,
  18734. h4: headings,
  18735. h5: headings,
  18736. h6: headings
  18737. };
  18738. const validateHtmlNesting = (node, context) => {
  18739. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  18740. const error = new SyntaxError(
  18741. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  18742. );
  18743. error.loc = node.loc;
  18744. context.onWarn(error);
  18745. }
  18746. };
  18747. const DOMNodeTransforms = [
  18748. transformStyle,
  18749. ...[transformTransition, validateHtmlNesting]
  18750. ];
  18751. const DOMDirectiveTransforms = {
  18752. cloak: noopDirectiveTransform,
  18753. html: transformVHtml,
  18754. text: transformVText,
  18755. model: transformModel,
  18756. // override compiler-core
  18757. on: transformOn,
  18758. // override compiler-core
  18759. show: transformShow
  18760. };
  18761. function compile(src, options = {}) {
  18762. return baseCompile(
  18763. src,
  18764. extend({}, parserOptions, options, {
  18765. nodeTransforms: [
  18766. // ignore <script> and <tag>
  18767. // this is not put inside DOMNodeTransforms because that list is used
  18768. // by compiler-ssr to generate vnode fallback branches
  18769. ignoreSideEffectTags,
  18770. ...DOMNodeTransforms,
  18771. ...options.nodeTransforms || []
  18772. ],
  18773. directiveTransforms: extend(
  18774. {},
  18775. DOMDirectiveTransforms,
  18776. options.directiveTransforms || {}
  18777. ),
  18778. transformHoist: null
  18779. })
  18780. );
  18781. }
  18782. {
  18783. initDev();
  18784. }
  18785. const compileCache = /* @__PURE__ */ Object.create(null);
  18786. function compileToFunction(template, options) {
  18787. if (!isString(template)) {
  18788. if (template.nodeType) {
  18789. template = template.innerHTML;
  18790. } else {
  18791. warn(`invalid template option: `, template);
  18792. return NOOP;
  18793. }
  18794. }
  18795. const key = genCacheKey(template, options);
  18796. const cached = compileCache[key];
  18797. if (cached) {
  18798. return cached;
  18799. }
  18800. if (template[0] === "#") {
  18801. const el = document.querySelector(template);
  18802. if (!el) {
  18803. warn(`Template element not found or is empty: ${template}`);
  18804. }
  18805. template = el ? el.innerHTML : ``;
  18806. }
  18807. const opts = extend(
  18808. {
  18809. hoistStatic: true,
  18810. onError: onError ,
  18811. onWarn: (e) => onError(e, true)
  18812. },
  18813. options
  18814. );
  18815. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  18816. opts.isCustomElement = (tag) => !!customElements.get(tag);
  18817. }
  18818. const { code } = compile(template, opts);
  18819. function onError(err, asWarning = false) {
  18820. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  18821. const codeFrame = err.loc && generateCodeFrame(
  18822. template,
  18823. err.loc.start.offset,
  18824. err.loc.end.offset
  18825. );
  18826. warn(codeFrame ? `${message}
  18827. ${codeFrame}` : message);
  18828. }
  18829. const render = new Function("Vue", code)(runtimeDom);
  18830. render._rc = true;
  18831. return compileCache[key] = render;
  18832. }
  18833. registerRuntimeCompiler(compileToFunction);
  18834. export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, nodeOps, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };