Node-Red configuration
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

vue.global.js 513KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759
  1. /**
  2. * vue v3.4.38
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. var Vue = (function (exports) {
  7. 'use strict';
  8. /*! #__NO_SIDE_EFFECTS__ */
  9. // @__NO_SIDE_EFFECTS__
  10. function makeMap(str, expectsLowerCase) {
  11. const set = new Set(str.split(","));
  12. return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
  13. }
  14. const EMPTY_OBJ = Object.freeze({}) ;
  15. const EMPTY_ARR = Object.freeze([]) ;
  16. const NOOP = () => {
  17. };
  18. const NO = () => false;
  19. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  20. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  21. const isModelListener = (key) => key.startsWith("onUpdate:");
  22. const extend = Object.assign;
  23. const remove = (arr, el) => {
  24. const i = arr.indexOf(el);
  25. if (i > -1) {
  26. arr.splice(i, 1);
  27. }
  28. };
  29. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  30. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  31. const isArray = Array.isArray;
  32. const isMap = (val) => toTypeString(val) === "[object Map]";
  33. const isSet = (val) => toTypeString(val) === "[object Set]";
  34. const isDate = (val) => toTypeString(val) === "[object Date]";
  35. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  36. const isFunction = (val) => typeof val === "function";
  37. const isString = (val) => typeof val === "string";
  38. const isSymbol = (val) => typeof val === "symbol";
  39. const isObject = (val) => val !== null && typeof val === "object";
  40. const isPromise = (val) => {
  41. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  42. };
  43. const objectToString = Object.prototype.toString;
  44. const toTypeString = (value) => objectToString.call(value);
  45. const toRawType = (value) => {
  46. return toTypeString(value).slice(8, -1);
  47. };
  48. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  49. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  50. const isReservedProp = /* @__PURE__ */ makeMap(
  51. // the leading comma is intentional so empty string "" is also included
  52. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  53. );
  54. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  55. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  56. );
  57. const cacheStringFunction = (fn) => {
  58. const cache = /* @__PURE__ */ Object.create(null);
  59. return (str) => {
  60. const hit = cache[str];
  61. return hit || (cache[str] = fn(str));
  62. };
  63. };
  64. const camelizeRE = /-(\w)/g;
  65. const camelize = cacheStringFunction((str) => {
  66. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  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((str) => {
  76. const s = str ? `on${capitalize(str)}` : ``;
  77. return s;
  78. });
  79. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  80. const invokeArrayFns = (fns, ...arg) => {
  81. for (let i = 0; i < fns.length; i++) {
  82. fns[i](...arg);
  83. }
  84. };
  85. const def = (obj, key, value, writable = false) => {
  86. Object.defineProperty(obj, key, {
  87. configurable: true,
  88. enumerable: false,
  89. writable,
  90. value
  91. });
  92. };
  93. const looseToNumber = (val) => {
  94. const n = parseFloat(val);
  95. return isNaN(n) ? val : n;
  96. };
  97. const toNumber = (val) => {
  98. const n = isString(val) ? Number(val) : NaN;
  99. return isNaN(n) ? val : n;
  100. };
  101. let _globalThis;
  102. const getGlobalThis = () => {
  103. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  104. };
  105. const PatchFlagNames = {
  106. [1]: `TEXT`,
  107. [2]: `CLASS`,
  108. [4]: `STYLE`,
  109. [8]: `PROPS`,
  110. [16]: `FULL_PROPS`,
  111. [32]: `NEED_HYDRATION`,
  112. [64]: `STABLE_FRAGMENT`,
  113. [128]: `KEYED_FRAGMENT`,
  114. [256]: `UNKEYED_FRAGMENT`,
  115. [512]: `NEED_PATCH`,
  116. [1024]: `DYNAMIC_SLOTS`,
  117. [2048]: `DEV_ROOT_FRAGMENT`,
  118. [-1]: `HOISTED`,
  119. [-2]: `BAIL`
  120. };
  121. const slotFlagsText = {
  122. [1]: "STABLE",
  123. [2]: "DYNAMIC",
  124. [3]: "FORWARDED"
  125. };
  126. 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";
  127. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  128. const range = 2;
  129. function generateCodeFrame(source, start = 0, end = source.length) {
  130. start = Math.max(0, Math.min(start, source.length));
  131. end = Math.max(0, Math.min(end, source.length));
  132. if (start > end) return "";
  133. let lines = source.split(/(\r?\n)/);
  134. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  135. lines = lines.filter((_, idx) => idx % 2 === 0);
  136. let count = 0;
  137. const res = [];
  138. for (let i = 0; i < lines.length; i++) {
  139. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  140. if (count >= start) {
  141. for (let j = i - range; j <= i + range || end > count; j++) {
  142. if (j < 0 || j >= lines.length) continue;
  143. const line = j + 1;
  144. res.push(
  145. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  146. );
  147. const lineLength = lines[j].length;
  148. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  149. if (j === i) {
  150. const pad = start - (count - (lineLength + newLineSeqLength));
  151. const length = Math.max(
  152. 1,
  153. end > count ? lineLength - pad : end - start
  154. );
  155. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  156. } else if (j > i) {
  157. if (end > count) {
  158. const length = Math.max(Math.min(end - count, lineLength), 1);
  159. res.push(` | ` + "^".repeat(length));
  160. }
  161. count += lineLength + newLineSeqLength;
  162. }
  163. }
  164. break;
  165. }
  166. }
  167. return res.join("\n");
  168. }
  169. function normalizeStyle(value) {
  170. if (isArray(value)) {
  171. const res = {};
  172. for (let i = 0; i < value.length; i++) {
  173. const item = value[i];
  174. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  175. if (normalized) {
  176. for (const key in normalized) {
  177. res[key] = normalized[key];
  178. }
  179. }
  180. }
  181. return res;
  182. } else if (isString(value) || isObject(value)) {
  183. return value;
  184. }
  185. }
  186. const listDelimiterRE = /;(?![^(]*\))/g;
  187. const propertyDelimiterRE = /:([^]+)/;
  188. const styleCommentRE = /\/\*[^]*?\*\//g;
  189. function parseStringStyle(cssText) {
  190. const ret = {};
  191. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  192. if (item) {
  193. const tmp = item.split(propertyDelimiterRE);
  194. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  195. }
  196. });
  197. return ret;
  198. }
  199. function stringifyStyle(styles) {
  200. let ret = "";
  201. if (!styles || isString(styles)) {
  202. return ret;
  203. }
  204. for (const key in styles) {
  205. const value = styles[key];
  206. if (isString(value) || typeof value === "number") {
  207. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  208. ret += `${normalizedKey}:${value};`;
  209. }
  210. }
  211. return ret;
  212. }
  213. function normalizeClass(value) {
  214. let res = "";
  215. if (isString(value)) {
  216. res = value;
  217. } else if (isArray(value)) {
  218. for (let i = 0; i < value.length; i++) {
  219. const normalized = normalizeClass(value[i]);
  220. if (normalized) {
  221. res += normalized + " ";
  222. }
  223. }
  224. } else if (isObject(value)) {
  225. for (const name in value) {
  226. if (value[name]) {
  227. res += name + " ";
  228. }
  229. }
  230. }
  231. return res.trim();
  232. }
  233. function normalizeProps(props) {
  234. if (!props) return null;
  235. let { class: klass, style } = props;
  236. if (klass && !isString(klass)) {
  237. props.class = normalizeClass(klass);
  238. }
  239. if (style) {
  240. props.style = normalizeStyle(style);
  241. }
  242. return props;
  243. }
  244. 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";
  245. 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";
  246. 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";
  247. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  248. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  249. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  250. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  251. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  252. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  253. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  254. const isBooleanAttr = /* @__PURE__ */ makeMap(
  255. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  256. );
  257. function includeBooleanAttr(value) {
  258. return !!value || value === "";
  259. }
  260. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  261. `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`
  262. );
  263. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  264. `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`
  265. );
  266. function isRenderableAttrValue(value) {
  267. if (value == null) {
  268. return false;
  269. }
  270. const type = typeof value;
  271. return type === "string" || type === "number" || type === "boolean";
  272. }
  273. function looseCompareArrays(a, b) {
  274. if (a.length !== b.length) return false;
  275. let equal = true;
  276. for (let i = 0; equal && i < a.length; i++) {
  277. equal = looseEqual(a[i], b[i]);
  278. }
  279. return equal;
  280. }
  281. function looseEqual(a, b) {
  282. if (a === b) return true;
  283. let aValidType = isDate(a);
  284. let bValidType = isDate(b);
  285. if (aValidType || bValidType) {
  286. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  287. }
  288. aValidType = isSymbol(a);
  289. bValidType = isSymbol(b);
  290. if (aValidType || bValidType) {
  291. return a === b;
  292. }
  293. aValidType = isArray(a);
  294. bValidType = isArray(b);
  295. if (aValidType || bValidType) {
  296. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  297. }
  298. aValidType = isObject(a);
  299. bValidType = isObject(b);
  300. if (aValidType || bValidType) {
  301. if (!aValidType || !bValidType) {
  302. return false;
  303. }
  304. const aKeysCount = Object.keys(a).length;
  305. const bKeysCount = Object.keys(b).length;
  306. if (aKeysCount !== bKeysCount) {
  307. return false;
  308. }
  309. for (const key in a) {
  310. const aHasKey = a.hasOwnProperty(key);
  311. const bHasKey = b.hasOwnProperty(key);
  312. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  313. return false;
  314. }
  315. }
  316. }
  317. return String(a) === String(b);
  318. }
  319. function looseIndexOf(arr, val) {
  320. return arr.findIndex((item) => looseEqual(item, val));
  321. }
  322. const isRef$1 = (val) => {
  323. return !!(val && val.__v_isRef === true);
  324. };
  325. const toDisplayString = (val) => {
  326. 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);
  327. };
  328. const replacer = (_key, val) => {
  329. if (isRef$1(val)) {
  330. return replacer(_key, val.value);
  331. } else if (isMap(val)) {
  332. return {
  333. [`Map(${val.size})`]: [...val.entries()].reduce(
  334. (entries, [key, val2], i) => {
  335. entries[stringifySymbol(key, i) + " =>"] = val2;
  336. return entries;
  337. },
  338. {}
  339. )
  340. };
  341. } else if (isSet(val)) {
  342. return {
  343. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  344. };
  345. } else if (isSymbol(val)) {
  346. return stringifySymbol(val);
  347. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  348. return String(val);
  349. }
  350. return val;
  351. };
  352. const stringifySymbol = (v, i = "") => {
  353. var _a;
  354. return (
  355. // Symbol.description in es2019+ so we need to cast here to pass
  356. // the lib: es2016 check
  357. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  358. );
  359. };
  360. function warn$2(msg, ...args) {
  361. console.warn(`[Vue warn] ${msg}`, ...args);
  362. }
  363. let activeEffectScope;
  364. class EffectScope {
  365. constructor(detached = false) {
  366. this.detached = detached;
  367. /**
  368. * @internal
  369. */
  370. this._active = true;
  371. /**
  372. * @internal
  373. */
  374. this.effects = [];
  375. /**
  376. * @internal
  377. */
  378. this.cleanups = [];
  379. this.parent = activeEffectScope;
  380. if (!detached && activeEffectScope) {
  381. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  382. this
  383. ) - 1;
  384. }
  385. }
  386. get active() {
  387. return this._active;
  388. }
  389. run(fn) {
  390. if (this._active) {
  391. const currentEffectScope = activeEffectScope;
  392. try {
  393. activeEffectScope = this;
  394. return fn();
  395. } finally {
  396. activeEffectScope = currentEffectScope;
  397. }
  398. } else {
  399. warn$2(`cannot run an inactive effect scope.`);
  400. }
  401. }
  402. /**
  403. * This should only be called on non-detached scopes
  404. * @internal
  405. */
  406. on() {
  407. activeEffectScope = this;
  408. }
  409. /**
  410. * This should only be called on non-detached scopes
  411. * @internal
  412. */
  413. off() {
  414. activeEffectScope = this.parent;
  415. }
  416. stop(fromParent) {
  417. if (this._active) {
  418. let i, l;
  419. for (i = 0, l = this.effects.length; i < l; i++) {
  420. this.effects[i].stop();
  421. }
  422. for (i = 0, l = this.cleanups.length; i < l; i++) {
  423. this.cleanups[i]();
  424. }
  425. if (this.scopes) {
  426. for (i = 0, l = this.scopes.length; i < l; i++) {
  427. this.scopes[i].stop(true);
  428. }
  429. }
  430. if (!this.detached && this.parent && !fromParent) {
  431. const last = this.parent.scopes.pop();
  432. if (last && last !== this) {
  433. this.parent.scopes[this.index] = last;
  434. last.index = this.index;
  435. }
  436. }
  437. this.parent = void 0;
  438. this._active = false;
  439. }
  440. }
  441. }
  442. function effectScope(detached) {
  443. return new EffectScope(detached);
  444. }
  445. function recordEffectScope(effect, scope = activeEffectScope) {
  446. if (scope && scope.active) {
  447. scope.effects.push(effect);
  448. }
  449. }
  450. function getCurrentScope() {
  451. return activeEffectScope;
  452. }
  453. function onScopeDispose(fn) {
  454. if (activeEffectScope) {
  455. activeEffectScope.cleanups.push(fn);
  456. } else {
  457. warn$2(
  458. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  459. );
  460. }
  461. }
  462. let activeEffect;
  463. class ReactiveEffect {
  464. constructor(fn, trigger, scheduler, scope) {
  465. this.fn = fn;
  466. this.trigger = trigger;
  467. this.scheduler = scheduler;
  468. this.active = true;
  469. this.deps = [];
  470. /**
  471. * @internal
  472. */
  473. this._dirtyLevel = 4;
  474. /**
  475. * @internal
  476. */
  477. this._trackId = 0;
  478. /**
  479. * @internal
  480. */
  481. this._runnings = 0;
  482. /**
  483. * @internal
  484. */
  485. this._shouldSchedule = false;
  486. /**
  487. * @internal
  488. */
  489. this._depsLength = 0;
  490. recordEffectScope(this, scope);
  491. }
  492. get dirty() {
  493. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  494. this._dirtyLevel = 1;
  495. pauseTracking();
  496. for (let i = 0; i < this._depsLength; i++) {
  497. const dep = this.deps[i];
  498. if (dep.computed) {
  499. triggerComputed(dep.computed);
  500. if (this._dirtyLevel >= 4) {
  501. break;
  502. }
  503. }
  504. }
  505. if (this._dirtyLevel === 1) {
  506. this._dirtyLevel = 0;
  507. }
  508. resetTracking();
  509. }
  510. return this._dirtyLevel >= 4;
  511. }
  512. set dirty(v) {
  513. this._dirtyLevel = v ? 4 : 0;
  514. }
  515. run() {
  516. this._dirtyLevel = 0;
  517. if (!this.active) {
  518. return this.fn();
  519. }
  520. let lastShouldTrack = shouldTrack;
  521. let lastEffect = activeEffect;
  522. try {
  523. shouldTrack = true;
  524. activeEffect = this;
  525. this._runnings++;
  526. preCleanupEffect(this);
  527. return this.fn();
  528. } finally {
  529. postCleanupEffect(this);
  530. this._runnings--;
  531. activeEffect = lastEffect;
  532. shouldTrack = lastShouldTrack;
  533. }
  534. }
  535. stop() {
  536. if (this.active) {
  537. preCleanupEffect(this);
  538. postCleanupEffect(this);
  539. this.onStop && this.onStop();
  540. this.active = false;
  541. }
  542. }
  543. }
  544. function triggerComputed(computed) {
  545. return computed.value;
  546. }
  547. function preCleanupEffect(effect2) {
  548. effect2._trackId++;
  549. effect2._depsLength = 0;
  550. }
  551. function postCleanupEffect(effect2) {
  552. if (effect2.deps.length > effect2._depsLength) {
  553. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  554. cleanupDepEffect(effect2.deps[i], effect2);
  555. }
  556. effect2.deps.length = effect2._depsLength;
  557. }
  558. }
  559. function cleanupDepEffect(dep, effect2) {
  560. const trackId = dep.get(effect2);
  561. if (trackId !== void 0 && effect2._trackId !== trackId) {
  562. dep.delete(effect2);
  563. if (dep.size === 0) {
  564. dep.cleanup();
  565. }
  566. }
  567. }
  568. function effect(fn, options) {
  569. if (fn.effect instanceof ReactiveEffect) {
  570. fn = fn.effect.fn;
  571. }
  572. const _effect = new ReactiveEffect(fn, NOOP, () => {
  573. if (_effect.dirty) {
  574. _effect.run();
  575. }
  576. });
  577. if (options) {
  578. extend(_effect, options);
  579. if (options.scope) recordEffectScope(_effect, options.scope);
  580. }
  581. if (!options || !options.lazy) {
  582. _effect.run();
  583. }
  584. const runner = _effect.run.bind(_effect);
  585. runner.effect = _effect;
  586. return runner;
  587. }
  588. function stop(runner) {
  589. runner.effect.stop();
  590. }
  591. let shouldTrack = true;
  592. let pauseScheduleStack = 0;
  593. const trackStack = [];
  594. function pauseTracking() {
  595. trackStack.push(shouldTrack);
  596. shouldTrack = false;
  597. }
  598. function resetTracking() {
  599. const last = trackStack.pop();
  600. shouldTrack = last === void 0 ? true : last;
  601. }
  602. function pauseScheduling() {
  603. pauseScheduleStack++;
  604. }
  605. function resetScheduling() {
  606. pauseScheduleStack--;
  607. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  608. queueEffectSchedulers.shift()();
  609. }
  610. }
  611. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  612. var _a;
  613. if (dep.get(effect2) !== effect2._trackId) {
  614. dep.set(effect2, effect2._trackId);
  615. const oldDep = effect2.deps[effect2._depsLength];
  616. if (oldDep !== dep) {
  617. if (oldDep) {
  618. cleanupDepEffect(oldDep, effect2);
  619. }
  620. effect2.deps[effect2._depsLength++] = dep;
  621. } else {
  622. effect2._depsLength++;
  623. }
  624. {
  625. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  626. }
  627. }
  628. }
  629. const queueEffectSchedulers = [];
  630. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  631. var _a;
  632. pauseScheduling();
  633. for (const effect2 of dep.keys()) {
  634. let tracking;
  635. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  636. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  637. effect2._dirtyLevel = dirtyLevel;
  638. }
  639. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  640. {
  641. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  642. }
  643. effect2.trigger();
  644. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  645. effect2._shouldSchedule = false;
  646. if (effect2.scheduler) {
  647. queueEffectSchedulers.push(effect2.scheduler);
  648. }
  649. }
  650. }
  651. }
  652. resetScheduling();
  653. }
  654. const createDep = (cleanup, computed) => {
  655. const dep = /* @__PURE__ */ new Map();
  656. dep.cleanup = cleanup;
  657. dep.computed = computed;
  658. return dep;
  659. };
  660. const targetMap = /* @__PURE__ */ new WeakMap();
  661. const ITERATE_KEY = Symbol("iterate" );
  662. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  663. function track(target, type, key) {
  664. if (shouldTrack && activeEffect) {
  665. let depsMap = targetMap.get(target);
  666. if (!depsMap) {
  667. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  668. }
  669. let dep = depsMap.get(key);
  670. if (!dep) {
  671. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  672. }
  673. trackEffect(
  674. activeEffect,
  675. dep,
  676. {
  677. target,
  678. type,
  679. key
  680. }
  681. );
  682. }
  683. }
  684. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  685. const depsMap = targetMap.get(target);
  686. if (!depsMap) {
  687. return;
  688. }
  689. let deps = [];
  690. if (type === "clear") {
  691. deps = [...depsMap.values()];
  692. } else if (key === "length" && isArray(target)) {
  693. const newLength = Number(newValue);
  694. depsMap.forEach((dep, key2) => {
  695. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  696. deps.push(dep);
  697. }
  698. });
  699. } else {
  700. if (key !== void 0) {
  701. deps.push(depsMap.get(key));
  702. }
  703. switch (type) {
  704. case "add":
  705. if (!isArray(target)) {
  706. deps.push(depsMap.get(ITERATE_KEY));
  707. if (isMap(target)) {
  708. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  709. }
  710. } else if (isIntegerKey(key)) {
  711. deps.push(depsMap.get("length"));
  712. }
  713. break;
  714. case "delete":
  715. if (!isArray(target)) {
  716. deps.push(depsMap.get(ITERATE_KEY));
  717. if (isMap(target)) {
  718. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  719. }
  720. }
  721. break;
  722. case "set":
  723. if (isMap(target)) {
  724. deps.push(depsMap.get(ITERATE_KEY));
  725. }
  726. break;
  727. }
  728. }
  729. pauseScheduling();
  730. for (const dep of deps) {
  731. if (dep) {
  732. triggerEffects(
  733. dep,
  734. 4,
  735. {
  736. target,
  737. type,
  738. key,
  739. newValue,
  740. oldValue,
  741. oldTarget
  742. }
  743. );
  744. }
  745. }
  746. resetScheduling();
  747. }
  748. function getDepFromReactive(object, key) {
  749. const depsMap = targetMap.get(object);
  750. return depsMap && depsMap.get(key);
  751. }
  752. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  753. const builtInSymbols = new Set(
  754. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  755. );
  756. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  757. function createArrayInstrumentations() {
  758. const instrumentations = {};
  759. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  760. instrumentations[key] = function(...args) {
  761. const arr = toRaw(this);
  762. for (let i = 0, l = this.length; i < l; i++) {
  763. track(arr, "get", i + "");
  764. }
  765. const res = arr[key](...args);
  766. if (res === -1 || res === false) {
  767. return arr[key](...args.map(toRaw));
  768. } else {
  769. return res;
  770. }
  771. };
  772. });
  773. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  774. instrumentations[key] = function(...args) {
  775. pauseTracking();
  776. pauseScheduling();
  777. const res = toRaw(this)[key].apply(this, args);
  778. resetScheduling();
  779. resetTracking();
  780. return res;
  781. };
  782. });
  783. return instrumentations;
  784. }
  785. function hasOwnProperty(key) {
  786. if (!isSymbol(key)) key = String(key);
  787. const obj = toRaw(this);
  788. track(obj, "has", key);
  789. return obj.hasOwnProperty(key);
  790. }
  791. class BaseReactiveHandler {
  792. constructor(_isReadonly = false, _isShallow = false) {
  793. this._isReadonly = _isReadonly;
  794. this._isShallow = _isShallow;
  795. }
  796. get(target, key, receiver) {
  797. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  798. if (key === "__v_isReactive") {
  799. return !isReadonly2;
  800. } else if (key === "__v_isReadonly") {
  801. return isReadonly2;
  802. } else if (key === "__v_isShallow") {
  803. return isShallow2;
  804. } else if (key === "__v_raw") {
  805. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  806. // this means the receiver is a user proxy of the reactive proxy
  807. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  808. return target;
  809. }
  810. return;
  811. }
  812. const targetIsArray = isArray(target);
  813. if (!isReadonly2) {
  814. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  815. return Reflect.get(arrayInstrumentations, key, receiver);
  816. }
  817. if (key === "hasOwnProperty") {
  818. return hasOwnProperty;
  819. }
  820. }
  821. const res = Reflect.get(target, key, receiver);
  822. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  823. return res;
  824. }
  825. if (!isReadonly2) {
  826. track(target, "get", key);
  827. }
  828. if (isShallow2) {
  829. return res;
  830. }
  831. if (isRef(res)) {
  832. return targetIsArray && isIntegerKey(key) ? res : res.value;
  833. }
  834. if (isObject(res)) {
  835. return isReadonly2 ? readonly(res) : reactive(res);
  836. }
  837. return res;
  838. }
  839. }
  840. class MutableReactiveHandler extends BaseReactiveHandler {
  841. constructor(isShallow2 = false) {
  842. super(false, isShallow2);
  843. }
  844. set(target, key, value, receiver) {
  845. let oldValue = target[key];
  846. if (!this._isShallow) {
  847. const isOldValueReadonly = isReadonly(oldValue);
  848. if (!isShallow(value) && !isReadonly(value)) {
  849. oldValue = toRaw(oldValue);
  850. value = toRaw(value);
  851. }
  852. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  853. if (isOldValueReadonly) {
  854. return false;
  855. } else {
  856. oldValue.value = value;
  857. return true;
  858. }
  859. }
  860. }
  861. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  862. const result = Reflect.set(target, key, value, receiver);
  863. if (target === toRaw(receiver)) {
  864. if (!hadKey) {
  865. trigger(target, "add", key, value);
  866. } else if (hasChanged(value, oldValue)) {
  867. trigger(target, "set", key, value, oldValue);
  868. }
  869. }
  870. return result;
  871. }
  872. deleteProperty(target, key) {
  873. const hadKey = hasOwn(target, key);
  874. const oldValue = target[key];
  875. const result = Reflect.deleteProperty(target, key);
  876. if (result && hadKey) {
  877. trigger(target, "delete", key, void 0, oldValue);
  878. }
  879. return result;
  880. }
  881. has(target, key) {
  882. const result = Reflect.has(target, key);
  883. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  884. track(target, "has", key);
  885. }
  886. return result;
  887. }
  888. ownKeys(target) {
  889. track(
  890. target,
  891. "iterate",
  892. isArray(target) ? "length" : ITERATE_KEY
  893. );
  894. return Reflect.ownKeys(target);
  895. }
  896. }
  897. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  898. constructor(isShallow2 = false) {
  899. super(true, isShallow2);
  900. }
  901. set(target, key) {
  902. {
  903. warn$2(
  904. `Set operation on key "${String(key)}" failed: target is readonly.`,
  905. target
  906. );
  907. }
  908. return true;
  909. }
  910. deleteProperty(target, key) {
  911. {
  912. warn$2(
  913. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  914. target
  915. );
  916. }
  917. return true;
  918. }
  919. }
  920. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  921. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  922. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  923. true
  924. );
  925. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  926. const toShallow = (value) => value;
  927. const getProto = (v) => Reflect.getPrototypeOf(v);
  928. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  929. target = target["__v_raw"];
  930. const rawTarget = toRaw(target);
  931. const rawKey = toRaw(key);
  932. if (!isReadonly2) {
  933. if (hasChanged(key, rawKey)) {
  934. track(rawTarget, "get", key);
  935. }
  936. track(rawTarget, "get", rawKey);
  937. }
  938. const { has: has2 } = getProto(rawTarget);
  939. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  940. if (has2.call(rawTarget, key)) {
  941. return wrap(target.get(key));
  942. } else if (has2.call(rawTarget, rawKey)) {
  943. return wrap(target.get(rawKey));
  944. } else if (target !== rawTarget) {
  945. target.get(key);
  946. }
  947. }
  948. function has(key, isReadonly2 = false) {
  949. const target = this["__v_raw"];
  950. const rawTarget = toRaw(target);
  951. const rawKey = toRaw(key);
  952. if (!isReadonly2) {
  953. if (hasChanged(key, rawKey)) {
  954. track(rawTarget, "has", key);
  955. }
  956. track(rawTarget, "has", rawKey);
  957. }
  958. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  959. }
  960. function size(target, isReadonly2 = false) {
  961. target = target["__v_raw"];
  962. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  963. return Reflect.get(target, "size", target);
  964. }
  965. function add(value, _isShallow = false) {
  966. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  967. value = toRaw(value);
  968. }
  969. const target = toRaw(this);
  970. const proto = getProto(target);
  971. const hadKey = proto.has.call(target, value);
  972. if (!hadKey) {
  973. target.add(value);
  974. trigger(target, "add", value, value);
  975. }
  976. return this;
  977. }
  978. function set(key, value, _isShallow = false) {
  979. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  980. value = toRaw(value);
  981. }
  982. const target = toRaw(this);
  983. const { has: has2, get: get2 } = getProto(target);
  984. let hadKey = has2.call(target, key);
  985. if (!hadKey) {
  986. key = toRaw(key);
  987. hadKey = has2.call(target, key);
  988. } else {
  989. checkIdentityKeys(target, has2, key);
  990. }
  991. const oldValue = get2.call(target, key);
  992. target.set(key, value);
  993. if (!hadKey) {
  994. trigger(target, "add", key, value);
  995. } else if (hasChanged(value, oldValue)) {
  996. trigger(target, "set", key, value, oldValue);
  997. }
  998. return this;
  999. }
  1000. function deleteEntry(key) {
  1001. const target = toRaw(this);
  1002. const { has: has2, get: get2 } = getProto(target);
  1003. let hadKey = has2.call(target, key);
  1004. if (!hadKey) {
  1005. key = toRaw(key);
  1006. hadKey = has2.call(target, key);
  1007. } else {
  1008. checkIdentityKeys(target, has2, key);
  1009. }
  1010. const oldValue = get2 ? get2.call(target, key) : void 0;
  1011. const result = target.delete(key);
  1012. if (hadKey) {
  1013. trigger(target, "delete", key, void 0, oldValue);
  1014. }
  1015. return result;
  1016. }
  1017. function clear() {
  1018. const target = toRaw(this);
  1019. const hadItems = target.size !== 0;
  1020. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1021. const result = target.clear();
  1022. if (hadItems) {
  1023. trigger(target, "clear", void 0, void 0, oldTarget);
  1024. }
  1025. return result;
  1026. }
  1027. function createForEach(isReadonly2, isShallow2) {
  1028. return function forEach(callback, thisArg) {
  1029. const observed = this;
  1030. const target = observed["__v_raw"];
  1031. const rawTarget = toRaw(target);
  1032. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1033. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  1034. return target.forEach((value, key) => {
  1035. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1036. });
  1037. };
  1038. }
  1039. function createIterableMethod(method, isReadonly2, isShallow2) {
  1040. return function(...args) {
  1041. const target = this["__v_raw"];
  1042. const rawTarget = toRaw(target);
  1043. const targetIsMap = isMap(rawTarget);
  1044. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1045. const isKeyOnly = method === "keys" && targetIsMap;
  1046. const innerIterator = target[method](...args);
  1047. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1048. !isReadonly2 && track(
  1049. rawTarget,
  1050. "iterate",
  1051. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1052. );
  1053. return {
  1054. // iterator protocol
  1055. next() {
  1056. const { value, done } = innerIterator.next();
  1057. return done ? { value, done } : {
  1058. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1059. done
  1060. };
  1061. },
  1062. // iterable protocol
  1063. [Symbol.iterator]() {
  1064. return this;
  1065. }
  1066. };
  1067. };
  1068. }
  1069. function createReadonlyMethod(type) {
  1070. return function(...args) {
  1071. {
  1072. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1073. warn$2(
  1074. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1075. toRaw(this)
  1076. );
  1077. }
  1078. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1079. };
  1080. }
  1081. function createInstrumentations() {
  1082. const mutableInstrumentations2 = {
  1083. get(key) {
  1084. return get(this, key);
  1085. },
  1086. get size() {
  1087. return size(this);
  1088. },
  1089. has,
  1090. add,
  1091. set,
  1092. delete: deleteEntry,
  1093. clear,
  1094. forEach: createForEach(false, false)
  1095. };
  1096. const shallowInstrumentations2 = {
  1097. get(key) {
  1098. return get(this, key, false, true);
  1099. },
  1100. get size() {
  1101. return size(this);
  1102. },
  1103. has,
  1104. add(value) {
  1105. return add.call(this, value, true);
  1106. },
  1107. set(key, value) {
  1108. return set.call(this, key, value, true);
  1109. },
  1110. delete: deleteEntry,
  1111. clear,
  1112. forEach: createForEach(false, true)
  1113. };
  1114. const readonlyInstrumentations2 = {
  1115. get(key) {
  1116. return get(this, key, true);
  1117. },
  1118. get size() {
  1119. return size(this, true);
  1120. },
  1121. has(key) {
  1122. return has.call(this, key, true);
  1123. },
  1124. add: createReadonlyMethod("add"),
  1125. set: createReadonlyMethod("set"),
  1126. delete: createReadonlyMethod("delete"),
  1127. clear: createReadonlyMethod("clear"),
  1128. forEach: createForEach(true, false)
  1129. };
  1130. const shallowReadonlyInstrumentations2 = {
  1131. get(key) {
  1132. return get(this, key, true, true);
  1133. },
  1134. get size() {
  1135. return size(this, true);
  1136. },
  1137. has(key) {
  1138. return has.call(this, key, true);
  1139. },
  1140. add: createReadonlyMethod("add"),
  1141. set: createReadonlyMethod("set"),
  1142. delete: createReadonlyMethod("delete"),
  1143. clear: createReadonlyMethod("clear"),
  1144. forEach: createForEach(true, true)
  1145. };
  1146. const iteratorMethods = [
  1147. "keys",
  1148. "values",
  1149. "entries",
  1150. Symbol.iterator
  1151. ];
  1152. iteratorMethods.forEach((method) => {
  1153. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1154. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1155. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1156. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1157. method,
  1158. true,
  1159. true
  1160. );
  1161. });
  1162. return [
  1163. mutableInstrumentations2,
  1164. readonlyInstrumentations2,
  1165. shallowInstrumentations2,
  1166. shallowReadonlyInstrumentations2
  1167. ];
  1168. }
  1169. const [
  1170. mutableInstrumentations,
  1171. readonlyInstrumentations,
  1172. shallowInstrumentations,
  1173. shallowReadonlyInstrumentations
  1174. ] = /* @__PURE__ */ createInstrumentations();
  1175. function createInstrumentationGetter(isReadonly2, shallow) {
  1176. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1177. return (target, key, receiver) => {
  1178. if (key === "__v_isReactive") {
  1179. return !isReadonly2;
  1180. } else if (key === "__v_isReadonly") {
  1181. return isReadonly2;
  1182. } else if (key === "__v_raw") {
  1183. return target;
  1184. }
  1185. return Reflect.get(
  1186. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1187. key,
  1188. receiver
  1189. );
  1190. };
  1191. }
  1192. const mutableCollectionHandlers = {
  1193. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1194. };
  1195. const shallowCollectionHandlers = {
  1196. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1197. };
  1198. const readonlyCollectionHandlers = {
  1199. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1200. };
  1201. const shallowReadonlyCollectionHandlers = {
  1202. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1203. };
  1204. function checkIdentityKeys(target, has2, key) {
  1205. const rawKey = toRaw(key);
  1206. if (rawKey !== key && has2.call(target, rawKey)) {
  1207. const type = toRawType(target);
  1208. warn$2(
  1209. `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.`
  1210. );
  1211. }
  1212. }
  1213. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1214. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1215. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1216. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1217. function targetTypeMap(rawType) {
  1218. switch (rawType) {
  1219. case "Object":
  1220. case "Array":
  1221. return 1 /* COMMON */;
  1222. case "Map":
  1223. case "Set":
  1224. case "WeakMap":
  1225. case "WeakSet":
  1226. return 2 /* COLLECTION */;
  1227. default:
  1228. return 0 /* INVALID */;
  1229. }
  1230. }
  1231. function getTargetType(value) {
  1232. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1233. }
  1234. function reactive(target) {
  1235. if (isReadonly(target)) {
  1236. return target;
  1237. }
  1238. return createReactiveObject(
  1239. target,
  1240. false,
  1241. mutableHandlers,
  1242. mutableCollectionHandlers,
  1243. reactiveMap
  1244. );
  1245. }
  1246. function shallowReactive(target) {
  1247. return createReactiveObject(
  1248. target,
  1249. false,
  1250. shallowReactiveHandlers,
  1251. shallowCollectionHandlers,
  1252. shallowReactiveMap
  1253. );
  1254. }
  1255. function readonly(target) {
  1256. return createReactiveObject(
  1257. target,
  1258. true,
  1259. readonlyHandlers,
  1260. readonlyCollectionHandlers,
  1261. readonlyMap
  1262. );
  1263. }
  1264. function shallowReadonly(target) {
  1265. return createReactiveObject(
  1266. target,
  1267. true,
  1268. shallowReadonlyHandlers,
  1269. shallowReadonlyCollectionHandlers,
  1270. shallowReadonlyMap
  1271. );
  1272. }
  1273. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1274. if (!isObject(target)) {
  1275. {
  1276. warn$2(
  1277. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1278. target
  1279. )}`
  1280. );
  1281. }
  1282. return target;
  1283. }
  1284. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1285. return target;
  1286. }
  1287. const existingProxy = proxyMap.get(target);
  1288. if (existingProxy) {
  1289. return existingProxy;
  1290. }
  1291. const targetType = getTargetType(target);
  1292. if (targetType === 0 /* INVALID */) {
  1293. return target;
  1294. }
  1295. const proxy = new Proxy(
  1296. target,
  1297. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1298. );
  1299. proxyMap.set(target, proxy);
  1300. return proxy;
  1301. }
  1302. function isReactive(value) {
  1303. if (isReadonly(value)) {
  1304. return isReactive(value["__v_raw"]);
  1305. }
  1306. return !!(value && value["__v_isReactive"]);
  1307. }
  1308. function isReadonly(value) {
  1309. return !!(value && value["__v_isReadonly"]);
  1310. }
  1311. function isShallow(value) {
  1312. return !!(value && value["__v_isShallow"]);
  1313. }
  1314. function isProxy(value) {
  1315. return value ? !!value["__v_raw"] : false;
  1316. }
  1317. function toRaw(observed) {
  1318. const raw = observed && observed["__v_raw"];
  1319. return raw ? toRaw(raw) : observed;
  1320. }
  1321. function markRaw(value) {
  1322. if (Object.isExtensible(value)) {
  1323. def(value, "__v_skip", true);
  1324. }
  1325. return value;
  1326. }
  1327. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1328. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1329. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1330. class ComputedRefImpl {
  1331. constructor(getter, _setter, isReadonly, isSSR) {
  1332. this.getter = getter;
  1333. this._setter = _setter;
  1334. this.dep = void 0;
  1335. this.__v_isRef = true;
  1336. this["__v_isReadonly"] = false;
  1337. this.effect = new ReactiveEffect(
  1338. () => getter(this._value),
  1339. () => triggerRefValue(
  1340. this,
  1341. this.effect._dirtyLevel === 2 ? 2 : 3
  1342. )
  1343. );
  1344. this.effect.computed = this;
  1345. this.effect.active = this._cacheable = !isSSR;
  1346. this["__v_isReadonly"] = isReadonly;
  1347. }
  1348. get value() {
  1349. const self = toRaw(this);
  1350. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1351. triggerRefValue(self, 4);
  1352. }
  1353. trackRefValue(self);
  1354. if (self.effect._dirtyLevel >= 2) {
  1355. if (this._warnRecursive) {
  1356. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1357. getter: `, this.getter);
  1358. }
  1359. triggerRefValue(self, 2);
  1360. }
  1361. return self._value;
  1362. }
  1363. set value(newValue) {
  1364. this._setter(newValue);
  1365. }
  1366. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1367. get _dirty() {
  1368. return this.effect.dirty;
  1369. }
  1370. set _dirty(v) {
  1371. this.effect.dirty = v;
  1372. }
  1373. // #endregion
  1374. }
  1375. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1376. let getter;
  1377. let setter;
  1378. const onlyGetter = isFunction(getterOrOptions);
  1379. if (onlyGetter) {
  1380. getter = getterOrOptions;
  1381. setter = () => {
  1382. warn$2("Write operation failed: computed value is readonly");
  1383. } ;
  1384. } else {
  1385. getter = getterOrOptions.get;
  1386. setter = getterOrOptions.set;
  1387. }
  1388. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1389. if (debugOptions && !isSSR) {
  1390. cRef.effect.onTrack = debugOptions.onTrack;
  1391. cRef.effect.onTrigger = debugOptions.onTrigger;
  1392. }
  1393. return cRef;
  1394. }
  1395. function trackRefValue(ref2) {
  1396. var _a;
  1397. if (shouldTrack && activeEffect) {
  1398. ref2 = toRaw(ref2);
  1399. trackEffect(
  1400. activeEffect,
  1401. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1402. () => ref2.dep = void 0,
  1403. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1404. ),
  1405. {
  1406. target: ref2,
  1407. type: "get",
  1408. key: "value"
  1409. }
  1410. );
  1411. }
  1412. }
  1413. function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
  1414. ref2 = toRaw(ref2);
  1415. const dep = ref2.dep;
  1416. if (dep) {
  1417. triggerEffects(
  1418. dep,
  1419. dirtyLevel,
  1420. {
  1421. target: ref2,
  1422. type: "set",
  1423. key: "value",
  1424. newValue: newVal,
  1425. oldValue: oldVal
  1426. }
  1427. );
  1428. }
  1429. }
  1430. function isRef(r) {
  1431. return !!(r && r.__v_isRef === true);
  1432. }
  1433. function ref(value) {
  1434. return createRef(value, false);
  1435. }
  1436. function shallowRef(value) {
  1437. return createRef(value, true);
  1438. }
  1439. function createRef(rawValue, shallow) {
  1440. if (isRef(rawValue)) {
  1441. return rawValue;
  1442. }
  1443. return new RefImpl(rawValue, shallow);
  1444. }
  1445. class RefImpl {
  1446. constructor(value, __v_isShallow) {
  1447. this.__v_isShallow = __v_isShallow;
  1448. this.dep = void 0;
  1449. this.__v_isRef = true;
  1450. this._rawValue = __v_isShallow ? value : toRaw(value);
  1451. this._value = __v_isShallow ? value : toReactive(value);
  1452. }
  1453. get value() {
  1454. trackRefValue(this);
  1455. return this._value;
  1456. }
  1457. set value(newVal) {
  1458. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1459. newVal = useDirectValue ? newVal : toRaw(newVal);
  1460. if (hasChanged(newVal, this._rawValue)) {
  1461. const oldVal = this._rawValue;
  1462. this._rawValue = newVal;
  1463. this._value = useDirectValue ? newVal : toReactive(newVal);
  1464. triggerRefValue(this, 4, newVal, oldVal);
  1465. }
  1466. }
  1467. }
  1468. function triggerRef(ref2) {
  1469. triggerRefValue(ref2, 4, ref2.value );
  1470. }
  1471. function unref(ref2) {
  1472. return isRef(ref2) ? ref2.value : ref2;
  1473. }
  1474. function toValue(source) {
  1475. return isFunction(source) ? source() : unref(source);
  1476. }
  1477. const shallowUnwrapHandlers = {
  1478. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1479. set: (target, key, value, receiver) => {
  1480. const oldValue = target[key];
  1481. if (isRef(oldValue) && !isRef(value)) {
  1482. oldValue.value = value;
  1483. return true;
  1484. } else {
  1485. return Reflect.set(target, key, value, receiver);
  1486. }
  1487. }
  1488. };
  1489. function proxyRefs(objectWithRefs) {
  1490. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1491. }
  1492. class CustomRefImpl {
  1493. constructor(factory) {
  1494. this.dep = void 0;
  1495. this.__v_isRef = true;
  1496. const { get, set } = factory(
  1497. () => trackRefValue(this),
  1498. () => triggerRefValue(this)
  1499. );
  1500. this._get = get;
  1501. this._set = set;
  1502. }
  1503. get value() {
  1504. return this._get();
  1505. }
  1506. set value(newVal) {
  1507. this._set(newVal);
  1508. }
  1509. }
  1510. function customRef(factory) {
  1511. return new CustomRefImpl(factory);
  1512. }
  1513. function toRefs(object) {
  1514. if (!isProxy(object)) {
  1515. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1516. }
  1517. const ret = isArray(object) ? new Array(object.length) : {};
  1518. for (const key in object) {
  1519. ret[key] = propertyToRef(object, key);
  1520. }
  1521. return ret;
  1522. }
  1523. class ObjectRefImpl {
  1524. constructor(_object, _key, _defaultValue) {
  1525. this._object = _object;
  1526. this._key = _key;
  1527. this._defaultValue = _defaultValue;
  1528. this.__v_isRef = true;
  1529. }
  1530. get value() {
  1531. const val = this._object[this._key];
  1532. return val === void 0 ? this._defaultValue : val;
  1533. }
  1534. set value(newVal) {
  1535. this._object[this._key] = newVal;
  1536. }
  1537. get dep() {
  1538. return getDepFromReactive(toRaw(this._object), this._key);
  1539. }
  1540. }
  1541. class GetterRefImpl {
  1542. constructor(_getter) {
  1543. this._getter = _getter;
  1544. this.__v_isRef = true;
  1545. this.__v_isReadonly = true;
  1546. }
  1547. get value() {
  1548. return this._getter();
  1549. }
  1550. }
  1551. function toRef(source, key, defaultValue) {
  1552. if (isRef(source)) {
  1553. return source;
  1554. } else if (isFunction(source)) {
  1555. return new GetterRefImpl(source);
  1556. } else if (isObject(source) && arguments.length > 1) {
  1557. return propertyToRef(source, key, defaultValue);
  1558. } else {
  1559. return ref(source);
  1560. }
  1561. }
  1562. function propertyToRef(source, key, defaultValue) {
  1563. const val = source[key];
  1564. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1565. }
  1566. const TrackOpTypes = {
  1567. "GET": "get",
  1568. "HAS": "has",
  1569. "ITERATE": "iterate"
  1570. };
  1571. const TriggerOpTypes = {
  1572. "SET": "set",
  1573. "ADD": "add",
  1574. "DELETE": "delete",
  1575. "CLEAR": "clear"
  1576. };
  1577. const stack$1 = [];
  1578. function pushWarningContext(vnode) {
  1579. stack$1.push(vnode);
  1580. }
  1581. function popWarningContext() {
  1582. stack$1.pop();
  1583. }
  1584. let isWarning = false;
  1585. function warn$1(msg, ...args) {
  1586. if (isWarning) return;
  1587. isWarning = true;
  1588. pauseTracking();
  1589. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1590. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1591. const trace = getComponentTrace();
  1592. if (appWarnHandler) {
  1593. callWithErrorHandling(
  1594. appWarnHandler,
  1595. instance,
  1596. 11,
  1597. [
  1598. // eslint-disable-next-line no-restricted-syntax
  1599. msg + args.map((a) => {
  1600. var _a, _b;
  1601. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1602. }).join(""),
  1603. instance && instance.proxy,
  1604. trace.map(
  1605. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1606. ).join("\n"),
  1607. trace
  1608. ]
  1609. );
  1610. } else {
  1611. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1612. if (trace.length && // avoid spamming console during tests
  1613. true) {
  1614. warnArgs.push(`
  1615. `, ...formatTrace(trace));
  1616. }
  1617. console.warn(...warnArgs);
  1618. }
  1619. resetTracking();
  1620. isWarning = false;
  1621. }
  1622. function getComponentTrace() {
  1623. let currentVNode = stack$1[stack$1.length - 1];
  1624. if (!currentVNode) {
  1625. return [];
  1626. }
  1627. const normalizedStack = [];
  1628. while (currentVNode) {
  1629. const last = normalizedStack[0];
  1630. if (last && last.vnode === currentVNode) {
  1631. last.recurseCount++;
  1632. } else {
  1633. normalizedStack.push({
  1634. vnode: currentVNode,
  1635. recurseCount: 0
  1636. });
  1637. }
  1638. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1639. currentVNode = parentInstance && parentInstance.vnode;
  1640. }
  1641. return normalizedStack;
  1642. }
  1643. function formatTrace(trace) {
  1644. const logs = [];
  1645. trace.forEach((entry, i) => {
  1646. logs.push(...i === 0 ? [] : [`
  1647. `], ...formatTraceEntry(entry));
  1648. });
  1649. return logs;
  1650. }
  1651. function formatTraceEntry({ vnode, recurseCount }) {
  1652. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1653. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1654. const open = ` at <${formatComponentName(
  1655. vnode.component,
  1656. vnode.type,
  1657. isRoot
  1658. )}`;
  1659. const close = `>` + postfix;
  1660. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1661. }
  1662. function formatProps(props) {
  1663. const res = [];
  1664. const keys = Object.keys(props);
  1665. keys.slice(0, 3).forEach((key) => {
  1666. res.push(...formatProp(key, props[key]));
  1667. });
  1668. if (keys.length > 3) {
  1669. res.push(` ...`);
  1670. }
  1671. return res;
  1672. }
  1673. function formatProp(key, value, raw) {
  1674. if (isString(value)) {
  1675. value = JSON.stringify(value);
  1676. return raw ? value : [`${key}=${value}`];
  1677. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1678. return raw ? value : [`${key}=${value}`];
  1679. } else if (isRef(value)) {
  1680. value = formatProp(key, toRaw(value.value), true);
  1681. return raw ? value : [`${key}=Ref<`, value, `>`];
  1682. } else if (isFunction(value)) {
  1683. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1684. } else {
  1685. value = toRaw(value);
  1686. return raw ? value : [`${key}=`, value];
  1687. }
  1688. }
  1689. function assertNumber(val, type) {
  1690. if (val === void 0) {
  1691. return;
  1692. } else if (typeof val !== "number") {
  1693. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1694. } else if (isNaN(val)) {
  1695. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  1696. }
  1697. }
  1698. const ErrorCodes = {
  1699. "SETUP_FUNCTION": 0,
  1700. "0": "SETUP_FUNCTION",
  1701. "RENDER_FUNCTION": 1,
  1702. "1": "RENDER_FUNCTION",
  1703. "WATCH_GETTER": 2,
  1704. "2": "WATCH_GETTER",
  1705. "WATCH_CALLBACK": 3,
  1706. "3": "WATCH_CALLBACK",
  1707. "WATCH_CLEANUP": 4,
  1708. "4": "WATCH_CLEANUP",
  1709. "NATIVE_EVENT_HANDLER": 5,
  1710. "5": "NATIVE_EVENT_HANDLER",
  1711. "COMPONENT_EVENT_HANDLER": 6,
  1712. "6": "COMPONENT_EVENT_HANDLER",
  1713. "VNODE_HOOK": 7,
  1714. "7": "VNODE_HOOK",
  1715. "DIRECTIVE_HOOK": 8,
  1716. "8": "DIRECTIVE_HOOK",
  1717. "TRANSITION_HOOK": 9,
  1718. "9": "TRANSITION_HOOK",
  1719. "APP_ERROR_HANDLER": 10,
  1720. "10": "APP_ERROR_HANDLER",
  1721. "APP_WARN_HANDLER": 11,
  1722. "11": "APP_WARN_HANDLER",
  1723. "FUNCTION_REF": 12,
  1724. "12": "FUNCTION_REF",
  1725. "ASYNC_COMPONENT_LOADER": 13,
  1726. "13": "ASYNC_COMPONENT_LOADER",
  1727. "SCHEDULER": 14,
  1728. "14": "SCHEDULER",
  1729. "COMPONENT_UPDATE": 15,
  1730. "15": "COMPONENT_UPDATE"
  1731. };
  1732. const ErrorTypeStrings$1 = {
  1733. ["sp"]: "serverPrefetch hook",
  1734. ["bc"]: "beforeCreate hook",
  1735. ["c"]: "created hook",
  1736. ["bm"]: "beforeMount hook",
  1737. ["m"]: "mounted hook",
  1738. ["bu"]: "beforeUpdate hook",
  1739. ["u"]: "updated",
  1740. ["bum"]: "beforeUnmount hook",
  1741. ["um"]: "unmounted hook",
  1742. ["a"]: "activated hook",
  1743. ["da"]: "deactivated hook",
  1744. ["ec"]: "errorCaptured hook",
  1745. ["rtc"]: "renderTracked hook",
  1746. ["rtg"]: "renderTriggered hook",
  1747. [0]: "setup function",
  1748. [1]: "render function",
  1749. [2]: "watcher getter",
  1750. [3]: "watcher callback",
  1751. [4]: "watcher cleanup function",
  1752. [5]: "native event handler",
  1753. [6]: "component event handler",
  1754. [7]: "vnode hook",
  1755. [8]: "directive hook",
  1756. [9]: "transition hook",
  1757. [10]: "app errorHandler",
  1758. [11]: "app warnHandler",
  1759. [12]: "ref function",
  1760. [13]: "async component loader",
  1761. [14]: "scheduler flush",
  1762. [15]: "component update"
  1763. };
  1764. function callWithErrorHandling(fn, instance, type, args) {
  1765. try {
  1766. return args ? fn(...args) : fn();
  1767. } catch (err) {
  1768. handleError(err, instance, type);
  1769. }
  1770. }
  1771. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1772. if (isFunction(fn)) {
  1773. const res = callWithErrorHandling(fn, instance, type, args);
  1774. if (res && isPromise(res)) {
  1775. res.catch((err) => {
  1776. handleError(err, instance, type);
  1777. });
  1778. }
  1779. return res;
  1780. }
  1781. if (isArray(fn)) {
  1782. const values = [];
  1783. for (let i = 0; i < fn.length; i++) {
  1784. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1785. }
  1786. return values;
  1787. } else {
  1788. warn$1(
  1789. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  1790. );
  1791. }
  1792. }
  1793. function handleError(err, instance, type, throwInDev = true) {
  1794. const contextVNode = instance ? instance.vnode : null;
  1795. if (instance) {
  1796. let cur = instance.parent;
  1797. const exposedInstance = instance.proxy;
  1798. const errorInfo = ErrorTypeStrings$1[type] ;
  1799. while (cur) {
  1800. const errorCapturedHooks = cur.ec;
  1801. if (errorCapturedHooks) {
  1802. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1803. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1804. return;
  1805. }
  1806. }
  1807. }
  1808. cur = cur.parent;
  1809. }
  1810. const appErrorHandler = instance.appContext.config.errorHandler;
  1811. if (appErrorHandler) {
  1812. pauseTracking();
  1813. callWithErrorHandling(
  1814. appErrorHandler,
  1815. null,
  1816. 10,
  1817. [err, exposedInstance, errorInfo]
  1818. );
  1819. resetTracking();
  1820. return;
  1821. }
  1822. }
  1823. logError(err, type, contextVNode, throwInDev);
  1824. }
  1825. function logError(err, type, contextVNode, throwInDev = true) {
  1826. {
  1827. const info = ErrorTypeStrings$1[type];
  1828. if (contextVNode) {
  1829. pushWarningContext(contextVNode);
  1830. }
  1831. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1832. if (contextVNode) {
  1833. popWarningContext();
  1834. }
  1835. if (throwInDev) {
  1836. throw err;
  1837. } else {
  1838. console.error(err);
  1839. }
  1840. }
  1841. }
  1842. let isFlushing = false;
  1843. let isFlushPending = false;
  1844. const queue = [];
  1845. let flushIndex = 0;
  1846. const pendingPostFlushCbs = [];
  1847. let activePostFlushCbs = null;
  1848. let postFlushIndex = 0;
  1849. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1850. let currentFlushPromise = null;
  1851. const RECURSION_LIMIT = 100;
  1852. function nextTick(fn) {
  1853. const p = currentFlushPromise || resolvedPromise;
  1854. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1855. }
  1856. function findInsertionIndex(id) {
  1857. let start = flushIndex + 1;
  1858. let end = queue.length;
  1859. while (start < end) {
  1860. const middle = start + end >>> 1;
  1861. const middleJob = queue[middle];
  1862. const middleJobId = getId(middleJob);
  1863. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1864. start = middle + 1;
  1865. } else {
  1866. end = middle;
  1867. }
  1868. }
  1869. return start;
  1870. }
  1871. function queueJob(job) {
  1872. if (!queue.length || !queue.includes(
  1873. job,
  1874. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1875. )) {
  1876. if (job.id == null) {
  1877. queue.push(job);
  1878. } else {
  1879. queue.splice(findInsertionIndex(job.id), 0, job);
  1880. }
  1881. queueFlush();
  1882. }
  1883. }
  1884. function queueFlush() {
  1885. if (!isFlushing && !isFlushPending) {
  1886. isFlushPending = true;
  1887. currentFlushPromise = resolvedPromise.then(flushJobs);
  1888. }
  1889. }
  1890. function invalidateJob(job) {
  1891. const i = queue.indexOf(job);
  1892. if (i > flushIndex) {
  1893. queue.splice(i, 1);
  1894. }
  1895. }
  1896. function queuePostFlushCb(cb) {
  1897. if (!isArray(cb)) {
  1898. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1899. cb,
  1900. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1901. )) {
  1902. pendingPostFlushCbs.push(cb);
  1903. }
  1904. } else {
  1905. pendingPostFlushCbs.push(...cb);
  1906. }
  1907. queueFlush();
  1908. }
  1909. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1910. {
  1911. seen = seen || /* @__PURE__ */ new Map();
  1912. }
  1913. for (; i < queue.length; i++) {
  1914. const cb = queue[i];
  1915. if (cb && cb.pre) {
  1916. if (instance && cb.id !== instance.uid) {
  1917. continue;
  1918. }
  1919. if (checkRecursiveUpdates(seen, cb)) {
  1920. continue;
  1921. }
  1922. queue.splice(i, 1);
  1923. i--;
  1924. cb();
  1925. }
  1926. }
  1927. }
  1928. function flushPostFlushCbs(seen) {
  1929. if (pendingPostFlushCbs.length) {
  1930. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1931. (a, b) => getId(a) - getId(b)
  1932. );
  1933. pendingPostFlushCbs.length = 0;
  1934. if (activePostFlushCbs) {
  1935. activePostFlushCbs.push(...deduped);
  1936. return;
  1937. }
  1938. activePostFlushCbs = deduped;
  1939. {
  1940. seen = seen || /* @__PURE__ */ new Map();
  1941. }
  1942. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1943. const cb = activePostFlushCbs[postFlushIndex];
  1944. if (checkRecursiveUpdates(seen, cb)) {
  1945. continue;
  1946. }
  1947. if (cb.active !== false) cb();
  1948. }
  1949. activePostFlushCbs = null;
  1950. postFlushIndex = 0;
  1951. }
  1952. }
  1953. const getId = (job) => job.id == null ? Infinity : job.id;
  1954. const comparator = (a, b) => {
  1955. const diff = getId(a) - getId(b);
  1956. if (diff === 0) {
  1957. if (a.pre && !b.pre) return -1;
  1958. if (b.pre && !a.pre) return 1;
  1959. }
  1960. return diff;
  1961. };
  1962. function flushJobs(seen) {
  1963. isFlushPending = false;
  1964. isFlushing = true;
  1965. {
  1966. seen = seen || /* @__PURE__ */ new Map();
  1967. }
  1968. queue.sort(comparator);
  1969. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1970. try {
  1971. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1972. const job = queue[flushIndex];
  1973. if (job && job.active !== false) {
  1974. if (check(job)) {
  1975. continue;
  1976. }
  1977. callWithErrorHandling(
  1978. job,
  1979. job.i,
  1980. job.i ? 15 : 14
  1981. );
  1982. }
  1983. }
  1984. } finally {
  1985. flushIndex = 0;
  1986. queue.length = 0;
  1987. flushPostFlushCbs(seen);
  1988. isFlushing = false;
  1989. currentFlushPromise = null;
  1990. if (queue.length || pendingPostFlushCbs.length) {
  1991. flushJobs(seen);
  1992. }
  1993. }
  1994. }
  1995. function checkRecursiveUpdates(seen, fn) {
  1996. if (!seen.has(fn)) {
  1997. seen.set(fn, 1);
  1998. } else {
  1999. const count = seen.get(fn);
  2000. if (count > RECURSION_LIMIT) {
  2001. const instance = fn.i;
  2002. const componentName = instance && getComponentName(instance.type);
  2003. handleError(
  2004. `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.`,
  2005. null,
  2006. 10
  2007. );
  2008. return true;
  2009. } else {
  2010. seen.set(fn, count + 1);
  2011. }
  2012. }
  2013. }
  2014. let isHmrUpdating = false;
  2015. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2016. {
  2017. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2018. createRecord: tryWrap(createRecord),
  2019. rerender: tryWrap(rerender),
  2020. reload: tryWrap(reload)
  2021. };
  2022. }
  2023. const map = /* @__PURE__ */ new Map();
  2024. function registerHMR(instance) {
  2025. const id = instance.type.__hmrId;
  2026. let record = map.get(id);
  2027. if (!record) {
  2028. createRecord(id, instance.type);
  2029. record = map.get(id);
  2030. }
  2031. record.instances.add(instance);
  2032. }
  2033. function unregisterHMR(instance) {
  2034. map.get(instance.type.__hmrId).instances.delete(instance);
  2035. }
  2036. function createRecord(id, initialDef) {
  2037. if (map.has(id)) {
  2038. return false;
  2039. }
  2040. map.set(id, {
  2041. initialDef: normalizeClassComponent(initialDef),
  2042. instances: /* @__PURE__ */ new Set()
  2043. });
  2044. return true;
  2045. }
  2046. function normalizeClassComponent(component) {
  2047. return isClassComponent(component) ? component.__vccOpts : component;
  2048. }
  2049. function rerender(id, newRender) {
  2050. const record = map.get(id);
  2051. if (!record) {
  2052. return;
  2053. }
  2054. record.initialDef.render = newRender;
  2055. [...record.instances].forEach((instance) => {
  2056. if (newRender) {
  2057. instance.render = newRender;
  2058. normalizeClassComponent(instance.type).render = newRender;
  2059. }
  2060. instance.renderCache = [];
  2061. isHmrUpdating = true;
  2062. instance.effect.dirty = true;
  2063. instance.update();
  2064. isHmrUpdating = false;
  2065. });
  2066. }
  2067. function reload(id, newComp) {
  2068. const record = map.get(id);
  2069. if (!record) return;
  2070. newComp = normalizeClassComponent(newComp);
  2071. updateComponentDef(record.initialDef, newComp);
  2072. const instances = [...record.instances];
  2073. for (let i = 0; i < instances.length; i++) {
  2074. const instance = instances[i];
  2075. const oldComp = normalizeClassComponent(instance.type);
  2076. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2077. if (!dirtyInstances) {
  2078. if (oldComp !== record.initialDef) {
  2079. updateComponentDef(oldComp, newComp);
  2080. }
  2081. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2082. }
  2083. dirtyInstances.add(instance);
  2084. instance.appContext.propsCache.delete(instance.type);
  2085. instance.appContext.emitsCache.delete(instance.type);
  2086. instance.appContext.optionsCache.delete(instance.type);
  2087. if (instance.ceReload) {
  2088. dirtyInstances.add(instance);
  2089. instance.ceReload(newComp.styles);
  2090. dirtyInstances.delete(instance);
  2091. } else if (instance.parent) {
  2092. instance.parent.effect.dirty = true;
  2093. queueJob(() => {
  2094. instance.parent.update();
  2095. dirtyInstances.delete(instance);
  2096. });
  2097. } else if (instance.appContext.reload) {
  2098. instance.appContext.reload();
  2099. } else if (typeof window !== "undefined") {
  2100. window.location.reload();
  2101. } else {
  2102. console.warn(
  2103. "[HMR] Root or manually mounted instance modified. Full reload required."
  2104. );
  2105. }
  2106. }
  2107. queuePostFlushCb(() => {
  2108. hmrDirtyComponents.clear();
  2109. });
  2110. }
  2111. function updateComponentDef(oldComp, newComp) {
  2112. extend(oldComp, newComp);
  2113. for (const key in oldComp) {
  2114. if (key !== "__file" && !(key in newComp)) {
  2115. delete oldComp[key];
  2116. }
  2117. }
  2118. }
  2119. function tryWrap(fn) {
  2120. return (id, arg) => {
  2121. try {
  2122. return fn(id, arg);
  2123. } catch (e) {
  2124. console.error(e);
  2125. console.warn(
  2126. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2127. );
  2128. }
  2129. };
  2130. }
  2131. let devtools$1;
  2132. let buffer = [];
  2133. let devtoolsNotInstalled = false;
  2134. function emit$1(event, ...args) {
  2135. if (devtools$1) {
  2136. devtools$1.emit(event, ...args);
  2137. } else if (!devtoolsNotInstalled) {
  2138. buffer.push({ event, args });
  2139. }
  2140. }
  2141. function setDevtoolsHook$1(hook, target) {
  2142. var _a, _b;
  2143. devtools$1 = hook;
  2144. if (devtools$1) {
  2145. devtools$1.enabled = true;
  2146. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2147. buffer = [];
  2148. } else if (
  2149. // handle late devtools injection - only do this if we are in an actual
  2150. // browser environment to avoid the timer handle stalling test runner exit
  2151. // (#4815)
  2152. typeof window !== "undefined" && // some envs mock window but not fully
  2153. window.HTMLElement && // also exclude jsdom
  2154. // eslint-disable-next-line no-restricted-syntax
  2155. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2156. ) {
  2157. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2158. replay.push((newHook) => {
  2159. setDevtoolsHook$1(newHook, target);
  2160. });
  2161. setTimeout(() => {
  2162. if (!devtools$1) {
  2163. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2164. devtoolsNotInstalled = true;
  2165. buffer = [];
  2166. }
  2167. }, 3e3);
  2168. } else {
  2169. devtoolsNotInstalled = true;
  2170. buffer = [];
  2171. }
  2172. }
  2173. function devtoolsInitApp(app, version) {
  2174. emit$1("app:init" /* APP_INIT */, app, version, {
  2175. Fragment,
  2176. Text,
  2177. Comment,
  2178. Static
  2179. });
  2180. }
  2181. function devtoolsUnmountApp(app) {
  2182. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2183. }
  2184. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2185. "component:added" /* COMPONENT_ADDED */
  2186. );
  2187. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2188. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2189. "component:removed" /* COMPONENT_REMOVED */
  2190. );
  2191. const devtoolsComponentRemoved = (component) => {
  2192. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2193. !devtools$1.cleanupBuffer(component)) {
  2194. _devtoolsComponentRemoved(component);
  2195. }
  2196. };
  2197. /*! #__NO_SIDE_EFFECTS__ */
  2198. // @__NO_SIDE_EFFECTS__
  2199. function createDevtoolsComponentHook(hook) {
  2200. return (component) => {
  2201. emit$1(
  2202. hook,
  2203. component.appContext.app,
  2204. component.uid,
  2205. component.parent ? component.parent.uid : void 0,
  2206. component
  2207. );
  2208. };
  2209. }
  2210. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2211. "perf:start" /* PERFORMANCE_START */
  2212. );
  2213. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2214. "perf:end" /* PERFORMANCE_END */
  2215. );
  2216. function createDevtoolsPerformanceHook(hook) {
  2217. return (component, type, time) => {
  2218. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2219. };
  2220. }
  2221. function devtoolsComponentEmit(component, event, params) {
  2222. emit$1(
  2223. "component:emit" /* COMPONENT_EMIT */,
  2224. component.appContext.app,
  2225. component,
  2226. event,
  2227. params
  2228. );
  2229. }
  2230. let currentRenderingInstance = null;
  2231. let currentScopeId = null;
  2232. function setCurrentRenderingInstance(instance) {
  2233. const prev = currentRenderingInstance;
  2234. currentRenderingInstance = instance;
  2235. currentScopeId = instance && instance.type.__scopeId || null;
  2236. return prev;
  2237. }
  2238. function pushScopeId(id) {
  2239. currentScopeId = id;
  2240. }
  2241. function popScopeId() {
  2242. currentScopeId = null;
  2243. }
  2244. const withScopeId = (_id) => withCtx;
  2245. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2246. if (!ctx) return fn;
  2247. if (fn._n) {
  2248. return fn;
  2249. }
  2250. const renderFnWithContext = (...args) => {
  2251. if (renderFnWithContext._d) {
  2252. setBlockTracking(-1);
  2253. }
  2254. const prevInstance = setCurrentRenderingInstance(ctx);
  2255. let res;
  2256. try {
  2257. res = fn(...args);
  2258. } finally {
  2259. setCurrentRenderingInstance(prevInstance);
  2260. if (renderFnWithContext._d) {
  2261. setBlockTracking(1);
  2262. }
  2263. }
  2264. {
  2265. devtoolsComponentUpdated(ctx);
  2266. }
  2267. return res;
  2268. };
  2269. renderFnWithContext._n = true;
  2270. renderFnWithContext._c = true;
  2271. renderFnWithContext._d = true;
  2272. return renderFnWithContext;
  2273. }
  2274. function validateDirectiveName(name) {
  2275. if (isBuiltInDirective(name)) {
  2276. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2277. }
  2278. }
  2279. function withDirectives(vnode, directives) {
  2280. if (currentRenderingInstance === null) {
  2281. warn$1(`withDirectives can only be used inside render functions.`);
  2282. return vnode;
  2283. }
  2284. const instance = getComponentPublicInstance(currentRenderingInstance);
  2285. const bindings = vnode.dirs || (vnode.dirs = []);
  2286. for (let i = 0; i < directives.length; i++) {
  2287. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2288. if (dir) {
  2289. if (isFunction(dir)) {
  2290. dir = {
  2291. mounted: dir,
  2292. updated: dir
  2293. };
  2294. }
  2295. if (dir.deep) {
  2296. traverse(value);
  2297. }
  2298. bindings.push({
  2299. dir,
  2300. instance,
  2301. value,
  2302. oldValue: void 0,
  2303. arg,
  2304. modifiers
  2305. });
  2306. }
  2307. }
  2308. return vnode;
  2309. }
  2310. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2311. const bindings = vnode.dirs;
  2312. const oldBindings = prevVNode && prevVNode.dirs;
  2313. for (let i = 0; i < bindings.length; i++) {
  2314. const binding = bindings[i];
  2315. if (oldBindings) {
  2316. binding.oldValue = oldBindings[i].value;
  2317. }
  2318. let hook = binding.dir[name];
  2319. if (hook) {
  2320. pauseTracking();
  2321. callWithAsyncErrorHandling(hook, instance, 8, [
  2322. vnode.el,
  2323. binding,
  2324. vnode,
  2325. prevVNode
  2326. ]);
  2327. resetTracking();
  2328. }
  2329. }
  2330. }
  2331. const leaveCbKey = Symbol("_leaveCb");
  2332. const enterCbKey$1 = Symbol("_enterCb");
  2333. function useTransitionState() {
  2334. const state = {
  2335. isMounted: false,
  2336. isLeaving: false,
  2337. isUnmounting: false,
  2338. leavingVNodes: /* @__PURE__ */ new Map()
  2339. };
  2340. onMounted(() => {
  2341. state.isMounted = true;
  2342. });
  2343. onBeforeUnmount(() => {
  2344. state.isUnmounting = true;
  2345. });
  2346. return state;
  2347. }
  2348. const TransitionHookValidator = [Function, Array];
  2349. const BaseTransitionPropsValidators = {
  2350. mode: String,
  2351. appear: Boolean,
  2352. persisted: Boolean,
  2353. // enter
  2354. onBeforeEnter: TransitionHookValidator,
  2355. onEnter: TransitionHookValidator,
  2356. onAfterEnter: TransitionHookValidator,
  2357. onEnterCancelled: TransitionHookValidator,
  2358. // leave
  2359. onBeforeLeave: TransitionHookValidator,
  2360. onLeave: TransitionHookValidator,
  2361. onAfterLeave: TransitionHookValidator,
  2362. onLeaveCancelled: TransitionHookValidator,
  2363. // appear
  2364. onBeforeAppear: TransitionHookValidator,
  2365. onAppear: TransitionHookValidator,
  2366. onAfterAppear: TransitionHookValidator,
  2367. onAppearCancelled: TransitionHookValidator
  2368. };
  2369. const recursiveGetSubtree = (instance) => {
  2370. const subTree = instance.subTree;
  2371. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  2372. };
  2373. const BaseTransitionImpl = {
  2374. name: `BaseTransition`,
  2375. props: BaseTransitionPropsValidators,
  2376. setup(props, { slots }) {
  2377. const instance = getCurrentInstance();
  2378. const state = useTransitionState();
  2379. return () => {
  2380. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  2381. if (!children || !children.length) {
  2382. return;
  2383. }
  2384. let child = children[0];
  2385. if (children.length > 1) {
  2386. let hasFound = false;
  2387. for (const c of children) {
  2388. if (c.type !== Comment) {
  2389. if (hasFound) {
  2390. warn$1(
  2391. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  2392. );
  2393. break;
  2394. }
  2395. child = c;
  2396. hasFound = true;
  2397. }
  2398. }
  2399. }
  2400. const rawProps = toRaw(props);
  2401. const { mode } = rawProps;
  2402. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  2403. warn$1(`invalid <transition> mode: ${mode}`);
  2404. }
  2405. if (state.isLeaving) {
  2406. return emptyPlaceholder(child);
  2407. }
  2408. const innerChild = getKeepAliveChild(child);
  2409. if (!innerChild) {
  2410. return emptyPlaceholder(child);
  2411. }
  2412. let enterHooks = resolveTransitionHooks(
  2413. innerChild,
  2414. rawProps,
  2415. state,
  2416. instance,
  2417. // #11061, ensure enterHooks is fresh after clone
  2418. (hooks) => enterHooks = hooks
  2419. );
  2420. setTransitionHooks(innerChild, enterHooks);
  2421. const oldChild = instance.subTree;
  2422. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2423. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  2424. const leavingHooks = resolveTransitionHooks(
  2425. oldInnerChild,
  2426. rawProps,
  2427. state,
  2428. instance
  2429. );
  2430. setTransitionHooks(oldInnerChild, leavingHooks);
  2431. if (mode === "out-in" && innerChild.type !== Comment) {
  2432. state.isLeaving = true;
  2433. leavingHooks.afterLeave = () => {
  2434. state.isLeaving = false;
  2435. if (instance.update.active !== false) {
  2436. instance.effect.dirty = true;
  2437. instance.update();
  2438. }
  2439. };
  2440. return emptyPlaceholder(child);
  2441. } else if (mode === "in-out" && innerChild.type !== Comment) {
  2442. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2443. const leavingVNodesCache = getLeavingNodesForType(
  2444. state,
  2445. oldInnerChild
  2446. );
  2447. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2448. el[leaveCbKey] = () => {
  2449. earlyRemove();
  2450. el[leaveCbKey] = void 0;
  2451. delete enterHooks.delayedLeave;
  2452. };
  2453. enterHooks.delayedLeave = delayedLeave;
  2454. };
  2455. }
  2456. }
  2457. return child;
  2458. };
  2459. }
  2460. };
  2461. const BaseTransition = BaseTransitionImpl;
  2462. function getLeavingNodesForType(state, vnode) {
  2463. const { leavingVNodes } = state;
  2464. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  2465. if (!leavingVNodesCache) {
  2466. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  2467. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2468. }
  2469. return leavingVNodesCache;
  2470. }
  2471. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  2472. const {
  2473. appear,
  2474. mode,
  2475. persisted = false,
  2476. onBeforeEnter,
  2477. onEnter,
  2478. onAfterEnter,
  2479. onEnterCancelled,
  2480. onBeforeLeave,
  2481. onLeave,
  2482. onAfterLeave,
  2483. onLeaveCancelled,
  2484. onBeforeAppear,
  2485. onAppear,
  2486. onAfterAppear,
  2487. onAppearCancelled
  2488. } = props;
  2489. const key = String(vnode.key);
  2490. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2491. const callHook = (hook, args) => {
  2492. hook && callWithAsyncErrorHandling(
  2493. hook,
  2494. instance,
  2495. 9,
  2496. args
  2497. );
  2498. };
  2499. const callAsyncHook = (hook, args) => {
  2500. const done = args[1];
  2501. callHook(hook, args);
  2502. if (isArray(hook)) {
  2503. if (hook.every((hook2) => hook2.length <= 1)) done();
  2504. } else if (hook.length <= 1) {
  2505. done();
  2506. }
  2507. };
  2508. const hooks = {
  2509. mode,
  2510. persisted,
  2511. beforeEnter(el) {
  2512. let hook = onBeforeEnter;
  2513. if (!state.isMounted) {
  2514. if (appear) {
  2515. hook = onBeforeAppear || onBeforeEnter;
  2516. } else {
  2517. return;
  2518. }
  2519. }
  2520. if (el[leaveCbKey]) {
  2521. el[leaveCbKey](
  2522. true
  2523. /* cancelled */
  2524. );
  2525. }
  2526. const leavingVNode = leavingVNodesCache[key];
  2527. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  2528. leavingVNode.el[leaveCbKey]();
  2529. }
  2530. callHook(hook, [el]);
  2531. },
  2532. enter(el) {
  2533. let hook = onEnter;
  2534. let afterHook = onAfterEnter;
  2535. let cancelHook = onEnterCancelled;
  2536. if (!state.isMounted) {
  2537. if (appear) {
  2538. hook = onAppear || onEnter;
  2539. afterHook = onAfterAppear || onAfterEnter;
  2540. cancelHook = onAppearCancelled || onEnterCancelled;
  2541. } else {
  2542. return;
  2543. }
  2544. }
  2545. let called = false;
  2546. const done = el[enterCbKey$1] = (cancelled) => {
  2547. if (called) return;
  2548. called = true;
  2549. if (cancelled) {
  2550. callHook(cancelHook, [el]);
  2551. } else {
  2552. callHook(afterHook, [el]);
  2553. }
  2554. if (hooks.delayedLeave) {
  2555. hooks.delayedLeave();
  2556. }
  2557. el[enterCbKey$1] = void 0;
  2558. };
  2559. if (hook) {
  2560. callAsyncHook(hook, [el, done]);
  2561. } else {
  2562. done();
  2563. }
  2564. },
  2565. leave(el, remove) {
  2566. const key2 = String(vnode.key);
  2567. if (el[enterCbKey$1]) {
  2568. el[enterCbKey$1](
  2569. true
  2570. /* cancelled */
  2571. );
  2572. }
  2573. if (state.isUnmounting) {
  2574. return remove();
  2575. }
  2576. callHook(onBeforeLeave, [el]);
  2577. let called = false;
  2578. const done = el[leaveCbKey] = (cancelled) => {
  2579. if (called) return;
  2580. called = true;
  2581. remove();
  2582. if (cancelled) {
  2583. callHook(onLeaveCancelled, [el]);
  2584. } else {
  2585. callHook(onAfterLeave, [el]);
  2586. }
  2587. el[leaveCbKey] = void 0;
  2588. if (leavingVNodesCache[key2] === vnode) {
  2589. delete leavingVNodesCache[key2];
  2590. }
  2591. };
  2592. leavingVNodesCache[key2] = vnode;
  2593. if (onLeave) {
  2594. callAsyncHook(onLeave, [el, done]);
  2595. } else {
  2596. done();
  2597. }
  2598. },
  2599. clone(vnode2) {
  2600. const hooks2 = resolveTransitionHooks(
  2601. vnode2,
  2602. props,
  2603. state,
  2604. instance,
  2605. postClone
  2606. );
  2607. if (postClone) postClone(hooks2);
  2608. return hooks2;
  2609. }
  2610. };
  2611. return hooks;
  2612. }
  2613. function emptyPlaceholder(vnode) {
  2614. if (isKeepAlive(vnode)) {
  2615. vnode = cloneVNode(vnode);
  2616. vnode.children = null;
  2617. return vnode;
  2618. }
  2619. }
  2620. function getKeepAliveChild(vnode) {
  2621. if (!isKeepAlive(vnode)) {
  2622. return vnode;
  2623. }
  2624. if (vnode.component) {
  2625. return vnode.component.subTree;
  2626. }
  2627. const { shapeFlag, children } = vnode;
  2628. if (children) {
  2629. if (shapeFlag & 16) {
  2630. return children[0];
  2631. }
  2632. if (shapeFlag & 32 && isFunction(children.default)) {
  2633. return children.default();
  2634. }
  2635. }
  2636. }
  2637. function setTransitionHooks(vnode, hooks) {
  2638. if (vnode.shapeFlag & 6 && vnode.component) {
  2639. setTransitionHooks(vnode.component.subTree, hooks);
  2640. } else if (vnode.shapeFlag & 128) {
  2641. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2642. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2643. } else {
  2644. vnode.transition = hooks;
  2645. }
  2646. }
  2647. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  2648. let ret = [];
  2649. let keyedFragmentCount = 0;
  2650. for (let i = 0; i < children.length; i++) {
  2651. let child = children[i];
  2652. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2653. if (child.type === Fragment) {
  2654. if (child.patchFlag & 128) keyedFragmentCount++;
  2655. ret = ret.concat(
  2656. getTransitionRawChildren(child.children, keepComment, key)
  2657. );
  2658. } else if (keepComment || child.type !== Comment) {
  2659. ret.push(key != null ? cloneVNode(child, { key }) : child);
  2660. }
  2661. }
  2662. if (keyedFragmentCount > 1) {
  2663. for (let i = 0; i < ret.length; i++) {
  2664. ret[i].patchFlag = -2;
  2665. }
  2666. }
  2667. return ret;
  2668. }
  2669. /*! #__NO_SIDE_EFFECTS__ */
  2670. // @__NO_SIDE_EFFECTS__
  2671. function defineComponent(options, extraOptions) {
  2672. return isFunction(options) ? (
  2673. // #8326: extend call and options.name access are considered side-effects
  2674. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  2675. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  2676. ) : options;
  2677. }
  2678. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2679. /*! #__NO_SIDE_EFFECTS__ */
  2680. // @__NO_SIDE_EFFECTS__
  2681. function defineAsyncComponent(source) {
  2682. if (isFunction(source)) {
  2683. source = { loader: source };
  2684. }
  2685. const {
  2686. loader,
  2687. loadingComponent,
  2688. errorComponent,
  2689. delay = 200,
  2690. timeout,
  2691. // undefined = never times out
  2692. suspensible = true,
  2693. onError: userOnError
  2694. } = source;
  2695. let pendingRequest = null;
  2696. let resolvedComp;
  2697. let retries = 0;
  2698. const retry = () => {
  2699. retries++;
  2700. pendingRequest = null;
  2701. return load();
  2702. };
  2703. const load = () => {
  2704. let thisRequest;
  2705. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  2706. err = err instanceof Error ? err : new Error(String(err));
  2707. if (userOnError) {
  2708. return new Promise((resolve, reject) => {
  2709. const userRetry = () => resolve(retry());
  2710. const userFail = () => reject(err);
  2711. userOnError(err, userRetry, userFail, retries + 1);
  2712. });
  2713. } else {
  2714. throw err;
  2715. }
  2716. }).then((comp) => {
  2717. if (thisRequest !== pendingRequest && pendingRequest) {
  2718. return pendingRequest;
  2719. }
  2720. if (!comp) {
  2721. warn$1(
  2722. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  2723. );
  2724. }
  2725. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  2726. comp = comp.default;
  2727. }
  2728. if (comp && !isObject(comp) && !isFunction(comp)) {
  2729. throw new Error(`Invalid async component load result: ${comp}`);
  2730. }
  2731. resolvedComp = comp;
  2732. return comp;
  2733. }));
  2734. };
  2735. return defineComponent({
  2736. name: "AsyncComponentWrapper",
  2737. __asyncLoader: load,
  2738. get __asyncResolved() {
  2739. return resolvedComp;
  2740. },
  2741. setup() {
  2742. const instance = currentInstance;
  2743. if (resolvedComp) {
  2744. return () => createInnerComp(resolvedComp, instance);
  2745. }
  2746. const onError = (err) => {
  2747. pendingRequest = null;
  2748. handleError(
  2749. err,
  2750. instance,
  2751. 13,
  2752. !errorComponent
  2753. );
  2754. };
  2755. if (suspensible && instance.suspense || false) {
  2756. return load().then((comp) => {
  2757. return () => createInnerComp(comp, instance);
  2758. }).catch((err) => {
  2759. onError(err);
  2760. return () => errorComponent ? createVNode(errorComponent, {
  2761. error: err
  2762. }) : null;
  2763. });
  2764. }
  2765. const loaded = ref(false);
  2766. const error = ref();
  2767. const delayed = ref(!!delay);
  2768. if (delay) {
  2769. setTimeout(() => {
  2770. delayed.value = false;
  2771. }, delay);
  2772. }
  2773. if (timeout != null) {
  2774. setTimeout(() => {
  2775. if (!loaded.value && !error.value) {
  2776. const err = new Error(
  2777. `Async component timed out after ${timeout}ms.`
  2778. );
  2779. onError(err);
  2780. error.value = err;
  2781. }
  2782. }, timeout);
  2783. }
  2784. load().then(() => {
  2785. loaded.value = true;
  2786. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  2787. instance.parent.effect.dirty = true;
  2788. queueJob(instance.parent.update);
  2789. }
  2790. }).catch((err) => {
  2791. onError(err);
  2792. error.value = err;
  2793. });
  2794. return () => {
  2795. if (loaded.value && resolvedComp) {
  2796. return createInnerComp(resolvedComp, instance);
  2797. } else if (error.value && errorComponent) {
  2798. return createVNode(errorComponent, {
  2799. error: error.value
  2800. });
  2801. } else if (loadingComponent && !delayed.value) {
  2802. return createVNode(loadingComponent);
  2803. }
  2804. };
  2805. }
  2806. });
  2807. }
  2808. function createInnerComp(comp, parent) {
  2809. const { ref: ref2, props, children, ce } = parent.vnode;
  2810. const vnode = createVNode(comp, props, children);
  2811. vnode.ref = ref2;
  2812. vnode.ce = ce;
  2813. delete parent.vnode.ce;
  2814. return vnode;
  2815. }
  2816. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2817. const KeepAliveImpl = {
  2818. name: `KeepAlive`,
  2819. // Marker for special handling inside the renderer. We are not using a ===
  2820. // check directly on KeepAlive in the renderer, because importing it directly
  2821. // would prevent it from being tree-shaken.
  2822. __isKeepAlive: true,
  2823. props: {
  2824. include: [String, RegExp, Array],
  2825. exclude: [String, RegExp, Array],
  2826. max: [String, Number]
  2827. },
  2828. setup(props, { slots }) {
  2829. const instance = getCurrentInstance();
  2830. const sharedContext = instance.ctx;
  2831. const cache = /* @__PURE__ */ new Map();
  2832. const keys = /* @__PURE__ */ new Set();
  2833. let current = null;
  2834. {
  2835. instance.__v_cache = cache;
  2836. }
  2837. const parentSuspense = instance.suspense;
  2838. const {
  2839. renderer: {
  2840. p: patch,
  2841. m: move,
  2842. um: _unmount,
  2843. o: { createElement }
  2844. }
  2845. } = sharedContext;
  2846. const storageContainer = createElement("div");
  2847. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  2848. const instance2 = vnode.component;
  2849. move(vnode, container, anchor, 0, parentSuspense);
  2850. patch(
  2851. instance2.vnode,
  2852. vnode,
  2853. container,
  2854. anchor,
  2855. instance2,
  2856. parentSuspense,
  2857. namespace,
  2858. vnode.slotScopeIds,
  2859. optimized
  2860. );
  2861. queuePostRenderEffect(() => {
  2862. instance2.isDeactivated = false;
  2863. if (instance2.a) {
  2864. invokeArrayFns(instance2.a);
  2865. }
  2866. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  2867. if (vnodeHook) {
  2868. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2869. }
  2870. }, parentSuspense);
  2871. {
  2872. devtoolsComponentAdded(instance2);
  2873. }
  2874. };
  2875. sharedContext.deactivate = (vnode) => {
  2876. const instance2 = vnode.component;
  2877. invalidateMount(instance2.m);
  2878. invalidateMount(instance2.a);
  2879. move(vnode, storageContainer, null, 1, parentSuspense);
  2880. queuePostRenderEffect(() => {
  2881. if (instance2.da) {
  2882. invokeArrayFns(instance2.da);
  2883. }
  2884. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  2885. if (vnodeHook) {
  2886. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2887. }
  2888. instance2.isDeactivated = true;
  2889. }, parentSuspense);
  2890. {
  2891. devtoolsComponentAdded(instance2);
  2892. }
  2893. };
  2894. function unmount(vnode) {
  2895. resetShapeFlag(vnode);
  2896. _unmount(vnode, instance, parentSuspense, true);
  2897. }
  2898. function pruneCache(filter) {
  2899. cache.forEach((vnode, key) => {
  2900. const name = getComponentName(vnode.type);
  2901. if (name && (!filter || !filter(name))) {
  2902. pruneCacheEntry(key);
  2903. }
  2904. });
  2905. }
  2906. function pruneCacheEntry(key) {
  2907. const cached = cache.get(key);
  2908. if (cached && (!current || !isSameVNodeType(cached, current))) {
  2909. unmount(cached);
  2910. } else if (current) {
  2911. resetShapeFlag(current);
  2912. }
  2913. cache.delete(key);
  2914. keys.delete(key);
  2915. }
  2916. watch(
  2917. () => [props.include, props.exclude],
  2918. ([include, exclude]) => {
  2919. include && pruneCache((name) => matches(include, name));
  2920. exclude && pruneCache((name) => !matches(exclude, name));
  2921. },
  2922. // prune post-render after `current` has been updated
  2923. { flush: "post", deep: true }
  2924. );
  2925. let pendingCacheKey = null;
  2926. const cacheSubtree = () => {
  2927. if (pendingCacheKey != null) {
  2928. if (isSuspense(instance.subTree.type)) {
  2929. queuePostRenderEffect(() => {
  2930. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2931. }, instance.subTree.suspense);
  2932. } else {
  2933. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2934. }
  2935. }
  2936. };
  2937. onMounted(cacheSubtree);
  2938. onUpdated(cacheSubtree);
  2939. onBeforeUnmount(() => {
  2940. cache.forEach((cached) => {
  2941. const { subTree, suspense } = instance;
  2942. const vnode = getInnerChild(subTree);
  2943. if (cached.type === vnode.type && cached.key === vnode.key) {
  2944. resetShapeFlag(vnode);
  2945. const da = vnode.component.da;
  2946. da && queuePostRenderEffect(da, suspense);
  2947. return;
  2948. }
  2949. unmount(cached);
  2950. });
  2951. });
  2952. return () => {
  2953. pendingCacheKey = null;
  2954. if (!slots.default) {
  2955. return null;
  2956. }
  2957. const children = slots.default();
  2958. const rawVNode = children[0];
  2959. if (children.length > 1) {
  2960. {
  2961. warn$1(`KeepAlive should contain exactly one component child.`);
  2962. }
  2963. current = null;
  2964. return children;
  2965. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2966. current = null;
  2967. return rawVNode;
  2968. }
  2969. let vnode = getInnerChild(rawVNode);
  2970. if (vnode.type === Comment) {
  2971. current = null;
  2972. return vnode;
  2973. }
  2974. const comp = vnode.type;
  2975. const name = getComponentName(
  2976. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2977. );
  2978. const { include, exclude, max } = props;
  2979. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2980. current = vnode;
  2981. return rawVNode;
  2982. }
  2983. const key = vnode.key == null ? comp : vnode.key;
  2984. const cachedVNode = cache.get(key);
  2985. if (vnode.el) {
  2986. vnode = cloneVNode(vnode);
  2987. if (rawVNode.shapeFlag & 128) {
  2988. rawVNode.ssContent = vnode;
  2989. }
  2990. }
  2991. pendingCacheKey = key;
  2992. if (cachedVNode) {
  2993. vnode.el = cachedVNode.el;
  2994. vnode.component = cachedVNode.component;
  2995. if (vnode.transition) {
  2996. setTransitionHooks(vnode, vnode.transition);
  2997. }
  2998. vnode.shapeFlag |= 512;
  2999. keys.delete(key);
  3000. keys.add(key);
  3001. } else {
  3002. keys.add(key);
  3003. if (max && keys.size > parseInt(max, 10)) {
  3004. pruneCacheEntry(keys.values().next().value);
  3005. }
  3006. }
  3007. vnode.shapeFlag |= 256;
  3008. current = vnode;
  3009. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3010. };
  3011. }
  3012. };
  3013. const KeepAlive = KeepAliveImpl;
  3014. function matches(pattern, name) {
  3015. if (isArray(pattern)) {
  3016. return pattern.some((p) => matches(p, name));
  3017. } else if (isString(pattern)) {
  3018. return pattern.split(",").includes(name);
  3019. } else if (isRegExp(pattern)) {
  3020. return pattern.test(name);
  3021. }
  3022. return false;
  3023. }
  3024. function onActivated(hook, target) {
  3025. registerKeepAliveHook(hook, "a", target);
  3026. }
  3027. function onDeactivated(hook, target) {
  3028. registerKeepAliveHook(hook, "da", target);
  3029. }
  3030. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3031. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3032. let current = target;
  3033. while (current) {
  3034. if (current.isDeactivated) {
  3035. return;
  3036. }
  3037. current = current.parent;
  3038. }
  3039. return hook();
  3040. });
  3041. injectHook(type, wrappedHook, target);
  3042. if (target) {
  3043. let current = target.parent;
  3044. while (current && current.parent) {
  3045. if (isKeepAlive(current.parent.vnode)) {
  3046. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3047. }
  3048. current = current.parent;
  3049. }
  3050. }
  3051. }
  3052. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3053. const injected = injectHook(
  3054. type,
  3055. hook,
  3056. keepAliveRoot,
  3057. true
  3058. /* prepend */
  3059. );
  3060. onUnmounted(() => {
  3061. remove(keepAliveRoot[type], injected);
  3062. }, target);
  3063. }
  3064. function resetShapeFlag(vnode) {
  3065. vnode.shapeFlag &= ~256;
  3066. vnode.shapeFlag &= ~512;
  3067. }
  3068. function getInnerChild(vnode) {
  3069. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  3070. }
  3071. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3072. if (target) {
  3073. const hooks = target[type] || (target[type] = []);
  3074. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3075. pauseTracking();
  3076. const reset = setCurrentInstance(target);
  3077. const res = callWithAsyncErrorHandling(hook, target, type, args);
  3078. reset();
  3079. resetTracking();
  3080. return res;
  3081. });
  3082. if (prepend) {
  3083. hooks.unshift(wrappedHook);
  3084. } else {
  3085. hooks.push(wrappedHook);
  3086. }
  3087. return wrappedHook;
  3088. } else {
  3089. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  3090. warn$1(
  3091. `${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.` )
  3092. );
  3093. }
  3094. }
  3095. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  3096. if (!isInSSRComponentSetup || lifecycle === "sp") {
  3097. injectHook(lifecycle, (...args) => hook(...args), target);
  3098. }
  3099. };
  3100. const onBeforeMount = createHook("bm");
  3101. const onMounted = createHook("m");
  3102. const onBeforeUpdate = createHook("bu");
  3103. const onUpdated = createHook("u");
  3104. const onBeforeUnmount = createHook("bum");
  3105. const onUnmounted = createHook("um");
  3106. const onServerPrefetch = createHook("sp");
  3107. const onRenderTriggered = createHook(
  3108. "rtg"
  3109. );
  3110. const onRenderTracked = createHook(
  3111. "rtc"
  3112. );
  3113. function onErrorCaptured(hook, target = currentInstance) {
  3114. injectHook("ec", hook, target);
  3115. }
  3116. const COMPONENTS = "components";
  3117. const DIRECTIVES = "directives";
  3118. function resolveComponent(name, maybeSelfReference) {
  3119. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  3120. }
  3121. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  3122. function resolveDynamicComponent(component) {
  3123. if (isString(component)) {
  3124. return resolveAsset(COMPONENTS, component, false) || component;
  3125. } else {
  3126. return component || NULL_DYNAMIC_COMPONENT;
  3127. }
  3128. }
  3129. function resolveDirective(name) {
  3130. return resolveAsset(DIRECTIVES, name);
  3131. }
  3132. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  3133. const instance = currentRenderingInstance || currentInstance;
  3134. if (instance) {
  3135. const Component = instance.type;
  3136. if (type === COMPONENTS) {
  3137. const selfName = getComponentName(
  3138. Component,
  3139. false
  3140. );
  3141. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  3142. return Component;
  3143. }
  3144. }
  3145. const res = (
  3146. // local registration
  3147. // check instance[type] first which is resolved for options API
  3148. resolve(instance[type] || Component[type], name) || // global registration
  3149. resolve(instance.appContext[type], name)
  3150. );
  3151. if (!res && maybeSelfReference) {
  3152. return Component;
  3153. }
  3154. if (warnMissing && !res) {
  3155. const extra = type === COMPONENTS ? `
  3156. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  3157. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  3158. }
  3159. return res;
  3160. } else {
  3161. warn$1(
  3162. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  3163. );
  3164. }
  3165. }
  3166. function resolve(registry, name) {
  3167. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  3168. }
  3169. function renderList(source, renderItem, cache, index) {
  3170. let ret;
  3171. const cached = cache && cache[index];
  3172. if (isArray(source) || isString(source)) {
  3173. ret = new Array(source.length);
  3174. for (let i = 0, l = source.length; i < l; i++) {
  3175. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  3176. }
  3177. } else if (typeof source === "number") {
  3178. if (!Number.isInteger(source)) {
  3179. warn$1(`The v-for range expect an integer value but got ${source}.`);
  3180. }
  3181. ret = new Array(source);
  3182. for (let i = 0; i < source; i++) {
  3183. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  3184. }
  3185. } else if (isObject(source)) {
  3186. if (source[Symbol.iterator]) {
  3187. ret = Array.from(
  3188. source,
  3189. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  3190. );
  3191. } else {
  3192. const keys = Object.keys(source);
  3193. ret = new Array(keys.length);
  3194. for (let i = 0, l = keys.length; i < l; i++) {
  3195. const key = keys[i];
  3196. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  3197. }
  3198. }
  3199. } else {
  3200. ret = [];
  3201. }
  3202. if (cache) {
  3203. cache[index] = ret;
  3204. }
  3205. return ret;
  3206. }
  3207. function createSlots(slots, dynamicSlots) {
  3208. for (let i = 0; i < dynamicSlots.length; i++) {
  3209. const slot = dynamicSlots[i];
  3210. if (isArray(slot)) {
  3211. for (let j = 0; j < slot.length; j++) {
  3212. slots[slot[j].name] = slot[j].fn;
  3213. }
  3214. } else if (slot) {
  3215. slots[slot.name] = slot.key ? (...args) => {
  3216. const res = slot.fn(...args);
  3217. if (res) res.key = slot.key;
  3218. return res;
  3219. } : slot.fn;
  3220. }
  3221. }
  3222. return slots;
  3223. }
  3224. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  3225. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  3226. if (name !== "default") props.name = name;
  3227. return createVNode("slot", props, fallback && fallback());
  3228. }
  3229. let slot = slots[name];
  3230. if (slot && slot.length > 1) {
  3231. warn$1(
  3232. `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.`
  3233. );
  3234. slot = () => [];
  3235. }
  3236. if (slot && slot._c) {
  3237. slot._d = false;
  3238. }
  3239. openBlock();
  3240. const validSlotContent = slot && ensureValidVNode(slot(props));
  3241. const rendered = createBlock(
  3242. Fragment,
  3243. {
  3244. key: (props.key || // slot content array of a dynamic conditional slot may have a branch
  3245. // key attached in the `createSlots` helper, respect that
  3246. validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
  3247. (!validSlotContent && fallback ? "_fb" : "")
  3248. },
  3249. validSlotContent || (fallback ? fallback() : []),
  3250. validSlotContent && slots._ === 1 ? 64 : -2
  3251. );
  3252. if (!noSlotted && rendered.scopeId) {
  3253. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  3254. }
  3255. if (slot && slot._c) {
  3256. slot._d = true;
  3257. }
  3258. return rendered;
  3259. }
  3260. function ensureValidVNode(vnodes) {
  3261. return vnodes.some((child) => {
  3262. if (!isVNode(child)) return true;
  3263. if (child.type === Comment) return false;
  3264. if (child.type === Fragment && !ensureValidVNode(child.children))
  3265. return false;
  3266. return true;
  3267. }) ? vnodes : null;
  3268. }
  3269. function toHandlers(obj, preserveCaseIfNecessary) {
  3270. const ret = {};
  3271. if (!isObject(obj)) {
  3272. warn$1(`v-on with no argument expects an object value.`);
  3273. return ret;
  3274. }
  3275. for (const key in obj) {
  3276. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  3277. }
  3278. return ret;
  3279. }
  3280. const getPublicInstance = (i) => {
  3281. if (!i) return null;
  3282. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  3283. return getPublicInstance(i.parent);
  3284. };
  3285. const publicPropertiesMap = (
  3286. // Move PURE marker to new line to workaround compiler discarding it
  3287. // due to type annotation
  3288. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  3289. $: (i) => i,
  3290. $el: (i) => i.vnode.el,
  3291. $data: (i) => i.data,
  3292. $props: (i) => shallowReadonly(i.props) ,
  3293. $attrs: (i) => shallowReadonly(i.attrs) ,
  3294. $slots: (i) => shallowReadonly(i.slots) ,
  3295. $refs: (i) => shallowReadonly(i.refs) ,
  3296. $parent: (i) => getPublicInstance(i.parent),
  3297. $root: (i) => getPublicInstance(i.root),
  3298. $emit: (i) => i.emit,
  3299. $options: (i) => resolveMergedOptions(i) ,
  3300. $forceUpdate: (i) => i.f || (i.f = () => {
  3301. i.effect.dirty = true;
  3302. queueJob(i.update);
  3303. }),
  3304. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  3305. $watch: (i) => instanceWatch.bind(i)
  3306. })
  3307. );
  3308. const isReservedPrefix = (key) => key === "_" || key === "$";
  3309. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  3310. const PublicInstanceProxyHandlers = {
  3311. get({ _: instance }, key) {
  3312. if (key === "__v_skip") {
  3313. return true;
  3314. }
  3315. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  3316. if (key === "__isVue") {
  3317. return true;
  3318. }
  3319. let normalizedProps;
  3320. if (key[0] !== "$") {
  3321. const n = accessCache[key];
  3322. if (n !== void 0) {
  3323. switch (n) {
  3324. case 1 /* SETUP */:
  3325. return setupState[key];
  3326. case 2 /* DATA */:
  3327. return data[key];
  3328. case 4 /* CONTEXT */:
  3329. return ctx[key];
  3330. case 3 /* PROPS */:
  3331. return props[key];
  3332. }
  3333. } else if (hasSetupBinding(setupState, key)) {
  3334. accessCache[key] = 1 /* SETUP */;
  3335. return setupState[key];
  3336. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3337. accessCache[key] = 2 /* DATA */;
  3338. return data[key];
  3339. } else if (
  3340. // only cache other properties when instance has declared (thus stable)
  3341. // props
  3342. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  3343. ) {
  3344. accessCache[key] = 3 /* PROPS */;
  3345. return props[key];
  3346. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3347. accessCache[key] = 4 /* CONTEXT */;
  3348. return ctx[key];
  3349. } else if (shouldCacheAccess) {
  3350. accessCache[key] = 0 /* OTHER */;
  3351. }
  3352. }
  3353. const publicGetter = publicPropertiesMap[key];
  3354. let cssModule, globalProperties;
  3355. if (publicGetter) {
  3356. if (key === "$attrs") {
  3357. track(instance.attrs, "get", "");
  3358. markAttrsAccessed();
  3359. } else if (key === "$slots") {
  3360. track(instance, "get", key);
  3361. }
  3362. return publicGetter(instance);
  3363. } else if (
  3364. // css module (injected by vue-loader)
  3365. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  3366. ) {
  3367. return cssModule;
  3368. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3369. accessCache[key] = 4 /* CONTEXT */;
  3370. return ctx[key];
  3371. } else if (
  3372. // global properties
  3373. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  3374. ) {
  3375. {
  3376. return globalProperties[key];
  3377. }
  3378. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  3379. // to infinite warning loop
  3380. key.indexOf("__v") !== 0)) {
  3381. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  3382. warn$1(
  3383. `Property ${JSON.stringify(
  3384. key
  3385. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  3386. );
  3387. } else if (instance === currentRenderingInstance) {
  3388. warn$1(
  3389. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  3390. );
  3391. }
  3392. }
  3393. },
  3394. set({ _: instance }, key, value) {
  3395. const { data, setupState, ctx } = instance;
  3396. if (hasSetupBinding(setupState, key)) {
  3397. setupState[key] = value;
  3398. return true;
  3399. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  3400. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  3401. return false;
  3402. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3403. data[key] = value;
  3404. return true;
  3405. } else if (hasOwn(instance.props, key)) {
  3406. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  3407. return false;
  3408. }
  3409. if (key[0] === "$" && key.slice(1) in instance) {
  3410. warn$1(
  3411. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  3412. );
  3413. return false;
  3414. } else {
  3415. if (key in instance.appContext.config.globalProperties) {
  3416. Object.defineProperty(ctx, key, {
  3417. enumerable: true,
  3418. configurable: true,
  3419. value
  3420. });
  3421. } else {
  3422. ctx[key] = value;
  3423. }
  3424. }
  3425. return true;
  3426. },
  3427. has({
  3428. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  3429. }, key) {
  3430. let normalizedProps;
  3431. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  3432. },
  3433. defineProperty(target, key, descriptor) {
  3434. if (descriptor.get != null) {
  3435. target._.accessCache[key] = 0;
  3436. } else if (hasOwn(descriptor, "value")) {
  3437. this.set(target, key, descriptor.value, null);
  3438. }
  3439. return Reflect.defineProperty(target, key, descriptor);
  3440. }
  3441. };
  3442. {
  3443. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3444. warn$1(
  3445. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  3446. );
  3447. return Reflect.ownKeys(target);
  3448. };
  3449. }
  3450. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  3451. {},
  3452. PublicInstanceProxyHandlers,
  3453. {
  3454. get(target, key) {
  3455. if (key === Symbol.unscopables) {
  3456. return;
  3457. }
  3458. return PublicInstanceProxyHandlers.get(target, key, target);
  3459. },
  3460. has(_, key) {
  3461. const has = key[0] !== "_" && !isGloballyAllowed(key);
  3462. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  3463. warn$1(
  3464. `Property ${JSON.stringify(
  3465. key
  3466. )} should not start with _ which is a reserved prefix for Vue internals.`
  3467. );
  3468. }
  3469. return has;
  3470. }
  3471. }
  3472. );
  3473. function createDevRenderContext(instance) {
  3474. const target = {};
  3475. Object.defineProperty(target, `_`, {
  3476. configurable: true,
  3477. enumerable: false,
  3478. get: () => instance
  3479. });
  3480. Object.keys(publicPropertiesMap).forEach((key) => {
  3481. Object.defineProperty(target, key, {
  3482. configurable: true,
  3483. enumerable: false,
  3484. get: () => publicPropertiesMap[key](instance),
  3485. // intercepted by the proxy so no need for implementation,
  3486. // but needed to prevent set errors
  3487. set: NOOP
  3488. });
  3489. });
  3490. return target;
  3491. }
  3492. function exposePropsOnRenderContext(instance) {
  3493. const {
  3494. ctx,
  3495. propsOptions: [propsOptions]
  3496. } = instance;
  3497. if (propsOptions) {
  3498. Object.keys(propsOptions).forEach((key) => {
  3499. Object.defineProperty(ctx, key, {
  3500. enumerable: true,
  3501. configurable: true,
  3502. get: () => instance.props[key],
  3503. set: NOOP
  3504. });
  3505. });
  3506. }
  3507. }
  3508. function exposeSetupStateOnRenderContext(instance) {
  3509. const { ctx, setupState } = instance;
  3510. Object.keys(toRaw(setupState)).forEach((key) => {
  3511. if (!setupState.__isScriptSetup) {
  3512. if (isReservedPrefix(key[0])) {
  3513. warn$1(
  3514. `setup() return property ${JSON.stringify(
  3515. key
  3516. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  3517. );
  3518. return;
  3519. }
  3520. Object.defineProperty(ctx, key, {
  3521. enumerable: true,
  3522. configurable: true,
  3523. get: () => setupState[key],
  3524. set: NOOP
  3525. });
  3526. }
  3527. });
  3528. }
  3529. const warnRuntimeUsage = (method) => warn$1(
  3530. `${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.`
  3531. );
  3532. function defineProps() {
  3533. {
  3534. warnRuntimeUsage(`defineProps`);
  3535. }
  3536. return null;
  3537. }
  3538. function defineEmits() {
  3539. {
  3540. warnRuntimeUsage(`defineEmits`);
  3541. }
  3542. return null;
  3543. }
  3544. function defineExpose(exposed) {
  3545. {
  3546. warnRuntimeUsage(`defineExpose`);
  3547. }
  3548. }
  3549. function defineOptions(options) {
  3550. {
  3551. warnRuntimeUsage(`defineOptions`);
  3552. }
  3553. }
  3554. function defineSlots() {
  3555. {
  3556. warnRuntimeUsage(`defineSlots`);
  3557. }
  3558. return null;
  3559. }
  3560. function defineModel() {
  3561. {
  3562. warnRuntimeUsage("defineModel");
  3563. }
  3564. }
  3565. function withDefaults(props, defaults) {
  3566. {
  3567. warnRuntimeUsage(`withDefaults`);
  3568. }
  3569. return null;
  3570. }
  3571. function useSlots() {
  3572. return getContext().slots;
  3573. }
  3574. function useAttrs() {
  3575. return getContext().attrs;
  3576. }
  3577. function getContext() {
  3578. const i = getCurrentInstance();
  3579. if (!i) {
  3580. warn$1(`useContext() called without active instance.`);
  3581. }
  3582. return i.setupContext || (i.setupContext = createSetupContext(i));
  3583. }
  3584. function normalizePropsOrEmits(props) {
  3585. return isArray(props) ? props.reduce(
  3586. (normalized, p) => (normalized[p] = null, normalized),
  3587. {}
  3588. ) : props;
  3589. }
  3590. function mergeDefaults(raw, defaults) {
  3591. const props = normalizePropsOrEmits(raw);
  3592. for (const key in defaults) {
  3593. if (key.startsWith("__skip")) continue;
  3594. let opt = props[key];
  3595. if (opt) {
  3596. if (isArray(opt) || isFunction(opt)) {
  3597. opt = props[key] = { type: opt, default: defaults[key] };
  3598. } else {
  3599. opt.default = defaults[key];
  3600. }
  3601. } else if (opt === null) {
  3602. opt = props[key] = { default: defaults[key] };
  3603. } else {
  3604. warn$1(`props default key "${key}" has no corresponding declaration.`);
  3605. }
  3606. if (opt && defaults[`__skip_${key}`]) {
  3607. opt.skipFactory = true;
  3608. }
  3609. }
  3610. return props;
  3611. }
  3612. function mergeModels(a, b) {
  3613. if (!a || !b) return a || b;
  3614. if (isArray(a) && isArray(b)) return a.concat(b);
  3615. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  3616. }
  3617. function createPropsRestProxy(props, excludedKeys) {
  3618. const ret = {};
  3619. for (const key in props) {
  3620. if (!excludedKeys.includes(key)) {
  3621. Object.defineProperty(ret, key, {
  3622. enumerable: true,
  3623. get: () => props[key]
  3624. });
  3625. }
  3626. }
  3627. return ret;
  3628. }
  3629. function withAsyncContext(getAwaitable) {
  3630. const ctx = getCurrentInstance();
  3631. if (!ctx) {
  3632. warn$1(
  3633. `withAsyncContext called without active current instance. This is likely a bug.`
  3634. );
  3635. }
  3636. let awaitable = getAwaitable();
  3637. unsetCurrentInstance();
  3638. if (isPromise(awaitable)) {
  3639. awaitable = awaitable.catch((e) => {
  3640. setCurrentInstance(ctx);
  3641. throw e;
  3642. });
  3643. }
  3644. return [awaitable, () => setCurrentInstance(ctx)];
  3645. }
  3646. function createDuplicateChecker() {
  3647. const cache = /* @__PURE__ */ Object.create(null);
  3648. return (type, key) => {
  3649. if (cache[key]) {
  3650. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3651. } else {
  3652. cache[key] = type;
  3653. }
  3654. };
  3655. }
  3656. let shouldCacheAccess = true;
  3657. function applyOptions(instance) {
  3658. const options = resolveMergedOptions(instance);
  3659. const publicThis = instance.proxy;
  3660. const ctx = instance.ctx;
  3661. shouldCacheAccess = false;
  3662. if (options.beforeCreate) {
  3663. callHook$1(options.beforeCreate, instance, "bc");
  3664. }
  3665. const {
  3666. // state
  3667. data: dataOptions,
  3668. computed: computedOptions,
  3669. methods,
  3670. watch: watchOptions,
  3671. provide: provideOptions,
  3672. inject: injectOptions,
  3673. // lifecycle
  3674. created,
  3675. beforeMount,
  3676. mounted,
  3677. beforeUpdate,
  3678. updated,
  3679. activated,
  3680. deactivated,
  3681. beforeDestroy,
  3682. beforeUnmount,
  3683. destroyed,
  3684. unmounted,
  3685. render,
  3686. renderTracked,
  3687. renderTriggered,
  3688. errorCaptured,
  3689. serverPrefetch,
  3690. // public API
  3691. expose,
  3692. inheritAttrs,
  3693. // assets
  3694. components,
  3695. directives,
  3696. filters
  3697. } = options;
  3698. const checkDuplicateProperties = createDuplicateChecker() ;
  3699. {
  3700. const [propsOptions] = instance.propsOptions;
  3701. if (propsOptions) {
  3702. for (const key in propsOptions) {
  3703. checkDuplicateProperties("Props" /* PROPS */, key);
  3704. }
  3705. }
  3706. }
  3707. if (injectOptions) {
  3708. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  3709. }
  3710. if (methods) {
  3711. for (const key in methods) {
  3712. const methodHandler = methods[key];
  3713. if (isFunction(methodHandler)) {
  3714. {
  3715. Object.defineProperty(ctx, key, {
  3716. value: methodHandler.bind(publicThis),
  3717. configurable: true,
  3718. enumerable: true,
  3719. writable: true
  3720. });
  3721. }
  3722. {
  3723. checkDuplicateProperties("Methods" /* METHODS */, key);
  3724. }
  3725. } else {
  3726. warn$1(
  3727. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  3728. );
  3729. }
  3730. }
  3731. }
  3732. if (dataOptions) {
  3733. if (!isFunction(dataOptions)) {
  3734. warn$1(
  3735. `The data option must be a function. Plain object usage is no longer supported.`
  3736. );
  3737. }
  3738. const data = dataOptions.call(publicThis, publicThis);
  3739. if (isPromise(data)) {
  3740. warn$1(
  3741. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  3742. );
  3743. }
  3744. if (!isObject(data)) {
  3745. warn$1(`data() should return an object.`);
  3746. } else {
  3747. instance.data = reactive(data);
  3748. {
  3749. for (const key in data) {
  3750. checkDuplicateProperties("Data" /* DATA */, key);
  3751. if (!isReservedPrefix(key[0])) {
  3752. Object.defineProperty(ctx, key, {
  3753. configurable: true,
  3754. enumerable: true,
  3755. get: () => data[key],
  3756. set: NOOP
  3757. });
  3758. }
  3759. }
  3760. }
  3761. }
  3762. }
  3763. shouldCacheAccess = true;
  3764. if (computedOptions) {
  3765. for (const key in computedOptions) {
  3766. const opt = computedOptions[key];
  3767. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  3768. if (get === NOOP) {
  3769. warn$1(`Computed property "${key}" has no getter.`);
  3770. }
  3771. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  3772. warn$1(
  3773. `Write operation failed: computed property "${key}" is readonly.`
  3774. );
  3775. } ;
  3776. const c = computed({
  3777. get,
  3778. set
  3779. });
  3780. Object.defineProperty(ctx, key, {
  3781. enumerable: true,
  3782. configurable: true,
  3783. get: () => c.value,
  3784. set: (v) => c.value = v
  3785. });
  3786. {
  3787. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  3788. }
  3789. }
  3790. }
  3791. if (watchOptions) {
  3792. for (const key in watchOptions) {
  3793. createWatcher(watchOptions[key], ctx, publicThis, key);
  3794. }
  3795. }
  3796. if (provideOptions) {
  3797. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3798. Reflect.ownKeys(provides).forEach((key) => {
  3799. provide(key, provides[key]);
  3800. });
  3801. }
  3802. if (created) {
  3803. callHook$1(created, instance, "c");
  3804. }
  3805. function registerLifecycleHook(register, hook) {
  3806. if (isArray(hook)) {
  3807. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3808. } else if (hook) {
  3809. register(hook.bind(publicThis));
  3810. }
  3811. }
  3812. registerLifecycleHook(onBeforeMount, beforeMount);
  3813. registerLifecycleHook(onMounted, mounted);
  3814. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3815. registerLifecycleHook(onUpdated, updated);
  3816. registerLifecycleHook(onActivated, activated);
  3817. registerLifecycleHook(onDeactivated, deactivated);
  3818. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3819. registerLifecycleHook(onRenderTracked, renderTracked);
  3820. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3821. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3822. registerLifecycleHook(onUnmounted, unmounted);
  3823. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3824. if (isArray(expose)) {
  3825. if (expose.length) {
  3826. const exposed = instance.exposed || (instance.exposed = {});
  3827. expose.forEach((key) => {
  3828. Object.defineProperty(exposed, key, {
  3829. get: () => publicThis[key],
  3830. set: (val) => publicThis[key] = val
  3831. });
  3832. });
  3833. } else if (!instance.exposed) {
  3834. instance.exposed = {};
  3835. }
  3836. }
  3837. if (render && instance.render === NOOP) {
  3838. instance.render = render;
  3839. }
  3840. if (inheritAttrs != null) {
  3841. instance.inheritAttrs = inheritAttrs;
  3842. }
  3843. if (components) instance.components = components;
  3844. if (directives) instance.directives = directives;
  3845. }
  3846. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3847. if (isArray(injectOptions)) {
  3848. injectOptions = normalizeInject(injectOptions);
  3849. }
  3850. for (const key in injectOptions) {
  3851. const opt = injectOptions[key];
  3852. let injected;
  3853. if (isObject(opt)) {
  3854. if ("default" in opt) {
  3855. injected = inject(
  3856. opt.from || key,
  3857. opt.default,
  3858. true
  3859. );
  3860. } else {
  3861. injected = inject(opt.from || key);
  3862. }
  3863. } else {
  3864. injected = inject(opt);
  3865. }
  3866. if (isRef(injected)) {
  3867. Object.defineProperty(ctx, key, {
  3868. enumerable: true,
  3869. configurable: true,
  3870. get: () => injected.value,
  3871. set: (v) => injected.value = v
  3872. });
  3873. } else {
  3874. ctx[key] = injected;
  3875. }
  3876. {
  3877. checkDuplicateProperties("Inject" /* INJECT */, key);
  3878. }
  3879. }
  3880. }
  3881. function callHook$1(hook, instance, type) {
  3882. callWithAsyncErrorHandling(
  3883. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  3884. instance,
  3885. type
  3886. );
  3887. }
  3888. function createWatcher(raw, ctx, publicThis, key) {
  3889. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3890. if (isString(raw)) {
  3891. const handler = ctx[raw];
  3892. if (isFunction(handler)) {
  3893. watch(getter, handler);
  3894. } else {
  3895. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3896. }
  3897. } else if (isFunction(raw)) {
  3898. watch(getter, raw.bind(publicThis));
  3899. } else if (isObject(raw)) {
  3900. if (isArray(raw)) {
  3901. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  3902. } else {
  3903. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3904. if (isFunction(handler)) {
  3905. watch(getter, handler, raw);
  3906. } else {
  3907. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3908. }
  3909. }
  3910. } else {
  3911. warn$1(`Invalid watch option: "${key}"`, raw);
  3912. }
  3913. }
  3914. function resolveMergedOptions(instance) {
  3915. const base = instance.type;
  3916. const { mixins, extends: extendsOptions } = base;
  3917. const {
  3918. mixins: globalMixins,
  3919. optionsCache: cache,
  3920. config: { optionMergeStrategies }
  3921. } = instance.appContext;
  3922. const cached = cache.get(base);
  3923. let resolved;
  3924. if (cached) {
  3925. resolved = cached;
  3926. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3927. {
  3928. resolved = base;
  3929. }
  3930. } else {
  3931. resolved = {};
  3932. if (globalMixins.length) {
  3933. globalMixins.forEach(
  3934. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  3935. );
  3936. }
  3937. mergeOptions(resolved, base, optionMergeStrategies);
  3938. }
  3939. if (isObject(base)) {
  3940. cache.set(base, resolved);
  3941. }
  3942. return resolved;
  3943. }
  3944. function mergeOptions(to, from, strats, asMixin = false) {
  3945. const { mixins, extends: extendsOptions } = from;
  3946. if (extendsOptions) {
  3947. mergeOptions(to, extendsOptions, strats, true);
  3948. }
  3949. if (mixins) {
  3950. mixins.forEach(
  3951. (m) => mergeOptions(to, m, strats, true)
  3952. );
  3953. }
  3954. for (const key in from) {
  3955. if (asMixin && key === "expose") {
  3956. warn$1(
  3957. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3958. );
  3959. } else {
  3960. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3961. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3962. }
  3963. }
  3964. return to;
  3965. }
  3966. const internalOptionMergeStrats = {
  3967. data: mergeDataFn,
  3968. props: mergeEmitsOrPropsOptions,
  3969. emits: mergeEmitsOrPropsOptions,
  3970. // objects
  3971. methods: mergeObjectOptions,
  3972. computed: mergeObjectOptions,
  3973. // lifecycle
  3974. beforeCreate: mergeAsArray$1,
  3975. created: mergeAsArray$1,
  3976. beforeMount: mergeAsArray$1,
  3977. mounted: mergeAsArray$1,
  3978. beforeUpdate: mergeAsArray$1,
  3979. updated: mergeAsArray$1,
  3980. beforeDestroy: mergeAsArray$1,
  3981. beforeUnmount: mergeAsArray$1,
  3982. destroyed: mergeAsArray$1,
  3983. unmounted: mergeAsArray$1,
  3984. activated: mergeAsArray$1,
  3985. deactivated: mergeAsArray$1,
  3986. errorCaptured: mergeAsArray$1,
  3987. serverPrefetch: mergeAsArray$1,
  3988. // assets
  3989. components: mergeObjectOptions,
  3990. directives: mergeObjectOptions,
  3991. // watch
  3992. watch: mergeWatchOptions,
  3993. // provide / inject
  3994. provide: mergeDataFn,
  3995. inject: mergeInject
  3996. };
  3997. function mergeDataFn(to, from) {
  3998. if (!from) {
  3999. return to;
  4000. }
  4001. if (!to) {
  4002. return from;
  4003. }
  4004. return function mergedDataFn() {
  4005. return (extend)(
  4006. isFunction(to) ? to.call(this, this) : to,
  4007. isFunction(from) ? from.call(this, this) : from
  4008. );
  4009. };
  4010. }
  4011. function mergeInject(to, from) {
  4012. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4013. }
  4014. function normalizeInject(raw) {
  4015. if (isArray(raw)) {
  4016. const res = {};
  4017. for (let i = 0; i < raw.length; i++) {
  4018. res[raw[i]] = raw[i];
  4019. }
  4020. return res;
  4021. }
  4022. return raw;
  4023. }
  4024. function mergeAsArray$1(to, from) {
  4025. return to ? [...new Set([].concat(to, from))] : from;
  4026. }
  4027. function mergeObjectOptions(to, from) {
  4028. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  4029. }
  4030. function mergeEmitsOrPropsOptions(to, from) {
  4031. if (to) {
  4032. if (isArray(to) && isArray(from)) {
  4033. return [.../* @__PURE__ */ new Set([...to, ...from])];
  4034. }
  4035. return extend(
  4036. /* @__PURE__ */ Object.create(null),
  4037. normalizePropsOrEmits(to),
  4038. normalizePropsOrEmits(from != null ? from : {})
  4039. );
  4040. } else {
  4041. return from;
  4042. }
  4043. }
  4044. function mergeWatchOptions(to, from) {
  4045. if (!to) return from;
  4046. if (!from) return to;
  4047. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  4048. for (const key in from) {
  4049. merged[key] = mergeAsArray$1(to[key], from[key]);
  4050. }
  4051. return merged;
  4052. }
  4053. function createAppContext() {
  4054. return {
  4055. app: null,
  4056. config: {
  4057. isNativeTag: NO,
  4058. performance: false,
  4059. globalProperties: {},
  4060. optionMergeStrategies: {},
  4061. errorHandler: void 0,
  4062. warnHandler: void 0,
  4063. compilerOptions: {}
  4064. },
  4065. mixins: [],
  4066. components: {},
  4067. directives: {},
  4068. provides: /* @__PURE__ */ Object.create(null),
  4069. optionsCache: /* @__PURE__ */ new WeakMap(),
  4070. propsCache: /* @__PURE__ */ new WeakMap(),
  4071. emitsCache: /* @__PURE__ */ new WeakMap()
  4072. };
  4073. }
  4074. let uid$1 = 0;
  4075. function createAppAPI(render, hydrate) {
  4076. return function createApp(rootComponent, rootProps = null) {
  4077. if (!isFunction(rootComponent)) {
  4078. rootComponent = extend({}, rootComponent);
  4079. }
  4080. if (rootProps != null && !isObject(rootProps)) {
  4081. warn$1(`root props passed to app.mount() must be an object.`);
  4082. rootProps = null;
  4083. }
  4084. const context = createAppContext();
  4085. const installedPlugins = /* @__PURE__ */ new WeakSet();
  4086. let isMounted = false;
  4087. const app = context.app = {
  4088. _uid: uid$1++,
  4089. _component: rootComponent,
  4090. _props: rootProps,
  4091. _container: null,
  4092. _context: context,
  4093. _instance: null,
  4094. version,
  4095. get config() {
  4096. return context.config;
  4097. },
  4098. set config(v) {
  4099. {
  4100. warn$1(
  4101. `app.config cannot be replaced. Modify individual options instead.`
  4102. );
  4103. }
  4104. },
  4105. use(plugin, ...options) {
  4106. if (installedPlugins.has(plugin)) {
  4107. warn$1(`Plugin has already been applied to target app.`);
  4108. } else if (plugin && isFunction(plugin.install)) {
  4109. installedPlugins.add(plugin);
  4110. plugin.install(app, ...options);
  4111. } else if (isFunction(plugin)) {
  4112. installedPlugins.add(plugin);
  4113. plugin(app, ...options);
  4114. } else {
  4115. warn$1(
  4116. `A plugin must either be a function or an object with an "install" function.`
  4117. );
  4118. }
  4119. return app;
  4120. },
  4121. mixin(mixin) {
  4122. {
  4123. if (!context.mixins.includes(mixin)) {
  4124. context.mixins.push(mixin);
  4125. } else {
  4126. warn$1(
  4127. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  4128. );
  4129. }
  4130. }
  4131. return app;
  4132. },
  4133. component(name, component) {
  4134. {
  4135. validateComponentName(name, context.config);
  4136. }
  4137. if (!component) {
  4138. return context.components[name];
  4139. }
  4140. if (context.components[name]) {
  4141. warn$1(`Component "${name}" has already been registered in target app.`);
  4142. }
  4143. context.components[name] = component;
  4144. return app;
  4145. },
  4146. directive(name, directive) {
  4147. {
  4148. validateDirectiveName(name);
  4149. }
  4150. if (!directive) {
  4151. return context.directives[name];
  4152. }
  4153. if (context.directives[name]) {
  4154. warn$1(`Directive "${name}" has already been registered in target app.`);
  4155. }
  4156. context.directives[name] = directive;
  4157. return app;
  4158. },
  4159. mount(rootContainer, isHydrate, namespace) {
  4160. if (!isMounted) {
  4161. if (rootContainer.__vue_app__) {
  4162. warn$1(
  4163. `There is already an app instance mounted on the host container.
  4164. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  4165. );
  4166. }
  4167. const vnode = createVNode(rootComponent, rootProps);
  4168. vnode.appContext = context;
  4169. if (namespace === true) {
  4170. namespace = "svg";
  4171. } else if (namespace === false) {
  4172. namespace = void 0;
  4173. }
  4174. {
  4175. context.reload = () => {
  4176. render(
  4177. cloneVNode(vnode),
  4178. rootContainer,
  4179. namespace
  4180. );
  4181. };
  4182. }
  4183. if (isHydrate && hydrate) {
  4184. hydrate(vnode, rootContainer);
  4185. } else {
  4186. render(vnode, rootContainer, namespace);
  4187. }
  4188. isMounted = true;
  4189. app._container = rootContainer;
  4190. rootContainer.__vue_app__ = app;
  4191. {
  4192. app._instance = vnode.component;
  4193. devtoolsInitApp(app, version);
  4194. }
  4195. return getComponentPublicInstance(vnode.component);
  4196. } else {
  4197. warn$1(
  4198. `App has already been mounted.
  4199. 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)\``
  4200. );
  4201. }
  4202. },
  4203. unmount() {
  4204. if (isMounted) {
  4205. render(null, app._container);
  4206. {
  4207. app._instance = null;
  4208. devtoolsUnmountApp(app);
  4209. }
  4210. delete app._container.__vue_app__;
  4211. } else {
  4212. warn$1(`Cannot unmount an app that is not mounted.`);
  4213. }
  4214. },
  4215. provide(key, value) {
  4216. if (key in context.provides) {
  4217. warn$1(
  4218. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  4219. );
  4220. }
  4221. context.provides[key] = value;
  4222. return app;
  4223. },
  4224. runWithContext(fn) {
  4225. const lastApp = currentApp;
  4226. currentApp = app;
  4227. try {
  4228. return fn();
  4229. } finally {
  4230. currentApp = lastApp;
  4231. }
  4232. }
  4233. };
  4234. return app;
  4235. };
  4236. }
  4237. let currentApp = null;
  4238. function provide(key, value) {
  4239. if (!currentInstance) {
  4240. {
  4241. warn$1(`provide() can only be used inside setup().`);
  4242. }
  4243. } else {
  4244. let provides = currentInstance.provides;
  4245. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  4246. if (parentProvides === provides) {
  4247. provides = currentInstance.provides = Object.create(parentProvides);
  4248. }
  4249. provides[key] = value;
  4250. }
  4251. }
  4252. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  4253. const instance = currentInstance || currentRenderingInstance;
  4254. if (instance || currentApp) {
  4255. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  4256. if (provides && key in provides) {
  4257. return provides[key];
  4258. } else if (arguments.length > 1) {
  4259. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  4260. } else {
  4261. warn$1(`injection "${String(key)}" not found.`);
  4262. }
  4263. } else {
  4264. warn$1(`inject() can only be used inside setup() or functional components.`);
  4265. }
  4266. }
  4267. function hasInjectionContext() {
  4268. return !!(currentInstance || currentRenderingInstance || currentApp);
  4269. }
  4270. const internalObjectProto = {};
  4271. const createInternalObject = () => Object.create(internalObjectProto);
  4272. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  4273. function initProps(instance, rawProps, isStateful, isSSR = false) {
  4274. const props = {};
  4275. const attrs = createInternalObject();
  4276. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  4277. setFullProps(instance, rawProps, props, attrs);
  4278. for (const key in instance.propsOptions[0]) {
  4279. if (!(key in props)) {
  4280. props[key] = void 0;
  4281. }
  4282. }
  4283. {
  4284. validateProps(rawProps || {}, props, instance);
  4285. }
  4286. if (isStateful) {
  4287. instance.props = isSSR ? props : shallowReactive(props);
  4288. } else {
  4289. if (!instance.type.props) {
  4290. instance.props = attrs;
  4291. } else {
  4292. instance.props = props;
  4293. }
  4294. }
  4295. instance.attrs = attrs;
  4296. }
  4297. function isInHmrContext(instance) {
  4298. while (instance) {
  4299. if (instance.type.__hmrId) return true;
  4300. instance = instance.parent;
  4301. }
  4302. }
  4303. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  4304. const {
  4305. props,
  4306. attrs,
  4307. vnode: { patchFlag }
  4308. } = instance;
  4309. const rawCurrentProps = toRaw(props);
  4310. const [options] = instance.propsOptions;
  4311. let hasAttrsChanged = false;
  4312. if (
  4313. // always force full diff in dev
  4314. // - #1942 if hmr is enabled with sfc component
  4315. // - vite#872 non-sfc component used by sfc component
  4316. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  4317. ) {
  4318. if (patchFlag & 8) {
  4319. const propsToUpdate = instance.vnode.dynamicProps;
  4320. for (let i = 0; i < propsToUpdate.length; i++) {
  4321. let key = propsToUpdate[i];
  4322. if (isEmitListener(instance.emitsOptions, key)) {
  4323. continue;
  4324. }
  4325. const value = rawProps[key];
  4326. if (options) {
  4327. if (hasOwn(attrs, key)) {
  4328. if (value !== attrs[key]) {
  4329. attrs[key] = value;
  4330. hasAttrsChanged = true;
  4331. }
  4332. } else {
  4333. const camelizedKey = camelize(key);
  4334. props[camelizedKey] = resolvePropValue(
  4335. options,
  4336. rawCurrentProps,
  4337. camelizedKey,
  4338. value,
  4339. instance,
  4340. false
  4341. );
  4342. }
  4343. } else {
  4344. if (value !== attrs[key]) {
  4345. attrs[key] = value;
  4346. hasAttrsChanged = true;
  4347. }
  4348. }
  4349. }
  4350. }
  4351. } else {
  4352. if (setFullProps(instance, rawProps, props, attrs)) {
  4353. hasAttrsChanged = true;
  4354. }
  4355. let kebabKey;
  4356. for (const key in rawCurrentProps) {
  4357. if (!rawProps || // for camelCase
  4358. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  4359. // and converted to camelCase (#955)
  4360. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  4361. if (options) {
  4362. if (rawPrevProps && // for camelCase
  4363. (rawPrevProps[key] !== void 0 || // for kebab-case
  4364. rawPrevProps[kebabKey] !== void 0)) {
  4365. props[key] = resolvePropValue(
  4366. options,
  4367. rawCurrentProps,
  4368. key,
  4369. void 0,
  4370. instance,
  4371. true
  4372. );
  4373. }
  4374. } else {
  4375. delete props[key];
  4376. }
  4377. }
  4378. }
  4379. if (attrs !== rawCurrentProps) {
  4380. for (const key in attrs) {
  4381. if (!rawProps || !hasOwn(rawProps, key) && true) {
  4382. delete attrs[key];
  4383. hasAttrsChanged = true;
  4384. }
  4385. }
  4386. }
  4387. }
  4388. if (hasAttrsChanged) {
  4389. trigger(instance.attrs, "set", "");
  4390. }
  4391. {
  4392. validateProps(rawProps || {}, props, instance);
  4393. }
  4394. }
  4395. function setFullProps(instance, rawProps, props, attrs) {
  4396. const [options, needCastKeys] = instance.propsOptions;
  4397. let hasAttrsChanged = false;
  4398. let rawCastValues;
  4399. if (rawProps) {
  4400. for (let key in rawProps) {
  4401. if (isReservedProp(key)) {
  4402. continue;
  4403. }
  4404. const value = rawProps[key];
  4405. let camelKey;
  4406. if (options && hasOwn(options, camelKey = camelize(key))) {
  4407. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4408. props[camelKey] = value;
  4409. } else {
  4410. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4411. }
  4412. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4413. if (!(key in attrs) || value !== attrs[key]) {
  4414. attrs[key] = value;
  4415. hasAttrsChanged = true;
  4416. }
  4417. }
  4418. }
  4419. }
  4420. if (needCastKeys) {
  4421. const rawCurrentProps = toRaw(props);
  4422. const castValues = rawCastValues || EMPTY_OBJ;
  4423. for (let i = 0; i < needCastKeys.length; i++) {
  4424. const key = needCastKeys[i];
  4425. props[key] = resolvePropValue(
  4426. options,
  4427. rawCurrentProps,
  4428. key,
  4429. castValues[key],
  4430. instance,
  4431. !hasOwn(castValues, key)
  4432. );
  4433. }
  4434. }
  4435. return hasAttrsChanged;
  4436. }
  4437. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4438. const opt = options[key];
  4439. if (opt != null) {
  4440. const hasDefault = hasOwn(opt, "default");
  4441. if (hasDefault && value === void 0) {
  4442. const defaultValue = opt.default;
  4443. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  4444. const { propsDefaults } = instance;
  4445. if (key in propsDefaults) {
  4446. value = propsDefaults[key];
  4447. } else {
  4448. const reset = setCurrentInstance(instance);
  4449. value = propsDefaults[key] = defaultValue.call(
  4450. null,
  4451. props
  4452. );
  4453. reset();
  4454. }
  4455. } else {
  4456. value = defaultValue;
  4457. }
  4458. }
  4459. if (opt[0 /* shouldCast */]) {
  4460. if (isAbsent && !hasDefault) {
  4461. value = false;
  4462. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  4463. value = true;
  4464. }
  4465. }
  4466. }
  4467. return value;
  4468. }
  4469. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  4470. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4471. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  4472. const cached = cache.get(comp);
  4473. if (cached) {
  4474. return cached;
  4475. }
  4476. const raw = comp.props;
  4477. const normalized = {};
  4478. const needCastKeys = [];
  4479. let hasExtends = false;
  4480. if (!isFunction(comp)) {
  4481. const extendProps = (raw2) => {
  4482. hasExtends = true;
  4483. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4484. extend(normalized, props);
  4485. if (keys) needCastKeys.push(...keys);
  4486. };
  4487. if (!asMixin && appContext.mixins.length) {
  4488. appContext.mixins.forEach(extendProps);
  4489. }
  4490. if (comp.extends) {
  4491. extendProps(comp.extends);
  4492. }
  4493. if (comp.mixins) {
  4494. comp.mixins.forEach(extendProps);
  4495. }
  4496. }
  4497. if (!raw && !hasExtends) {
  4498. if (isObject(comp)) {
  4499. cache.set(comp, EMPTY_ARR);
  4500. }
  4501. return EMPTY_ARR;
  4502. }
  4503. if (isArray(raw)) {
  4504. for (let i = 0; i < raw.length; i++) {
  4505. if (!isString(raw[i])) {
  4506. warn$1(`props must be strings when using array syntax.`, raw[i]);
  4507. }
  4508. const normalizedKey = camelize(raw[i]);
  4509. if (validatePropName(normalizedKey)) {
  4510. normalized[normalizedKey] = EMPTY_OBJ;
  4511. }
  4512. }
  4513. } else if (raw) {
  4514. if (!isObject(raw)) {
  4515. warn$1(`invalid props options`, raw);
  4516. }
  4517. for (const key in raw) {
  4518. const normalizedKey = camelize(key);
  4519. if (validatePropName(normalizedKey)) {
  4520. const opt = raw[key];
  4521. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  4522. const propType = prop.type;
  4523. let shouldCast = false;
  4524. let shouldCastTrue = true;
  4525. if (isArray(propType)) {
  4526. for (let index = 0; index < propType.length; ++index) {
  4527. const type = propType[index];
  4528. const typeName = isFunction(type) && type.name;
  4529. if (typeName === "Boolean") {
  4530. shouldCast = true;
  4531. break;
  4532. } else if (typeName === "String") {
  4533. shouldCastTrue = false;
  4534. }
  4535. }
  4536. } else {
  4537. shouldCast = isFunction(propType) && propType.name === "Boolean";
  4538. }
  4539. prop[0 /* shouldCast */] = shouldCast;
  4540. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  4541. if (shouldCast || hasOwn(prop, "default")) {
  4542. needCastKeys.push(normalizedKey);
  4543. }
  4544. }
  4545. }
  4546. }
  4547. const res = [normalized, needCastKeys];
  4548. if (isObject(comp)) {
  4549. cache.set(comp, res);
  4550. }
  4551. return res;
  4552. }
  4553. function validatePropName(key) {
  4554. if (key[0] !== "$" && !isReservedProp(key)) {
  4555. return true;
  4556. } else {
  4557. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  4558. }
  4559. return false;
  4560. }
  4561. function getType(ctor) {
  4562. if (ctor === null) {
  4563. return "null";
  4564. }
  4565. if (typeof ctor === "function") {
  4566. return ctor.name || "";
  4567. } else if (typeof ctor === "object") {
  4568. const name = ctor.constructor && ctor.constructor.name;
  4569. return name || "";
  4570. }
  4571. return "";
  4572. }
  4573. function validateProps(rawProps, props, instance) {
  4574. const resolvedValues = toRaw(props);
  4575. const options = instance.propsOptions[0];
  4576. for (const key in options) {
  4577. let opt = options[key];
  4578. if (opt == null) continue;
  4579. validateProp(
  4580. key,
  4581. resolvedValues[key],
  4582. opt,
  4583. shallowReadonly(resolvedValues) ,
  4584. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  4585. );
  4586. }
  4587. }
  4588. function validateProp(name, value, prop, props, isAbsent) {
  4589. const { type, required, validator, skipCheck } = prop;
  4590. if (required && isAbsent) {
  4591. warn$1('Missing required prop: "' + name + '"');
  4592. return;
  4593. }
  4594. if (value == null && !required) {
  4595. return;
  4596. }
  4597. if (type != null && type !== true && !skipCheck) {
  4598. let isValid = false;
  4599. const types = isArray(type) ? type : [type];
  4600. const expectedTypes = [];
  4601. for (let i = 0; i < types.length && !isValid; i++) {
  4602. const { valid, expectedType } = assertType(value, types[i]);
  4603. expectedTypes.push(expectedType || "");
  4604. isValid = valid;
  4605. }
  4606. if (!isValid) {
  4607. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  4608. return;
  4609. }
  4610. }
  4611. if (validator && !validator(value, props)) {
  4612. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  4613. }
  4614. }
  4615. const isSimpleType = /* @__PURE__ */ makeMap(
  4616. "String,Number,Boolean,Function,Symbol,BigInt"
  4617. );
  4618. function assertType(value, type) {
  4619. let valid;
  4620. const expectedType = getType(type);
  4621. if (isSimpleType(expectedType)) {
  4622. const t = typeof value;
  4623. valid = t === expectedType.toLowerCase();
  4624. if (!valid && t === "object") {
  4625. valid = value instanceof type;
  4626. }
  4627. } else if (expectedType === "Object") {
  4628. valid = isObject(value);
  4629. } else if (expectedType === "Array") {
  4630. valid = isArray(value);
  4631. } else if (expectedType === "null") {
  4632. valid = value === null;
  4633. } else {
  4634. valid = value instanceof type;
  4635. }
  4636. return {
  4637. valid,
  4638. expectedType
  4639. };
  4640. }
  4641. function getInvalidTypeMessage(name, value, expectedTypes) {
  4642. if (expectedTypes.length === 0) {
  4643. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  4644. }
  4645. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  4646. const expectedType = expectedTypes[0];
  4647. const receivedType = toRawType(value);
  4648. const expectedValue = styleValue(value, expectedType);
  4649. const receivedValue = styleValue(value, receivedType);
  4650. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4651. message += ` with value ${expectedValue}`;
  4652. }
  4653. message += `, got ${receivedType} `;
  4654. if (isExplicable(receivedType)) {
  4655. message += `with value ${receivedValue}.`;
  4656. }
  4657. return message;
  4658. }
  4659. function styleValue(value, type) {
  4660. if (type === "String") {
  4661. return `"${value}"`;
  4662. } else if (type === "Number") {
  4663. return `${Number(value)}`;
  4664. } else {
  4665. return `${value}`;
  4666. }
  4667. }
  4668. function isExplicable(type) {
  4669. const explicitTypes = ["string", "number", "boolean"];
  4670. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4671. }
  4672. function isBoolean(...args) {
  4673. return args.some((elem) => elem.toLowerCase() === "boolean");
  4674. }
  4675. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  4676. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4677. const normalizeSlot = (key, rawSlot, ctx) => {
  4678. if (rawSlot._n) {
  4679. return rawSlot;
  4680. }
  4681. const normalized = withCtx((...args) => {
  4682. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  4683. warn$1(
  4684. `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.`
  4685. );
  4686. }
  4687. return normalizeSlotValue(rawSlot(...args));
  4688. }, ctx);
  4689. normalized._c = false;
  4690. return normalized;
  4691. };
  4692. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  4693. const ctx = rawSlots._ctx;
  4694. for (const key in rawSlots) {
  4695. if (isInternalKey(key)) continue;
  4696. const value = rawSlots[key];
  4697. if (isFunction(value)) {
  4698. slots[key] = normalizeSlot(key, value, ctx);
  4699. } else if (value != null) {
  4700. {
  4701. warn$1(
  4702. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  4703. );
  4704. }
  4705. const normalized = normalizeSlotValue(value);
  4706. slots[key] = () => normalized;
  4707. }
  4708. }
  4709. };
  4710. const normalizeVNodeSlots = (instance, children) => {
  4711. if (!isKeepAlive(instance.vnode) && true) {
  4712. warn$1(
  4713. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  4714. );
  4715. }
  4716. const normalized = normalizeSlotValue(children);
  4717. instance.slots.default = () => normalized;
  4718. };
  4719. const assignSlots = (slots, children, optimized) => {
  4720. for (const key in children) {
  4721. if (optimized || key !== "_") {
  4722. slots[key] = children[key];
  4723. }
  4724. }
  4725. };
  4726. const initSlots = (instance, children, optimized) => {
  4727. const slots = instance.slots = createInternalObject();
  4728. if (instance.vnode.shapeFlag & 32) {
  4729. const type = children._;
  4730. if (type) {
  4731. assignSlots(slots, children, optimized);
  4732. if (optimized) {
  4733. def(slots, "_", type, true);
  4734. }
  4735. } else {
  4736. normalizeObjectSlots(children, slots);
  4737. }
  4738. } else if (children) {
  4739. normalizeVNodeSlots(instance, children);
  4740. }
  4741. };
  4742. const updateSlots = (instance, children, optimized) => {
  4743. const { vnode, slots } = instance;
  4744. let needDeletionCheck = true;
  4745. let deletionComparisonTarget = EMPTY_OBJ;
  4746. if (vnode.shapeFlag & 32) {
  4747. const type = children._;
  4748. if (type) {
  4749. if (isHmrUpdating) {
  4750. assignSlots(slots, children, optimized);
  4751. trigger(instance, "set", "$slots");
  4752. } else if (optimized && type === 1) {
  4753. needDeletionCheck = false;
  4754. } else {
  4755. assignSlots(slots, children, optimized);
  4756. }
  4757. } else {
  4758. needDeletionCheck = !children.$stable;
  4759. normalizeObjectSlots(children, slots);
  4760. }
  4761. deletionComparisonTarget = children;
  4762. } else if (children) {
  4763. normalizeVNodeSlots(instance, children);
  4764. deletionComparisonTarget = { default: 1 };
  4765. }
  4766. if (needDeletionCheck) {
  4767. for (const key in slots) {
  4768. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  4769. delete slots[key];
  4770. }
  4771. }
  4772. }
  4773. };
  4774. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4775. if (isArray(rawRef)) {
  4776. rawRef.forEach(
  4777. (r, i) => setRef(
  4778. r,
  4779. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4780. parentSuspense,
  4781. vnode,
  4782. isUnmount
  4783. )
  4784. );
  4785. return;
  4786. }
  4787. if (isAsyncWrapper(vnode) && !isUnmount) {
  4788. return;
  4789. }
  4790. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  4791. const value = isUnmount ? null : refValue;
  4792. const { i: owner, r: ref } = rawRef;
  4793. if (!owner) {
  4794. warn$1(
  4795. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4796. );
  4797. return;
  4798. }
  4799. const oldRef = oldRawRef && oldRawRef.r;
  4800. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4801. const setupState = owner.setupState;
  4802. if (oldRef != null && oldRef !== ref) {
  4803. if (isString(oldRef)) {
  4804. refs[oldRef] = null;
  4805. if (hasOwn(setupState, oldRef)) {
  4806. setupState[oldRef] = null;
  4807. }
  4808. } else if (isRef(oldRef)) {
  4809. oldRef.value = null;
  4810. }
  4811. }
  4812. if (isFunction(ref)) {
  4813. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4814. } else {
  4815. const _isString = isString(ref);
  4816. const _isRef = isRef(ref);
  4817. if (_isString || _isRef) {
  4818. const doSet = () => {
  4819. if (rawRef.f) {
  4820. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  4821. if (isUnmount) {
  4822. isArray(existing) && remove(existing, refValue);
  4823. } else {
  4824. if (!isArray(existing)) {
  4825. if (_isString) {
  4826. refs[ref] = [refValue];
  4827. if (hasOwn(setupState, ref)) {
  4828. setupState[ref] = refs[ref];
  4829. }
  4830. } else {
  4831. ref.value = [refValue];
  4832. if (rawRef.k) refs[rawRef.k] = ref.value;
  4833. }
  4834. } else if (!existing.includes(refValue)) {
  4835. existing.push(refValue);
  4836. }
  4837. }
  4838. } else if (_isString) {
  4839. refs[ref] = value;
  4840. if (hasOwn(setupState, ref)) {
  4841. setupState[ref] = value;
  4842. }
  4843. } else if (_isRef) {
  4844. ref.value = value;
  4845. if (rawRef.k) refs[rawRef.k] = value;
  4846. } else {
  4847. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4848. }
  4849. };
  4850. if (value) {
  4851. doSet.id = -1;
  4852. queuePostRenderEffect(doSet, parentSuspense);
  4853. } else {
  4854. doSet();
  4855. }
  4856. } else {
  4857. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4858. }
  4859. }
  4860. }
  4861. const TeleportEndKey = Symbol("_vte");
  4862. const isTeleport = (type) => type.__isTeleport;
  4863. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  4864. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  4865. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  4866. const resolveTarget = (props, select) => {
  4867. const targetSelector = props && props.to;
  4868. if (isString(targetSelector)) {
  4869. if (!select) {
  4870. warn$1(
  4871. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  4872. );
  4873. return null;
  4874. } else {
  4875. const target = select(targetSelector);
  4876. if (!target && !isTeleportDisabled(props)) {
  4877. warn$1(
  4878. `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.`
  4879. );
  4880. }
  4881. return target;
  4882. }
  4883. } else {
  4884. if (!targetSelector && !isTeleportDisabled(props)) {
  4885. warn$1(`Invalid Teleport target: ${targetSelector}`);
  4886. }
  4887. return targetSelector;
  4888. }
  4889. };
  4890. const TeleportImpl = {
  4891. name: "Teleport",
  4892. __isTeleport: true,
  4893. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  4894. const {
  4895. mc: mountChildren,
  4896. pc: patchChildren,
  4897. pbc: patchBlockChildren,
  4898. o: { insert, querySelector, createText, createComment }
  4899. } = internals;
  4900. const disabled = isTeleportDisabled(n2.props);
  4901. let { shapeFlag, children, dynamicChildren } = n2;
  4902. if (isHmrUpdating) {
  4903. optimized = false;
  4904. dynamicChildren = null;
  4905. }
  4906. if (n1 == null) {
  4907. const placeholder = n2.el = createComment("teleport start") ;
  4908. const mainAnchor = n2.anchor = createComment("teleport end") ;
  4909. insert(placeholder, container, anchor);
  4910. insert(mainAnchor, container, anchor);
  4911. const target = n2.target = resolveTarget(n2.props, querySelector);
  4912. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  4913. if (target) {
  4914. if (namespace === "svg" || isTargetSVG(target)) {
  4915. namespace = "svg";
  4916. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4917. namespace = "mathml";
  4918. }
  4919. } else if (!disabled) {
  4920. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  4921. }
  4922. const mount = (container2, anchor2) => {
  4923. if (shapeFlag & 16) {
  4924. mountChildren(
  4925. children,
  4926. container2,
  4927. anchor2,
  4928. parentComponent,
  4929. parentSuspense,
  4930. namespace,
  4931. slotScopeIds,
  4932. optimized
  4933. );
  4934. }
  4935. };
  4936. if (disabled) {
  4937. mount(container, mainAnchor);
  4938. } else if (target) {
  4939. mount(target, targetAnchor);
  4940. }
  4941. } else {
  4942. n2.el = n1.el;
  4943. n2.targetStart = n1.targetStart;
  4944. const mainAnchor = n2.anchor = n1.anchor;
  4945. const target = n2.target = n1.target;
  4946. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  4947. const wasDisabled = isTeleportDisabled(n1.props);
  4948. const currentContainer = wasDisabled ? container : target;
  4949. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  4950. if (namespace === "svg" || isTargetSVG(target)) {
  4951. namespace = "svg";
  4952. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4953. namespace = "mathml";
  4954. }
  4955. if (dynamicChildren) {
  4956. patchBlockChildren(
  4957. n1.dynamicChildren,
  4958. dynamicChildren,
  4959. currentContainer,
  4960. parentComponent,
  4961. parentSuspense,
  4962. namespace,
  4963. slotScopeIds
  4964. );
  4965. traverseStaticChildren(n1, n2, true);
  4966. } else if (!optimized) {
  4967. patchChildren(
  4968. n1,
  4969. n2,
  4970. currentContainer,
  4971. currentAnchor,
  4972. parentComponent,
  4973. parentSuspense,
  4974. namespace,
  4975. slotScopeIds,
  4976. false
  4977. );
  4978. }
  4979. if (disabled) {
  4980. if (!wasDisabled) {
  4981. moveTeleport(
  4982. n2,
  4983. container,
  4984. mainAnchor,
  4985. internals,
  4986. 1
  4987. );
  4988. } else {
  4989. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  4990. n2.props.to = n1.props.to;
  4991. }
  4992. }
  4993. } else {
  4994. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  4995. const nextTarget = n2.target = resolveTarget(
  4996. n2.props,
  4997. querySelector
  4998. );
  4999. if (nextTarget) {
  5000. moveTeleport(
  5001. n2,
  5002. nextTarget,
  5003. null,
  5004. internals,
  5005. 0
  5006. );
  5007. } else {
  5008. warn$1(
  5009. "Invalid Teleport target on update:",
  5010. target,
  5011. `(${typeof target})`
  5012. );
  5013. }
  5014. } else if (wasDisabled) {
  5015. moveTeleport(
  5016. n2,
  5017. target,
  5018. targetAnchor,
  5019. internals,
  5020. 1
  5021. );
  5022. }
  5023. }
  5024. }
  5025. updateCssVars(n2);
  5026. },
  5027. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5028. const {
  5029. shapeFlag,
  5030. children,
  5031. anchor,
  5032. targetStart,
  5033. targetAnchor,
  5034. target,
  5035. props
  5036. } = vnode;
  5037. if (target) {
  5038. hostRemove(targetStart);
  5039. hostRemove(targetAnchor);
  5040. }
  5041. doRemove && hostRemove(anchor);
  5042. if (shapeFlag & 16) {
  5043. const shouldRemove = doRemove || !isTeleportDisabled(props);
  5044. for (let i = 0; i < children.length; i++) {
  5045. const child = children[i];
  5046. unmount(
  5047. child,
  5048. parentComponent,
  5049. parentSuspense,
  5050. shouldRemove,
  5051. !!child.dynamicChildren
  5052. );
  5053. }
  5054. }
  5055. },
  5056. move: moveTeleport,
  5057. hydrate: hydrateTeleport
  5058. };
  5059. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5060. if (moveType === 0) {
  5061. insert(vnode.targetAnchor, container, parentAnchor);
  5062. }
  5063. const { el, anchor, shapeFlag, children, props } = vnode;
  5064. const isReorder = moveType === 2;
  5065. if (isReorder) {
  5066. insert(el, container, parentAnchor);
  5067. }
  5068. if (!isReorder || isTeleportDisabled(props)) {
  5069. if (shapeFlag & 16) {
  5070. for (let i = 0; i < children.length; i++) {
  5071. move(
  5072. children[i],
  5073. container,
  5074. parentAnchor,
  5075. 2
  5076. );
  5077. }
  5078. }
  5079. }
  5080. if (isReorder) {
  5081. insert(anchor, container, parentAnchor);
  5082. }
  5083. }
  5084. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5085. o: { nextSibling, parentNode, querySelector, insert, createText }
  5086. }, hydrateChildren) {
  5087. const target = vnode.target = resolveTarget(
  5088. vnode.props,
  5089. querySelector
  5090. );
  5091. if (target) {
  5092. const targetNode = target._lpa || target.firstChild;
  5093. if (vnode.shapeFlag & 16) {
  5094. if (isTeleportDisabled(vnode.props)) {
  5095. vnode.anchor = hydrateChildren(
  5096. nextSibling(node),
  5097. vnode,
  5098. parentNode(node),
  5099. parentComponent,
  5100. parentSuspense,
  5101. slotScopeIds,
  5102. optimized
  5103. );
  5104. vnode.targetStart = targetNode;
  5105. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  5106. } else {
  5107. vnode.anchor = nextSibling(node);
  5108. let targetAnchor = targetNode;
  5109. while (targetAnchor) {
  5110. if (targetAnchor && targetAnchor.nodeType === 8) {
  5111. if (targetAnchor.data === "teleport start anchor") {
  5112. vnode.targetStart = targetAnchor;
  5113. } else if (targetAnchor.data === "teleport anchor") {
  5114. vnode.targetAnchor = targetAnchor;
  5115. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5116. break;
  5117. }
  5118. }
  5119. targetAnchor = nextSibling(targetAnchor);
  5120. }
  5121. if (!vnode.targetAnchor) {
  5122. prepareAnchor(target, vnode, createText, insert);
  5123. }
  5124. hydrateChildren(
  5125. targetNode && nextSibling(targetNode),
  5126. vnode,
  5127. target,
  5128. parentComponent,
  5129. parentSuspense,
  5130. slotScopeIds,
  5131. optimized
  5132. );
  5133. }
  5134. }
  5135. updateCssVars(vnode);
  5136. }
  5137. return vnode.anchor && nextSibling(vnode.anchor);
  5138. }
  5139. const Teleport = TeleportImpl;
  5140. function updateCssVars(vnode) {
  5141. const ctx = vnode.ctx;
  5142. if (ctx && ctx.ut) {
  5143. let node = vnode.children[0].el;
  5144. while (node && node !== vnode.targetAnchor) {
  5145. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  5146. node = node.nextSibling;
  5147. }
  5148. ctx.ut();
  5149. }
  5150. }
  5151. function prepareAnchor(target, vnode, createText, insert) {
  5152. const targetStart = vnode.targetStart = createText("");
  5153. const targetAnchor = vnode.targetAnchor = createText("");
  5154. targetStart[TeleportEndKey] = targetAnchor;
  5155. if (target) {
  5156. insert(targetStart, target);
  5157. insert(targetAnchor, target);
  5158. }
  5159. return targetAnchor;
  5160. }
  5161. let hasLoggedMismatchError = false;
  5162. const logMismatchError = () => {
  5163. if (hasLoggedMismatchError) {
  5164. return;
  5165. }
  5166. console.error("Hydration completed but contains mismatches.");
  5167. hasLoggedMismatchError = true;
  5168. };
  5169. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  5170. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  5171. const getContainerType = (container) => {
  5172. if (isSVGContainer(container)) return "svg";
  5173. if (isMathMLContainer(container)) return "mathml";
  5174. return void 0;
  5175. };
  5176. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5177. function createHydrationFunctions(rendererInternals) {
  5178. const {
  5179. mt: mountComponent,
  5180. p: patch,
  5181. o: {
  5182. patchProp,
  5183. createText,
  5184. nextSibling,
  5185. parentNode,
  5186. remove,
  5187. insert,
  5188. createComment
  5189. }
  5190. } = rendererInternals;
  5191. const hydrate = (vnode, container) => {
  5192. if (!container.hasChildNodes()) {
  5193. warn$1(
  5194. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5195. );
  5196. patch(null, vnode, container);
  5197. flushPostFlushCbs();
  5198. container._vnode = vnode;
  5199. return;
  5200. }
  5201. hydrateNode(container.firstChild, vnode, null, null, null);
  5202. flushPostFlushCbs();
  5203. container._vnode = vnode;
  5204. };
  5205. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5206. optimized = optimized || !!vnode.dynamicChildren;
  5207. const isFragmentStart = isComment(node) && node.data === "[";
  5208. const onMismatch = () => handleMismatch(
  5209. node,
  5210. vnode,
  5211. parentComponent,
  5212. parentSuspense,
  5213. slotScopeIds,
  5214. isFragmentStart
  5215. );
  5216. const { type, ref, shapeFlag, patchFlag } = vnode;
  5217. let domType = node.nodeType;
  5218. vnode.el = node;
  5219. {
  5220. def(node, "__vnode", vnode, true);
  5221. def(node, "__vueParentComponent", parentComponent, true);
  5222. }
  5223. if (patchFlag === -2) {
  5224. optimized = false;
  5225. vnode.dynamicChildren = null;
  5226. }
  5227. let nextNode = null;
  5228. switch (type) {
  5229. case Text:
  5230. if (domType !== 3 /* TEXT */) {
  5231. if (vnode.children === "") {
  5232. insert(vnode.el = createText(""), parentNode(node), node);
  5233. nextNode = node;
  5234. } else {
  5235. nextNode = onMismatch();
  5236. }
  5237. } else {
  5238. if (node.data !== vnode.children) {
  5239. warn$1(
  5240. `Hydration text mismatch in`,
  5241. node.parentNode,
  5242. `
  5243. - rendered on server: ${JSON.stringify(
  5244. node.data
  5245. )}
  5246. - expected on client: ${JSON.stringify(vnode.children)}`
  5247. );
  5248. logMismatchError();
  5249. node.data = vnode.children;
  5250. }
  5251. nextNode = nextSibling(node);
  5252. }
  5253. break;
  5254. case Comment:
  5255. if (isTemplateNode(node)) {
  5256. nextNode = nextSibling(node);
  5257. replaceNode(
  5258. vnode.el = node.content.firstChild,
  5259. node,
  5260. parentComponent
  5261. );
  5262. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5263. nextNode = onMismatch();
  5264. } else {
  5265. nextNode = nextSibling(node);
  5266. }
  5267. break;
  5268. case Static:
  5269. if (isFragmentStart) {
  5270. node = nextSibling(node);
  5271. domType = node.nodeType;
  5272. }
  5273. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5274. nextNode = node;
  5275. const needToAdoptContent = !vnode.children.length;
  5276. for (let i = 0; i < vnode.staticCount; i++) {
  5277. if (needToAdoptContent)
  5278. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5279. if (i === vnode.staticCount - 1) {
  5280. vnode.anchor = nextNode;
  5281. }
  5282. nextNode = nextSibling(nextNode);
  5283. }
  5284. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5285. } else {
  5286. onMismatch();
  5287. }
  5288. break;
  5289. case Fragment:
  5290. if (!isFragmentStart) {
  5291. nextNode = onMismatch();
  5292. } else {
  5293. nextNode = hydrateFragment(
  5294. node,
  5295. vnode,
  5296. parentComponent,
  5297. parentSuspense,
  5298. slotScopeIds,
  5299. optimized
  5300. );
  5301. }
  5302. break;
  5303. default:
  5304. if (shapeFlag & 1) {
  5305. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  5306. nextNode = onMismatch();
  5307. } else {
  5308. nextNode = hydrateElement(
  5309. node,
  5310. vnode,
  5311. parentComponent,
  5312. parentSuspense,
  5313. slotScopeIds,
  5314. optimized
  5315. );
  5316. }
  5317. } else if (shapeFlag & 6) {
  5318. vnode.slotScopeIds = slotScopeIds;
  5319. const container = parentNode(node);
  5320. if (isFragmentStart) {
  5321. nextNode = locateClosingAnchor(node);
  5322. } else if (isComment(node) && node.data === "teleport start") {
  5323. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  5324. } else {
  5325. nextNode = nextSibling(node);
  5326. }
  5327. mountComponent(
  5328. vnode,
  5329. container,
  5330. null,
  5331. parentComponent,
  5332. parentSuspense,
  5333. getContainerType(container),
  5334. optimized
  5335. );
  5336. if (isAsyncWrapper(vnode)) {
  5337. let subTree;
  5338. if (isFragmentStart) {
  5339. subTree = createVNode(Fragment);
  5340. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5341. } else {
  5342. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  5343. }
  5344. subTree.el = node;
  5345. vnode.component.subTree = subTree;
  5346. }
  5347. } else if (shapeFlag & 64) {
  5348. if (domType !== 8 /* COMMENT */) {
  5349. nextNode = onMismatch();
  5350. } else {
  5351. nextNode = vnode.type.hydrate(
  5352. node,
  5353. vnode,
  5354. parentComponent,
  5355. parentSuspense,
  5356. slotScopeIds,
  5357. optimized,
  5358. rendererInternals,
  5359. hydrateChildren
  5360. );
  5361. }
  5362. } else if (shapeFlag & 128) {
  5363. nextNode = vnode.type.hydrate(
  5364. node,
  5365. vnode,
  5366. parentComponent,
  5367. parentSuspense,
  5368. getContainerType(parentNode(node)),
  5369. slotScopeIds,
  5370. optimized,
  5371. rendererInternals,
  5372. hydrateNode
  5373. );
  5374. } else {
  5375. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  5376. }
  5377. }
  5378. if (ref != null) {
  5379. setRef(ref, null, parentSuspense, vnode);
  5380. }
  5381. return nextNode;
  5382. };
  5383. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5384. optimized = optimized || !!vnode.dynamicChildren;
  5385. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  5386. const forcePatch = type === "input" || type === "option";
  5387. {
  5388. if (dirs) {
  5389. invokeDirectiveHook(vnode, null, parentComponent, "created");
  5390. }
  5391. let needCallTransitionHooks = false;
  5392. if (isTemplateNode(el)) {
  5393. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  5394. const content = el.content.firstChild;
  5395. if (needCallTransitionHooks) {
  5396. transition.beforeEnter(content);
  5397. }
  5398. replaceNode(content, el, parentComponent);
  5399. vnode.el = el = content;
  5400. }
  5401. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  5402. !(props && (props.innerHTML || props.textContent))) {
  5403. let next = hydrateChildren(
  5404. el.firstChild,
  5405. vnode,
  5406. el,
  5407. parentComponent,
  5408. parentSuspense,
  5409. slotScopeIds,
  5410. optimized
  5411. );
  5412. let hasWarned = false;
  5413. while (next) {
  5414. if (!hasWarned) {
  5415. warn$1(
  5416. `Hydration children mismatch on`,
  5417. el,
  5418. `
  5419. Server rendered element contains more child nodes than client vdom.`
  5420. );
  5421. hasWarned = true;
  5422. }
  5423. logMismatchError();
  5424. const cur = next;
  5425. next = next.nextSibling;
  5426. remove(cur);
  5427. }
  5428. } else if (shapeFlag & 8) {
  5429. if (el.textContent !== vnode.children) {
  5430. warn$1(
  5431. `Hydration text content mismatch on`,
  5432. el,
  5433. `
  5434. - rendered on server: ${el.textContent}
  5435. - expected on client: ${vnode.children}`
  5436. );
  5437. logMismatchError();
  5438. el.textContent = vnode.children;
  5439. }
  5440. }
  5441. if (props) {
  5442. {
  5443. const isCustomElement = el.tagName.includes("-");
  5444. for (const key in props) {
  5445. if (// #11189 skip if this node has directives that have created hooks
  5446. // as it could have mutated the DOM in any possible way
  5447. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  5448. logMismatchError();
  5449. }
  5450. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  5451. key[0] === "." || isCustomElement) {
  5452. patchProp(el, key, null, props[key], void 0, parentComponent);
  5453. }
  5454. }
  5455. }
  5456. }
  5457. let vnodeHooks;
  5458. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  5459. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5460. }
  5461. if (dirs) {
  5462. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  5463. }
  5464. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  5465. queueEffectWithSuspense(() => {
  5466. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5467. needCallTransitionHooks && transition.enter(el);
  5468. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  5469. }, parentSuspense);
  5470. }
  5471. }
  5472. return el.nextSibling;
  5473. };
  5474. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5475. optimized = optimized || !!parentVNode.dynamicChildren;
  5476. const children = parentVNode.children;
  5477. const l = children.length;
  5478. let hasWarned = false;
  5479. for (let i = 0; i < l; i++) {
  5480. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  5481. const isText = vnode.type === Text;
  5482. if (node) {
  5483. if (isText && !optimized) {
  5484. let next = children[i + 1];
  5485. if (next && (next = normalizeVNode(next)).type === Text) {
  5486. insert(
  5487. createText(
  5488. node.data.slice(vnode.children.length)
  5489. ),
  5490. container,
  5491. nextSibling(node)
  5492. );
  5493. node.data = vnode.children;
  5494. }
  5495. }
  5496. node = hydrateNode(
  5497. node,
  5498. vnode,
  5499. parentComponent,
  5500. parentSuspense,
  5501. slotScopeIds,
  5502. optimized
  5503. );
  5504. } else if (isText && !vnode.children) {
  5505. insert(vnode.el = createText(""), container);
  5506. } else {
  5507. if (!hasWarned) {
  5508. warn$1(
  5509. `Hydration children mismatch on`,
  5510. container,
  5511. `
  5512. Server rendered element contains fewer child nodes than client vdom.`
  5513. );
  5514. hasWarned = true;
  5515. }
  5516. logMismatchError();
  5517. patch(
  5518. null,
  5519. vnode,
  5520. container,
  5521. null,
  5522. parentComponent,
  5523. parentSuspense,
  5524. getContainerType(container),
  5525. slotScopeIds
  5526. );
  5527. }
  5528. }
  5529. return node;
  5530. };
  5531. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5532. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  5533. if (fragmentSlotScopeIds) {
  5534. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  5535. }
  5536. const container = parentNode(node);
  5537. const next = hydrateChildren(
  5538. nextSibling(node),
  5539. vnode,
  5540. container,
  5541. parentComponent,
  5542. parentSuspense,
  5543. slotScopeIds,
  5544. optimized
  5545. );
  5546. if (next && isComment(next) && next.data === "]") {
  5547. return nextSibling(vnode.anchor = next);
  5548. } else {
  5549. logMismatchError();
  5550. insert(vnode.anchor = createComment(`]`), container, next);
  5551. return next;
  5552. }
  5553. };
  5554. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  5555. warn$1(
  5556. `Hydration node mismatch:
  5557. - rendered on server:`,
  5558. node,
  5559. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  5560. `
  5561. - expected on client:`,
  5562. vnode.type
  5563. );
  5564. logMismatchError();
  5565. vnode.el = null;
  5566. if (isFragment) {
  5567. const end = locateClosingAnchor(node);
  5568. while (true) {
  5569. const next2 = nextSibling(node);
  5570. if (next2 && next2 !== end) {
  5571. remove(next2);
  5572. } else {
  5573. break;
  5574. }
  5575. }
  5576. }
  5577. const next = nextSibling(node);
  5578. const container = parentNode(node);
  5579. remove(node);
  5580. patch(
  5581. null,
  5582. vnode,
  5583. container,
  5584. next,
  5585. parentComponent,
  5586. parentSuspense,
  5587. getContainerType(container),
  5588. slotScopeIds
  5589. );
  5590. return next;
  5591. };
  5592. const locateClosingAnchor = (node, open = "[", close = "]") => {
  5593. let match = 0;
  5594. while (node) {
  5595. node = nextSibling(node);
  5596. if (node && isComment(node)) {
  5597. if (node.data === open) match++;
  5598. if (node.data === close) {
  5599. if (match === 0) {
  5600. return nextSibling(node);
  5601. } else {
  5602. match--;
  5603. }
  5604. }
  5605. }
  5606. }
  5607. return node;
  5608. };
  5609. const replaceNode = (newNode, oldNode, parentComponent) => {
  5610. const parentNode2 = oldNode.parentNode;
  5611. if (parentNode2) {
  5612. parentNode2.replaceChild(newNode, oldNode);
  5613. }
  5614. let parent = parentComponent;
  5615. while (parent) {
  5616. if (parent.vnode.el === oldNode) {
  5617. parent.vnode.el = parent.subTree.el = newNode;
  5618. }
  5619. parent = parent.parent;
  5620. }
  5621. };
  5622. const isTemplateNode = (node) => {
  5623. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  5624. };
  5625. return [hydrate, hydrateNode];
  5626. }
  5627. function propHasMismatch(el, key, clientValue, vnode, instance) {
  5628. let mismatchType;
  5629. let mismatchKey;
  5630. let actual;
  5631. let expected;
  5632. if (key === "class") {
  5633. actual = el.getAttribute("class");
  5634. expected = normalizeClass(clientValue);
  5635. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  5636. mismatchType = mismatchKey = `class`;
  5637. }
  5638. } else if (key === "style") {
  5639. actual = el.getAttribute("style") || "";
  5640. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  5641. const actualMap = toStyleMap(actual);
  5642. const expectedMap = toStyleMap(expected);
  5643. if (vnode.dirs) {
  5644. for (const { dir, value } of vnode.dirs) {
  5645. if (dir.name === "show" && !value) {
  5646. expectedMap.set("display", "none");
  5647. }
  5648. }
  5649. }
  5650. if (instance) {
  5651. resolveCssVars(instance, vnode, expectedMap);
  5652. }
  5653. if (!isMapEqual(actualMap, expectedMap)) {
  5654. mismatchType = mismatchKey = "style";
  5655. }
  5656. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  5657. if (isBooleanAttr(key)) {
  5658. actual = el.hasAttribute(key);
  5659. expected = includeBooleanAttr(clientValue);
  5660. } else if (clientValue == null) {
  5661. actual = el.hasAttribute(key);
  5662. expected = false;
  5663. } else {
  5664. if (el.hasAttribute(key)) {
  5665. actual = el.getAttribute(key);
  5666. } else if (key === "value" && el.tagName === "TEXTAREA") {
  5667. actual = el.value;
  5668. } else {
  5669. actual = false;
  5670. }
  5671. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  5672. }
  5673. if (actual !== expected) {
  5674. mismatchType = `attribute`;
  5675. mismatchKey = key;
  5676. }
  5677. }
  5678. if (mismatchType) {
  5679. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  5680. const preSegment = `Hydration ${mismatchType} mismatch on`;
  5681. const postSegment = `
  5682. - rendered on server: ${format(actual)}
  5683. - expected on client: ${format(expected)}
  5684. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  5685. You should fix the source of the mismatch.`;
  5686. {
  5687. warn$1(preSegment, el, postSegment);
  5688. }
  5689. return true;
  5690. }
  5691. return false;
  5692. }
  5693. function toClassSet(str) {
  5694. return new Set(str.trim().split(/\s+/));
  5695. }
  5696. function isSetEqual(a, b) {
  5697. if (a.size !== b.size) {
  5698. return false;
  5699. }
  5700. for (const s of a) {
  5701. if (!b.has(s)) {
  5702. return false;
  5703. }
  5704. }
  5705. return true;
  5706. }
  5707. function toStyleMap(str) {
  5708. const styleMap = /* @__PURE__ */ new Map();
  5709. for (const item of str.split(";")) {
  5710. let [key, value] = item.split(":");
  5711. key = key.trim();
  5712. value = value && value.trim();
  5713. if (key && value) {
  5714. styleMap.set(key, value);
  5715. }
  5716. }
  5717. return styleMap;
  5718. }
  5719. function isMapEqual(a, b) {
  5720. if (a.size !== b.size) {
  5721. return false;
  5722. }
  5723. for (const [key, value] of a) {
  5724. if (value !== b.get(key)) {
  5725. return false;
  5726. }
  5727. }
  5728. return true;
  5729. }
  5730. function resolveCssVars(instance, vnode, expectedMap) {
  5731. const root = instance.subTree;
  5732. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  5733. const cssVars = instance.getCssVars();
  5734. for (const key in cssVars) {
  5735. expectedMap.set(`--${key}`, String(cssVars[key]));
  5736. }
  5737. }
  5738. if (vnode === root && instance.parent) {
  5739. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  5740. }
  5741. }
  5742. let supported;
  5743. let perf;
  5744. function startMeasure(instance, type) {
  5745. if (instance.appContext.config.performance && isSupported()) {
  5746. perf.mark(`vue-${type}-${instance.uid}`);
  5747. }
  5748. {
  5749. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  5750. }
  5751. }
  5752. function endMeasure(instance, type) {
  5753. if (instance.appContext.config.performance && isSupported()) {
  5754. const startTag = `vue-${type}-${instance.uid}`;
  5755. const endTag = startTag + `:end`;
  5756. perf.mark(endTag);
  5757. perf.measure(
  5758. `<${formatComponentName(instance, instance.type)}> ${type}`,
  5759. startTag,
  5760. endTag
  5761. );
  5762. perf.clearMarks(startTag);
  5763. perf.clearMarks(endTag);
  5764. }
  5765. {
  5766. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  5767. }
  5768. }
  5769. function isSupported() {
  5770. if (supported !== void 0) {
  5771. return supported;
  5772. }
  5773. if (typeof window !== "undefined" && window.performance) {
  5774. supported = true;
  5775. perf = window.performance;
  5776. } else {
  5777. supported = false;
  5778. }
  5779. return supported;
  5780. }
  5781. const queuePostRenderEffect = queueEffectWithSuspense ;
  5782. function createRenderer(options) {
  5783. return baseCreateRenderer(options);
  5784. }
  5785. function createHydrationRenderer(options) {
  5786. return baseCreateRenderer(options, createHydrationFunctions);
  5787. }
  5788. function baseCreateRenderer(options, createHydrationFns) {
  5789. const target = getGlobalThis();
  5790. target.__VUE__ = true;
  5791. {
  5792. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  5793. }
  5794. const {
  5795. insert: hostInsert,
  5796. remove: hostRemove,
  5797. patchProp: hostPatchProp,
  5798. createElement: hostCreateElement,
  5799. createText: hostCreateText,
  5800. createComment: hostCreateComment,
  5801. setText: hostSetText,
  5802. setElementText: hostSetElementText,
  5803. parentNode: hostParentNode,
  5804. nextSibling: hostNextSibling,
  5805. setScopeId: hostSetScopeId = NOOP,
  5806. insertStaticContent: hostInsertStaticContent
  5807. } = options;
  5808. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  5809. if (n1 === n2) {
  5810. return;
  5811. }
  5812. if (n1 && !isSameVNodeType(n1, n2)) {
  5813. anchor = getNextHostNode(n1);
  5814. unmount(n1, parentComponent, parentSuspense, true);
  5815. n1 = null;
  5816. }
  5817. if (n2.patchFlag === -2) {
  5818. optimized = false;
  5819. n2.dynamicChildren = null;
  5820. }
  5821. const { type, ref, shapeFlag } = n2;
  5822. switch (type) {
  5823. case Text:
  5824. processText(n1, n2, container, anchor);
  5825. break;
  5826. case Comment:
  5827. processCommentNode(n1, n2, container, anchor);
  5828. break;
  5829. case Static:
  5830. if (n1 == null) {
  5831. mountStaticNode(n2, container, anchor, namespace);
  5832. } else {
  5833. patchStaticNode(n1, n2, container, namespace);
  5834. }
  5835. break;
  5836. case Fragment:
  5837. processFragment(
  5838. n1,
  5839. n2,
  5840. container,
  5841. anchor,
  5842. parentComponent,
  5843. parentSuspense,
  5844. namespace,
  5845. slotScopeIds,
  5846. optimized
  5847. );
  5848. break;
  5849. default:
  5850. if (shapeFlag & 1) {
  5851. processElement(
  5852. n1,
  5853. n2,
  5854. container,
  5855. anchor,
  5856. parentComponent,
  5857. parentSuspense,
  5858. namespace,
  5859. slotScopeIds,
  5860. optimized
  5861. );
  5862. } else if (shapeFlag & 6) {
  5863. processComponent(
  5864. n1,
  5865. n2,
  5866. container,
  5867. anchor,
  5868. parentComponent,
  5869. parentSuspense,
  5870. namespace,
  5871. slotScopeIds,
  5872. optimized
  5873. );
  5874. } else if (shapeFlag & 64) {
  5875. type.process(
  5876. n1,
  5877. n2,
  5878. container,
  5879. anchor,
  5880. parentComponent,
  5881. parentSuspense,
  5882. namespace,
  5883. slotScopeIds,
  5884. optimized,
  5885. internals
  5886. );
  5887. } else if (shapeFlag & 128) {
  5888. type.process(
  5889. n1,
  5890. n2,
  5891. container,
  5892. anchor,
  5893. parentComponent,
  5894. parentSuspense,
  5895. namespace,
  5896. slotScopeIds,
  5897. optimized,
  5898. internals
  5899. );
  5900. } else {
  5901. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  5902. }
  5903. }
  5904. if (ref != null && parentComponent) {
  5905. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  5906. }
  5907. };
  5908. const processText = (n1, n2, container, anchor) => {
  5909. if (n1 == null) {
  5910. hostInsert(
  5911. n2.el = hostCreateText(n2.children),
  5912. container,
  5913. anchor
  5914. );
  5915. } else {
  5916. const el = n2.el = n1.el;
  5917. if (n2.children !== n1.children) {
  5918. hostSetText(el, n2.children);
  5919. }
  5920. }
  5921. };
  5922. const processCommentNode = (n1, n2, container, anchor) => {
  5923. if (n1 == null) {
  5924. hostInsert(
  5925. n2.el = hostCreateComment(n2.children || ""),
  5926. container,
  5927. anchor
  5928. );
  5929. } else {
  5930. n2.el = n1.el;
  5931. }
  5932. };
  5933. const mountStaticNode = (n2, container, anchor, namespace) => {
  5934. [n2.el, n2.anchor] = hostInsertStaticContent(
  5935. n2.children,
  5936. container,
  5937. anchor,
  5938. namespace,
  5939. n2.el,
  5940. n2.anchor
  5941. );
  5942. };
  5943. const patchStaticNode = (n1, n2, container, namespace) => {
  5944. if (n2.children !== n1.children) {
  5945. const anchor = hostNextSibling(n1.anchor);
  5946. removeStaticNode(n1);
  5947. [n2.el, n2.anchor] = hostInsertStaticContent(
  5948. n2.children,
  5949. container,
  5950. anchor,
  5951. namespace
  5952. );
  5953. } else {
  5954. n2.el = n1.el;
  5955. n2.anchor = n1.anchor;
  5956. }
  5957. };
  5958. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  5959. let next;
  5960. while (el && el !== anchor) {
  5961. next = hostNextSibling(el);
  5962. hostInsert(el, container, nextSibling);
  5963. el = next;
  5964. }
  5965. hostInsert(anchor, container, nextSibling);
  5966. };
  5967. const removeStaticNode = ({ el, anchor }) => {
  5968. let next;
  5969. while (el && el !== anchor) {
  5970. next = hostNextSibling(el);
  5971. hostRemove(el);
  5972. el = next;
  5973. }
  5974. hostRemove(anchor);
  5975. };
  5976. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  5977. if (n2.type === "svg") {
  5978. namespace = "svg";
  5979. } else if (n2.type === "math") {
  5980. namespace = "mathml";
  5981. }
  5982. if (n1 == null) {
  5983. mountElement(
  5984. n2,
  5985. container,
  5986. anchor,
  5987. parentComponent,
  5988. parentSuspense,
  5989. namespace,
  5990. slotScopeIds,
  5991. optimized
  5992. );
  5993. } else {
  5994. patchElement(
  5995. n1,
  5996. n2,
  5997. parentComponent,
  5998. parentSuspense,
  5999. namespace,
  6000. slotScopeIds,
  6001. optimized
  6002. );
  6003. }
  6004. };
  6005. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6006. let el;
  6007. let vnodeHook;
  6008. const { props, shapeFlag, transition, dirs } = vnode;
  6009. el = vnode.el = hostCreateElement(
  6010. vnode.type,
  6011. namespace,
  6012. props && props.is,
  6013. props
  6014. );
  6015. if (shapeFlag & 8) {
  6016. hostSetElementText(el, vnode.children);
  6017. } else if (shapeFlag & 16) {
  6018. mountChildren(
  6019. vnode.children,
  6020. el,
  6021. null,
  6022. parentComponent,
  6023. parentSuspense,
  6024. resolveChildrenNamespace(vnode, namespace),
  6025. slotScopeIds,
  6026. optimized
  6027. );
  6028. }
  6029. if (dirs) {
  6030. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6031. }
  6032. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6033. if (props) {
  6034. for (const key in props) {
  6035. if (key !== "value" && !isReservedProp(key)) {
  6036. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6037. }
  6038. }
  6039. if ("value" in props) {
  6040. hostPatchProp(el, "value", null, props.value, namespace);
  6041. }
  6042. if (vnodeHook = props.onVnodeBeforeMount) {
  6043. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6044. }
  6045. }
  6046. {
  6047. def(el, "__vnode", vnode, true);
  6048. def(el, "__vueParentComponent", parentComponent, true);
  6049. }
  6050. if (dirs) {
  6051. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6052. }
  6053. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6054. if (needCallTransitionHooks) {
  6055. transition.beforeEnter(el);
  6056. }
  6057. hostInsert(el, container, anchor);
  6058. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6059. queuePostRenderEffect(() => {
  6060. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6061. needCallTransitionHooks && transition.enter(el);
  6062. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6063. }, parentSuspense);
  6064. }
  6065. };
  6066. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6067. if (scopeId) {
  6068. hostSetScopeId(el, scopeId);
  6069. }
  6070. if (slotScopeIds) {
  6071. for (let i = 0; i < slotScopeIds.length; i++) {
  6072. hostSetScopeId(el, slotScopeIds[i]);
  6073. }
  6074. }
  6075. if (parentComponent) {
  6076. let subTree = parentComponent.subTree;
  6077. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6078. subTree = filterSingleRoot(subTree.children) || subTree;
  6079. }
  6080. if (vnode === subTree) {
  6081. const parentVNode = parentComponent.vnode;
  6082. setScopeId(
  6083. el,
  6084. parentVNode,
  6085. parentVNode.scopeId,
  6086. parentVNode.slotScopeIds,
  6087. parentComponent.parent
  6088. );
  6089. }
  6090. }
  6091. };
  6092. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  6093. for (let i = start; i < children.length; i++) {
  6094. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6095. patch(
  6096. null,
  6097. child,
  6098. container,
  6099. anchor,
  6100. parentComponent,
  6101. parentSuspense,
  6102. namespace,
  6103. slotScopeIds,
  6104. optimized
  6105. );
  6106. }
  6107. };
  6108. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6109. const el = n2.el = n1.el;
  6110. {
  6111. el.__vnode = n2;
  6112. }
  6113. let { patchFlag, dynamicChildren, dirs } = n2;
  6114. patchFlag |= n1.patchFlag & 16;
  6115. const oldProps = n1.props || EMPTY_OBJ;
  6116. const newProps = n2.props || EMPTY_OBJ;
  6117. let vnodeHook;
  6118. parentComponent && toggleRecurse(parentComponent, false);
  6119. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6120. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6121. }
  6122. if (dirs) {
  6123. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6124. }
  6125. parentComponent && toggleRecurse(parentComponent, true);
  6126. if (isHmrUpdating) {
  6127. patchFlag = 0;
  6128. optimized = false;
  6129. dynamicChildren = null;
  6130. }
  6131. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  6132. hostSetElementText(el, "");
  6133. }
  6134. if (dynamicChildren) {
  6135. patchBlockChildren(
  6136. n1.dynamicChildren,
  6137. dynamicChildren,
  6138. el,
  6139. parentComponent,
  6140. parentSuspense,
  6141. resolveChildrenNamespace(n2, namespace),
  6142. slotScopeIds
  6143. );
  6144. {
  6145. traverseStaticChildren(n1, n2);
  6146. }
  6147. } else if (!optimized) {
  6148. patchChildren(
  6149. n1,
  6150. n2,
  6151. el,
  6152. null,
  6153. parentComponent,
  6154. parentSuspense,
  6155. resolveChildrenNamespace(n2, namespace),
  6156. slotScopeIds,
  6157. false
  6158. );
  6159. }
  6160. if (patchFlag > 0) {
  6161. if (patchFlag & 16) {
  6162. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6163. } else {
  6164. if (patchFlag & 2) {
  6165. if (oldProps.class !== newProps.class) {
  6166. hostPatchProp(el, "class", null, newProps.class, namespace);
  6167. }
  6168. }
  6169. if (patchFlag & 4) {
  6170. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  6171. }
  6172. if (patchFlag & 8) {
  6173. const propsToUpdate = n2.dynamicProps;
  6174. for (let i = 0; i < propsToUpdate.length; i++) {
  6175. const key = propsToUpdate[i];
  6176. const prev = oldProps[key];
  6177. const next = newProps[key];
  6178. if (next !== prev || key === "value") {
  6179. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6180. }
  6181. }
  6182. }
  6183. }
  6184. if (patchFlag & 1) {
  6185. if (n1.children !== n2.children) {
  6186. hostSetElementText(el, n2.children);
  6187. }
  6188. }
  6189. } else if (!optimized && dynamicChildren == null) {
  6190. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6191. }
  6192. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6193. queuePostRenderEffect(() => {
  6194. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6195. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6196. }, parentSuspense);
  6197. }
  6198. };
  6199. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  6200. for (let i = 0; i < newChildren.length; i++) {
  6201. const oldVNode = oldChildren[i];
  6202. const newVNode = newChildren[i];
  6203. const container = (
  6204. // oldVNode may be an errored async setup() component inside Suspense
  6205. // which will not have a mounted element
  6206. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6207. // of the Fragment itself so it can move its children.
  6208. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6209. // which also requires the correct parent container
  6210. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6211. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6212. // In other cases, the parent container is not actually used so we
  6213. // just pass the block element here to avoid a DOM parentNode call.
  6214. fallbackContainer
  6215. )
  6216. );
  6217. patch(
  6218. oldVNode,
  6219. newVNode,
  6220. container,
  6221. null,
  6222. parentComponent,
  6223. parentSuspense,
  6224. namespace,
  6225. slotScopeIds,
  6226. true
  6227. );
  6228. }
  6229. };
  6230. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  6231. if (oldProps !== newProps) {
  6232. if (oldProps !== EMPTY_OBJ) {
  6233. for (const key in oldProps) {
  6234. if (!isReservedProp(key) && !(key in newProps)) {
  6235. hostPatchProp(
  6236. el,
  6237. key,
  6238. oldProps[key],
  6239. null,
  6240. namespace,
  6241. parentComponent
  6242. );
  6243. }
  6244. }
  6245. }
  6246. for (const key in newProps) {
  6247. if (isReservedProp(key)) continue;
  6248. const next = newProps[key];
  6249. const prev = oldProps[key];
  6250. if (next !== prev && key !== "value") {
  6251. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6252. }
  6253. }
  6254. if ("value" in newProps) {
  6255. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  6256. }
  6257. }
  6258. };
  6259. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6260. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6261. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6262. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6263. if (
  6264. // #5523 dev root fragment may inherit directives
  6265. isHmrUpdating || patchFlag & 2048
  6266. ) {
  6267. patchFlag = 0;
  6268. optimized = false;
  6269. dynamicChildren = null;
  6270. }
  6271. if (fragmentSlotScopeIds) {
  6272. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6273. }
  6274. if (n1 == null) {
  6275. hostInsert(fragmentStartAnchor, container, anchor);
  6276. hostInsert(fragmentEndAnchor, container, anchor);
  6277. mountChildren(
  6278. // #10007
  6279. // such fragment like `<></>` will be compiled into
  6280. // a fragment which doesn't have a children.
  6281. // In this case fallback to an empty array
  6282. n2.children || [],
  6283. container,
  6284. fragmentEndAnchor,
  6285. parentComponent,
  6286. parentSuspense,
  6287. namespace,
  6288. slotScopeIds,
  6289. optimized
  6290. );
  6291. } else {
  6292. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6293. // of renderSlot() with no valid children
  6294. n1.dynamicChildren) {
  6295. patchBlockChildren(
  6296. n1.dynamicChildren,
  6297. dynamicChildren,
  6298. container,
  6299. parentComponent,
  6300. parentSuspense,
  6301. namespace,
  6302. slotScopeIds
  6303. );
  6304. {
  6305. traverseStaticChildren(n1, n2);
  6306. }
  6307. } else {
  6308. patchChildren(
  6309. n1,
  6310. n2,
  6311. container,
  6312. fragmentEndAnchor,
  6313. parentComponent,
  6314. parentSuspense,
  6315. namespace,
  6316. slotScopeIds,
  6317. optimized
  6318. );
  6319. }
  6320. }
  6321. };
  6322. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6323. n2.slotScopeIds = slotScopeIds;
  6324. if (n1 == null) {
  6325. if (n2.shapeFlag & 512) {
  6326. parentComponent.ctx.activate(
  6327. n2,
  6328. container,
  6329. anchor,
  6330. namespace,
  6331. optimized
  6332. );
  6333. } else {
  6334. mountComponent(
  6335. n2,
  6336. container,
  6337. anchor,
  6338. parentComponent,
  6339. parentSuspense,
  6340. namespace,
  6341. optimized
  6342. );
  6343. }
  6344. } else {
  6345. updateComponent(n1, n2, optimized);
  6346. }
  6347. };
  6348. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  6349. const instance = (initialVNode.component = createComponentInstance(
  6350. initialVNode,
  6351. parentComponent,
  6352. parentSuspense
  6353. ));
  6354. if (instance.type.__hmrId) {
  6355. registerHMR(instance);
  6356. }
  6357. {
  6358. pushWarningContext(initialVNode);
  6359. startMeasure(instance, `mount`);
  6360. }
  6361. if (isKeepAlive(initialVNode)) {
  6362. instance.ctx.renderer = internals;
  6363. }
  6364. {
  6365. {
  6366. startMeasure(instance, `init`);
  6367. }
  6368. setupComponent(instance, false, optimized);
  6369. {
  6370. endMeasure(instance, `init`);
  6371. }
  6372. }
  6373. if (instance.asyncDep) {
  6374. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  6375. if (!initialVNode.el) {
  6376. const placeholder = instance.subTree = createVNode(Comment);
  6377. processCommentNode(null, placeholder, container, anchor);
  6378. }
  6379. } else {
  6380. setupRenderEffect(
  6381. instance,
  6382. initialVNode,
  6383. container,
  6384. anchor,
  6385. parentSuspense,
  6386. namespace,
  6387. optimized
  6388. );
  6389. }
  6390. {
  6391. popWarningContext();
  6392. endMeasure(instance, `mount`);
  6393. }
  6394. };
  6395. const updateComponent = (n1, n2, optimized) => {
  6396. const instance = n2.component = n1.component;
  6397. if (shouldUpdateComponent(n1, n2, optimized)) {
  6398. if (instance.asyncDep && !instance.asyncResolved) {
  6399. {
  6400. pushWarningContext(n2);
  6401. }
  6402. updateComponentPreRender(instance, n2, optimized);
  6403. {
  6404. popWarningContext();
  6405. }
  6406. return;
  6407. } else {
  6408. instance.next = n2;
  6409. invalidateJob(instance.update);
  6410. instance.effect.dirty = true;
  6411. instance.update();
  6412. }
  6413. } else {
  6414. n2.el = n1.el;
  6415. instance.vnode = n2;
  6416. }
  6417. };
  6418. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  6419. const componentUpdateFn = () => {
  6420. if (!instance.isMounted) {
  6421. let vnodeHook;
  6422. const { el, props } = initialVNode;
  6423. const { bm, m, parent } = instance;
  6424. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6425. toggleRecurse(instance, false);
  6426. if (bm) {
  6427. invokeArrayFns(bm);
  6428. }
  6429. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6430. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6431. }
  6432. toggleRecurse(instance, true);
  6433. if (el && hydrateNode) {
  6434. const hydrateSubTree = () => {
  6435. {
  6436. startMeasure(instance, `render`);
  6437. }
  6438. instance.subTree = renderComponentRoot(instance);
  6439. {
  6440. endMeasure(instance, `render`);
  6441. }
  6442. {
  6443. startMeasure(instance, `hydrate`);
  6444. }
  6445. hydrateNode(
  6446. el,
  6447. instance.subTree,
  6448. instance,
  6449. parentSuspense,
  6450. null
  6451. );
  6452. {
  6453. endMeasure(instance, `hydrate`);
  6454. }
  6455. };
  6456. if (isAsyncWrapperVNode) {
  6457. initialVNode.type.__asyncLoader().then(
  6458. // note: we are moving the render call into an async callback,
  6459. // which means it won't track dependencies - but it's ok because
  6460. // a server-rendered async wrapper is already in resolved state
  6461. // and it will never need to change.
  6462. () => !instance.isUnmounted && hydrateSubTree()
  6463. );
  6464. } else {
  6465. hydrateSubTree();
  6466. }
  6467. } else {
  6468. {
  6469. startMeasure(instance, `render`);
  6470. }
  6471. const subTree = instance.subTree = renderComponentRoot(instance);
  6472. {
  6473. endMeasure(instance, `render`);
  6474. }
  6475. {
  6476. startMeasure(instance, `patch`);
  6477. }
  6478. patch(
  6479. null,
  6480. subTree,
  6481. container,
  6482. anchor,
  6483. instance,
  6484. parentSuspense,
  6485. namespace
  6486. );
  6487. {
  6488. endMeasure(instance, `patch`);
  6489. }
  6490. initialVNode.el = subTree.el;
  6491. }
  6492. if (m) {
  6493. queuePostRenderEffect(m, parentSuspense);
  6494. }
  6495. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  6496. const scopedInitialVNode = initialVNode;
  6497. queuePostRenderEffect(
  6498. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  6499. parentSuspense
  6500. );
  6501. }
  6502. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  6503. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  6504. }
  6505. instance.isMounted = true;
  6506. {
  6507. devtoolsComponentAdded(instance);
  6508. }
  6509. initialVNode = container = anchor = null;
  6510. } else {
  6511. let { next, bu, u, parent, vnode } = instance;
  6512. {
  6513. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  6514. if (nonHydratedAsyncRoot) {
  6515. if (next) {
  6516. next.el = vnode.el;
  6517. updateComponentPreRender(instance, next, optimized);
  6518. }
  6519. nonHydratedAsyncRoot.asyncDep.then(() => {
  6520. if (!instance.isUnmounted) {
  6521. componentUpdateFn();
  6522. }
  6523. });
  6524. return;
  6525. }
  6526. }
  6527. let originNext = next;
  6528. let vnodeHook;
  6529. {
  6530. pushWarningContext(next || instance.vnode);
  6531. }
  6532. toggleRecurse(instance, false);
  6533. if (next) {
  6534. next.el = vnode.el;
  6535. updateComponentPreRender(instance, next, optimized);
  6536. } else {
  6537. next = vnode;
  6538. }
  6539. if (bu) {
  6540. invokeArrayFns(bu);
  6541. }
  6542. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  6543. invokeVNodeHook(vnodeHook, parent, next, vnode);
  6544. }
  6545. toggleRecurse(instance, true);
  6546. {
  6547. startMeasure(instance, `render`);
  6548. }
  6549. const nextTree = renderComponentRoot(instance);
  6550. {
  6551. endMeasure(instance, `render`);
  6552. }
  6553. const prevTree = instance.subTree;
  6554. instance.subTree = nextTree;
  6555. {
  6556. startMeasure(instance, `patch`);
  6557. }
  6558. patch(
  6559. prevTree,
  6560. nextTree,
  6561. // parent may have changed if it's in a teleport
  6562. hostParentNode(prevTree.el),
  6563. // anchor may have changed if it's in a fragment
  6564. getNextHostNode(prevTree),
  6565. instance,
  6566. parentSuspense,
  6567. namespace
  6568. );
  6569. {
  6570. endMeasure(instance, `patch`);
  6571. }
  6572. next.el = nextTree.el;
  6573. if (originNext === null) {
  6574. updateHOCHostEl(instance, nextTree.el);
  6575. }
  6576. if (u) {
  6577. queuePostRenderEffect(u, parentSuspense);
  6578. }
  6579. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  6580. queuePostRenderEffect(
  6581. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  6582. parentSuspense
  6583. );
  6584. }
  6585. {
  6586. devtoolsComponentUpdated(instance);
  6587. }
  6588. {
  6589. popWarningContext();
  6590. }
  6591. }
  6592. };
  6593. const effect = instance.effect = new ReactiveEffect(
  6594. componentUpdateFn,
  6595. NOOP,
  6596. () => queueJob(update),
  6597. instance.scope
  6598. // track it in component's effect scope
  6599. );
  6600. const update = instance.update = () => {
  6601. if (effect.dirty) {
  6602. effect.run();
  6603. }
  6604. };
  6605. update.i = instance;
  6606. update.id = instance.uid;
  6607. toggleRecurse(instance, true);
  6608. {
  6609. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  6610. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  6611. }
  6612. update();
  6613. };
  6614. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  6615. nextVNode.component = instance;
  6616. const prevProps = instance.vnode.props;
  6617. instance.vnode = nextVNode;
  6618. instance.next = null;
  6619. updateProps(instance, nextVNode.props, prevProps, optimized);
  6620. updateSlots(instance, nextVNode.children, optimized);
  6621. pauseTracking();
  6622. flushPreFlushCbs(instance);
  6623. resetTracking();
  6624. };
  6625. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  6626. const c1 = n1 && n1.children;
  6627. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  6628. const c2 = n2.children;
  6629. const { patchFlag, shapeFlag } = n2;
  6630. if (patchFlag > 0) {
  6631. if (patchFlag & 128) {
  6632. patchKeyedChildren(
  6633. c1,
  6634. c2,
  6635. container,
  6636. anchor,
  6637. parentComponent,
  6638. parentSuspense,
  6639. namespace,
  6640. slotScopeIds,
  6641. optimized
  6642. );
  6643. return;
  6644. } else if (patchFlag & 256) {
  6645. patchUnkeyedChildren(
  6646. c1,
  6647. c2,
  6648. container,
  6649. anchor,
  6650. parentComponent,
  6651. parentSuspense,
  6652. namespace,
  6653. slotScopeIds,
  6654. optimized
  6655. );
  6656. return;
  6657. }
  6658. }
  6659. if (shapeFlag & 8) {
  6660. if (prevShapeFlag & 16) {
  6661. unmountChildren(c1, parentComponent, parentSuspense);
  6662. }
  6663. if (c2 !== c1) {
  6664. hostSetElementText(container, c2);
  6665. }
  6666. } else {
  6667. if (prevShapeFlag & 16) {
  6668. if (shapeFlag & 16) {
  6669. patchKeyedChildren(
  6670. c1,
  6671. c2,
  6672. container,
  6673. anchor,
  6674. parentComponent,
  6675. parentSuspense,
  6676. namespace,
  6677. slotScopeIds,
  6678. optimized
  6679. );
  6680. } else {
  6681. unmountChildren(c1, parentComponent, parentSuspense, true);
  6682. }
  6683. } else {
  6684. if (prevShapeFlag & 8) {
  6685. hostSetElementText(container, "");
  6686. }
  6687. if (shapeFlag & 16) {
  6688. mountChildren(
  6689. c2,
  6690. container,
  6691. anchor,
  6692. parentComponent,
  6693. parentSuspense,
  6694. namespace,
  6695. slotScopeIds,
  6696. optimized
  6697. );
  6698. }
  6699. }
  6700. }
  6701. };
  6702. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6703. c1 = c1 || EMPTY_ARR;
  6704. c2 = c2 || EMPTY_ARR;
  6705. const oldLength = c1.length;
  6706. const newLength = c2.length;
  6707. const commonLength = Math.min(oldLength, newLength);
  6708. let i;
  6709. for (i = 0; i < commonLength; i++) {
  6710. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6711. patch(
  6712. c1[i],
  6713. nextChild,
  6714. container,
  6715. null,
  6716. parentComponent,
  6717. parentSuspense,
  6718. namespace,
  6719. slotScopeIds,
  6720. optimized
  6721. );
  6722. }
  6723. if (oldLength > newLength) {
  6724. unmountChildren(
  6725. c1,
  6726. parentComponent,
  6727. parentSuspense,
  6728. true,
  6729. false,
  6730. commonLength
  6731. );
  6732. } else {
  6733. mountChildren(
  6734. c2,
  6735. container,
  6736. anchor,
  6737. parentComponent,
  6738. parentSuspense,
  6739. namespace,
  6740. slotScopeIds,
  6741. optimized,
  6742. commonLength
  6743. );
  6744. }
  6745. };
  6746. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6747. let i = 0;
  6748. const l2 = c2.length;
  6749. let e1 = c1.length - 1;
  6750. let e2 = l2 - 1;
  6751. while (i <= e1 && i <= e2) {
  6752. const n1 = c1[i];
  6753. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6754. if (isSameVNodeType(n1, n2)) {
  6755. patch(
  6756. n1,
  6757. n2,
  6758. container,
  6759. null,
  6760. parentComponent,
  6761. parentSuspense,
  6762. namespace,
  6763. slotScopeIds,
  6764. optimized
  6765. );
  6766. } else {
  6767. break;
  6768. }
  6769. i++;
  6770. }
  6771. while (i <= e1 && i <= e2) {
  6772. const n1 = c1[e1];
  6773. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  6774. if (isSameVNodeType(n1, n2)) {
  6775. patch(
  6776. n1,
  6777. n2,
  6778. container,
  6779. null,
  6780. parentComponent,
  6781. parentSuspense,
  6782. namespace,
  6783. slotScopeIds,
  6784. optimized
  6785. );
  6786. } else {
  6787. break;
  6788. }
  6789. e1--;
  6790. e2--;
  6791. }
  6792. if (i > e1) {
  6793. if (i <= e2) {
  6794. const nextPos = e2 + 1;
  6795. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  6796. while (i <= e2) {
  6797. patch(
  6798. null,
  6799. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  6800. container,
  6801. anchor,
  6802. parentComponent,
  6803. parentSuspense,
  6804. namespace,
  6805. slotScopeIds,
  6806. optimized
  6807. );
  6808. i++;
  6809. }
  6810. }
  6811. } else if (i > e2) {
  6812. while (i <= e1) {
  6813. unmount(c1[i], parentComponent, parentSuspense, true);
  6814. i++;
  6815. }
  6816. } else {
  6817. const s1 = i;
  6818. const s2 = i;
  6819. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  6820. for (i = s2; i <= e2; i++) {
  6821. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6822. if (nextChild.key != null) {
  6823. if (keyToNewIndexMap.has(nextChild.key)) {
  6824. warn$1(
  6825. `Duplicate keys found during update:`,
  6826. JSON.stringify(nextChild.key),
  6827. `Make sure keys are unique.`
  6828. );
  6829. }
  6830. keyToNewIndexMap.set(nextChild.key, i);
  6831. }
  6832. }
  6833. let j;
  6834. let patched = 0;
  6835. const toBePatched = e2 - s2 + 1;
  6836. let moved = false;
  6837. let maxNewIndexSoFar = 0;
  6838. const newIndexToOldIndexMap = new Array(toBePatched);
  6839. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  6840. for (i = s1; i <= e1; i++) {
  6841. const prevChild = c1[i];
  6842. if (patched >= toBePatched) {
  6843. unmount(prevChild, parentComponent, parentSuspense, true);
  6844. continue;
  6845. }
  6846. let newIndex;
  6847. if (prevChild.key != null) {
  6848. newIndex = keyToNewIndexMap.get(prevChild.key);
  6849. } else {
  6850. for (j = s2; j <= e2; j++) {
  6851. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  6852. newIndex = j;
  6853. break;
  6854. }
  6855. }
  6856. }
  6857. if (newIndex === void 0) {
  6858. unmount(prevChild, parentComponent, parentSuspense, true);
  6859. } else {
  6860. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  6861. if (newIndex >= maxNewIndexSoFar) {
  6862. maxNewIndexSoFar = newIndex;
  6863. } else {
  6864. moved = true;
  6865. }
  6866. patch(
  6867. prevChild,
  6868. c2[newIndex],
  6869. container,
  6870. null,
  6871. parentComponent,
  6872. parentSuspense,
  6873. namespace,
  6874. slotScopeIds,
  6875. optimized
  6876. );
  6877. patched++;
  6878. }
  6879. }
  6880. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  6881. j = increasingNewIndexSequence.length - 1;
  6882. for (i = toBePatched - 1; i >= 0; i--) {
  6883. const nextIndex = s2 + i;
  6884. const nextChild = c2[nextIndex];
  6885. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  6886. if (newIndexToOldIndexMap[i] === 0) {
  6887. patch(
  6888. null,
  6889. nextChild,
  6890. container,
  6891. anchor,
  6892. parentComponent,
  6893. parentSuspense,
  6894. namespace,
  6895. slotScopeIds,
  6896. optimized
  6897. );
  6898. } else if (moved) {
  6899. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  6900. move(nextChild, container, anchor, 2);
  6901. } else {
  6902. j--;
  6903. }
  6904. }
  6905. }
  6906. }
  6907. };
  6908. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  6909. const { el, type, transition, children, shapeFlag } = vnode;
  6910. if (shapeFlag & 6) {
  6911. move(vnode.component.subTree, container, anchor, moveType);
  6912. return;
  6913. }
  6914. if (shapeFlag & 128) {
  6915. vnode.suspense.move(container, anchor, moveType);
  6916. return;
  6917. }
  6918. if (shapeFlag & 64) {
  6919. type.move(vnode, container, anchor, internals);
  6920. return;
  6921. }
  6922. if (type === Fragment) {
  6923. hostInsert(el, container, anchor);
  6924. for (let i = 0; i < children.length; i++) {
  6925. move(children[i], container, anchor, moveType);
  6926. }
  6927. hostInsert(vnode.anchor, container, anchor);
  6928. return;
  6929. }
  6930. if (type === Static) {
  6931. moveStaticNode(vnode, container, anchor);
  6932. return;
  6933. }
  6934. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  6935. if (needTransition2) {
  6936. if (moveType === 0) {
  6937. transition.beforeEnter(el);
  6938. hostInsert(el, container, anchor);
  6939. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  6940. } else {
  6941. const { leave, delayLeave, afterLeave } = transition;
  6942. const remove2 = () => hostInsert(el, container, anchor);
  6943. const performLeave = () => {
  6944. leave(el, () => {
  6945. remove2();
  6946. afterLeave && afterLeave();
  6947. });
  6948. };
  6949. if (delayLeave) {
  6950. delayLeave(el, remove2, performLeave);
  6951. } else {
  6952. performLeave();
  6953. }
  6954. }
  6955. } else {
  6956. hostInsert(el, container, anchor);
  6957. }
  6958. };
  6959. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  6960. const {
  6961. type,
  6962. props,
  6963. ref,
  6964. children,
  6965. dynamicChildren,
  6966. shapeFlag,
  6967. patchFlag,
  6968. dirs,
  6969. cacheIndex
  6970. } = vnode;
  6971. if (patchFlag === -2) {
  6972. optimized = false;
  6973. }
  6974. if (ref != null) {
  6975. setRef(ref, null, parentSuspense, vnode, true);
  6976. }
  6977. if (cacheIndex != null) {
  6978. parentComponent.renderCache[cacheIndex] = void 0;
  6979. }
  6980. if (shapeFlag & 256) {
  6981. parentComponent.ctx.deactivate(vnode);
  6982. return;
  6983. }
  6984. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  6985. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  6986. let vnodeHook;
  6987. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  6988. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6989. }
  6990. if (shapeFlag & 6) {
  6991. unmountComponent(vnode.component, parentSuspense, doRemove);
  6992. } else {
  6993. if (shapeFlag & 128) {
  6994. vnode.suspense.unmount(parentSuspense, doRemove);
  6995. return;
  6996. }
  6997. if (shouldInvokeDirs) {
  6998. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  6999. }
  7000. if (shapeFlag & 64) {
  7001. vnode.type.remove(
  7002. vnode,
  7003. parentComponent,
  7004. parentSuspense,
  7005. internals,
  7006. doRemove
  7007. );
  7008. } else if (dynamicChildren && // #5154
  7009. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7010. // parent block with hasOnce: true
  7011. // so that it doesn't take the fast path during unmount - otherwise
  7012. // components nested in v-once are never unmounted.
  7013. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7014. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7015. unmountChildren(
  7016. dynamicChildren,
  7017. parentComponent,
  7018. parentSuspense,
  7019. false,
  7020. true
  7021. );
  7022. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7023. unmountChildren(children, parentComponent, parentSuspense);
  7024. }
  7025. if (doRemove) {
  7026. remove(vnode);
  7027. }
  7028. }
  7029. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7030. queuePostRenderEffect(() => {
  7031. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7032. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7033. }, parentSuspense);
  7034. }
  7035. };
  7036. const remove = (vnode) => {
  7037. const { type, el, anchor, transition } = vnode;
  7038. if (type === Fragment) {
  7039. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7040. vnode.children.forEach((child) => {
  7041. if (child.type === Comment) {
  7042. hostRemove(child.el);
  7043. } else {
  7044. remove(child);
  7045. }
  7046. });
  7047. } else {
  7048. removeFragment(el, anchor);
  7049. }
  7050. return;
  7051. }
  7052. if (type === Static) {
  7053. removeStaticNode(vnode);
  7054. return;
  7055. }
  7056. const performRemove = () => {
  7057. hostRemove(el);
  7058. if (transition && !transition.persisted && transition.afterLeave) {
  7059. transition.afterLeave();
  7060. }
  7061. };
  7062. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7063. const { leave, delayLeave } = transition;
  7064. const performLeave = () => leave(el, performRemove);
  7065. if (delayLeave) {
  7066. delayLeave(vnode.el, performRemove, performLeave);
  7067. } else {
  7068. performLeave();
  7069. }
  7070. } else {
  7071. performRemove();
  7072. }
  7073. };
  7074. const removeFragment = (cur, end) => {
  7075. let next;
  7076. while (cur !== end) {
  7077. next = hostNextSibling(cur);
  7078. hostRemove(cur);
  7079. cur = next;
  7080. }
  7081. hostRemove(end);
  7082. };
  7083. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7084. if (instance.type.__hmrId) {
  7085. unregisterHMR(instance);
  7086. }
  7087. const { bum, scope, update, subTree, um, m, a } = instance;
  7088. invalidateMount(m);
  7089. invalidateMount(a);
  7090. if (bum) {
  7091. invokeArrayFns(bum);
  7092. }
  7093. scope.stop();
  7094. if (update) {
  7095. update.active = false;
  7096. unmount(subTree, instance, parentSuspense, doRemove);
  7097. }
  7098. if (um) {
  7099. queuePostRenderEffect(um, parentSuspense);
  7100. }
  7101. queuePostRenderEffect(() => {
  7102. instance.isUnmounted = true;
  7103. }, parentSuspense);
  7104. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7105. parentSuspense.deps--;
  7106. if (parentSuspense.deps === 0) {
  7107. parentSuspense.resolve();
  7108. }
  7109. }
  7110. {
  7111. devtoolsComponentRemoved(instance);
  7112. }
  7113. };
  7114. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7115. for (let i = start; i < children.length; i++) {
  7116. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7117. }
  7118. };
  7119. const getNextHostNode = (vnode) => {
  7120. if (vnode.shapeFlag & 6) {
  7121. return getNextHostNode(vnode.component.subTree);
  7122. }
  7123. if (vnode.shapeFlag & 128) {
  7124. return vnode.suspense.next();
  7125. }
  7126. const el = hostNextSibling(vnode.anchor || vnode.el);
  7127. const teleportEnd = el && el[TeleportEndKey];
  7128. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  7129. };
  7130. let isFlushing = false;
  7131. const render = (vnode, container, namespace) => {
  7132. if (vnode == null) {
  7133. if (container._vnode) {
  7134. unmount(container._vnode, null, null, true);
  7135. }
  7136. } else {
  7137. patch(
  7138. container._vnode || null,
  7139. vnode,
  7140. container,
  7141. null,
  7142. null,
  7143. null,
  7144. namespace
  7145. );
  7146. }
  7147. container._vnode = vnode;
  7148. if (!isFlushing) {
  7149. isFlushing = true;
  7150. flushPreFlushCbs();
  7151. flushPostFlushCbs();
  7152. isFlushing = false;
  7153. }
  7154. };
  7155. const internals = {
  7156. p: patch,
  7157. um: unmount,
  7158. m: move,
  7159. r: remove,
  7160. mt: mountComponent,
  7161. mc: mountChildren,
  7162. pc: patchChildren,
  7163. pbc: patchBlockChildren,
  7164. n: getNextHostNode,
  7165. o: options
  7166. };
  7167. let hydrate;
  7168. let hydrateNode;
  7169. if (createHydrationFns) {
  7170. [hydrate, hydrateNode] = createHydrationFns(
  7171. internals
  7172. );
  7173. }
  7174. return {
  7175. render,
  7176. hydrate,
  7177. createApp: createAppAPI(render, hydrate)
  7178. };
  7179. }
  7180. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  7181. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  7182. }
  7183. function toggleRecurse({ effect, update }, allowed) {
  7184. effect.allowRecurse = update.allowRecurse = allowed;
  7185. }
  7186. function needTransition(parentSuspense, transition) {
  7187. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  7188. }
  7189. function traverseStaticChildren(n1, n2, shallow = false) {
  7190. const ch1 = n1.children;
  7191. const ch2 = n2.children;
  7192. if (isArray(ch1) && isArray(ch2)) {
  7193. for (let i = 0; i < ch1.length; i++) {
  7194. const c1 = ch1[i];
  7195. let c2 = ch2[i];
  7196. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7197. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7198. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7199. c2.el = c1.el;
  7200. }
  7201. if (!shallow && c2.patchFlag !== -2)
  7202. traverseStaticChildren(c1, c2);
  7203. }
  7204. if (c2.type === Text) {
  7205. c2.el = c1.el;
  7206. }
  7207. if (c2.type === Comment && !c2.el) {
  7208. c2.el = c1.el;
  7209. }
  7210. }
  7211. }
  7212. }
  7213. function getSequence(arr) {
  7214. const p = arr.slice();
  7215. const result = [0];
  7216. let i, j, u, v, c;
  7217. const len = arr.length;
  7218. for (i = 0; i < len; i++) {
  7219. const arrI = arr[i];
  7220. if (arrI !== 0) {
  7221. j = result[result.length - 1];
  7222. if (arr[j] < arrI) {
  7223. p[i] = j;
  7224. result.push(i);
  7225. continue;
  7226. }
  7227. u = 0;
  7228. v = result.length - 1;
  7229. while (u < v) {
  7230. c = u + v >> 1;
  7231. if (arr[result[c]] < arrI) {
  7232. u = c + 1;
  7233. } else {
  7234. v = c;
  7235. }
  7236. }
  7237. if (arrI < arr[result[u]]) {
  7238. if (u > 0) {
  7239. p[i] = result[u - 1];
  7240. }
  7241. result[u] = i;
  7242. }
  7243. }
  7244. }
  7245. u = result.length;
  7246. v = result[u - 1];
  7247. while (u-- > 0) {
  7248. result[u] = v;
  7249. v = p[v];
  7250. }
  7251. return result;
  7252. }
  7253. function locateNonHydratedAsyncRoot(instance) {
  7254. const subComponent = instance.subTree.component;
  7255. if (subComponent) {
  7256. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  7257. return subComponent;
  7258. } else {
  7259. return locateNonHydratedAsyncRoot(subComponent);
  7260. }
  7261. }
  7262. }
  7263. function invalidateMount(hooks) {
  7264. if (hooks) {
  7265. for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
  7266. }
  7267. }
  7268. const ssrContextKey = Symbol.for("v-scx");
  7269. const useSSRContext = () => {
  7270. {
  7271. warn$1(`useSSRContext() is not supported in the global build.`);
  7272. }
  7273. };
  7274. function watchEffect(effect, options) {
  7275. return doWatch(effect, null, options);
  7276. }
  7277. function watchPostEffect(effect, options) {
  7278. return doWatch(
  7279. effect,
  7280. null,
  7281. extend({}, options, { flush: "post" })
  7282. );
  7283. }
  7284. function watchSyncEffect(effect, options) {
  7285. return doWatch(
  7286. effect,
  7287. null,
  7288. extend({}, options, { flush: "sync" })
  7289. );
  7290. }
  7291. const INITIAL_WATCHER_VALUE = {};
  7292. function watch(source, cb, options) {
  7293. if (!isFunction(cb)) {
  7294. warn$1(
  7295. `\`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.`
  7296. );
  7297. }
  7298. return doWatch(source, cb, options);
  7299. }
  7300. function doWatch(source, cb, {
  7301. immediate,
  7302. deep,
  7303. flush,
  7304. once,
  7305. onTrack,
  7306. onTrigger
  7307. } = EMPTY_OBJ) {
  7308. if (cb && once) {
  7309. const _cb = cb;
  7310. cb = (...args) => {
  7311. _cb(...args);
  7312. unwatch();
  7313. };
  7314. }
  7315. if (deep !== void 0 && typeof deep === "number") {
  7316. warn$1(
  7317. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  7318. );
  7319. }
  7320. if (!cb) {
  7321. if (immediate !== void 0) {
  7322. warn$1(
  7323. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  7324. );
  7325. }
  7326. if (deep !== void 0) {
  7327. warn$1(
  7328. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  7329. );
  7330. }
  7331. if (once !== void 0) {
  7332. warn$1(
  7333. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  7334. );
  7335. }
  7336. }
  7337. const warnInvalidSource = (s) => {
  7338. warn$1(
  7339. `Invalid watch source: `,
  7340. s,
  7341. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  7342. );
  7343. };
  7344. const instance = currentInstance;
  7345. const reactiveGetter = (source2) => deep === true ? source2 : (
  7346. // for deep: false, only traverse root-level properties
  7347. traverse(source2, deep === false ? 1 : void 0)
  7348. );
  7349. let getter;
  7350. let forceTrigger = false;
  7351. let isMultiSource = false;
  7352. if (isRef(source)) {
  7353. getter = () => source.value;
  7354. forceTrigger = isShallow(source);
  7355. } else if (isReactive(source)) {
  7356. getter = () => reactiveGetter(source);
  7357. forceTrigger = true;
  7358. } else if (isArray(source)) {
  7359. isMultiSource = true;
  7360. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  7361. getter = () => source.map((s) => {
  7362. if (isRef(s)) {
  7363. return s.value;
  7364. } else if (isReactive(s)) {
  7365. return reactiveGetter(s);
  7366. } else if (isFunction(s)) {
  7367. return callWithErrorHandling(s, instance, 2);
  7368. } else {
  7369. warnInvalidSource(s);
  7370. }
  7371. });
  7372. } else if (isFunction(source)) {
  7373. if (cb) {
  7374. getter = () => callWithErrorHandling(source, instance, 2);
  7375. } else {
  7376. getter = () => {
  7377. if (cleanup) {
  7378. cleanup();
  7379. }
  7380. return callWithAsyncErrorHandling(
  7381. source,
  7382. instance,
  7383. 3,
  7384. [onCleanup]
  7385. );
  7386. };
  7387. }
  7388. } else {
  7389. getter = NOOP;
  7390. warnInvalidSource(source);
  7391. }
  7392. if (cb && deep) {
  7393. const baseGetter = getter;
  7394. getter = () => traverse(baseGetter());
  7395. }
  7396. let cleanup;
  7397. let onCleanup = (fn) => {
  7398. cleanup = effect.onStop = () => {
  7399. callWithErrorHandling(fn, instance, 4);
  7400. cleanup = effect.onStop = void 0;
  7401. };
  7402. };
  7403. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  7404. const job = () => {
  7405. if (!effect.active || !effect.dirty) {
  7406. return;
  7407. }
  7408. if (cb) {
  7409. const newValue = effect.run();
  7410. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  7411. if (cleanup) {
  7412. cleanup();
  7413. }
  7414. callWithAsyncErrorHandling(cb, instance, 3, [
  7415. newValue,
  7416. // pass undefined as the old value when it's changed for the first time
  7417. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  7418. onCleanup
  7419. ]);
  7420. oldValue = newValue;
  7421. }
  7422. } else {
  7423. effect.run();
  7424. }
  7425. };
  7426. job.allowRecurse = !!cb;
  7427. let scheduler;
  7428. if (flush === "sync") {
  7429. scheduler = job;
  7430. } else if (flush === "post") {
  7431. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  7432. } else {
  7433. job.pre = true;
  7434. if (instance) job.id = instance.uid;
  7435. scheduler = () => queueJob(job);
  7436. }
  7437. const effect = new ReactiveEffect(getter, NOOP, scheduler);
  7438. const scope = getCurrentScope();
  7439. const unwatch = () => {
  7440. effect.stop();
  7441. if (scope) {
  7442. remove(scope.effects, effect);
  7443. }
  7444. };
  7445. {
  7446. effect.onTrack = onTrack;
  7447. effect.onTrigger = onTrigger;
  7448. }
  7449. if (cb) {
  7450. if (immediate) {
  7451. job();
  7452. } else {
  7453. oldValue = effect.run();
  7454. }
  7455. } else if (flush === "post") {
  7456. queuePostRenderEffect(
  7457. effect.run.bind(effect),
  7458. instance && instance.suspense
  7459. );
  7460. } else {
  7461. effect.run();
  7462. }
  7463. return unwatch;
  7464. }
  7465. function instanceWatch(source, value, options) {
  7466. const publicThis = this.proxy;
  7467. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  7468. let cb;
  7469. if (isFunction(value)) {
  7470. cb = value;
  7471. } else {
  7472. cb = value.handler;
  7473. options = value;
  7474. }
  7475. const reset = setCurrentInstance(this);
  7476. const res = doWatch(getter, cb.bind(publicThis), options);
  7477. reset();
  7478. return res;
  7479. }
  7480. function createPathGetter(ctx, path) {
  7481. const segments = path.split(".");
  7482. return () => {
  7483. let cur = ctx;
  7484. for (let i = 0; i < segments.length && cur; i++) {
  7485. cur = cur[segments[i]];
  7486. }
  7487. return cur;
  7488. };
  7489. }
  7490. function traverse(value, depth = Infinity, seen) {
  7491. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  7492. return value;
  7493. }
  7494. seen = seen || /* @__PURE__ */ new Set();
  7495. if (seen.has(value)) {
  7496. return value;
  7497. }
  7498. seen.add(value);
  7499. depth--;
  7500. if (isRef(value)) {
  7501. traverse(value.value, depth, seen);
  7502. } else if (isArray(value)) {
  7503. for (let i = 0; i < value.length; i++) {
  7504. traverse(value[i], depth, seen);
  7505. }
  7506. } else if (isSet(value) || isMap(value)) {
  7507. value.forEach((v) => {
  7508. traverse(v, depth, seen);
  7509. });
  7510. } else if (isPlainObject(value)) {
  7511. for (const key in value) {
  7512. traverse(value[key], depth, seen);
  7513. }
  7514. for (const key of Object.getOwnPropertySymbols(value)) {
  7515. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  7516. traverse(value[key], depth, seen);
  7517. }
  7518. }
  7519. }
  7520. return value;
  7521. }
  7522. function useModel(props, name, options = EMPTY_OBJ) {
  7523. const i = getCurrentInstance();
  7524. if (!i) {
  7525. warn$1(`useModel() called without active instance.`);
  7526. return ref();
  7527. }
  7528. if (!i.propsOptions[0][name]) {
  7529. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  7530. return ref();
  7531. }
  7532. const camelizedName = camelize(name);
  7533. const hyphenatedName = hyphenate(name);
  7534. const modifiers = getModelModifiers(props, name);
  7535. const res = customRef((track, trigger) => {
  7536. let localValue;
  7537. let prevSetValue = EMPTY_OBJ;
  7538. let prevEmittedValue;
  7539. watchSyncEffect(() => {
  7540. const propValue = props[name];
  7541. if (hasChanged(localValue, propValue)) {
  7542. localValue = propValue;
  7543. trigger();
  7544. }
  7545. });
  7546. return {
  7547. get() {
  7548. track();
  7549. return options.get ? options.get(localValue) : localValue;
  7550. },
  7551. set(value) {
  7552. const emittedValue = options.set ? options.set(value) : value;
  7553. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  7554. return;
  7555. }
  7556. const rawProps = i.vnode.props;
  7557. if (!(rawProps && // check if parent has passed v-model
  7558. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  7559. localValue = value;
  7560. trigger();
  7561. }
  7562. i.emit(`update:${name}`, emittedValue);
  7563. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  7564. trigger();
  7565. }
  7566. prevSetValue = value;
  7567. prevEmittedValue = emittedValue;
  7568. }
  7569. };
  7570. });
  7571. res[Symbol.iterator] = () => {
  7572. let i2 = 0;
  7573. return {
  7574. next() {
  7575. if (i2 < 2) {
  7576. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  7577. } else {
  7578. return { done: true };
  7579. }
  7580. }
  7581. };
  7582. };
  7583. return res;
  7584. }
  7585. const getModelModifiers = (props, modelName) => {
  7586. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  7587. };
  7588. function emit(instance, event, ...rawArgs) {
  7589. if (instance.isUnmounted) return;
  7590. const props = instance.vnode.props || EMPTY_OBJ;
  7591. {
  7592. const {
  7593. emitsOptions,
  7594. propsOptions: [propsOptions]
  7595. } = instance;
  7596. if (emitsOptions) {
  7597. if (!(event in emitsOptions) && true) {
  7598. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  7599. warn$1(
  7600. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  7601. );
  7602. }
  7603. } else {
  7604. const validator = emitsOptions[event];
  7605. if (isFunction(validator)) {
  7606. const isValid = validator(...rawArgs);
  7607. if (!isValid) {
  7608. warn$1(
  7609. `Invalid event arguments: event validation failed for event "${event}".`
  7610. );
  7611. }
  7612. }
  7613. }
  7614. }
  7615. }
  7616. let args = rawArgs;
  7617. const isModelListener = event.startsWith("update:");
  7618. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  7619. if (modifiers) {
  7620. if (modifiers.trim) {
  7621. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  7622. }
  7623. if (modifiers.number) {
  7624. args = rawArgs.map(looseToNumber);
  7625. }
  7626. }
  7627. {
  7628. devtoolsComponentEmit(instance, event, args);
  7629. }
  7630. {
  7631. const lowerCaseEvent = event.toLowerCase();
  7632. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  7633. warn$1(
  7634. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  7635. instance,
  7636. instance.type
  7637. )} 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(
  7638. event
  7639. )}" instead of "${event}".`
  7640. );
  7641. }
  7642. }
  7643. let handlerName;
  7644. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  7645. props[handlerName = toHandlerKey(camelize(event))];
  7646. if (!handler && isModelListener) {
  7647. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  7648. }
  7649. if (handler) {
  7650. callWithAsyncErrorHandling(
  7651. handler,
  7652. instance,
  7653. 6,
  7654. args
  7655. );
  7656. }
  7657. const onceHandler = props[handlerName + `Once`];
  7658. if (onceHandler) {
  7659. if (!instance.emitted) {
  7660. instance.emitted = {};
  7661. } else if (instance.emitted[handlerName]) {
  7662. return;
  7663. }
  7664. instance.emitted[handlerName] = true;
  7665. callWithAsyncErrorHandling(
  7666. onceHandler,
  7667. instance,
  7668. 6,
  7669. args
  7670. );
  7671. }
  7672. }
  7673. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  7674. const cache = appContext.emitsCache;
  7675. const cached = cache.get(comp);
  7676. if (cached !== void 0) {
  7677. return cached;
  7678. }
  7679. const raw = comp.emits;
  7680. let normalized = {};
  7681. let hasExtends = false;
  7682. if (!isFunction(comp)) {
  7683. const extendEmits = (raw2) => {
  7684. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  7685. if (normalizedFromExtend) {
  7686. hasExtends = true;
  7687. extend(normalized, normalizedFromExtend);
  7688. }
  7689. };
  7690. if (!asMixin && appContext.mixins.length) {
  7691. appContext.mixins.forEach(extendEmits);
  7692. }
  7693. if (comp.extends) {
  7694. extendEmits(comp.extends);
  7695. }
  7696. if (comp.mixins) {
  7697. comp.mixins.forEach(extendEmits);
  7698. }
  7699. }
  7700. if (!raw && !hasExtends) {
  7701. if (isObject(comp)) {
  7702. cache.set(comp, null);
  7703. }
  7704. return null;
  7705. }
  7706. if (isArray(raw)) {
  7707. raw.forEach((key) => normalized[key] = null);
  7708. } else {
  7709. extend(normalized, raw);
  7710. }
  7711. if (isObject(comp)) {
  7712. cache.set(comp, normalized);
  7713. }
  7714. return normalized;
  7715. }
  7716. function isEmitListener(options, key) {
  7717. if (!options || !isOn(key)) {
  7718. return false;
  7719. }
  7720. key = key.slice(2).replace(/Once$/, "");
  7721. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  7722. }
  7723. let accessedAttrs = false;
  7724. function markAttrsAccessed() {
  7725. accessedAttrs = true;
  7726. }
  7727. function renderComponentRoot(instance) {
  7728. const {
  7729. type: Component,
  7730. vnode,
  7731. proxy,
  7732. withProxy,
  7733. propsOptions: [propsOptions],
  7734. slots,
  7735. attrs,
  7736. emit,
  7737. render,
  7738. renderCache,
  7739. props,
  7740. data,
  7741. setupState,
  7742. ctx,
  7743. inheritAttrs
  7744. } = instance;
  7745. const prev = setCurrentRenderingInstance(instance);
  7746. let result;
  7747. let fallthroughAttrs;
  7748. {
  7749. accessedAttrs = false;
  7750. }
  7751. try {
  7752. if (vnode.shapeFlag & 4) {
  7753. const proxyToUse = withProxy || proxy;
  7754. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  7755. get(target, key, receiver) {
  7756. warn$1(
  7757. `Property '${String(
  7758. key
  7759. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  7760. );
  7761. return Reflect.get(target, key, receiver);
  7762. }
  7763. }) : proxyToUse;
  7764. result = normalizeVNode(
  7765. render.call(
  7766. thisProxy,
  7767. proxyToUse,
  7768. renderCache,
  7769. true ? shallowReadonly(props) : props,
  7770. setupState,
  7771. data,
  7772. ctx
  7773. )
  7774. );
  7775. fallthroughAttrs = attrs;
  7776. } else {
  7777. const render2 = Component;
  7778. if (attrs === props) {
  7779. markAttrsAccessed();
  7780. }
  7781. result = normalizeVNode(
  7782. render2.length > 1 ? render2(
  7783. true ? shallowReadonly(props) : props,
  7784. true ? {
  7785. get attrs() {
  7786. markAttrsAccessed();
  7787. return shallowReadonly(attrs);
  7788. },
  7789. slots,
  7790. emit
  7791. } : { attrs, slots, emit }
  7792. ) : render2(
  7793. true ? shallowReadonly(props) : props,
  7794. null
  7795. )
  7796. );
  7797. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  7798. }
  7799. } catch (err) {
  7800. blockStack.length = 0;
  7801. handleError(err, instance, 1);
  7802. result = createVNode(Comment);
  7803. }
  7804. let root = result;
  7805. let setRoot = void 0;
  7806. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  7807. [root, setRoot] = getChildRoot(result);
  7808. }
  7809. if (fallthroughAttrs && inheritAttrs !== false) {
  7810. const keys = Object.keys(fallthroughAttrs);
  7811. const { shapeFlag } = root;
  7812. if (keys.length) {
  7813. if (shapeFlag & (1 | 6)) {
  7814. if (propsOptions && keys.some(isModelListener)) {
  7815. fallthroughAttrs = filterModelListeners(
  7816. fallthroughAttrs,
  7817. propsOptions
  7818. );
  7819. }
  7820. root = cloneVNode(root, fallthroughAttrs, false, true);
  7821. } else if (!accessedAttrs && root.type !== Comment) {
  7822. const allAttrs = Object.keys(attrs);
  7823. const eventAttrs = [];
  7824. const extraAttrs = [];
  7825. for (let i = 0, l = allAttrs.length; i < l; i++) {
  7826. const key = allAttrs[i];
  7827. if (isOn(key)) {
  7828. if (!isModelListener(key)) {
  7829. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  7830. }
  7831. } else {
  7832. extraAttrs.push(key);
  7833. }
  7834. }
  7835. if (extraAttrs.length) {
  7836. warn$1(
  7837. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  7838. );
  7839. }
  7840. if (eventAttrs.length) {
  7841. warn$1(
  7842. `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.`
  7843. );
  7844. }
  7845. }
  7846. }
  7847. }
  7848. if (vnode.dirs) {
  7849. if (!isElementRoot(root)) {
  7850. warn$1(
  7851. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  7852. );
  7853. }
  7854. root = cloneVNode(root, null, false, true);
  7855. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  7856. }
  7857. if (vnode.transition) {
  7858. if (!isElementRoot(root)) {
  7859. warn$1(
  7860. `Component inside <Transition> renders non-element root node that cannot be animated.`
  7861. );
  7862. }
  7863. root.transition = vnode.transition;
  7864. }
  7865. if (setRoot) {
  7866. setRoot(root);
  7867. } else {
  7868. result = root;
  7869. }
  7870. setCurrentRenderingInstance(prev);
  7871. return result;
  7872. }
  7873. const getChildRoot = (vnode) => {
  7874. const rawChildren = vnode.children;
  7875. const dynamicChildren = vnode.dynamicChildren;
  7876. const childRoot = filterSingleRoot(rawChildren, false);
  7877. if (!childRoot) {
  7878. return [vnode, void 0];
  7879. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  7880. return getChildRoot(childRoot);
  7881. }
  7882. const index = rawChildren.indexOf(childRoot);
  7883. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  7884. const setRoot = (updatedRoot) => {
  7885. rawChildren[index] = updatedRoot;
  7886. if (dynamicChildren) {
  7887. if (dynamicIndex > -1) {
  7888. dynamicChildren[dynamicIndex] = updatedRoot;
  7889. } else if (updatedRoot.patchFlag > 0) {
  7890. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  7891. }
  7892. }
  7893. };
  7894. return [normalizeVNode(childRoot), setRoot];
  7895. };
  7896. function filterSingleRoot(children, recurse = true) {
  7897. let singleRoot;
  7898. for (let i = 0; i < children.length; i++) {
  7899. const child = children[i];
  7900. if (isVNode(child)) {
  7901. if (child.type !== Comment || child.children === "v-if") {
  7902. if (singleRoot) {
  7903. return;
  7904. } else {
  7905. singleRoot = child;
  7906. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  7907. return filterSingleRoot(singleRoot.children);
  7908. }
  7909. }
  7910. }
  7911. } else {
  7912. return;
  7913. }
  7914. }
  7915. return singleRoot;
  7916. }
  7917. const getFunctionalFallthrough = (attrs) => {
  7918. let res;
  7919. for (const key in attrs) {
  7920. if (key === "class" || key === "style" || isOn(key)) {
  7921. (res || (res = {}))[key] = attrs[key];
  7922. }
  7923. }
  7924. return res;
  7925. };
  7926. const filterModelListeners = (attrs, props) => {
  7927. const res = {};
  7928. for (const key in attrs) {
  7929. if (!isModelListener(key) || !(key.slice(9) in props)) {
  7930. res[key] = attrs[key];
  7931. }
  7932. }
  7933. return res;
  7934. };
  7935. const isElementRoot = (vnode) => {
  7936. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  7937. };
  7938. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  7939. const { props: prevProps, children: prevChildren, component } = prevVNode;
  7940. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  7941. const emits = component.emitsOptions;
  7942. if ((prevChildren || nextChildren) && isHmrUpdating) {
  7943. return true;
  7944. }
  7945. if (nextVNode.dirs || nextVNode.transition) {
  7946. return true;
  7947. }
  7948. if (optimized && patchFlag >= 0) {
  7949. if (patchFlag & 1024) {
  7950. return true;
  7951. }
  7952. if (patchFlag & 16) {
  7953. if (!prevProps) {
  7954. return !!nextProps;
  7955. }
  7956. return hasPropsChanged(prevProps, nextProps, emits);
  7957. } else if (patchFlag & 8) {
  7958. const dynamicProps = nextVNode.dynamicProps;
  7959. for (let i = 0; i < dynamicProps.length; i++) {
  7960. const key = dynamicProps[i];
  7961. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  7962. return true;
  7963. }
  7964. }
  7965. }
  7966. } else {
  7967. if (prevChildren || nextChildren) {
  7968. if (!nextChildren || !nextChildren.$stable) {
  7969. return true;
  7970. }
  7971. }
  7972. if (prevProps === nextProps) {
  7973. return false;
  7974. }
  7975. if (!prevProps) {
  7976. return !!nextProps;
  7977. }
  7978. if (!nextProps) {
  7979. return true;
  7980. }
  7981. return hasPropsChanged(prevProps, nextProps, emits);
  7982. }
  7983. return false;
  7984. }
  7985. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  7986. const nextKeys = Object.keys(nextProps);
  7987. if (nextKeys.length !== Object.keys(prevProps).length) {
  7988. return true;
  7989. }
  7990. for (let i = 0; i < nextKeys.length; i++) {
  7991. const key = nextKeys[i];
  7992. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  7993. return true;
  7994. }
  7995. }
  7996. return false;
  7997. }
  7998. function updateHOCHostEl({ vnode, parent }, el) {
  7999. while (parent) {
  8000. const root = parent.subTree;
  8001. if (root.suspense && root.suspense.activeBranch === vnode) {
  8002. root.el = vnode.el;
  8003. }
  8004. if (root === vnode) {
  8005. (vnode = parent.vnode).el = el;
  8006. parent = parent.parent;
  8007. } else {
  8008. break;
  8009. }
  8010. }
  8011. }
  8012. const isSuspense = (type) => type.__isSuspense;
  8013. let suspenseId = 0;
  8014. const SuspenseImpl = {
  8015. name: "Suspense",
  8016. // In order to make Suspense tree-shakable, we need to avoid importing it
  8017. // directly in the renderer. The renderer checks for the __isSuspense flag
  8018. // on a vnode's type and calls the `process` method, passing in renderer
  8019. // internals.
  8020. __isSuspense: true,
  8021. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8022. if (n1 == null) {
  8023. mountSuspense(
  8024. n2,
  8025. container,
  8026. anchor,
  8027. parentComponent,
  8028. parentSuspense,
  8029. namespace,
  8030. slotScopeIds,
  8031. optimized,
  8032. rendererInternals
  8033. );
  8034. } else {
  8035. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8036. n2.suspense = n1.suspense;
  8037. n2.suspense.vnode = n2;
  8038. n2.el = n1.el;
  8039. return;
  8040. }
  8041. patchSuspense(
  8042. n1,
  8043. n2,
  8044. container,
  8045. anchor,
  8046. parentComponent,
  8047. namespace,
  8048. slotScopeIds,
  8049. optimized,
  8050. rendererInternals
  8051. );
  8052. }
  8053. },
  8054. hydrate: hydrateSuspense,
  8055. normalize: normalizeSuspenseChildren
  8056. };
  8057. const Suspense = SuspenseImpl ;
  8058. function triggerEvent(vnode, name) {
  8059. const eventListener = vnode.props && vnode.props[name];
  8060. if (isFunction(eventListener)) {
  8061. eventListener();
  8062. }
  8063. }
  8064. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8065. const {
  8066. p: patch,
  8067. o: { createElement }
  8068. } = rendererInternals;
  8069. const hiddenContainer = createElement("div");
  8070. const suspense = vnode.suspense = createSuspenseBoundary(
  8071. vnode,
  8072. parentSuspense,
  8073. parentComponent,
  8074. container,
  8075. hiddenContainer,
  8076. anchor,
  8077. namespace,
  8078. slotScopeIds,
  8079. optimized,
  8080. rendererInternals
  8081. );
  8082. patch(
  8083. null,
  8084. suspense.pendingBranch = vnode.ssContent,
  8085. hiddenContainer,
  8086. null,
  8087. parentComponent,
  8088. suspense,
  8089. namespace,
  8090. slotScopeIds
  8091. );
  8092. if (suspense.deps > 0) {
  8093. triggerEvent(vnode, "onPending");
  8094. triggerEvent(vnode, "onFallback");
  8095. patch(
  8096. null,
  8097. vnode.ssFallback,
  8098. container,
  8099. anchor,
  8100. parentComponent,
  8101. null,
  8102. // fallback tree will not have suspense context
  8103. namespace,
  8104. slotScopeIds
  8105. );
  8106. setActiveBranch(suspense, vnode.ssFallback);
  8107. } else {
  8108. suspense.resolve(false, true);
  8109. }
  8110. }
  8111. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8112. const suspense = n2.suspense = n1.suspense;
  8113. suspense.vnode = n2;
  8114. n2.el = n1.el;
  8115. const newBranch = n2.ssContent;
  8116. const newFallback = n2.ssFallback;
  8117. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8118. if (pendingBranch) {
  8119. suspense.pendingBranch = newBranch;
  8120. if (isSameVNodeType(newBranch, pendingBranch)) {
  8121. patch(
  8122. pendingBranch,
  8123. newBranch,
  8124. suspense.hiddenContainer,
  8125. null,
  8126. parentComponent,
  8127. suspense,
  8128. namespace,
  8129. slotScopeIds,
  8130. optimized
  8131. );
  8132. if (suspense.deps <= 0) {
  8133. suspense.resolve();
  8134. } else if (isInFallback) {
  8135. if (!isHydrating) {
  8136. patch(
  8137. activeBranch,
  8138. newFallback,
  8139. container,
  8140. anchor,
  8141. parentComponent,
  8142. null,
  8143. // fallback tree will not have suspense context
  8144. namespace,
  8145. slotScopeIds,
  8146. optimized
  8147. );
  8148. setActiveBranch(suspense, newFallback);
  8149. }
  8150. }
  8151. } else {
  8152. suspense.pendingId = suspenseId++;
  8153. if (isHydrating) {
  8154. suspense.isHydrating = false;
  8155. suspense.activeBranch = pendingBranch;
  8156. } else {
  8157. unmount(pendingBranch, parentComponent, suspense);
  8158. }
  8159. suspense.deps = 0;
  8160. suspense.effects.length = 0;
  8161. suspense.hiddenContainer = createElement("div");
  8162. if (isInFallback) {
  8163. patch(
  8164. null,
  8165. newBranch,
  8166. suspense.hiddenContainer,
  8167. null,
  8168. parentComponent,
  8169. suspense,
  8170. namespace,
  8171. slotScopeIds,
  8172. optimized
  8173. );
  8174. if (suspense.deps <= 0) {
  8175. suspense.resolve();
  8176. } else {
  8177. patch(
  8178. activeBranch,
  8179. newFallback,
  8180. container,
  8181. anchor,
  8182. parentComponent,
  8183. null,
  8184. // fallback tree will not have suspense context
  8185. namespace,
  8186. slotScopeIds,
  8187. optimized
  8188. );
  8189. setActiveBranch(suspense, newFallback);
  8190. }
  8191. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8192. patch(
  8193. activeBranch,
  8194. newBranch,
  8195. container,
  8196. anchor,
  8197. parentComponent,
  8198. suspense,
  8199. namespace,
  8200. slotScopeIds,
  8201. optimized
  8202. );
  8203. suspense.resolve(true);
  8204. } else {
  8205. patch(
  8206. null,
  8207. newBranch,
  8208. suspense.hiddenContainer,
  8209. null,
  8210. parentComponent,
  8211. suspense,
  8212. namespace,
  8213. slotScopeIds,
  8214. optimized
  8215. );
  8216. if (suspense.deps <= 0) {
  8217. suspense.resolve();
  8218. }
  8219. }
  8220. }
  8221. } else {
  8222. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8223. patch(
  8224. activeBranch,
  8225. newBranch,
  8226. container,
  8227. anchor,
  8228. parentComponent,
  8229. suspense,
  8230. namespace,
  8231. slotScopeIds,
  8232. optimized
  8233. );
  8234. setActiveBranch(suspense, newBranch);
  8235. } else {
  8236. triggerEvent(n2, "onPending");
  8237. suspense.pendingBranch = newBranch;
  8238. if (newBranch.shapeFlag & 512) {
  8239. suspense.pendingId = newBranch.component.suspenseId;
  8240. } else {
  8241. suspense.pendingId = suspenseId++;
  8242. }
  8243. patch(
  8244. null,
  8245. newBranch,
  8246. suspense.hiddenContainer,
  8247. null,
  8248. parentComponent,
  8249. suspense,
  8250. namespace,
  8251. slotScopeIds,
  8252. optimized
  8253. );
  8254. if (suspense.deps <= 0) {
  8255. suspense.resolve();
  8256. } else {
  8257. const { timeout, pendingId } = suspense;
  8258. if (timeout > 0) {
  8259. setTimeout(() => {
  8260. if (suspense.pendingId === pendingId) {
  8261. suspense.fallback(newFallback);
  8262. }
  8263. }, timeout);
  8264. } else if (timeout === 0) {
  8265. suspense.fallback(newFallback);
  8266. }
  8267. }
  8268. }
  8269. }
  8270. }
  8271. let hasWarned = false;
  8272. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  8273. if (!hasWarned) {
  8274. hasWarned = true;
  8275. console[console.info ? "info" : "log"](
  8276. `<Suspense> is an experimental feature and its API will likely change.`
  8277. );
  8278. }
  8279. const {
  8280. p: patch,
  8281. m: move,
  8282. um: unmount,
  8283. n: next,
  8284. o: { parentNode, remove }
  8285. } = rendererInternals;
  8286. let parentSuspenseId;
  8287. const isSuspensible = isVNodeSuspensible(vnode);
  8288. if (isSuspensible) {
  8289. if (parentSuspense && parentSuspense.pendingBranch) {
  8290. parentSuspenseId = parentSuspense.pendingId;
  8291. parentSuspense.deps++;
  8292. }
  8293. }
  8294. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  8295. {
  8296. assertNumber(timeout, `Suspense timeout`);
  8297. }
  8298. const initialAnchor = anchor;
  8299. const suspense = {
  8300. vnode,
  8301. parent: parentSuspense,
  8302. parentComponent,
  8303. namespace,
  8304. container,
  8305. hiddenContainer,
  8306. deps: 0,
  8307. pendingId: suspenseId++,
  8308. timeout: typeof timeout === "number" ? timeout : -1,
  8309. activeBranch: null,
  8310. pendingBranch: null,
  8311. isInFallback: !isHydrating,
  8312. isHydrating,
  8313. isUnmounted: false,
  8314. effects: [],
  8315. resolve(resume = false, sync = false) {
  8316. {
  8317. if (!resume && !suspense.pendingBranch) {
  8318. throw new Error(
  8319. `suspense.resolve() is called without a pending branch.`
  8320. );
  8321. }
  8322. if (suspense.isUnmounted) {
  8323. throw new Error(
  8324. `suspense.resolve() is called on an already unmounted suspense boundary.`
  8325. );
  8326. }
  8327. }
  8328. const {
  8329. vnode: vnode2,
  8330. activeBranch,
  8331. pendingBranch,
  8332. pendingId,
  8333. effects,
  8334. parentComponent: parentComponent2,
  8335. container: container2
  8336. } = suspense;
  8337. let delayEnter = false;
  8338. if (suspense.isHydrating) {
  8339. suspense.isHydrating = false;
  8340. } else if (!resume) {
  8341. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  8342. if (delayEnter) {
  8343. activeBranch.transition.afterLeave = () => {
  8344. if (pendingId === suspense.pendingId) {
  8345. move(
  8346. pendingBranch,
  8347. container2,
  8348. anchor === initialAnchor ? next(activeBranch) : anchor,
  8349. 0
  8350. );
  8351. queuePostFlushCb(effects);
  8352. }
  8353. };
  8354. }
  8355. if (activeBranch) {
  8356. if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
  8357. anchor = next(activeBranch);
  8358. }
  8359. unmount(activeBranch, parentComponent2, suspense, true);
  8360. }
  8361. if (!delayEnter) {
  8362. move(pendingBranch, container2, anchor, 0);
  8363. }
  8364. }
  8365. setActiveBranch(suspense, pendingBranch);
  8366. suspense.pendingBranch = null;
  8367. suspense.isInFallback = false;
  8368. let parent = suspense.parent;
  8369. let hasUnresolvedAncestor = false;
  8370. while (parent) {
  8371. if (parent.pendingBranch) {
  8372. parent.effects.push(...effects);
  8373. hasUnresolvedAncestor = true;
  8374. break;
  8375. }
  8376. parent = parent.parent;
  8377. }
  8378. if (!hasUnresolvedAncestor && !delayEnter) {
  8379. queuePostFlushCb(effects);
  8380. }
  8381. suspense.effects = [];
  8382. if (isSuspensible) {
  8383. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  8384. parentSuspense.deps--;
  8385. if (parentSuspense.deps === 0 && !sync) {
  8386. parentSuspense.resolve();
  8387. }
  8388. }
  8389. }
  8390. triggerEvent(vnode2, "onResolve");
  8391. },
  8392. fallback(fallbackVNode) {
  8393. if (!suspense.pendingBranch) {
  8394. return;
  8395. }
  8396. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  8397. triggerEvent(vnode2, "onFallback");
  8398. const anchor2 = next(activeBranch);
  8399. const mountFallback = () => {
  8400. if (!suspense.isInFallback) {
  8401. return;
  8402. }
  8403. patch(
  8404. null,
  8405. fallbackVNode,
  8406. container2,
  8407. anchor2,
  8408. parentComponent2,
  8409. null,
  8410. // fallback tree will not have suspense context
  8411. namespace2,
  8412. slotScopeIds,
  8413. optimized
  8414. );
  8415. setActiveBranch(suspense, fallbackVNode);
  8416. };
  8417. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  8418. if (delayEnter) {
  8419. activeBranch.transition.afterLeave = mountFallback;
  8420. }
  8421. suspense.isInFallback = true;
  8422. unmount(
  8423. activeBranch,
  8424. parentComponent2,
  8425. null,
  8426. // no suspense so unmount hooks fire now
  8427. true
  8428. // shouldRemove
  8429. );
  8430. if (!delayEnter) {
  8431. mountFallback();
  8432. }
  8433. },
  8434. move(container2, anchor2, type) {
  8435. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  8436. suspense.container = container2;
  8437. },
  8438. next() {
  8439. return suspense.activeBranch && next(suspense.activeBranch);
  8440. },
  8441. registerDep(instance, setupRenderEffect, optimized2) {
  8442. const isInPendingSuspense = !!suspense.pendingBranch;
  8443. if (isInPendingSuspense) {
  8444. suspense.deps++;
  8445. }
  8446. const hydratedEl = instance.vnode.el;
  8447. instance.asyncDep.catch((err) => {
  8448. handleError(err, instance, 0);
  8449. }).then((asyncSetupResult) => {
  8450. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  8451. return;
  8452. }
  8453. instance.asyncResolved = true;
  8454. const { vnode: vnode2 } = instance;
  8455. {
  8456. pushWarningContext(vnode2);
  8457. }
  8458. handleSetupResult(instance, asyncSetupResult, false);
  8459. if (hydratedEl) {
  8460. vnode2.el = hydratedEl;
  8461. }
  8462. const placeholder = !hydratedEl && instance.subTree.el;
  8463. setupRenderEffect(
  8464. instance,
  8465. vnode2,
  8466. // component may have been moved before resolve.
  8467. // if this is not a hydration, instance.subTree will be the comment
  8468. // placeholder.
  8469. parentNode(hydratedEl || instance.subTree.el),
  8470. // anchor will not be used if this is hydration, so only need to
  8471. // consider the comment placeholder case.
  8472. hydratedEl ? null : next(instance.subTree),
  8473. suspense,
  8474. namespace,
  8475. optimized2
  8476. );
  8477. if (placeholder) {
  8478. remove(placeholder);
  8479. }
  8480. updateHOCHostEl(instance, vnode2.el);
  8481. {
  8482. popWarningContext();
  8483. }
  8484. if (isInPendingSuspense && --suspense.deps === 0) {
  8485. suspense.resolve();
  8486. }
  8487. });
  8488. },
  8489. unmount(parentSuspense2, doRemove) {
  8490. suspense.isUnmounted = true;
  8491. if (suspense.activeBranch) {
  8492. unmount(
  8493. suspense.activeBranch,
  8494. parentComponent,
  8495. parentSuspense2,
  8496. doRemove
  8497. );
  8498. }
  8499. if (suspense.pendingBranch) {
  8500. unmount(
  8501. suspense.pendingBranch,
  8502. parentComponent,
  8503. parentSuspense2,
  8504. doRemove
  8505. );
  8506. }
  8507. }
  8508. };
  8509. return suspense;
  8510. }
  8511. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  8512. const suspense = vnode.suspense = createSuspenseBoundary(
  8513. vnode,
  8514. parentSuspense,
  8515. parentComponent,
  8516. node.parentNode,
  8517. // eslint-disable-next-line no-restricted-globals
  8518. document.createElement("div"),
  8519. null,
  8520. namespace,
  8521. slotScopeIds,
  8522. optimized,
  8523. rendererInternals,
  8524. true
  8525. );
  8526. const result = hydrateNode(
  8527. node,
  8528. suspense.pendingBranch = vnode.ssContent,
  8529. parentComponent,
  8530. suspense,
  8531. slotScopeIds,
  8532. optimized
  8533. );
  8534. if (suspense.deps === 0) {
  8535. suspense.resolve(false, true);
  8536. }
  8537. return result;
  8538. }
  8539. function normalizeSuspenseChildren(vnode) {
  8540. const { shapeFlag, children } = vnode;
  8541. const isSlotChildren = shapeFlag & 32;
  8542. vnode.ssContent = normalizeSuspenseSlot(
  8543. isSlotChildren ? children.default : children
  8544. );
  8545. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  8546. }
  8547. function normalizeSuspenseSlot(s) {
  8548. let block;
  8549. if (isFunction(s)) {
  8550. const trackBlock = isBlockTreeEnabled && s._c;
  8551. if (trackBlock) {
  8552. s._d = false;
  8553. openBlock();
  8554. }
  8555. s = s();
  8556. if (trackBlock) {
  8557. s._d = true;
  8558. block = currentBlock;
  8559. closeBlock();
  8560. }
  8561. }
  8562. if (isArray(s)) {
  8563. const singleChild = filterSingleRoot(s);
  8564. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  8565. warn$1(`<Suspense> slots expect a single root node.`);
  8566. }
  8567. s = singleChild;
  8568. }
  8569. s = normalizeVNode(s);
  8570. if (block && !s.dynamicChildren) {
  8571. s.dynamicChildren = block.filter((c) => c !== s);
  8572. }
  8573. return s;
  8574. }
  8575. function queueEffectWithSuspense(fn, suspense) {
  8576. if (suspense && suspense.pendingBranch) {
  8577. if (isArray(fn)) {
  8578. suspense.effects.push(...fn);
  8579. } else {
  8580. suspense.effects.push(fn);
  8581. }
  8582. } else {
  8583. queuePostFlushCb(fn);
  8584. }
  8585. }
  8586. function setActiveBranch(suspense, branch) {
  8587. suspense.activeBranch = branch;
  8588. const { vnode, parentComponent } = suspense;
  8589. let el = branch.el;
  8590. while (!el && branch.component) {
  8591. branch = branch.component.subTree;
  8592. el = branch.el;
  8593. }
  8594. vnode.el = el;
  8595. if (parentComponent && parentComponent.subTree === vnode) {
  8596. parentComponent.vnode.el = el;
  8597. updateHOCHostEl(parentComponent, el);
  8598. }
  8599. }
  8600. function isVNodeSuspensible(vnode) {
  8601. const suspensible = vnode.props && vnode.props.suspensible;
  8602. return suspensible != null && suspensible !== false;
  8603. }
  8604. const Fragment = Symbol.for("v-fgt");
  8605. const Text = Symbol.for("v-txt");
  8606. const Comment = Symbol.for("v-cmt");
  8607. const Static = Symbol.for("v-stc");
  8608. const blockStack = [];
  8609. let currentBlock = null;
  8610. function openBlock(disableTracking = false) {
  8611. blockStack.push(currentBlock = disableTracking ? null : []);
  8612. }
  8613. function closeBlock() {
  8614. blockStack.pop();
  8615. currentBlock = blockStack[blockStack.length - 1] || null;
  8616. }
  8617. let isBlockTreeEnabled = 1;
  8618. function setBlockTracking(value) {
  8619. isBlockTreeEnabled += value;
  8620. if (value < 0 && currentBlock) {
  8621. currentBlock.hasOnce = true;
  8622. }
  8623. }
  8624. function setupBlock(vnode) {
  8625. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8626. closeBlock();
  8627. if (isBlockTreeEnabled > 0 && currentBlock) {
  8628. currentBlock.push(vnode);
  8629. }
  8630. return vnode;
  8631. }
  8632. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8633. return setupBlock(
  8634. createBaseVNode(
  8635. type,
  8636. props,
  8637. children,
  8638. patchFlag,
  8639. dynamicProps,
  8640. shapeFlag,
  8641. true
  8642. )
  8643. );
  8644. }
  8645. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8646. return setupBlock(
  8647. createVNode(
  8648. type,
  8649. props,
  8650. children,
  8651. patchFlag,
  8652. dynamicProps,
  8653. true
  8654. )
  8655. );
  8656. }
  8657. function isVNode(value) {
  8658. return value ? value.__v_isVNode === true : false;
  8659. }
  8660. function isSameVNodeType(n1, n2) {
  8661. if (n2.shapeFlag & 6 && n1.component) {
  8662. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  8663. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  8664. n1.shapeFlag &= ~256;
  8665. n2.shapeFlag &= ~512;
  8666. return false;
  8667. }
  8668. }
  8669. return n1.type === n2.type && n1.key === n2.key;
  8670. }
  8671. let vnodeArgsTransformer;
  8672. function transformVNodeArgs(transformer) {
  8673. vnodeArgsTransformer = transformer;
  8674. }
  8675. const createVNodeWithArgsTransform = (...args) => {
  8676. return _createVNode(
  8677. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8678. );
  8679. };
  8680. const normalizeKey = ({ key }) => key != null ? key : null;
  8681. const normalizeRef = ({
  8682. ref,
  8683. ref_key,
  8684. ref_for
  8685. }) => {
  8686. if (typeof ref === "number") {
  8687. ref = "" + ref;
  8688. }
  8689. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8690. };
  8691. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8692. const vnode = {
  8693. __v_isVNode: true,
  8694. __v_skip: true,
  8695. type,
  8696. props,
  8697. key: props && normalizeKey(props),
  8698. ref: props && normalizeRef(props),
  8699. scopeId: currentScopeId,
  8700. slotScopeIds: null,
  8701. children,
  8702. component: null,
  8703. suspense: null,
  8704. ssContent: null,
  8705. ssFallback: null,
  8706. dirs: null,
  8707. transition: null,
  8708. el: null,
  8709. anchor: null,
  8710. target: null,
  8711. targetStart: null,
  8712. targetAnchor: null,
  8713. staticCount: 0,
  8714. shapeFlag,
  8715. patchFlag,
  8716. dynamicProps,
  8717. dynamicChildren: null,
  8718. appContext: null,
  8719. ctx: currentRenderingInstance
  8720. };
  8721. if (needFullChildrenNormalization) {
  8722. normalizeChildren(vnode, children);
  8723. if (shapeFlag & 128) {
  8724. type.normalize(vnode);
  8725. }
  8726. } else if (children) {
  8727. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8728. }
  8729. if (vnode.key !== vnode.key) {
  8730. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8731. }
  8732. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8733. !isBlockNode && // has current parent block
  8734. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8735. // component nodes also should always be patched, because even if the
  8736. // component doesn't need to update, it needs to persist the instance on to
  8737. // the next vnode so that it can be properly unmounted later.
  8738. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8739. // vnode should not be considered dynamic due to handler caching.
  8740. vnode.patchFlag !== 32) {
  8741. currentBlock.push(vnode);
  8742. }
  8743. return vnode;
  8744. }
  8745. const createVNode = createVNodeWithArgsTransform ;
  8746. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8747. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8748. if (!type) {
  8749. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  8750. }
  8751. type = Comment;
  8752. }
  8753. if (isVNode(type)) {
  8754. const cloned = cloneVNode(
  8755. type,
  8756. props,
  8757. true
  8758. /* mergeRef: true */
  8759. );
  8760. if (children) {
  8761. normalizeChildren(cloned, children);
  8762. }
  8763. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8764. if (cloned.shapeFlag & 6) {
  8765. currentBlock[currentBlock.indexOf(type)] = cloned;
  8766. } else {
  8767. currentBlock.push(cloned);
  8768. }
  8769. }
  8770. cloned.patchFlag = -2;
  8771. return cloned;
  8772. }
  8773. if (isClassComponent(type)) {
  8774. type = type.__vccOpts;
  8775. }
  8776. if (props) {
  8777. props = guardReactiveProps(props);
  8778. let { class: klass, style } = props;
  8779. if (klass && !isString(klass)) {
  8780. props.class = normalizeClass(klass);
  8781. }
  8782. if (isObject(style)) {
  8783. if (isProxy(style) && !isArray(style)) {
  8784. style = extend({}, style);
  8785. }
  8786. props.style = normalizeStyle(style);
  8787. }
  8788. }
  8789. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8790. if (shapeFlag & 4 && isProxy(type)) {
  8791. type = toRaw(type);
  8792. warn$1(
  8793. `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\`.`,
  8794. `
  8795. Component that was made reactive: `,
  8796. type
  8797. );
  8798. }
  8799. return createBaseVNode(
  8800. type,
  8801. props,
  8802. children,
  8803. patchFlag,
  8804. dynamicProps,
  8805. shapeFlag,
  8806. isBlockNode,
  8807. true
  8808. );
  8809. }
  8810. function guardReactiveProps(props) {
  8811. if (!props) return null;
  8812. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  8813. }
  8814. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  8815. const { props, ref, patchFlag, children, transition } = vnode;
  8816. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8817. const cloned = {
  8818. __v_isVNode: true,
  8819. __v_skip: true,
  8820. type: vnode.type,
  8821. props: mergedProps,
  8822. key: mergedProps && normalizeKey(mergedProps),
  8823. ref: extraProps && extraProps.ref ? (
  8824. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8825. // if the vnode itself already has a ref, cloneVNode will need to merge
  8826. // the refs so the single vnode can be set on multiple refs
  8827. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8828. ) : ref,
  8829. scopeId: vnode.scopeId,
  8830. slotScopeIds: vnode.slotScopeIds,
  8831. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8832. target: vnode.target,
  8833. targetStart: vnode.targetStart,
  8834. targetAnchor: vnode.targetAnchor,
  8835. staticCount: vnode.staticCount,
  8836. shapeFlag: vnode.shapeFlag,
  8837. // if the vnode is cloned with extra props, we can no longer assume its
  8838. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8839. // note: preserve flag for fragments since they use the flag for children
  8840. // fast paths only.
  8841. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8842. dynamicProps: vnode.dynamicProps,
  8843. dynamicChildren: vnode.dynamicChildren,
  8844. appContext: vnode.appContext,
  8845. dirs: vnode.dirs,
  8846. transition,
  8847. // These should technically only be non-null on mounted VNodes. However,
  8848. // they *should* be copied for kept-alive vnodes. So we just always copy
  8849. // them since them being non-null during a mount doesn't affect the logic as
  8850. // they will simply be overwritten.
  8851. component: vnode.component,
  8852. suspense: vnode.suspense,
  8853. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8854. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8855. el: vnode.el,
  8856. anchor: vnode.anchor,
  8857. ctx: vnode.ctx,
  8858. ce: vnode.ce
  8859. };
  8860. if (transition && cloneTransition) {
  8861. setTransitionHooks(
  8862. cloned,
  8863. transition.clone(cloned)
  8864. );
  8865. }
  8866. return cloned;
  8867. }
  8868. function deepCloneVNode(vnode) {
  8869. const cloned = cloneVNode(vnode);
  8870. if (isArray(vnode.children)) {
  8871. cloned.children = vnode.children.map(deepCloneVNode);
  8872. }
  8873. return cloned;
  8874. }
  8875. function createTextVNode(text = " ", flag = 0) {
  8876. return createVNode(Text, null, text, flag);
  8877. }
  8878. function createStaticVNode(content, numberOfNodes) {
  8879. const vnode = createVNode(Static, null, content);
  8880. vnode.staticCount = numberOfNodes;
  8881. return vnode;
  8882. }
  8883. function createCommentVNode(text = "", asBlock = false) {
  8884. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8885. }
  8886. function normalizeVNode(child) {
  8887. if (child == null || typeof child === "boolean") {
  8888. return createVNode(Comment);
  8889. } else if (isArray(child)) {
  8890. return createVNode(
  8891. Fragment,
  8892. null,
  8893. // #3666, avoid reference pollution when reusing vnode
  8894. child.slice()
  8895. );
  8896. } else if (typeof child === "object") {
  8897. return cloneIfMounted(child);
  8898. } else {
  8899. return createVNode(Text, null, String(child));
  8900. }
  8901. }
  8902. function cloneIfMounted(child) {
  8903. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8904. }
  8905. function normalizeChildren(vnode, children) {
  8906. let type = 0;
  8907. const { shapeFlag } = vnode;
  8908. if (children == null) {
  8909. children = null;
  8910. } else if (isArray(children)) {
  8911. type = 16;
  8912. } else if (typeof children === "object") {
  8913. if (shapeFlag & (1 | 64)) {
  8914. const slot = children.default;
  8915. if (slot) {
  8916. slot._c && (slot._d = false);
  8917. normalizeChildren(vnode, slot());
  8918. slot._c && (slot._d = true);
  8919. }
  8920. return;
  8921. } else {
  8922. type = 32;
  8923. const slotFlag = children._;
  8924. if (!slotFlag && !isInternalObject(children)) {
  8925. children._ctx = currentRenderingInstance;
  8926. } else if (slotFlag === 3 && currentRenderingInstance) {
  8927. if (currentRenderingInstance.slots._ === 1) {
  8928. children._ = 1;
  8929. } else {
  8930. children._ = 2;
  8931. vnode.patchFlag |= 1024;
  8932. }
  8933. }
  8934. }
  8935. } else if (isFunction(children)) {
  8936. children = { default: children, _ctx: currentRenderingInstance };
  8937. type = 32;
  8938. } else {
  8939. children = String(children);
  8940. if (shapeFlag & 64) {
  8941. type = 16;
  8942. children = [createTextVNode(children)];
  8943. } else {
  8944. type = 8;
  8945. }
  8946. }
  8947. vnode.children = children;
  8948. vnode.shapeFlag |= type;
  8949. }
  8950. function mergeProps(...args) {
  8951. const ret = {};
  8952. for (let i = 0; i < args.length; i++) {
  8953. const toMerge = args[i];
  8954. for (const key in toMerge) {
  8955. if (key === "class") {
  8956. if (ret.class !== toMerge.class) {
  8957. ret.class = normalizeClass([ret.class, toMerge.class]);
  8958. }
  8959. } else if (key === "style") {
  8960. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8961. } else if (isOn(key)) {
  8962. const existing = ret[key];
  8963. const incoming = toMerge[key];
  8964. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8965. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8966. }
  8967. } else if (key !== "") {
  8968. ret[key] = toMerge[key];
  8969. }
  8970. }
  8971. }
  8972. return ret;
  8973. }
  8974. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8975. callWithAsyncErrorHandling(hook, instance, 7, [
  8976. vnode,
  8977. prevVNode
  8978. ]);
  8979. }
  8980. const emptyAppContext = createAppContext();
  8981. let uid = 0;
  8982. function createComponentInstance(vnode, parent, suspense) {
  8983. const type = vnode.type;
  8984. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8985. const instance = {
  8986. uid: uid++,
  8987. vnode,
  8988. type,
  8989. parent,
  8990. appContext,
  8991. root: null,
  8992. // to be immediately set
  8993. next: null,
  8994. subTree: null,
  8995. // will be set synchronously right after creation
  8996. effect: null,
  8997. update: null,
  8998. // will be set synchronously right after creation
  8999. scope: new EffectScope(
  9000. true
  9001. /* detached */
  9002. ),
  9003. render: null,
  9004. proxy: null,
  9005. exposed: null,
  9006. exposeProxy: null,
  9007. withProxy: null,
  9008. provides: parent ? parent.provides : Object.create(appContext.provides),
  9009. accessCache: null,
  9010. renderCache: [],
  9011. // local resolved assets
  9012. components: null,
  9013. directives: null,
  9014. // resolved props and emits options
  9015. propsOptions: normalizePropsOptions(type, appContext),
  9016. emitsOptions: normalizeEmitsOptions(type, appContext),
  9017. // emit
  9018. emit: null,
  9019. // to be set immediately
  9020. emitted: null,
  9021. // props default value
  9022. propsDefaults: EMPTY_OBJ,
  9023. // inheritAttrs
  9024. inheritAttrs: type.inheritAttrs,
  9025. // state
  9026. ctx: EMPTY_OBJ,
  9027. data: EMPTY_OBJ,
  9028. props: EMPTY_OBJ,
  9029. attrs: EMPTY_OBJ,
  9030. slots: EMPTY_OBJ,
  9031. refs: EMPTY_OBJ,
  9032. setupState: EMPTY_OBJ,
  9033. setupContext: null,
  9034. // suspense related
  9035. suspense,
  9036. suspenseId: suspense ? suspense.pendingId : 0,
  9037. asyncDep: null,
  9038. asyncResolved: false,
  9039. // lifecycle hooks
  9040. // not using enums here because it results in computed properties
  9041. isMounted: false,
  9042. isUnmounted: false,
  9043. isDeactivated: false,
  9044. bc: null,
  9045. c: null,
  9046. bm: null,
  9047. m: null,
  9048. bu: null,
  9049. u: null,
  9050. um: null,
  9051. bum: null,
  9052. da: null,
  9053. a: null,
  9054. rtg: null,
  9055. rtc: null,
  9056. ec: null,
  9057. sp: null
  9058. };
  9059. {
  9060. instance.ctx = createDevRenderContext(instance);
  9061. }
  9062. instance.root = parent ? parent.root : instance;
  9063. instance.emit = emit.bind(null, instance);
  9064. if (vnode.ce) {
  9065. vnode.ce(instance);
  9066. }
  9067. return instance;
  9068. }
  9069. let currentInstance = null;
  9070. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9071. let internalSetCurrentInstance;
  9072. let setInSSRSetupState;
  9073. {
  9074. internalSetCurrentInstance = (i) => {
  9075. currentInstance = i;
  9076. };
  9077. setInSSRSetupState = (v) => {
  9078. isInSSRComponentSetup = v;
  9079. };
  9080. }
  9081. const setCurrentInstance = (instance) => {
  9082. const prev = currentInstance;
  9083. internalSetCurrentInstance(instance);
  9084. instance.scope.on();
  9085. return () => {
  9086. instance.scope.off();
  9087. internalSetCurrentInstance(prev);
  9088. };
  9089. };
  9090. const unsetCurrentInstance = () => {
  9091. currentInstance && currentInstance.scope.off();
  9092. internalSetCurrentInstance(null);
  9093. };
  9094. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9095. function validateComponentName(name, { isNativeTag }) {
  9096. if (isBuiltInTag(name) || isNativeTag(name)) {
  9097. warn$1(
  9098. "Do not use built-in or reserved HTML elements as component id: " + name
  9099. );
  9100. }
  9101. }
  9102. function isStatefulComponent(instance) {
  9103. return instance.vnode.shapeFlag & 4;
  9104. }
  9105. let isInSSRComponentSetup = false;
  9106. function setupComponent(instance, isSSR = false, optimized = false) {
  9107. isSSR && setInSSRSetupState(isSSR);
  9108. const { props, children } = instance.vnode;
  9109. const isStateful = isStatefulComponent(instance);
  9110. initProps(instance, props, isStateful, isSSR);
  9111. initSlots(instance, children, optimized);
  9112. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9113. isSSR && setInSSRSetupState(false);
  9114. return setupResult;
  9115. }
  9116. function setupStatefulComponent(instance, isSSR) {
  9117. var _a;
  9118. const Component = instance.type;
  9119. {
  9120. if (Component.name) {
  9121. validateComponentName(Component.name, instance.appContext.config);
  9122. }
  9123. if (Component.components) {
  9124. const names = Object.keys(Component.components);
  9125. for (let i = 0; i < names.length; i++) {
  9126. validateComponentName(names[i], instance.appContext.config);
  9127. }
  9128. }
  9129. if (Component.directives) {
  9130. const names = Object.keys(Component.directives);
  9131. for (let i = 0; i < names.length; i++) {
  9132. validateDirectiveName(names[i]);
  9133. }
  9134. }
  9135. if (Component.compilerOptions && isRuntimeOnly()) {
  9136. warn$1(
  9137. `"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.`
  9138. );
  9139. }
  9140. }
  9141. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9142. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9143. {
  9144. exposePropsOnRenderContext(instance);
  9145. }
  9146. const { setup } = Component;
  9147. if (setup) {
  9148. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9149. const reset = setCurrentInstance(instance);
  9150. pauseTracking();
  9151. const setupResult = callWithErrorHandling(
  9152. setup,
  9153. instance,
  9154. 0,
  9155. [
  9156. shallowReadonly(instance.props) ,
  9157. setupContext
  9158. ]
  9159. );
  9160. resetTracking();
  9161. reset();
  9162. if (isPromise(setupResult)) {
  9163. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9164. if (isSSR) {
  9165. return setupResult.then((resolvedResult) => {
  9166. handleSetupResult(instance, resolvedResult, isSSR);
  9167. }).catch((e) => {
  9168. handleError(e, instance, 0);
  9169. });
  9170. } else {
  9171. instance.asyncDep = setupResult;
  9172. if (!instance.suspense) {
  9173. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9174. warn$1(
  9175. `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.`
  9176. );
  9177. }
  9178. }
  9179. } else {
  9180. handleSetupResult(instance, setupResult, isSSR);
  9181. }
  9182. } else {
  9183. finishComponentSetup(instance, isSSR);
  9184. }
  9185. }
  9186. function handleSetupResult(instance, setupResult, isSSR) {
  9187. if (isFunction(setupResult)) {
  9188. {
  9189. instance.render = setupResult;
  9190. }
  9191. } else if (isObject(setupResult)) {
  9192. if (isVNode(setupResult)) {
  9193. warn$1(
  9194. `setup() should not return VNodes directly - return a render function instead.`
  9195. );
  9196. }
  9197. {
  9198. instance.devtoolsRawSetupState = setupResult;
  9199. }
  9200. instance.setupState = proxyRefs(setupResult);
  9201. {
  9202. exposeSetupStateOnRenderContext(instance);
  9203. }
  9204. } else if (setupResult !== void 0) {
  9205. warn$1(
  9206. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  9207. );
  9208. }
  9209. finishComponentSetup(instance, isSSR);
  9210. }
  9211. let compile$1;
  9212. let installWithProxy;
  9213. function registerRuntimeCompiler(_compile) {
  9214. compile$1 = _compile;
  9215. installWithProxy = (i) => {
  9216. if (i.render._rc) {
  9217. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  9218. }
  9219. };
  9220. }
  9221. const isRuntimeOnly = () => !compile$1;
  9222. function finishComponentSetup(instance, isSSR, skipOptions) {
  9223. const Component = instance.type;
  9224. if (!instance.render) {
  9225. if (!isSSR && compile$1 && !Component.render) {
  9226. const template = Component.template || resolveMergedOptions(instance).template;
  9227. if (template) {
  9228. {
  9229. startMeasure(instance, `compile`);
  9230. }
  9231. const { isCustomElement, compilerOptions } = instance.appContext.config;
  9232. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  9233. const finalCompilerOptions = extend(
  9234. extend(
  9235. {
  9236. isCustomElement,
  9237. delimiters
  9238. },
  9239. compilerOptions
  9240. ),
  9241. componentCompilerOptions
  9242. );
  9243. Component.render = compile$1(template, finalCompilerOptions);
  9244. {
  9245. endMeasure(instance, `compile`);
  9246. }
  9247. }
  9248. }
  9249. instance.render = Component.render || NOOP;
  9250. if (installWithProxy) {
  9251. installWithProxy(instance);
  9252. }
  9253. }
  9254. {
  9255. const reset = setCurrentInstance(instance);
  9256. pauseTracking();
  9257. try {
  9258. applyOptions(instance);
  9259. } finally {
  9260. resetTracking();
  9261. reset();
  9262. }
  9263. }
  9264. if (!Component.render && instance.render === NOOP && !isSSR) {
  9265. if (!compile$1 && Component.template) {
  9266. warn$1(
  9267. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  9268. );
  9269. } else {
  9270. warn$1(`Component is missing template or render function: `, Component);
  9271. }
  9272. }
  9273. }
  9274. const attrsProxyHandlers = {
  9275. get(target, key) {
  9276. markAttrsAccessed();
  9277. track(target, "get", "");
  9278. return target[key];
  9279. },
  9280. set() {
  9281. warn$1(`setupContext.attrs is readonly.`);
  9282. return false;
  9283. },
  9284. deleteProperty() {
  9285. warn$1(`setupContext.attrs is readonly.`);
  9286. return false;
  9287. }
  9288. } ;
  9289. function getSlotsProxy(instance) {
  9290. return new Proxy(instance.slots, {
  9291. get(target, key) {
  9292. track(instance, "get", "$slots");
  9293. return target[key];
  9294. }
  9295. });
  9296. }
  9297. function createSetupContext(instance) {
  9298. const expose = (exposed) => {
  9299. {
  9300. if (instance.exposed) {
  9301. warn$1(`expose() should be called only once per setup().`);
  9302. }
  9303. if (exposed != null) {
  9304. let exposedType = typeof exposed;
  9305. if (exposedType === "object") {
  9306. if (isArray(exposed)) {
  9307. exposedType = "array";
  9308. } else if (isRef(exposed)) {
  9309. exposedType = "ref";
  9310. }
  9311. }
  9312. if (exposedType !== "object") {
  9313. warn$1(
  9314. `expose() should be passed a plain object, received ${exposedType}.`
  9315. );
  9316. }
  9317. }
  9318. }
  9319. instance.exposed = exposed || {};
  9320. };
  9321. {
  9322. let attrsProxy;
  9323. let slotsProxy;
  9324. return Object.freeze({
  9325. get attrs() {
  9326. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  9327. },
  9328. get slots() {
  9329. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  9330. },
  9331. get emit() {
  9332. return (event, ...args) => instance.emit(event, ...args);
  9333. },
  9334. expose
  9335. });
  9336. }
  9337. }
  9338. function getComponentPublicInstance(instance) {
  9339. if (instance.exposed) {
  9340. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  9341. get(target, key) {
  9342. if (key in target) {
  9343. return target[key];
  9344. } else if (key in publicPropertiesMap) {
  9345. return publicPropertiesMap[key](instance);
  9346. }
  9347. },
  9348. has(target, key) {
  9349. return key in target || key in publicPropertiesMap;
  9350. }
  9351. }));
  9352. } else {
  9353. return instance.proxy;
  9354. }
  9355. }
  9356. const classifyRE = /(?:^|[-_])(\w)/g;
  9357. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  9358. function getComponentName(Component, includeInferred = true) {
  9359. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  9360. }
  9361. function formatComponentName(instance, Component, isRoot = false) {
  9362. let name = getComponentName(Component);
  9363. if (!name && Component.__file) {
  9364. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  9365. if (match) {
  9366. name = match[1];
  9367. }
  9368. }
  9369. if (!name && instance && instance.parent) {
  9370. const inferFromRegistry = (registry) => {
  9371. for (const key in registry) {
  9372. if (registry[key] === Component) {
  9373. return key;
  9374. }
  9375. }
  9376. };
  9377. name = inferFromRegistry(
  9378. instance.components || instance.parent.type.components
  9379. ) || inferFromRegistry(instance.appContext.components);
  9380. }
  9381. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  9382. }
  9383. function isClassComponent(value) {
  9384. return isFunction(value) && "__vccOpts" in value;
  9385. }
  9386. const computed = (getterOrOptions, debugOptions) => {
  9387. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  9388. {
  9389. const i = getCurrentInstance();
  9390. if (i && i.appContext.config.warnRecursiveComputed) {
  9391. c._warnRecursive = true;
  9392. }
  9393. }
  9394. return c;
  9395. };
  9396. function h(type, propsOrChildren, children) {
  9397. const l = arguments.length;
  9398. if (l === 2) {
  9399. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  9400. if (isVNode(propsOrChildren)) {
  9401. return createVNode(type, null, [propsOrChildren]);
  9402. }
  9403. return createVNode(type, propsOrChildren);
  9404. } else {
  9405. return createVNode(type, null, propsOrChildren);
  9406. }
  9407. } else {
  9408. if (l > 3) {
  9409. children = Array.prototype.slice.call(arguments, 2);
  9410. } else if (l === 3 && isVNode(children)) {
  9411. children = [children];
  9412. }
  9413. return createVNode(type, propsOrChildren, children);
  9414. }
  9415. }
  9416. function initCustomFormatter() {
  9417. if (typeof window === "undefined") {
  9418. return;
  9419. }
  9420. const vueStyle = { style: "color:#3ba776" };
  9421. const numberStyle = { style: "color:#1677ff" };
  9422. const stringStyle = { style: "color:#f5222d" };
  9423. const keywordStyle = { style: "color:#eb2f96" };
  9424. const formatter = {
  9425. __vue_custom_formatter: true,
  9426. header(obj) {
  9427. if (!isObject(obj)) {
  9428. return null;
  9429. }
  9430. if (obj.__isVue) {
  9431. return ["div", vueStyle, `VueInstance`];
  9432. } else if (isRef(obj)) {
  9433. return [
  9434. "div",
  9435. {},
  9436. ["span", vueStyle, genRefFlag(obj)],
  9437. "<",
  9438. formatValue(obj.value),
  9439. `>`
  9440. ];
  9441. } else if (isReactive(obj)) {
  9442. return [
  9443. "div",
  9444. {},
  9445. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  9446. "<",
  9447. formatValue(obj),
  9448. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  9449. ];
  9450. } else if (isReadonly(obj)) {
  9451. return [
  9452. "div",
  9453. {},
  9454. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  9455. "<",
  9456. formatValue(obj),
  9457. ">"
  9458. ];
  9459. }
  9460. return null;
  9461. },
  9462. hasBody(obj) {
  9463. return obj && obj.__isVue;
  9464. },
  9465. body(obj) {
  9466. if (obj && obj.__isVue) {
  9467. return [
  9468. "div",
  9469. {},
  9470. ...formatInstance(obj.$)
  9471. ];
  9472. }
  9473. }
  9474. };
  9475. function formatInstance(instance) {
  9476. const blocks = [];
  9477. if (instance.type.props && instance.props) {
  9478. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  9479. }
  9480. if (instance.setupState !== EMPTY_OBJ) {
  9481. blocks.push(createInstanceBlock("setup", instance.setupState));
  9482. }
  9483. if (instance.data !== EMPTY_OBJ) {
  9484. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  9485. }
  9486. const computed = extractKeys(instance, "computed");
  9487. if (computed) {
  9488. blocks.push(createInstanceBlock("computed", computed));
  9489. }
  9490. const injected = extractKeys(instance, "inject");
  9491. if (injected) {
  9492. blocks.push(createInstanceBlock("injected", injected));
  9493. }
  9494. blocks.push([
  9495. "div",
  9496. {},
  9497. [
  9498. "span",
  9499. {
  9500. style: keywordStyle.style + ";opacity:0.66"
  9501. },
  9502. "$ (internal): "
  9503. ],
  9504. ["object", { object: instance }]
  9505. ]);
  9506. return blocks;
  9507. }
  9508. function createInstanceBlock(type, target) {
  9509. target = extend({}, target);
  9510. if (!Object.keys(target).length) {
  9511. return ["span", {}];
  9512. }
  9513. return [
  9514. "div",
  9515. { style: "line-height:1.25em;margin-bottom:0.6em" },
  9516. [
  9517. "div",
  9518. {
  9519. style: "color:#476582"
  9520. },
  9521. type
  9522. ],
  9523. [
  9524. "div",
  9525. {
  9526. style: "padding-left:1.25em"
  9527. },
  9528. ...Object.keys(target).map((key) => {
  9529. return [
  9530. "div",
  9531. {},
  9532. ["span", keywordStyle, key + ": "],
  9533. formatValue(target[key], false)
  9534. ];
  9535. })
  9536. ]
  9537. ];
  9538. }
  9539. function formatValue(v, asRaw = true) {
  9540. if (typeof v === "number") {
  9541. return ["span", numberStyle, v];
  9542. } else if (typeof v === "string") {
  9543. return ["span", stringStyle, JSON.stringify(v)];
  9544. } else if (typeof v === "boolean") {
  9545. return ["span", keywordStyle, v];
  9546. } else if (isObject(v)) {
  9547. return ["object", { object: asRaw ? toRaw(v) : v }];
  9548. } else {
  9549. return ["span", stringStyle, String(v)];
  9550. }
  9551. }
  9552. function extractKeys(instance, type) {
  9553. const Comp = instance.type;
  9554. if (isFunction(Comp)) {
  9555. return;
  9556. }
  9557. const extracted = {};
  9558. for (const key in instance.ctx) {
  9559. if (isKeyOfType(Comp, key, type)) {
  9560. extracted[key] = instance.ctx[key];
  9561. }
  9562. }
  9563. return extracted;
  9564. }
  9565. function isKeyOfType(Comp, key, type) {
  9566. const opts = Comp[type];
  9567. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  9568. return true;
  9569. }
  9570. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9571. return true;
  9572. }
  9573. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  9574. return true;
  9575. }
  9576. }
  9577. function genRefFlag(v) {
  9578. if (isShallow(v)) {
  9579. return `ShallowRef`;
  9580. }
  9581. if (v.effect) {
  9582. return `ComputedRef`;
  9583. }
  9584. return `Ref`;
  9585. }
  9586. if (window.devtoolsFormatters) {
  9587. window.devtoolsFormatters.push(formatter);
  9588. } else {
  9589. window.devtoolsFormatters = [formatter];
  9590. }
  9591. }
  9592. function withMemo(memo, render, cache, index) {
  9593. const cached = cache[index];
  9594. if (cached && isMemoSame(cached, memo)) {
  9595. return cached;
  9596. }
  9597. const ret = render();
  9598. ret.memo = memo.slice();
  9599. ret.cacheIndex = index;
  9600. return cache[index] = ret;
  9601. }
  9602. function isMemoSame(cached, memo) {
  9603. const prev = cached.memo;
  9604. if (prev.length != memo.length) {
  9605. return false;
  9606. }
  9607. for (let i = 0; i < prev.length; i++) {
  9608. if (hasChanged(prev[i], memo[i])) {
  9609. return false;
  9610. }
  9611. }
  9612. if (isBlockTreeEnabled > 0 && currentBlock) {
  9613. currentBlock.push(cached);
  9614. }
  9615. return true;
  9616. }
  9617. const version = "3.4.38";
  9618. const warn = warn$1 ;
  9619. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  9620. const devtools = devtools$1 ;
  9621. const setDevtoolsHook = setDevtoolsHook$1 ;
  9622. const ssrUtils = null;
  9623. const resolveFilter = null;
  9624. const compatUtils = null;
  9625. const DeprecationTypes = null;
  9626. const svgNS = "http://www.w3.org/2000/svg";
  9627. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  9628. const doc = typeof document !== "undefined" ? document : null;
  9629. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9630. const nodeOps = {
  9631. insert: (child, parent, anchor) => {
  9632. parent.insertBefore(child, anchor || null);
  9633. },
  9634. remove: (child) => {
  9635. const parent = child.parentNode;
  9636. if (parent) {
  9637. parent.removeChild(child);
  9638. }
  9639. },
  9640. createElement: (tag, namespace, is, props) => {
  9641. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  9642. if (tag === "select" && props && props.multiple != null) {
  9643. el.setAttribute("multiple", props.multiple);
  9644. }
  9645. return el;
  9646. },
  9647. createText: (text) => doc.createTextNode(text),
  9648. createComment: (text) => doc.createComment(text),
  9649. setText: (node, text) => {
  9650. node.nodeValue = text;
  9651. },
  9652. setElementText: (el, text) => {
  9653. el.textContent = text;
  9654. },
  9655. parentNode: (node) => node.parentNode,
  9656. nextSibling: (node) => node.nextSibling,
  9657. querySelector: (selector) => doc.querySelector(selector),
  9658. setScopeId(el, id) {
  9659. el.setAttribute(id, "");
  9660. },
  9661. // __UNSAFE__
  9662. // Reason: innerHTML.
  9663. // Static content here can only come from compiled templates.
  9664. // As long as the user only uses trusted templates, this is safe.
  9665. insertStaticContent(content, parent, anchor, namespace, start, end) {
  9666. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9667. if (start && (start === end || start.nextSibling)) {
  9668. while (true) {
  9669. parent.insertBefore(start.cloneNode(true), anchor);
  9670. if (start === end || !(start = start.nextSibling)) break;
  9671. }
  9672. } else {
  9673. templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
  9674. const template = templateContainer.content;
  9675. if (namespace === "svg" || namespace === "mathml") {
  9676. const wrapper = template.firstChild;
  9677. while (wrapper.firstChild) {
  9678. template.appendChild(wrapper.firstChild);
  9679. }
  9680. template.removeChild(wrapper);
  9681. }
  9682. parent.insertBefore(template, anchor);
  9683. }
  9684. return [
  9685. // first
  9686. before ? before.nextSibling : parent.firstChild,
  9687. // last
  9688. anchor ? anchor.previousSibling : parent.lastChild
  9689. ];
  9690. }
  9691. };
  9692. const TRANSITION$1 = "transition";
  9693. const ANIMATION = "animation";
  9694. const vtcKey = Symbol("_vtc");
  9695. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9696. Transition.displayName = "Transition";
  9697. const DOMTransitionPropsValidators = {
  9698. name: String,
  9699. type: String,
  9700. css: {
  9701. type: Boolean,
  9702. default: true
  9703. },
  9704. duration: [String, Number, Object],
  9705. enterFromClass: String,
  9706. enterActiveClass: String,
  9707. enterToClass: String,
  9708. appearFromClass: String,
  9709. appearActiveClass: String,
  9710. appearToClass: String,
  9711. leaveFromClass: String,
  9712. leaveActiveClass: String,
  9713. leaveToClass: String
  9714. };
  9715. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9716. {},
  9717. BaseTransitionPropsValidators,
  9718. DOMTransitionPropsValidators
  9719. );
  9720. const callHook = (hook, args = []) => {
  9721. if (isArray(hook)) {
  9722. hook.forEach((h2) => h2(...args));
  9723. } else if (hook) {
  9724. hook(...args);
  9725. }
  9726. };
  9727. const hasExplicitCallback = (hook) => {
  9728. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9729. };
  9730. function resolveTransitionProps(rawProps) {
  9731. const baseProps = {};
  9732. for (const key in rawProps) {
  9733. if (!(key in DOMTransitionPropsValidators)) {
  9734. baseProps[key] = rawProps[key];
  9735. }
  9736. }
  9737. if (rawProps.css === false) {
  9738. return baseProps;
  9739. }
  9740. const {
  9741. name = "v",
  9742. type,
  9743. duration,
  9744. enterFromClass = `${name}-enter-from`,
  9745. enterActiveClass = `${name}-enter-active`,
  9746. enterToClass = `${name}-enter-to`,
  9747. appearFromClass = enterFromClass,
  9748. appearActiveClass = enterActiveClass,
  9749. appearToClass = enterToClass,
  9750. leaveFromClass = `${name}-leave-from`,
  9751. leaveActiveClass = `${name}-leave-active`,
  9752. leaveToClass = `${name}-leave-to`
  9753. } = rawProps;
  9754. const durations = normalizeDuration(duration);
  9755. const enterDuration = durations && durations[0];
  9756. const leaveDuration = durations && durations[1];
  9757. const {
  9758. onBeforeEnter,
  9759. onEnter,
  9760. onEnterCancelled,
  9761. onLeave,
  9762. onLeaveCancelled,
  9763. onBeforeAppear = onBeforeEnter,
  9764. onAppear = onEnter,
  9765. onAppearCancelled = onEnterCancelled
  9766. } = baseProps;
  9767. const finishEnter = (el, isAppear, done) => {
  9768. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9769. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9770. done && done();
  9771. };
  9772. const finishLeave = (el, done) => {
  9773. el._isLeaving = false;
  9774. removeTransitionClass(el, leaveFromClass);
  9775. removeTransitionClass(el, leaveToClass);
  9776. removeTransitionClass(el, leaveActiveClass);
  9777. done && done();
  9778. };
  9779. const makeEnterHook = (isAppear) => {
  9780. return (el, done) => {
  9781. const hook = isAppear ? onAppear : onEnter;
  9782. const resolve = () => finishEnter(el, isAppear, done);
  9783. callHook(hook, [el, resolve]);
  9784. nextFrame(() => {
  9785. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9786. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9787. if (!hasExplicitCallback(hook)) {
  9788. whenTransitionEnds(el, type, enterDuration, resolve);
  9789. }
  9790. });
  9791. };
  9792. };
  9793. return extend(baseProps, {
  9794. onBeforeEnter(el) {
  9795. callHook(onBeforeEnter, [el]);
  9796. addTransitionClass(el, enterFromClass);
  9797. addTransitionClass(el, enterActiveClass);
  9798. },
  9799. onBeforeAppear(el) {
  9800. callHook(onBeforeAppear, [el]);
  9801. addTransitionClass(el, appearFromClass);
  9802. addTransitionClass(el, appearActiveClass);
  9803. },
  9804. onEnter: makeEnterHook(false),
  9805. onAppear: makeEnterHook(true),
  9806. onLeave(el, done) {
  9807. el._isLeaving = true;
  9808. const resolve = () => finishLeave(el, done);
  9809. addTransitionClass(el, leaveFromClass);
  9810. addTransitionClass(el, leaveActiveClass);
  9811. forceReflow();
  9812. nextFrame(() => {
  9813. if (!el._isLeaving) {
  9814. return;
  9815. }
  9816. removeTransitionClass(el, leaveFromClass);
  9817. addTransitionClass(el, leaveToClass);
  9818. if (!hasExplicitCallback(onLeave)) {
  9819. whenTransitionEnds(el, type, leaveDuration, resolve);
  9820. }
  9821. });
  9822. callHook(onLeave, [el, resolve]);
  9823. },
  9824. onEnterCancelled(el) {
  9825. finishEnter(el, false);
  9826. callHook(onEnterCancelled, [el]);
  9827. },
  9828. onAppearCancelled(el) {
  9829. finishEnter(el, true);
  9830. callHook(onAppearCancelled, [el]);
  9831. },
  9832. onLeaveCancelled(el) {
  9833. finishLeave(el);
  9834. callHook(onLeaveCancelled, [el]);
  9835. }
  9836. });
  9837. }
  9838. function normalizeDuration(duration) {
  9839. if (duration == null) {
  9840. return null;
  9841. } else if (isObject(duration)) {
  9842. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9843. } else {
  9844. const n = NumberOf(duration);
  9845. return [n, n];
  9846. }
  9847. }
  9848. function NumberOf(val) {
  9849. const res = toNumber(val);
  9850. {
  9851. assertNumber(res, "<transition> explicit duration");
  9852. }
  9853. return res;
  9854. }
  9855. function addTransitionClass(el, cls) {
  9856. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9857. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  9858. }
  9859. function removeTransitionClass(el, cls) {
  9860. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9861. const _vtc = el[vtcKey];
  9862. if (_vtc) {
  9863. _vtc.delete(cls);
  9864. if (!_vtc.size) {
  9865. el[vtcKey] = void 0;
  9866. }
  9867. }
  9868. }
  9869. function nextFrame(cb) {
  9870. requestAnimationFrame(() => {
  9871. requestAnimationFrame(cb);
  9872. });
  9873. }
  9874. let endId = 0;
  9875. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9876. const id = el._endId = ++endId;
  9877. const resolveIfNotStale = () => {
  9878. if (id === el._endId) {
  9879. resolve();
  9880. }
  9881. };
  9882. if (explicitTimeout) {
  9883. return setTimeout(resolveIfNotStale, explicitTimeout);
  9884. }
  9885. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9886. if (!type) {
  9887. return resolve();
  9888. }
  9889. const endEvent = type + "end";
  9890. let ended = 0;
  9891. const end = () => {
  9892. el.removeEventListener(endEvent, onEnd);
  9893. resolveIfNotStale();
  9894. };
  9895. const onEnd = (e) => {
  9896. if (e.target === el && ++ended >= propCount) {
  9897. end();
  9898. }
  9899. };
  9900. setTimeout(() => {
  9901. if (ended < propCount) {
  9902. end();
  9903. }
  9904. }, timeout + 1);
  9905. el.addEventListener(endEvent, onEnd);
  9906. }
  9907. function getTransitionInfo(el, expectedType) {
  9908. const styles = window.getComputedStyle(el);
  9909. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9910. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9911. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9912. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9913. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9914. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9915. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9916. let type = null;
  9917. let timeout = 0;
  9918. let propCount = 0;
  9919. if (expectedType === TRANSITION$1) {
  9920. if (transitionTimeout > 0) {
  9921. type = TRANSITION$1;
  9922. timeout = transitionTimeout;
  9923. propCount = transitionDurations.length;
  9924. }
  9925. } else if (expectedType === ANIMATION) {
  9926. if (animationTimeout > 0) {
  9927. type = ANIMATION;
  9928. timeout = animationTimeout;
  9929. propCount = animationDurations.length;
  9930. }
  9931. } else {
  9932. timeout = Math.max(transitionTimeout, animationTimeout);
  9933. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9934. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9935. }
  9936. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9937. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9938. );
  9939. return {
  9940. type,
  9941. timeout,
  9942. propCount,
  9943. hasTransform
  9944. };
  9945. }
  9946. function getTimeout(delays, durations) {
  9947. while (delays.length < durations.length) {
  9948. delays = delays.concat(delays);
  9949. }
  9950. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9951. }
  9952. function toMs(s) {
  9953. if (s === "auto") return 0;
  9954. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9955. }
  9956. function forceReflow() {
  9957. return document.body.offsetHeight;
  9958. }
  9959. function patchClass(el, value, isSVG) {
  9960. const transitionClasses = el[vtcKey];
  9961. if (transitionClasses) {
  9962. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9963. }
  9964. if (value == null) {
  9965. el.removeAttribute("class");
  9966. } else if (isSVG) {
  9967. el.setAttribute("class", value);
  9968. } else {
  9969. el.className = value;
  9970. }
  9971. }
  9972. const vShowOriginalDisplay = Symbol("_vod");
  9973. const vShowHidden = Symbol("_vsh");
  9974. const vShow = {
  9975. beforeMount(el, { value }, { transition }) {
  9976. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  9977. if (transition && value) {
  9978. transition.beforeEnter(el);
  9979. } else {
  9980. setDisplay(el, value);
  9981. }
  9982. },
  9983. mounted(el, { value }, { transition }) {
  9984. if (transition && value) {
  9985. transition.enter(el);
  9986. }
  9987. },
  9988. updated(el, { value, oldValue }, { transition }) {
  9989. if (!value === !oldValue) return;
  9990. if (transition) {
  9991. if (value) {
  9992. transition.beforeEnter(el);
  9993. setDisplay(el, true);
  9994. transition.enter(el);
  9995. } else {
  9996. transition.leave(el, () => {
  9997. setDisplay(el, false);
  9998. });
  9999. }
  10000. } else {
  10001. setDisplay(el, value);
  10002. }
  10003. },
  10004. beforeUnmount(el, { value }) {
  10005. setDisplay(el, value);
  10006. }
  10007. };
  10008. {
  10009. vShow.name = "show";
  10010. }
  10011. function setDisplay(el, value) {
  10012. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10013. el[vShowHidden] = !value;
  10014. }
  10015. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10016. function useCssVars(getter) {
  10017. const instance = getCurrentInstance();
  10018. if (!instance) {
  10019. warn(`useCssVars is called without current active component instance.`);
  10020. return;
  10021. }
  10022. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10023. Array.from(
  10024. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10025. ).forEach((node) => setVarsOnNode(node, vars));
  10026. };
  10027. {
  10028. instance.getCssVars = () => getter(instance.proxy);
  10029. }
  10030. const setVars = () => {
  10031. const vars = getter(instance.proxy);
  10032. setVarsOnVNode(instance.subTree, vars);
  10033. updateTeleports(vars);
  10034. };
  10035. onBeforeMount(() => {
  10036. watchPostEffect(setVars);
  10037. });
  10038. onMounted(() => {
  10039. const ob = new MutationObserver(setVars);
  10040. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10041. onUnmounted(() => ob.disconnect());
  10042. });
  10043. }
  10044. function setVarsOnVNode(vnode, vars) {
  10045. if (vnode.shapeFlag & 128) {
  10046. const suspense = vnode.suspense;
  10047. vnode = suspense.activeBranch;
  10048. if (suspense.pendingBranch && !suspense.isHydrating) {
  10049. suspense.effects.push(() => {
  10050. setVarsOnVNode(suspense.activeBranch, vars);
  10051. });
  10052. }
  10053. }
  10054. while (vnode.component) {
  10055. vnode = vnode.component.subTree;
  10056. }
  10057. if (vnode.shapeFlag & 1 && vnode.el) {
  10058. setVarsOnNode(vnode.el, vars);
  10059. } else if (vnode.type === Fragment) {
  10060. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10061. } else if (vnode.type === Static) {
  10062. let { el, anchor } = vnode;
  10063. while (el) {
  10064. setVarsOnNode(el, vars);
  10065. if (el === anchor) break;
  10066. el = el.nextSibling;
  10067. }
  10068. }
  10069. }
  10070. function setVarsOnNode(el, vars) {
  10071. if (el.nodeType === 1) {
  10072. const style = el.style;
  10073. let cssText = "";
  10074. for (const key in vars) {
  10075. style.setProperty(`--${key}`, vars[key]);
  10076. cssText += `--${key}: ${vars[key]};`;
  10077. }
  10078. style[CSS_VAR_TEXT] = cssText;
  10079. }
  10080. }
  10081. const displayRE = /(^|;)\s*display\s*:/;
  10082. function patchStyle(el, prev, next) {
  10083. const style = el.style;
  10084. const isCssString = isString(next);
  10085. let hasControlledDisplay = false;
  10086. if (next && !isCssString) {
  10087. if (prev) {
  10088. if (!isString(prev)) {
  10089. for (const key in prev) {
  10090. if (next[key] == null) {
  10091. setStyle(style, key, "");
  10092. }
  10093. }
  10094. } else {
  10095. for (const prevStyle of prev.split(";")) {
  10096. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10097. if (next[key] == null) {
  10098. setStyle(style, key, "");
  10099. }
  10100. }
  10101. }
  10102. }
  10103. for (const key in next) {
  10104. if (key === "display") {
  10105. hasControlledDisplay = true;
  10106. }
  10107. setStyle(style, key, next[key]);
  10108. }
  10109. } else {
  10110. if (isCssString) {
  10111. if (prev !== next) {
  10112. const cssVarText = style[CSS_VAR_TEXT];
  10113. if (cssVarText) {
  10114. next += ";" + cssVarText;
  10115. }
  10116. style.cssText = next;
  10117. hasControlledDisplay = displayRE.test(next);
  10118. }
  10119. } else if (prev) {
  10120. el.removeAttribute("style");
  10121. }
  10122. }
  10123. if (vShowOriginalDisplay in el) {
  10124. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10125. if (el[vShowHidden]) {
  10126. style.display = "none";
  10127. }
  10128. }
  10129. }
  10130. const semicolonRE = /[^\\];\s*$/;
  10131. const importantRE = /\s*!important$/;
  10132. function setStyle(style, name, val) {
  10133. if (isArray(val)) {
  10134. val.forEach((v) => setStyle(style, name, v));
  10135. } else {
  10136. if (val == null) val = "";
  10137. {
  10138. if (semicolonRE.test(val)) {
  10139. warn(
  10140. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10141. );
  10142. }
  10143. }
  10144. if (name.startsWith("--")) {
  10145. style.setProperty(name, val);
  10146. } else {
  10147. const prefixed = autoPrefix(style, name);
  10148. if (importantRE.test(val)) {
  10149. style.setProperty(
  10150. hyphenate(prefixed),
  10151. val.replace(importantRE, ""),
  10152. "important"
  10153. );
  10154. } else {
  10155. style[prefixed] = val;
  10156. }
  10157. }
  10158. }
  10159. }
  10160. const prefixes = ["Webkit", "Moz", "ms"];
  10161. const prefixCache = {};
  10162. function autoPrefix(style, rawName) {
  10163. const cached = prefixCache[rawName];
  10164. if (cached) {
  10165. return cached;
  10166. }
  10167. let name = camelize(rawName);
  10168. if (name !== "filter" && name in style) {
  10169. return prefixCache[rawName] = name;
  10170. }
  10171. name = capitalize(name);
  10172. for (let i = 0; i < prefixes.length; i++) {
  10173. const prefixed = prefixes[i] + name;
  10174. if (prefixed in style) {
  10175. return prefixCache[rawName] = prefixed;
  10176. }
  10177. }
  10178. return rawName;
  10179. }
  10180. const xlinkNS = "http://www.w3.org/1999/xlink";
  10181. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  10182. if (isSVG && key.startsWith("xlink:")) {
  10183. if (value == null) {
  10184. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  10185. } else {
  10186. el.setAttributeNS(xlinkNS, key, value);
  10187. }
  10188. } else {
  10189. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  10190. el.removeAttribute(key);
  10191. } else {
  10192. el.setAttribute(
  10193. key,
  10194. isBoolean ? "" : isSymbol(value) ? String(value) : value
  10195. );
  10196. }
  10197. }
  10198. }
  10199. function patchDOMProp(el, key, value, parentComponent) {
  10200. if (key === "innerHTML" || key === "textContent") {
  10201. if (value == null) return;
  10202. el[key] = value;
  10203. return;
  10204. }
  10205. const tag = el.tagName;
  10206. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  10207. !tag.includes("-")) {
  10208. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  10209. const newValue = value == null ? "" : String(value);
  10210. if (oldValue !== newValue || !("_value" in el)) {
  10211. el.value = newValue;
  10212. }
  10213. if (value == null) {
  10214. el.removeAttribute(key);
  10215. }
  10216. el._value = value;
  10217. return;
  10218. }
  10219. let needRemove = false;
  10220. if (value === "" || value == null) {
  10221. const type = typeof el[key];
  10222. if (type === "boolean") {
  10223. value = includeBooleanAttr(value);
  10224. } else if (value == null && type === "string") {
  10225. value = "";
  10226. needRemove = true;
  10227. } else if (type === "number") {
  10228. value = 0;
  10229. needRemove = true;
  10230. }
  10231. }
  10232. try {
  10233. el[key] = value;
  10234. } catch (e) {
  10235. if (!needRemove) {
  10236. warn(
  10237. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  10238. e
  10239. );
  10240. }
  10241. }
  10242. needRemove && el.removeAttribute(key);
  10243. }
  10244. function addEventListener(el, event, handler, options) {
  10245. el.addEventListener(event, handler, options);
  10246. }
  10247. function removeEventListener(el, event, handler, options) {
  10248. el.removeEventListener(event, handler, options);
  10249. }
  10250. const veiKey = Symbol("_vei");
  10251. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  10252. const invokers = el[veiKey] || (el[veiKey] = {});
  10253. const existingInvoker = invokers[rawName];
  10254. if (nextValue && existingInvoker) {
  10255. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  10256. } else {
  10257. const [name, options] = parseName(rawName);
  10258. if (nextValue) {
  10259. const invoker = invokers[rawName] = createInvoker(
  10260. sanitizeEventValue(nextValue, rawName) ,
  10261. instance
  10262. );
  10263. addEventListener(el, name, invoker, options);
  10264. } else if (existingInvoker) {
  10265. removeEventListener(el, name, existingInvoker, options);
  10266. invokers[rawName] = void 0;
  10267. }
  10268. }
  10269. }
  10270. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  10271. function parseName(name) {
  10272. let options;
  10273. if (optionsModifierRE.test(name)) {
  10274. options = {};
  10275. let m;
  10276. while (m = name.match(optionsModifierRE)) {
  10277. name = name.slice(0, name.length - m[0].length);
  10278. options[m[0].toLowerCase()] = true;
  10279. }
  10280. }
  10281. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  10282. return [event, options];
  10283. }
  10284. let cachedNow = 0;
  10285. const p = /* @__PURE__ */ Promise.resolve();
  10286. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  10287. function createInvoker(initialValue, instance) {
  10288. const invoker = (e) => {
  10289. if (!e._vts) {
  10290. e._vts = Date.now();
  10291. } else if (e._vts <= invoker.attached) {
  10292. return;
  10293. }
  10294. callWithAsyncErrorHandling(
  10295. patchStopImmediatePropagation(e, invoker.value),
  10296. instance,
  10297. 5,
  10298. [e]
  10299. );
  10300. };
  10301. invoker.value = initialValue;
  10302. invoker.attached = getNow();
  10303. return invoker;
  10304. }
  10305. function sanitizeEventValue(value, propName) {
  10306. if (isFunction(value) || isArray(value)) {
  10307. return value;
  10308. }
  10309. warn(
  10310. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  10311. Expected function or array of functions, received type ${typeof value}.`
  10312. );
  10313. return NOOP;
  10314. }
  10315. function patchStopImmediatePropagation(e, value) {
  10316. if (isArray(value)) {
  10317. const originalStop = e.stopImmediatePropagation;
  10318. e.stopImmediatePropagation = () => {
  10319. originalStop.call(e);
  10320. e._stopped = true;
  10321. };
  10322. return value.map(
  10323. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  10324. );
  10325. } else {
  10326. return value;
  10327. }
  10328. }
  10329. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  10330. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  10331. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  10332. const isSVG = namespace === "svg";
  10333. if (key === "class") {
  10334. patchClass(el, nextValue, isSVG);
  10335. } else if (key === "style") {
  10336. patchStyle(el, prevValue, nextValue);
  10337. } else if (isOn(key)) {
  10338. if (!isModelListener(key)) {
  10339. patchEvent(el, key, prevValue, nextValue, parentComponent);
  10340. }
  10341. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  10342. patchDOMProp(el, key, nextValue);
  10343. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  10344. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  10345. }
  10346. } else {
  10347. if (key === "true-value") {
  10348. el._trueValue = nextValue;
  10349. } else if (key === "false-value") {
  10350. el._falseValue = nextValue;
  10351. }
  10352. patchAttr(el, key, nextValue, isSVG);
  10353. }
  10354. };
  10355. function shouldSetAsProp(el, key, value, isSVG) {
  10356. if (isSVG) {
  10357. if (key === "innerHTML" || key === "textContent") {
  10358. return true;
  10359. }
  10360. if (key in el && isNativeOn(key) && isFunction(value)) {
  10361. return true;
  10362. }
  10363. return false;
  10364. }
  10365. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  10366. return false;
  10367. }
  10368. if (key === "form") {
  10369. return false;
  10370. }
  10371. if (key === "list" && el.tagName === "INPUT") {
  10372. return false;
  10373. }
  10374. if (key === "type" && el.tagName === "TEXTAREA") {
  10375. return false;
  10376. }
  10377. if (key === "width" || key === "height") {
  10378. const tag = el.tagName;
  10379. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  10380. return false;
  10381. }
  10382. }
  10383. if (isNativeOn(key) && isString(value)) {
  10384. return false;
  10385. }
  10386. return key in el;
  10387. }
  10388. /*! #__NO_SIDE_EFFECTS__ */
  10389. // @__NO_SIDE_EFFECTS__
  10390. function defineCustomElement(options, extraOptions, hydrate2) {
  10391. const Comp = defineComponent(options, extraOptions);
  10392. class VueCustomElement extends VueElement {
  10393. constructor(initialProps) {
  10394. super(Comp, initialProps, hydrate2);
  10395. }
  10396. }
  10397. VueCustomElement.def = Comp;
  10398. return VueCustomElement;
  10399. }
  10400. /*! #__NO_SIDE_EFFECTS__ */
  10401. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  10402. return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
  10403. };
  10404. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  10405. };
  10406. class VueElement extends BaseClass {
  10407. constructor(_def, _props = {}, hydrate2) {
  10408. super();
  10409. this._def = _def;
  10410. this._props = _props;
  10411. /**
  10412. * @internal
  10413. */
  10414. this._instance = null;
  10415. this._connected = false;
  10416. this._resolved = false;
  10417. this._numberProps = null;
  10418. this._ob = null;
  10419. if (this.shadowRoot && hydrate2) {
  10420. hydrate2(this._createVNode(), this.shadowRoot);
  10421. } else {
  10422. if (this.shadowRoot) {
  10423. warn(
  10424. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  10425. );
  10426. }
  10427. this.attachShadow({ mode: "open" });
  10428. if (!this._def.__asyncLoader) {
  10429. this._resolveProps(this._def);
  10430. }
  10431. }
  10432. }
  10433. connectedCallback() {
  10434. this._connected = true;
  10435. if (!this._instance) {
  10436. if (this._resolved) {
  10437. this._update();
  10438. } else {
  10439. this._resolveDef();
  10440. }
  10441. }
  10442. }
  10443. disconnectedCallback() {
  10444. this._connected = false;
  10445. nextTick(() => {
  10446. if (!this._connected) {
  10447. if (this._ob) {
  10448. this._ob.disconnect();
  10449. this._ob = null;
  10450. }
  10451. render(null, this.shadowRoot);
  10452. this._instance = null;
  10453. }
  10454. });
  10455. }
  10456. /**
  10457. * resolve inner component definition (handle possible async component)
  10458. */
  10459. _resolveDef() {
  10460. this._resolved = true;
  10461. for (let i = 0; i < this.attributes.length; i++) {
  10462. this._setAttr(this.attributes[i].name);
  10463. }
  10464. this._ob = new MutationObserver((mutations) => {
  10465. for (const m of mutations) {
  10466. this._setAttr(m.attributeName);
  10467. }
  10468. });
  10469. this._ob.observe(this, { attributes: true });
  10470. const resolve = (def, isAsync = false) => {
  10471. const { props, styles } = def;
  10472. let numberProps;
  10473. if (props && !isArray(props)) {
  10474. for (const key in props) {
  10475. const opt = props[key];
  10476. if (opt === Number || opt && opt.type === Number) {
  10477. if (key in this._props) {
  10478. this._props[key] = toNumber(this._props[key]);
  10479. }
  10480. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  10481. }
  10482. }
  10483. }
  10484. this._numberProps = numberProps;
  10485. if (isAsync) {
  10486. this._resolveProps(def);
  10487. }
  10488. this._applyStyles(styles);
  10489. this._update();
  10490. };
  10491. const asyncDef = this._def.__asyncLoader;
  10492. if (asyncDef) {
  10493. asyncDef().then((def) => resolve(def, true));
  10494. } else {
  10495. resolve(this._def);
  10496. }
  10497. }
  10498. _resolveProps(def) {
  10499. const { props } = def;
  10500. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  10501. for (const key of Object.keys(this)) {
  10502. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  10503. this._setProp(key, this[key], true, false);
  10504. }
  10505. }
  10506. for (const key of declaredPropKeys.map(camelize)) {
  10507. Object.defineProperty(this, key, {
  10508. get() {
  10509. return this._getProp(key);
  10510. },
  10511. set(val) {
  10512. this._setProp(key, val);
  10513. }
  10514. });
  10515. }
  10516. }
  10517. _setAttr(key) {
  10518. let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
  10519. const camelKey = camelize(key);
  10520. if (this._numberProps && this._numberProps[camelKey]) {
  10521. value = toNumber(value);
  10522. }
  10523. this._setProp(camelKey, value, false);
  10524. }
  10525. /**
  10526. * @internal
  10527. */
  10528. _getProp(key) {
  10529. return this._props[key];
  10530. }
  10531. /**
  10532. * @internal
  10533. */
  10534. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  10535. if (val !== this._props[key]) {
  10536. this._props[key] = val;
  10537. if (shouldUpdate && this._instance) {
  10538. this._update();
  10539. }
  10540. if (shouldReflect) {
  10541. if (val === true) {
  10542. this.setAttribute(hyphenate(key), "");
  10543. } else if (typeof val === "string" || typeof val === "number") {
  10544. this.setAttribute(hyphenate(key), val + "");
  10545. } else if (!val) {
  10546. this.removeAttribute(hyphenate(key));
  10547. }
  10548. }
  10549. }
  10550. }
  10551. _update() {
  10552. render(this._createVNode(), this.shadowRoot);
  10553. }
  10554. _createVNode() {
  10555. const vnode = createVNode(this._def, extend({}, this._props));
  10556. if (!this._instance) {
  10557. vnode.ce = (instance) => {
  10558. this._instance = instance;
  10559. instance.isCE = true;
  10560. {
  10561. instance.ceReload = (newStyles) => {
  10562. if (this._styles) {
  10563. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  10564. this._styles.length = 0;
  10565. }
  10566. this._applyStyles(newStyles);
  10567. this._instance = null;
  10568. this._update();
  10569. };
  10570. }
  10571. const dispatch = (event, args) => {
  10572. this.dispatchEvent(
  10573. new CustomEvent(event, {
  10574. detail: args
  10575. })
  10576. );
  10577. };
  10578. instance.emit = (event, ...args) => {
  10579. dispatch(event, args);
  10580. if (hyphenate(event) !== event) {
  10581. dispatch(hyphenate(event), args);
  10582. }
  10583. };
  10584. let parent = this;
  10585. while (parent = parent && (parent.parentNode || parent.host)) {
  10586. if (parent instanceof VueElement) {
  10587. instance.parent = parent._instance;
  10588. instance.provides = parent._instance.provides;
  10589. break;
  10590. }
  10591. }
  10592. };
  10593. }
  10594. return vnode;
  10595. }
  10596. _applyStyles(styles) {
  10597. if (styles) {
  10598. styles.forEach((css) => {
  10599. const s = document.createElement("style");
  10600. s.textContent = css;
  10601. this.shadowRoot.appendChild(s);
  10602. {
  10603. (this._styles || (this._styles = [])).push(s);
  10604. }
  10605. });
  10606. }
  10607. }
  10608. }
  10609. function useCssModule(name = "$style") {
  10610. {
  10611. {
  10612. warn(`useCssModule() is not supported in the global build.`);
  10613. }
  10614. return EMPTY_OBJ;
  10615. }
  10616. }
  10617. const positionMap = /* @__PURE__ */ new WeakMap();
  10618. const newPositionMap = /* @__PURE__ */ new WeakMap();
  10619. const moveCbKey = Symbol("_moveCb");
  10620. const enterCbKey = Symbol("_enterCb");
  10621. const TransitionGroupImpl = {
  10622. name: "TransitionGroup",
  10623. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  10624. tag: String,
  10625. moveClass: String
  10626. }),
  10627. setup(props, { slots }) {
  10628. const instance = getCurrentInstance();
  10629. const state = useTransitionState();
  10630. let prevChildren;
  10631. let children;
  10632. onUpdated(() => {
  10633. if (!prevChildren.length) {
  10634. return;
  10635. }
  10636. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  10637. if (!hasCSSTransform(
  10638. prevChildren[0].el,
  10639. instance.vnode.el,
  10640. moveClass
  10641. )) {
  10642. return;
  10643. }
  10644. prevChildren.forEach(callPendingCbs);
  10645. prevChildren.forEach(recordPosition);
  10646. const movedChildren = prevChildren.filter(applyTranslation);
  10647. forceReflow();
  10648. movedChildren.forEach((c) => {
  10649. const el = c.el;
  10650. const style = el.style;
  10651. addTransitionClass(el, moveClass);
  10652. style.transform = style.webkitTransform = style.transitionDuration = "";
  10653. const cb = el[moveCbKey] = (e) => {
  10654. if (e && e.target !== el) {
  10655. return;
  10656. }
  10657. if (!e || /transform$/.test(e.propertyName)) {
  10658. el.removeEventListener("transitionend", cb);
  10659. el[moveCbKey] = null;
  10660. removeTransitionClass(el, moveClass);
  10661. }
  10662. };
  10663. el.addEventListener("transitionend", cb);
  10664. });
  10665. });
  10666. return () => {
  10667. const rawProps = toRaw(props);
  10668. const cssTransitionProps = resolveTransitionProps(rawProps);
  10669. let tag = rawProps.tag || Fragment;
  10670. prevChildren = [];
  10671. if (children) {
  10672. for (let i = 0; i < children.length; i++) {
  10673. const child = children[i];
  10674. if (child.el && child.el instanceof Element) {
  10675. prevChildren.push(child);
  10676. setTransitionHooks(
  10677. child,
  10678. resolveTransitionHooks(
  10679. child,
  10680. cssTransitionProps,
  10681. state,
  10682. instance
  10683. )
  10684. );
  10685. positionMap.set(
  10686. child,
  10687. child.el.getBoundingClientRect()
  10688. );
  10689. }
  10690. }
  10691. }
  10692. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  10693. for (let i = 0; i < children.length; i++) {
  10694. const child = children[i];
  10695. if (child.key != null) {
  10696. setTransitionHooks(
  10697. child,
  10698. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10699. );
  10700. } else {
  10701. warn(`<TransitionGroup> children must be keyed.`);
  10702. }
  10703. }
  10704. return createVNode(tag, null, children);
  10705. };
  10706. }
  10707. };
  10708. const removeMode = (props) => delete props.mode;
  10709. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  10710. const TransitionGroup = TransitionGroupImpl;
  10711. function callPendingCbs(c) {
  10712. const el = c.el;
  10713. if (el[moveCbKey]) {
  10714. el[moveCbKey]();
  10715. }
  10716. if (el[enterCbKey]) {
  10717. el[enterCbKey]();
  10718. }
  10719. }
  10720. function recordPosition(c) {
  10721. newPositionMap.set(c, c.el.getBoundingClientRect());
  10722. }
  10723. function applyTranslation(c) {
  10724. const oldPos = positionMap.get(c);
  10725. const newPos = newPositionMap.get(c);
  10726. const dx = oldPos.left - newPos.left;
  10727. const dy = oldPos.top - newPos.top;
  10728. if (dx || dy) {
  10729. const s = c.el.style;
  10730. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10731. s.transitionDuration = "0s";
  10732. return c;
  10733. }
  10734. }
  10735. function hasCSSTransform(el, root, moveClass) {
  10736. const clone = el.cloneNode();
  10737. const _vtc = el[vtcKey];
  10738. if (_vtc) {
  10739. _vtc.forEach((cls) => {
  10740. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10741. });
  10742. }
  10743. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10744. clone.style.display = "none";
  10745. const container = root.nodeType === 1 ? root : root.parentNode;
  10746. container.appendChild(clone);
  10747. const { hasTransform } = getTransitionInfo(clone);
  10748. container.removeChild(clone);
  10749. return hasTransform;
  10750. }
  10751. const getModelAssigner = (vnode) => {
  10752. const fn = vnode.props["onUpdate:modelValue"] || false;
  10753. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10754. };
  10755. function onCompositionStart(e) {
  10756. e.target.composing = true;
  10757. }
  10758. function onCompositionEnd(e) {
  10759. const target = e.target;
  10760. if (target.composing) {
  10761. target.composing = false;
  10762. target.dispatchEvent(new Event("input"));
  10763. }
  10764. }
  10765. const assignKey = Symbol("_assign");
  10766. const vModelText = {
  10767. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10768. el[assignKey] = getModelAssigner(vnode);
  10769. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10770. addEventListener(el, lazy ? "change" : "input", (e) => {
  10771. if (e.target.composing) return;
  10772. let domValue = el.value;
  10773. if (trim) {
  10774. domValue = domValue.trim();
  10775. }
  10776. if (castToNumber) {
  10777. domValue = looseToNumber(domValue);
  10778. }
  10779. el[assignKey](domValue);
  10780. });
  10781. if (trim) {
  10782. addEventListener(el, "change", () => {
  10783. el.value = el.value.trim();
  10784. });
  10785. }
  10786. if (!lazy) {
  10787. addEventListener(el, "compositionstart", onCompositionStart);
  10788. addEventListener(el, "compositionend", onCompositionEnd);
  10789. addEventListener(el, "change", onCompositionEnd);
  10790. }
  10791. },
  10792. // set value on mounted so it's after min/max for type="range"
  10793. mounted(el, { value }) {
  10794. el.value = value == null ? "" : value;
  10795. },
  10796. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  10797. el[assignKey] = getModelAssigner(vnode);
  10798. if (el.composing) return;
  10799. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  10800. const newValue = value == null ? "" : value;
  10801. if (elValue === newValue) {
  10802. return;
  10803. }
  10804. if (document.activeElement === el && el.type !== "range") {
  10805. if (lazy && value === oldValue) {
  10806. return;
  10807. }
  10808. if (trim && el.value.trim() === newValue) {
  10809. return;
  10810. }
  10811. }
  10812. el.value = newValue;
  10813. }
  10814. };
  10815. const vModelCheckbox = {
  10816. // #4096 array checkboxes need to be deep traversed
  10817. deep: true,
  10818. created(el, _, vnode) {
  10819. el[assignKey] = getModelAssigner(vnode);
  10820. addEventListener(el, "change", () => {
  10821. const modelValue = el._modelValue;
  10822. const elementValue = getValue(el);
  10823. const checked = el.checked;
  10824. const assign = el[assignKey];
  10825. if (isArray(modelValue)) {
  10826. const index = looseIndexOf(modelValue, elementValue);
  10827. const found = index !== -1;
  10828. if (checked && !found) {
  10829. assign(modelValue.concat(elementValue));
  10830. } else if (!checked && found) {
  10831. const filtered = [...modelValue];
  10832. filtered.splice(index, 1);
  10833. assign(filtered);
  10834. }
  10835. } else if (isSet(modelValue)) {
  10836. const cloned = new Set(modelValue);
  10837. if (checked) {
  10838. cloned.add(elementValue);
  10839. } else {
  10840. cloned.delete(elementValue);
  10841. }
  10842. assign(cloned);
  10843. } else {
  10844. assign(getCheckboxValue(el, checked));
  10845. }
  10846. });
  10847. },
  10848. // set initial checked on mount to wait for true-value/false-value
  10849. mounted: setChecked,
  10850. beforeUpdate(el, binding, vnode) {
  10851. el[assignKey] = getModelAssigner(vnode);
  10852. setChecked(el, binding, vnode);
  10853. }
  10854. };
  10855. function setChecked(el, { value, oldValue }, vnode) {
  10856. el._modelValue = value;
  10857. if (isArray(value)) {
  10858. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10859. } else if (isSet(value)) {
  10860. el.checked = value.has(vnode.props.value);
  10861. } else if (value !== oldValue) {
  10862. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10863. }
  10864. }
  10865. const vModelRadio = {
  10866. created(el, { value }, vnode) {
  10867. el.checked = looseEqual(value, vnode.props.value);
  10868. el[assignKey] = getModelAssigner(vnode);
  10869. addEventListener(el, "change", () => {
  10870. el[assignKey](getValue(el));
  10871. });
  10872. },
  10873. beforeUpdate(el, { value, oldValue }, vnode) {
  10874. el[assignKey] = getModelAssigner(vnode);
  10875. if (value !== oldValue) {
  10876. el.checked = looseEqual(value, vnode.props.value);
  10877. }
  10878. }
  10879. };
  10880. const vModelSelect = {
  10881. // <select multiple> value need to be deep traversed
  10882. deep: true,
  10883. created(el, { value, modifiers: { number } }, vnode) {
  10884. const isSetModel = isSet(value);
  10885. addEventListener(el, "change", () => {
  10886. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10887. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10888. );
  10889. el[assignKey](
  10890. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10891. );
  10892. el._assigning = true;
  10893. nextTick(() => {
  10894. el._assigning = false;
  10895. });
  10896. });
  10897. el[assignKey] = getModelAssigner(vnode);
  10898. },
  10899. // set value in mounted & updated because <select> relies on its children
  10900. // <option>s.
  10901. mounted(el, { value, modifiers: { number } }) {
  10902. setSelected(el, value);
  10903. },
  10904. beforeUpdate(el, _binding, vnode) {
  10905. el[assignKey] = getModelAssigner(vnode);
  10906. },
  10907. updated(el, { value, modifiers: { number } }) {
  10908. if (!el._assigning) {
  10909. setSelected(el, value);
  10910. }
  10911. }
  10912. };
  10913. function setSelected(el, value, number) {
  10914. const isMultiple = el.multiple;
  10915. const isArrayValue = isArray(value);
  10916. if (isMultiple && !isArrayValue && !isSet(value)) {
  10917. warn(
  10918. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10919. );
  10920. return;
  10921. }
  10922. for (let i = 0, l = el.options.length; i < l; i++) {
  10923. const option = el.options[i];
  10924. const optionValue = getValue(option);
  10925. if (isMultiple) {
  10926. if (isArrayValue) {
  10927. const optionType = typeof optionValue;
  10928. if (optionType === "string" || optionType === "number") {
  10929. option.selected = value.some((v) => String(v) === String(optionValue));
  10930. } else {
  10931. option.selected = looseIndexOf(value, optionValue) > -1;
  10932. }
  10933. } else {
  10934. option.selected = value.has(optionValue);
  10935. }
  10936. } else if (looseEqual(getValue(option), value)) {
  10937. if (el.selectedIndex !== i) el.selectedIndex = i;
  10938. return;
  10939. }
  10940. }
  10941. if (!isMultiple && el.selectedIndex !== -1) {
  10942. el.selectedIndex = -1;
  10943. }
  10944. }
  10945. function getValue(el) {
  10946. return "_value" in el ? el._value : el.value;
  10947. }
  10948. function getCheckboxValue(el, checked) {
  10949. const key = checked ? "_trueValue" : "_falseValue";
  10950. return key in el ? el[key] : checked;
  10951. }
  10952. const vModelDynamic = {
  10953. created(el, binding, vnode) {
  10954. callModelHook(el, binding, vnode, null, "created");
  10955. },
  10956. mounted(el, binding, vnode) {
  10957. callModelHook(el, binding, vnode, null, "mounted");
  10958. },
  10959. beforeUpdate(el, binding, vnode, prevVNode) {
  10960. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10961. },
  10962. updated(el, binding, vnode, prevVNode) {
  10963. callModelHook(el, binding, vnode, prevVNode, "updated");
  10964. }
  10965. };
  10966. function resolveDynamicModel(tagName, type) {
  10967. switch (tagName) {
  10968. case "SELECT":
  10969. return vModelSelect;
  10970. case "TEXTAREA":
  10971. return vModelText;
  10972. default:
  10973. switch (type) {
  10974. case "checkbox":
  10975. return vModelCheckbox;
  10976. case "radio":
  10977. return vModelRadio;
  10978. default:
  10979. return vModelText;
  10980. }
  10981. }
  10982. }
  10983. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10984. const modelToUse = resolveDynamicModel(
  10985. el.tagName,
  10986. vnode.props && vnode.props.type
  10987. );
  10988. const fn = modelToUse[hook];
  10989. fn && fn(el, binding, vnode, prevVNode);
  10990. }
  10991. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10992. const modifierGuards = {
  10993. stop: (e) => e.stopPropagation(),
  10994. prevent: (e) => e.preventDefault(),
  10995. self: (e) => e.target !== e.currentTarget,
  10996. ctrl: (e) => !e.ctrlKey,
  10997. shift: (e) => !e.shiftKey,
  10998. alt: (e) => !e.altKey,
  10999. meta: (e) => !e.metaKey,
  11000. left: (e) => "button" in e && e.button !== 0,
  11001. middle: (e) => "button" in e && e.button !== 1,
  11002. right: (e) => "button" in e && e.button !== 2,
  11003. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  11004. };
  11005. const withModifiers = (fn, modifiers) => {
  11006. const cache = fn._withMods || (fn._withMods = {});
  11007. const cacheKey = modifiers.join(".");
  11008. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  11009. for (let i = 0; i < modifiers.length; i++) {
  11010. const guard = modifierGuards[modifiers[i]];
  11011. if (guard && guard(event, modifiers)) return;
  11012. }
  11013. return fn(event, ...args);
  11014. });
  11015. };
  11016. const keyNames = {
  11017. esc: "escape",
  11018. space: " ",
  11019. up: "arrow-up",
  11020. left: "arrow-left",
  11021. right: "arrow-right",
  11022. down: "arrow-down",
  11023. delete: "backspace"
  11024. };
  11025. const withKeys = (fn, modifiers) => {
  11026. const cache = fn._withKeys || (fn._withKeys = {});
  11027. const cacheKey = modifiers.join(".");
  11028. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  11029. if (!("key" in event)) {
  11030. return;
  11031. }
  11032. const eventKey = hyphenate(event.key);
  11033. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  11034. return fn(event);
  11035. }
  11036. });
  11037. };
  11038. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  11039. let renderer;
  11040. let enabledHydration = false;
  11041. function ensureRenderer() {
  11042. return renderer || (renderer = createRenderer(rendererOptions));
  11043. }
  11044. function ensureHydrationRenderer() {
  11045. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  11046. enabledHydration = true;
  11047. return renderer;
  11048. }
  11049. const render = (...args) => {
  11050. ensureRenderer().render(...args);
  11051. };
  11052. const hydrate = (...args) => {
  11053. ensureHydrationRenderer().hydrate(...args);
  11054. };
  11055. const createApp = (...args) => {
  11056. const app = ensureRenderer().createApp(...args);
  11057. {
  11058. injectNativeTagCheck(app);
  11059. injectCompilerOptionsCheck(app);
  11060. }
  11061. const { mount } = app;
  11062. app.mount = (containerOrSelector) => {
  11063. const container = normalizeContainer(containerOrSelector);
  11064. if (!container) return;
  11065. const component = app._component;
  11066. if (!isFunction(component) && !component.render && !component.template) {
  11067. component.template = container.innerHTML;
  11068. }
  11069. container.innerHTML = "";
  11070. const proxy = mount(container, false, resolveRootNamespace(container));
  11071. if (container instanceof Element) {
  11072. container.removeAttribute("v-cloak");
  11073. container.setAttribute("data-v-app", "");
  11074. }
  11075. return proxy;
  11076. };
  11077. return app;
  11078. };
  11079. const createSSRApp = (...args) => {
  11080. const app = ensureHydrationRenderer().createApp(...args);
  11081. {
  11082. injectNativeTagCheck(app);
  11083. injectCompilerOptionsCheck(app);
  11084. }
  11085. const { mount } = app;
  11086. app.mount = (containerOrSelector) => {
  11087. const container = normalizeContainer(containerOrSelector);
  11088. if (container) {
  11089. return mount(container, true, resolveRootNamespace(container));
  11090. }
  11091. };
  11092. return app;
  11093. };
  11094. function resolveRootNamespace(container) {
  11095. if (container instanceof SVGElement) {
  11096. return "svg";
  11097. }
  11098. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  11099. return "mathml";
  11100. }
  11101. }
  11102. function injectNativeTagCheck(app) {
  11103. Object.defineProperty(app.config, "isNativeTag", {
  11104. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  11105. writable: false
  11106. });
  11107. }
  11108. function injectCompilerOptionsCheck(app) {
  11109. if (isRuntimeOnly()) {
  11110. const isCustomElement = app.config.isCustomElement;
  11111. Object.defineProperty(app.config, "isCustomElement", {
  11112. get() {
  11113. return isCustomElement;
  11114. },
  11115. set() {
  11116. warn(
  11117. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  11118. );
  11119. }
  11120. });
  11121. const compilerOptions = app.config.compilerOptions;
  11122. 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.
  11123. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  11124. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  11125. - 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`;
  11126. Object.defineProperty(app.config, "compilerOptions", {
  11127. get() {
  11128. warn(msg);
  11129. return compilerOptions;
  11130. },
  11131. set() {
  11132. warn(msg);
  11133. }
  11134. });
  11135. }
  11136. }
  11137. function normalizeContainer(container) {
  11138. if (isString(container)) {
  11139. const res = document.querySelector(container);
  11140. if (!res) {
  11141. warn(
  11142. `Failed to mount app: mount target selector "${container}" returned null.`
  11143. );
  11144. }
  11145. return res;
  11146. }
  11147. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  11148. warn(
  11149. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  11150. );
  11151. }
  11152. return container;
  11153. }
  11154. const initDirectivesForSSR = NOOP;
  11155. function initDev() {
  11156. {
  11157. {
  11158. console.info(
  11159. `You are running a development build of Vue.
  11160. Make sure to use the production build (*.prod.js) when deploying for production.`
  11161. );
  11162. }
  11163. initCustomFormatter();
  11164. }
  11165. }
  11166. const FRAGMENT = Symbol(`Fragment` );
  11167. const TELEPORT = Symbol(`Teleport` );
  11168. const SUSPENSE = Symbol(`Suspense` );
  11169. const KEEP_ALIVE = Symbol(`KeepAlive` );
  11170. const BASE_TRANSITION = Symbol(`BaseTransition` );
  11171. const OPEN_BLOCK = Symbol(`openBlock` );
  11172. const CREATE_BLOCK = Symbol(`createBlock` );
  11173. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
  11174. const CREATE_VNODE = Symbol(`createVNode` );
  11175. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
  11176. const CREATE_COMMENT = Symbol(`createCommentVNode` );
  11177. const CREATE_TEXT = Symbol(`createTextVNode` );
  11178. const CREATE_STATIC = Symbol(`createStaticVNode` );
  11179. const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
  11180. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  11181. `resolveDynamicComponent`
  11182. );
  11183. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
  11184. const RESOLVE_FILTER = Symbol(`resolveFilter` );
  11185. const WITH_DIRECTIVES = Symbol(`withDirectives` );
  11186. const RENDER_LIST = Symbol(`renderList` );
  11187. const RENDER_SLOT = Symbol(`renderSlot` );
  11188. const CREATE_SLOTS = Symbol(`createSlots` );
  11189. const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
  11190. const MERGE_PROPS = Symbol(`mergeProps` );
  11191. const NORMALIZE_CLASS = Symbol(`normalizeClass` );
  11192. const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
  11193. const NORMALIZE_PROPS = Symbol(`normalizeProps` );
  11194. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
  11195. const TO_HANDLERS = Symbol(`toHandlers` );
  11196. const CAMELIZE = Symbol(`camelize` );
  11197. const CAPITALIZE = Symbol(`capitalize` );
  11198. const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
  11199. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
  11200. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  11201. const POP_SCOPE_ID = Symbol(`popScopeId` );
  11202. const WITH_CTX = Symbol(`withCtx` );
  11203. const UNREF = Symbol(`unref` );
  11204. const IS_REF = Symbol(`isRef` );
  11205. const WITH_MEMO = Symbol(`withMemo` );
  11206. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  11207. const helperNameMap = {
  11208. [FRAGMENT]: `Fragment`,
  11209. [TELEPORT]: `Teleport`,
  11210. [SUSPENSE]: `Suspense`,
  11211. [KEEP_ALIVE]: `KeepAlive`,
  11212. [BASE_TRANSITION]: `BaseTransition`,
  11213. [OPEN_BLOCK]: `openBlock`,
  11214. [CREATE_BLOCK]: `createBlock`,
  11215. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  11216. [CREATE_VNODE]: `createVNode`,
  11217. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  11218. [CREATE_COMMENT]: `createCommentVNode`,
  11219. [CREATE_TEXT]: `createTextVNode`,
  11220. [CREATE_STATIC]: `createStaticVNode`,
  11221. [RESOLVE_COMPONENT]: `resolveComponent`,
  11222. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  11223. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  11224. [RESOLVE_FILTER]: `resolveFilter`,
  11225. [WITH_DIRECTIVES]: `withDirectives`,
  11226. [RENDER_LIST]: `renderList`,
  11227. [RENDER_SLOT]: `renderSlot`,
  11228. [CREATE_SLOTS]: `createSlots`,
  11229. [TO_DISPLAY_STRING]: `toDisplayString`,
  11230. [MERGE_PROPS]: `mergeProps`,
  11231. [NORMALIZE_CLASS]: `normalizeClass`,
  11232. [NORMALIZE_STYLE]: `normalizeStyle`,
  11233. [NORMALIZE_PROPS]: `normalizeProps`,
  11234. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  11235. [TO_HANDLERS]: `toHandlers`,
  11236. [CAMELIZE]: `camelize`,
  11237. [CAPITALIZE]: `capitalize`,
  11238. [TO_HANDLER_KEY]: `toHandlerKey`,
  11239. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  11240. [PUSH_SCOPE_ID]: `pushScopeId`,
  11241. [POP_SCOPE_ID]: `popScopeId`,
  11242. [WITH_CTX]: `withCtx`,
  11243. [UNREF]: `unref`,
  11244. [IS_REF]: `isRef`,
  11245. [WITH_MEMO]: `withMemo`,
  11246. [IS_MEMO_SAME]: `isMemoSame`
  11247. };
  11248. function registerRuntimeHelpers(helpers) {
  11249. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  11250. helperNameMap[s] = helpers[s];
  11251. });
  11252. }
  11253. const locStub = {
  11254. start: { line: 1, column: 1, offset: 0 },
  11255. end: { line: 1, column: 1, offset: 0 },
  11256. source: ""
  11257. };
  11258. function createRoot(children, source = "") {
  11259. return {
  11260. type: 0,
  11261. source,
  11262. children,
  11263. helpers: /* @__PURE__ */ new Set(),
  11264. components: [],
  11265. directives: [],
  11266. hoists: [],
  11267. imports: [],
  11268. cached: 0,
  11269. temps: 0,
  11270. codegenNode: void 0,
  11271. loc: locStub
  11272. };
  11273. }
  11274. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  11275. if (context) {
  11276. if (isBlock) {
  11277. context.helper(OPEN_BLOCK);
  11278. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  11279. } else {
  11280. context.helper(getVNodeHelper(context.inSSR, isComponent));
  11281. }
  11282. if (directives) {
  11283. context.helper(WITH_DIRECTIVES);
  11284. }
  11285. }
  11286. return {
  11287. type: 13,
  11288. tag,
  11289. props,
  11290. children,
  11291. patchFlag,
  11292. dynamicProps,
  11293. directives,
  11294. isBlock,
  11295. disableTracking,
  11296. isComponent,
  11297. loc
  11298. };
  11299. }
  11300. function createArrayExpression(elements, loc = locStub) {
  11301. return {
  11302. type: 17,
  11303. loc,
  11304. elements
  11305. };
  11306. }
  11307. function createObjectExpression(properties, loc = locStub) {
  11308. return {
  11309. type: 15,
  11310. loc,
  11311. properties
  11312. };
  11313. }
  11314. function createObjectProperty(key, value) {
  11315. return {
  11316. type: 16,
  11317. loc: locStub,
  11318. key: isString(key) ? createSimpleExpression(key, true) : key,
  11319. value
  11320. };
  11321. }
  11322. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  11323. return {
  11324. type: 4,
  11325. loc,
  11326. content,
  11327. isStatic,
  11328. constType: isStatic ? 3 : constType
  11329. };
  11330. }
  11331. function createCompoundExpression(children, loc = locStub) {
  11332. return {
  11333. type: 8,
  11334. loc,
  11335. children
  11336. };
  11337. }
  11338. function createCallExpression(callee, args = [], loc = locStub) {
  11339. return {
  11340. type: 14,
  11341. loc,
  11342. callee,
  11343. arguments: args
  11344. };
  11345. }
  11346. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  11347. return {
  11348. type: 18,
  11349. params,
  11350. returns,
  11351. newline,
  11352. isSlot,
  11353. loc
  11354. };
  11355. }
  11356. function createConditionalExpression(test, consequent, alternate, newline = true) {
  11357. return {
  11358. type: 19,
  11359. test,
  11360. consequent,
  11361. alternate,
  11362. newline,
  11363. loc: locStub
  11364. };
  11365. }
  11366. function createCacheExpression(index, value, isVOnce = false) {
  11367. return {
  11368. type: 20,
  11369. index,
  11370. value,
  11371. isVOnce,
  11372. loc: locStub
  11373. };
  11374. }
  11375. function createBlockStatement(body) {
  11376. return {
  11377. type: 21,
  11378. body,
  11379. loc: locStub
  11380. };
  11381. }
  11382. function getVNodeHelper(ssr, isComponent) {
  11383. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  11384. }
  11385. function getVNodeBlockHelper(ssr, isComponent) {
  11386. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  11387. }
  11388. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  11389. if (!node.isBlock) {
  11390. node.isBlock = true;
  11391. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  11392. helper(OPEN_BLOCK);
  11393. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  11394. }
  11395. }
  11396. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  11397. const defaultDelimitersClose = new Uint8Array([125, 125]);
  11398. function isTagStartChar(c) {
  11399. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  11400. }
  11401. function isWhitespace(c) {
  11402. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  11403. }
  11404. function isEndOfTagSection(c) {
  11405. return c === 47 || c === 62 || isWhitespace(c);
  11406. }
  11407. function toCharCodes(str) {
  11408. const ret = new Uint8Array(str.length);
  11409. for (let i = 0; i < str.length; i++) {
  11410. ret[i] = str.charCodeAt(i);
  11411. }
  11412. return ret;
  11413. }
  11414. const Sequences = {
  11415. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  11416. // CDATA[
  11417. CdataEnd: new Uint8Array([93, 93, 62]),
  11418. // ]]>
  11419. CommentEnd: new Uint8Array([45, 45, 62]),
  11420. // `-->`
  11421. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  11422. // `<\/script`
  11423. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  11424. // `</style`
  11425. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  11426. // `</title`
  11427. TextareaEnd: new Uint8Array([
  11428. 60,
  11429. 47,
  11430. 116,
  11431. 101,
  11432. 120,
  11433. 116,
  11434. 97,
  11435. 114,
  11436. 101,
  11437. 97
  11438. ])
  11439. // `</textarea
  11440. };
  11441. class Tokenizer {
  11442. constructor(stack, cbs) {
  11443. this.stack = stack;
  11444. this.cbs = cbs;
  11445. /** The current state the tokenizer is in. */
  11446. this.state = 1;
  11447. /** The read buffer. */
  11448. this.buffer = "";
  11449. /** The beginning of the section that is currently being read. */
  11450. this.sectionStart = 0;
  11451. /** The index within the buffer that we are currently looking at. */
  11452. this.index = 0;
  11453. /** The start of the last entity. */
  11454. this.entityStart = 0;
  11455. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  11456. this.baseState = 1;
  11457. /** For special parsing behavior inside of script and style tags. */
  11458. this.inRCDATA = false;
  11459. /** For disabling RCDATA tags handling */
  11460. this.inXML = false;
  11461. /** For disabling interpolation parsing in v-pre */
  11462. this.inVPre = false;
  11463. /** Record newline positions for fast line / column calculation */
  11464. this.newlines = [];
  11465. this.mode = 0;
  11466. this.delimiterOpen = defaultDelimitersOpen;
  11467. this.delimiterClose = defaultDelimitersClose;
  11468. this.delimiterIndex = -1;
  11469. this.currentSequence = void 0;
  11470. this.sequenceIndex = 0;
  11471. }
  11472. get inSFCRoot() {
  11473. return this.mode === 2 && this.stack.length === 0;
  11474. }
  11475. reset() {
  11476. this.state = 1;
  11477. this.mode = 0;
  11478. this.buffer = "";
  11479. this.sectionStart = 0;
  11480. this.index = 0;
  11481. this.baseState = 1;
  11482. this.inRCDATA = false;
  11483. this.currentSequence = void 0;
  11484. this.newlines.length = 0;
  11485. this.delimiterOpen = defaultDelimitersOpen;
  11486. this.delimiterClose = defaultDelimitersClose;
  11487. }
  11488. /**
  11489. * Generate Position object with line / column information using recorded
  11490. * newline positions. We know the index is always going to be an already
  11491. * processed index, so all the newlines up to this index should have been
  11492. * recorded.
  11493. */
  11494. getPos(index) {
  11495. let line = 1;
  11496. let column = index + 1;
  11497. for (let i = this.newlines.length - 1; i >= 0; i--) {
  11498. const newlineIndex = this.newlines[i];
  11499. if (index > newlineIndex) {
  11500. line = i + 2;
  11501. column = index - newlineIndex;
  11502. break;
  11503. }
  11504. }
  11505. return {
  11506. column,
  11507. line,
  11508. offset: index
  11509. };
  11510. }
  11511. peek() {
  11512. return this.buffer.charCodeAt(this.index + 1);
  11513. }
  11514. stateText(c) {
  11515. if (c === 60) {
  11516. if (this.index > this.sectionStart) {
  11517. this.cbs.ontext(this.sectionStart, this.index);
  11518. }
  11519. this.state = 5;
  11520. this.sectionStart = this.index;
  11521. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  11522. this.state = 2;
  11523. this.delimiterIndex = 0;
  11524. this.stateInterpolationOpen(c);
  11525. }
  11526. }
  11527. stateInterpolationOpen(c) {
  11528. if (c === this.delimiterOpen[this.delimiterIndex]) {
  11529. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  11530. const start = this.index + 1 - this.delimiterOpen.length;
  11531. if (start > this.sectionStart) {
  11532. this.cbs.ontext(this.sectionStart, start);
  11533. }
  11534. this.state = 3;
  11535. this.sectionStart = start;
  11536. } else {
  11537. this.delimiterIndex++;
  11538. }
  11539. } else if (this.inRCDATA) {
  11540. this.state = 32;
  11541. this.stateInRCDATA(c);
  11542. } else {
  11543. this.state = 1;
  11544. this.stateText(c);
  11545. }
  11546. }
  11547. stateInterpolation(c) {
  11548. if (c === this.delimiterClose[0]) {
  11549. this.state = 4;
  11550. this.delimiterIndex = 0;
  11551. this.stateInterpolationClose(c);
  11552. }
  11553. }
  11554. stateInterpolationClose(c) {
  11555. if (c === this.delimiterClose[this.delimiterIndex]) {
  11556. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  11557. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  11558. if (this.inRCDATA) {
  11559. this.state = 32;
  11560. } else {
  11561. this.state = 1;
  11562. }
  11563. this.sectionStart = this.index + 1;
  11564. } else {
  11565. this.delimiterIndex++;
  11566. }
  11567. } else {
  11568. this.state = 3;
  11569. this.stateInterpolation(c);
  11570. }
  11571. }
  11572. stateSpecialStartSequence(c) {
  11573. const isEnd = this.sequenceIndex === this.currentSequence.length;
  11574. const isMatch = isEnd ? (
  11575. // If we are at the end of the sequence, make sure the tag name has ended
  11576. isEndOfTagSection(c)
  11577. ) : (
  11578. // Otherwise, do a case-insensitive comparison
  11579. (c | 32) === this.currentSequence[this.sequenceIndex]
  11580. );
  11581. if (!isMatch) {
  11582. this.inRCDATA = false;
  11583. } else if (!isEnd) {
  11584. this.sequenceIndex++;
  11585. return;
  11586. }
  11587. this.sequenceIndex = 0;
  11588. this.state = 6;
  11589. this.stateInTagName(c);
  11590. }
  11591. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  11592. stateInRCDATA(c) {
  11593. if (this.sequenceIndex === this.currentSequence.length) {
  11594. if (c === 62 || isWhitespace(c)) {
  11595. const endOfText = this.index - this.currentSequence.length;
  11596. if (this.sectionStart < endOfText) {
  11597. const actualIndex = this.index;
  11598. this.index = endOfText;
  11599. this.cbs.ontext(this.sectionStart, endOfText);
  11600. this.index = actualIndex;
  11601. }
  11602. this.sectionStart = endOfText + 2;
  11603. this.stateInClosingTagName(c);
  11604. this.inRCDATA = false;
  11605. return;
  11606. }
  11607. this.sequenceIndex = 0;
  11608. }
  11609. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  11610. this.sequenceIndex += 1;
  11611. } else if (this.sequenceIndex === 0) {
  11612. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  11613. if (c === this.delimiterOpen[0]) {
  11614. this.state = 2;
  11615. this.delimiterIndex = 0;
  11616. this.stateInterpolationOpen(c);
  11617. }
  11618. } else if (this.fastForwardTo(60)) {
  11619. this.sequenceIndex = 1;
  11620. }
  11621. } else {
  11622. this.sequenceIndex = Number(c === 60);
  11623. }
  11624. }
  11625. stateCDATASequence(c) {
  11626. if (c === Sequences.Cdata[this.sequenceIndex]) {
  11627. if (++this.sequenceIndex === Sequences.Cdata.length) {
  11628. this.state = 28;
  11629. this.currentSequence = Sequences.CdataEnd;
  11630. this.sequenceIndex = 0;
  11631. this.sectionStart = this.index + 1;
  11632. }
  11633. } else {
  11634. this.sequenceIndex = 0;
  11635. this.state = 23;
  11636. this.stateInDeclaration(c);
  11637. }
  11638. }
  11639. /**
  11640. * When we wait for one specific character, we can speed things up
  11641. * by skipping through the buffer until we find it.
  11642. *
  11643. * @returns Whether the character was found.
  11644. */
  11645. fastForwardTo(c) {
  11646. while (++this.index < this.buffer.length) {
  11647. const cc = this.buffer.charCodeAt(this.index);
  11648. if (cc === 10) {
  11649. this.newlines.push(this.index);
  11650. }
  11651. if (cc === c) {
  11652. return true;
  11653. }
  11654. }
  11655. this.index = this.buffer.length - 1;
  11656. return false;
  11657. }
  11658. /**
  11659. * Comments and CDATA end with `-->` and `]]>`.
  11660. *
  11661. * Their common qualities are:
  11662. * - Their end sequences have a distinct character they start with.
  11663. * - That character is then repeated, so we have to check multiple repeats.
  11664. * - All characters but the start character of the sequence can be skipped.
  11665. */
  11666. stateInCommentLike(c) {
  11667. if (c === this.currentSequence[this.sequenceIndex]) {
  11668. if (++this.sequenceIndex === this.currentSequence.length) {
  11669. if (this.currentSequence === Sequences.CdataEnd) {
  11670. this.cbs.oncdata(this.sectionStart, this.index - 2);
  11671. } else {
  11672. this.cbs.oncomment(this.sectionStart, this.index - 2);
  11673. }
  11674. this.sequenceIndex = 0;
  11675. this.sectionStart = this.index + 1;
  11676. this.state = 1;
  11677. }
  11678. } else if (this.sequenceIndex === 0) {
  11679. if (this.fastForwardTo(this.currentSequence[0])) {
  11680. this.sequenceIndex = 1;
  11681. }
  11682. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  11683. this.sequenceIndex = 0;
  11684. }
  11685. }
  11686. startSpecial(sequence, offset) {
  11687. this.enterRCDATA(sequence, offset);
  11688. this.state = 31;
  11689. }
  11690. enterRCDATA(sequence, offset) {
  11691. this.inRCDATA = true;
  11692. this.currentSequence = sequence;
  11693. this.sequenceIndex = offset;
  11694. }
  11695. stateBeforeTagName(c) {
  11696. if (c === 33) {
  11697. this.state = 22;
  11698. this.sectionStart = this.index + 1;
  11699. } else if (c === 63) {
  11700. this.state = 24;
  11701. this.sectionStart = this.index + 1;
  11702. } else if (isTagStartChar(c)) {
  11703. this.sectionStart = this.index;
  11704. if (this.mode === 0) {
  11705. this.state = 6;
  11706. } else if (this.inSFCRoot) {
  11707. this.state = 34;
  11708. } else if (!this.inXML) {
  11709. if (c === 116) {
  11710. this.state = 30;
  11711. } else {
  11712. this.state = c === 115 ? 29 : 6;
  11713. }
  11714. } else {
  11715. this.state = 6;
  11716. }
  11717. } else if (c === 47) {
  11718. this.state = 8;
  11719. } else {
  11720. this.state = 1;
  11721. this.stateText(c);
  11722. }
  11723. }
  11724. stateInTagName(c) {
  11725. if (isEndOfTagSection(c)) {
  11726. this.handleTagName(c);
  11727. }
  11728. }
  11729. stateInSFCRootTagName(c) {
  11730. if (isEndOfTagSection(c)) {
  11731. const tag = this.buffer.slice(this.sectionStart, this.index);
  11732. if (tag !== "template") {
  11733. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  11734. }
  11735. this.handleTagName(c);
  11736. }
  11737. }
  11738. handleTagName(c) {
  11739. this.cbs.onopentagname(this.sectionStart, this.index);
  11740. this.sectionStart = -1;
  11741. this.state = 11;
  11742. this.stateBeforeAttrName(c);
  11743. }
  11744. stateBeforeClosingTagName(c) {
  11745. if (isWhitespace(c)) ; else if (c === 62) {
  11746. {
  11747. this.cbs.onerr(14, this.index);
  11748. }
  11749. this.state = 1;
  11750. this.sectionStart = this.index + 1;
  11751. } else {
  11752. this.state = isTagStartChar(c) ? 9 : 27;
  11753. this.sectionStart = this.index;
  11754. }
  11755. }
  11756. stateInClosingTagName(c) {
  11757. if (c === 62 || isWhitespace(c)) {
  11758. this.cbs.onclosetag(this.sectionStart, this.index);
  11759. this.sectionStart = -1;
  11760. this.state = 10;
  11761. this.stateAfterClosingTagName(c);
  11762. }
  11763. }
  11764. stateAfterClosingTagName(c) {
  11765. if (c === 62) {
  11766. this.state = 1;
  11767. this.sectionStart = this.index + 1;
  11768. }
  11769. }
  11770. stateBeforeAttrName(c) {
  11771. if (c === 62) {
  11772. this.cbs.onopentagend(this.index);
  11773. if (this.inRCDATA) {
  11774. this.state = 32;
  11775. } else {
  11776. this.state = 1;
  11777. }
  11778. this.sectionStart = this.index + 1;
  11779. } else if (c === 47) {
  11780. this.state = 7;
  11781. if (this.peek() !== 62) {
  11782. this.cbs.onerr(22, this.index);
  11783. }
  11784. } else if (c === 60 && this.peek() === 47) {
  11785. this.cbs.onopentagend(this.index);
  11786. this.state = 5;
  11787. this.sectionStart = this.index;
  11788. } else if (!isWhitespace(c)) {
  11789. if (c === 61) {
  11790. this.cbs.onerr(
  11791. 19,
  11792. this.index
  11793. );
  11794. }
  11795. this.handleAttrStart(c);
  11796. }
  11797. }
  11798. handleAttrStart(c) {
  11799. if (c === 118 && this.peek() === 45) {
  11800. this.state = 13;
  11801. this.sectionStart = this.index;
  11802. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  11803. this.cbs.ondirname(this.index, this.index + 1);
  11804. this.state = 14;
  11805. this.sectionStart = this.index + 1;
  11806. } else {
  11807. this.state = 12;
  11808. this.sectionStart = this.index;
  11809. }
  11810. }
  11811. stateInSelfClosingTag(c) {
  11812. if (c === 62) {
  11813. this.cbs.onselfclosingtag(this.index);
  11814. this.state = 1;
  11815. this.sectionStart = this.index + 1;
  11816. this.inRCDATA = false;
  11817. } else if (!isWhitespace(c)) {
  11818. this.state = 11;
  11819. this.stateBeforeAttrName(c);
  11820. }
  11821. }
  11822. stateInAttrName(c) {
  11823. if (c === 61 || isEndOfTagSection(c)) {
  11824. this.cbs.onattribname(this.sectionStart, this.index);
  11825. this.handleAttrNameEnd(c);
  11826. } else if (c === 34 || c === 39 || c === 60) {
  11827. this.cbs.onerr(
  11828. 17,
  11829. this.index
  11830. );
  11831. }
  11832. }
  11833. stateInDirName(c) {
  11834. if (c === 61 || isEndOfTagSection(c)) {
  11835. this.cbs.ondirname(this.sectionStart, this.index);
  11836. this.handleAttrNameEnd(c);
  11837. } else if (c === 58) {
  11838. this.cbs.ondirname(this.sectionStart, this.index);
  11839. this.state = 14;
  11840. this.sectionStart = this.index + 1;
  11841. } else if (c === 46) {
  11842. this.cbs.ondirname(this.sectionStart, this.index);
  11843. this.state = 16;
  11844. this.sectionStart = this.index + 1;
  11845. }
  11846. }
  11847. stateInDirArg(c) {
  11848. if (c === 61 || isEndOfTagSection(c)) {
  11849. this.cbs.ondirarg(this.sectionStart, this.index);
  11850. this.handleAttrNameEnd(c);
  11851. } else if (c === 91) {
  11852. this.state = 15;
  11853. } else if (c === 46) {
  11854. this.cbs.ondirarg(this.sectionStart, this.index);
  11855. this.state = 16;
  11856. this.sectionStart = this.index + 1;
  11857. }
  11858. }
  11859. stateInDynamicDirArg(c) {
  11860. if (c === 93) {
  11861. this.state = 14;
  11862. } else if (c === 61 || isEndOfTagSection(c)) {
  11863. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  11864. this.handleAttrNameEnd(c);
  11865. {
  11866. this.cbs.onerr(
  11867. 27,
  11868. this.index
  11869. );
  11870. }
  11871. }
  11872. }
  11873. stateInDirModifier(c) {
  11874. if (c === 61 || isEndOfTagSection(c)) {
  11875. this.cbs.ondirmodifier(this.sectionStart, this.index);
  11876. this.handleAttrNameEnd(c);
  11877. } else if (c === 46) {
  11878. this.cbs.ondirmodifier(this.sectionStart, this.index);
  11879. this.sectionStart = this.index + 1;
  11880. }
  11881. }
  11882. handleAttrNameEnd(c) {
  11883. this.sectionStart = this.index;
  11884. this.state = 17;
  11885. this.cbs.onattribnameend(this.index);
  11886. this.stateAfterAttrName(c);
  11887. }
  11888. stateAfterAttrName(c) {
  11889. if (c === 61) {
  11890. this.state = 18;
  11891. } else if (c === 47 || c === 62) {
  11892. this.cbs.onattribend(0, this.sectionStart);
  11893. this.sectionStart = -1;
  11894. this.state = 11;
  11895. this.stateBeforeAttrName(c);
  11896. } else if (!isWhitespace(c)) {
  11897. this.cbs.onattribend(0, this.sectionStart);
  11898. this.handleAttrStart(c);
  11899. }
  11900. }
  11901. stateBeforeAttrValue(c) {
  11902. if (c === 34) {
  11903. this.state = 19;
  11904. this.sectionStart = this.index + 1;
  11905. } else if (c === 39) {
  11906. this.state = 20;
  11907. this.sectionStart = this.index + 1;
  11908. } else if (!isWhitespace(c)) {
  11909. this.sectionStart = this.index;
  11910. this.state = 21;
  11911. this.stateInAttrValueNoQuotes(c);
  11912. }
  11913. }
  11914. handleInAttrValue(c, quote) {
  11915. if (c === quote || this.fastForwardTo(quote)) {
  11916. this.cbs.onattribdata(this.sectionStart, this.index);
  11917. this.sectionStart = -1;
  11918. this.cbs.onattribend(
  11919. quote === 34 ? 3 : 2,
  11920. this.index + 1
  11921. );
  11922. this.state = 11;
  11923. }
  11924. }
  11925. stateInAttrValueDoubleQuotes(c) {
  11926. this.handleInAttrValue(c, 34);
  11927. }
  11928. stateInAttrValueSingleQuotes(c) {
  11929. this.handleInAttrValue(c, 39);
  11930. }
  11931. stateInAttrValueNoQuotes(c) {
  11932. if (isWhitespace(c) || c === 62) {
  11933. this.cbs.onattribdata(this.sectionStart, this.index);
  11934. this.sectionStart = -1;
  11935. this.cbs.onattribend(1, this.index);
  11936. this.state = 11;
  11937. this.stateBeforeAttrName(c);
  11938. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  11939. this.cbs.onerr(
  11940. 18,
  11941. this.index
  11942. );
  11943. } else ;
  11944. }
  11945. stateBeforeDeclaration(c) {
  11946. if (c === 91) {
  11947. this.state = 26;
  11948. this.sequenceIndex = 0;
  11949. } else {
  11950. this.state = c === 45 ? 25 : 23;
  11951. }
  11952. }
  11953. stateInDeclaration(c) {
  11954. if (c === 62 || this.fastForwardTo(62)) {
  11955. this.state = 1;
  11956. this.sectionStart = this.index + 1;
  11957. }
  11958. }
  11959. stateInProcessingInstruction(c) {
  11960. if (c === 62 || this.fastForwardTo(62)) {
  11961. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  11962. this.state = 1;
  11963. this.sectionStart = this.index + 1;
  11964. }
  11965. }
  11966. stateBeforeComment(c) {
  11967. if (c === 45) {
  11968. this.state = 28;
  11969. this.currentSequence = Sequences.CommentEnd;
  11970. this.sequenceIndex = 2;
  11971. this.sectionStart = this.index + 1;
  11972. } else {
  11973. this.state = 23;
  11974. }
  11975. }
  11976. stateInSpecialComment(c) {
  11977. if (c === 62 || this.fastForwardTo(62)) {
  11978. this.cbs.oncomment(this.sectionStart, this.index);
  11979. this.state = 1;
  11980. this.sectionStart = this.index + 1;
  11981. }
  11982. }
  11983. stateBeforeSpecialS(c) {
  11984. if (c === Sequences.ScriptEnd[3]) {
  11985. this.startSpecial(Sequences.ScriptEnd, 4);
  11986. } else if (c === Sequences.StyleEnd[3]) {
  11987. this.startSpecial(Sequences.StyleEnd, 4);
  11988. } else {
  11989. this.state = 6;
  11990. this.stateInTagName(c);
  11991. }
  11992. }
  11993. stateBeforeSpecialT(c) {
  11994. if (c === Sequences.TitleEnd[3]) {
  11995. this.startSpecial(Sequences.TitleEnd, 4);
  11996. } else if (c === Sequences.TextareaEnd[3]) {
  11997. this.startSpecial(Sequences.TextareaEnd, 4);
  11998. } else {
  11999. this.state = 6;
  12000. this.stateInTagName(c);
  12001. }
  12002. }
  12003. startEntity() {
  12004. }
  12005. stateInEntity() {
  12006. }
  12007. /**
  12008. * Iterates through the buffer, calling the function corresponding to the current state.
  12009. *
  12010. * States that are more likely to be hit are higher up, as a performance improvement.
  12011. */
  12012. parse(input) {
  12013. this.buffer = input;
  12014. while (this.index < this.buffer.length) {
  12015. const c = this.buffer.charCodeAt(this.index);
  12016. if (c === 10) {
  12017. this.newlines.push(this.index);
  12018. }
  12019. switch (this.state) {
  12020. case 1: {
  12021. this.stateText(c);
  12022. break;
  12023. }
  12024. case 2: {
  12025. this.stateInterpolationOpen(c);
  12026. break;
  12027. }
  12028. case 3: {
  12029. this.stateInterpolation(c);
  12030. break;
  12031. }
  12032. case 4: {
  12033. this.stateInterpolationClose(c);
  12034. break;
  12035. }
  12036. case 31: {
  12037. this.stateSpecialStartSequence(c);
  12038. break;
  12039. }
  12040. case 32: {
  12041. this.stateInRCDATA(c);
  12042. break;
  12043. }
  12044. case 26: {
  12045. this.stateCDATASequence(c);
  12046. break;
  12047. }
  12048. case 19: {
  12049. this.stateInAttrValueDoubleQuotes(c);
  12050. break;
  12051. }
  12052. case 12: {
  12053. this.stateInAttrName(c);
  12054. break;
  12055. }
  12056. case 13: {
  12057. this.stateInDirName(c);
  12058. break;
  12059. }
  12060. case 14: {
  12061. this.stateInDirArg(c);
  12062. break;
  12063. }
  12064. case 15: {
  12065. this.stateInDynamicDirArg(c);
  12066. break;
  12067. }
  12068. case 16: {
  12069. this.stateInDirModifier(c);
  12070. break;
  12071. }
  12072. case 28: {
  12073. this.stateInCommentLike(c);
  12074. break;
  12075. }
  12076. case 27: {
  12077. this.stateInSpecialComment(c);
  12078. break;
  12079. }
  12080. case 11: {
  12081. this.stateBeforeAttrName(c);
  12082. break;
  12083. }
  12084. case 6: {
  12085. this.stateInTagName(c);
  12086. break;
  12087. }
  12088. case 34: {
  12089. this.stateInSFCRootTagName(c);
  12090. break;
  12091. }
  12092. case 9: {
  12093. this.stateInClosingTagName(c);
  12094. break;
  12095. }
  12096. case 5: {
  12097. this.stateBeforeTagName(c);
  12098. break;
  12099. }
  12100. case 17: {
  12101. this.stateAfterAttrName(c);
  12102. break;
  12103. }
  12104. case 20: {
  12105. this.stateInAttrValueSingleQuotes(c);
  12106. break;
  12107. }
  12108. case 18: {
  12109. this.stateBeforeAttrValue(c);
  12110. break;
  12111. }
  12112. case 8: {
  12113. this.stateBeforeClosingTagName(c);
  12114. break;
  12115. }
  12116. case 10: {
  12117. this.stateAfterClosingTagName(c);
  12118. break;
  12119. }
  12120. case 29: {
  12121. this.stateBeforeSpecialS(c);
  12122. break;
  12123. }
  12124. case 30: {
  12125. this.stateBeforeSpecialT(c);
  12126. break;
  12127. }
  12128. case 21: {
  12129. this.stateInAttrValueNoQuotes(c);
  12130. break;
  12131. }
  12132. case 7: {
  12133. this.stateInSelfClosingTag(c);
  12134. break;
  12135. }
  12136. case 23: {
  12137. this.stateInDeclaration(c);
  12138. break;
  12139. }
  12140. case 22: {
  12141. this.stateBeforeDeclaration(c);
  12142. break;
  12143. }
  12144. case 25: {
  12145. this.stateBeforeComment(c);
  12146. break;
  12147. }
  12148. case 24: {
  12149. this.stateInProcessingInstruction(c);
  12150. break;
  12151. }
  12152. case 33: {
  12153. this.stateInEntity();
  12154. break;
  12155. }
  12156. }
  12157. this.index++;
  12158. }
  12159. this.cleanup();
  12160. this.finish();
  12161. }
  12162. /**
  12163. * Remove data that has already been consumed from the buffer.
  12164. */
  12165. cleanup() {
  12166. if (this.sectionStart !== this.index) {
  12167. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  12168. this.cbs.ontext(this.sectionStart, this.index);
  12169. this.sectionStart = this.index;
  12170. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  12171. this.cbs.onattribdata(this.sectionStart, this.index);
  12172. this.sectionStart = this.index;
  12173. }
  12174. }
  12175. }
  12176. finish() {
  12177. this.handleTrailingData();
  12178. this.cbs.onend();
  12179. }
  12180. /** Handle any trailing data. */
  12181. handleTrailingData() {
  12182. const endIndex = this.buffer.length;
  12183. if (this.sectionStart >= endIndex) {
  12184. return;
  12185. }
  12186. if (this.state === 28) {
  12187. if (this.currentSequence === Sequences.CdataEnd) {
  12188. this.cbs.oncdata(this.sectionStart, endIndex);
  12189. } else {
  12190. this.cbs.oncomment(this.sectionStart, endIndex);
  12191. }
  12192. } 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 {
  12193. this.cbs.ontext(this.sectionStart, endIndex);
  12194. }
  12195. }
  12196. emitCodePoint(cp, consumed) {
  12197. }
  12198. }
  12199. function defaultOnError(error) {
  12200. throw error;
  12201. }
  12202. function defaultOnWarn(msg) {
  12203. console.warn(`[Vue warn] ${msg.message}`);
  12204. }
  12205. function createCompilerError(code, loc, messages, additionalMessage) {
  12206. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  12207. const error = new SyntaxError(String(msg));
  12208. error.code = code;
  12209. error.loc = loc;
  12210. return error;
  12211. }
  12212. const errorMessages = {
  12213. // parse errors
  12214. [0]: "Illegal comment.",
  12215. [1]: "CDATA section is allowed only in XML context.",
  12216. [2]: "Duplicate attribute.",
  12217. [3]: "End tag cannot have attributes.",
  12218. [4]: "Illegal '/' in tags.",
  12219. [5]: "Unexpected EOF in tag.",
  12220. [6]: "Unexpected EOF in CDATA section.",
  12221. [7]: "Unexpected EOF in comment.",
  12222. [8]: "Unexpected EOF in script.",
  12223. [9]: "Unexpected EOF in tag.",
  12224. [10]: "Incorrectly closed comment.",
  12225. [11]: "Incorrectly opened comment.",
  12226. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  12227. [13]: "Attribute value was expected.",
  12228. [14]: "End tag name was expected.",
  12229. [15]: "Whitespace was expected.",
  12230. [16]: "Unexpected '<!--' in comment.",
  12231. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  12232. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  12233. [19]: "Attribute name cannot start with '='.",
  12234. [21]: "'<?' is allowed only in XML context.",
  12235. [20]: `Unexpected null character.`,
  12236. [22]: "Illegal '/' in tags.",
  12237. // Vue-specific parse errors
  12238. [23]: "Invalid end tag.",
  12239. [24]: "Element is missing end tag.",
  12240. [25]: "Interpolation end sign was not found.",
  12241. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  12242. [26]: "Legal directive name was expected.",
  12243. // transform errors
  12244. [28]: `v-if/v-else-if is missing expression.`,
  12245. [29]: `v-if/else branches must use unique keys.`,
  12246. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  12247. [31]: `v-for is missing expression.`,
  12248. [32]: `v-for has invalid expression.`,
  12249. [33]: `<template v-for> key should be placed on the <template> tag.`,
  12250. [34]: `v-bind is missing expression.`,
  12251. [52]: `v-bind with same-name shorthand only allows static argument.`,
  12252. [35]: `v-on is missing expression.`,
  12253. [36]: `Unexpected custom directive on <slot> outlet.`,
  12254. [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.`,
  12255. [38]: `Duplicate slot names found. `,
  12256. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  12257. [40]: `v-slot can only be used on components or <template> tags.`,
  12258. [41]: `v-model is missing expression.`,
  12259. [42]: `v-model value must be a valid JavaScript member expression.`,
  12260. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  12261. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  12262. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  12263. [45]: `Error parsing JavaScript expression: `,
  12264. [46]: `<KeepAlive> expects exactly one child component.`,
  12265. [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
  12266. // generic errors
  12267. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  12268. [48]: `ES module mode is not supported in this build of compiler.`,
  12269. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  12270. [50]: `"scopeId" option is only supported in module mode.`,
  12271. // just to fulfill types
  12272. [53]: ``
  12273. };
  12274. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  12275. function isCoreComponent(tag) {
  12276. switch (tag) {
  12277. case "Teleport":
  12278. case "teleport":
  12279. return TELEPORT;
  12280. case "Suspense":
  12281. case "suspense":
  12282. return SUSPENSE;
  12283. case "KeepAlive":
  12284. case "keep-alive":
  12285. return KEEP_ALIVE;
  12286. case "BaseTransition":
  12287. case "base-transition":
  12288. return BASE_TRANSITION;
  12289. }
  12290. }
  12291. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  12292. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  12293. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  12294. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  12295. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  12296. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  12297. const isMemberExpressionBrowser = (exp) => {
  12298. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  12299. let state = 0 /* inMemberExp */;
  12300. let stateStack = [];
  12301. let currentOpenBracketCount = 0;
  12302. let currentOpenParensCount = 0;
  12303. let currentStringType = null;
  12304. for (let i = 0; i < path.length; i++) {
  12305. const char = path.charAt(i);
  12306. switch (state) {
  12307. case 0 /* inMemberExp */:
  12308. if (char === "[") {
  12309. stateStack.push(state);
  12310. state = 1 /* inBrackets */;
  12311. currentOpenBracketCount++;
  12312. } else if (char === "(") {
  12313. stateStack.push(state);
  12314. state = 2 /* inParens */;
  12315. currentOpenParensCount++;
  12316. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  12317. return false;
  12318. }
  12319. break;
  12320. case 1 /* inBrackets */:
  12321. if (char === `'` || char === `"` || char === "`") {
  12322. stateStack.push(state);
  12323. state = 3 /* inString */;
  12324. currentStringType = char;
  12325. } else if (char === `[`) {
  12326. currentOpenBracketCount++;
  12327. } else if (char === `]`) {
  12328. if (!--currentOpenBracketCount) {
  12329. state = stateStack.pop();
  12330. }
  12331. }
  12332. break;
  12333. case 2 /* inParens */:
  12334. if (char === `'` || char === `"` || char === "`") {
  12335. stateStack.push(state);
  12336. state = 3 /* inString */;
  12337. currentStringType = char;
  12338. } else if (char === `(`) {
  12339. currentOpenParensCount++;
  12340. } else if (char === `)`) {
  12341. if (i === path.length - 1) {
  12342. return false;
  12343. }
  12344. if (!--currentOpenParensCount) {
  12345. state = stateStack.pop();
  12346. }
  12347. }
  12348. break;
  12349. case 3 /* inString */:
  12350. if (char === currentStringType) {
  12351. state = stateStack.pop();
  12352. currentStringType = null;
  12353. }
  12354. break;
  12355. }
  12356. }
  12357. return !currentOpenBracketCount && !currentOpenParensCount;
  12358. };
  12359. const isMemberExpression = isMemberExpressionBrowser ;
  12360. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  12361. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  12362. const isFnExpression = isFnExpressionBrowser ;
  12363. function assert(condition, msg) {
  12364. if (!condition) {
  12365. throw new Error(msg || `unexpected compiler condition`);
  12366. }
  12367. }
  12368. function findDir(node, name, allowEmpty = false) {
  12369. for (let i = 0; i < node.props.length; i++) {
  12370. const p = node.props[i];
  12371. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  12372. return p;
  12373. }
  12374. }
  12375. }
  12376. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  12377. for (let i = 0; i < node.props.length; i++) {
  12378. const p = node.props[i];
  12379. if (p.type === 6) {
  12380. if (dynamicOnly) continue;
  12381. if (p.name === name && (p.value || allowEmpty)) {
  12382. return p;
  12383. }
  12384. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  12385. return p;
  12386. }
  12387. }
  12388. }
  12389. function isStaticArgOf(arg, name) {
  12390. return !!(arg && isStaticExp(arg) && arg.content === name);
  12391. }
  12392. function hasDynamicKeyVBind(node) {
  12393. return node.props.some(
  12394. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  12395. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  12396. !p.arg.isStatic)
  12397. // v-bind:[foo]
  12398. );
  12399. }
  12400. function isText$1(node) {
  12401. return node.type === 5 || node.type === 2;
  12402. }
  12403. function isVSlot(p) {
  12404. return p.type === 7 && p.name === "slot";
  12405. }
  12406. function isTemplateNode(node) {
  12407. return node.type === 1 && node.tagType === 3;
  12408. }
  12409. function isSlotOutlet(node) {
  12410. return node.type === 1 && node.tagType === 2;
  12411. }
  12412. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  12413. function getUnnormalizedProps(props, callPath = []) {
  12414. if (props && !isString(props) && props.type === 14) {
  12415. const callee = props.callee;
  12416. if (!isString(callee) && propsHelperSet.has(callee)) {
  12417. return getUnnormalizedProps(
  12418. props.arguments[0],
  12419. callPath.concat(props)
  12420. );
  12421. }
  12422. }
  12423. return [props, callPath];
  12424. }
  12425. function injectProp(node, prop, context) {
  12426. let propsWithInjection;
  12427. let props = node.type === 13 ? node.props : node.arguments[2];
  12428. let callPath = [];
  12429. let parentCall;
  12430. if (props && !isString(props) && props.type === 14) {
  12431. const ret = getUnnormalizedProps(props);
  12432. props = ret[0];
  12433. callPath = ret[1];
  12434. parentCall = callPath[callPath.length - 1];
  12435. }
  12436. if (props == null || isString(props)) {
  12437. propsWithInjection = createObjectExpression([prop]);
  12438. } else if (props.type === 14) {
  12439. const first = props.arguments[0];
  12440. if (!isString(first) && first.type === 15) {
  12441. if (!hasProp(prop, first)) {
  12442. first.properties.unshift(prop);
  12443. }
  12444. } else {
  12445. if (props.callee === TO_HANDLERS) {
  12446. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12447. createObjectExpression([prop]),
  12448. props
  12449. ]);
  12450. } else {
  12451. props.arguments.unshift(createObjectExpression([prop]));
  12452. }
  12453. }
  12454. !propsWithInjection && (propsWithInjection = props);
  12455. } else if (props.type === 15) {
  12456. if (!hasProp(prop, props)) {
  12457. props.properties.unshift(prop);
  12458. }
  12459. propsWithInjection = props;
  12460. } else {
  12461. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12462. createObjectExpression([prop]),
  12463. props
  12464. ]);
  12465. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  12466. parentCall = callPath[callPath.length - 2];
  12467. }
  12468. }
  12469. if (node.type === 13) {
  12470. if (parentCall) {
  12471. parentCall.arguments[0] = propsWithInjection;
  12472. } else {
  12473. node.props = propsWithInjection;
  12474. }
  12475. } else {
  12476. if (parentCall) {
  12477. parentCall.arguments[0] = propsWithInjection;
  12478. } else {
  12479. node.arguments[2] = propsWithInjection;
  12480. }
  12481. }
  12482. }
  12483. function hasProp(prop, props) {
  12484. let result = false;
  12485. if (prop.key.type === 4) {
  12486. const propKeyName = prop.key.content;
  12487. result = props.properties.some(
  12488. (p) => p.key.type === 4 && p.key.content === propKeyName
  12489. );
  12490. }
  12491. return result;
  12492. }
  12493. function toValidAssetId(name, type) {
  12494. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  12495. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  12496. })}`;
  12497. }
  12498. function getMemoedVNodeCall(node) {
  12499. if (node.type === 14 && node.callee === WITH_MEMO) {
  12500. return node.arguments[1].returns;
  12501. } else {
  12502. return node;
  12503. }
  12504. }
  12505. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  12506. const defaultParserOptions = {
  12507. parseMode: "base",
  12508. ns: 0,
  12509. delimiters: [`{{`, `}}`],
  12510. getNamespace: () => 0,
  12511. isVoidTag: NO,
  12512. isPreTag: NO,
  12513. isCustomElement: NO,
  12514. onError: defaultOnError,
  12515. onWarn: defaultOnWarn,
  12516. comments: true,
  12517. prefixIdentifiers: false
  12518. };
  12519. let currentOptions = defaultParserOptions;
  12520. let currentRoot = null;
  12521. let currentInput = "";
  12522. let currentOpenTag = null;
  12523. let currentProp = null;
  12524. let currentAttrValue = "";
  12525. let currentAttrStartIndex = -1;
  12526. let currentAttrEndIndex = -1;
  12527. let inPre = 0;
  12528. let inVPre = false;
  12529. let currentVPreBoundary = null;
  12530. const stack = [];
  12531. const tokenizer = new Tokenizer(stack, {
  12532. onerr: emitError,
  12533. ontext(start, end) {
  12534. onText(getSlice(start, end), start, end);
  12535. },
  12536. ontextentity(char, start, end) {
  12537. onText(char, start, end);
  12538. },
  12539. oninterpolation(start, end) {
  12540. if (inVPre) {
  12541. return onText(getSlice(start, end), start, end);
  12542. }
  12543. let innerStart = start + tokenizer.delimiterOpen.length;
  12544. let innerEnd = end - tokenizer.delimiterClose.length;
  12545. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  12546. innerStart++;
  12547. }
  12548. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  12549. innerEnd--;
  12550. }
  12551. let exp = getSlice(innerStart, innerEnd);
  12552. if (exp.includes("&")) {
  12553. {
  12554. exp = currentOptions.decodeEntities(exp, false);
  12555. }
  12556. }
  12557. addNode({
  12558. type: 5,
  12559. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  12560. loc: getLoc(start, end)
  12561. });
  12562. },
  12563. onopentagname(start, end) {
  12564. const name = getSlice(start, end);
  12565. currentOpenTag = {
  12566. type: 1,
  12567. tag: name,
  12568. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  12569. tagType: 0,
  12570. // will be refined on tag close
  12571. props: [],
  12572. children: [],
  12573. loc: getLoc(start - 1, end),
  12574. codegenNode: void 0
  12575. };
  12576. },
  12577. onopentagend(end) {
  12578. endOpenTag(end);
  12579. },
  12580. onclosetag(start, end) {
  12581. const name = getSlice(start, end);
  12582. if (!currentOptions.isVoidTag(name)) {
  12583. let found = false;
  12584. for (let i = 0; i < stack.length; i++) {
  12585. const e = stack[i];
  12586. if (e.tag.toLowerCase() === name.toLowerCase()) {
  12587. found = true;
  12588. if (i > 0) {
  12589. emitError(24, stack[0].loc.start.offset);
  12590. }
  12591. for (let j = 0; j <= i; j++) {
  12592. const el = stack.shift();
  12593. onCloseTag(el, end, j < i);
  12594. }
  12595. break;
  12596. }
  12597. }
  12598. if (!found) {
  12599. emitError(23, backTrack(start, 60));
  12600. }
  12601. }
  12602. },
  12603. onselfclosingtag(end) {
  12604. const name = currentOpenTag.tag;
  12605. currentOpenTag.isSelfClosing = true;
  12606. endOpenTag(end);
  12607. if (stack[0] && stack[0].tag === name) {
  12608. onCloseTag(stack.shift(), end);
  12609. }
  12610. },
  12611. onattribname(start, end) {
  12612. currentProp = {
  12613. type: 6,
  12614. name: getSlice(start, end),
  12615. nameLoc: getLoc(start, end),
  12616. value: void 0,
  12617. loc: getLoc(start)
  12618. };
  12619. },
  12620. ondirname(start, end) {
  12621. const raw = getSlice(start, end);
  12622. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  12623. if (!inVPre && name === "") {
  12624. emitError(26, start);
  12625. }
  12626. if (inVPre || name === "") {
  12627. currentProp = {
  12628. type: 6,
  12629. name: raw,
  12630. nameLoc: getLoc(start, end),
  12631. value: void 0,
  12632. loc: getLoc(start)
  12633. };
  12634. } else {
  12635. currentProp = {
  12636. type: 7,
  12637. name,
  12638. rawName: raw,
  12639. exp: void 0,
  12640. arg: void 0,
  12641. modifiers: raw === "." ? ["prop"] : [],
  12642. loc: getLoc(start)
  12643. };
  12644. if (name === "pre") {
  12645. inVPre = tokenizer.inVPre = true;
  12646. currentVPreBoundary = currentOpenTag;
  12647. const props = currentOpenTag.props;
  12648. for (let i = 0; i < props.length; i++) {
  12649. if (props[i].type === 7) {
  12650. props[i] = dirToAttr(props[i]);
  12651. }
  12652. }
  12653. }
  12654. }
  12655. },
  12656. ondirarg(start, end) {
  12657. if (start === end) return;
  12658. const arg = getSlice(start, end);
  12659. if (inVPre) {
  12660. currentProp.name += arg;
  12661. setLocEnd(currentProp.nameLoc, end);
  12662. } else {
  12663. const isStatic = arg[0] !== `[`;
  12664. currentProp.arg = createExp(
  12665. isStatic ? arg : arg.slice(1, -1),
  12666. isStatic,
  12667. getLoc(start, end),
  12668. isStatic ? 3 : 0
  12669. );
  12670. }
  12671. },
  12672. ondirmodifier(start, end) {
  12673. const mod = getSlice(start, end);
  12674. if (inVPre) {
  12675. currentProp.name += "." + mod;
  12676. setLocEnd(currentProp.nameLoc, end);
  12677. } else if (currentProp.name === "slot") {
  12678. const arg = currentProp.arg;
  12679. if (arg) {
  12680. arg.content += "." + mod;
  12681. setLocEnd(arg.loc, end);
  12682. }
  12683. } else {
  12684. currentProp.modifiers.push(mod);
  12685. }
  12686. },
  12687. onattribdata(start, end) {
  12688. currentAttrValue += getSlice(start, end);
  12689. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12690. currentAttrEndIndex = end;
  12691. },
  12692. onattribentity(char, start, end) {
  12693. currentAttrValue += char;
  12694. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12695. currentAttrEndIndex = end;
  12696. },
  12697. onattribnameend(end) {
  12698. const start = currentProp.loc.start.offset;
  12699. const name = getSlice(start, end);
  12700. if (currentProp.type === 7) {
  12701. currentProp.rawName = name;
  12702. }
  12703. if (currentOpenTag.props.some(
  12704. (p) => (p.type === 7 ? p.rawName : p.name) === name
  12705. )) {
  12706. emitError(2, start);
  12707. }
  12708. },
  12709. onattribend(quote, end) {
  12710. if (currentOpenTag && currentProp) {
  12711. setLocEnd(currentProp.loc, end);
  12712. if (quote !== 0) {
  12713. if (currentAttrValue.includes("&")) {
  12714. currentAttrValue = currentOptions.decodeEntities(
  12715. currentAttrValue,
  12716. true
  12717. );
  12718. }
  12719. if (currentProp.type === 6) {
  12720. if (currentProp.name === "class") {
  12721. currentAttrValue = condense(currentAttrValue).trim();
  12722. }
  12723. if (quote === 1 && !currentAttrValue) {
  12724. emitError(13, end);
  12725. }
  12726. currentProp.value = {
  12727. type: 2,
  12728. content: currentAttrValue,
  12729. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  12730. };
  12731. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  12732. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  12733. }
  12734. } else {
  12735. let expParseMode = 0 /* Normal */;
  12736. currentProp.exp = createExp(
  12737. currentAttrValue,
  12738. false,
  12739. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  12740. 0,
  12741. expParseMode
  12742. );
  12743. if (currentProp.name === "for") {
  12744. currentProp.forParseResult = parseForExpression(currentProp.exp);
  12745. }
  12746. }
  12747. }
  12748. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  12749. currentOpenTag.props.push(currentProp);
  12750. }
  12751. }
  12752. currentAttrValue = "";
  12753. currentAttrStartIndex = currentAttrEndIndex = -1;
  12754. },
  12755. oncomment(start, end) {
  12756. if (currentOptions.comments) {
  12757. addNode({
  12758. type: 3,
  12759. content: getSlice(start, end),
  12760. loc: getLoc(start - 4, end + 3)
  12761. });
  12762. }
  12763. },
  12764. onend() {
  12765. const end = currentInput.length;
  12766. if (tokenizer.state !== 1) {
  12767. switch (tokenizer.state) {
  12768. case 5:
  12769. case 8:
  12770. emitError(5, end);
  12771. break;
  12772. case 3:
  12773. case 4:
  12774. emitError(
  12775. 25,
  12776. tokenizer.sectionStart
  12777. );
  12778. break;
  12779. case 28:
  12780. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  12781. emitError(6, end);
  12782. } else {
  12783. emitError(7, end);
  12784. }
  12785. break;
  12786. case 6:
  12787. case 7:
  12788. case 9:
  12789. case 11:
  12790. case 12:
  12791. case 13:
  12792. case 14:
  12793. case 15:
  12794. case 16:
  12795. case 17:
  12796. case 18:
  12797. case 19:
  12798. case 20:
  12799. case 21:
  12800. emitError(9, end);
  12801. break;
  12802. }
  12803. }
  12804. for (let index = 0; index < stack.length; index++) {
  12805. onCloseTag(stack[index], end - 1);
  12806. emitError(24, stack[index].loc.start.offset);
  12807. }
  12808. },
  12809. oncdata(start, end) {
  12810. if (stack[0].ns !== 0) {
  12811. onText(getSlice(start, end), start, end);
  12812. } else {
  12813. emitError(1, start - 9);
  12814. }
  12815. },
  12816. onprocessinginstruction(start) {
  12817. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12818. emitError(
  12819. 21,
  12820. start - 1
  12821. );
  12822. }
  12823. }
  12824. });
  12825. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  12826. const stripParensRE = /^\(|\)$/g;
  12827. function parseForExpression(input) {
  12828. const loc = input.loc;
  12829. const exp = input.content;
  12830. const inMatch = exp.match(forAliasRE);
  12831. if (!inMatch) return;
  12832. const [, LHS, RHS] = inMatch;
  12833. const createAliasExpression = (content, offset, asParam = false) => {
  12834. const start = loc.start.offset + offset;
  12835. const end = start + content.length;
  12836. return createExp(
  12837. content,
  12838. false,
  12839. getLoc(start, end),
  12840. 0,
  12841. asParam ? 1 /* Params */ : 0 /* Normal */
  12842. );
  12843. };
  12844. const result = {
  12845. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  12846. value: void 0,
  12847. key: void 0,
  12848. index: void 0,
  12849. finalized: false
  12850. };
  12851. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  12852. const trimmedOffset = LHS.indexOf(valueContent);
  12853. const iteratorMatch = valueContent.match(forIteratorRE);
  12854. if (iteratorMatch) {
  12855. valueContent = valueContent.replace(forIteratorRE, "").trim();
  12856. const keyContent = iteratorMatch[1].trim();
  12857. let keyOffset;
  12858. if (keyContent) {
  12859. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  12860. result.key = createAliasExpression(keyContent, keyOffset, true);
  12861. }
  12862. if (iteratorMatch[2]) {
  12863. const indexContent = iteratorMatch[2].trim();
  12864. if (indexContent) {
  12865. result.index = createAliasExpression(
  12866. indexContent,
  12867. exp.indexOf(
  12868. indexContent,
  12869. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  12870. ),
  12871. true
  12872. );
  12873. }
  12874. }
  12875. }
  12876. if (valueContent) {
  12877. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  12878. }
  12879. return result;
  12880. }
  12881. function getSlice(start, end) {
  12882. return currentInput.slice(start, end);
  12883. }
  12884. function endOpenTag(end) {
  12885. if (tokenizer.inSFCRoot) {
  12886. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  12887. }
  12888. addNode(currentOpenTag);
  12889. const { tag, ns } = currentOpenTag;
  12890. if (ns === 0 && currentOptions.isPreTag(tag)) {
  12891. inPre++;
  12892. }
  12893. if (currentOptions.isVoidTag(tag)) {
  12894. onCloseTag(currentOpenTag, end);
  12895. } else {
  12896. stack.unshift(currentOpenTag);
  12897. if (ns === 1 || ns === 2) {
  12898. tokenizer.inXML = true;
  12899. }
  12900. }
  12901. currentOpenTag = null;
  12902. }
  12903. function onText(content, start, end) {
  12904. {
  12905. const tag = stack[0] && stack[0].tag;
  12906. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  12907. content = currentOptions.decodeEntities(content, false);
  12908. }
  12909. }
  12910. const parent = stack[0] || currentRoot;
  12911. const lastNode = parent.children[parent.children.length - 1];
  12912. if (lastNode && lastNode.type === 2) {
  12913. lastNode.content += content;
  12914. setLocEnd(lastNode.loc, end);
  12915. } else {
  12916. parent.children.push({
  12917. type: 2,
  12918. content,
  12919. loc: getLoc(start, end)
  12920. });
  12921. }
  12922. }
  12923. function onCloseTag(el, end, isImplied = false) {
  12924. if (isImplied) {
  12925. setLocEnd(el.loc, backTrack(end, 60));
  12926. } else {
  12927. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  12928. }
  12929. if (tokenizer.inSFCRoot) {
  12930. if (el.children.length) {
  12931. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  12932. } else {
  12933. el.innerLoc.end = extend({}, el.innerLoc.start);
  12934. }
  12935. el.innerLoc.source = getSlice(
  12936. el.innerLoc.start.offset,
  12937. el.innerLoc.end.offset
  12938. );
  12939. }
  12940. const { tag, ns } = el;
  12941. if (!inVPre) {
  12942. if (tag === "slot") {
  12943. el.tagType = 2;
  12944. } else if (isFragmentTemplate(el)) {
  12945. el.tagType = 3;
  12946. } else if (isComponent(el)) {
  12947. el.tagType = 1;
  12948. }
  12949. }
  12950. if (!tokenizer.inRCDATA) {
  12951. el.children = condenseWhitespace(el.children, el.tag);
  12952. }
  12953. if (ns === 0 && currentOptions.isPreTag(tag)) {
  12954. inPre--;
  12955. }
  12956. if (currentVPreBoundary === el) {
  12957. inVPre = tokenizer.inVPre = false;
  12958. currentVPreBoundary = null;
  12959. }
  12960. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12961. tokenizer.inXML = false;
  12962. }
  12963. }
  12964. function lookAhead(index, c) {
  12965. let i = index;
  12966. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  12967. return i;
  12968. }
  12969. function backTrack(index, c) {
  12970. let i = index;
  12971. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  12972. return i;
  12973. }
  12974. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  12975. function isFragmentTemplate({ tag, props }) {
  12976. if (tag === "template") {
  12977. for (let i = 0; i < props.length; i++) {
  12978. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  12979. return true;
  12980. }
  12981. }
  12982. }
  12983. return false;
  12984. }
  12985. function isComponent({ tag, props }) {
  12986. if (currentOptions.isCustomElement(tag)) {
  12987. return false;
  12988. }
  12989. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  12990. return true;
  12991. }
  12992. for (let i = 0; i < props.length; i++) {
  12993. const p = props[i];
  12994. if (p.type === 6) {
  12995. if (p.name === "is" && p.value) {
  12996. if (p.value.content.startsWith("vue:")) {
  12997. return true;
  12998. }
  12999. }
  13000. }
  13001. }
  13002. return false;
  13003. }
  13004. function isUpperCase(c) {
  13005. return c > 64 && c < 91;
  13006. }
  13007. const windowsNewlineRE = /\r\n/g;
  13008. function condenseWhitespace(nodes, tag) {
  13009. const shouldCondense = currentOptions.whitespace !== "preserve";
  13010. let removedWhitespace = false;
  13011. for (let i = 0; i < nodes.length; i++) {
  13012. const node = nodes[i];
  13013. if (node.type === 2) {
  13014. if (!inPre) {
  13015. if (isAllWhitespace(node.content)) {
  13016. const prev = nodes[i - 1] && nodes[i - 1].type;
  13017. const next = nodes[i + 1] && nodes[i + 1].type;
  13018. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  13019. removedWhitespace = true;
  13020. nodes[i] = null;
  13021. } else {
  13022. node.content = " ";
  13023. }
  13024. } else if (shouldCondense) {
  13025. node.content = condense(node.content);
  13026. }
  13027. } else {
  13028. node.content = node.content.replace(windowsNewlineRE, "\n");
  13029. }
  13030. }
  13031. }
  13032. if (inPre && tag && currentOptions.isPreTag(tag)) {
  13033. const first = nodes[0];
  13034. if (first && first.type === 2) {
  13035. first.content = first.content.replace(/^\r?\n/, "");
  13036. }
  13037. }
  13038. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  13039. }
  13040. function isAllWhitespace(str) {
  13041. for (let i = 0; i < str.length; i++) {
  13042. if (!isWhitespace(str.charCodeAt(i))) {
  13043. return false;
  13044. }
  13045. }
  13046. return true;
  13047. }
  13048. function hasNewlineChar(str) {
  13049. for (let i = 0; i < str.length; i++) {
  13050. const c = str.charCodeAt(i);
  13051. if (c === 10 || c === 13) {
  13052. return true;
  13053. }
  13054. }
  13055. return false;
  13056. }
  13057. function condense(str) {
  13058. let ret = "";
  13059. let prevCharIsWhitespace = false;
  13060. for (let i = 0; i < str.length; i++) {
  13061. if (isWhitespace(str.charCodeAt(i))) {
  13062. if (!prevCharIsWhitespace) {
  13063. ret += " ";
  13064. prevCharIsWhitespace = true;
  13065. }
  13066. } else {
  13067. ret += str[i];
  13068. prevCharIsWhitespace = false;
  13069. }
  13070. }
  13071. return ret;
  13072. }
  13073. function addNode(node) {
  13074. (stack[0] || currentRoot).children.push(node);
  13075. }
  13076. function getLoc(start, end) {
  13077. return {
  13078. start: tokenizer.getPos(start),
  13079. // @ts-expect-error allow late attachment
  13080. end: end == null ? end : tokenizer.getPos(end),
  13081. // @ts-expect-error allow late attachment
  13082. source: end == null ? end : getSlice(start, end)
  13083. };
  13084. }
  13085. function setLocEnd(loc, end) {
  13086. loc.end = tokenizer.getPos(end);
  13087. loc.source = getSlice(loc.start.offset, end);
  13088. }
  13089. function dirToAttr(dir) {
  13090. const attr = {
  13091. type: 6,
  13092. name: dir.rawName,
  13093. nameLoc: getLoc(
  13094. dir.loc.start.offset,
  13095. dir.loc.start.offset + dir.rawName.length
  13096. ),
  13097. value: void 0,
  13098. loc: dir.loc
  13099. };
  13100. if (dir.exp) {
  13101. const loc = dir.exp.loc;
  13102. if (loc.end.offset < dir.loc.end.offset) {
  13103. loc.start.offset--;
  13104. loc.start.column--;
  13105. loc.end.offset++;
  13106. loc.end.column++;
  13107. }
  13108. attr.value = {
  13109. type: 2,
  13110. content: dir.exp.content,
  13111. loc
  13112. };
  13113. }
  13114. return attr;
  13115. }
  13116. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  13117. const exp = createSimpleExpression(content, isStatic, loc, constType);
  13118. return exp;
  13119. }
  13120. function emitError(code, index, message) {
  13121. currentOptions.onError(
  13122. createCompilerError(code, getLoc(index, index), void 0, message)
  13123. );
  13124. }
  13125. function reset() {
  13126. tokenizer.reset();
  13127. currentOpenTag = null;
  13128. currentProp = null;
  13129. currentAttrValue = "";
  13130. currentAttrStartIndex = -1;
  13131. currentAttrEndIndex = -1;
  13132. stack.length = 0;
  13133. }
  13134. function baseParse(input, options) {
  13135. reset();
  13136. currentInput = input;
  13137. currentOptions = extend({}, defaultParserOptions);
  13138. if (options) {
  13139. let key;
  13140. for (key in options) {
  13141. if (options[key] != null) {
  13142. currentOptions[key] = options[key];
  13143. }
  13144. }
  13145. }
  13146. {
  13147. if (!currentOptions.decodeEntities) {
  13148. throw new Error(
  13149. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  13150. );
  13151. }
  13152. }
  13153. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  13154. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  13155. const delimiters = options && options.delimiters;
  13156. if (delimiters) {
  13157. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  13158. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  13159. }
  13160. const root = currentRoot = createRoot([], input);
  13161. tokenizer.parse(currentInput);
  13162. root.loc = getLoc(0, input.length);
  13163. root.children = condenseWhitespace(root.children);
  13164. currentRoot = null;
  13165. return root;
  13166. }
  13167. function hoistStatic(root, context) {
  13168. walk(
  13169. root,
  13170. context,
  13171. // Root node is unfortunately non-hoistable due to potential parent
  13172. // fallthrough attributes.
  13173. isSingleElementRoot(root, root.children[0])
  13174. );
  13175. }
  13176. function isSingleElementRoot(root, child) {
  13177. const { children } = root;
  13178. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  13179. }
  13180. function walk(node, context, doNotHoistNode = false) {
  13181. const { children } = node;
  13182. const originalCount = children.length;
  13183. let hoistedCount = 0;
  13184. for (let i = 0; i < children.length; i++) {
  13185. const child = children[i];
  13186. if (child.type === 1 && child.tagType === 0) {
  13187. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  13188. if (constantType > 0) {
  13189. if (constantType >= 2) {
  13190. child.codegenNode.patchFlag = -1;
  13191. child.codegenNode = context.hoist(child.codegenNode);
  13192. hoistedCount++;
  13193. continue;
  13194. }
  13195. } else {
  13196. const codegenNode = child.codegenNode;
  13197. if (codegenNode.type === 13) {
  13198. const flag = codegenNode.patchFlag;
  13199. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  13200. const props = getNodeProps(child);
  13201. if (props) {
  13202. codegenNode.props = context.hoist(props);
  13203. }
  13204. }
  13205. if (codegenNode.dynamicProps) {
  13206. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  13207. }
  13208. }
  13209. }
  13210. }
  13211. if (child.type === 1) {
  13212. const isComponent = child.tagType === 1;
  13213. if (isComponent) {
  13214. context.scopes.vSlot++;
  13215. }
  13216. walk(child, context);
  13217. if (isComponent) {
  13218. context.scopes.vSlot--;
  13219. }
  13220. } else if (child.type === 11) {
  13221. walk(child, context, child.children.length === 1);
  13222. } else if (child.type === 9) {
  13223. for (let i2 = 0; i2 < child.branches.length; i2++) {
  13224. walk(
  13225. child.branches[i2],
  13226. context,
  13227. child.branches[i2].children.length === 1
  13228. );
  13229. }
  13230. }
  13231. }
  13232. if (hoistedCount && context.transformHoist) {
  13233. context.transformHoist(children, context, node);
  13234. }
  13235. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  13236. const hoisted = context.hoist(
  13237. createArrayExpression(node.codegenNode.children)
  13238. );
  13239. if (context.hmr) {
  13240. hoisted.content = `[...${hoisted.content}]`;
  13241. }
  13242. node.codegenNode.children = hoisted;
  13243. }
  13244. }
  13245. function getConstantType(node, context) {
  13246. const { constantCache } = context;
  13247. switch (node.type) {
  13248. case 1:
  13249. if (node.tagType !== 0) {
  13250. return 0;
  13251. }
  13252. const cached = constantCache.get(node);
  13253. if (cached !== void 0) {
  13254. return cached;
  13255. }
  13256. const codegenNode = node.codegenNode;
  13257. if (codegenNode.type !== 13) {
  13258. return 0;
  13259. }
  13260. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  13261. return 0;
  13262. }
  13263. if (codegenNode.patchFlag === void 0) {
  13264. let returnType2 = 3;
  13265. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  13266. if (generatedPropsType === 0) {
  13267. constantCache.set(node, 0);
  13268. return 0;
  13269. }
  13270. if (generatedPropsType < returnType2) {
  13271. returnType2 = generatedPropsType;
  13272. }
  13273. for (let i = 0; i < node.children.length; i++) {
  13274. const childType = getConstantType(node.children[i], context);
  13275. if (childType === 0) {
  13276. constantCache.set(node, 0);
  13277. return 0;
  13278. }
  13279. if (childType < returnType2) {
  13280. returnType2 = childType;
  13281. }
  13282. }
  13283. if (returnType2 > 1) {
  13284. for (let i = 0; i < node.props.length; i++) {
  13285. const p = node.props[i];
  13286. if (p.type === 7 && p.name === "bind" && p.exp) {
  13287. const expType = getConstantType(p.exp, context);
  13288. if (expType === 0) {
  13289. constantCache.set(node, 0);
  13290. return 0;
  13291. }
  13292. if (expType < returnType2) {
  13293. returnType2 = expType;
  13294. }
  13295. }
  13296. }
  13297. }
  13298. if (codegenNode.isBlock) {
  13299. for (let i = 0; i < node.props.length; i++) {
  13300. const p = node.props[i];
  13301. if (p.type === 7) {
  13302. constantCache.set(node, 0);
  13303. return 0;
  13304. }
  13305. }
  13306. context.removeHelper(OPEN_BLOCK);
  13307. context.removeHelper(
  13308. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  13309. );
  13310. codegenNode.isBlock = false;
  13311. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  13312. }
  13313. constantCache.set(node, returnType2);
  13314. return returnType2;
  13315. } else {
  13316. constantCache.set(node, 0);
  13317. return 0;
  13318. }
  13319. case 2:
  13320. case 3:
  13321. return 3;
  13322. case 9:
  13323. case 11:
  13324. case 10:
  13325. return 0;
  13326. case 5:
  13327. case 12:
  13328. return getConstantType(node.content, context);
  13329. case 4:
  13330. return node.constType;
  13331. case 8:
  13332. let returnType = 3;
  13333. for (let i = 0; i < node.children.length; i++) {
  13334. const child = node.children[i];
  13335. if (isString(child) || isSymbol(child)) {
  13336. continue;
  13337. }
  13338. const childType = getConstantType(child, context);
  13339. if (childType === 0) {
  13340. return 0;
  13341. } else if (childType < returnType) {
  13342. returnType = childType;
  13343. }
  13344. }
  13345. return returnType;
  13346. default:
  13347. return 0;
  13348. }
  13349. }
  13350. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  13351. NORMALIZE_CLASS,
  13352. NORMALIZE_STYLE,
  13353. NORMALIZE_PROPS,
  13354. GUARD_REACTIVE_PROPS
  13355. ]);
  13356. function getConstantTypeOfHelperCall(value, context) {
  13357. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  13358. const arg = value.arguments[0];
  13359. if (arg.type === 4) {
  13360. return getConstantType(arg, context);
  13361. } else if (arg.type === 14) {
  13362. return getConstantTypeOfHelperCall(arg, context);
  13363. }
  13364. }
  13365. return 0;
  13366. }
  13367. function getGeneratedPropsConstantType(node, context) {
  13368. let returnType = 3;
  13369. const props = getNodeProps(node);
  13370. if (props && props.type === 15) {
  13371. const { properties } = props;
  13372. for (let i = 0; i < properties.length; i++) {
  13373. const { key, value } = properties[i];
  13374. const keyType = getConstantType(key, context);
  13375. if (keyType === 0) {
  13376. return keyType;
  13377. }
  13378. if (keyType < returnType) {
  13379. returnType = keyType;
  13380. }
  13381. let valueType;
  13382. if (value.type === 4) {
  13383. valueType = getConstantType(value, context);
  13384. } else if (value.type === 14) {
  13385. valueType = getConstantTypeOfHelperCall(value, context);
  13386. } else {
  13387. valueType = 0;
  13388. }
  13389. if (valueType === 0) {
  13390. return valueType;
  13391. }
  13392. if (valueType < returnType) {
  13393. returnType = valueType;
  13394. }
  13395. }
  13396. }
  13397. return returnType;
  13398. }
  13399. function getNodeProps(node) {
  13400. const codegenNode = node.codegenNode;
  13401. if (codegenNode.type === 13) {
  13402. return codegenNode.props;
  13403. }
  13404. }
  13405. function createTransformContext(root, {
  13406. filename = "",
  13407. prefixIdentifiers = false,
  13408. hoistStatic: hoistStatic2 = false,
  13409. hmr = false,
  13410. cacheHandlers = false,
  13411. nodeTransforms = [],
  13412. directiveTransforms = {},
  13413. transformHoist = null,
  13414. isBuiltInComponent = NOOP,
  13415. isCustomElement = NOOP,
  13416. expressionPlugins = [],
  13417. scopeId = null,
  13418. slotted = true,
  13419. ssr = false,
  13420. inSSR = false,
  13421. ssrCssVars = ``,
  13422. bindingMetadata = EMPTY_OBJ,
  13423. inline = false,
  13424. isTS = false,
  13425. onError = defaultOnError,
  13426. onWarn = defaultOnWarn,
  13427. compatConfig
  13428. }) {
  13429. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  13430. const context = {
  13431. // options
  13432. filename,
  13433. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  13434. prefixIdentifiers,
  13435. hoistStatic: hoistStatic2,
  13436. hmr,
  13437. cacheHandlers,
  13438. nodeTransforms,
  13439. directiveTransforms,
  13440. transformHoist,
  13441. isBuiltInComponent,
  13442. isCustomElement,
  13443. expressionPlugins,
  13444. scopeId,
  13445. slotted,
  13446. ssr,
  13447. inSSR,
  13448. ssrCssVars,
  13449. bindingMetadata,
  13450. inline,
  13451. isTS,
  13452. onError,
  13453. onWarn,
  13454. compatConfig,
  13455. // state
  13456. root,
  13457. helpers: /* @__PURE__ */ new Map(),
  13458. components: /* @__PURE__ */ new Set(),
  13459. directives: /* @__PURE__ */ new Set(),
  13460. hoists: [],
  13461. imports: [],
  13462. constantCache: /* @__PURE__ */ new WeakMap(),
  13463. temps: 0,
  13464. cached: 0,
  13465. identifiers: /* @__PURE__ */ Object.create(null),
  13466. scopes: {
  13467. vFor: 0,
  13468. vSlot: 0,
  13469. vPre: 0,
  13470. vOnce: 0
  13471. },
  13472. parent: null,
  13473. grandParent: null,
  13474. currentNode: root,
  13475. childIndex: 0,
  13476. inVOnce: false,
  13477. // methods
  13478. helper(name) {
  13479. const count = context.helpers.get(name) || 0;
  13480. context.helpers.set(name, count + 1);
  13481. return name;
  13482. },
  13483. removeHelper(name) {
  13484. const count = context.helpers.get(name);
  13485. if (count) {
  13486. const currentCount = count - 1;
  13487. if (!currentCount) {
  13488. context.helpers.delete(name);
  13489. } else {
  13490. context.helpers.set(name, currentCount);
  13491. }
  13492. }
  13493. },
  13494. helperString(name) {
  13495. return `_${helperNameMap[context.helper(name)]}`;
  13496. },
  13497. replaceNode(node) {
  13498. {
  13499. if (!context.currentNode) {
  13500. throw new Error(`Node being replaced is already removed.`);
  13501. }
  13502. if (!context.parent) {
  13503. throw new Error(`Cannot replace root node.`);
  13504. }
  13505. }
  13506. context.parent.children[context.childIndex] = context.currentNode = node;
  13507. },
  13508. removeNode(node) {
  13509. if (!context.parent) {
  13510. throw new Error(`Cannot remove root node.`);
  13511. }
  13512. const list = context.parent.children;
  13513. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  13514. if (removalIndex < 0) {
  13515. throw new Error(`node being removed is not a child of current parent`);
  13516. }
  13517. if (!node || node === context.currentNode) {
  13518. context.currentNode = null;
  13519. context.onNodeRemoved();
  13520. } else {
  13521. if (context.childIndex > removalIndex) {
  13522. context.childIndex--;
  13523. context.onNodeRemoved();
  13524. }
  13525. }
  13526. context.parent.children.splice(removalIndex, 1);
  13527. },
  13528. onNodeRemoved: NOOP,
  13529. addIdentifiers(exp) {
  13530. },
  13531. removeIdentifiers(exp) {
  13532. },
  13533. hoist(exp) {
  13534. if (isString(exp)) exp = createSimpleExpression(exp);
  13535. context.hoists.push(exp);
  13536. const identifier = createSimpleExpression(
  13537. `_hoisted_${context.hoists.length}`,
  13538. false,
  13539. exp.loc,
  13540. 2
  13541. );
  13542. identifier.hoisted = exp;
  13543. return identifier;
  13544. },
  13545. cache(exp, isVNode = false) {
  13546. return createCacheExpression(context.cached++, exp, isVNode);
  13547. }
  13548. };
  13549. return context;
  13550. }
  13551. function transform(root, options) {
  13552. const context = createTransformContext(root, options);
  13553. traverseNode(root, context);
  13554. if (options.hoistStatic) {
  13555. hoistStatic(root, context);
  13556. }
  13557. if (!options.ssr) {
  13558. createRootCodegen(root, context);
  13559. }
  13560. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  13561. root.components = [...context.components];
  13562. root.directives = [...context.directives];
  13563. root.imports = context.imports;
  13564. root.hoists = context.hoists;
  13565. root.temps = context.temps;
  13566. root.cached = context.cached;
  13567. root.transformed = true;
  13568. }
  13569. function createRootCodegen(root, context) {
  13570. const { helper } = context;
  13571. const { children } = root;
  13572. if (children.length === 1) {
  13573. const child = children[0];
  13574. if (isSingleElementRoot(root, child) && child.codegenNode) {
  13575. const codegenNode = child.codegenNode;
  13576. if (codegenNode.type === 13) {
  13577. convertToBlock(codegenNode, context);
  13578. }
  13579. root.codegenNode = codegenNode;
  13580. } else {
  13581. root.codegenNode = child;
  13582. }
  13583. } else if (children.length > 1) {
  13584. let patchFlag = 64;
  13585. let patchFlagText = PatchFlagNames[64];
  13586. if (children.filter((c) => c.type !== 3).length === 1) {
  13587. patchFlag |= 2048;
  13588. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13589. }
  13590. root.codegenNode = createVNodeCall(
  13591. context,
  13592. helper(FRAGMENT),
  13593. void 0,
  13594. root.children,
  13595. patchFlag,
  13596. void 0,
  13597. void 0,
  13598. true,
  13599. void 0,
  13600. false
  13601. );
  13602. } else ;
  13603. }
  13604. function traverseChildren(parent, context) {
  13605. let i = 0;
  13606. const nodeRemoved = () => {
  13607. i--;
  13608. };
  13609. for (; i < parent.children.length; i++) {
  13610. const child = parent.children[i];
  13611. if (isString(child)) continue;
  13612. context.grandParent = context.parent;
  13613. context.parent = parent;
  13614. context.childIndex = i;
  13615. context.onNodeRemoved = nodeRemoved;
  13616. traverseNode(child, context);
  13617. }
  13618. }
  13619. function traverseNode(node, context) {
  13620. context.currentNode = node;
  13621. const { nodeTransforms } = context;
  13622. const exitFns = [];
  13623. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  13624. const onExit = nodeTransforms[i2](node, context);
  13625. if (onExit) {
  13626. if (isArray(onExit)) {
  13627. exitFns.push(...onExit);
  13628. } else {
  13629. exitFns.push(onExit);
  13630. }
  13631. }
  13632. if (!context.currentNode) {
  13633. return;
  13634. } else {
  13635. node = context.currentNode;
  13636. }
  13637. }
  13638. switch (node.type) {
  13639. case 3:
  13640. if (!context.ssr) {
  13641. context.helper(CREATE_COMMENT);
  13642. }
  13643. break;
  13644. case 5:
  13645. if (!context.ssr) {
  13646. context.helper(TO_DISPLAY_STRING);
  13647. }
  13648. break;
  13649. case 9:
  13650. for (let i2 = 0; i2 < node.branches.length; i2++) {
  13651. traverseNode(node.branches[i2], context);
  13652. }
  13653. break;
  13654. case 10:
  13655. case 11:
  13656. case 1:
  13657. case 0:
  13658. traverseChildren(node, context);
  13659. break;
  13660. }
  13661. context.currentNode = node;
  13662. let i = exitFns.length;
  13663. while (i--) {
  13664. exitFns[i]();
  13665. }
  13666. }
  13667. function createStructuralDirectiveTransform(name, fn) {
  13668. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  13669. return (node, context) => {
  13670. if (node.type === 1) {
  13671. const { props } = node;
  13672. if (node.tagType === 3 && props.some(isVSlot)) {
  13673. return;
  13674. }
  13675. const exitFns = [];
  13676. for (let i = 0; i < props.length; i++) {
  13677. const prop = props[i];
  13678. if (prop.type === 7 && matches(prop.name)) {
  13679. props.splice(i, 1);
  13680. i--;
  13681. const onExit = fn(node, prop, context);
  13682. if (onExit) exitFns.push(onExit);
  13683. }
  13684. }
  13685. return exitFns;
  13686. }
  13687. };
  13688. }
  13689. const PURE_ANNOTATION = `/*#__PURE__*/`;
  13690. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  13691. function createCodegenContext(ast, {
  13692. mode = "function",
  13693. prefixIdentifiers = mode === "module",
  13694. sourceMap = false,
  13695. filename = `template.vue.html`,
  13696. scopeId = null,
  13697. optimizeImports = false,
  13698. runtimeGlobalName = `Vue`,
  13699. runtimeModuleName = `vue`,
  13700. ssrRuntimeModuleName = "vue/server-renderer",
  13701. ssr = false,
  13702. isTS = false,
  13703. inSSR = false
  13704. }) {
  13705. const context = {
  13706. mode,
  13707. prefixIdentifiers,
  13708. sourceMap,
  13709. filename,
  13710. scopeId,
  13711. optimizeImports,
  13712. runtimeGlobalName,
  13713. runtimeModuleName,
  13714. ssrRuntimeModuleName,
  13715. ssr,
  13716. isTS,
  13717. inSSR,
  13718. source: ast.source,
  13719. code: ``,
  13720. column: 1,
  13721. line: 1,
  13722. offset: 0,
  13723. indentLevel: 0,
  13724. pure: false,
  13725. map: void 0,
  13726. helper(key) {
  13727. return `_${helperNameMap[key]}`;
  13728. },
  13729. push(code, newlineIndex = -2 /* None */, node) {
  13730. context.code += code;
  13731. },
  13732. indent() {
  13733. newline(++context.indentLevel);
  13734. },
  13735. deindent(withoutNewLine = false) {
  13736. if (withoutNewLine) {
  13737. --context.indentLevel;
  13738. } else {
  13739. newline(--context.indentLevel);
  13740. }
  13741. },
  13742. newline() {
  13743. newline(context.indentLevel);
  13744. }
  13745. };
  13746. function newline(n) {
  13747. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  13748. }
  13749. return context;
  13750. }
  13751. function generate(ast, options = {}) {
  13752. const context = createCodegenContext(ast, options);
  13753. if (options.onContextCreated) options.onContextCreated(context);
  13754. const {
  13755. mode,
  13756. push,
  13757. prefixIdentifiers,
  13758. indent,
  13759. deindent,
  13760. newline,
  13761. scopeId,
  13762. ssr
  13763. } = context;
  13764. const helpers = Array.from(ast.helpers);
  13765. const hasHelpers = helpers.length > 0;
  13766. const useWithBlock = !prefixIdentifiers && mode !== "module";
  13767. const preambleContext = context;
  13768. {
  13769. genFunctionPreamble(ast, preambleContext);
  13770. }
  13771. const functionName = ssr ? `ssrRender` : `render`;
  13772. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  13773. const signature = args.join(", ");
  13774. {
  13775. push(`function ${functionName}(${signature}) {`);
  13776. }
  13777. indent();
  13778. if (useWithBlock) {
  13779. push(`with (_ctx) {`);
  13780. indent();
  13781. if (hasHelpers) {
  13782. push(
  13783. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  13784. `,
  13785. -1 /* End */
  13786. );
  13787. newline();
  13788. }
  13789. }
  13790. if (ast.components.length) {
  13791. genAssets(ast.components, "component", context);
  13792. if (ast.directives.length || ast.temps > 0) {
  13793. newline();
  13794. }
  13795. }
  13796. if (ast.directives.length) {
  13797. genAssets(ast.directives, "directive", context);
  13798. if (ast.temps > 0) {
  13799. newline();
  13800. }
  13801. }
  13802. if (ast.temps > 0) {
  13803. push(`let `);
  13804. for (let i = 0; i < ast.temps; i++) {
  13805. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  13806. }
  13807. }
  13808. if (ast.components.length || ast.directives.length || ast.temps) {
  13809. push(`
  13810. `, 0 /* Start */);
  13811. newline();
  13812. }
  13813. if (!ssr) {
  13814. push(`return `);
  13815. }
  13816. if (ast.codegenNode) {
  13817. genNode(ast.codegenNode, context);
  13818. } else {
  13819. push(`null`);
  13820. }
  13821. if (useWithBlock) {
  13822. deindent();
  13823. push(`}`);
  13824. }
  13825. deindent();
  13826. push(`}`);
  13827. return {
  13828. ast,
  13829. code: context.code,
  13830. preamble: ``,
  13831. map: context.map ? context.map.toJSON() : void 0
  13832. };
  13833. }
  13834. function genFunctionPreamble(ast, context) {
  13835. const {
  13836. ssr,
  13837. prefixIdentifiers,
  13838. push,
  13839. newline,
  13840. runtimeModuleName,
  13841. runtimeGlobalName,
  13842. ssrRuntimeModuleName
  13843. } = context;
  13844. const VueBinding = runtimeGlobalName;
  13845. const helpers = Array.from(ast.helpers);
  13846. if (helpers.length > 0) {
  13847. {
  13848. push(`const _Vue = ${VueBinding}
  13849. `, -1 /* End */);
  13850. if (ast.hoists.length) {
  13851. const staticHelpers = [
  13852. CREATE_VNODE,
  13853. CREATE_ELEMENT_VNODE,
  13854. CREATE_COMMENT,
  13855. CREATE_TEXT,
  13856. CREATE_STATIC
  13857. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  13858. push(`const { ${staticHelpers} } = _Vue
  13859. `, -1 /* End */);
  13860. }
  13861. }
  13862. }
  13863. genHoists(ast.hoists, context);
  13864. newline();
  13865. push(`return `);
  13866. }
  13867. function genAssets(assets, type, { helper, push, newline, isTS }) {
  13868. const resolver = helper(
  13869. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  13870. );
  13871. for (let i = 0; i < assets.length; i++) {
  13872. let id = assets[i];
  13873. const maybeSelfReference = id.endsWith("__self");
  13874. if (maybeSelfReference) {
  13875. id = id.slice(0, -6);
  13876. }
  13877. push(
  13878. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  13879. );
  13880. if (i < assets.length - 1) {
  13881. newline();
  13882. }
  13883. }
  13884. }
  13885. function genHoists(hoists, context) {
  13886. if (!hoists.length) {
  13887. return;
  13888. }
  13889. context.pure = true;
  13890. const { push, newline, helper, scopeId, mode } = context;
  13891. newline();
  13892. for (let i = 0; i < hoists.length; i++) {
  13893. const exp = hoists[i];
  13894. if (exp) {
  13895. push(
  13896. `const _hoisted_${i + 1} = ${``}`
  13897. );
  13898. genNode(exp, context);
  13899. newline();
  13900. }
  13901. }
  13902. context.pure = false;
  13903. }
  13904. function isText(n) {
  13905. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  13906. }
  13907. function genNodeListAsArray(nodes, context) {
  13908. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  13909. context.push(`[`);
  13910. multilines && context.indent();
  13911. genNodeList(nodes, context, multilines);
  13912. multilines && context.deindent();
  13913. context.push(`]`);
  13914. }
  13915. function genNodeList(nodes, context, multilines = false, comma = true) {
  13916. const { push, newline } = context;
  13917. for (let i = 0; i < nodes.length; i++) {
  13918. const node = nodes[i];
  13919. if (isString(node)) {
  13920. push(node, -3 /* Unknown */);
  13921. } else if (isArray(node)) {
  13922. genNodeListAsArray(node, context);
  13923. } else {
  13924. genNode(node, context);
  13925. }
  13926. if (i < nodes.length - 1) {
  13927. if (multilines) {
  13928. comma && push(",");
  13929. newline();
  13930. } else {
  13931. comma && push(", ");
  13932. }
  13933. }
  13934. }
  13935. }
  13936. function genNode(node, context) {
  13937. if (isString(node)) {
  13938. context.push(node, -3 /* Unknown */);
  13939. return;
  13940. }
  13941. if (isSymbol(node)) {
  13942. context.push(context.helper(node));
  13943. return;
  13944. }
  13945. switch (node.type) {
  13946. case 1:
  13947. case 9:
  13948. case 11:
  13949. assert(
  13950. node.codegenNode != null,
  13951. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  13952. );
  13953. genNode(node.codegenNode, context);
  13954. break;
  13955. case 2:
  13956. genText(node, context);
  13957. break;
  13958. case 4:
  13959. genExpression(node, context);
  13960. break;
  13961. case 5:
  13962. genInterpolation(node, context);
  13963. break;
  13964. case 12:
  13965. genNode(node.codegenNode, context);
  13966. break;
  13967. case 8:
  13968. genCompoundExpression(node, context);
  13969. break;
  13970. case 3:
  13971. genComment(node, context);
  13972. break;
  13973. case 13:
  13974. genVNodeCall(node, context);
  13975. break;
  13976. case 14:
  13977. genCallExpression(node, context);
  13978. break;
  13979. case 15:
  13980. genObjectExpression(node, context);
  13981. break;
  13982. case 17:
  13983. genArrayExpression(node, context);
  13984. break;
  13985. case 18:
  13986. genFunctionExpression(node, context);
  13987. break;
  13988. case 19:
  13989. genConditionalExpression(node, context);
  13990. break;
  13991. case 20:
  13992. genCacheExpression(node, context);
  13993. break;
  13994. case 21:
  13995. genNodeList(node.body, context, true, false);
  13996. break;
  13997. case 22:
  13998. break;
  13999. case 23:
  14000. break;
  14001. case 24:
  14002. break;
  14003. case 25:
  14004. break;
  14005. case 26:
  14006. break;
  14007. case 10:
  14008. break;
  14009. default:
  14010. {
  14011. assert(false, `unhandled codegen node type: ${node.type}`);
  14012. const exhaustiveCheck = node;
  14013. return exhaustiveCheck;
  14014. }
  14015. }
  14016. }
  14017. function genText(node, context) {
  14018. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  14019. }
  14020. function genExpression(node, context) {
  14021. const { content, isStatic } = node;
  14022. context.push(
  14023. isStatic ? JSON.stringify(content) : content,
  14024. -3 /* Unknown */,
  14025. node
  14026. );
  14027. }
  14028. function genInterpolation(node, context) {
  14029. const { push, helper, pure } = context;
  14030. if (pure) push(PURE_ANNOTATION);
  14031. push(`${helper(TO_DISPLAY_STRING)}(`);
  14032. genNode(node.content, context);
  14033. push(`)`);
  14034. }
  14035. function genCompoundExpression(node, context) {
  14036. for (let i = 0; i < node.children.length; i++) {
  14037. const child = node.children[i];
  14038. if (isString(child)) {
  14039. context.push(child, -3 /* Unknown */);
  14040. } else {
  14041. genNode(child, context);
  14042. }
  14043. }
  14044. }
  14045. function genExpressionAsPropertyKey(node, context) {
  14046. const { push } = context;
  14047. if (node.type === 8) {
  14048. push(`[`);
  14049. genCompoundExpression(node, context);
  14050. push(`]`);
  14051. } else if (node.isStatic) {
  14052. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  14053. push(text, -2 /* None */, node);
  14054. } else {
  14055. push(`[${node.content}]`, -3 /* Unknown */, node);
  14056. }
  14057. }
  14058. function genComment(node, context) {
  14059. const { push, helper, pure } = context;
  14060. if (pure) {
  14061. push(PURE_ANNOTATION);
  14062. }
  14063. push(
  14064. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  14065. -3 /* Unknown */,
  14066. node
  14067. );
  14068. }
  14069. function genVNodeCall(node, context) {
  14070. const { push, helper, pure } = context;
  14071. const {
  14072. tag,
  14073. props,
  14074. children,
  14075. patchFlag,
  14076. dynamicProps,
  14077. directives,
  14078. isBlock,
  14079. disableTracking,
  14080. isComponent
  14081. } = node;
  14082. let patchFlagString;
  14083. if (patchFlag) {
  14084. {
  14085. if (patchFlag < 0) {
  14086. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  14087. } else {
  14088. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  14089. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  14090. }
  14091. }
  14092. }
  14093. if (directives) {
  14094. push(helper(WITH_DIRECTIVES) + `(`);
  14095. }
  14096. if (isBlock) {
  14097. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  14098. }
  14099. if (pure) {
  14100. push(PURE_ANNOTATION);
  14101. }
  14102. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  14103. push(helper(callHelper) + `(`, -2 /* None */, node);
  14104. genNodeList(
  14105. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  14106. context
  14107. );
  14108. push(`)`);
  14109. if (isBlock) {
  14110. push(`)`);
  14111. }
  14112. if (directives) {
  14113. push(`, `);
  14114. genNode(directives, context);
  14115. push(`)`);
  14116. }
  14117. }
  14118. function genNullableArgs(args) {
  14119. let i = args.length;
  14120. while (i--) {
  14121. if (args[i] != null) break;
  14122. }
  14123. return args.slice(0, i + 1).map((arg) => arg || `null`);
  14124. }
  14125. function genCallExpression(node, context) {
  14126. const { push, helper, pure } = context;
  14127. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  14128. if (pure) {
  14129. push(PURE_ANNOTATION);
  14130. }
  14131. push(callee + `(`, -2 /* None */, node);
  14132. genNodeList(node.arguments, context);
  14133. push(`)`);
  14134. }
  14135. function genObjectExpression(node, context) {
  14136. const { push, indent, deindent, newline } = context;
  14137. const { properties } = node;
  14138. if (!properties.length) {
  14139. push(`{}`, -2 /* None */, node);
  14140. return;
  14141. }
  14142. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  14143. push(multilines ? `{` : `{ `);
  14144. multilines && indent();
  14145. for (let i = 0; i < properties.length; i++) {
  14146. const { key, value } = properties[i];
  14147. genExpressionAsPropertyKey(key, context);
  14148. push(`: `);
  14149. genNode(value, context);
  14150. if (i < properties.length - 1) {
  14151. push(`,`);
  14152. newline();
  14153. }
  14154. }
  14155. multilines && deindent();
  14156. push(multilines ? `}` : ` }`);
  14157. }
  14158. function genArrayExpression(node, context) {
  14159. genNodeListAsArray(node.elements, context);
  14160. }
  14161. function genFunctionExpression(node, context) {
  14162. const { push, indent, deindent } = context;
  14163. const { params, returns, body, newline, isSlot } = node;
  14164. if (isSlot) {
  14165. push(`_${helperNameMap[WITH_CTX]}(`);
  14166. }
  14167. push(`(`, -2 /* None */, node);
  14168. if (isArray(params)) {
  14169. genNodeList(params, context);
  14170. } else if (params) {
  14171. genNode(params, context);
  14172. }
  14173. push(`) => `);
  14174. if (newline || body) {
  14175. push(`{`);
  14176. indent();
  14177. }
  14178. if (returns) {
  14179. if (newline) {
  14180. push(`return `);
  14181. }
  14182. if (isArray(returns)) {
  14183. genNodeListAsArray(returns, context);
  14184. } else {
  14185. genNode(returns, context);
  14186. }
  14187. } else if (body) {
  14188. genNode(body, context);
  14189. }
  14190. if (newline || body) {
  14191. deindent();
  14192. push(`}`);
  14193. }
  14194. if (isSlot) {
  14195. push(`)`);
  14196. }
  14197. }
  14198. function genConditionalExpression(node, context) {
  14199. const { test, consequent, alternate, newline: needNewline } = node;
  14200. const { push, indent, deindent, newline } = context;
  14201. if (test.type === 4) {
  14202. const needsParens = !isSimpleIdentifier(test.content);
  14203. needsParens && push(`(`);
  14204. genExpression(test, context);
  14205. needsParens && push(`)`);
  14206. } else {
  14207. push(`(`);
  14208. genNode(test, context);
  14209. push(`)`);
  14210. }
  14211. needNewline && indent();
  14212. context.indentLevel++;
  14213. needNewline || push(` `);
  14214. push(`? `);
  14215. genNode(consequent, context);
  14216. context.indentLevel--;
  14217. needNewline && newline();
  14218. needNewline || push(` `);
  14219. push(`: `);
  14220. const isNested = alternate.type === 19;
  14221. if (!isNested) {
  14222. context.indentLevel++;
  14223. }
  14224. genNode(alternate, context);
  14225. if (!isNested) {
  14226. context.indentLevel--;
  14227. }
  14228. needNewline && deindent(
  14229. true
  14230. /* without newline */
  14231. );
  14232. }
  14233. function genCacheExpression(node, context) {
  14234. const { push, helper, indent, deindent, newline } = context;
  14235. push(`_cache[${node.index}] || (`);
  14236. if (node.isVOnce) {
  14237. indent();
  14238. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  14239. newline();
  14240. push(`(`);
  14241. }
  14242. push(`_cache[${node.index}] = `);
  14243. genNode(node.value, context);
  14244. if (node.isVOnce) {
  14245. push(`).cacheIndex = ${node.index},`);
  14246. newline();
  14247. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  14248. newline();
  14249. push(`_cache[${node.index}]`);
  14250. deindent();
  14251. }
  14252. push(`)`);
  14253. }
  14254. const prohibitedKeywordRE = new RegExp(
  14255. "\\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"
  14256. );
  14257. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  14258. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  14259. const exp = node.content;
  14260. if (!exp.trim()) {
  14261. return;
  14262. }
  14263. try {
  14264. new Function(
  14265. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  14266. );
  14267. } catch (e) {
  14268. let message = e.message;
  14269. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  14270. if (keywordMatch) {
  14271. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  14272. }
  14273. context.onError(
  14274. createCompilerError(
  14275. 45,
  14276. node.loc,
  14277. void 0,
  14278. message
  14279. )
  14280. );
  14281. }
  14282. }
  14283. const transformExpression = (node, context) => {
  14284. if (node.type === 5) {
  14285. node.content = processExpression(
  14286. node.content,
  14287. context
  14288. );
  14289. } else if (node.type === 1) {
  14290. for (let i = 0; i < node.props.length; i++) {
  14291. const dir = node.props[i];
  14292. if (dir.type === 7 && dir.name !== "for") {
  14293. const exp = dir.exp;
  14294. const arg = dir.arg;
  14295. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  14296. dir.exp = processExpression(
  14297. exp,
  14298. context,
  14299. // slot args must be processed as function params
  14300. dir.name === "slot"
  14301. );
  14302. }
  14303. if (arg && arg.type === 4 && !arg.isStatic) {
  14304. dir.arg = processExpression(arg, context);
  14305. }
  14306. }
  14307. }
  14308. }
  14309. };
  14310. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  14311. {
  14312. {
  14313. validateBrowserExpression(node, context, asParams, asRawStatements);
  14314. }
  14315. return node;
  14316. }
  14317. }
  14318. const transformIf = createStructuralDirectiveTransform(
  14319. /^(if|else|else-if)$/,
  14320. (node, dir, context) => {
  14321. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  14322. const siblings = context.parent.children;
  14323. let i = siblings.indexOf(ifNode);
  14324. let key = 0;
  14325. while (i-- >= 0) {
  14326. const sibling = siblings[i];
  14327. if (sibling && sibling.type === 9) {
  14328. key += sibling.branches.length;
  14329. }
  14330. }
  14331. return () => {
  14332. if (isRoot) {
  14333. ifNode.codegenNode = createCodegenNodeForBranch(
  14334. branch,
  14335. key,
  14336. context
  14337. );
  14338. } else {
  14339. const parentCondition = getParentCondition(ifNode.codegenNode);
  14340. parentCondition.alternate = createCodegenNodeForBranch(
  14341. branch,
  14342. key + ifNode.branches.length - 1,
  14343. context
  14344. );
  14345. }
  14346. };
  14347. });
  14348. }
  14349. );
  14350. function processIf(node, dir, context, processCodegen) {
  14351. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  14352. const loc = dir.exp ? dir.exp.loc : node.loc;
  14353. context.onError(
  14354. createCompilerError(28, dir.loc)
  14355. );
  14356. dir.exp = createSimpleExpression(`true`, false, loc);
  14357. }
  14358. if (dir.exp) {
  14359. validateBrowserExpression(dir.exp, context);
  14360. }
  14361. if (dir.name === "if") {
  14362. const branch = createIfBranch(node, dir);
  14363. const ifNode = {
  14364. type: 9,
  14365. loc: node.loc,
  14366. branches: [branch]
  14367. };
  14368. context.replaceNode(ifNode);
  14369. if (processCodegen) {
  14370. return processCodegen(ifNode, branch, true);
  14371. }
  14372. } else {
  14373. const siblings = context.parent.children;
  14374. const comments = [];
  14375. let i = siblings.indexOf(node);
  14376. while (i-- >= -1) {
  14377. const sibling = siblings[i];
  14378. if (sibling && sibling.type === 3) {
  14379. context.removeNode(sibling);
  14380. comments.unshift(sibling);
  14381. continue;
  14382. }
  14383. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  14384. context.removeNode(sibling);
  14385. continue;
  14386. }
  14387. if (sibling && sibling.type === 9) {
  14388. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  14389. context.onError(
  14390. createCompilerError(30, node.loc)
  14391. );
  14392. }
  14393. context.removeNode();
  14394. const branch = createIfBranch(node, dir);
  14395. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  14396. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  14397. branch.children = [...comments, ...branch.children];
  14398. }
  14399. {
  14400. const key = branch.userKey;
  14401. if (key) {
  14402. sibling.branches.forEach(({ userKey }) => {
  14403. if (isSameKey(userKey, key)) {
  14404. context.onError(
  14405. createCompilerError(
  14406. 29,
  14407. branch.userKey.loc
  14408. )
  14409. );
  14410. }
  14411. });
  14412. }
  14413. }
  14414. sibling.branches.push(branch);
  14415. const onExit = processCodegen && processCodegen(sibling, branch, false);
  14416. traverseNode(branch, context);
  14417. if (onExit) onExit();
  14418. context.currentNode = null;
  14419. } else {
  14420. context.onError(
  14421. createCompilerError(30, node.loc)
  14422. );
  14423. }
  14424. break;
  14425. }
  14426. }
  14427. }
  14428. function createIfBranch(node, dir) {
  14429. const isTemplateIf = node.tagType === 3;
  14430. return {
  14431. type: 10,
  14432. loc: node.loc,
  14433. condition: dir.name === "else" ? void 0 : dir.exp,
  14434. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  14435. userKey: findProp(node, `key`),
  14436. isTemplateIf
  14437. };
  14438. }
  14439. function createCodegenNodeForBranch(branch, keyIndex, context) {
  14440. if (branch.condition) {
  14441. return createConditionalExpression(
  14442. branch.condition,
  14443. createChildrenCodegenNode(branch, keyIndex, context),
  14444. // make sure to pass in asBlock: true so that the comment node call
  14445. // closes the current block.
  14446. createCallExpression(context.helper(CREATE_COMMENT), [
  14447. '"v-if"' ,
  14448. "true"
  14449. ])
  14450. );
  14451. } else {
  14452. return createChildrenCodegenNode(branch, keyIndex, context);
  14453. }
  14454. }
  14455. function createChildrenCodegenNode(branch, keyIndex, context) {
  14456. const { helper } = context;
  14457. const keyProperty = createObjectProperty(
  14458. `key`,
  14459. createSimpleExpression(
  14460. `${keyIndex}`,
  14461. false,
  14462. locStub,
  14463. 2
  14464. )
  14465. );
  14466. const { children } = branch;
  14467. const firstChild = children[0];
  14468. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  14469. if (needFragmentWrapper) {
  14470. if (children.length === 1 && firstChild.type === 11) {
  14471. const vnodeCall = firstChild.codegenNode;
  14472. injectProp(vnodeCall, keyProperty, context);
  14473. return vnodeCall;
  14474. } else {
  14475. let patchFlag = 64;
  14476. let patchFlagText = PatchFlagNames[64];
  14477. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  14478. patchFlag |= 2048;
  14479. patchFlagText += `, ${PatchFlagNames[2048]}`;
  14480. }
  14481. return createVNodeCall(
  14482. context,
  14483. helper(FRAGMENT),
  14484. createObjectExpression([keyProperty]),
  14485. children,
  14486. patchFlag,
  14487. void 0,
  14488. void 0,
  14489. true,
  14490. false,
  14491. false,
  14492. branch.loc
  14493. );
  14494. }
  14495. } else {
  14496. const ret = firstChild.codegenNode;
  14497. const vnodeCall = getMemoedVNodeCall(ret);
  14498. if (vnodeCall.type === 13) {
  14499. convertToBlock(vnodeCall, context);
  14500. }
  14501. injectProp(vnodeCall, keyProperty, context);
  14502. return ret;
  14503. }
  14504. }
  14505. function isSameKey(a, b) {
  14506. if (!a || a.type !== b.type) {
  14507. return false;
  14508. }
  14509. if (a.type === 6) {
  14510. if (a.value.content !== b.value.content) {
  14511. return false;
  14512. }
  14513. } else {
  14514. const exp = a.exp;
  14515. const branchExp = b.exp;
  14516. if (exp.type !== branchExp.type) {
  14517. return false;
  14518. }
  14519. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  14520. return false;
  14521. }
  14522. }
  14523. return true;
  14524. }
  14525. function getParentCondition(node) {
  14526. while (true) {
  14527. if (node.type === 19) {
  14528. if (node.alternate.type === 19) {
  14529. node = node.alternate;
  14530. } else {
  14531. return node;
  14532. }
  14533. } else if (node.type === 20) {
  14534. node = node.value;
  14535. }
  14536. }
  14537. }
  14538. const transformBind = (dir, _node, context) => {
  14539. const { modifiers, loc } = dir;
  14540. const arg = dir.arg;
  14541. let { exp } = dir;
  14542. if (exp && exp.type === 4 && !exp.content.trim()) {
  14543. {
  14544. exp = void 0;
  14545. }
  14546. }
  14547. if (!exp) {
  14548. if (arg.type !== 4 || !arg.isStatic) {
  14549. context.onError(
  14550. createCompilerError(
  14551. 52,
  14552. arg.loc
  14553. )
  14554. );
  14555. return {
  14556. props: [
  14557. createObjectProperty(arg, createSimpleExpression("", true, loc))
  14558. ]
  14559. };
  14560. }
  14561. transformBindShorthand(dir);
  14562. exp = dir.exp;
  14563. }
  14564. if (arg.type !== 4) {
  14565. arg.children.unshift(`(`);
  14566. arg.children.push(`) || ""`);
  14567. } else if (!arg.isStatic) {
  14568. arg.content = `${arg.content} || ""`;
  14569. }
  14570. if (modifiers.includes("camel")) {
  14571. if (arg.type === 4) {
  14572. if (arg.isStatic) {
  14573. arg.content = camelize(arg.content);
  14574. } else {
  14575. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  14576. }
  14577. } else {
  14578. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  14579. arg.children.push(`)`);
  14580. }
  14581. }
  14582. if (!context.inSSR) {
  14583. if (modifiers.includes("prop")) {
  14584. injectPrefix(arg, ".");
  14585. }
  14586. if (modifiers.includes("attr")) {
  14587. injectPrefix(arg, "^");
  14588. }
  14589. }
  14590. return {
  14591. props: [createObjectProperty(arg, exp)]
  14592. };
  14593. };
  14594. const transformBindShorthand = (dir, context) => {
  14595. const arg = dir.arg;
  14596. const propName = camelize(arg.content);
  14597. dir.exp = createSimpleExpression(propName, false, arg.loc);
  14598. };
  14599. const injectPrefix = (arg, prefix) => {
  14600. if (arg.type === 4) {
  14601. if (arg.isStatic) {
  14602. arg.content = prefix + arg.content;
  14603. } else {
  14604. arg.content = `\`${prefix}\${${arg.content}}\``;
  14605. }
  14606. } else {
  14607. arg.children.unshift(`'${prefix}' + (`);
  14608. arg.children.push(`)`);
  14609. }
  14610. };
  14611. const transformFor = createStructuralDirectiveTransform(
  14612. "for",
  14613. (node, dir, context) => {
  14614. const { helper, removeHelper } = context;
  14615. return processFor(node, dir, context, (forNode) => {
  14616. const renderExp = createCallExpression(helper(RENDER_LIST), [
  14617. forNode.source
  14618. ]);
  14619. const isTemplate = isTemplateNode(node);
  14620. const memo = findDir(node, "memo");
  14621. const keyProp = findProp(node, `key`, false, true);
  14622. if (keyProp && keyProp.type === 7 && !keyProp.exp) {
  14623. transformBindShorthand(keyProp);
  14624. }
  14625. const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  14626. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  14627. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  14628. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  14629. forNode.codegenNode = createVNodeCall(
  14630. context,
  14631. helper(FRAGMENT),
  14632. void 0,
  14633. renderExp,
  14634. fragmentFlag,
  14635. void 0,
  14636. void 0,
  14637. true,
  14638. !isStableFragment,
  14639. false,
  14640. node.loc
  14641. );
  14642. return () => {
  14643. let childBlock;
  14644. const { children } = forNode;
  14645. if (isTemplate) {
  14646. node.children.some((c) => {
  14647. if (c.type === 1) {
  14648. const key = findProp(c, "key");
  14649. if (key) {
  14650. context.onError(
  14651. createCompilerError(
  14652. 33,
  14653. key.loc
  14654. )
  14655. );
  14656. return true;
  14657. }
  14658. }
  14659. });
  14660. }
  14661. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  14662. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  14663. if (slotOutlet) {
  14664. childBlock = slotOutlet.codegenNode;
  14665. if (isTemplate && keyProperty) {
  14666. injectProp(childBlock, keyProperty, context);
  14667. }
  14668. } else if (needFragmentWrapper) {
  14669. childBlock = createVNodeCall(
  14670. context,
  14671. helper(FRAGMENT),
  14672. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  14673. node.children,
  14674. 64,
  14675. void 0,
  14676. void 0,
  14677. true,
  14678. void 0,
  14679. false
  14680. );
  14681. } else {
  14682. childBlock = children[0].codegenNode;
  14683. if (isTemplate && keyProperty) {
  14684. injectProp(childBlock, keyProperty, context);
  14685. }
  14686. if (childBlock.isBlock !== !isStableFragment) {
  14687. if (childBlock.isBlock) {
  14688. removeHelper(OPEN_BLOCK);
  14689. removeHelper(
  14690. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  14691. );
  14692. } else {
  14693. removeHelper(
  14694. getVNodeHelper(context.inSSR, childBlock.isComponent)
  14695. );
  14696. }
  14697. }
  14698. childBlock.isBlock = !isStableFragment;
  14699. if (childBlock.isBlock) {
  14700. helper(OPEN_BLOCK);
  14701. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  14702. } else {
  14703. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  14704. }
  14705. }
  14706. if (memo) {
  14707. const loop = createFunctionExpression(
  14708. createForLoopParams(forNode.parseResult, [
  14709. createSimpleExpression(`_cached`)
  14710. ])
  14711. );
  14712. loop.body = createBlockStatement([
  14713. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  14714. createCompoundExpression([
  14715. `if (_cached`,
  14716. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  14717. ` && ${context.helperString(
  14718. IS_MEMO_SAME
  14719. )}(_cached, _memo)) return _cached`
  14720. ]),
  14721. createCompoundExpression([`const _item = `, childBlock]),
  14722. createSimpleExpression(`_item.memo = _memo`),
  14723. createSimpleExpression(`return _item`)
  14724. ]);
  14725. renderExp.arguments.push(
  14726. loop,
  14727. createSimpleExpression(`_cache`),
  14728. createSimpleExpression(String(context.cached++))
  14729. );
  14730. } else {
  14731. renderExp.arguments.push(
  14732. createFunctionExpression(
  14733. createForLoopParams(forNode.parseResult),
  14734. childBlock,
  14735. true
  14736. )
  14737. );
  14738. }
  14739. };
  14740. });
  14741. }
  14742. );
  14743. function processFor(node, dir, context, processCodegen) {
  14744. if (!dir.exp) {
  14745. context.onError(
  14746. createCompilerError(31, dir.loc)
  14747. );
  14748. return;
  14749. }
  14750. const parseResult = dir.forParseResult;
  14751. if (!parseResult) {
  14752. context.onError(
  14753. createCompilerError(32, dir.loc)
  14754. );
  14755. return;
  14756. }
  14757. finalizeForParseResult(parseResult, context);
  14758. const { addIdentifiers, removeIdentifiers, scopes } = context;
  14759. const { source, value, key, index } = parseResult;
  14760. const forNode = {
  14761. type: 11,
  14762. loc: dir.loc,
  14763. source,
  14764. valueAlias: value,
  14765. keyAlias: key,
  14766. objectIndexAlias: index,
  14767. parseResult,
  14768. children: isTemplateNode(node) ? node.children : [node]
  14769. };
  14770. context.replaceNode(forNode);
  14771. scopes.vFor++;
  14772. const onExit = processCodegen && processCodegen(forNode);
  14773. return () => {
  14774. scopes.vFor--;
  14775. if (onExit) onExit();
  14776. };
  14777. }
  14778. function finalizeForParseResult(result, context) {
  14779. if (result.finalized) return;
  14780. {
  14781. validateBrowserExpression(result.source, context);
  14782. if (result.key) {
  14783. validateBrowserExpression(
  14784. result.key,
  14785. context,
  14786. true
  14787. );
  14788. }
  14789. if (result.index) {
  14790. validateBrowserExpression(
  14791. result.index,
  14792. context,
  14793. true
  14794. );
  14795. }
  14796. if (result.value) {
  14797. validateBrowserExpression(
  14798. result.value,
  14799. context,
  14800. true
  14801. );
  14802. }
  14803. }
  14804. result.finalized = true;
  14805. }
  14806. function createForLoopParams({ value, key, index }, memoArgs = []) {
  14807. return createParamsList([value, key, index, ...memoArgs]);
  14808. }
  14809. function createParamsList(args) {
  14810. let i = args.length;
  14811. while (i--) {
  14812. if (args[i]) break;
  14813. }
  14814. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  14815. }
  14816. const defaultFallback = createSimpleExpression(`undefined`, false);
  14817. const trackSlotScopes = (node, context) => {
  14818. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  14819. const vSlot = findDir(node, "slot");
  14820. if (vSlot) {
  14821. vSlot.exp;
  14822. context.scopes.vSlot++;
  14823. return () => {
  14824. context.scopes.vSlot--;
  14825. };
  14826. }
  14827. }
  14828. };
  14829. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  14830. props,
  14831. children,
  14832. false,
  14833. true,
  14834. children.length ? children[0].loc : loc
  14835. );
  14836. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  14837. context.helper(WITH_CTX);
  14838. const { children, loc } = node;
  14839. const slotsProperties = [];
  14840. const dynamicSlots = [];
  14841. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  14842. const onComponentSlot = findDir(node, "slot", true);
  14843. if (onComponentSlot) {
  14844. const { arg, exp } = onComponentSlot;
  14845. if (arg && !isStaticExp(arg)) {
  14846. hasDynamicSlots = true;
  14847. }
  14848. slotsProperties.push(
  14849. createObjectProperty(
  14850. arg || createSimpleExpression("default", true),
  14851. buildSlotFn(exp, void 0, children, loc)
  14852. )
  14853. );
  14854. }
  14855. let hasTemplateSlots = false;
  14856. let hasNamedDefaultSlot = false;
  14857. const implicitDefaultChildren = [];
  14858. const seenSlotNames = /* @__PURE__ */ new Set();
  14859. let conditionalBranchIndex = 0;
  14860. for (let i = 0; i < children.length; i++) {
  14861. const slotElement = children[i];
  14862. let slotDir;
  14863. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  14864. if (slotElement.type !== 3) {
  14865. implicitDefaultChildren.push(slotElement);
  14866. }
  14867. continue;
  14868. }
  14869. if (onComponentSlot) {
  14870. context.onError(
  14871. createCompilerError(37, slotDir.loc)
  14872. );
  14873. break;
  14874. }
  14875. hasTemplateSlots = true;
  14876. const { children: slotChildren, loc: slotLoc } = slotElement;
  14877. const {
  14878. arg: slotName = createSimpleExpression(`default`, true),
  14879. exp: slotProps,
  14880. loc: dirLoc
  14881. } = slotDir;
  14882. let staticSlotName;
  14883. if (isStaticExp(slotName)) {
  14884. staticSlotName = slotName ? slotName.content : `default`;
  14885. } else {
  14886. hasDynamicSlots = true;
  14887. }
  14888. const vFor = findDir(slotElement, "for");
  14889. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  14890. let vIf;
  14891. let vElse;
  14892. if (vIf = findDir(slotElement, "if")) {
  14893. hasDynamicSlots = true;
  14894. dynamicSlots.push(
  14895. createConditionalExpression(
  14896. vIf.exp,
  14897. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  14898. defaultFallback
  14899. )
  14900. );
  14901. } else if (vElse = findDir(
  14902. slotElement,
  14903. /^else(-if)?$/,
  14904. true
  14905. /* allowEmpty */
  14906. )) {
  14907. let j = i;
  14908. let prev;
  14909. while (j--) {
  14910. prev = children[j];
  14911. if (prev.type !== 3) {
  14912. break;
  14913. }
  14914. }
  14915. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  14916. let conditional = dynamicSlots[dynamicSlots.length - 1];
  14917. while (conditional.alternate.type === 19) {
  14918. conditional = conditional.alternate;
  14919. }
  14920. conditional.alternate = vElse.exp ? createConditionalExpression(
  14921. vElse.exp,
  14922. buildDynamicSlot(
  14923. slotName,
  14924. slotFunction,
  14925. conditionalBranchIndex++
  14926. ),
  14927. defaultFallback
  14928. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  14929. } else {
  14930. context.onError(
  14931. createCompilerError(30, vElse.loc)
  14932. );
  14933. }
  14934. } else if (vFor) {
  14935. hasDynamicSlots = true;
  14936. const parseResult = vFor.forParseResult;
  14937. if (parseResult) {
  14938. finalizeForParseResult(parseResult, context);
  14939. dynamicSlots.push(
  14940. createCallExpression(context.helper(RENDER_LIST), [
  14941. parseResult.source,
  14942. createFunctionExpression(
  14943. createForLoopParams(parseResult),
  14944. buildDynamicSlot(slotName, slotFunction),
  14945. true
  14946. )
  14947. ])
  14948. );
  14949. } else {
  14950. context.onError(
  14951. createCompilerError(
  14952. 32,
  14953. vFor.loc
  14954. )
  14955. );
  14956. }
  14957. } else {
  14958. if (staticSlotName) {
  14959. if (seenSlotNames.has(staticSlotName)) {
  14960. context.onError(
  14961. createCompilerError(
  14962. 38,
  14963. dirLoc
  14964. )
  14965. );
  14966. continue;
  14967. }
  14968. seenSlotNames.add(staticSlotName);
  14969. if (staticSlotName === "default") {
  14970. hasNamedDefaultSlot = true;
  14971. }
  14972. }
  14973. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  14974. }
  14975. }
  14976. if (!onComponentSlot) {
  14977. const buildDefaultSlotProperty = (props, children2) => {
  14978. const fn = buildSlotFn(props, void 0, children2, loc);
  14979. return createObjectProperty(`default`, fn);
  14980. };
  14981. if (!hasTemplateSlots) {
  14982. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  14983. } else if (implicitDefaultChildren.length && // #3766
  14984. // with whitespace: 'preserve', whitespaces between slots will end up in
  14985. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  14986. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  14987. if (hasNamedDefaultSlot) {
  14988. context.onError(
  14989. createCompilerError(
  14990. 39,
  14991. implicitDefaultChildren[0].loc
  14992. )
  14993. );
  14994. } else {
  14995. slotsProperties.push(
  14996. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  14997. );
  14998. }
  14999. }
  15000. }
  15001. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  15002. let slots = createObjectExpression(
  15003. slotsProperties.concat(
  15004. createObjectProperty(
  15005. `_`,
  15006. // 2 = compiled but dynamic = can skip normalization, but must run diff
  15007. // 1 = compiled and static = can skip normalization AND diff as optimized
  15008. createSimpleExpression(
  15009. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  15010. false
  15011. )
  15012. )
  15013. ),
  15014. loc
  15015. );
  15016. if (dynamicSlots.length) {
  15017. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  15018. slots,
  15019. createArrayExpression(dynamicSlots)
  15020. ]);
  15021. }
  15022. return {
  15023. slots,
  15024. hasDynamicSlots
  15025. };
  15026. }
  15027. function buildDynamicSlot(name, fn, index) {
  15028. const props = [
  15029. createObjectProperty(`name`, name),
  15030. createObjectProperty(`fn`, fn)
  15031. ];
  15032. if (index != null) {
  15033. props.push(
  15034. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  15035. );
  15036. }
  15037. return createObjectExpression(props);
  15038. }
  15039. function hasForwardedSlots(children) {
  15040. for (let i = 0; i < children.length; i++) {
  15041. const child = children[i];
  15042. switch (child.type) {
  15043. case 1:
  15044. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  15045. return true;
  15046. }
  15047. break;
  15048. case 9:
  15049. if (hasForwardedSlots(child.branches)) return true;
  15050. break;
  15051. case 10:
  15052. case 11:
  15053. if (hasForwardedSlots(child.children)) return true;
  15054. break;
  15055. }
  15056. }
  15057. return false;
  15058. }
  15059. function isNonWhitespaceContent(node) {
  15060. if (node.type !== 2 && node.type !== 12)
  15061. return true;
  15062. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  15063. }
  15064. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  15065. const transformElement = (node, context) => {
  15066. return function postTransformElement() {
  15067. node = context.currentNode;
  15068. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  15069. return;
  15070. }
  15071. const { tag, props } = node;
  15072. const isComponent = node.tagType === 1;
  15073. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  15074. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  15075. let vnodeProps;
  15076. let vnodeChildren;
  15077. let patchFlag = 0;
  15078. let vnodeDynamicProps;
  15079. let dynamicPropNames;
  15080. let vnodeDirectives;
  15081. let shouldUseBlock = (
  15082. // dynamic component may resolve to plain elements
  15083. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  15084. // updates inside get proper isSVG flag at runtime. (#639, #643)
  15085. // This is technically web-specific, but splitting the logic out of core
  15086. // leads to too much unnecessary complexity.
  15087. (tag === "svg" || tag === "foreignObject" || tag === "math")
  15088. );
  15089. if (props.length > 0) {
  15090. const propsBuildResult = buildProps(
  15091. node,
  15092. context,
  15093. void 0,
  15094. isComponent,
  15095. isDynamicComponent
  15096. );
  15097. vnodeProps = propsBuildResult.props;
  15098. patchFlag = propsBuildResult.patchFlag;
  15099. dynamicPropNames = propsBuildResult.dynamicPropNames;
  15100. const directives = propsBuildResult.directives;
  15101. vnodeDirectives = directives && directives.length ? createArrayExpression(
  15102. directives.map((dir) => buildDirectiveArgs(dir, context))
  15103. ) : void 0;
  15104. if (propsBuildResult.shouldUseBlock) {
  15105. shouldUseBlock = true;
  15106. }
  15107. }
  15108. if (node.children.length > 0) {
  15109. if (vnodeTag === KEEP_ALIVE) {
  15110. shouldUseBlock = true;
  15111. patchFlag |= 1024;
  15112. if (node.children.length > 1) {
  15113. context.onError(
  15114. createCompilerError(46, {
  15115. start: node.children[0].loc.start,
  15116. end: node.children[node.children.length - 1].loc.end,
  15117. source: ""
  15118. })
  15119. );
  15120. }
  15121. }
  15122. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  15123. vnodeTag !== TELEPORT && // explained above.
  15124. vnodeTag !== KEEP_ALIVE;
  15125. if (shouldBuildAsSlots) {
  15126. const { slots, hasDynamicSlots } = buildSlots(node, context);
  15127. vnodeChildren = slots;
  15128. if (hasDynamicSlots) {
  15129. patchFlag |= 1024;
  15130. }
  15131. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  15132. const child = node.children[0];
  15133. const type = child.type;
  15134. const hasDynamicTextChild = type === 5 || type === 8;
  15135. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  15136. patchFlag |= 1;
  15137. }
  15138. if (hasDynamicTextChild || type === 2) {
  15139. vnodeChildren = child;
  15140. } else {
  15141. vnodeChildren = node.children;
  15142. }
  15143. } else {
  15144. vnodeChildren = node.children;
  15145. }
  15146. }
  15147. if (dynamicPropNames && dynamicPropNames.length) {
  15148. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  15149. }
  15150. node.codegenNode = createVNodeCall(
  15151. context,
  15152. vnodeTag,
  15153. vnodeProps,
  15154. vnodeChildren,
  15155. patchFlag === 0 ? void 0 : patchFlag,
  15156. vnodeDynamicProps,
  15157. vnodeDirectives,
  15158. !!shouldUseBlock,
  15159. false,
  15160. isComponent,
  15161. node.loc
  15162. );
  15163. };
  15164. };
  15165. function resolveComponentType(node, context, ssr = false) {
  15166. let { tag } = node;
  15167. const isExplicitDynamic = isComponentTag(tag);
  15168. const isProp = findProp(
  15169. node,
  15170. "is",
  15171. false,
  15172. true
  15173. /* allow empty */
  15174. );
  15175. if (isProp) {
  15176. if (isExplicitDynamic || false) {
  15177. let exp;
  15178. if (isProp.type === 6) {
  15179. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  15180. } else {
  15181. exp = isProp.exp;
  15182. if (!exp) {
  15183. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  15184. }
  15185. }
  15186. if (exp) {
  15187. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  15188. exp
  15189. ]);
  15190. }
  15191. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  15192. tag = isProp.value.content.slice(4);
  15193. }
  15194. }
  15195. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  15196. if (builtIn) {
  15197. if (!ssr) context.helper(builtIn);
  15198. return builtIn;
  15199. }
  15200. context.helper(RESOLVE_COMPONENT);
  15201. context.components.add(tag);
  15202. return toValidAssetId(tag, `component`);
  15203. }
  15204. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  15205. const { tag, loc: elementLoc, children } = node;
  15206. let properties = [];
  15207. const mergeArgs = [];
  15208. const runtimeDirectives = [];
  15209. const hasChildren = children.length > 0;
  15210. let shouldUseBlock = false;
  15211. let patchFlag = 0;
  15212. let hasRef = false;
  15213. let hasClassBinding = false;
  15214. let hasStyleBinding = false;
  15215. let hasHydrationEventBinding = false;
  15216. let hasDynamicKeys = false;
  15217. let hasVnodeHook = false;
  15218. const dynamicPropNames = [];
  15219. const pushMergeArg = (arg) => {
  15220. if (properties.length) {
  15221. mergeArgs.push(
  15222. createObjectExpression(dedupeProperties(properties), elementLoc)
  15223. );
  15224. properties = [];
  15225. }
  15226. if (arg) mergeArgs.push(arg);
  15227. };
  15228. const pushRefVForMarker = () => {
  15229. if (context.scopes.vFor > 0) {
  15230. properties.push(
  15231. createObjectProperty(
  15232. createSimpleExpression("ref_for", true),
  15233. createSimpleExpression("true")
  15234. )
  15235. );
  15236. }
  15237. };
  15238. const analyzePatchFlag = ({ key, value }) => {
  15239. if (isStaticExp(key)) {
  15240. const name = key.content;
  15241. const isEventHandler = isOn(name);
  15242. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  15243. // dedicated fast path.
  15244. name.toLowerCase() !== "onclick" && // omit v-model handlers
  15245. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  15246. !isReservedProp(name)) {
  15247. hasHydrationEventBinding = true;
  15248. }
  15249. if (isEventHandler && isReservedProp(name)) {
  15250. hasVnodeHook = true;
  15251. }
  15252. if (isEventHandler && value.type === 14) {
  15253. value = value.arguments[0];
  15254. }
  15255. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  15256. return;
  15257. }
  15258. if (name === "ref") {
  15259. hasRef = true;
  15260. } else if (name === "class") {
  15261. hasClassBinding = true;
  15262. } else if (name === "style") {
  15263. hasStyleBinding = true;
  15264. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  15265. dynamicPropNames.push(name);
  15266. }
  15267. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  15268. dynamicPropNames.push(name);
  15269. }
  15270. } else {
  15271. hasDynamicKeys = true;
  15272. }
  15273. };
  15274. for (let i = 0; i < props.length; i++) {
  15275. const prop = props[i];
  15276. if (prop.type === 6) {
  15277. const { loc, name, nameLoc, value } = prop;
  15278. let isStatic = true;
  15279. if (name === "ref") {
  15280. hasRef = true;
  15281. pushRefVForMarker();
  15282. }
  15283. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  15284. continue;
  15285. }
  15286. properties.push(
  15287. createObjectProperty(
  15288. createSimpleExpression(name, true, nameLoc),
  15289. createSimpleExpression(
  15290. value ? value.content : "",
  15291. isStatic,
  15292. value ? value.loc : loc
  15293. )
  15294. )
  15295. );
  15296. } else {
  15297. const { name, arg, exp, loc, modifiers } = prop;
  15298. const isVBind = name === "bind";
  15299. const isVOn = name === "on";
  15300. if (name === "slot") {
  15301. if (!isComponent) {
  15302. context.onError(
  15303. createCompilerError(40, loc)
  15304. );
  15305. }
  15306. continue;
  15307. }
  15308. if (name === "once" || name === "memo") {
  15309. continue;
  15310. }
  15311. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  15312. continue;
  15313. }
  15314. if (isVOn && ssr) {
  15315. continue;
  15316. }
  15317. if (
  15318. // #938: elements with dynamic keys should be forced into blocks
  15319. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  15320. // before children
  15321. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  15322. ) {
  15323. shouldUseBlock = true;
  15324. }
  15325. if (isVBind && isStaticArgOf(arg, "ref")) {
  15326. pushRefVForMarker();
  15327. }
  15328. if (!arg && (isVBind || isVOn)) {
  15329. hasDynamicKeys = true;
  15330. if (exp) {
  15331. if (isVBind) {
  15332. pushRefVForMarker();
  15333. pushMergeArg();
  15334. mergeArgs.push(exp);
  15335. } else {
  15336. pushMergeArg({
  15337. type: 14,
  15338. loc,
  15339. callee: context.helper(TO_HANDLERS),
  15340. arguments: isComponent ? [exp] : [exp, `true`]
  15341. });
  15342. }
  15343. } else {
  15344. context.onError(
  15345. createCompilerError(
  15346. isVBind ? 34 : 35,
  15347. loc
  15348. )
  15349. );
  15350. }
  15351. continue;
  15352. }
  15353. if (isVBind && modifiers.includes("prop")) {
  15354. patchFlag |= 32;
  15355. }
  15356. const directiveTransform = context.directiveTransforms[name];
  15357. if (directiveTransform) {
  15358. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  15359. !ssr && props2.forEach(analyzePatchFlag);
  15360. if (isVOn && arg && !isStaticExp(arg)) {
  15361. pushMergeArg(createObjectExpression(props2, elementLoc));
  15362. } else {
  15363. properties.push(...props2);
  15364. }
  15365. if (needRuntime) {
  15366. runtimeDirectives.push(prop);
  15367. if (isSymbol(needRuntime)) {
  15368. directiveImportMap.set(prop, needRuntime);
  15369. }
  15370. }
  15371. } else if (!isBuiltInDirective(name)) {
  15372. runtimeDirectives.push(prop);
  15373. if (hasChildren) {
  15374. shouldUseBlock = true;
  15375. }
  15376. }
  15377. }
  15378. }
  15379. let propsExpression = void 0;
  15380. if (mergeArgs.length) {
  15381. pushMergeArg();
  15382. if (mergeArgs.length > 1) {
  15383. propsExpression = createCallExpression(
  15384. context.helper(MERGE_PROPS),
  15385. mergeArgs,
  15386. elementLoc
  15387. );
  15388. } else {
  15389. propsExpression = mergeArgs[0];
  15390. }
  15391. } else if (properties.length) {
  15392. propsExpression = createObjectExpression(
  15393. dedupeProperties(properties),
  15394. elementLoc
  15395. );
  15396. }
  15397. if (hasDynamicKeys) {
  15398. patchFlag |= 16;
  15399. } else {
  15400. if (hasClassBinding && !isComponent) {
  15401. patchFlag |= 2;
  15402. }
  15403. if (hasStyleBinding && !isComponent) {
  15404. patchFlag |= 4;
  15405. }
  15406. if (dynamicPropNames.length) {
  15407. patchFlag |= 8;
  15408. }
  15409. if (hasHydrationEventBinding) {
  15410. patchFlag |= 32;
  15411. }
  15412. }
  15413. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  15414. patchFlag |= 512;
  15415. }
  15416. if (!context.inSSR && propsExpression) {
  15417. switch (propsExpression.type) {
  15418. case 15:
  15419. let classKeyIndex = -1;
  15420. let styleKeyIndex = -1;
  15421. let hasDynamicKey = false;
  15422. for (let i = 0; i < propsExpression.properties.length; i++) {
  15423. const key = propsExpression.properties[i].key;
  15424. if (isStaticExp(key)) {
  15425. if (key.content === "class") {
  15426. classKeyIndex = i;
  15427. } else if (key.content === "style") {
  15428. styleKeyIndex = i;
  15429. }
  15430. } else if (!key.isHandlerKey) {
  15431. hasDynamicKey = true;
  15432. }
  15433. }
  15434. const classProp = propsExpression.properties[classKeyIndex];
  15435. const styleProp = propsExpression.properties[styleKeyIndex];
  15436. if (!hasDynamicKey) {
  15437. if (classProp && !isStaticExp(classProp.value)) {
  15438. classProp.value = createCallExpression(
  15439. context.helper(NORMALIZE_CLASS),
  15440. [classProp.value]
  15441. );
  15442. }
  15443. if (styleProp && // the static style is compiled into an object,
  15444. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  15445. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  15446. // v-bind:style with static literal object
  15447. styleProp.value.type === 17)) {
  15448. styleProp.value = createCallExpression(
  15449. context.helper(NORMALIZE_STYLE),
  15450. [styleProp.value]
  15451. );
  15452. }
  15453. } else {
  15454. propsExpression = createCallExpression(
  15455. context.helper(NORMALIZE_PROPS),
  15456. [propsExpression]
  15457. );
  15458. }
  15459. break;
  15460. case 14:
  15461. break;
  15462. default:
  15463. propsExpression = createCallExpression(
  15464. context.helper(NORMALIZE_PROPS),
  15465. [
  15466. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  15467. propsExpression
  15468. ])
  15469. ]
  15470. );
  15471. break;
  15472. }
  15473. }
  15474. return {
  15475. props: propsExpression,
  15476. directives: runtimeDirectives,
  15477. patchFlag,
  15478. dynamicPropNames,
  15479. shouldUseBlock
  15480. };
  15481. }
  15482. function dedupeProperties(properties) {
  15483. const knownProps = /* @__PURE__ */ new Map();
  15484. const deduped = [];
  15485. for (let i = 0; i < properties.length; i++) {
  15486. const prop = properties[i];
  15487. if (prop.key.type === 8 || !prop.key.isStatic) {
  15488. deduped.push(prop);
  15489. continue;
  15490. }
  15491. const name = prop.key.content;
  15492. const existing = knownProps.get(name);
  15493. if (existing) {
  15494. if (name === "style" || name === "class" || isOn(name)) {
  15495. mergeAsArray(existing, prop);
  15496. }
  15497. } else {
  15498. knownProps.set(name, prop);
  15499. deduped.push(prop);
  15500. }
  15501. }
  15502. return deduped;
  15503. }
  15504. function mergeAsArray(existing, incoming) {
  15505. if (existing.value.type === 17) {
  15506. existing.value.elements.push(incoming.value);
  15507. } else {
  15508. existing.value = createArrayExpression(
  15509. [existing.value, incoming.value],
  15510. existing.loc
  15511. );
  15512. }
  15513. }
  15514. function buildDirectiveArgs(dir, context) {
  15515. const dirArgs = [];
  15516. const runtime = directiveImportMap.get(dir);
  15517. if (runtime) {
  15518. dirArgs.push(context.helperString(runtime));
  15519. } else {
  15520. {
  15521. context.helper(RESOLVE_DIRECTIVE);
  15522. context.directives.add(dir.name);
  15523. dirArgs.push(toValidAssetId(dir.name, `directive`));
  15524. }
  15525. }
  15526. const { loc } = dir;
  15527. if (dir.exp) dirArgs.push(dir.exp);
  15528. if (dir.arg) {
  15529. if (!dir.exp) {
  15530. dirArgs.push(`void 0`);
  15531. }
  15532. dirArgs.push(dir.arg);
  15533. }
  15534. if (Object.keys(dir.modifiers).length) {
  15535. if (!dir.arg) {
  15536. if (!dir.exp) {
  15537. dirArgs.push(`void 0`);
  15538. }
  15539. dirArgs.push(`void 0`);
  15540. }
  15541. const trueExpression = createSimpleExpression(`true`, false, loc);
  15542. dirArgs.push(
  15543. createObjectExpression(
  15544. dir.modifiers.map(
  15545. (modifier) => createObjectProperty(modifier, trueExpression)
  15546. ),
  15547. loc
  15548. )
  15549. );
  15550. }
  15551. return createArrayExpression(dirArgs, dir.loc);
  15552. }
  15553. function stringifyDynamicPropNames(props) {
  15554. let propsNamesString = `[`;
  15555. for (let i = 0, l = props.length; i < l; i++) {
  15556. propsNamesString += JSON.stringify(props[i]);
  15557. if (i < l - 1) propsNamesString += ", ";
  15558. }
  15559. return propsNamesString + `]`;
  15560. }
  15561. function isComponentTag(tag) {
  15562. return tag === "component" || tag === "Component";
  15563. }
  15564. const transformSlotOutlet = (node, context) => {
  15565. if (isSlotOutlet(node)) {
  15566. const { children, loc } = node;
  15567. const { slotName, slotProps } = processSlotOutlet(node, context);
  15568. const slotArgs = [
  15569. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  15570. slotName,
  15571. "{}",
  15572. "undefined",
  15573. "true"
  15574. ];
  15575. let expectedLen = 2;
  15576. if (slotProps) {
  15577. slotArgs[2] = slotProps;
  15578. expectedLen = 3;
  15579. }
  15580. if (children.length) {
  15581. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  15582. expectedLen = 4;
  15583. }
  15584. if (context.scopeId && !context.slotted) {
  15585. expectedLen = 5;
  15586. }
  15587. slotArgs.splice(expectedLen);
  15588. node.codegenNode = createCallExpression(
  15589. context.helper(RENDER_SLOT),
  15590. slotArgs,
  15591. loc
  15592. );
  15593. }
  15594. };
  15595. function processSlotOutlet(node, context) {
  15596. let slotName = `"default"`;
  15597. let slotProps = void 0;
  15598. const nonNameProps = [];
  15599. for (let i = 0; i < node.props.length; i++) {
  15600. const p = node.props[i];
  15601. if (p.type === 6) {
  15602. if (p.value) {
  15603. if (p.name === "name") {
  15604. slotName = JSON.stringify(p.value.content);
  15605. } else {
  15606. p.name = camelize(p.name);
  15607. nonNameProps.push(p);
  15608. }
  15609. }
  15610. } else {
  15611. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  15612. if (p.exp) {
  15613. slotName = p.exp;
  15614. } else if (p.arg && p.arg.type === 4) {
  15615. const name = camelize(p.arg.content);
  15616. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  15617. }
  15618. } else {
  15619. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  15620. p.arg.content = camelize(p.arg.content);
  15621. }
  15622. nonNameProps.push(p);
  15623. }
  15624. }
  15625. }
  15626. if (nonNameProps.length > 0) {
  15627. const { props, directives } = buildProps(
  15628. node,
  15629. context,
  15630. nonNameProps,
  15631. false,
  15632. false
  15633. );
  15634. slotProps = props;
  15635. if (directives.length) {
  15636. context.onError(
  15637. createCompilerError(
  15638. 36,
  15639. directives[0].loc
  15640. )
  15641. );
  15642. }
  15643. }
  15644. return {
  15645. slotName,
  15646. slotProps
  15647. };
  15648. }
  15649. const transformOn$1 = (dir, node, context, augmentor) => {
  15650. const { loc, modifiers, arg } = dir;
  15651. if (!dir.exp && !modifiers.length) {
  15652. context.onError(createCompilerError(35, loc));
  15653. }
  15654. let eventName;
  15655. if (arg.type === 4) {
  15656. if (arg.isStatic) {
  15657. let rawName = arg.content;
  15658. if (rawName.startsWith("vnode")) {
  15659. context.onError(createCompilerError(51, arg.loc));
  15660. }
  15661. if (rawName.startsWith("vue:")) {
  15662. rawName = `vnode-${rawName.slice(4)}`;
  15663. }
  15664. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  15665. // for non-element and vnode lifecycle event listeners, auto convert
  15666. // it to camelCase. See issue #2249
  15667. toHandlerKey(camelize(rawName))
  15668. ) : (
  15669. // preserve case for plain element listeners that have uppercase
  15670. // letters, as these may be custom elements' custom events
  15671. `on:${rawName}`
  15672. );
  15673. eventName = createSimpleExpression(eventString, true, arg.loc);
  15674. } else {
  15675. eventName = createCompoundExpression([
  15676. `${context.helperString(TO_HANDLER_KEY)}(`,
  15677. arg,
  15678. `)`
  15679. ]);
  15680. }
  15681. } else {
  15682. eventName = arg;
  15683. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  15684. eventName.children.push(`)`);
  15685. }
  15686. let exp = dir.exp;
  15687. if (exp && !exp.content.trim()) {
  15688. exp = void 0;
  15689. }
  15690. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  15691. if (exp) {
  15692. const isMemberExp = isMemberExpression(exp);
  15693. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  15694. const hasMultipleStatements = exp.content.includes(`;`);
  15695. {
  15696. validateBrowserExpression(
  15697. exp,
  15698. context,
  15699. false,
  15700. hasMultipleStatements
  15701. );
  15702. }
  15703. if (isInlineStatement || shouldCache && isMemberExp) {
  15704. exp = createCompoundExpression([
  15705. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  15706. exp,
  15707. hasMultipleStatements ? `}` : `)`
  15708. ]);
  15709. }
  15710. }
  15711. let ret = {
  15712. props: [
  15713. createObjectProperty(
  15714. eventName,
  15715. exp || createSimpleExpression(`() => {}`, false, loc)
  15716. )
  15717. ]
  15718. };
  15719. if (augmentor) {
  15720. ret = augmentor(ret);
  15721. }
  15722. if (shouldCache) {
  15723. ret.props[0].value = context.cache(ret.props[0].value);
  15724. }
  15725. ret.props.forEach((p) => p.key.isHandlerKey = true);
  15726. return ret;
  15727. };
  15728. const transformText = (node, context) => {
  15729. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  15730. return () => {
  15731. const children = node.children;
  15732. let currentContainer = void 0;
  15733. let hasText = false;
  15734. for (let i = 0; i < children.length; i++) {
  15735. const child = children[i];
  15736. if (isText$1(child)) {
  15737. hasText = true;
  15738. for (let j = i + 1; j < children.length; j++) {
  15739. const next = children[j];
  15740. if (isText$1(next)) {
  15741. if (!currentContainer) {
  15742. currentContainer = children[i] = createCompoundExpression(
  15743. [child],
  15744. child.loc
  15745. );
  15746. }
  15747. currentContainer.children.push(` + `, next);
  15748. children.splice(j, 1);
  15749. j--;
  15750. } else {
  15751. currentContainer = void 0;
  15752. break;
  15753. }
  15754. }
  15755. }
  15756. }
  15757. if (!hasText || // if this is a plain element with a single text child, leave it
  15758. // as-is since the runtime has dedicated fast path for this by directly
  15759. // setting textContent of the element.
  15760. // for component root it's always normalized anyway.
  15761. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  15762. // custom directives can potentially add DOM elements arbitrarily,
  15763. // we need to avoid setting textContent of the element at runtime
  15764. // to avoid accidentally overwriting the DOM elements added
  15765. // by the user through custom directives.
  15766. !node.props.find(
  15767. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  15768. ) && // in compat mode, <template> tags with no special directives
  15769. // will be rendered as a fragment so its children must be
  15770. // converted into vnodes.
  15771. true)) {
  15772. return;
  15773. }
  15774. for (let i = 0; i < children.length; i++) {
  15775. const child = children[i];
  15776. if (isText$1(child) || child.type === 8) {
  15777. const callArgs = [];
  15778. if (child.type !== 2 || child.content !== " ") {
  15779. callArgs.push(child);
  15780. }
  15781. if (!context.ssr && getConstantType(child, context) === 0) {
  15782. callArgs.push(
  15783. 1 + (` /* ${PatchFlagNames[1]} */` )
  15784. );
  15785. }
  15786. children[i] = {
  15787. type: 12,
  15788. content: child,
  15789. loc: child.loc,
  15790. codegenNode: createCallExpression(
  15791. context.helper(CREATE_TEXT),
  15792. callArgs
  15793. )
  15794. };
  15795. }
  15796. }
  15797. };
  15798. }
  15799. };
  15800. const seen$1 = /* @__PURE__ */ new WeakSet();
  15801. const transformOnce = (node, context) => {
  15802. if (node.type === 1 && findDir(node, "once", true)) {
  15803. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  15804. return;
  15805. }
  15806. seen$1.add(node);
  15807. context.inVOnce = true;
  15808. context.helper(SET_BLOCK_TRACKING);
  15809. return () => {
  15810. context.inVOnce = false;
  15811. const cur = context.currentNode;
  15812. if (cur.codegenNode) {
  15813. cur.codegenNode = context.cache(
  15814. cur.codegenNode,
  15815. true
  15816. /* isVNode */
  15817. );
  15818. }
  15819. };
  15820. }
  15821. };
  15822. const transformModel$1 = (dir, node, context) => {
  15823. const { exp, arg } = dir;
  15824. if (!exp) {
  15825. context.onError(
  15826. createCompilerError(41, dir.loc)
  15827. );
  15828. return createTransformProps();
  15829. }
  15830. const rawExp = exp.loc.source;
  15831. const expString = exp.type === 4 ? exp.content : rawExp;
  15832. const bindingType = context.bindingMetadata[rawExp];
  15833. if (bindingType === "props" || bindingType === "props-aliased") {
  15834. context.onError(createCompilerError(44, exp.loc));
  15835. return createTransformProps();
  15836. }
  15837. const maybeRef = false;
  15838. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  15839. context.onError(
  15840. createCompilerError(42, exp.loc)
  15841. );
  15842. return createTransformProps();
  15843. }
  15844. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  15845. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  15846. let assignmentExp;
  15847. const eventArg = context.isTS ? `($event: any)` : `$event`;
  15848. {
  15849. assignmentExp = createCompoundExpression([
  15850. `${eventArg} => ((`,
  15851. exp,
  15852. `) = $event)`
  15853. ]);
  15854. }
  15855. const props = [
  15856. // modelValue: foo
  15857. createObjectProperty(propName, dir.exp),
  15858. // "onUpdate:modelValue": $event => (foo = $event)
  15859. createObjectProperty(eventName, assignmentExp)
  15860. ];
  15861. if (dir.modifiers.length && node.tagType === 1) {
  15862. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  15863. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  15864. props.push(
  15865. createObjectProperty(
  15866. modifiersKey,
  15867. createSimpleExpression(
  15868. `{ ${modifiers} }`,
  15869. false,
  15870. dir.loc,
  15871. 2
  15872. )
  15873. )
  15874. );
  15875. }
  15876. return createTransformProps(props);
  15877. };
  15878. function createTransformProps(props = []) {
  15879. return { props };
  15880. }
  15881. const seen = /* @__PURE__ */ new WeakSet();
  15882. const transformMemo = (node, context) => {
  15883. if (node.type === 1) {
  15884. const dir = findDir(node, "memo");
  15885. if (!dir || seen.has(node)) {
  15886. return;
  15887. }
  15888. seen.add(node);
  15889. return () => {
  15890. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  15891. if (codegenNode && codegenNode.type === 13) {
  15892. if (node.tagType !== 1) {
  15893. convertToBlock(codegenNode, context);
  15894. }
  15895. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  15896. dir.exp,
  15897. createFunctionExpression(void 0, codegenNode),
  15898. `_cache`,
  15899. String(context.cached++)
  15900. ]);
  15901. }
  15902. };
  15903. }
  15904. };
  15905. function getBaseTransformPreset(prefixIdentifiers) {
  15906. return [
  15907. [
  15908. transformOnce,
  15909. transformIf,
  15910. transformMemo,
  15911. transformFor,
  15912. ...[],
  15913. ...[transformExpression] ,
  15914. transformSlotOutlet,
  15915. transformElement,
  15916. trackSlotScopes,
  15917. transformText
  15918. ],
  15919. {
  15920. on: transformOn$1,
  15921. bind: transformBind,
  15922. model: transformModel$1
  15923. }
  15924. ];
  15925. }
  15926. function baseCompile(source, options = {}) {
  15927. const onError = options.onError || defaultOnError;
  15928. const isModuleMode = options.mode === "module";
  15929. {
  15930. if (options.prefixIdentifiers === true) {
  15931. onError(createCompilerError(47));
  15932. } else if (isModuleMode) {
  15933. onError(createCompilerError(48));
  15934. }
  15935. }
  15936. const prefixIdentifiers = false;
  15937. if (options.cacheHandlers) {
  15938. onError(createCompilerError(49));
  15939. }
  15940. if (options.scopeId && !isModuleMode) {
  15941. onError(createCompilerError(50));
  15942. }
  15943. const resolvedOptions = extend({}, options, {
  15944. prefixIdentifiers
  15945. });
  15946. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  15947. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  15948. transform(
  15949. ast,
  15950. extend({}, resolvedOptions, {
  15951. nodeTransforms: [
  15952. ...nodeTransforms,
  15953. ...options.nodeTransforms || []
  15954. // user transforms
  15955. ],
  15956. directiveTransforms: extend(
  15957. {},
  15958. directiveTransforms,
  15959. options.directiveTransforms || {}
  15960. // user transforms
  15961. )
  15962. })
  15963. );
  15964. return generate(ast, resolvedOptions);
  15965. }
  15966. const noopDirectiveTransform = () => ({ props: [] });
  15967. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  15968. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  15969. const V_MODEL_TEXT = Symbol(`vModelText` );
  15970. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  15971. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  15972. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  15973. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  15974. const V_SHOW = Symbol(`vShow` );
  15975. const TRANSITION = Symbol(`Transition` );
  15976. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  15977. registerRuntimeHelpers({
  15978. [V_MODEL_RADIO]: `vModelRadio`,
  15979. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  15980. [V_MODEL_TEXT]: `vModelText`,
  15981. [V_MODEL_SELECT]: `vModelSelect`,
  15982. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  15983. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  15984. [V_ON_WITH_KEYS]: `withKeys`,
  15985. [V_SHOW]: `vShow`,
  15986. [TRANSITION]: `Transition`,
  15987. [TRANSITION_GROUP]: `TransitionGroup`
  15988. });
  15989. let decoder;
  15990. function decodeHtmlBrowser(raw, asAttr = false) {
  15991. if (!decoder) {
  15992. decoder = document.createElement("div");
  15993. }
  15994. if (asAttr) {
  15995. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  15996. return decoder.children[0].getAttribute("foo");
  15997. } else {
  15998. decoder.innerHTML = raw;
  15999. return decoder.textContent;
  16000. }
  16001. }
  16002. const parserOptions = {
  16003. parseMode: "html",
  16004. isVoidTag,
  16005. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  16006. isPreTag: (tag) => tag === "pre",
  16007. decodeEntities: decodeHtmlBrowser ,
  16008. isBuiltInComponent: (tag) => {
  16009. if (tag === "Transition" || tag === "transition") {
  16010. return TRANSITION;
  16011. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  16012. return TRANSITION_GROUP;
  16013. }
  16014. },
  16015. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  16016. getNamespace(tag, parent, rootNamespace) {
  16017. let ns = parent ? parent.ns : rootNamespace;
  16018. if (parent && ns === 2) {
  16019. if (parent.tag === "annotation-xml") {
  16020. if (tag === "svg") {
  16021. return 1;
  16022. }
  16023. if (parent.props.some(
  16024. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  16025. )) {
  16026. ns = 0;
  16027. }
  16028. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  16029. ns = 0;
  16030. }
  16031. } else if (parent && ns === 1) {
  16032. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  16033. ns = 0;
  16034. }
  16035. }
  16036. if (ns === 0) {
  16037. if (tag === "svg") {
  16038. return 1;
  16039. }
  16040. if (tag === "math") {
  16041. return 2;
  16042. }
  16043. }
  16044. return ns;
  16045. }
  16046. };
  16047. const transformStyle = (node) => {
  16048. if (node.type === 1) {
  16049. node.props.forEach((p, i) => {
  16050. if (p.type === 6 && p.name === "style" && p.value) {
  16051. node.props[i] = {
  16052. type: 7,
  16053. name: `bind`,
  16054. arg: createSimpleExpression(`style`, true, p.loc),
  16055. exp: parseInlineCSS(p.value.content, p.loc),
  16056. modifiers: [],
  16057. loc: p.loc
  16058. };
  16059. }
  16060. });
  16061. }
  16062. };
  16063. const parseInlineCSS = (cssText, loc) => {
  16064. const normalized = parseStringStyle(cssText);
  16065. return createSimpleExpression(
  16066. JSON.stringify(normalized),
  16067. false,
  16068. loc,
  16069. 3
  16070. );
  16071. };
  16072. function createDOMCompilerError(code, loc) {
  16073. return createCompilerError(
  16074. code,
  16075. loc,
  16076. DOMErrorMessages
  16077. );
  16078. }
  16079. const DOMErrorMessages = {
  16080. [53]: `v-html is missing expression.`,
  16081. [54]: `v-html will override element children.`,
  16082. [55]: `v-text is missing expression.`,
  16083. [56]: `v-text will override element children.`,
  16084. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  16085. [58]: `v-model argument is not supported on plain elements.`,
  16086. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  16087. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  16088. [61]: `v-show is missing expression.`,
  16089. [62]: `<Transition> expects exactly one child element or component.`,
  16090. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  16091. };
  16092. const transformVHtml = (dir, node, context) => {
  16093. const { exp, loc } = dir;
  16094. if (!exp) {
  16095. context.onError(
  16096. createDOMCompilerError(53, loc)
  16097. );
  16098. }
  16099. if (node.children.length) {
  16100. context.onError(
  16101. createDOMCompilerError(54, loc)
  16102. );
  16103. node.children.length = 0;
  16104. }
  16105. return {
  16106. props: [
  16107. createObjectProperty(
  16108. createSimpleExpression(`innerHTML`, true, loc),
  16109. exp || createSimpleExpression("", true)
  16110. )
  16111. ]
  16112. };
  16113. };
  16114. const transformVText = (dir, node, context) => {
  16115. const { exp, loc } = dir;
  16116. if (!exp) {
  16117. context.onError(
  16118. createDOMCompilerError(55, loc)
  16119. );
  16120. }
  16121. if (node.children.length) {
  16122. context.onError(
  16123. createDOMCompilerError(56, loc)
  16124. );
  16125. node.children.length = 0;
  16126. }
  16127. return {
  16128. props: [
  16129. createObjectProperty(
  16130. createSimpleExpression(`textContent`, true),
  16131. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  16132. context.helperString(TO_DISPLAY_STRING),
  16133. [exp],
  16134. loc
  16135. ) : createSimpleExpression("", true)
  16136. )
  16137. ]
  16138. };
  16139. };
  16140. const transformModel = (dir, node, context) => {
  16141. const baseResult = transformModel$1(dir, node, context);
  16142. if (!baseResult.props.length || node.tagType === 1) {
  16143. return baseResult;
  16144. }
  16145. if (dir.arg) {
  16146. context.onError(
  16147. createDOMCompilerError(
  16148. 58,
  16149. dir.arg.loc
  16150. )
  16151. );
  16152. }
  16153. function checkDuplicatedValue() {
  16154. const value = findDir(node, "bind");
  16155. if (value && isStaticArgOf(value.arg, "value")) {
  16156. context.onError(
  16157. createDOMCompilerError(
  16158. 60,
  16159. value.loc
  16160. )
  16161. );
  16162. }
  16163. }
  16164. const { tag } = node;
  16165. const isCustomElement = context.isCustomElement(tag);
  16166. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  16167. let directiveToUse = V_MODEL_TEXT;
  16168. let isInvalidType = false;
  16169. if (tag === "input" || isCustomElement) {
  16170. const type = findProp(node, `type`);
  16171. if (type) {
  16172. if (type.type === 7) {
  16173. directiveToUse = V_MODEL_DYNAMIC;
  16174. } else if (type.value) {
  16175. switch (type.value.content) {
  16176. case "radio":
  16177. directiveToUse = V_MODEL_RADIO;
  16178. break;
  16179. case "checkbox":
  16180. directiveToUse = V_MODEL_CHECKBOX;
  16181. break;
  16182. case "file":
  16183. isInvalidType = true;
  16184. context.onError(
  16185. createDOMCompilerError(
  16186. 59,
  16187. dir.loc
  16188. )
  16189. );
  16190. break;
  16191. default:
  16192. checkDuplicatedValue();
  16193. break;
  16194. }
  16195. }
  16196. } else if (hasDynamicKeyVBind(node)) {
  16197. directiveToUse = V_MODEL_DYNAMIC;
  16198. } else {
  16199. checkDuplicatedValue();
  16200. }
  16201. } else if (tag === "select") {
  16202. directiveToUse = V_MODEL_SELECT;
  16203. } else {
  16204. checkDuplicatedValue();
  16205. }
  16206. if (!isInvalidType) {
  16207. baseResult.needRuntime = context.helper(directiveToUse);
  16208. }
  16209. } else {
  16210. context.onError(
  16211. createDOMCompilerError(
  16212. 57,
  16213. dir.loc
  16214. )
  16215. );
  16216. }
  16217. baseResult.props = baseResult.props.filter(
  16218. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  16219. );
  16220. return baseResult;
  16221. };
  16222. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  16223. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  16224. // event propagation management
  16225. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  16226. );
  16227. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  16228. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  16229. `onkeyup,onkeydown,onkeypress`,
  16230. true
  16231. );
  16232. const resolveModifiers = (key, modifiers, context, loc) => {
  16233. const keyModifiers = [];
  16234. const nonKeyModifiers = [];
  16235. const eventOptionModifiers = [];
  16236. for (let i = 0; i < modifiers.length; i++) {
  16237. const modifier = modifiers[i];
  16238. if (isEventOptionModifier(modifier)) {
  16239. eventOptionModifiers.push(modifier);
  16240. } else {
  16241. if (maybeKeyModifier(modifier)) {
  16242. if (isStaticExp(key)) {
  16243. if (isKeyboardEvent(key.content)) {
  16244. keyModifiers.push(modifier);
  16245. } else {
  16246. nonKeyModifiers.push(modifier);
  16247. }
  16248. } else {
  16249. keyModifiers.push(modifier);
  16250. nonKeyModifiers.push(modifier);
  16251. }
  16252. } else {
  16253. if (isNonKeyModifier(modifier)) {
  16254. nonKeyModifiers.push(modifier);
  16255. } else {
  16256. keyModifiers.push(modifier);
  16257. }
  16258. }
  16259. }
  16260. }
  16261. return {
  16262. keyModifiers,
  16263. nonKeyModifiers,
  16264. eventOptionModifiers
  16265. };
  16266. };
  16267. const transformClick = (key, event) => {
  16268. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  16269. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  16270. `(`,
  16271. key,
  16272. `) === "onClick" ? "${event}" : (`,
  16273. key,
  16274. `)`
  16275. ]) : key;
  16276. };
  16277. const transformOn = (dir, node, context) => {
  16278. return transformOn$1(dir, node, context, (baseResult) => {
  16279. const { modifiers } = dir;
  16280. if (!modifiers.length) return baseResult;
  16281. let { key, value: handlerExp } = baseResult.props[0];
  16282. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  16283. if (nonKeyModifiers.includes("right")) {
  16284. key = transformClick(key, `onContextmenu`);
  16285. }
  16286. if (nonKeyModifiers.includes("middle")) {
  16287. key = transformClick(key, `onMouseup`);
  16288. }
  16289. if (nonKeyModifiers.length) {
  16290. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  16291. handlerExp,
  16292. JSON.stringify(nonKeyModifiers)
  16293. ]);
  16294. }
  16295. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  16296. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  16297. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  16298. handlerExp,
  16299. JSON.stringify(keyModifiers)
  16300. ]);
  16301. }
  16302. if (eventOptionModifiers.length) {
  16303. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  16304. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  16305. }
  16306. return {
  16307. props: [createObjectProperty(key, handlerExp)]
  16308. };
  16309. });
  16310. };
  16311. const transformShow = (dir, node, context) => {
  16312. const { exp, loc } = dir;
  16313. if (!exp) {
  16314. context.onError(
  16315. createDOMCompilerError(61, loc)
  16316. );
  16317. }
  16318. return {
  16319. props: [],
  16320. needRuntime: context.helper(V_SHOW)
  16321. };
  16322. };
  16323. const transformTransition = (node, context) => {
  16324. if (node.type === 1 && node.tagType === 1) {
  16325. const component = context.isBuiltInComponent(node.tag);
  16326. if (component === TRANSITION) {
  16327. return () => {
  16328. if (!node.children.length) {
  16329. return;
  16330. }
  16331. if (hasMultipleChildren(node)) {
  16332. context.onError(
  16333. createDOMCompilerError(
  16334. 62,
  16335. {
  16336. start: node.children[0].loc.start,
  16337. end: node.children[node.children.length - 1].loc.end,
  16338. source: ""
  16339. }
  16340. )
  16341. );
  16342. }
  16343. const child = node.children[0];
  16344. if (child.type === 1) {
  16345. for (const p of child.props) {
  16346. if (p.type === 7 && p.name === "show") {
  16347. node.props.push({
  16348. type: 6,
  16349. name: "persisted",
  16350. nameLoc: node.loc,
  16351. value: void 0,
  16352. loc: node.loc
  16353. });
  16354. }
  16355. }
  16356. }
  16357. };
  16358. }
  16359. }
  16360. };
  16361. function hasMultipleChildren(node) {
  16362. const children = node.children = node.children.filter(
  16363. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  16364. );
  16365. const child = children[0];
  16366. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  16367. }
  16368. const ignoreSideEffectTags = (node, context) => {
  16369. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  16370. context.onError(
  16371. createDOMCompilerError(
  16372. 63,
  16373. node.loc
  16374. )
  16375. );
  16376. context.removeNode();
  16377. }
  16378. };
  16379. const DOMNodeTransforms = [
  16380. transformStyle,
  16381. ...[transformTransition]
  16382. ];
  16383. const DOMDirectiveTransforms = {
  16384. cloak: noopDirectiveTransform,
  16385. html: transformVHtml,
  16386. text: transformVText,
  16387. model: transformModel,
  16388. // override compiler-core
  16389. on: transformOn,
  16390. // override compiler-core
  16391. show: transformShow
  16392. };
  16393. function compile(src, options = {}) {
  16394. return baseCompile(
  16395. src,
  16396. extend({}, parserOptions, options, {
  16397. nodeTransforms: [
  16398. // ignore <script> and <tag>
  16399. // this is not put inside DOMNodeTransforms because that list is used
  16400. // by compiler-ssr to generate vnode fallback branches
  16401. ignoreSideEffectTags,
  16402. ...DOMNodeTransforms,
  16403. ...options.nodeTransforms || []
  16404. ],
  16405. directiveTransforms: extend(
  16406. {},
  16407. DOMDirectiveTransforms,
  16408. options.directiveTransforms || {}
  16409. ),
  16410. transformHoist: null
  16411. })
  16412. );
  16413. }
  16414. {
  16415. initDev();
  16416. }
  16417. const compileCache = /* @__PURE__ */ new WeakMap();
  16418. function getCache(options) {
  16419. let c = compileCache.get(options != null ? options : EMPTY_OBJ);
  16420. if (!c) {
  16421. c = /* @__PURE__ */ Object.create(null);
  16422. compileCache.set(options != null ? options : EMPTY_OBJ, c);
  16423. }
  16424. return c;
  16425. }
  16426. function compileToFunction(template, options) {
  16427. if (!isString(template)) {
  16428. if (template.nodeType) {
  16429. template = template.innerHTML;
  16430. } else {
  16431. warn(`invalid template option: `, template);
  16432. return NOOP;
  16433. }
  16434. }
  16435. const key = template;
  16436. const cache = getCache(options);
  16437. const cached = cache[key];
  16438. if (cached) {
  16439. return cached;
  16440. }
  16441. if (template[0] === "#") {
  16442. const el = document.querySelector(template);
  16443. if (!el) {
  16444. warn(`Template element not found or is empty: ${template}`);
  16445. }
  16446. template = el ? el.innerHTML : ``;
  16447. }
  16448. const opts = extend(
  16449. {
  16450. hoistStatic: true,
  16451. onError: onError ,
  16452. onWarn: (e) => onError(e, true)
  16453. },
  16454. options
  16455. );
  16456. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  16457. opts.isCustomElement = (tag) => !!customElements.get(tag);
  16458. }
  16459. const { code } = compile(template, opts);
  16460. function onError(err, asWarning = false) {
  16461. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  16462. const codeFrame = err.loc && generateCodeFrame(
  16463. template,
  16464. err.loc.start.offset,
  16465. err.loc.end.offset
  16466. );
  16467. warn(codeFrame ? `${message}
  16468. ${codeFrame}` : message);
  16469. }
  16470. const render = new Function(code)() ;
  16471. render._rc = true;
  16472. return cache[key] = render;
  16473. }
  16474. registerRuntimeCompiler(compileToFunction);
  16475. exports.BaseTransition = BaseTransition;
  16476. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  16477. exports.Comment = Comment;
  16478. exports.DeprecationTypes = DeprecationTypes;
  16479. exports.EffectScope = EffectScope;
  16480. exports.ErrorCodes = ErrorCodes;
  16481. exports.ErrorTypeStrings = ErrorTypeStrings;
  16482. exports.Fragment = Fragment;
  16483. exports.KeepAlive = KeepAlive;
  16484. exports.ReactiveEffect = ReactiveEffect;
  16485. exports.Static = Static;
  16486. exports.Suspense = Suspense;
  16487. exports.Teleport = Teleport;
  16488. exports.Text = Text;
  16489. exports.TrackOpTypes = TrackOpTypes;
  16490. exports.Transition = Transition;
  16491. exports.TransitionGroup = TransitionGroup;
  16492. exports.TriggerOpTypes = TriggerOpTypes;
  16493. exports.VueElement = VueElement;
  16494. exports.assertNumber = assertNumber;
  16495. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  16496. exports.callWithErrorHandling = callWithErrorHandling;
  16497. exports.camelize = camelize;
  16498. exports.capitalize = capitalize;
  16499. exports.cloneVNode = cloneVNode;
  16500. exports.compatUtils = compatUtils;
  16501. exports.compile = compileToFunction;
  16502. exports.computed = computed;
  16503. exports.createApp = createApp;
  16504. exports.createBlock = createBlock;
  16505. exports.createCommentVNode = createCommentVNode;
  16506. exports.createElementBlock = createElementBlock;
  16507. exports.createElementVNode = createBaseVNode;
  16508. exports.createHydrationRenderer = createHydrationRenderer;
  16509. exports.createPropsRestProxy = createPropsRestProxy;
  16510. exports.createRenderer = createRenderer;
  16511. exports.createSSRApp = createSSRApp;
  16512. exports.createSlots = createSlots;
  16513. exports.createStaticVNode = createStaticVNode;
  16514. exports.createTextVNode = createTextVNode;
  16515. exports.createVNode = createVNode;
  16516. exports.customRef = customRef;
  16517. exports.defineAsyncComponent = defineAsyncComponent;
  16518. exports.defineComponent = defineComponent;
  16519. exports.defineCustomElement = defineCustomElement;
  16520. exports.defineEmits = defineEmits;
  16521. exports.defineExpose = defineExpose;
  16522. exports.defineModel = defineModel;
  16523. exports.defineOptions = defineOptions;
  16524. exports.defineProps = defineProps;
  16525. exports.defineSSRCustomElement = defineSSRCustomElement;
  16526. exports.defineSlots = defineSlots;
  16527. exports.devtools = devtools;
  16528. exports.effect = effect;
  16529. exports.effectScope = effectScope;
  16530. exports.getCurrentInstance = getCurrentInstance;
  16531. exports.getCurrentScope = getCurrentScope;
  16532. exports.getTransitionRawChildren = getTransitionRawChildren;
  16533. exports.guardReactiveProps = guardReactiveProps;
  16534. exports.h = h;
  16535. exports.handleError = handleError;
  16536. exports.hasInjectionContext = hasInjectionContext;
  16537. exports.hydrate = hydrate;
  16538. exports.initCustomFormatter = initCustomFormatter;
  16539. exports.initDirectivesForSSR = initDirectivesForSSR;
  16540. exports.inject = inject;
  16541. exports.isMemoSame = isMemoSame;
  16542. exports.isProxy = isProxy;
  16543. exports.isReactive = isReactive;
  16544. exports.isReadonly = isReadonly;
  16545. exports.isRef = isRef;
  16546. exports.isRuntimeOnly = isRuntimeOnly;
  16547. exports.isShallow = isShallow;
  16548. exports.isVNode = isVNode;
  16549. exports.markRaw = markRaw;
  16550. exports.mergeDefaults = mergeDefaults;
  16551. exports.mergeModels = mergeModels;
  16552. exports.mergeProps = mergeProps;
  16553. exports.nextTick = nextTick;
  16554. exports.normalizeClass = normalizeClass;
  16555. exports.normalizeProps = normalizeProps;
  16556. exports.normalizeStyle = normalizeStyle;
  16557. exports.onActivated = onActivated;
  16558. exports.onBeforeMount = onBeforeMount;
  16559. exports.onBeforeUnmount = onBeforeUnmount;
  16560. exports.onBeforeUpdate = onBeforeUpdate;
  16561. exports.onDeactivated = onDeactivated;
  16562. exports.onErrorCaptured = onErrorCaptured;
  16563. exports.onMounted = onMounted;
  16564. exports.onRenderTracked = onRenderTracked;
  16565. exports.onRenderTriggered = onRenderTriggered;
  16566. exports.onScopeDispose = onScopeDispose;
  16567. exports.onServerPrefetch = onServerPrefetch;
  16568. exports.onUnmounted = onUnmounted;
  16569. exports.onUpdated = onUpdated;
  16570. exports.openBlock = openBlock;
  16571. exports.popScopeId = popScopeId;
  16572. exports.provide = provide;
  16573. exports.proxyRefs = proxyRefs;
  16574. exports.pushScopeId = pushScopeId;
  16575. exports.queuePostFlushCb = queuePostFlushCb;
  16576. exports.reactive = reactive;
  16577. exports.readonly = readonly;
  16578. exports.ref = ref;
  16579. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  16580. exports.render = render;
  16581. exports.renderList = renderList;
  16582. exports.renderSlot = renderSlot;
  16583. exports.resolveComponent = resolveComponent;
  16584. exports.resolveDirective = resolveDirective;
  16585. exports.resolveDynamicComponent = resolveDynamicComponent;
  16586. exports.resolveFilter = resolveFilter;
  16587. exports.resolveTransitionHooks = resolveTransitionHooks;
  16588. exports.setBlockTracking = setBlockTracking;
  16589. exports.setDevtoolsHook = setDevtoolsHook;
  16590. exports.setTransitionHooks = setTransitionHooks;
  16591. exports.shallowReactive = shallowReactive;
  16592. exports.shallowReadonly = shallowReadonly;
  16593. exports.shallowRef = shallowRef;
  16594. exports.ssrContextKey = ssrContextKey;
  16595. exports.ssrUtils = ssrUtils;
  16596. exports.stop = stop;
  16597. exports.toDisplayString = toDisplayString;
  16598. exports.toHandlerKey = toHandlerKey;
  16599. exports.toHandlers = toHandlers;
  16600. exports.toRaw = toRaw;
  16601. exports.toRef = toRef;
  16602. exports.toRefs = toRefs;
  16603. exports.toValue = toValue;
  16604. exports.transformVNodeArgs = transformVNodeArgs;
  16605. exports.triggerRef = triggerRef;
  16606. exports.unref = unref;
  16607. exports.useAttrs = useAttrs;
  16608. exports.useCssModule = useCssModule;
  16609. exports.useCssVars = useCssVars;
  16610. exports.useModel = useModel;
  16611. exports.useSSRContext = useSSRContext;
  16612. exports.useSlots = useSlots;
  16613. exports.useTransitionState = useTransitionState;
  16614. exports.vModelCheckbox = vModelCheckbox;
  16615. exports.vModelDynamic = vModelDynamic;
  16616. exports.vModelRadio = vModelRadio;
  16617. exports.vModelSelect = vModelSelect;
  16618. exports.vModelText = vModelText;
  16619. exports.vShow = vShow;
  16620. exports.version = version;
  16621. exports.warn = warn;
  16622. exports.watch = watch;
  16623. exports.watchEffect = watchEffect;
  16624. exports.watchPostEffect = watchPostEffect;
  16625. exports.watchSyncEffect = watchSyncEffect;
  16626. exports.withAsyncContext = withAsyncContext;
  16627. exports.withCtx = withCtx;
  16628. exports.withDefaults = withDefaults;
  16629. exports.withDirectives = withDirectives;
  16630. exports.withKeys = withKeys;
  16631. exports.withMemo = withMemo;
  16632. exports.withModifiers = withModifiers;
  16633. exports.withScopeId = withScopeId;
  16634. return exports;
  16635. })({});