runtime-core.cjs.js 245 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399
  1. /**
  2. * @vue/runtime-core v3.5.4
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. var reactivity = require('@vue/reactivity');
  9. var shared = require('@vue/shared');
  10. const stack = [];
  11. function pushWarningContext(vnode) {
  12. stack.push(vnode);
  13. }
  14. function popWarningContext() {
  15. stack.pop();
  16. }
  17. let isWarning = false;
  18. function warn$1(msg, ...args) {
  19. if (isWarning) return;
  20. isWarning = true;
  21. reactivity.pauseTracking();
  22. const instance = stack.length ? stack[stack.length - 1].component : null;
  23. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  24. const trace = getComponentTrace();
  25. if (appWarnHandler) {
  26. callWithErrorHandling(
  27. appWarnHandler,
  28. instance,
  29. 11,
  30. [
  31. // eslint-disable-next-line no-restricted-syntax
  32. msg + args.map((a) => {
  33. var _a, _b;
  34. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  35. }).join(""),
  36. instance && instance.proxy,
  37. trace.map(
  38. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  39. ).join("\n"),
  40. trace
  41. ]
  42. );
  43. } else {
  44. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  45. if (trace.length && // avoid spamming console during tests
  46. true) {
  47. warnArgs.push(`
  48. `, ...formatTrace(trace));
  49. }
  50. console.warn(...warnArgs);
  51. }
  52. reactivity.resetTracking();
  53. isWarning = false;
  54. }
  55. function getComponentTrace() {
  56. let currentVNode = stack[stack.length - 1];
  57. if (!currentVNode) {
  58. return [];
  59. }
  60. const normalizedStack = [];
  61. while (currentVNode) {
  62. const last = normalizedStack[0];
  63. if (last && last.vnode === currentVNode) {
  64. last.recurseCount++;
  65. } else {
  66. normalizedStack.push({
  67. vnode: currentVNode,
  68. recurseCount: 0
  69. });
  70. }
  71. const parentInstance = currentVNode.component && currentVNode.component.parent;
  72. currentVNode = parentInstance && parentInstance.vnode;
  73. }
  74. return normalizedStack;
  75. }
  76. function formatTrace(trace) {
  77. const logs = [];
  78. trace.forEach((entry, i) => {
  79. logs.push(...i === 0 ? [] : [`
  80. `], ...formatTraceEntry(entry));
  81. });
  82. return logs;
  83. }
  84. function formatTraceEntry({ vnode, recurseCount }) {
  85. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  86. const isRoot = vnode.component ? vnode.component.parent == null : false;
  87. const open = ` at <${formatComponentName(
  88. vnode.component,
  89. vnode.type,
  90. isRoot
  91. )}`;
  92. const close = `>` + postfix;
  93. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  94. }
  95. function formatProps(props) {
  96. const res = [];
  97. const keys = Object.keys(props);
  98. keys.slice(0, 3).forEach((key) => {
  99. res.push(...formatProp(key, props[key]));
  100. });
  101. if (keys.length > 3) {
  102. res.push(` ...`);
  103. }
  104. return res;
  105. }
  106. function formatProp(key, value, raw) {
  107. if (shared.isString(value)) {
  108. value = JSON.stringify(value);
  109. return raw ? value : [`${key}=${value}`];
  110. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  111. return raw ? value : [`${key}=${value}`];
  112. } else if (reactivity.isRef(value)) {
  113. value = formatProp(key, reactivity.toRaw(value.value), true);
  114. return raw ? value : [`${key}=Ref<`, value, `>`];
  115. } else if (shared.isFunction(value)) {
  116. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  117. } else {
  118. value = reactivity.toRaw(value);
  119. return raw ? value : [`${key}=`, value];
  120. }
  121. }
  122. function assertNumber(val, type) {
  123. if (val === void 0) {
  124. return;
  125. } else if (typeof val !== "number") {
  126. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  127. } else if (isNaN(val)) {
  128. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  129. }
  130. }
  131. const ErrorCodes = {
  132. "SETUP_FUNCTION": 0,
  133. "0": "SETUP_FUNCTION",
  134. "RENDER_FUNCTION": 1,
  135. "1": "RENDER_FUNCTION",
  136. "NATIVE_EVENT_HANDLER": 5,
  137. "5": "NATIVE_EVENT_HANDLER",
  138. "COMPONENT_EVENT_HANDLER": 6,
  139. "6": "COMPONENT_EVENT_HANDLER",
  140. "VNODE_HOOK": 7,
  141. "7": "VNODE_HOOK",
  142. "DIRECTIVE_HOOK": 8,
  143. "8": "DIRECTIVE_HOOK",
  144. "TRANSITION_HOOK": 9,
  145. "9": "TRANSITION_HOOK",
  146. "APP_ERROR_HANDLER": 10,
  147. "10": "APP_ERROR_HANDLER",
  148. "APP_WARN_HANDLER": 11,
  149. "11": "APP_WARN_HANDLER",
  150. "FUNCTION_REF": 12,
  151. "12": "FUNCTION_REF",
  152. "ASYNC_COMPONENT_LOADER": 13,
  153. "13": "ASYNC_COMPONENT_LOADER",
  154. "SCHEDULER": 14,
  155. "14": "SCHEDULER",
  156. "COMPONENT_UPDATE": 15,
  157. "15": "COMPONENT_UPDATE",
  158. "APP_UNMOUNT_CLEANUP": 16,
  159. "16": "APP_UNMOUNT_CLEANUP"
  160. };
  161. const ErrorTypeStrings$1 = {
  162. ["sp"]: "serverPrefetch hook",
  163. ["bc"]: "beforeCreate hook",
  164. ["c"]: "created hook",
  165. ["bm"]: "beforeMount hook",
  166. ["m"]: "mounted hook",
  167. ["bu"]: "beforeUpdate hook",
  168. ["u"]: "updated",
  169. ["bum"]: "beforeUnmount hook",
  170. ["um"]: "unmounted hook",
  171. ["a"]: "activated hook",
  172. ["da"]: "deactivated hook",
  173. ["ec"]: "errorCaptured hook",
  174. ["rtc"]: "renderTracked hook",
  175. ["rtg"]: "renderTriggered hook",
  176. [0]: "setup function",
  177. [1]: "render function",
  178. [2]: "watcher getter",
  179. [3]: "watcher callback",
  180. [4]: "watcher cleanup function",
  181. [5]: "native event handler",
  182. [6]: "component event handler",
  183. [7]: "vnode hook",
  184. [8]: "directive hook",
  185. [9]: "transition hook",
  186. [10]: "app errorHandler",
  187. [11]: "app warnHandler",
  188. [12]: "ref function",
  189. [13]: "async component loader",
  190. [14]: "scheduler flush",
  191. [15]: "component update",
  192. [16]: "app unmount cleanup function"
  193. };
  194. function callWithErrorHandling(fn, instance, type, args) {
  195. try {
  196. return args ? fn(...args) : fn();
  197. } catch (err) {
  198. handleError(err, instance, type);
  199. }
  200. }
  201. function callWithAsyncErrorHandling(fn, instance, type, args) {
  202. if (shared.isFunction(fn)) {
  203. const res = callWithErrorHandling(fn, instance, type, args);
  204. if (res && shared.isPromise(res)) {
  205. res.catch((err) => {
  206. handleError(err, instance, type);
  207. });
  208. }
  209. return res;
  210. }
  211. if (shared.isArray(fn)) {
  212. const values = [];
  213. for (let i = 0; i < fn.length; i++) {
  214. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  215. }
  216. return values;
  217. } else {
  218. warn$1(
  219. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  220. );
  221. }
  222. }
  223. function handleError(err, instance, type, throwInDev = true) {
  224. const contextVNode = instance ? instance.vnode : null;
  225. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || shared.EMPTY_OBJ;
  226. if (instance) {
  227. let cur = instance.parent;
  228. const exposedInstance = instance.proxy;
  229. const errorInfo = ErrorTypeStrings$1[type] ;
  230. while (cur) {
  231. const errorCapturedHooks = cur.ec;
  232. if (errorCapturedHooks) {
  233. for (let i = 0; i < errorCapturedHooks.length; i++) {
  234. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  235. return;
  236. }
  237. }
  238. }
  239. cur = cur.parent;
  240. }
  241. if (errorHandler) {
  242. reactivity.pauseTracking();
  243. callWithErrorHandling(errorHandler, null, 10, [
  244. err,
  245. exposedInstance,
  246. errorInfo
  247. ]);
  248. reactivity.resetTracking();
  249. return;
  250. }
  251. }
  252. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  253. }
  254. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  255. {
  256. const info = ErrorTypeStrings$1[type];
  257. if (contextVNode) {
  258. pushWarningContext(contextVNode);
  259. }
  260. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  261. if (contextVNode) {
  262. popWarningContext();
  263. }
  264. if (throwInDev) {
  265. throw err;
  266. } else {
  267. console.error(err);
  268. }
  269. }
  270. }
  271. let isFlushing = false;
  272. let isFlushPending = false;
  273. const queue = [];
  274. let flushIndex = 0;
  275. const pendingPostFlushCbs = [];
  276. let activePostFlushCbs = null;
  277. let postFlushIndex = 0;
  278. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  279. let currentFlushPromise = null;
  280. const RECURSION_LIMIT = 100;
  281. function nextTick(fn) {
  282. const p = currentFlushPromise || resolvedPromise;
  283. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  284. }
  285. function findInsertionIndex(id) {
  286. let start = isFlushing ? flushIndex + 1 : 0;
  287. let end = queue.length;
  288. while (start < end) {
  289. const middle = start + end >>> 1;
  290. const middleJob = queue[middle];
  291. const middleJobId = getId(middleJob);
  292. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  293. start = middle + 1;
  294. } else {
  295. end = middle;
  296. }
  297. }
  298. return start;
  299. }
  300. function queueJob(job) {
  301. if (!(job.flags & 1)) {
  302. const jobId = getId(job);
  303. const lastJob = queue[queue.length - 1];
  304. if (!lastJob || // fast path when the job id is larger than the tail
  305. !(job.flags & 2) && jobId >= getId(lastJob)) {
  306. queue.push(job);
  307. } else {
  308. queue.splice(findInsertionIndex(jobId), 0, job);
  309. }
  310. job.flags |= 1;
  311. queueFlush();
  312. }
  313. }
  314. function queueFlush() {
  315. if (!isFlushing && !isFlushPending) {
  316. isFlushPending = true;
  317. currentFlushPromise = resolvedPromise.then(flushJobs);
  318. }
  319. }
  320. function queuePostFlushCb(cb) {
  321. if (!shared.isArray(cb)) {
  322. if (activePostFlushCbs && cb.id === -1) {
  323. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  324. } else if (!(cb.flags & 1)) {
  325. pendingPostFlushCbs.push(cb);
  326. cb.flags |= 1;
  327. }
  328. } else {
  329. pendingPostFlushCbs.push(...cb);
  330. }
  331. queueFlush();
  332. }
  333. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  334. {
  335. seen = seen || /* @__PURE__ */ new Map();
  336. }
  337. for (; i < queue.length; i++) {
  338. const cb = queue[i];
  339. if (cb && cb.flags & 2) {
  340. if (instance && cb.id !== instance.uid) {
  341. continue;
  342. }
  343. if (checkRecursiveUpdates(seen, cb)) {
  344. continue;
  345. }
  346. queue.splice(i, 1);
  347. i--;
  348. if (cb.flags & 4) {
  349. cb.flags &= ~1;
  350. }
  351. cb();
  352. cb.flags &= ~1;
  353. }
  354. }
  355. }
  356. function flushPostFlushCbs(seen) {
  357. if (pendingPostFlushCbs.length) {
  358. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  359. (a, b) => getId(a) - getId(b)
  360. );
  361. pendingPostFlushCbs.length = 0;
  362. if (activePostFlushCbs) {
  363. activePostFlushCbs.push(...deduped);
  364. return;
  365. }
  366. activePostFlushCbs = deduped;
  367. {
  368. seen = seen || /* @__PURE__ */ new Map();
  369. }
  370. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  371. const cb = activePostFlushCbs[postFlushIndex];
  372. if (checkRecursiveUpdates(seen, cb)) {
  373. continue;
  374. }
  375. if (cb.flags & 4) {
  376. cb.flags &= ~1;
  377. }
  378. if (!(cb.flags & 8)) cb();
  379. cb.flags &= ~1;
  380. }
  381. activePostFlushCbs = null;
  382. postFlushIndex = 0;
  383. }
  384. }
  385. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  386. function flushJobs(seen) {
  387. isFlushPending = false;
  388. isFlushing = true;
  389. {
  390. seen = seen || /* @__PURE__ */ new Map();
  391. }
  392. const check = (job) => checkRecursiveUpdates(seen, job) ;
  393. try {
  394. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  395. const job = queue[flushIndex];
  396. if (job && !(job.flags & 8)) {
  397. if (check(job)) {
  398. continue;
  399. }
  400. if (job.flags & 4) {
  401. job.flags &= ~1;
  402. }
  403. callWithErrorHandling(
  404. job,
  405. job.i,
  406. job.i ? 15 : 14
  407. );
  408. job.flags &= ~1;
  409. }
  410. }
  411. } finally {
  412. for (; flushIndex < queue.length; flushIndex++) {
  413. const job = queue[flushIndex];
  414. if (job) {
  415. job.flags &= ~1;
  416. }
  417. }
  418. flushIndex = 0;
  419. queue.length = 0;
  420. flushPostFlushCbs(seen);
  421. isFlushing = false;
  422. currentFlushPromise = null;
  423. if (queue.length || pendingPostFlushCbs.length) {
  424. flushJobs(seen);
  425. }
  426. }
  427. }
  428. function checkRecursiveUpdates(seen, fn) {
  429. const count = seen.get(fn) || 0;
  430. if (count > RECURSION_LIMIT) {
  431. const instance = fn.i;
  432. const componentName = instance && getComponentName(instance.type);
  433. handleError(
  434. `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.`,
  435. null,
  436. 10
  437. );
  438. return true;
  439. }
  440. seen.set(fn, count + 1);
  441. return false;
  442. }
  443. let isHmrUpdating = false;
  444. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  445. {
  446. shared.getGlobalThis().__VUE_HMR_RUNTIME__ = {
  447. createRecord: tryWrap(createRecord),
  448. rerender: tryWrap(rerender),
  449. reload: tryWrap(reload)
  450. };
  451. }
  452. const map = /* @__PURE__ */ new Map();
  453. function registerHMR(instance) {
  454. const id = instance.type.__hmrId;
  455. let record = map.get(id);
  456. if (!record) {
  457. createRecord(id, instance.type);
  458. record = map.get(id);
  459. }
  460. record.instances.add(instance);
  461. }
  462. function unregisterHMR(instance) {
  463. map.get(instance.type.__hmrId).instances.delete(instance);
  464. }
  465. function createRecord(id, initialDef) {
  466. if (map.has(id)) {
  467. return false;
  468. }
  469. map.set(id, {
  470. initialDef: normalizeClassComponent(initialDef),
  471. instances: /* @__PURE__ */ new Set()
  472. });
  473. return true;
  474. }
  475. function normalizeClassComponent(component) {
  476. return isClassComponent(component) ? component.__vccOpts : component;
  477. }
  478. function rerender(id, newRender) {
  479. const record = map.get(id);
  480. if (!record) {
  481. return;
  482. }
  483. record.initialDef.render = newRender;
  484. [...record.instances].forEach((instance) => {
  485. if (newRender) {
  486. instance.render = newRender;
  487. normalizeClassComponent(instance.type).render = newRender;
  488. }
  489. instance.renderCache = [];
  490. isHmrUpdating = true;
  491. instance.update();
  492. isHmrUpdating = false;
  493. });
  494. }
  495. function reload(id, newComp) {
  496. const record = map.get(id);
  497. if (!record) return;
  498. newComp = normalizeClassComponent(newComp);
  499. updateComponentDef(record.initialDef, newComp);
  500. const instances = [...record.instances];
  501. for (let i = 0; i < instances.length; i++) {
  502. const instance = instances[i];
  503. const oldComp = normalizeClassComponent(instance.type);
  504. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  505. if (!dirtyInstances) {
  506. if (oldComp !== record.initialDef) {
  507. updateComponentDef(oldComp, newComp);
  508. }
  509. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  510. }
  511. dirtyInstances.add(instance);
  512. instance.appContext.propsCache.delete(instance.type);
  513. instance.appContext.emitsCache.delete(instance.type);
  514. instance.appContext.optionsCache.delete(instance.type);
  515. if (instance.ceReload) {
  516. dirtyInstances.add(instance);
  517. instance.ceReload(newComp.styles);
  518. dirtyInstances.delete(instance);
  519. } else if (instance.parent) {
  520. queueJob(() => {
  521. instance.parent.update();
  522. dirtyInstances.delete(instance);
  523. });
  524. } else if (instance.appContext.reload) {
  525. instance.appContext.reload();
  526. } else if (typeof window !== "undefined") {
  527. window.location.reload();
  528. } else {
  529. console.warn(
  530. "[HMR] Root or manually mounted instance modified. Full reload required."
  531. );
  532. }
  533. if (instance.root.ce && instance !== instance.root) {
  534. instance.root.ce._removeChildStyle(oldComp);
  535. }
  536. }
  537. queuePostFlushCb(() => {
  538. hmrDirtyComponents.clear();
  539. });
  540. }
  541. function updateComponentDef(oldComp, newComp) {
  542. shared.extend(oldComp, newComp);
  543. for (const key in oldComp) {
  544. if (key !== "__file" && !(key in newComp)) {
  545. delete oldComp[key];
  546. }
  547. }
  548. }
  549. function tryWrap(fn) {
  550. return (id, arg) => {
  551. try {
  552. return fn(id, arg);
  553. } catch (e) {
  554. console.error(e);
  555. console.warn(
  556. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  557. );
  558. }
  559. };
  560. }
  561. let devtools$1;
  562. let buffer = [];
  563. let devtoolsNotInstalled = false;
  564. function emit$1(event, ...args) {
  565. if (devtools$1) {
  566. devtools$1.emit(event, ...args);
  567. } else if (!devtoolsNotInstalled) {
  568. buffer.push({ event, args });
  569. }
  570. }
  571. function setDevtoolsHook$1(hook, target) {
  572. var _a, _b;
  573. devtools$1 = hook;
  574. if (devtools$1) {
  575. devtools$1.enabled = true;
  576. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  577. buffer = [];
  578. } else if (
  579. // handle late devtools injection - only do this if we are in an actual
  580. // browser environment to avoid the timer handle stalling test runner exit
  581. // (#4815)
  582. typeof window !== "undefined" && // some envs mock window but not fully
  583. window.HTMLElement && // also exclude jsdom
  584. // eslint-disable-next-line no-restricted-syntax
  585. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  586. ) {
  587. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  588. replay.push((newHook) => {
  589. setDevtoolsHook$1(newHook, target);
  590. });
  591. setTimeout(() => {
  592. if (!devtools$1) {
  593. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  594. devtoolsNotInstalled = true;
  595. buffer = [];
  596. }
  597. }, 3e3);
  598. } else {
  599. devtoolsNotInstalled = true;
  600. buffer = [];
  601. }
  602. }
  603. function devtoolsInitApp(app, version) {
  604. emit$1("app:init" /* APP_INIT */, app, version, {
  605. Fragment,
  606. Text,
  607. Comment,
  608. Static
  609. });
  610. }
  611. function devtoolsUnmountApp(app) {
  612. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  613. }
  614. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  615. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  616. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  617. "component:removed" /* COMPONENT_REMOVED */
  618. );
  619. const devtoolsComponentRemoved = (component) => {
  620. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  621. !devtools$1.cleanupBuffer(component)) {
  622. _devtoolsComponentRemoved(component);
  623. }
  624. };
  625. /*! #__NO_SIDE_EFFECTS__ */
  626. // @__NO_SIDE_EFFECTS__
  627. function createDevtoolsComponentHook(hook) {
  628. return (component) => {
  629. emit$1(
  630. hook,
  631. component.appContext.app,
  632. component.uid,
  633. component.parent ? component.parent.uid : void 0,
  634. component
  635. );
  636. };
  637. }
  638. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  639. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  640. function createDevtoolsPerformanceHook(hook) {
  641. return (component, type, time) => {
  642. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  643. };
  644. }
  645. function devtoolsComponentEmit(component, event, params) {
  646. emit$1(
  647. "component:emit" /* COMPONENT_EMIT */,
  648. component.appContext.app,
  649. component,
  650. event,
  651. params
  652. );
  653. }
  654. let currentRenderingInstance = null;
  655. let currentScopeId = null;
  656. function setCurrentRenderingInstance(instance) {
  657. const prev = currentRenderingInstance;
  658. currentRenderingInstance = instance;
  659. currentScopeId = instance && instance.type.__scopeId || null;
  660. return prev;
  661. }
  662. function pushScopeId(id) {
  663. currentScopeId = id;
  664. }
  665. function popScopeId() {
  666. currentScopeId = null;
  667. }
  668. const withScopeId = (_id) => withCtx;
  669. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  670. if (!ctx) return fn;
  671. if (fn._n) {
  672. return fn;
  673. }
  674. const renderFnWithContext = (...args) => {
  675. if (renderFnWithContext._d) {
  676. setBlockTracking(-1);
  677. }
  678. const prevInstance = setCurrentRenderingInstance(ctx);
  679. let res;
  680. try {
  681. res = fn(...args);
  682. } finally {
  683. setCurrentRenderingInstance(prevInstance);
  684. if (renderFnWithContext._d) {
  685. setBlockTracking(1);
  686. }
  687. }
  688. {
  689. devtoolsComponentUpdated(ctx);
  690. }
  691. return res;
  692. };
  693. renderFnWithContext._n = true;
  694. renderFnWithContext._c = true;
  695. renderFnWithContext._d = true;
  696. return renderFnWithContext;
  697. }
  698. function validateDirectiveName(name) {
  699. if (shared.isBuiltInDirective(name)) {
  700. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  701. }
  702. }
  703. function withDirectives(vnode, directives) {
  704. if (currentRenderingInstance === null) {
  705. warn$1(`withDirectives can only be used inside render functions.`);
  706. return vnode;
  707. }
  708. const instance = getComponentPublicInstance(currentRenderingInstance);
  709. const bindings = vnode.dirs || (vnode.dirs = []);
  710. for (let i = 0; i < directives.length; i++) {
  711. let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
  712. if (dir) {
  713. if (shared.isFunction(dir)) {
  714. dir = {
  715. mounted: dir,
  716. updated: dir
  717. };
  718. }
  719. if (dir.deep) {
  720. reactivity.traverse(value);
  721. }
  722. bindings.push({
  723. dir,
  724. instance,
  725. value,
  726. oldValue: void 0,
  727. arg,
  728. modifiers
  729. });
  730. }
  731. }
  732. return vnode;
  733. }
  734. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  735. const bindings = vnode.dirs;
  736. const oldBindings = prevVNode && prevVNode.dirs;
  737. for (let i = 0; i < bindings.length; i++) {
  738. const binding = bindings[i];
  739. if (oldBindings) {
  740. binding.oldValue = oldBindings[i].value;
  741. }
  742. let hook = binding.dir[name];
  743. if (hook) {
  744. reactivity.pauseTracking();
  745. callWithAsyncErrorHandling(hook, instance, 8, [
  746. vnode.el,
  747. binding,
  748. vnode,
  749. prevVNode
  750. ]);
  751. reactivity.resetTracking();
  752. }
  753. }
  754. }
  755. const TeleportEndKey = Symbol("_vte");
  756. const isTeleport = (type) => type.__isTeleport;
  757. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  758. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  759. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  760. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  761. const resolveTarget = (props, select) => {
  762. const targetSelector = props && props.to;
  763. if (shared.isString(targetSelector)) {
  764. if (!select) {
  765. warn$1(
  766. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  767. );
  768. return null;
  769. } else {
  770. const target = select(targetSelector);
  771. if (!target && !isTeleportDisabled(props)) {
  772. warn$1(
  773. `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.`
  774. );
  775. }
  776. return target;
  777. }
  778. } else {
  779. if (!targetSelector && !isTeleportDisabled(props)) {
  780. warn$1(`Invalid Teleport target: ${targetSelector}`);
  781. }
  782. return targetSelector;
  783. }
  784. };
  785. const TeleportImpl = {
  786. name: "Teleport",
  787. __isTeleport: true,
  788. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  789. const {
  790. mc: mountChildren,
  791. pc: patchChildren,
  792. pbc: patchBlockChildren,
  793. o: { insert, querySelector, createText, createComment }
  794. } = internals;
  795. const disabled = isTeleportDisabled(n2.props);
  796. let { shapeFlag, children, dynamicChildren } = n2;
  797. if (isHmrUpdating) {
  798. optimized = false;
  799. dynamicChildren = null;
  800. }
  801. if (n1 == null) {
  802. const placeholder = n2.el = createComment("teleport start") ;
  803. const mainAnchor = n2.anchor = createComment("teleport end") ;
  804. insert(placeholder, container, anchor);
  805. insert(mainAnchor, container, anchor);
  806. const mount = (container2, anchor2) => {
  807. if (shapeFlag & 16) {
  808. mountChildren(
  809. children,
  810. container2,
  811. anchor2,
  812. parentComponent,
  813. parentSuspense,
  814. namespace,
  815. slotScopeIds,
  816. optimized
  817. );
  818. }
  819. };
  820. const mountToTarget = () => {
  821. const target = n2.target = resolveTarget(n2.props, querySelector);
  822. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  823. if (target) {
  824. if (namespace !== "svg" && isTargetSVG(target)) {
  825. namespace = "svg";
  826. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  827. namespace = "mathml";
  828. }
  829. if (!disabled) {
  830. mount(target, targetAnchor);
  831. updateCssVars(n2);
  832. }
  833. } else if (!disabled) {
  834. warn$1(
  835. "Invalid Teleport target on mount:",
  836. target,
  837. `(${typeof target})`
  838. );
  839. }
  840. };
  841. if (disabled) {
  842. mount(container, mainAnchor);
  843. updateCssVars(n2);
  844. }
  845. if (isTeleportDeferred(n2.props)) {
  846. queuePostRenderEffect(mountToTarget, parentSuspense);
  847. } else {
  848. mountToTarget();
  849. }
  850. } else {
  851. n2.el = n1.el;
  852. n2.targetStart = n1.targetStart;
  853. const mainAnchor = n2.anchor = n1.anchor;
  854. const target = n2.target = n1.target;
  855. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  856. const wasDisabled = isTeleportDisabled(n1.props);
  857. const currentContainer = wasDisabled ? container : target;
  858. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  859. if (namespace === "svg" || isTargetSVG(target)) {
  860. namespace = "svg";
  861. } else if (namespace === "mathml" || isTargetMathML(target)) {
  862. namespace = "mathml";
  863. }
  864. if (dynamicChildren) {
  865. patchBlockChildren(
  866. n1.dynamicChildren,
  867. dynamicChildren,
  868. currentContainer,
  869. parentComponent,
  870. parentSuspense,
  871. namespace,
  872. slotScopeIds
  873. );
  874. traverseStaticChildren(n1, n2, true);
  875. } else if (!optimized) {
  876. patchChildren(
  877. n1,
  878. n2,
  879. currentContainer,
  880. currentAnchor,
  881. parentComponent,
  882. parentSuspense,
  883. namespace,
  884. slotScopeIds,
  885. false
  886. );
  887. }
  888. if (disabled) {
  889. if (!wasDisabled) {
  890. moveTeleport(
  891. n2,
  892. container,
  893. mainAnchor,
  894. internals,
  895. 1
  896. );
  897. } else {
  898. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  899. n2.props.to = n1.props.to;
  900. }
  901. }
  902. } else {
  903. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  904. const nextTarget = n2.target = resolveTarget(
  905. n2.props,
  906. querySelector
  907. );
  908. if (nextTarget) {
  909. moveTeleport(
  910. n2,
  911. nextTarget,
  912. null,
  913. internals,
  914. 0
  915. );
  916. } else {
  917. warn$1(
  918. "Invalid Teleport target on update:",
  919. target,
  920. `(${typeof target})`
  921. );
  922. }
  923. } else if (wasDisabled) {
  924. moveTeleport(
  925. n2,
  926. target,
  927. targetAnchor,
  928. internals,
  929. 1
  930. );
  931. }
  932. }
  933. updateCssVars(n2);
  934. }
  935. },
  936. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  937. const {
  938. shapeFlag,
  939. children,
  940. anchor,
  941. targetStart,
  942. targetAnchor,
  943. target,
  944. props
  945. } = vnode;
  946. if (target) {
  947. hostRemove(targetStart);
  948. hostRemove(targetAnchor);
  949. }
  950. doRemove && hostRemove(anchor);
  951. if (shapeFlag & 16) {
  952. const shouldRemove = doRemove || !isTeleportDisabled(props);
  953. for (let i = 0; i < children.length; i++) {
  954. const child = children[i];
  955. unmount(
  956. child,
  957. parentComponent,
  958. parentSuspense,
  959. shouldRemove,
  960. !!child.dynamicChildren
  961. );
  962. }
  963. }
  964. },
  965. move: moveTeleport,
  966. hydrate: hydrateTeleport
  967. };
  968. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  969. if (moveType === 0) {
  970. insert(vnode.targetAnchor, container, parentAnchor);
  971. }
  972. const { el, anchor, shapeFlag, children, props } = vnode;
  973. const isReorder = moveType === 2;
  974. if (isReorder) {
  975. insert(el, container, parentAnchor);
  976. }
  977. if (!isReorder || isTeleportDisabled(props)) {
  978. if (shapeFlag & 16) {
  979. for (let i = 0; i < children.length; i++) {
  980. move(
  981. children[i],
  982. container,
  983. parentAnchor,
  984. 2
  985. );
  986. }
  987. }
  988. }
  989. if (isReorder) {
  990. insert(anchor, container, parentAnchor);
  991. }
  992. }
  993. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  994. o: { nextSibling, parentNode, querySelector, insert, createText }
  995. }, hydrateChildren) {
  996. const target = vnode.target = resolveTarget(
  997. vnode.props,
  998. querySelector
  999. );
  1000. if (target) {
  1001. const targetNode = target._lpa || target.firstChild;
  1002. if (vnode.shapeFlag & 16) {
  1003. if (isTeleportDisabled(vnode.props)) {
  1004. vnode.anchor = hydrateChildren(
  1005. nextSibling(node),
  1006. vnode,
  1007. parentNode(node),
  1008. parentComponent,
  1009. parentSuspense,
  1010. slotScopeIds,
  1011. optimized
  1012. );
  1013. vnode.targetStart = targetNode;
  1014. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  1015. } else {
  1016. vnode.anchor = nextSibling(node);
  1017. let targetAnchor = targetNode;
  1018. while (targetAnchor) {
  1019. if (targetAnchor && targetAnchor.nodeType === 8) {
  1020. if (targetAnchor.data === "teleport start anchor") {
  1021. vnode.targetStart = targetAnchor;
  1022. } else if (targetAnchor.data === "teleport anchor") {
  1023. vnode.targetAnchor = targetAnchor;
  1024. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  1025. break;
  1026. }
  1027. }
  1028. targetAnchor = nextSibling(targetAnchor);
  1029. }
  1030. if (!vnode.targetAnchor) {
  1031. prepareAnchor(target, vnode, createText, insert);
  1032. }
  1033. hydrateChildren(
  1034. targetNode && nextSibling(targetNode),
  1035. vnode,
  1036. target,
  1037. parentComponent,
  1038. parentSuspense,
  1039. slotScopeIds,
  1040. optimized
  1041. );
  1042. }
  1043. }
  1044. updateCssVars(vnode);
  1045. }
  1046. return vnode.anchor && nextSibling(vnode.anchor);
  1047. }
  1048. const Teleport = TeleportImpl;
  1049. function updateCssVars(vnode) {
  1050. const ctx = vnode.ctx;
  1051. if (ctx && ctx.ut) {
  1052. let node = vnode.targetStart;
  1053. while (node && node !== vnode.targetAnchor) {
  1054. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  1055. node = node.nextSibling;
  1056. }
  1057. ctx.ut();
  1058. }
  1059. }
  1060. function prepareAnchor(target, vnode, createText, insert) {
  1061. const targetStart = vnode.targetStart = createText("");
  1062. const targetAnchor = vnode.targetAnchor = createText("");
  1063. targetStart[TeleportEndKey] = targetAnchor;
  1064. if (target) {
  1065. insert(targetStart, target);
  1066. insert(targetAnchor, target);
  1067. }
  1068. return targetAnchor;
  1069. }
  1070. const leaveCbKey = Symbol("_leaveCb");
  1071. const enterCbKey = Symbol("_enterCb");
  1072. function useTransitionState() {
  1073. const state = {
  1074. isMounted: false,
  1075. isLeaving: false,
  1076. isUnmounting: false,
  1077. leavingVNodes: /* @__PURE__ */ new Map()
  1078. };
  1079. onMounted(() => {
  1080. state.isMounted = true;
  1081. });
  1082. onBeforeUnmount(() => {
  1083. state.isUnmounting = true;
  1084. });
  1085. return state;
  1086. }
  1087. const TransitionHookValidator = [Function, Array];
  1088. const BaseTransitionPropsValidators = {
  1089. mode: String,
  1090. appear: Boolean,
  1091. persisted: Boolean,
  1092. // enter
  1093. onBeforeEnter: TransitionHookValidator,
  1094. onEnter: TransitionHookValidator,
  1095. onAfterEnter: TransitionHookValidator,
  1096. onEnterCancelled: TransitionHookValidator,
  1097. // leave
  1098. onBeforeLeave: TransitionHookValidator,
  1099. onLeave: TransitionHookValidator,
  1100. onAfterLeave: TransitionHookValidator,
  1101. onLeaveCancelled: TransitionHookValidator,
  1102. // appear
  1103. onBeforeAppear: TransitionHookValidator,
  1104. onAppear: TransitionHookValidator,
  1105. onAfterAppear: TransitionHookValidator,
  1106. onAppearCancelled: TransitionHookValidator
  1107. };
  1108. const recursiveGetSubtree = (instance) => {
  1109. const subTree = instance.subTree;
  1110. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  1111. };
  1112. const BaseTransitionImpl = {
  1113. name: `BaseTransition`,
  1114. props: BaseTransitionPropsValidators,
  1115. setup(props, { slots }) {
  1116. const instance = getCurrentInstance();
  1117. const state = useTransitionState();
  1118. return () => {
  1119. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  1120. if (!children || !children.length) {
  1121. return;
  1122. }
  1123. const child = findNonCommentChild(children);
  1124. const rawProps = reactivity.toRaw(props);
  1125. const { mode } = rawProps;
  1126. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  1127. warn$1(`invalid <transition> mode: ${mode}`);
  1128. }
  1129. if (state.isLeaving) {
  1130. return emptyPlaceholder(child);
  1131. }
  1132. const innerChild = getInnerChild$1(child);
  1133. if (!innerChild) {
  1134. return emptyPlaceholder(child);
  1135. }
  1136. let enterHooks = resolveTransitionHooks(
  1137. innerChild,
  1138. rawProps,
  1139. state,
  1140. instance,
  1141. // #11061, ensure enterHooks is fresh after clone
  1142. (hooks) => enterHooks = hooks
  1143. );
  1144. if (innerChild.type !== Comment) {
  1145. setTransitionHooks(innerChild, enterHooks);
  1146. }
  1147. const oldChild = instance.subTree;
  1148. const oldInnerChild = oldChild && getInnerChild$1(oldChild);
  1149. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  1150. const leavingHooks = resolveTransitionHooks(
  1151. oldInnerChild,
  1152. rawProps,
  1153. state,
  1154. instance
  1155. );
  1156. setTransitionHooks(oldInnerChild, leavingHooks);
  1157. if (mode === "out-in" && innerChild.type !== Comment) {
  1158. state.isLeaving = true;
  1159. leavingHooks.afterLeave = () => {
  1160. state.isLeaving = false;
  1161. if (!(instance.job.flags & 8)) {
  1162. instance.update();
  1163. }
  1164. delete leavingHooks.afterLeave;
  1165. };
  1166. return emptyPlaceholder(child);
  1167. } else if (mode === "in-out" && innerChild.type !== Comment) {
  1168. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  1169. const leavingVNodesCache = getLeavingNodesForType(
  1170. state,
  1171. oldInnerChild
  1172. );
  1173. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  1174. el[leaveCbKey] = () => {
  1175. earlyRemove();
  1176. el[leaveCbKey] = void 0;
  1177. delete enterHooks.delayedLeave;
  1178. };
  1179. enterHooks.delayedLeave = delayedLeave;
  1180. };
  1181. }
  1182. }
  1183. return child;
  1184. };
  1185. }
  1186. };
  1187. function findNonCommentChild(children) {
  1188. let child = children[0];
  1189. if (children.length > 1) {
  1190. let hasFound = false;
  1191. for (const c of children) {
  1192. if (c.type !== Comment) {
  1193. if (hasFound) {
  1194. warn$1(
  1195. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  1196. );
  1197. break;
  1198. }
  1199. child = c;
  1200. hasFound = true;
  1201. }
  1202. }
  1203. }
  1204. return child;
  1205. }
  1206. const BaseTransition = BaseTransitionImpl;
  1207. function getLeavingNodesForType(state, vnode) {
  1208. const { leavingVNodes } = state;
  1209. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  1210. if (!leavingVNodesCache) {
  1211. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  1212. leavingVNodes.set(vnode.type, leavingVNodesCache);
  1213. }
  1214. return leavingVNodesCache;
  1215. }
  1216. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  1217. const {
  1218. appear,
  1219. mode,
  1220. persisted = false,
  1221. onBeforeEnter,
  1222. onEnter,
  1223. onAfterEnter,
  1224. onEnterCancelled,
  1225. onBeforeLeave,
  1226. onLeave,
  1227. onAfterLeave,
  1228. onLeaveCancelled,
  1229. onBeforeAppear,
  1230. onAppear,
  1231. onAfterAppear,
  1232. onAppearCancelled
  1233. } = props;
  1234. const key = String(vnode.key);
  1235. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  1236. const callHook = (hook, args) => {
  1237. hook && callWithAsyncErrorHandling(
  1238. hook,
  1239. instance,
  1240. 9,
  1241. args
  1242. );
  1243. };
  1244. const callAsyncHook = (hook, args) => {
  1245. const done = args[1];
  1246. callHook(hook, args);
  1247. if (shared.isArray(hook)) {
  1248. if (hook.every((hook2) => hook2.length <= 1)) done();
  1249. } else if (hook.length <= 1) {
  1250. done();
  1251. }
  1252. };
  1253. const hooks = {
  1254. mode,
  1255. persisted,
  1256. beforeEnter(el) {
  1257. let hook = onBeforeEnter;
  1258. if (!state.isMounted) {
  1259. if (appear) {
  1260. hook = onBeforeAppear || onBeforeEnter;
  1261. } else {
  1262. return;
  1263. }
  1264. }
  1265. if (el[leaveCbKey]) {
  1266. el[leaveCbKey](
  1267. true
  1268. /* cancelled */
  1269. );
  1270. }
  1271. const leavingVNode = leavingVNodesCache[key];
  1272. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  1273. leavingVNode.el[leaveCbKey]();
  1274. }
  1275. callHook(hook, [el]);
  1276. },
  1277. enter(el) {
  1278. let hook = onEnter;
  1279. let afterHook = onAfterEnter;
  1280. let cancelHook = onEnterCancelled;
  1281. if (!state.isMounted) {
  1282. if (appear) {
  1283. hook = onAppear || onEnter;
  1284. afterHook = onAfterAppear || onAfterEnter;
  1285. cancelHook = onAppearCancelled || onEnterCancelled;
  1286. } else {
  1287. return;
  1288. }
  1289. }
  1290. let called = false;
  1291. const done = el[enterCbKey] = (cancelled) => {
  1292. if (called) return;
  1293. called = true;
  1294. if (cancelled) {
  1295. callHook(cancelHook, [el]);
  1296. } else {
  1297. callHook(afterHook, [el]);
  1298. }
  1299. if (hooks.delayedLeave) {
  1300. hooks.delayedLeave();
  1301. }
  1302. el[enterCbKey] = void 0;
  1303. };
  1304. if (hook) {
  1305. callAsyncHook(hook, [el, done]);
  1306. } else {
  1307. done();
  1308. }
  1309. },
  1310. leave(el, remove) {
  1311. const key2 = String(vnode.key);
  1312. if (el[enterCbKey]) {
  1313. el[enterCbKey](
  1314. true
  1315. /* cancelled */
  1316. );
  1317. }
  1318. if (state.isUnmounting) {
  1319. return remove();
  1320. }
  1321. callHook(onBeforeLeave, [el]);
  1322. let called = false;
  1323. const done = el[leaveCbKey] = (cancelled) => {
  1324. if (called) return;
  1325. called = true;
  1326. remove();
  1327. if (cancelled) {
  1328. callHook(onLeaveCancelled, [el]);
  1329. } else {
  1330. callHook(onAfterLeave, [el]);
  1331. }
  1332. el[leaveCbKey] = void 0;
  1333. if (leavingVNodesCache[key2] === vnode) {
  1334. delete leavingVNodesCache[key2];
  1335. }
  1336. };
  1337. leavingVNodesCache[key2] = vnode;
  1338. if (onLeave) {
  1339. callAsyncHook(onLeave, [el, done]);
  1340. } else {
  1341. done();
  1342. }
  1343. },
  1344. clone(vnode2) {
  1345. const hooks2 = resolveTransitionHooks(
  1346. vnode2,
  1347. props,
  1348. state,
  1349. instance,
  1350. postClone
  1351. );
  1352. if (postClone) postClone(hooks2);
  1353. return hooks2;
  1354. }
  1355. };
  1356. return hooks;
  1357. }
  1358. function emptyPlaceholder(vnode) {
  1359. if (isKeepAlive(vnode)) {
  1360. vnode = cloneVNode(vnode);
  1361. vnode.children = null;
  1362. return vnode;
  1363. }
  1364. }
  1365. function getInnerChild$1(vnode) {
  1366. if (!isKeepAlive(vnode)) {
  1367. if (isTeleport(vnode.type) && vnode.children) {
  1368. return findNonCommentChild(vnode.children);
  1369. }
  1370. return vnode;
  1371. }
  1372. if (vnode.component) {
  1373. return vnode.component.subTree;
  1374. }
  1375. const { shapeFlag, children } = vnode;
  1376. if (children) {
  1377. if (shapeFlag & 16) {
  1378. return children[0];
  1379. }
  1380. if (shapeFlag & 32 && shared.isFunction(children.default)) {
  1381. return children.default();
  1382. }
  1383. }
  1384. }
  1385. function setTransitionHooks(vnode, hooks) {
  1386. if (vnode.shapeFlag & 6 && vnode.component) {
  1387. vnode.transition = hooks;
  1388. setTransitionHooks(vnode.component.subTree, hooks);
  1389. } else if (vnode.shapeFlag & 128) {
  1390. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  1391. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  1392. } else {
  1393. vnode.transition = hooks;
  1394. }
  1395. }
  1396. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  1397. let ret = [];
  1398. let keyedFragmentCount = 0;
  1399. for (let i = 0; i < children.length; i++) {
  1400. let child = children[i];
  1401. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  1402. if (child.type === Fragment) {
  1403. if (child.patchFlag & 128) keyedFragmentCount++;
  1404. ret = ret.concat(
  1405. getTransitionRawChildren(child.children, keepComment, key)
  1406. );
  1407. } else if (keepComment || child.type !== Comment) {
  1408. ret.push(key != null ? cloneVNode(child, { key }) : child);
  1409. }
  1410. }
  1411. if (keyedFragmentCount > 1) {
  1412. for (let i = 0; i < ret.length; i++) {
  1413. ret[i].patchFlag = -2;
  1414. }
  1415. }
  1416. return ret;
  1417. }
  1418. /*! #__NO_SIDE_EFFECTS__ */
  1419. // @__NO_SIDE_EFFECTS__
  1420. function defineComponent(options, extraOptions) {
  1421. return shared.isFunction(options) ? (
  1422. // #8236: extend call and options.name access are considered side-effects
  1423. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  1424. /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
  1425. ) : options;
  1426. }
  1427. function useId() {
  1428. const i = getCurrentInstance();
  1429. if (i) {
  1430. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  1431. } else {
  1432. warn$1(
  1433. `useId() is called when there is no active component instance to be associated with.`
  1434. );
  1435. }
  1436. }
  1437. function markAsyncBoundary(instance) {
  1438. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  1439. }
  1440. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  1441. function useTemplateRef(key) {
  1442. const i = getCurrentInstance();
  1443. const r = reactivity.shallowRef(null);
  1444. if (i) {
  1445. const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
  1446. let desc;
  1447. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  1448. warn$1(`useTemplateRef('${key}') already exists.`);
  1449. } else {
  1450. Object.defineProperty(refs, key, {
  1451. enumerable: true,
  1452. get: () => r.value,
  1453. set: (val) => r.value = val
  1454. });
  1455. }
  1456. } else {
  1457. warn$1(
  1458. `useTemplateRef() is called when there is no active component instance to be associated with.`
  1459. );
  1460. }
  1461. const ret = reactivity.readonly(r) ;
  1462. {
  1463. knownTemplateRefs.add(ret);
  1464. }
  1465. return ret;
  1466. }
  1467. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  1468. if (shared.isArray(rawRef)) {
  1469. rawRef.forEach(
  1470. (r, i) => setRef(
  1471. r,
  1472. oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  1473. parentSuspense,
  1474. vnode,
  1475. isUnmount
  1476. )
  1477. );
  1478. return;
  1479. }
  1480. if (isAsyncWrapper(vnode) && !isUnmount) {
  1481. return;
  1482. }
  1483. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  1484. const value = isUnmount ? null : refValue;
  1485. const { i: owner, r: ref } = rawRef;
  1486. if (!owner) {
  1487. warn$1(
  1488. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  1489. );
  1490. return;
  1491. }
  1492. const oldRef = oldRawRef && oldRawRef.r;
  1493. const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
  1494. const setupState = owner.setupState;
  1495. const rawSetupState = reactivity.toRaw(setupState);
  1496. const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
  1497. if (knownTemplateRefs.has(rawSetupState[key])) {
  1498. return false;
  1499. }
  1500. return shared.hasOwn(rawSetupState, key);
  1501. };
  1502. if (oldRef != null && oldRef !== ref) {
  1503. if (shared.isString(oldRef)) {
  1504. refs[oldRef] = null;
  1505. if (canSetSetupRef(oldRef)) {
  1506. setupState[oldRef] = null;
  1507. }
  1508. } else if (reactivity.isRef(oldRef)) {
  1509. oldRef.value = null;
  1510. }
  1511. }
  1512. if (shared.isFunction(ref)) {
  1513. callWithErrorHandling(ref, owner, 12, [value, refs]);
  1514. } else {
  1515. const _isString = shared.isString(ref);
  1516. const _isRef = reactivity.isRef(ref);
  1517. if (_isString || _isRef) {
  1518. const doSet = () => {
  1519. if (rawRef.f) {
  1520. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
  1521. if (isUnmount) {
  1522. shared.isArray(existing) && shared.remove(existing, refValue);
  1523. } else {
  1524. if (!shared.isArray(existing)) {
  1525. if (_isString) {
  1526. refs[ref] = [refValue];
  1527. if (canSetSetupRef(ref)) {
  1528. setupState[ref] = refs[ref];
  1529. }
  1530. } else {
  1531. ref.value = [refValue];
  1532. if (rawRef.k) refs[rawRef.k] = ref.value;
  1533. }
  1534. } else if (!existing.includes(refValue)) {
  1535. existing.push(refValue);
  1536. }
  1537. }
  1538. } else if (_isString) {
  1539. refs[ref] = value;
  1540. if (canSetSetupRef(ref)) {
  1541. setupState[ref] = value;
  1542. }
  1543. } else if (_isRef) {
  1544. ref.value = value;
  1545. if (rawRef.k) refs[rawRef.k] = value;
  1546. } else {
  1547. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  1548. }
  1549. };
  1550. if (value) {
  1551. doSet.id = -1;
  1552. queuePostRenderEffect(doSet, parentSuspense);
  1553. } else {
  1554. doSet();
  1555. }
  1556. } else {
  1557. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  1558. }
  1559. }
  1560. }
  1561. let hasLoggedMismatchError = false;
  1562. const logMismatchError = () => {
  1563. if (hasLoggedMismatchError) {
  1564. return;
  1565. }
  1566. console.error("Hydration completed but contains mismatches.");
  1567. hasLoggedMismatchError = true;
  1568. };
  1569. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  1570. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  1571. const getContainerType = (container) => {
  1572. if (container.nodeType !== 1) return void 0;
  1573. if (isSVGContainer(container)) return "svg";
  1574. if (isMathMLContainer(container)) return "mathml";
  1575. return void 0;
  1576. };
  1577. const isComment = (node) => node.nodeType === 8;
  1578. function createHydrationFunctions(rendererInternals) {
  1579. const {
  1580. mt: mountComponent,
  1581. p: patch,
  1582. o: {
  1583. patchProp,
  1584. createText,
  1585. nextSibling,
  1586. parentNode,
  1587. remove,
  1588. insert,
  1589. createComment
  1590. }
  1591. } = rendererInternals;
  1592. const hydrate = (vnode, container) => {
  1593. if (!container.hasChildNodes()) {
  1594. warn$1(
  1595. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  1596. );
  1597. patch(null, vnode, container);
  1598. flushPostFlushCbs();
  1599. container._vnode = vnode;
  1600. return;
  1601. }
  1602. hydrateNode(container.firstChild, vnode, null, null, null);
  1603. flushPostFlushCbs();
  1604. container._vnode = vnode;
  1605. };
  1606. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  1607. optimized = optimized || !!vnode.dynamicChildren;
  1608. const isFragmentStart = isComment(node) && node.data === "[";
  1609. const onMismatch = () => handleMismatch(
  1610. node,
  1611. vnode,
  1612. parentComponent,
  1613. parentSuspense,
  1614. slotScopeIds,
  1615. isFragmentStart
  1616. );
  1617. const { type, ref, shapeFlag, patchFlag } = vnode;
  1618. let domType = node.nodeType;
  1619. vnode.el = node;
  1620. {
  1621. shared.def(node, "__vnode", vnode, true);
  1622. shared.def(node, "__vueParentComponent", parentComponent, true);
  1623. }
  1624. if (patchFlag === -2) {
  1625. optimized = false;
  1626. vnode.dynamicChildren = null;
  1627. }
  1628. let nextNode = null;
  1629. switch (type) {
  1630. case Text:
  1631. if (domType !== 3) {
  1632. if (vnode.children === "") {
  1633. insert(vnode.el = createText(""), parentNode(node), node);
  1634. nextNode = node;
  1635. } else {
  1636. nextNode = onMismatch();
  1637. }
  1638. } else {
  1639. if (node.data !== vnode.children) {
  1640. warn$1(
  1641. `Hydration text mismatch in`,
  1642. node.parentNode,
  1643. `
  1644. - rendered on server: ${JSON.stringify(
  1645. node.data
  1646. )}
  1647. - expected on client: ${JSON.stringify(vnode.children)}`
  1648. );
  1649. logMismatchError();
  1650. node.data = vnode.children;
  1651. }
  1652. nextNode = nextSibling(node);
  1653. }
  1654. break;
  1655. case Comment:
  1656. if (isTemplateNode(node)) {
  1657. nextNode = nextSibling(node);
  1658. replaceNode(
  1659. vnode.el = node.content.firstChild,
  1660. node,
  1661. parentComponent
  1662. );
  1663. } else if (domType !== 8 || isFragmentStart) {
  1664. nextNode = onMismatch();
  1665. } else {
  1666. nextNode = nextSibling(node);
  1667. }
  1668. break;
  1669. case Static:
  1670. if (isFragmentStart) {
  1671. node = nextSibling(node);
  1672. domType = node.nodeType;
  1673. }
  1674. if (domType === 1 || domType === 3) {
  1675. nextNode = node;
  1676. const needToAdoptContent = !vnode.children.length;
  1677. for (let i = 0; i < vnode.staticCount; i++) {
  1678. if (needToAdoptContent)
  1679. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  1680. if (i === vnode.staticCount - 1) {
  1681. vnode.anchor = nextNode;
  1682. }
  1683. nextNode = nextSibling(nextNode);
  1684. }
  1685. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  1686. } else {
  1687. onMismatch();
  1688. }
  1689. break;
  1690. case Fragment:
  1691. if (!isFragmentStart) {
  1692. nextNode = onMismatch();
  1693. } else {
  1694. nextNode = hydrateFragment(
  1695. node,
  1696. vnode,
  1697. parentComponent,
  1698. parentSuspense,
  1699. slotScopeIds,
  1700. optimized
  1701. );
  1702. }
  1703. break;
  1704. default:
  1705. if (shapeFlag & 1) {
  1706. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  1707. nextNode = onMismatch();
  1708. } else {
  1709. nextNode = hydrateElement(
  1710. node,
  1711. vnode,
  1712. parentComponent,
  1713. parentSuspense,
  1714. slotScopeIds,
  1715. optimized
  1716. );
  1717. }
  1718. } else if (shapeFlag & 6) {
  1719. vnode.slotScopeIds = slotScopeIds;
  1720. const container = parentNode(node);
  1721. if (isFragmentStart) {
  1722. nextNode = locateClosingAnchor(node);
  1723. } else if (isComment(node) && node.data === "teleport start") {
  1724. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  1725. } else {
  1726. nextNode = nextSibling(node);
  1727. }
  1728. mountComponent(
  1729. vnode,
  1730. container,
  1731. null,
  1732. parentComponent,
  1733. parentSuspense,
  1734. getContainerType(container),
  1735. optimized
  1736. );
  1737. if (isAsyncWrapper(vnode)) {
  1738. let subTree;
  1739. if (isFragmentStart) {
  1740. subTree = createVNode(Fragment);
  1741. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  1742. } else {
  1743. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  1744. }
  1745. subTree.el = node;
  1746. vnode.component.subTree = subTree;
  1747. }
  1748. } else if (shapeFlag & 64) {
  1749. if (domType !== 8) {
  1750. nextNode = onMismatch();
  1751. } else {
  1752. nextNode = vnode.type.hydrate(
  1753. node,
  1754. vnode,
  1755. parentComponent,
  1756. parentSuspense,
  1757. slotScopeIds,
  1758. optimized,
  1759. rendererInternals,
  1760. hydrateChildren
  1761. );
  1762. }
  1763. } else if (shapeFlag & 128) {
  1764. nextNode = vnode.type.hydrate(
  1765. node,
  1766. vnode,
  1767. parentComponent,
  1768. parentSuspense,
  1769. getContainerType(parentNode(node)),
  1770. slotScopeIds,
  1771. optimized,
  1772. rendererInternals,
  1773. hydrateNode
  1774. );
  1775. } else {
  1776. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  1777. }
  1778. }
  1779. if (ref != null) {
  1780. setRef(ref, null, parentSuspense, vnode);
  1781. }
  1782. return nextNode;
  1783. };
  1784. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  1785. optimized = optimized || !!vnode.dynamicChildren;
  1786. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  1787. const forcePatch = type === "input" || type === "option";
  1788. {
  1789. if (dirs) {
  1790. invokeDirectiveHook(vnode, null, parentComponent, "created");
  1791. }
  1792. let needCallTransitionHooks = false;
  1793. if (isTemplateNode(el)) {
  1794. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  1795. const content = el.content.firstChild;
  1796. if (needCallTransitionHooks) {
  1797. transition.beforeEnter(content);
  1798. }
  1799. replaceNode(content, el, parentComponent);
  1800. vnode.el = el = content;
  1801. }
  1802. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  1803. !(props && (props.innerHTML || props.textContent))) {
  1804. let next = hydrateChildren(
  1805. el.firstChild,
  1806. vnode,
  1807. el,
  1808. parentComponent,
  1809. parentSuspense,
  1810. slotScopeIds,
  1811. optimized
  1812. );
  1813. let hasWarned = false;
  1814. while (next) {
  1815. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  1816. if (!hasWarned) {
  1817. warn$1(
  1818. `Hydration children mismatch on`,
  1819. el,
  1820. `
  1821. Server rendered element contains more child nodes than client vdom.`
  1822. );
  1823. hasWarned = true;
  1824. }
  1825. logMismatchError();
  1826. }
  1827. const cur = next;
  1828. next = next.nextSibling;
  1829. remove(cur);
  1830. }
  1831. } else if (shapeFlag & 8) {
  1832. if (el.textContent !== vnode.children) {
  1833. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  1834. warn$1(
  1835. `Hydration text content mismatch on`,
  1836. el,
  1837. `
  1838. - rendered on server: ${el.textContent}
  1839. - expected on client: ${vnode.children}`
  1840. );
  1841. logMismatchError();
  1842. }
  1843. el.textContent = vnode.children;
  1844. }
  1845. }
  1846. if (props) {
  1847. {
  1848. const isCustomElement = el.tagName.includes("-");
  1849. for (const key in props) {
  1850. if (// #11189 skip if this node has directives that have created hooks
  1851. // as it could have mutated the DOM in any possible way
  1852. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  1853. logMismatchError();
  1854. }
  1855. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  1856. key[0] === "." || isCustomElement) {
  1857. patchProp(el, key, null, props[key], void 0, parentComponent);
  1858. }
  1859. }
  1860. }
  1861. }
  1862. let vnodeHooks;
  1863. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  1864. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  1865. }
  1866. if (dirs) {
  1867. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  1868. }
  1869. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  1870. queueEffectWithSuspense(() => {
  1871. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  1872. needCallTransitionHooks && transition.enter(el);
  1873. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  1874. }, parentSuspense);
  1875. }
  1876. }
  1877. return el.nextSibling;
  1878. };
  1879. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  1880. optimized = optimized || !!parentVNode.dynamicChildren;
  1881. const children = parentVNode.children;
  1882. const l = children.length;
  1883. let hasWarned = false;
  1884. for (let i = 0; i < l; i++) {
  1885. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  1886. const isText = vnode.type === Text;
  1887. if (node) {
  1888. if (isText && !optimized) {
  1889. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  1890. insert(
  1891. createText(
  1892. node.data.slice(vnode.children.length)
  1893. ),
  1894. container,
  1895. nextSibling(node)
  1896. );
  1897. node.data = vnode.children;
  1898. }
  1899. }
  1900. node = hydrateNode(
  1901. node,
  1902. vnode,
  1903. parentComponent,
  1904. parentSuspense,
  1905. slotScopeIds,
  1906. optimized
  1907. );
  1908. } else if (isText && !vnode.children) {
  1909. insert(vnode.el = createText(""), container);
  1910. } else {
  1911. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  1912. if (!hasWarned) {
  1913. warn$1(
  1914. `Hydration children mismatch on`,
  1915. container,
  1916. `
  1917. Server rendered element contains fewer child nodes than client vdom.`
  1918. );
  1919. hasWarned = true;
  1920. }
  1921. logMismatchError();
  1922. }
  1923. patch(
  1924. null,
  1925. vnode,
  1926. container,
  1927. null,
  1928. parentComponent,
  1929. parentSuspense,
  1930. getContainerType(container),
  1931. slotScopeIds
  1932. );
  1933. }
  1934. }
  1935. return node;
  1936. };
  1937. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  1938. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  1939. if (fragmentSlotScopeIds) {
  1940. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  1941. }
  1942. const container = parentNode(node);
  1943. const next = hydrateChildren(
  1944. nextSibling(node),
  1945. vnode,
  1946. container,
  1947. parentComponent,
  1948. parentSuspense,
  1949. slotScopeIds,
  1950. optimized
  1951. );
  1952. if (next && isComment(next) && next.data === "]") {
  1953. return nextSibling(vnode.anchor = next);
  1954. } else {
  1955. logMismatchError();
  1956. insert(vnode.anchor = createComment(`]`), container, next);
  1957. return next;
  1958. }
  1959. };
  1960. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  1961. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  1962. warn$1(
  1963. `Hydration node mismatch:
  1964. - rendered on server:`,
  1965. node,
  1966. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  1967. `
  1968. - expected on client:`,
  1969. vnode.type
  1970. );
  1971. logMismatchError();
  1972. }
  1973. vnode.el = null;
  1974. if (isFragment) {
  1975. const end = locateClosingAnchor(node);
  1976. while (true) {
  1977. const next2 = nextSibling(node);
  1978. if (next2 && next2 !== end) {
  1979. remove(next2);
  1980. } else {
  1981. break;
  1982. }
  1983. }
  1984. }
  1985. const next = nextSibling(node);
  1986. const container = parentNode(node);
  1987. remove(node);
  1988. patch(
  1989. null,
  1990. vnode,
  1991. container,
  1992. next,
  1993. parentComponent,
  1994. parentSuspense,
  1995. getContainerType(container),
  1996. slotScopeIds
  1997. );
  1998. return next;
  1999. };
  2000. const locateClosingAnchor = (node, open = "[", close = "]") => {
  2001. let match = 0;
  2002. while (node) {
  2003. node = nextSibling(node);
  2004. if (node && isComment(node)) {
  2005. if (node.data === open) match++;
  2006. if (node.data === close) {
  2007. if (match === 0) {
  2008. return nextSibling(node);
  2009. } else {
  2010. match--;
  2011. }
  2012. }
  2013. }
  2014. }
  2015. return node;
  2016. };
  2017. const replaceNode = (newNode, oldNode, parentComponent) => {
  2018. const parentNode2 = oldNode.parentNode;
  2019. if (parentNode2) {
  2020. parentNode2.replaceChild(newNode, oldNode);
  2021. }
  2022. let parent = parentComponent;
  2023. while (parent) {
  2024. if (parent.vnode.el === oldNode) {
  2025. parent.vnode.el = parent.subTree.el = newNode;
  2026. }
  2027. parent = parent.parent;
  2028. }
  2029. };
  2030. const isTemplateNode = (node) => {
  2031. return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
  2032. };
  2033. return [hydrate, hydrateNode];
  2034. }
  2035. function propHasMismatch(el, key, clientValue, vnode, instance) {
  2036. let mismatchType;
  2037. let mismatchKey;
  2038. let actual;
  2039. let expected;
  2040. if (key === "class") {
  2041. actual = el.getAttribute("class");
  2042. expected = shared.normalizeClass(clientValue);
  2043. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  2044. mismatchType = 2 /* CLASS */;
  2045. mismatchKey = `class`;
  2046. }
  2047. } else if (key === "style") {
  2048. actual = el.getAttribute("style") || "";
  2049. expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
  2050. const actualMap = toStyleMap(actual);
  2051. const expectedMap = toStyleMap(expected);
  2052. if (vnode.dirs) {
  2053. for (const { dir, value } of vnode.dirs) {
  2054. if (dir.name === "show" && !value) {
  2055. expectedMap.set("display", "none");
  2056. }
  2057. }
  2058. }
  2059. if (instance) {
  2060. resolveCssVars(instance, vnode, expectedMap);
  2061. }
  2062. if (!isMapEqual(actualMap, expectedMap)) {
  2063. mismatchType = 3 /* STYLE */;
  2064. mismatchKey = "style";
  2065. }
  2066. } else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
  2067. if (shared.isBooleanAttr(key)) {
  2068. actual = el.hasAttribute(key);
  2069. expected = shared.includeBooleanAttr(clientValue);
  2070. } else if (clientValue == null) {
  2071. actual = el.hasAttribute(key);
  2072. expected = false;
  2073. } else {
  2074. if (el.hasAttribute(key)) {
  2075. actual = el.getAttribute(key);
  2076. } else if (key === "value" && el.tagName === "TEXTAREA") {
  2077. actual = el.value;
  2078. } else {
  2079. actual = false;
  2080. }
  2081. expected = shared.isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  2082. }
  2083. if (actual !== expected) {
  2084. mismatchType = 4 /* ATTRIBUTE */;
  2085. mismatchKey = key;
  2086. }
  2087. }
  2088. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  2089. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  2090. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  2091. const postSegment = `
  2092. - rendered on server: ${format(actual)}
  2093. - expected on client: ${format(expected)}
  2094. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  2095. You should fix the source of the mismatch.`;
  2096. {
  2097. warn$1(preSegment, el, postSegment);
  2098. }
  2099. return true;
  2100. }
  2101. return false;
  2102. }
  2103. function toClassSet(str) {
  2104. return new Set(str.trim().split(/\s+/));
  2105. }
  2106. function isSetEqual(a, b) {
  2107. if (a.size !== b.size) {
  2108. return false;
  2109. }
  2110. for (const s of a) {
  2111. if (!b.has(s)) {
  2112. return false;
  2113. }
  2114. }
  2115. return true;
  2116. }
  2117. function toStyleMap(str) {
  2118. const styleMap = /* @__PURE__ */ new Map();
  2119. for (const item of str.split(";")) {
  2120. let [key, value] = item.split(":");
  2121. key = key.trim();
  2122. value = value && value.trim();
  2123. if (key && value) {
  2124. styleMap.set(key, value);
  2125. }
  2126. }
  2127. return styleMap;
  2128. }
  2129. function isMapEqual(a, b) {
  2130. if (a.size !== b.size) {
  2131. return false;
  2132. }
  2133. for (const [key, value] of a) {
  2134. if (value !== b.get(key)) {
  2135. return false;
  2136. }
  2137. }
  2138. return true;
  2139. }
  2140. function resolveCssVars(instance, vnode, expectedMap) {
  2141. const root = instance.subTree;
  2142. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  2143. const cssVars = instance.getCssVars();
  2144. for (const key in cssVars) {
  2145. expectedMap.set(
  2146. `--${shared.getEscapedCssVarName(key, false)}`,
  2147. String(cssVars[key])
  2148. );
  2149. }
  2150. }
  2151. if (vnode === root && instance.parent) {
  2152. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  2153. }
  2154. }
  2155. const allowMismatchAttr = "data-allow-mismatch";
  2156. const MismatchTypeString = {
  2157. [0 /* TEXT */]: "text",
  2158. [1 /* CHILDREN */]: "children",
  2159. [2 /* CLASS */]: "class",
  2160. [3 /* STYLE */]: "style",
  2161. [4 /* ATTRIBUTE */]: "attribute"
  2162. };
  2163. function isMismatchAllowed(el, allowedType) {
  2164. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  2165. while (el && !el.hasAttribute(allowMismatchAttr)) {
  2166. el = el.parentElement;
  2167. }
  2168. }
  2169. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  2170. if (allowedAttr == null) {
  2171. return false;
  2172. } else if (allowedAttr === "") {
  2173. return true;
  2174. } else {
  2175. const list = allowedAttr.split(",");
  2176. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  2177. return true;
  2178. }
  2179. return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
  2180. }
  2181. }
  2182. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  2183. const id = requestIdleCallback(hydrate, { timeout });
  2184. return () => cancelIdleCallback(id);
  2185. };
  2186. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  2187. const ob = new IntersectionObserver((entries) => {
  2188. for (const e of entries) {
  2189. if (!e.isIntersecting) continue;
  2190. ob.disconnect();
  2191. hydrate();
  2192. break;
  2193. }
  2194. }, opts);
  2195. forEach((el) => ob.observe(el));
  2196. return () => ob.disconnect();
  2197. };
  2198. const hydrateOnMediaQuery = (query) => (hydrate) => {
  2199. if (query) {
  2200. const mql = matchMedia(query);
  2201. if (mql.matches) {
  2202. hydrate();
  2203. } else {
  2204. mql.addEventListener("change", hydrate, { once: true });
  2205. return () => mql.removeEventListener("change", hydrate);
  2206. }
  2207. }
  2208. };
  2209. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  2210. if (shared.isString(interactions)) interactions = [interactions];
  2211. let hasHydrated = false;
  2212. const doHydrate = (e) => {
  2213. if (!hasHydrated) {
  2214. hasHydrated = true;
  2215. teardown();
  2216. hydrate();
  2217. e.target.dispatchEvent(new e.constructor(e.type, e));
  2218. }
  2219. };
  2220. const teardown = () => {
  2221. forEach((el) => {
  2222. for (const i of interactions) {
  2223. el.removeEventListener(i, doHydrate);
  2224. }
  2225. });
  2226. };
  2227. forEach((el) => {
  2228. for (const i of interactions) {
  2229. el.addEventListener(i, doHydrate, { once: true });
  2230. }
  2231. });
  2232. return teardown;
  2233. };
  2234. function forEachElement(node, cb) {
  2235. if (isComment(node) && node.data === "[") {
  2236. let depth = 1;
  2237. let next = node.nextSibling;
  2238. while (next) {
  2239. if (next.nodeType === 1) {
  2240. cb(next);
  2241. } else if (isComment(next)) {
  2242. if (next.data === "]") {
  2243. if (--depth === 0) break;
  2244. } else if (next.data === "[") {
  2245. depth++;
  2246. }
  2247. }
  2248. next = next.nextSibling;
  2249. }
  2250. } else {
  2251. cb(node);
  2252. }
  2253. }
  2254. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2255. /*! #__NO_SIDE_EFFECTS__ */
  2256. // @__NO_SIDE_EFFECTS__
  2257. function defineAsyncComponent(source) {
  2258. if (shared.isFunction(source)) {
  2259. source = { loader: source };
  2260. }
  2261. const {
  2262. loader,
  2263. loadingComponent,
  2264. errorComponent,
  2265. delay = 200,
  2266. hydrate: hydrateStrategy,
  2267. timeout,
  2268. // undefined = never times out
  2269. suspensible = true,
  2270. onError: userOnError
  2271. } = source;
  2272. let pendingRequest = null;
  2273. let resolvedComp;
  2274. let retries = 0;
  2275. const retry = () => {
  2276. retries++;
  2277. pendingRequest = null;
  2278. return load();
  2279. };
  2280. const load = () => {
  2281. let thisRequest;
  2282. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  2283. err = err instanceof Error ? err : new Error(String(err));
  2284. if (userOnError) {
  2285. return new Promise((resolve, reject) => {
  2286. const userRetry = () => resolve(retry());
  2287. const userFail = () => reject(err);
  2288. userOnError(err, userRetry, userFail, retries + 1);
  2289. });
  2290. } else {
  2291. throw err;
  2292. }
  2293. }).then((comp) => {
  2294. if (thisRequest !== pendingRequest && pendingRequest) {
  2295. return pendingRequest;
  2296. }
  2297. if (!comp) {
  2298. warn$1(
  2299. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  2300. );
  2301. }
  2302. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  2303. comp = comp.default;
  2304. }
  2305. if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
  2306. throw new Error(`Invalid async component load result: ${comp}`);
  2307. }
  2308. resolvedComp = comp;
  2309. return comp;
  2310. }));
  2311. };
  2312. return defineComponent({
  2313. name: "AsyncComponentWrapper",
  2314. __asyncLoader: load,
  2315. __asyncHydrate(el, instance, hydrate) {
  2316. const doHydrate = hydrateStrategy ? () => {
  2317. const teardown = hydrateStrategy(
  2318. hydrate,
  2319. (cb) => forEachElement(el, cb)
  2320. );
  2321. if (teardown) {
  2322. (instance.bum || (instance.bum = [])).push(teardown);
  2323. }
  2324. } : hydrate;
  2325. if (resolvedComp) {
  2326. doHydrate();
  2327. } else {
  2328. load().then(() => !instance.isUnmounted && doHydrate());
  2329. }
  2330. },
  2331. get __asyncResolved() {
  2332. return resolvedComp;
  2333. },
  2334. setup() {
  2335. const instance = currentInstance;
  2336. markAsyncBoundary(instance);
  2337. if (resolvedComp) {
  2338. return () => createInnerComp(resolvedComp, instance);
  2339. }
  2340. const onError = (err) => {
  2341. pendingRequest = null;
  2342. handleError(
  2343. err,
  2344. instance,
  2345. 13,
  2346. !errorComponent
  2347. );
  2348. };
  2349. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  2350. return load().then((comp) => {
  2351. return () => createInnerComp(comp, instance);
  2352. }).catch((err) => {
  2353. onError(err);
  2354. return () => errorComponent ? createVNode(errorComponent, {
  2355. error: err
  2356. }) : null;
  2357. });
  2358. }
  2359. const loaded = reactivity.ref(false);
  2360. const error = reactivity.ref();
  2361. const delayed = reactivity.ref(!!delay);
  2362. if (delay) {
  2363. setTimeout(() => {
  2364. delayed.value = false;
  2365. }, delay);
  2366. }
  2367. if (timeout != null) {
  2368. setTimeout(() => {
  2369. if (!loaded.value && !error.value) {
  2370. const err = new Error(
  2371. `Async component timed out after ${timeout}ms.`
  2372. );
  2373. onError(err);
  2374. error.value = err;
  2375. }
  2376. }, timeout);
  2377. }
  2378. load().then(() => {
  2379. loaded.value = true;
  2380. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  2381. queueJob(instance.parent.update);
  2382. }
  2383. }).catch((err) => {
  2384. onError(err);
  2385. error.value = err;
  2386. });
  2387. return () => {
  2388. if (loaded.value && resolvedComp) {
  2389. return createInnerComp(resolvedComp, instance);
  2390. } else if (error.value && errorComponent) {
  2391. return createVNode(errorComponent, {
  2392. error: error.value
  2393. });
  2394. } else if (loadingComponent && !delayed.value) {
  2395. return createVNode(loadingComponent);
  2396. }
  2397. };
  2398. }
  2399. });
  2400. }
  2401. function createInnerComp(comp, parent) {
  2402. const { ref: ref2, props, children, ce } = parent.vnode;
  2403. const vnode = createVNode(comp, props, children);
  2404. vnode.ref = ref2;
  2405. vnode.ce = ce;
  2406. delete parent.vnode.ce;
  2407. return vnode;
  2408. }
  2409. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2410. const KeepAliveImpl = {
  2411. name: `KeepAlive`,
  2412. // Marker for special handling inside the renderer. We are not using a ===
  2413. // check directly on KeepAlive in the renderer, because importing it directly
  2414. // would prevent it from being tree-shaken.
  2415. __isKeepAlive: true,
  2416. props: {
  2417. include: [String, RegExp, Array],
  2418. exclude: [String, RegExp, Array],
  2419. max: [String, Number]
  2420. },
  2421. setup(props, { slots }) {
  2422. const instance = getCurrentInstance();
  2423. const sharedContext = instance.ctx;
  2424. if (!sharedContext.renderer) {
  2425. return () => {
  2426. const children = slots.default && slots.default();
  2427. return children && children.length === 1 ? children[0] : children;
  2428. };
  2429. }
  2430. const cache = /* @__PURE__ */ new Map();
  2431. const keys = /* @__PURE__ */ new Set();
  2432. let current = null;
  2433. {
  2434. instance.__v_cache = cache;
  2435. }
  2436. const parentSuspense = instance.suspense;
  2437. const {
  2438. renderer: {
  2439. p: patch,
  2440. m: move,
  2441. um: _unmount,
  2442. o: { createElement }
  2443. }
  2444. } = sharedContext;
  2445. const storageContainer = createElement("div");
  2446. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  2447. const instance2 = vnode.component;
  2448. move(vnode, container, anchor, 0, parentSuspense);
  2449. patch(
  2450. instance2.vnode,
  2451. vnode,
  2452. container,
  2453. anchor,
  2454. instance2,
  2455. parentSuspense,
  2456. namespace,
  2457. vnode.slotScopeIds,
  2458. optimized
  2459. );
  2460. queuePostRenderEffect(() => {
  2461. instance2.isDeactivated = false;
  2462. if (instance2.a) {
  2463. shared.invokeArrayFns(instance2.a);
  2464. }
  2465. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  2466. if (vnodeHook) {
  2467. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2468. }
  2469. }, parentSuspense);
  2470. {
  2471. devtoolsComponentAdded(instance2);
  2472. }
  2473. };
  2474. sharedContext.deactivate = (vnode) => {
  2475. const instance2 = vnode.component;
  2476. invalidateMount(instance2.m);
  2477. invalidateMount(instance2.a);
  2478. move(vnode, storageContainer, null, 1, parentSuspense);
  2479. queuePostRenderEffect(() => {
  2480. if (instance2.da) {
  2481. shared.invokeArrayFns(instance2.da);
  2482. }
  2483. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  2484. if (vnodeHook) {
  2485. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2486. }
  2487. instance2.isDeactivated = true;
  2488. }, parentSuspense);
  2489. {
  2490. devtoolsComponentAdded(instance2);
  2491. }
  2492. };
  2493. function unmount(vnode) {
  2494. resetShapeFlag(vnode);
  2495. _unmount(vnode, instance, parentSuspense, true);
  2496. }
  2497. function pruneCache(filter) {
  2498. cache.forEach((vnode, key) => {
  2499. const name = getComponentName(vnode.type);
  2500. if (name && !filter(name)) {
  2501. pruneCacheEntry(key);
  2502. }
  2503. });
  2504. }
  2505. function pruneCacheEntry(key) {
  2506. const cached = cache.get(key);
  2507. if (cached && (!current || !isSameVNodeType(cached, current))) {
  2508. unmount(cached);
  2509. } else if (current) {
  2510. resetShapeFlag(current);
  2511. }
  2512. cache.delete(key);
  2513. keys.delete(key);
  2514. }
  2515. watch(
  2516. () => [props.include, props.exclude],
  2517. ([include, exclude]) => {
  2518. include && pruneCache((name) => matches(include, name));
  2519. exclude && pruneCache((name) => !matches(exclude, name));
  2520. },
  2521. // prune post-render after `current` has been updated
  2522. { flush: "post", deep: true }
  2523. );
  2524. let pendingCacheKey = null;
  2525. const cacheSubtree = () => {
  2526. if (pendingCacheKey != null) {
  2527. if (isSuspense(instance.subTree.type)) {
  2528. queuePostRenderEffect(() => {
  2529. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2530. }, instance.subTree.suspense);
  2531. } else {
  2532. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2533. }
  2534. }
  2535. };
  2536. onMounted(cacheSubtree);
  2537. onUpdated(cacheSubtree);
  2538. onBeforeUnmount(() => {
  2539. cache.forEach((cached) => {
  2540. const { subTree, suspense } = instance;
  2541. const vnode = getInnerChild(subTree);
  2542. if (cached.type === vnode.type && cached.key === vnode.key) {
  2543. resetShapeFlag(vnode);
  2544. const da = vnode.component.da;
  2545. da && queuePostRenderEffect(da, suspense);
  2546. return;
  2547. }
  2548. unmount(cached);
  2549. });
  2550. });
  2551. return () => {
  2552. pendingCacheKey = null;
  2553. if (!slots.default) {
  2554. return current = null;
  2555. }
  2556. const children = slots.default();
  2557. const rawVNode = children[0];
  2558. if (children.length > 1) {
  2559. {
  2560. warn$1(`KeepAlive should contain exactly one component child.`);
  2561. }
  2562. current = null;
  2563. return children;
  2564. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2565. current = null;
  2566. return rawVNode;
  2567. }
  2568. let vnode = getInnerChild(rawVNode);
  2569. if (vnode.type === Comment) {
  2570. current = null;
  2571. return vnode;
  2572. }
  2573. const comp = vnode.type;
  2574. const name = getComponentName(
  2575. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2576. );
  2577. const { include, exclude, max } = props;
  2578. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2579. vnode.shapeFlag &= ~256;
  2580. current = vnode;
  2581. return rawVNode;
  2582. }
  2583. const key = vnode.key == null ? comp : vnode.key;
  2584. const cachedVNode = cache.get(key);
  2585. if (vnode.el) {
  2586. vnode = cloneVNode(vnode);
  2587. if (rawVNode.shapeFlag & 128) {
  2588. rawVNode.ssContent = vnode;
  2589. }
  2590. }
  2591. pendingCacheKey = key;
  2592. if (cachedVNode) {
  2593. vnode.el = cachedVNode.el;
  2594. vnode.component = cachedVNode.component;
  2595. if (vnode.transition) {
  2596. setTransitionHooks(vnode, vnode.transition);
  2597. }
  2598. vnode.shapeFlag |= 512;
  2599. keys.delete(key);
  2600. keys.add(key);
  2601. } else {
  2602. keys.add(key);
  2603. if (max && keys.size > parseInt(max, 10)) {
  2604. pruneCacheEntry(keys.values().next().value);
  2605. }
  2606. }
  2607. vnode.shapeFlag |= 256;
  2608. current = vnode;
  2609. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  2610. };
  2611. }
  2612. };
  2613. const KeepAlive = KeepAliveImpl;
  2614. function matches(pattern, name) {
  2615. if (shared.isArray(pattern)) {
  2616. return pattern.some((p) => matches(p, name));
  2617. } else if (shared.isString(pattern)) {
  2618. return pattern.split(",").includes(name);
  2619. } else if (shared.isRegExp(pattern)) {
  2620. pattern.lastIndex = 0;
  2621. return pattern.test(name);
  2622. }
  2623. return false;
  2624. }
  2625. function onActivated(hook, target) {
  2626. registerKeepAliveHook(hook, "a", target);
  2627. }
  2628. function onDeactivated(hook, target) {
  2629. registerKeepAliveHook(hook, "da", target);
  2630. }
  2631. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2632. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2633. let current = target;
  2634. while (current) {
  2635. if (current.isDeactivated) {
  2636. return;
  2637. }
  2638. current = current.parent;
  2639. }
  2640. return hook();
  2641. });
  2642. injectHook(type, wrappedHook, target);
  2643. if (target) {
  2644. let current = target.parent;
  2645. while (current && current.parent) {
  2646. if (isKeepAlive(current.parent.vnode)) {
  2647. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2648. }
  2649. current = current.parent;
  2650. }
  2651. }
  2652. }
  2653. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2654. const injected = injectHook(
  2655. type,
  2656. hook,
  2657. keepAliveRoot,
  2658. true
  2659. /* prepend */
  2660. );
  2661. onUnmounted(() => {
  2662. shared.remove(keepAliveRoot[type], injected);
  2663. }, target);
  2664. }
  2665. function resetShapeFlag(vnode) {
  2666. vnode.shapeFlag &= ~256;
  2667. vnode.shapeFlag &= ~512;
  2668. }
  2669. function getInnerChild(vnode) {
  2670. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  2671. }
  2672. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2673. if (target) {
  2674. const hooks = target[type] || (target[type] = []);
  2675. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2676. reactivity.pauseTracking();
  2677. const reset = setCurrentInstance(target);
  2678. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2679. reset();
  2680. reactivity.resetTracking();
  2681. return res;
  2682. });
  2683. if (prepend) {
  2684. hooks.unshift(wrappedHook);
  2685. } else {
  2686. hooks.push(wrappedHook);
  2687. }
  2688. return wrappedHook;
  2689. } else {
  2690. const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  2691. warn$1(
  2692. `${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.` )
  2693. );
  2694. }
  2695. }
  2696. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  2697. if (!isInSSRComponentSetup || lifecycle === "sp") {
  2698. injectHook(lifecycle, (...args) => hook(...args), target);
  2699. }
  2700. };
  2701. const onBeforeMount = createHook("bm");
  2702. const onMounted = createHook("m");
  2703. const onBeforeUpdate = createHook(
  2704. "bu"
  2705. );
  2706. const onUpdated = createHook("u");
  2707. const onBeforeUnmount = createHook(
  2708. "bum"
  2709. );
  2710. const onUnmounted = createHook("um");
  2711. const onServerPrefetch = createHook(
  2712. "sp"
  2713. );
  2714. const onRenderTriggered = createHook("rtg");
  2715. const onRenderTracked = createHook("rtc");
  2716. function onErrorCaptured(hook, target = currentInstance) {
  2717. injectHook("ec", hook, target);
  2718. }
  2719. const COMPONENTS = "components";
  2720. const DIRECTIVES = "directives";
  2721. function resolveComponent(name, maybeSelfReference) {
  2722. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2723. }
  2724. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2725. function resolveDynamicComponent(component) {
  2726. if (shared.isString(component)) {
  2727. return resolveAsset(COMPONENTS, component, false) || component;
  2728. } else {
  2729. return component || NULL_DYNAMIC_COMPONENT;
  2730. }
  2731. }
  2732. function resolveDirective(name) {
  2733. return resolveAsset(DIRECTIVES, name);
  2734. }
  2735. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2736. const instance = currentRenderingInstance || currentInstance;
  2737. if (instance) {
  2738. const Component = instance.type;
  2739. if (type === COMPONENTS) {
  2740. const selfName = getComponentName(
  2741. Component,
  2742. false
  2743. );
  2744. if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
  2745. return Component;
  2746. }
  2747. }
  2748. const res = (
  2749. // local registration
  2750. // check instance[type] first which is resolved for options API
  2751. resolve(instance[type] || Component[type], name) || // global registration
  2752. resolve(instance.appContext[type], name)
  2753. );
  2754. if (!res && maybeSelfReference) {
  2755. return Component;
  2756. }
  2757. if (warnMissing && !res) {
  2758. const extra = type === COMPONENTS ? `
  2759. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2760. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2761. }
  2762. return res;
  2763. } else {
  2764. warn$1(
  2765. `resolve${shared.capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2766. );
  2767. }
  2768. }
  2769. function resolve(registry, name) {
  2770. return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
  2771. }
  2772. function renderList(source, renderItem, cache, index) {
  2773. let ret;
  2774. const cached = cache && cache[index];
  2775. const sourceIsArray = shared.isArray(source);
  2776. if (sourceIsArray || shared.isString(source)) {
  2777. const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
  2778. let needsWrap = false;
  2779. if (sourceIsReactiveArray) {
  2780. needsWrap = !reactivity.isShallow(source);
  2781. source = reactivity.shallowReadArray(source);
  2782. }
  2783. ret = new Array(source.length);
  2784. for (let i = 0, l = source.length; i < l; i++) {
  2785. ret[i] = renderItem(
  2786. needsWrap ? reactivity.toReactive(source[i]) : source[i],
  2787. i,
  2788. void 0,
  2789. cached && cached[i]
  2790. );
  2791. }
  2792. } else if (typeof source === "number") {
  2793. if (!Number.isInteger(source)) {
  2794. warn$1(`The v-for range expect an integer value but got ${source}.`);
  2795. }
  2796. ret = new Array(source);
  2797. for (let i = 0; i < source; i++) {
  2798. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  2799. }
  2800. } else if (shared.isObject(source)) {
  2801. if (source[Symbol.iterator]) {
  2802. ret = Array.from(
  2803. source,
  2804. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  2805. );
  2806. } else {
  2807. const keys = Object.keys(source);
  2808. ret = new Array(keys.length);
  2809. for (let i = 0, l = keys.length; i < l; i++) {
  2810. const key = keys[i];
  2811. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  2812. }
  2813. }
  2814. } else {
  2815. ret = [];
  2816. }
  2817. if (cache) {
  2818. cache[index] = ret;
  2819. }
  2820. return ret;
  2821. }
  2822. function createSlots(slots, dynamicSlots) {
  2823. for (let i = 0; i < dynamicSlots.length; i++) {
  2824. const slot = dynamicSlots[i];
  2825. if (shared.isArray(slot)) {
  2826. for (let j = 0; j < slot.length; j++) {
  2827. slots[slot[j].name] = slot[j].fn;
  2828. }
  2829. } else if (slot) {
  2830. slots[slot.name] = slot.key ? (...args) => {
  2831. const res = slot.fn(...args);
  2832. if (res) res.key = slot.key;
  2833. return res;
  2834. } : slot.fn;
  2835. }
  2836. }
  2837. return slots;
  2838. }
  2839. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  2840. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  2841. if (name !== "default") props.name = name;
  2842. return openBlock(), createBlock(
  2843. Fragment,
  2844. null,
  2845. [createVNode("slot", props, fallback && fallback())],
  2846. 64
  2847. );
  2848. }
  2849. let slot = slots[name];
  2850. if (slot && slot.length > 1) {
  2851. warn$1(
  2852. `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.`
  2853. );
  2854. slot = () => [];
  2855. }
  2856. if (slot && slot._c) {
  2857. slot._d = false;
  2858. }
  2859. openBlock();
  2860. const validSlotContent = slot && ensureValidVNode(slot(props));
  2861. const rendered = createBlock(
  2862. Fragment,
  2863. {
  2864. key: (props.key || // slot content array of a dynamic conditional slot may have a branch
  2865. // key attached in the `createSlots` helper, respect that
  2866. validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
  2867. (!validSlotContent && fallback ? "_fb" : "")
  2868. },
  2869. validSlotContent || (fallback ? fallback() : []),
  2870. validSlotContent && slots._ === 1 ? 64 : -2
  2871. );
  2872. if (!noSlotted && rendered.scopeId) {
  2873. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  2874. }
  2875. if (slot && slot._c) {
  2876. slot._d = true;
  2877. }
  2878. return rendered;
  2879. }
  2880. function ensureValidVNode(vnodes) {
  2881. return vnodes.some((child) => {
  2882. if (!isVNode(child)) return true;
  2883. if (child.type === Comment) return false;
  2884. if (child.type === Fragment && !ensureValidVNode(child.children))
  2885. return false;
  2886. return true;
  2887. }) ? vnodes : null;
  2888. }
  2889. function toHandlers(obj, preserveCaseIfNecessary) {
  2890. const ret = {};
  2891. if (!shared.isObject(obj)) {
  2892. warn$1(`v-on with no argument expects an object value.`);
  2893. return ret;
  2894. }
  2895. for (const key in obj) {
  2896. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
  2897. }
  2898. return ret;
  2899. }
  2900. const getPublicInstance = (i) => {
  2901. if (!i) return null;
  2902. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  2903. return getPublicInstance(i.parent);
  2904. };
  2905. const publicPropertiesMap = (
  2906. // Move PURE marker to new line to workaround compiler discarding it
  2907. // due to type annotation
  2908. /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
  2909. $: (i) => i,
  2910. $el: (i) => i.vnode.el,
  2911. $data: (i) => i.data,
  2912. $props: (i) => reactivity.shallowReadonly(i.props) ,
  2913. $attrs: (i) => reactivity.shallowReadonly(i.attrs) ,
  2914. $slots: (i) => reactivity.shallowReadonly(i.slots) ,
  2915. $refs: (i) => reactivity.shallowReadonly(i.refs) ,
  2916. $parent: (i) => getPublicInstance(i.parent),
  2917. $root: (i) => getPublicInstance(i.root),
  2918. $host: (i) => i.ce,
  2919. $emit: (i) => i.emit,
  2920. $options: (i) => resolveMergedOptions(i) ,
  2921. $forceUpdate: (i) => i.f || (i.f = () => {
  2922. queueJob(i.update);
  2923. }),
  2924. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  2925. $watch: (i) => instanceWatch.bind(i)
  2926. })
  2927. );
  2928. const isReservedPrefix = (key) => key === "_" || key === "$";
  2929. const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
  2930. const PublicInstanceProxyHandlers = {
  2931. get({ _: instance }, key) {
  2932. if (key === "__v_skip") {
  2933. return true;
  2934. }
  2935. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2936. if (key === "__isVue") {
  2937. return true;
  2938. }
  2939. let normalizedProps;
  2940. if (key[0] !== "$") {
  2941. const n = accessCache[key];
  2942. if (n !== void 0) {
  2943. switch (n) {
  2944. case 1 /* SETUP */:
  2945. return setupState[key];
  2946. case 2 /* DATA */:
  2947. return data[key];
  2948. case 4 /* CONTEXT */:
  2949. return ctx[key];
  2950. case 3 /* PROPS */:
  2951. return props[key];
  2952. }
  2953. } else if (hasSetupBinding(setupState, key)) {
  2954. accessCache[key] = 1 /* SETUP */;
  2955. return setupState[key];
  2956. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  2957. accessCache[key] = 2 /* DATA */;
  2958. return data[key];
  2959. } else if (
  2960. // only cache other properties when instance has declared (thus stable)
  2961. // props
  2962. (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
  2963. ) {
  2964. accessCache[key] = 3 /* PROPS */;
  2965. return props[key];
  2966. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2967. accessCache[key] = 4 /* CONTEXT */;
  2968. return ctx[key];
  2969. } else if (shouldCacheAccess) {
  2970. accessCache[key] = 0 /* OTHER */;
  2971. }
  2972. }
  2973. const publicGetter = publicPropertiesMap[key];
  2974. let cssModule, globalProperties;
  2975. if (publicGetter) {
  2976. if (key === "$attrs") {
  2977. reactivity.track(instance.attrs, "get", "");
  2978. markAttrsAccessed();
  2979. } else if (key === "$slots") {
  2980. reactivity.track(instance, "get", key);
  2981. }
  2982. return publicGetter(instance);
  2983. } else if (
  2984. // css module (injected by vue-loader)
  2985. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2986. ) {
  2987. return cssModule;
  2988. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2989. accessCache[key] = 4 /* CONTEXT */;
  2990. return ctx[key];
  2991. } else if (
  2992. // global properties
  2993. globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
  2994. ) {
  2995. {
  2996. return globalProperties[key];
  2997. }
  2998. } else if (currentRenderingInstance && (!shared.isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  2999. // to infinite warning loop
  3000. key.indexOf("__v") !== 0)) {
  3001. if (data !== shared.EMPTY_OBJ && isReservedPrefix(key[0]) && shared.hasOwn(data, key)) {
  3002. warn$1(
  3003. `Property ${JSON.stringify(
  3004. key
  3005. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  3006. );
  3007. } else if (instance === currentRenderingInstance) {
  3008. warn$1(
  3009. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  3010. );
  3011. }
  3012. }
  3013. },
  3014. set({ _: instance }, key, value) {
  3015. const { data, setupState, ctx } = instance;
  3016. if (hasSetupBinding(setupState, key)) {
  3017. setupState[key] = value;
  3018. return true;
  3019. } else if (setupState.__isScriptSetup && shared.hasOwn(setupState, key)) {
  3020. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  3021. return false;
  3022. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  3023. data[key] = value;
  3024. return true;
  3025. } else if (shared.hasOwn(instance.props, key)) {
  3026. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  3027. return false;
  3028. }
  3029. if (key[0] === "$" && key.slice(1) in instance) {
  3030. warn$1(
  3031. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  3032. );
  3033. return false;
  3034. } else {
  3035. if (key in instance.appContext.config.globalProperties) {
  3036. Object.defineProperty(ctx, key, {
  3037. enumerable: true,
  3038. configurable: true,
  3039. value
  3040. });
  3041. } else {
  3042. ctx[key] = value;
  3043. }
  3044. }
  3045. return true;
  3046. },
  3047. has({
  3048. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  3049. }, key) {
  3050. let normalizedProps;
  3051. return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
  3052. },
  3053. defineProperty(target, key, descriptor) {
  3054. if (descriptor.get != null) {
  3055. target._.accessCache[key] = 0;
  3056. } else if (shared.hasOwn(descriptor, "value")) {
  3057. this.set(target, key, descriptor.value, null);
  3058. }
  3059. return Reflect.defineProperty(target, key, descriptor);
  3060. }
  3061. };
  3062. {
  3063. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3064. warn$1(
  3065. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  3066. );
  3067. return Reflect.ownKeys(target);
  3068. };
  3069. }
  3070. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend({}, PublicInstanceProxyHandlers, {
  3071. get(target, key) {
  3072. if (key === Symbol.unscopables) {
  3073. return;
  3074. }
  3075. return PublicInstanceProxyHandlers.get(target, key, target);
  3076. },
  3077. has(_, key) {
  3078. const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
  3079. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  3080. warn$1(
  3081. `Property ${JSON.stringify(
  3082. key
  3083. )} should not start with _ which is a reserved prefix for Vue internals.`
  3084. );
  3085. }
  3086. return has;
  3087. }
  3088. });
  3089. function createDevRenderContext(instance) {
  3090. const target = {};
  3091. Object.defineProperty(target, `_`, {
  3092. configurable: true,
  3093. enumerable: false,
  3094. get: () => instance
  3095. });
  3096. Object.keys(publicPropertiesMap).forEach((key) => {
  3097. Object.defineProperty(target, key, {
  3098. configurable: true,
  3099. enumerable: false,
  3100. get: () => publicPropertiesMap[key](instance),
  3101. // intercepted by the proxy so no need for implementation,
  3102. // but needed to prevent set errors
  3103. set: shared.NOOP
  3104. });
  3105. });
  3106. return target;
  3107. }
  3108. function exposePropsOnRenderContext(instance) {
  3109. const {
  3110. ctx,
  3111. propsOptions: [propsOptions]
  3112. } = instance;
  3113. if (propsOptions) {
  3114. Object.keys(propsOptions).forEach((key) => {
  3115. Object.defineProperty(ctx, key, {
  3116. enumerable: true,
  3117. configurable: true,
  3118. get: () => instance.props[key],
  3119. set: shared.NOOP
  3120. });
  3121. });
  3122. }
  3123. }
  3124. function exposeSetupStateOnRenderContext(instance) {
  3125. const { ctx, setupState } = instance;
  3126. Object.keys(reactivity.toRaw(setupState)).forEach((key) => {
  3127. if (!setupState.__isScriptSetup) {
  3128. if (isReservedPrefix(key[0])) {
  3129. warn$1(
  3130. `setup() return property ${JSON.stringify(
  3131. key
  3132. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  3133. );
  3134. return;
  3135. }
  3136. Object.defineProperty(ctx, key, {
  3137. enumerable: true,
  3138. configurable: true,
  3139. get: () => setupState[key],
  3140. set: shared.NOOP
  3141. });
  3142. }
  3143. });
  3144. }
  3145. const warnRuntimeUsage = (method) => warn$1(
  3146. `${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.`
  3147. );
  3148. function defineProps() {
  3149. {
  3150. warnRuntimeUsage(`defineProps`);
  3151. }
  3152. return null;
  3153. }
  3154. function defineEmits() {
  3155. {
  3156. warnRuntimeUsage(`defineEmits`);
  3157. }
  3158. return null;
  3159. }
  3160. function defineExpose(exposed) {
  3161. {
  3162. warnRuntimeUsage(`defineExpose`);
  3163. }
  3164. }
  3165. function defineOptions(options) {
  3166. {
  3167. warnRuntimeUsage(`defineOptions`);
  3168. }
  3169. }
  3170. function defineSlots() {
  3171. {
  3172. warnRuntimeUsage(`defineSlots`);
  3173. }
  3174. return null;
  3175. }
  3176. function defineModel() {
  3177. {
  3178. warnRuntimeUsage("defineModel");
  3179. }
  3180. }
  3181. function withDefaults(props, defaults) {
  3182. {
  3183. warnRuntimeUsage(`withDefaults`);
  3184. }
  3185. return null;
  3186. }
  3187. function useSlots() {
  3188. return getContext().slots;
  3189. }
  3190. function useAttrs() {
  3191. return getContext().attrs;
  3192. }
  3193. function getContext() {
  3194. const i = getCurrentInstance();
  3195. if (!i) {
  3196. warn$1(`useContext() called without active instance.`);
  3197. }
  3198. return i.setupContext || (i.setupContext = createSetupContext(i));
  3199. }
  3200. function normalizePropsOrEmits(props) {
  3201. return shared.isArray(props) ? props.reduce(
  3202. (normalized, p) => (normalized[p] = null, normalized),
  3203. {}
  3204. ) : props;
  3205. }
  3206. function mergeDefaults(raw, defaults) {
  3207. const props = normalizePropsOrEmits(raw);
  3208. for (const key in defaults) {
  3209. if (key.startsWith("__skip")) continue;
  3210. let opt = props[key];
  3211. if (opt) {
  3212. if (shared.isArray(opt) || shared.isFunction(opt)) {
  3213. opt = props[key] = { type: opt, default: defaults[key] };
  3214. } else {
  3215. opt.default = defaults[key];
  3216. }
  3217. } else if (opt === null) {
  3218. opt = props[key] = { default: defaults[key] };
  3219. } else {
  3220. warn$1(`props default key "${key}" has no corresponding declaration.`);
  3221. }
  3222. if (opt && defaults[`__skip_${key}`]) {
  3223. opt.skipFactory = true;
  3224. }
  3225. }
  3226. return props;
  3227. }
  3228. function mergeModels(a, b) {
  3229. if (!a || !b) return a || b;
  3230. if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
  3231. return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  3232. }
  3233. function createPropsRestProxy(props, excludedKeys) {
  3234. const ret = {};
  3235. for (const key in props) {
  3236. if (!excludedKeys.includes(key)) {
  3237. Object.defineProperty(ret, key, {
  3238. enumerable: true,
  3239. get: () => props[key]
  3240. });
  3241. }
  3242. }
  3243. return ret;
  3244. }
  3245. function withAsyncContext(getAwaitable) {
  3246. const ctx = getCurrentInstance();
  3247. if (!ctx) {
  3248. warn$1(
  3249. `withAsyncContext called without active current instance. This is likely a bug.`
  3250. );
  3251. }
  3252. let awaitable = getAwaitable();
  3253. unsetCurrentInstance();
  3254. if (shared.isPromise(awaitable)) {
  3255. awaitable = awaitable.catch((e) => {
  3256. setCurrentInstance(ctx);
  3257. throw e;
  3258. });
  3259. }
  3260. return [awaitable, () => setCurrentInstance(ctx)];
  3261. }
  3262. function createDuplicateChecker() {
  3263. const cache = /* @__PURE__ */ Object.create(null);
  3264. return (type, key) => {
  3265. if (cache[key]) {
  3266. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3267. } else {
  3268. cache[key] = type;
  3269. }
  3270. };
  3271. }
  3272. let shouldCacheAccess = true;
  3273. function applyOptions(instance) {
  3274. const options = resolveMergedOptions(instance);
  3275. const publicThis = instance.proxy;
  3276. const ctx = instance.ctx;
  3277. shouldCacheAccess = false;
  3278. if (options.beforeCreate) {
  3279. callHook(options.beforeCreate, instance, "bc");
  3280. }
  3281. const {
  3282. // state
  3283. data: dataOptions,
  3284. computed: computedOptions,
  3285. methods,
  3286. watch: watchOptions,
  3287. provide: provideOptions,
  3288. inject: injectOptions,
  3289. // lifecycle
  3290. created,
  3291. beforeMount,
  3292. mounted,
  3293. beforeUpdate,
  3294. updated,
  3295. activated,
  3296. deactivated,
  3297. beforeDestroy,
  3298. beforeUnmount,
  3299. destroyed,
  3300. unmounted,
  3301. render,
  3302. renderTracked,
  3303. renderTriggered,
  3304. errorCaptured,
  3305. serverPrefetch,
  3306. // public API
  3307. expose,
  3308. inheritAttrs,
  3309. // assets
  3310. components,
  3311. directives,
  3312. filters
  3313. } = options;
  3314. const checkDuplicateProperties = createDuplicateChecker() ;
  3315. {
  3316. const [propsOptions] = instance.propsOptions;
  3317. if (propsOptions) {
  3318. for (const key in propsOptions) {
  3319. checkDuplicateProperties("Props" /* PROPS */, key);
  3320. }
  3321. }
  3322. }
  3323. if (injectOptions) {
  3324. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  3325. }
  3326. if (methods) {
  3327. for (const key in methods) {
  3328. const methodHandler = methods[key];
  3329. if (shared.isFunction(methodHandler)) {
  3330. {
  3331. Object.defineProperty(ctx, key, {
  3332. value: methodHandler.bind(publicThis),
  3333. configurable: true,
  3334. enumerable: true,
  3335. writable: true
  3336. });
  3337. }
  3338. {
  3339. checkDuplicateProperties("Methods" /* METHODS */, key);
  3340. }
  3341. } else {
  3342. warn$1(
  3343. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  3344. );
  3345. }
  3346. }
  3347. }
  3348. if (dataOptions) {
  3349. if (!shared.isFunction(dataOptions)) {
  3350. warn$1(
  3351. `The data option must be a function. Plain object usage is no longer supported.`
  3352. );
  3353. }
  3354. const data = dataOptions.call(publicThis, publicThis);
  3355. if (shared.isPromise(data)) {
  3356. warn$1(
  3357. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  3358. );
  3359. }
  3360. if (!shared.isObject(data)) {
  3361. warn$1(`data() should return an object.`);
  3362. } else {
  3363. instance.data = reactivity.reactive(data);
  3364. {
  3365. for (const key in data) {
  3366. checkDuplicateProperties("Data" /* DATA */, key);
  3367. if (!isReservedPrefix(key[0])) {
  3368. Object.defineProperty(ctx, key, {
  3369. configurable: true,
  3370. enumerable: true,
  3371. get: () => data[key],
  3372. set: shared.NOOP
  3373. });
  3374. }
  3375. }
  3376. }
  3377. }
  3378. }
  3379. shouldCacheAccess = true;
  3380. if (computedOptions) {
  3381. for (const key in computedOptions) {
  3382. const opt = computedOptions[key];
  3383. const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
  3384. if (get === shared.NOOP) {
  3385. warn$1(`Computed property "${key}" has no getter.`);
  3386. }
  3387. const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  3388. warn$1(
  3389. `Write operation failed: computed property "${key}" is readonly.`
  3390. );
  3391. } ;
  3392. const c = computed({
  3393. get,
  3394. set
  3395. });
  3396. Object.defineProperty(ctx, key, {
  3397. enumerable: true,
  3398. configurable: true,
  3399. get: () => c.value,
  3400. set: (v) => c.value = v
  3401. });
  3402. {
  3403. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  3404. }
  3405. }
  3406. }
  3407. if (watchOptions) {
  3408. for (const key in watchOptions) {
  3409. createWatcher(watchOptions[key], ctx, publicThis, key);
  3410. }
  3411. }
  3412. if (provideOptions) {
  3413. const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3414. Reflect.ownKeys(provides).forEach((key) => {
  3415. provide(key, provides[key]);
  3416. });
  3417. }
  3418. if (created) {
  3419. callHook(created, instance, "c");
  3420. }
  3421. function registerLifecycleHook(register, hook) {
  3422. if (shared.isArray(hook)) {
  3423. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3424. } else if (hook) {
  3425. register(hook.bind(publicThis));
  3426. }
  3427. }
  3428. registerLifecycleHook(onBeforeMount, beforeMount);
  3429. registerLifecycleHook(onMounted, mounted);
  3430. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3431. registerLifecycleHook(onUpdated, updated);
  3432. registerLifecycleHook(onActivated, activated);
  3433. registerLifecycleHook(onDeactivated, deactivated);
  3434. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3435. registerLifecycleHook(onRenderTracked, renderTracked);
  3436. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3437. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3438. registerLifecycleHook(onUnmounted, unmounted);
  3439. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3440. if (shared.isArray(expose)) {
  3441. if (expose.length) {
  3442. const exposed = instance.exposed || (instance.exposed = {});
  3443. expose.forEach((key) => {
  3444. Object.defineProperty(exposed, key, {
  3445. get: () => publicThis[key],
  3446. set: (val) => publicThis[key] = val
  3447. });
  3448. });
  3449. } else if (!instance.exposed) {
  3450. instance.exposed = {};
  3451. }
  3452. }
  3453. if (render && instance.render === shared.NOOP) {
  3454. instance.render = render;
  3455. }
  3456. if (inheritAttrs != null) {
  3457. instance.inheritAttrs = inheritAttrs;
  3458. }
  3459. if (components) instance.components = components;
  3460. if (directives) instance.directives = directives;
  3461. if (serverPrefetch) {
  3462. markAsyncBoundary(instance);
  3463. }
  3464. }
  3465. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
  3466. if (shared.isArray(injectOptions)) {
  3467. injectOptions = normalizeInject(injectOptions);
  3468. }
  3469. for (const key in injectOptions) {
  3470. const opt = injectOptions[key];
  3471. let injected;
  3472. if (shared.isObject(opt)) {
  3473. if ("default" in opt) {
  3474. injected = inject(
  3475. opt.from || key,
  3476. opt.default,
  3477. true
  3478. );
  3479. } else {
  3480. injected = inject(opt.from || key);
  3481. }
  3482. } else {
  3483. injected = inject(opt);
  3484. }
  3485. if (reactivity.isRef(injected)) {
  3486. Object.defineProperty(ctx, key, {
  3487. enumerable: true,
  3488. configurable: true,
  3489. get: () => injected.value,
  3490. set: (v) => injected.value = v
  3491. });
  3492. } else {
  3493. ctx[key] = injected;
  3494. }
  3495. {
  3496. checkDuplicateProperties("Inject" /* INJECT */, key);
  3497. }
  3498. }
  3499. }
  3500. function callHook(hook, instance, type) {
  3501. callWithAsyncErrorHandling(
  3502. shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  3503. instance,
  3504. type
  3505. );
  3506. }
  3507. function createWatcher(raw, ctx, publicThis, key) {
  3508. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3509. if (shared.isString(raw)) {
  3510. const handler = ctx[raw];
  3511. if (shared.isFunction(handler)) {
  3512. {
  3513. watch(getter, handler);
  3514. }
  3515. } else {
  3516. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3517. }
  3518. } else if (shared.isFunction(raw)) {
  3519. {
  3520. watch(getter, raw.bind(publicThis));
  3521. }
  3522. } else if (shared.isObject(raw)) {
  3523. if (shared.isArray(raw)) {
  3524. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  3525. } else {
  3526. const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3527. if (shared.isFunction(handler)) {
  3528. watch(getter, handler, raw);
  3529. } else {
  3530. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3531. }
  3532. }
  3533. } else {
  3534. warn$1(`Invalid watch option: "${key}"`, raw);
  3535. }
  3536. }
  3537. function resolveMergedOptions(instance) {
  3538. const base = instance.type;
  3539. const { mixins, extends: extendsOptions } = base;
  3540. const {
  3541. mixins: globalMixins,
  3542. optionsCache: cache,
  3543. config: { optionMergeStrategies }
  3544. } = instance.appContext;
  3545. const cached = cache.get(base);
  3546. let resolved;
  3547. if (cached) {
  3548. resolved = cached;
  3549. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3550. {
  3551. resolved = base;
  3552. }
  3553. } else {
  3554. resolved = {};
  3555. if (globalMixins.length) {
  3556. globalMixins.forEach(
  3557. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  3558. );
  3559. }
  3560. mergeOptions(resolved, base, optionMergeStrategies);
  3561. }
  3562. if (shared.isObject(base)) {
  3563. cache.set(base, resolved);
  3564. }
  3565. return resolved;
  3566. }
  3567. function mergeOptions(to, from, strats, asMixin = false) {
  3568. const { mixins, extends: extendsOptions } = from;
  3569. if (extendsOptions) {
  3570. mergeOptions(to, extendsOptions, strats, true);
  3571. }
  3572. if (mixins) {
  3573. mixins.forEach(
  3574. (m) => mergeOptions(to, m, strats, true)
  3575. );
  3576. }
  3577. for (const key in from) {
  3578. if (asMixin && key === "expose") {
  3579. warn$1(
  3580. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3581. );
  3582. } else {
  3583. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3584. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3585. }
  3586. }
  3587. return to;
  3588. }
  3589. const internalOptionMergeStrats = {
  3590. data: mergeDataFn,
  3591. props: mergeEmitsOrPropsOptions,
  3592. emits: mergeEmitsOrPropsOptions,
  3593. // objects
  3594. methods: mergeObjectOptions,
  3595. computed: mergeObjectOptions,
  3596. // lifecycle
  3597. beforeCreate: mergeAsArray,
  3598. created: mergeAsArray,
  3599. beforeMount: mergeAsArray,
  3600. mounted: mergeAsArray,
  3601. beforeUpdate: mergeAsArray,
  3602. updated: mergeAsArray,
  3603. beforeDestroy: mergeAsArray,
  3604. beforeUnmount: mergeAsArray,
  3605. destroyed: mergeAsArray,
  3606. unmounted: mergeAsArray,
  3607. activated: mergeAsArray,
  3608. deactivated: mergeAsArray,
  3609. errorCaptured: mergeAsArray,
  3610. serverPrefetch: mergeAsArray,
  3611. // assets
  3612. components: mergeObjectOptions,
  3613. directives: mergeObjectOptions,
  3614. // watch
  3615. watch: mergeWatchOptions,
  3616. // provide / inject
  3617. provide: mergeDataFn,
  3618. inject: mergeInject
  3619. };
  3620. function mergeDataFn(to, from) {
  3621. if (!from) {
  3622. return to;
  3623. }
  3624. if (!to) {
  3625. return from;
  3626. }
  3627. return function mergedDataFn() {
  3628. return (shared.extend)(
  3629. shared.isFunction(to) ? to.call(this, this) : to,
  3630. shared.isFunction(from) ? from.call(this, this) : from
  3631. );
  3632. };
  3633. }
  3634. function mergeInject(to, from) {
  3635. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  3636. }
  3637. function normalizeInject(raw) {
  3638. if (shared.isArray(raw)) {
  3639. const res = {};
  3640. for (let i = 0; i < raw.length; i++) {
  3641. res[raw[i]] = raw[i];
  3642. }
  3643. return res;
  3644. }
  3645. return raw;
  3646. }
  3647. function mergeAsArray(to, from) {
  3648. return to ? [...new Set([].concat(to, from))] : from;
  3649. }
  3650. function mergeObjectOptions(to, from) {
  3651. return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  3652. }
  3653. function mergeEmitsOrPropsOptions(to, from) {
  3654. if (to) {
  3655. if (shared.isArray(to) && shared.isArray(from)) {
  3656. return [.../* @__PURE__ */ new Set([...to, ...from])];
  3657. }
  3658. return shared.extend(
  3659. /* @__PURE__ */ Object.create(null),
  3660. normalizePropsOrEmits(to),
  3661. normalizePropsOrEmits(from != null ? from : {})
  3662. );
  3663. } else {
  3664. return from;
  3665. }
  3666. }
  3667. function mergeWatchOptions(to, from) {
  3668. if (!to) return from;
  3669. if (!from) return to;
  3670. const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
  3671. for (const key in from) {
  3672. merged[key] = mergeAsArray(to[key], from[key]);
  3673. }
  3674. return merged;
  3675. }
  3676. function createAppContext() {
  3677. return {
  3678. app: null,
  3679. config: {
  3680. isNativeTag: shared.NO,
  3681. performance: false,
  3682. globalProperties: {},
  3683. optionMergeStrategies: {},
  3684. errorHandler: void 0,
  3685. warnHandler: void 0,
  3686. compilerOptions: {}
  3687. },
  3688. mixins: [],
  3689. components: {},
  3690. directives: {},
  3691. provides: /* @__PURE__ */ Object.create(null),
  3692. optionsCache: /* @__PURE__ */ new WeakMap(),
  3693. propsCache: /* @__PURE__ */ new WeakMap(),
  3694. emitsCache: /* @__PURE__ */ new WeakMap()
  3695. };
  3696. }
  3697. let uid$1 = 0;
  3698. function createAppAPI(render, hydrate) {
  3699. return function createApp(rootComponent, rootProps = null) {
  3700. if (!shared.isFunction(rootComponent)) {
  3701. rootComponent = shared.extend({}, rootComponent);
  3702. }
  3703. if (rootProps != null && !shared.isObject(rootProps)) {
  3704. warn$1(`root props passed to app.mount() must be an object.`);
  3705. rootProps = null;
  3706. }
  3707. const context = createAppContext();
  3708. const installedPlugins = /* @__PURE__ */ new WeakSet();
  3709. const pluginCleanupFns = [];
  3710. let isMounted = false;
  3711. const app = context.app = {
  3712. _uid: uid$1++,
  3713. _component: rootComponent,
  3714. _props: rootProps,
  3715. _container: null,
  3716. _context: context,
  3717. _instance: null,
  3718. version,
  3719. get config() {
  3720. return context.config;
  3721. },
  3722. set config(v) {
  3723. {
  3724. warn$1(
  3725. `app.config cannot be replaced. Modify individual options instead.`
  3726. );
  3727. }
  3728. },
  3729. use(plugin, ...options) {
  3730. if (installedPlugins.has(plugin)) {
  3731. warn$1(`Plugin has already been applied to target app.`);
  3732. } else if (plugin && shared.isFunction(plugin.install)) {
  3733. installedPlugins.add(plugin);
  3734. plugin.install(app, ...options);
  3735. } else if (shared.isFunction(plugin)) {
  3736. installedPlugins.add(plugin);
  3737. plugin(app, ...options);
  3738. } else {
  3739. warn$1(
  3740. `A plugin must either be a function or an object with an "install" function.`
  3741. );
  3742. }
  3743. return app;
  3744. },
  3745. mixin(mixin) {
  3746. {
  3747. if (!context.mixins.includes(mixin)) {
  3748. context.mixins.push(mixin);
  3749. } else {
  3750. warn$1(
  3751. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  3752. );
  3753. }
  3754. }
  3755. return app;
  3756. },
  3757. component(name, component) {
  3758. {
  3759. validateComponentName(name, context.config);
  3760. }
  3761. if (!component) {
  3762. return context.components[name];
  3763. }
  3764. if (context.components[name]) {
  3765. warn$1(`Component "${name}" has already been registered in target app.`);
  3766. }
  3767. context.components[name] = component;
  3768. return app;
  3769. },
  3770. directive(name, directive) {
  3771. {
  3772. validateDirectiveName(name);
  3773. }
  3774. if (!directive) {
  3775. return context.directives[name];
  3776. }
  3777. if (context.directives[name]) {
  3778. warn$1(`Directive "${name}" has already been registered in target app.`);
  3779. }
  3780. context.directives[name] = directive;
  3781. return app;
  3782. },
  3783. mount(rootContainer, isHydrate, namespace) {
  3784. if (!isMounted) {
  3785. if (rootContainer.__vue_app__) {
  3786. warn$1(
  3787. `There is already an app instance mounted on the host container.
  3788. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  3789. );
  3790. }
  3791. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  3792. vnode.appContext = context;
  3793. if (namespace === true) {
  3794. namespace = "svg";
  3795. } else if (namespace === false) {
  3796. namespace = void 0;
  3797. }
  3798. {
  3799. context.reload = () => {
  3800. render(
  3801. cloneVNode(vnode),
  3802. rootContainer,
  3803. namespace
  3804. );
  3805. };
  3806. }
  3807. if (isHydrate && hydrate) {
  3808. hydrate(vnode, rootContainer);
  3809. } else {
  3810. render(vnode, rootContainer, namespace);
  3811. }
  3812. isMounted = true;
  3813. app._container = rootContainer;
  3814. rootContainer.__vue_app__ = app;
  3815. {
  3816. app._instance = vnode.component;
  3817. devtoolsInitApp(app, version);
  3818. }
  3819. return getComponentPublicInstance(vnode.component);
  3820. } else {
  3821. warn$1(
  3822. `App has already been mounted.
  3823. 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)\``
  3824. );
  3825. }
  3826. },
  3827. onUnmount(cleanupFn) {
  3828. if (typeof cleanupFn !== "function") {
  3829. warn$1(
  3830. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  3831. );
  3832. }
  3833. pluginCleanupFns.push(cleanupFn);
  3834. },
  3835. unmount() {
  3836. if (isMounted) {
  3837. callWithAsyncErrorHandling(
  3838. pluginCleanupFns,
  3839. app._instance,
  3840. 16
  3841. );
  3842. render(null, app._container);
  3843. {
  3844. app._instance = null;
  3845. devtoolsUnmountApp(app);
  3846. }
  3847. delete app._container.__vue_app__;
  3848. } else {
  3849. warn$1(`Cannot unmount an app that is not mounted.`);
  3850. }
  3851. },
  3852. provide(key, value) {
  3853. if (key in context.provides) {
  3854. warn$1(
  3855. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  3856. );
  3857. }
  3858. context.provides[key] = value;
  3859. return app;
  3860. },
  3861. runWithContext(fn) {
  3862. const lastApp = currentApp;
  3863. currentApp = app;
  3864. try {
  3865. return fn();
  3866. } finally {
  3867. currentApp = lastApp;
  3868. }
  3869. }
  3870. };
  3871. return app;
  3872. };
  3873. }
  3874. let currentApp = null;
  3875. function provide(key, value) {
  3876. if (!currentInstance) {
  3877. {
  3878. warn$1(`provide() can only be used inside setup().`);
  3879. }
  3880. } else {
  3881. let provides = currentInstance.provides;
  3882. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3883. if (parentProvides === provides) {
  3884. provides = currentInstance.provides = Object.create(parentProvides);
  3885. }
  3886. provides[key] = value;
  3887. }
  3888. }
  3889. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3890. const instance = currentInstance || currentRenderingInstance;
  3891. if (instance || currentApp) {
  3892. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  3893. if (provides && key in provides) {
  3894. return provides[key];
  3895. } else if (arguments.length > 1) {
  3896. return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3897. } else {
  3898. warn$1(`injection "${String(key)}" not found.`);
  3899. }
  3900. } else {
  3901. warn$1(`inject() can only be used inside setup() or functional components.`);
  3902. }
  3903. }
  3904. function hasInjectionContext() {
  3905. return !!(currentInstance || currentRenderingInstance || currentApp);
  3906. }
  3907. const internalObjectProto = {};
  3908. const createInternalObject = () => Object.create(internalObjectProto);
  3909. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  3910. function initProps(instance, rawProps, isStateful, isSSR = false) {
  3911. const props = {};
  3912. const attrs = createInternalObject();
  3913. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  3914. setFullProps(instance, rawProps, props, attrs);
  3915. for (const key in instance.propsOptions[0]) {
  3916. if (!(key in props)) {
  3917. props[key] = void 0;
  3918. }
  3919. }
  3920. {
  3921. validateProps(rawProps || {}, props, instance);
  3922. }
  3923. if (isStateful) {
  3924. instance.props = isSSR ? props : reactivity.shallowReactive(props);
  3925. } else {
  3926. if (!instance.type.props) {
  3927. instance.props = attrs;
  3928. } else {
  3929. instance.props = props;
  3930. }
  3931. }
  3932. instance.attrs = attrs;
  3933. }
  3934. function isInHmrContext(instance) {
  3935. while (instance) {
  3936. if (instance.type.__hmrId) return true;
  3937. instance = instance.parent;
  3938. }
  3939. }
  3940. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3941. const {
  3942. props,
  3943. attrs,
  3944. vnode: { patchFlag }
  3945. } = instance;
  3946. const rawCurrentProps = reactivity.toRaw(props);
  3947. const [options] = instance.propsOptions;
  3948. let hasAttrsChanged = false;
  3949. if (
  3950. // always force full diff in dev
  3951. // - #1942 if hmr is enabled with sfc component
  3952. // - vite#872 non-sfc component used by sfc component
  3953. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  3954. ) {
  3955. if (patchFlag & 8) {
  3956. const propsToUpdate = instance.vnode.dynamicProps;
  3957. for (let i = 0; i < propsToUpdate.length; i++) {
  3958. let key = propsToUpdate[i];
  3959. if (isEmitListener(instance.emitsOptions, key)) {
  3960. continue;
  3961. }
  3962. const value = rawProps[key];
  3963. if (options) {
  3964. if (shared.hasOwn(attrs, key)) {
  3965. if (value !== attrs[key]) {
  3966. attrs[key] = value;
  3967. hasAttrsChanged = true;
  3968. }
  3969. } else {
  3970. const camelizedKey = shared.camelize(key);
  3971. props[camelizedKey] = resolvePropValue(
  3972. options,
  3973. rawCurrentProps,
  3974. camelizedKey,
  3975. value,
  3976. instance,
  3977. false
  3978. );
  3979. }
  3980. } else {
  3981. if (value !== attrs[key]) {
  3982. attrs[key] = value;
  3983. hasAttrsChanged = true;
  3984. }
  3985. }
  3986. }
  3987. }
  3988. } else {
  3989. if (setFullProps(instance, rawProps, props, attrs)) {
  3990. hasAttrsChanged = true;
  3991. }
  3992. let kebabKey;
  3993. for (const key in rawCurrentProps) {
  3994. if (!rawProps || // for camelCase
  3995. !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3996. // and converted to camelCase (#955)
  3997. ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
  3998. if (options) {
  3999. if (rawPrevProps && // for camelCase
  4000. (rawPrevProps[key] !== void 0 || // for kebab-case
  4001. rawPrevProps[kebabKey] !== void 0)) {
  4002. props[key] = resolvePropValue(
  4003. options,
  4004. rawCurrentProps,
  4005. key,
  4006. void 0,
  4007. instance,
  4008. true
  4009. );
  4010. }
  4011. } else {
  4012. delete props[key];
  4013. }
  4014. }
  4015. }
  4016. if (attrs !== rawCurrentProps) {
  4017. for (const key in attrs) {
  4018. if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
  4019. delete attrs[key];
  4020. hasAttrsChanged = true;
  4021. }
  4022. }
  4023. }
  4024. }
  4025. if (hasAttrsChanged) {
  4026. reactivity.trigger(instance.attrs, "set", "");
  4027. }
  4028. {
  4029. validateProps(rawProps || {}, props, instance);
  4030. }
  4031. }
  4032. function setFullProps(instance, rawProps, props, attrs) {
  4033. const [options, needCastKeys] = instance.propsOptions;
  4034. let hasAttrsChanged = false;
  4035. let rawCastValues;
  4036. if (rawProps) {
  4037. for (let key in rawProps) {
  4038. if (shared.isReservedProp(key)) {
  4039. continue;
  4040. }
  4041. const value = rawProps[key];
  4042. let camelKey;
  4043. if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
  4044. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4045. props[camelKey] = value;
  4046. } else {
  4047. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4048. }
  4049. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4050. if (!(key in attrs) || value !== attrs[key]) {
  4051. attrs[key] = value;
  4052. hasAttrsChanged = true;
  4053. }
  4054. }
  4055. }
  4056. }
  4057. if (needCastKeys) {
  4058. const rawCurrentProps = reactivity.toRaw(props);
  4059. const castValues = rawCastValues || shared.EMPTY_OBJ;
  4060. for (let i = 0; i < needCastKeys.length; i++) {
  4061. const key = needCastKeys[i];
  4062. props[key] = resolvePropValue(
  4063. options,
  4064. rawCurrentProps,
  4065. key,
  4066. castValues[key],
  4067. instance,
  4068. !shared.hasOwn(castValues, key)
  4069. );
  4070. }
  4071. }
  4072. return hasAttrsChanged;
  4073. }
  4074. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4075. const opt = options[key];
  4076. if (opt != null) {
  4077. const hasDefault = shared.hasOwn(opt, "default");
  4078. if (hasDefault && value === void 0) {
  4079. const defaultValue = opt.default;
  4080. if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
  4081. const { propsDefaults } = instance;
  4082. if (key in propsDefaults) {
  4083. value = propsDefaults[key];
  4084. } else {
  4085. const reset = setCurrentInstance(instance);
  4086. value = propsDefaults[key] = defaultValue.call(
  4087. null,
  4088. props
  4089. );
  4090. reset();
  4091. }
  4092. } else {
  4093. value = defaultValue;
  4094. }
  4095. if (instance.ce) {
  4096. instance.ce._setProp(key, value);
  4097. }
  4098. }
  4099. if (opt[0 /* shouldCast */]) {
  4100. if (isAbsent && !hasDefault) {
  4101. value = false;
  4102. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
  4103. value = true;
  4104. }
  4105. }
  4106. }
  4107. return value;
  4108. }
  4109. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  4110. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4111. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  4112. const cached = cache.get(comp);
  4113. if (cached) {
  4114. return cached;
  4115. }
  4116. const raw = comp.props;
  4117. const normalized = {};
  4118. const needCastKeys = [];
  4119. let hasExtends = false;
  4120. if (!shared.isFunction(comp)) {
  4121. const extendProps = (raw2) => {
  4122. hasExtends = true;
  4123. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4124. shared.extend(normalized, props);
  4125. if (keys) needCastKeys.push(...keys);
  4126. };
  4127. if (!asMixin && appContext.mixins.length) {
  4128. appContext.mixins.forEach(extendProps);
  4129. }
  4130. if (comp.extends) {
  4131. extendProps(comp.extends);
  4132. }
  4133. if (comp.mixins) {
  4134. comp.mixins.forEach(extendProps);
  4135. }
  4136. }
  4137. if (!raw && !hasExtends) {
  4138. if (shared.isObject(comp)) {
  4139. cache.set(comp, shared.EMPTY_ARR);
  4140. }
  4141. return shared.EMPTY_ARR;
  4142. }
  4143. if (shared.isArray(raw)) {
  4144. for (let i = 0; i < raw.length; i++) {
  4145. if (!shared.isString(raw[i])) {
  4146. warn$1(`props must be strings when using array syntax.`, raw[i]);
  4147. }
  4148. const normalizedKey = shared.camelize(raw[i]);
  4149. if (validatePropName(normalizedKey)) {
  4150. normalized[normalizedKey] = shared.EMPTY_OBJ;
  4151. }
  4152. }
  4153. } else if (raw) {
  4154. if (!shared.isObject(raw)) {
  4155. warn$1(`invalid props options`, raw);
  4156. }
  4157. for (const key in raw) {
  4158. const normalizedKey = shared.camelize(key);
  4159. if (validatePropName(normalizedKey)) {
  4160. const opt = raw[key];
  4161. const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
  4162. const propType = prop.type;
  4163. let shouldCast = false;
  4164. let shouldCastTrue = true;
  4165. if (shared.isArray(propType)) {
  4166. for (let index = 0; index < propType.length; ++index) {
  4167. const type = propType[index];
  4168. const typeName = shared.isFunction(type) && type.name;
  4169. if (typeName === "Boolean") {
  4170. shouldCast = true;
  4171. break;
  4172. } else if (typeName === "String") {
  4173. shouldCastTrue = false;
  4174. }
  4175. }
  4176. } else {
  4177. shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
  4178. }
  4179. prop[0 /* shouldCast */] = shouldCast;
  4180. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  4181. if (shouldCast || shared.hasOwn(prop, "default")) {
  4182. needCastKeys.push(normalizedKey);
  4183. }
  4184. }
  4185. }
  4186. }
  4187. const res = [normalized, needCastKeys];
  4188. if (shared.isObject(comp)) {
  4189. cache.set(comp, res);
  4190. }
  4191. return res;
  4192. }
  4193. function validatePropName(key) {
  4194. if (key[0] !== "$" && !shared.isReservedProp(key)) {
  4195. return true;
  4196. } else {
  4197. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  4198. }
  4199. return false;
  4200. }
  4201. function getType(ctor) {
  4202. if (ctor === null) {
  4203. return "null";
  4204. }
  4205. if (typeof ctor === "function") {
  4206. return ctor.name || "";
  4207. } else if (typeof ctor === "object") {
  4208. const name = ctor.constructor && ctor.constructor.name;
  4209. return name || "";
  4210. }
  4211. return "";
  4212. }
  4213. function validateProps(rawProps, props, instance) {
  4214. const resolvedValues = reactivity.toRaw(props);
  4215. const options = instance.propsOptions[0];
  4216. for (const key in options) {
  4217. let opt = options[key];
  4218. if (opt == null) continue;
  4219. validateProp(
  4220. key,
  4221. resolvedValues[key],
  4222. opt,
  4223. reactivity.shallowReadonly(resolvedValues) ,
  4224. !shared.hasOwn(rawProps, key) && !shared.hasOwn(rawProps, shared.hyphenate(key))
  4225. );
  4226. }
  4227. }
  4228. function validateProp(name, value, prop, props, isAbsent) {
  4229. const { type, required, validator, skipCheck } = prop;
  4230. if (required && isAbsent) {
  4231. warn$1('Missing required prop: "' + name + '"');
  4232. return;
  4233. }
  4234. if (value == null && !required) {
  4235. return;
  4236. }
  4237. if (type != null && type !== true && !skipCheck) {
  4238. let isValid = false;
  4239. const types = shared.isArray(type) ? type : [type];
  4240. const expectedTypes = [];
  4241. for (let i = 0; i < types.length && !isValid; i++) {
  4242. const { valid, expectedType } = assertType(value, types[i]);
  4243. expectedTypes.push(expectedType || "");
  4244. isValid = valid;
  4245. }
  4246. if (!isValid) {
  4247. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  4248. return;
  4249. }
  4250. }
  4251. if (validator && !validator(value, props)) {
  4252. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  4253. }
  4254. }
  4255. const isSimpleType = /* @__PURE__ */ shared.makeMap(
  4256. "String,Number,Boolean,Function,Symbol,BigInt"
  4257. );
  4258. function assertType(value, type) {
  4259. let valid;
  4260. const expectedType = getType(type);
  4261. if (expectedType === "null") {
  4262. valid = value === null;
  4263. } else if (isSimpleType(expectedType)) {
  4264. const t = typeof value;
  4265. valid = t === expectedType.toLowerCase();
  4266. if (!valid && t === "object") {
  4267. valid = value instanceof type;
  4268. }
  4269. } else if (expectedType === "Object") {
  4270. valid = shared.isObject(value);
  4271. } else if (expectedType === "Array") {
  4272. valid = shared.isArray(value);
  4273. } else {
  4274. valid = value instanceof type;
  4275. }
  4276. return {
  4277. valid,
  4278. expectedType
  4279. };
  4280. }
  4281. function getInvalidTypeMessage(name, value, expectedTypes) {
  4282. if (expectedTypes.length === 0) {
  4283. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  4284. }
  4285. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
  4286. const expectedType = expectedTypes[0];
  4287. const receivedType = shared.toRawType(value);
  4288. const expectedValue = styleValue(value, expectedType);
  4289. const receivedValue = styleValue(value, receivedType);
  4290. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4291. message += ` with value ${expectedValue}`;
  4292. }
  4293. message += `, got ${receivedType} `;
  4294. if (isExplicable(receivedType)) {
  4295. message += `with value ${receivedValue}.`;
  4296. }
  4297. return message;
  4298. }
  4299. function styleValue(value, type) {
  4300. if (type === "String") {
  4301. return `"${value}"`;
  4302. } else if (type === "Number") {
  4303. return `${Number(value)}`;
  4304. } else {
  4305. return `${value}`;
  4306. }
  4307. }
  4308. function isExplicable(type) {
  4309. const explicitTypes = ["string", "number", "boolean"];
  4310. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4311. }
  4312. function isBoolean(...args) {
  4313. return args.some((elem) => elem.toLowerCase() === "boolean");
  4314. }
  4315. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  4316. const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4317. const normalizeSlot = (key, rawSlot, ctx) => {
  4318. if (rawSlot._n) {
  4319. return rawSlot;
  4320. }
  4321. const normalized = withCtx((...args) => {
  4322. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  4323. warn$1(
  4324. `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.`
  4325. );
  4326. }
  4327. return normalizeSlotValue(rawSlot(...args));
  4328. }, ctx);
  4329. normalized._c = false;
  4330. return normalized;
  4331. };
  4332. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  4333. const ctx = rawSlots._ctx;
  4334. for (const key in rawSlots) {
  4335. if (isInternalKey(key)) continue;
  4336. const value = rawSlots[key];
  4337. if (shared.isFunction(value)) {
  4338. slots[key] = normalizeSlot(key, value, ctx);
  4339. } else if (value != null) {
  4340. {
  4341. warn$1(
  4342. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  4343. );
  4344. }
  4345. const normalized = normalizeSlotValue(value);
  4346. slots[key] = () => normalized;
  4347. }
  4348. }
  4349. };
  4350. const normalizeVNodeSlots = (instance, children) => {
  4351. if (!isKeepAlive(instance.vnode) && true) {
  4352. warn$1(
  4353. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  4354. );
  4355. }
  4356. const normalized = normalizeSlotValue(children);
  4357. instance.slots.default = () => normalized;
  4358. };
  4359. const assignSlots = (slots, children, optimized) => {
  4360. for (const key in children) {
  4361. if (optimized || key !== "_") {
  4362. slots[key] = children[key];
  4363. }
  4364. }
  4365. };
  4366. const initSlots = (instance, children, optimized) => {
  4367. const slots = instance.slots = createInternalObject();
  4368. if (instance.vnode.shapeFlag & 32) {
  4369. const type = children._;
  4370. if (type) {
  4371. assignSlots(slots, children, optimized);
  4372. if (optimized) {
  4373. shared.def(slots, "_", type, true);
  4374. }
  4375. } else {
  4376. normalizeObjectSlots(children, slots);
  4377. }
  4378. } else if (children) {
  4379. normalizeVNodeSlots(instance, children);
  4380. }
  4381. };
  4382. const updateSlots = (instance, children, optimized) => {
  4383. const { vnode, slots } = instance;
  4384. let needDeletionCheck = true;
  4385. let deletionComparisonTarget = shared.EMPTY_OBJ;
  4386. if (vnode.shapeFlag & 32) {
  4387. const type = children._;
  4388. if (type) {
  4389. if (isHmrUpdating) {
  4390. assignSlots(slots, children, optimized);
  4391. reactivity.trigger(instance, "set", "$slots");
  4392. } else if (optimized && type === 1) {
  4393. needDeletionCheck = false;
  4394. } else {
  4395. assignSlots(slots, children, optimized);
  4396. }
  4397. } else {
  4398. needDeletionCheck = !children.$stable;
  4399. normalizeObjectSlots(children, slots);
  4400. }
  4401. deletionComparisonTarget = children;
  4402. } else if (children) {
  4403. normalizeVNodeSlots(instance, children);
  4404. deletionComparisonTarget = { default: 1 };
  4405. }
  4406. if (needDeletionCheck) {
  4407. for (const key in slots) {
  4408. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  4409. delete slots[key];
  4410. }
  4411. }
  4412. }
  4413. };
  4414. let supported;
  4415. let perf;
  4416. function startMeasure(instance, type) {
  4417. if (instance.appContext.config.performance && isSupported()) {
  4418. perf.mark(`vue-${type}-${instance.uid}`);
  4419. }
  4420. {
  4421. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  4422. }
  4423. }
  4424. function endMeasure(instance, type) {
  4425. if (instance.appContext.config.performance && isSupported()) {
  4426. const startTag = `vue-${type}-${instance.uid}`;
  4427. const endTag = startTag + `:end`;
  4428. perf.mark(endTag);
  4429. perf.measure(
  4430. `<${formatComponentName(instance, instance.type)}> ${type}`,
  4431. startTag,
  4432. endTag
  4433. );
  4434. perf.clearMarks(startTag);
  4435. perf.clearMarks(endTag);
  4436. }
  4437. {
  4438. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  4439. }
  4440. }
  4441. function isSupported() {
  4442. if (supported !== void 0) {
  4443. return supported;
  4444. }
  4445. if (typeof window !== "undefined" && window.performance) {
  4446. supported = true;
  4447. perf = window.performance;
  4448. } else {
  4449. supported = false;
  4450. }
  4451. return supported;
  4452. }
  4453. const queuePostRenderEffect = queueEffectWithSuspense ;
  4454. function createRenderer(options) {
  4455. return baseCreateRenderer(options);
  4456. }
  4457. function createHydrationRenderer(options) {
  4458. return baseCreateRenderer(options, createHydrationFunctions);
  4459. }
  4460. function baseCreateRenderer(options, createHydrationFns) {
  4461. const target = shared.getGlobalThis();
  4462. target.__VUE__ = true;
  4463. {
  4464. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  4465. }
  4466. const {
  4467. insert: hostInsert,
  4468. remove: hostRemove,
  4469. patchProp: hostPatchProp,
  4470. createElement: hostCreateElement,
  4471. createText: hostCreateText,
  4472. createComment: hostCreateComment,
  4473. setText: hostSetText,
  4474. setElementText: hostSetElementText,
  4475. parentNode: hostParentNode,
  4476. nextSibling: hostNextSibling,
  4477. setScopeId: hostSetScopeId = shared.NOOP,
  4478. insertStaticContent: hostInsertStaticContent
  4479. } = options;
  4480. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  4481. if (n1 === n2) {
  4482. return;
  4483. }
  4484. if (n1 && !isSameVNodeType(n1, n2)) {
  4485. anchor = getNextHostNode(n1);
  4486. unmount(n1, parentComponent, parentSuspense, true);
  4487. n1 = null;
  4488. }
  4489. if (n2.patchFlag === -2) {
  4490. optimized = false;
  4491. n2.dynamicChildren = null;
  4492. }
  4493. const { type, ref, shapeFlag } = n2;
  4494. switch (type) {
  4495. case Text:
  4496. processText(n1, n2, container, anchor);
  4497. break;
  4498. case Comment:
  4499. processCommentNode(n1, n2, container, anchor);
  4500. break;
  4501. case Static:
  4502. if (n1 == null) {
  4503. mountStaticNode(n2, container, anchor, namespace);
  4504. } else {
  4505. patchStaticNode(n1, n2, container, namespace);
  4506. }
  4507. break;
  4508. case Fragment:
  4509. processFragment(
  4510. n1,
  4511. n2,
  4512. container,
  4513. anchor,
  4514. parentComponent,
  4515. parentSuspense,
  4516. namespace,
  4517. slotScopeIds,
  4518. optimized
  4519. );
  4520. break;
  4521. default:
  4522. if (shapeFlag & 1) {
  4523. processElement(
  4524. n1,
  4525. n2,
  4526. container,
  4527. anchor,
  4528. parentComponent,
  4529. parentSuspense,
  4530. namespace,
  4531. slotScopeIds,
  4532. optimized
  4533. );
  4534. } else if (shapeFlag & 6) {
  4535. processComponent(
  4536. n1,
  4537. n2,
  4538. container,
  4539. anchor,
  4540. parentComponent,
  4541. parentSuspense,
  4542. namespace,
  4543. slotScopeIds,
  4544. optimized
  4545. );
  4546. } else if (shapeFlag & 64) {
  4547. type.process(
  4548. n1,
  4549. n2,
  4550. container,
  4551. anchor,
  4552. parentComponent,
  4553. parentSuspense,
  4554. namespace,
  4555. slotScopeIds,
  4556. optimized,
  4557. internals
  4558. );
  4559. } else if (shapeFlag & 128) {
  4560. type.process(
  4561. n1,
  4562. n2,
  4563. container,
  4564. anchor,
  4565. parentComponent,
  4566. parentSuspense,
  4567. namespace,
  4568. slotScopeIds,
  4569. optimized,
  4570. internals
  4571. );
  4572. } else {
  4573. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  4574. }
  4575. }
  4576. if (ref != null && parentComponent) {
  4577. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  4578. }
  4579. };
  4580. const processText = (n1, n2, container, anchor) => {
  4581. if (n1 == null) {
  4582. hostInsert(
  4583. n2.el = hostCreateText(n2.children),
  4584. container,
  4585. anchor
  4586. );
  4587. } else {
  4588. const el = n2.el = n1.el;
  4589. if (n2.children !== n1.children) {
  4590. hostSetText(el, n2.children);
  4591. }
  4592. }
  4593. };
  4594. const processCommentNode = (n1, n2, container, anchor) => {
  4595. if (n1 == null) {
  4596. hostInsert(
  4597. n2.el = hostCreateComment(n2.children || ""),
  4598. container,
  4599. anchor
  4600. );
  4601. } else {
  4602. n2.el = n1.el;
  4603. }
  4604. };
  4605. const mountStaticNode = (n2, container, anchor, namespace) => {
  4606. [n2.el, n2.anchor] = hostInsertStaticContent(
  4607. n2.children,
  4608. container,
  4609. anchor,
  4610. namespace,
  4611. n2.el,
  4612. n2.anchor
  4613. );
  4614. };
  4615. const patchStaticNode = (n1, n2, container, namespace) => {
  4616. if (n2.children !== n1.children) {
  4617. const anchor = hostNextSibling(n1.anchor);
  4618. removeStaticNode(n1);
  4619. [n2.el, n2.anchor] = hostInsertStaticContent(
  4620. n2.children,
  4621. container,
  4622. anchor,
  4623. namespace
  4624. );
  4625. } else {
  4626. n2.el = n1.el;
  4627. n2.anchor = n1.anchor;
  4628. }
  4629. };
  4630. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  4631. let next;
  4632. while (el && el !== anchor) {
  4633. next = hostNextSibling(el);
  4634. hostInsert(el, container, nextSibling);
  4635. el = next;
  4636. }
  4637. hostInsert(anchor, container, nextSibling);
  4638. };
  4639. const removeStaticNode = ({ el, anchor }) => {
  4640. let next;
  4641. while (el && el !== anchor) {
  4642. next = hostNextSibling(el);
  4643. hostRemove(el);
  4644. el = next;
  4645. }
  4646. hostRemove(anchor);
  4647. };
  4648. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  4649. if (n2.type === "svg") {
  4650. namespace = "svg";
  4651. } else if (n2.type === "math") {
  4652. namespace = "mathml";
  4653. }
  4654. if (n1 == null) {
  4655. mountElement(
  4656. n2,
  4657. container,
  4658. anchor,
  4659. parentComponent,
  4660. parentSuspense,
  4661. namespace,
  4662. slotScopeIds,
  4663. optimized
  4664. );
  4665. } else {
  4666. patchElement(
  4667. n1,
  4668. n2,
  4669. parentComponent,
  4670. parentSuspense,
  4671. namespace,
  4672. slotScopeIds,
  4673. optimized
  4674. );
  4675. }
  4676. };
  4677. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  4678. let el;
  4679. let vnodeHook;
  4680. const { props, shapeFlag, transition, dirs } = vnode;
  4681. el = vnode.el = hostCreateElement(
  4682. vnode.type,
  4683. namespace,
  4684. props && props.is,
  4685. props
  4686. );
  4687. if (shapeFlag & 8) {
  4688. hostSetElementText(el, vnode.children);
  4689. } else if (shapeFlag & 16) {
  4690. mountChildren(
  4691. vnode.children,
  4692. el,
  4693. null,
  4694. parentComponent,
  4695. parentSuspense,
  4696. resolveChildrenNamespace(vnode, namespace),
  4697. slotScopeIds,
  4698. optimized
  4699. );
  4700. }
  4701. if (dirs) {
  4702. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4703. }
  4704. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  4705. if (props) {
  4706. for (const key in props) {
  4707. if (key !== "value" && !shared.isReservedProp(key)) {
  4708. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  4709. }
  4710. }
  4711. if ("value" in props) {
  4712. hostPatchProp(el, "value", null, props.value, namespace);
  4713. }
  4714. if (vnodeHook = props.onVnodeBeforeMount) {
  4715. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4716. }
  4717. }
  4718. {
  4719. shared.def(el, "__vnode", vnode, true);
  4720. shared.def(el, "__vueParentComponent", parentComponent, true);
  4721. }
  4722. if (dirs) {
  4723. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4724. }
  4725. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  4726. if (needCallTransitionHooks) {
  4727. transition.beforeEnter(el);
  4728. }
  4729. hostInsert(el, container, anchor);
  4730. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  4731. queuePostRenderEffect(() => {
  4732. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4733. needCallTransitionHooks && transition.enter(el);
  4734. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4735. }, parentSuspense);
  4736. }
  4737. };
  4738. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  4739. if (scopeId) {
  4740. hostSetScopeId(el, scopeId);
  4741. }
  4742. if (slotScopeIds) {
  4743. for (let i = 0; i < slotScopeIds.length; i++) {
  4744. hostSetScopeId(el, slotScopeIds[i]);
  4745. }
  4746. }
  4747. if (parentComponent) {
  4748. let subTree = parentComponent.subTree;
  4749. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  4750. subTree = filterSingleRoot(subTree.children) || subTree;
  4751. }
  4752. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  4753. const parentVNode = parentComponent.vnode;
  4754. setScopeId(
  4755. el,
  4756. parentVNode,
  4757. parentVNode.scopeId,
  4758. parentVNode.slotScopeIds,
  4759. parentComponent.parent
  4760. );
  4761. }
  4762. }
  4763. };
  4764. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  4765. for (let i = start; i < children.length; i++) {
  4766. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  4767. patch(
  4768. null,
  4769. child,
  4770. container,
  4771. anchor,
  4772. parentComponent,
  4773. parentSuspense,
  4774. namespace,
  4775. slotScopeIds,
  4776. optimized
  4777. );
  4778. }
  4779. };
  4780. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  4781. const el = n2.el = n1.el;
  4782. {
  4783. el.__vnode = n2;
  4784. }
  4785. let { patchFlag, dynamicChildren, dirs } = n2;
  4786. patchFlag |= n1.patchFlag & 16;
  4787. const oldProps = n1.props || shared.EMPTY_OBJ;
  4788. const newProps = n2.props || shared.EMPTY_OBJ;
  4789. let vnodeHook;
  4790. parentComponent && toggleRecurse(parentComponent, false);
  4791. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  4792. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4793. }
  4794. if (dirs) {
  4795. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  4796. }
  4797. parentComponent && toggleRecurse(parentComponent, true);
  4798. if (isHmrUpdating) {
  4799. patchFlag = 0;
  4800. optimized = false;
  4801. dynamicChildren = null;
  4802. }
  4803. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  4804. hostSetElementText(el, "");
  4805. }
  4806. if (dynamicChildren) {
  4807. patchBlockChildren(
  4808. n1.dynamicChildren,
  4809. dynamicChildren,
  4810. el,
  4811. parentComponent,
  4812. parentSuspense,
  4813. resolveChildrenNamespace(n2, namespace),
  4814. slotScopeIds
  4815. );
  4816. {
  4817. traverseStaticChildren(n1, n2);
  4818. }
  4819. } else if (!optimized) {
  4820. patchChildren(
  4821. n1,
  4822. n2,
  4823. el,
  4824. null,
  4825. parentComponent,
  4826. parentSuspense,
  4827. resolveChildrenNamespace(n2, namespace),
  4828. slotScopeIds,
  4829. false
  4830. );
  4831. }
  4832. if (patchFlag > 0) {
  4833. if (patchFlag & 16) {
  4834. patchProps(el, oldProps, newProps, parentComponent, namespace);
  4835. } else {
  4836. if (patchFlag & 2) {
  4837. if (oldProps.class !== newProps.class) {
  4838. hostPatchProp(el, "class", null, newProps.class, namespace);
  4839. }
  4840. }
  4841. if (patchFlag & 4) {
  4842. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  4843. }
  4844. if (patchFlag & 8) {
  4845. const propsToUpdate = n2.dynamicProps;
  4846. for (let i = 0; i < propsToUpdate.length; i++) {
  4847. const key = propsToUpdate[i];
  4848. const prev = oldProps[key];
  4849. const next = newProps[key];
  4850. if (next !== prev || key === "value") {
  4851. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  4852. }
  4853. }
  4854. }
  4855. }
  4856. if (patchFlag & 1) {
  4857. if (n1.children !== n2.children) {
  4858. hostSetElementText(el, n2.children);
  4859. }
  4860. }
  4861. } else if (!optimized && dynamicChildren == null) {
  4862. patchProps(el, oldProps, newProps, parentComponent, namespace);
  4863. }
  4864. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  4865. queuePostRenderEffect(() => {
  4866. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4867. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  4868. }, parentSuspense);
  4869. }
  4870. };
  4871. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  4872. for (let i = 0; i < newChildren.length; i++) {
  4873. const oldVNode = oldChildren[i];
  4874. const newVNode = newChildren[i];
  4875. const container = (
  4876. // oldVNode may be an errored async setup() component inside Suspense
  4877. // which will not have a mounted element
  4878. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  4879. // of the Fragment itself so it can move its children.
  4880. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  4881. // which also requires the correct parent container
  4882. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  4883. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  4884. // In other cases, the parent container is not actually used so we
  4885. // just pass the block element here to avoid a DOM parentNode call.
  4886. fallbackContainer
  4887. )
  4888. );
  4889. patch(
  4890. oldVNode,
  4891. newVNode,
  4892. container,
  4893. null,
  4894. parentComponent,
  4895. parentSuspense,
  4896. namespace,
  4897. slotScopeIds,
  4898. true
  4899. );
  4900. }
  4901. };
  4902. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  4903. if (oldProps !== newProps) {
  4904. if (oldProps !== shared.EMPTY_OBJ) {
  4905. for (const key in oldProps) {
  4906. if (!shared.isReservedProp(key) && !(key in newProps)) {
  4907. hostPatchProp(
  4908. el,
  4909. key,
  4910. oldProps[key],
  4911. null,
  4912. namespace,
  4913. parentComponent
  4914. );
  4915. }
  4916. }
  4917. }
  4918. for (const key in newProps) {
  4919. if (shared.isReservedProp(key)) continue;
  4920. const next = newProps[key];
  4921. const prev = oldProps[key];
  4922. if (next !== prev && key !== "value") {
  4923. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  4924. }
  4925. }
  4926. if ("value" in newProps) {
  4927. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  4928. }
  4929. }
  4930. };
  4931. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  4932. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  4933. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  4934. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  4935. if (
  4936. // #5523 dev root fragment may inherit directives
  4937. isHmrUpdating || patchFlag & 2048
  4938. ) {
  4939. patchFlag = 0;
  4940. optimized = false;
  4941. dynamicChildren = null;
  4942. }
  4943. if (fragmentSlotScopeIds) {
  4944. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4945. }
  4946. if (n1 == null) {
  4947. hostInsert(fragmentStartAnchor, container, anchor);
  4948. hostInsert(fragmentEndAnchor, container, anchor);
  4949. mountChildren(
  4950. // #10007
  4951. // such fragment like `<></>` will be compiled into
  4952. // a fragment which doesn't have a children.
  4953. // In this case fallback to an empty array
  4954. n2.children || [],
  4955. container,
  4956. fragmentEndAnchor,
  4957. parentComponent,
  4958. parentSuspense,
  4959. namespace,
  4960. slotScopeIds,
  4961. optimized
  4962. );
  4963. } else {
  4964. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  4965. // of renderSlot() with no valid children
  4966. n1.dynamicChildren) {
  4967. patchBlockChildren(
  4968. n1.dynamicChildren,
  4969. dynamicChildren,
  4970. container,
  4971. parentComponent,
  4972. parentSuspense,
  4973. namespace,
  4974. slotScopeIds
  4975. );
  4976. {
  4977. traverseStaticChildren(n1, n2);
  4978. }
  4979. } else {
  4980. patchChildren(
  4981. n1,
  4982. n2,
  4983. container,
  4984. fragmentEndAnchor,
  4985. parentComponent,
  4986. parentSuspense,
  4987. namespace,
  4988. slotScopeIds,
  4989. optimized
  4990. );
  4991. }
  4992. }
  4993. };
  4994. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  4995. n2.slotScopeIds = slotScopeIds;
  4996. if (n1 == null) {
  4997. if (n2.shapeFlag & 512) {
  4998. parentComponent.ctx.activate(
  4999. n2,
  5000. container,
  5001. anchor,
  5002. namespace,
  5003. optimized
  5004. );
  5005. } else {
  5006. mountComponent(
  5007. n2,
  5008. container,
  5009. anchor,
  5010. parentComponent,
  5011. parentSuspense,
  5012. namespace,
  5013. optimized
  5014. );
  5015. }
  5016. } else {
  5017. updateComponent(n1, n2, optimized);
  5018. }
  5019. };
  5020. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  5021. const instance = (initialVNode.component = createComponentInstance(
  5022. initialVNode,
  5023. parentComponent,
  5024. parentSuspense
  5025. ));
  5026. if (instance.type.__hmrId) {
  5027. registerHMR(instance);
  5028. }
  5029. {
  5030. pushWarningContext(initialVNode);
  5031. startMeasure(instance, `mount`);
  5032. }
  5033. if (isKeepAlive(initialVNode)) {
  5034. instance.ctx.renderer = internals;
  5035. }
  5036. {
  5037. {
  5038. startMeasure(instance, `init`);
  5039. }
  5040. setupComponent(instance, false, optimized);
  5041. {
  5042. endMeasure(instance, `init`);
  5043. }
  5044. }
  5045. if (instance.asyncDep) {
  5046. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  5047. if (!initialVNode.el) {
  5048. const placeholder = instance.subTree = createVNode(Comment);
  5049. processCommentNode(null, placeholder, container, anchor);
  5050. }
  5051. } else {
  5052. setupRenderEffect(
  5053. instance,
  5054. initialVNode,
  5055. container,
  5056. anchor,
  5057. parentSuspense,
  5058. namespace,
  5059. optimized
  5060. );
  5061. }
  5062. {
  5063. popWarningContext();
  5064. endMeasure(instance, `mount`);
  5065. }
  5066. };
  5067. const updateComponent = (n1, n2, optimized) => {
  5068. const instance = n2.component = n1.component;
  5069. if (shouldUpdateComponent(n1, n2, optimized)) {
  5070. if (instance.asyncDep && !instance.asyncResolved) {
  5071. {
  5072. pushWarningContext(n2);
  5073. }
  5074. updateComponentPreRender(instance, n2, optimized);
  5075. {
  5076. popWarningContext();
  5077. }
  5078. return;
  5079. } else {
  5080. instance.next = n2;
  5081. instance.update();
  5082. }
  5083. } else {
  5084. n2.el = n1.el;
  5085. instance.vnode = n2;
  5086. }
  5087. };
  5088. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  5089. const componentUpdateFn = () => {
  5090. if (!instance.isMounted) {
  5091. let vnodeHook;
  5092. const { el, props } = initialVNode;
  5093. const { bm, m, parent, root, type } = instance;
  5094. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  5095. toggleRecurse(instance, false);
  5096. if (bm) {
  5097. shared.invokeArrayFns(bm);
  5098. }
  5099. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  5100. invokeVNodeHook(vnodeHook, parent, initialVNode);
  5101. }
  5102. toggleRecurse(instance, true);
  5103. if (el && hydrateNode) {
  5104. const hydrateSubTree = () => {
  5105. {
  5106. startMeasure(instance, `render`);
  5107. }
  5108. instance.subTree = renderComponentRoot(instance);
  5109. {
  5110. endMeasure(instance, `render`);
  5111. }
  5112. {
  5113. startMeasure(instance, `hydrate`);
  5114. }
  5115. hydrateNode(
  5116. el,
  5117. instance.subTree,
  5118. instance,
  5119. parentSuspense,
  5120. null
  5121. );
  5122. {
  5123. endMeasure(instance, `hydrate`);
  5124. }
  5125. };
  5126. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  5127. type.__asyncHydrate(
  5128. el,
  5129. instance,
  5130. hydrateSubTree
  5131. );
  5132. } else {
  5133. hydrateSubTree();
  5134. }
  5135. } else {
  5136. if (root.ce) {
  5137. root.ce._injectChildStyle(type);
  5138. }
  5139. {
  5140. startMeasure(instance, `render`);
  5141. }
  5142. const subTree = instance.subTree = renderComponentRoot(instance);
  5143. {
  5144. endMeasure(instance, `render`);
  5145. }
  5146. {
  5147. startMeasure(instance, `patch`);
  5148. }
  5149. patch(
  5150. null,
  5151. subTree,
  5152. container,
  5153. anchor,
  5154. instance,
  5155. parentSuspense,
  5156. namespace
  5157. );
  5158. {
  5159. endMeasure(instance, `patch`);
  5160. }
  5161. initialVNode.el = subTree.el;
  5162. }
  5163. if (m) {
  5164. queuePostRenderEffect(m, parentSuspense);
  5165. }
  5166. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  5167. const scopedInitialVNode = initialVNode;
  5168. queuePostRenderEffect(
  5169. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  5170. parentSuspense
  5171. );
  5172. }
  5173. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  5174. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  5175. }
  5176. instance.isMounted = true;
  5177. {
  5178. devtoolsComponentAdded(instance);
  5179. }
  5180. initialVNode = container = anchor = null;
  5181. } else {
  5182. let { next, bu, u, parent, vnode } = instance;
  5183. {
  5184. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  5185. if (nonHydratedAsyncRoot) {
  5186. if (next) {
  5187. next.el = vnode.el;
  5188. updateComponentPreRender(instance, next, optimized);
  5189. }
  5190. nonHydratedAsyncRoot.asyncDep.then(() => {
  5191. if (!instance.isUnmounted) {
  5192. componentUpdateFn();
  5193. }
  5194. });
  5195. return;
  5196. }
  5197. }
  5198. let originNext = next;
  5199. let vnodeHook;
  5200. {
  5201. pushWarningContext(next || instance.vnode);
  5202. }
  5203. toggleRecurse(instance, false);
  5204. if (next) {
  5205. next.el = vnode.el;
  5206. updateComponentPreRender(instance, next, optimized);
  5207. } else {
  5208. next = vnode;
  5209. }
  5210. if (bu) {
  5211. shared.invokeArrayFns(bu);
  5212. }
  5213. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  5214. invokeVNodeHook(vnodeHook, parent, next, vnode);
  5215. }
  5216. toggleRecurse(instance, true);
  5217. {
  5218. startMeasure(instance, `render`);
  5219. }
  5220. const nextTree = renderComponentRoot(instance);
  5221. {
  5222. endMeasure(instance, `render`);
  5223. }
  5224. const prevTree = instance.subTree;
  5225. instance.subTree = nextTree;
  5226. {
  5227. startMeasure(instance, `patch`);
  5228. }
  5229. patch(
  5230. prevTree,
  5231. nextTree,
  5232. // parent may have changed if it's in a teleport
  5233. hostParentNode(prevTree.el),
  5234. // anchor may have changed if it's in a fragment
  5235. getNextHostNode(prevTree),
  5236. instance,
  5237. parentSuspense,
  5238. namespace
  5239. );
  5240. {
  5241. endMeasure(instance, `patch`);
  5242. }
  5243. next.el = nextTree.el;
  5244. if (originNext === null) {
  5245. updateHOCHostEl(instance, nextTree.el);
  5246. }
  5247. if (u) {
  5248. queuePostRenderEffect(u, parentSuspense);
  5249. }
  5250. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  5251. queuePostRenderEffect(
  5252. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  5253. parentSuspense
  5254. );
  5255. }
  5256. {
  5257. devtoolsComponentUpdated(instance);
  5258. }
  5259. {
  5260. popWarningContext();
  5261. }
  5262. }
  5263. };
  5264. instance.scope.on();
  5265. const effect = instance.effect = new reactivity.ReactiveEffect(componentUpdateFn);
  5266. instance.scope.off();
  5267. const update = instance.update = effect.run.bind(effect);
  5268. const job = instance.job = effect.runIfDirty.bind(effect);
  5269. job.i = instance;
  5270. job.id = instance.uid;
  5271. effect.scheduler = () => queueJob(job);
  5272. toggleRecurse(instance, true);
  5273. {
  5274. effect.onTrack = instance.rtc ? (e) => shared.invokeArrayFns(instance.rtc, e) : void 0;
  5275. effect.onTrigger = instance.rtg ? (e) => shared.invokeArrayFns(instance.rtg, e) : void 0;
  5276. }
  5277. update();
  5278. };
  5279. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  5280. nextVNode.component = instance;
  5281. const prevProps = instance.vnode.props;
  5282. instance.vnode = nextVNode;
  5283. instance.next = null;
  5284. updateProps(instance, nextVNode.props, prevProps, optimized);
  5285. updateSlots(instance, nextVNode.children, optimized);
  5286. reactivity.pauseTracking();
  5287. flushPreFlushCbs(instance);
  5288. reactivity.resetTracking();
  5289. };
  5290. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  5291. const c1 = n1 && n1.children;
  5292. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  5293. const c2 = n2.children;
  5294. const { patchFlag, shapeFlag } = n2;
  5295. if (patchFlag > 0) {
  5296. if (patchFlag & 128) {
  5297. patchKeyedChildren(
  5298. c1,
  5299. c2,
  5300. container,
  5301. anchor,
  5302. parentComponent,
  5303. parentSuspense,
  5304. namespace,
  5305. slotScopeIds,
  5306. optimized
  5307. );
  5308. return;
  5309. } else if (patchFlag & 256) {
  5310. patchUnkeyedChildren(
  5311. c1,
  5312. c2,
  5313. container,
  5314. anchor,
  5315. parentComponent,
  5316. parentSuspense,
  5317. namespace,
  5318. slotScopeIds,
  5319. optimized
  5320. );
  5321. return;
  5322. }
  5323. }
  5324. if (shapeFlag & 8) {
  5325. if (prevShapeFlag & 16) {
  5326. unmountChildren(c1, parentComponent, parentSuspense);
  5327. }
  5328. if (c2 !== c1) {
  5329. hostSetElementText(container, c2);
  5330. }
  5331. } else {
  5332. if (prevShapeFlag & 16) {
  5333. if (shapeFlag & 16) {
  5334. patchKeyedChildren(
  5335. c1,
  5336. c2,
  5337. container,
  5338. anchor,
  5339. parentComponent,
  5340. parentSuspense,
  5341. namespace,
  5342. slotScopeIds,
  5343. optimized
  5344. );
  5345. } else {
  5346. unmountChildren(c1, parentComponent, parentSuspense, true);
  5347. }
  5348. } else {
  5349. if (prevShapeFlag & 8) {
  5350. hostSetElementText(container, "");
  5351. }
  5352. if (shapeFlag & 16) {
  5353. mountChildren(
  5354. c2,
  5355. container,
  5356. anchor,
  5357. parentComponent,
  5358. parentSuspense,
  5359. namespace,
  5360. slotScopeIds,
  5361. optimized
  5362. );
  5363. }
  5364. }
  5365. }
  5366. };
  5367. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  5368. c1 = c1 || shared.EMPTY_ARR;
  5369. c2 = c2 || shared.EMPTY_ARR;
  5370. const oldLength = c1.length;
  5371. const newLength = c2.length;
  5372. const commonLength = Math.min(oldLength, newLength);
  5373. let i;
  5374. for (i = 0; i < commonLength; i++) {
  5375. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5376. patch(
  5377. c1[i],
  5378. nextChild,
  5379. container,
  5380. null,
  5381. parentComponent,
  5382. parentSuspense,
  5383. namespace,
  5384. slotScopeIds,
  5385. optimized
  5386. );
  5387. }
  5388. if (oldLength > newLength) {
  5389. unmountChildren(
  5390. c1,
  5391. parentComponent,
  5392. parentSuspense,
  5393. true,
  5394. false,
  5395. commonLength
  5396. );
  5397. } else {
  5398. mountChildren(
  5399. c2,
  5400. container,
  5401. anchor,
  5402. parentComponent,
  5403. parentSuspense,
  5404. namespace,
  5405. slotScopeIds,
  5406. optimized,
  5407. commonLength
  5408. );
  5409. }
  5410. };
  5411. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  5412. let i = 0;
  5413. const l2 = c2.length;
  5414. let e1 = c1.length - 1;
  5415. let e2 = l2 - 1;
  5416. while (i <= e1 && i <= e2) {
  5417. const n1 = c1[i];
  5418. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5419. if (isSameVNodeType(n1, n2)) {
  5420. patch(
  5421. n1,
  5422. n2,
  5423. container,
  5424. null,
  5425. parentComponent,
  5426. parentSuspense,
  5427. namespace,
  5428. slotScopeIds,
  5429. optimized
  5430. );
  5431. } else {
  5432. break;
  5433. }
  5434. i++;
  5435. }
  5436. while (i <= e1 && i <= e2) {
  5437. const n1 = c1[e1];
  5438. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  5439. if (isSameVNodeType(n1, n2)) {
  5440. patch(
  5441. n1,
  5442. n2,
  5443. container,
  5444. null,
  5445. parentComponent,
  5446. parentSuspense,
  5447. namespace,
  5448. slotScopeIds,
  5449. optimized
  5450. );
  5451. } else {
  5452. break;
  5453. }
  5454. e1--;
  5455. e2--;
  5456. }
  5457. if (i > e1) {
  5458. if (i <= e2) {
  5459. const nextPos = e2 + 1;
  5460. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  5461. while (i <= e2) {
  5462. patch(
  5463. null,
  5464. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  5465. container,
  5466. anchor,
  5467. parentComponent,
  5468. parentSuspense,
  5469. namespace,
  5470. slotScopeIds,
  5471. optimized
  5472. );
  5473. i++;
  5474. }
  5475. }
  5476. } else if (i > e2) {
  5477. while (i <= e1) {
  5478. unmount(c1[i], parentComponent, parentSuspense, true);
  5479. i++;
  5480. }
  5481. } else {
  5482. const s1 = i;
  5483. const s2 = i;
  5484. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  5485. for (i = s2; i <= e2; i++) {
  5486. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5487. if (nextChild.key != null) {
  5488. if (keyToNewIndexMap.has(nextChild.key)) {
  5489. warn$1(
  5490. `Duplicate keys found during update:`,
  5491. JSON.stringify(nextChild.key),
  5492. `Make sure keys are unique.`
  5493. );
  5494. }
  5495. keyToNewIndexMap.set(nextChild.key, i);
  5496. }
  5497. }
  5498. let j;
  5499. let patched = 0;
  5500. const toBePatched = e2 - s2 + 1;
  5501. let moved = false;
  5502. let maxNewIndexSoFar = 0;
  5503. const newIndexToOldIndexMap = new Array(toBePatched);
  5504. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  5505. for (i = s1; i <= e1; i++) {
  5506. const prevChild = c1[i];
  5507. if (patched >= toBePatched) {
  5508. unmount(prevChild, parentComponent, parentSuspense, true);
  5509. continue;
  5510. }
  5511. let newIndex;
  5512. if (prevChild.key != null) {
  5513. newIndex = keyToNewIndexMap.get(prevChild.key);
  5514. } else {
  5515. for (j = s2; j <= e2; j++) {
  5516. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  5517. newIndex = j;
  5518. break;
  5519. }
  5520. }
  5521. }
  5522. if (newIndex === void 0) {
  5523. unmount(prevChild, parentComponent, parentSuspense, true);
  5524. } else {
  5525. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  5526. if (newIndex >= maxNewIndexSoFar) {
  5527. maxNewIndexSoFar = newIndex;
  5528. } else {
  5529. moved = true;
  5530. }
  5531. patch(
  5532. prevChild,
  5533. c2[newIndex],
  5534. container,
  5535. null,
  5536. parentComponent,
  5537. parentSuspense,
  5538. namespace,
  5539. slotScopeIds,
  5540. optimized
  5541. );
  5542. patched++;
  5543. }
  5544. }
  5545. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
  5546. j = increasingNewIndexSequence.length - 1;
  5547. for (i = toBePatched - 1; i >= 0; i--) {
  5548. const nextIndex = s2 + i;
  5549. const nextChild = c2[nextIndex];
  5550. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  5551. if (newIndexToOldIndexMap[i] === 0) {
  5552. patch(
  5553. null,
  5554. nextChild,
  5555. container,
  5556. anchor,
  5557. parentComponent,
  5558. parentSuspense,
  5559. namespace,
  5560. slotScopeIds,
  5561. optimized
  5562. );
  5563. } else if (moved) {
  5564. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  5565. move(nextChild, container, anchor, 2);
  5566. } else {
  5567. j--;
  5568. }
  5569. }
  5570. }
  5571. }
  5572. };
  5573. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  5574. const { el, type, transition, children, shapeFlag } = vnode;
  5575. if (shapeFlag & 6) {
  5576. move(vnode.component.subTree, container, anchor, moveType);
  5577. return;
  5578. }
  5579. if (shapeFlag & 128) {
  5580. vnode.suspense.move(container, anchor, moveType);
  5581. return;
  5582. }
  5583. if (shapeFlag & 64) {
  5584. type.move(vnode, container, anchor, internals);
  5585. return;
  5586. }
  5587. if (type === Fragment) {
  5588. hostInsert(el, container, anchor);
  5589. for (let i = 0; i < children.length; i++) {
  5590. move(children[i], container, anchor, moveType);
  5591. }
  5592. hostInsert(vnode.anchor, container, anchor);
  5593. return;
  5594. }
  5595. if (type === Static) {
  5596. moveStaticNode(vnode, container, anchor);
  5597. return;
  5598. }
  5599. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  5600. if (needTransition2) {
  5601. if (moveType === 0) {
  5602. transition.beforeEnter(el);
  5603. hostInsert(el, container, anchor);
  5604. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  5605. } else {
  5606. const { leave, delayLeave, afterLeave } = transition;
  5607. const remove2 = () => hostInsert(el, container, anchor);
  5608. const performLeave = () => {
  5609. leave(el, () => {
  5610. remove2();
  5611. afterLeave && afterLeave();
  5612. });
  5613. };
  5614. if (delayLeave) {
  5615. delayLeave(el, remove2, performLeave);
  5616. } else {
  5617. performLeave();
  5618. }
  5619. }
  5620. } else {
  5621. hostInsert(el, container, anchor);
  5622. }
  5623. };
  5624. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  5625. const {
  5626. type,
  5627. props,
  5628. ref,
  5629. children,
  5630. dynamicChildren,
  5631. shapeFlag,
  5632. patchFlag,
  5633. dirs,
  5634. cacheIndex
  5635. } = vnode;
  5636. if (patchFlag === -2) {
  5637. optimized = false;
  5638. }
  5639. if (ref != null) {
  5640. setRef(ref, null, parentSuspense, vnode, true);
  5641. }
  5642. if (cacheIndex != null) {
  5643. parentComponent.renderCache[cacheIndex] = void 0;
  5644. }
  5645. if (shapeFlag & 256) {
  5646. parentComponent.ctx.deactivate(vnode);
  5647. return;
  5648. }
  5649. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  5650. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  5651. let vnodeHook;
  5652. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  5653. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5654. }
  5655. if (shapeFlag & 6) {
  5656. unmountComponent(vnode.component, parentSuspense, doRemove);
  5657. } else {
  5658. if (shapeFlag & 128) {
  5659. vnode.suspense.unmount(parentSuspense, doRemove);
  5660. return;
  5661. }
  5662. if (shouldInvokeDirs) {
  5663. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  5664. }
  5665. if (shapeFlag & 64) {
  5666. vnode.type.remove(
  5667. vnode,
  5668. parentComponent,
  5669. parentSuspense,
  5670. internals,
  5671. doRemove
  5672. );
  5673. } else if (dynamicChildren && // #5154
  5674. // when v-once is used inside a block, setBlockTracking(-1) marks the
  5675. // parent block with hasOnce: true
  5676. // so that it doesn't take the fast path during unmount - otherwise
  5677. // components nested in v-once are never unmounted.
  5678. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  5679. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  5680. unmountChildren(
  5681. dynamicChildren,
  5682. parentComponent,
  5683. parentSuspense,
  5684. false,
  5685. true
  5686. );
  5687. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  5688. unmountChildren(children, parentComponent, parentSuspense);
  5689. }
  5690. if (doRemove) {
  5691. remove(vnode);
  5692. }
  5693. }
  5694. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  5695. queuePostRenderEffect(() => {
  5696. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5697. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  5698. }, parentSuspense);
  5699. }
  5700. };
  5701. const remove = (vnode) => {
  5702. const { type, el, anchor, transition } = vnode;
  5703. if (type === Fragment) {
  5704. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  5705. vnode.children.forEach((child) => {
  5706. if (child.type === Comment) {
  5707. hostRemove(child.el);
  5708. } else {
  5709. remove(child);
  5710. }
  5711. });
  5712. } else {
  5713. removeFragment(el, anchor);
  5714. }
  5715. return;
  5716. }
  5717. if (type === Static) {
  5718. removeStaticNode(vnode);
  5719. return;
  5720. }
  5721. const performRemove = () => {
  5722. hostRemove(el);
  5723. if (transition && !transition.persisted && transition.afterLeave) {
  5724. transition.afterLeave();
  5725. }
  5726. };
  5727. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  5728. const { leave, delayLeave } = transition;
  5729. const performLeave = () => leave(el, performRemove);
  5730. if (delayLeave) {
  5731. delayLeave(vnode.el, performRemove, performLeave);
  5732. } else {
  5733. performLeave();
  5734. }
  5735. } else {
  5736. performRemove();
  5737. }
  5738. };
  5739. const removeFragment = (cur, end) => {
  5740. let next;
  5741. while (cur !== end) {
  5742. next = hostNextSibling(cur);
  5743. hostRemove(cur);
  5744. cur = next;
  5745. }
  5746. hostRemove(end);
  5747. };
  5748. const unmountComponent = (instance, parentSuspense, doRemove) => {
  5749. if (instance.type.__hmrId) {
  5750. unregisterHMR(instance);
  5751. }
  5752. const { bum, scope, job, subTree, um, m, a } = instance;
  5753. invalidateMount(m);
  5754. invalidateMount(a);
  5755. if (bum) {
  5756. shared.invokeArrayFns(bum);
  5757. }
  5758. scope.stop();
  5759. if (job) {
  5760. job.flags |= 8;
  5761. unmount(subTree, instance, parentSuspense, doRemove);
  5762. }
  5763. if (um) {
  5764. queuePostRenderEffect(um, parentSuspense);
  5765. }
  5766. queuePostRenderEffect(() => {
  5767. instance.isUnmounted = true;
  5768. }, parentSuspense);
  5769. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  5770. parentSuspense.deps--;
  5771. if (parentSuspense.deps === 0) {
  5772. parentSuspense.resolve();
  5773. }
  5774. }
  5775. {
  5776. devtoolsComponentRemoved(instance);
  5777. }
  5778. };
  5779. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  5780. for (let i = start; i < children.length; i++) {
  5781. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  5782. }
  5783. };
  5784. const getNextHostNode = (vnode) => {
  5785. if (vnode.shapeFlag & 6) {
  5786. return getNextHostNode(vnode.component.subTree);
  5787. }
  5788. if (vnode.shapeFlag & 128) {
  5789. return vnode.suspense.next();
  5790. }
  5791. const el = hostNextSibling(vnode.anchor || vnode.el);
  5792. const teleportEnd = el && el[TeleportEndKey];
  5793. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  5794. };
  5795. let isFlushing = false;
  5796. const render = (vnode, container, namespace) => {
  5797. if (vnode == null) {
  5798. if (container._vnode) {
  5799. unmount(container._vnode, null, null, true);
  5800. }
  5801. } else {
  5802. patch(
  5803. container._vnode || null,
  5804. vnode,
  5805. container,
  5806. null,
  5807. null,
  5808. null,
  5809. namespace
  5810. );
  5811. }
  5812. container._vnode = vnode;
  5813. if (!isFlushing) {
  5814. isFlushing = true;
  5815. flushPreFlushCbs();
  5816. flushPostFlushCbs();
  5817. isFlushing = false;
  5818. }
  5819. };
  5820. const internals = {
  5821. p: patch,
  5822. um: unmount,
  5823. m: move,
  5824. r: remove,
  5825. mt: mountComponent,
  5826. mc: mountChildren,
  5827. pc: patchChildren,
  5828. pbc: patchBlockChildren,
  5829. n: getNextHostNode,
  5830. o: options
  5831. };
  5832. let hydrate;
  5833. let hydrateNode;
  5834. if (createHydrationFns) {
  5835. [hydrate, hydrateNode] = createHydrationFns(
  5836. internals
  5837. );
  5838. }
  5839. return {
  5840. render,
  5841. hydrate,
  5842. createApp: createAppAPI(render, hydrate)
  5843. };
  5844. }
  5845. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  5846. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  5847. }
  5848. function toggleRecurse({ effect, job }, allowed) {
  5849. if (allowed) {
  5850. effect.flags |= 32;
  5851. job.flags |= 4;
  5852. } else {
  5853. effect.flags &= ~32;
  5854. job.flags &= ~4;
  5855. }
  5856. }
  5857. function needTransition(parentSuspense, transition) {
  5858. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  5859. }
  5860. function traverseStaticChildren(n1, n2, shallow = false) {
  5861. const ch1 = n1.children;
  5862. const ch2 = n2.children;
  5863. if (shared.isArray(ch1) && shared.isArray(ch2)) {
  5864. for (let i = 0; i < ch1.length; i++) {
  5865. const c1 = ch1[i];
  5866. let c2 = ch2[i];
  5867. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  5868. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  5869. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  5870. c2.el = c1.el;
  5871. }
  5872. if (!shallow && c2.patchFlag !== -2)
  5873. traverseStaticChildren(c1, c2);
  5874. }
  5875. if (c2.type === Text) {
  5876. c2.el = c1.el;
  5877. }
  5878. if (c2.type === Comment && !c2.el) {
  5879. c2.el = c1.el;
  5880. }
  5881. }
  5882. }
  5883. }
  5884. function getSequence(arr) {
  5885. const p = arr.slice();
  5886. const result = [0];
  5887. let i, j, u, v, c;
  5888. const len = arr.length;
  5889. for (i = 0; i < len; i++) {
  5890. const arrI = arr[i];
  5891. if (arrI !== 0) {
  5892. j = result[result.length - 1];
  5893. if (arr[j] < arrI) {
  5894. p[i] = j;
  5895. result.push(i);
  5896. continue;
  5897. }
  5898. u = 0;
  5899. v = result.length - 1;
  5900. while (u < v) {
  5901. c = u + v >> 1;
  5902. if (arr[result[c]] < arrI) {
  5903. u = c + 1;
  5904. } else {
  5905. v = c;
  5906. }
  5907. }
  5908. if (arrI < arr[result[u]]) {
  5909. if (u > 0) {
  5910. p[i] = result[u - 1];
  5911. }
  5912. result[u] = i;
  5913. }
  5914. }
  5915. }
  5916. u = result.length;
  5917. v = result[u - 1];
  5918. while (u-- > 0) {
  5919. result[u] = v;
  5920. v = p[v];
  5921. }
  5922. return result;
  5923. }
  5924. function locateNonHydratedAsyncRoot(instance) {
  5925. const subComponent = instance.subTree.component;
  5926. if (subComponent) {
  5927. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  5928. return subComponent;
  5929. } else {
  5930. return locateNonHydratedAsyncRoot(subComponent);
  5931. }
  5932. }
  5933. }
  5934. function invalidateMount(hooks) {
  5935. if (hooks) {
  5936. for (let i = 0; i < hooks.length; i++)
  5937. hooks[i].flags |= 8;
  5938. }
  5939. }
  5940. const ssrContextKey = Symbol.for("v-scx");
  5941. const useSSRContext = () => {
  5942. {
  5943. const ctx = inject(ssrContextKey);
  5944. if (!ctx) {
  5945. warn$1(
  5946. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  5947. );
  5948. }
  5949. return ctx;
  5950. }
  5951. };
  5952. function watchEffect(effect, options) {
  5953. return doWatch(effect, null, options);
  5954. }
  5955. function watchPostEffect(effect, options) {
  5956. return doWatch(
  5957. effect,
  5958. null,
  5959. shared.extend({}, options, { flush: "post" })
  5960. );
  5961. }
  5962. function watchSyncEffect(effect, options) {
  5963. return doWatch(
  5964. effect,
  5965. null,
  5966. shared.extend({}, options, { flush: "sync" })
  5967. );
  5968. }
  5969. function watch(source, cb, options) {
  5970. if (!shared.isFunction(cb)) {
  5971. warn$1(
  5972. `\`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.`
  5973. );
  5974. }
  5975. return doWatch(source, cb, options);
  5976. }
  5977. function doWatch(source, cb, options = shared.EMPTY_OBJ) {
  5978. const { immediate, deep, flush, once } = options;
  5979. if (!cb) {
  5980. if (immediate !== void 0) {
  5981. warn$1(
  5982. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  5983. );
  5984. }
  5985. if (deep !== void 0) {
  5986. warn$1(
  5987. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  5988. );
  5989. }
  5990. if (once !== void 0) {
  5991. warn$1(
  5992. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  5993. );
  5994. }
  5995. }
  5996. const baseWatchOptions = shared.extend({}, options);
  5997. baseWatchOptions.onWarn = warn$1;
  5998. let ssrCleanup;
  5999. if (isInSSRComponentSetup) {
  6000. if (flush === "sync") {
  6001. const ctx = useSSRContext();
  6002. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  6003. } else if (!cb || immediate) {
  6004. baseWatchOptions.once = true;
  6005. } else {
  6006. return {
  6007. stop: shared.NOOP,
  6008. resume: shared.NOOP,
  6009. pause: shared.NOOP
  6010. };
  6011. }
  6012. }
  6013. const instance = currentInstance;
  6014. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  6015. let isPre = false;
  6016. if (flush === "post") {
  6017. baseWatchOptions.scheduler = (job) => {
  6018. queuePostRenderEffect(job, instance && instance.suspense);
  6019. };
  6020. } else if (flush !== "sync") {
  6021. isPre = true;
  6022. baseWatchOptions.scheduler = (job, isFirstRun) => {
  6023. if (isFirstRun) {
  6024. job();
  6025. } else {
  6026. queueJob(job);
  6027. }
  6028. };
  6029. }
  6030. baseWatchOptions.augmentJob = (job) => {
  6031. if (cb) {
  6032. job.flags |= 4;
  6033. }
  6034. if (isPre) {
  6035. job.flags |= 2;
  6036. if (instance) {
  6037. job.id = instance.uid;
  6038. job.i = instance;
  6039. }
  6040. }
  6041. };
  6042. const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
  6043. if (ssrCleanup) ssrCleanup.push(watchHandle);
  6044. return watchHandle;
  6045. }
  6046. function instanceWatch(source, value, options) {
  6047. const publicThis = this.proxy;
  6048. const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  6049. let cb;
  6050. if (shared.isFunction(value)) {
  6051. cb = value;
  6052. } else {
  6053. cb = value.handler;
  6054. options = value;
  6055. }
  6056. const reset = setCurrentInstance(this);
  6057. const res = doWatch(getter, cb.bind(publicThis), options);
  6058. reset();
  6059. return res;
  6060. }
  6061. function createPathGetter(ctx, path) {
  6062. const segments = path.split(".");
  6063. return () => {
  6064. let cur = ctx;
  6065. for (let i = 0; i < segments.length && cur; i++) {
  6066. cur = cur[segments[i]];
  6067. }
  6068. return cur;
  6069. };
  6070. }
  6071. function useModel(props, name, options = shared.EMPTY_OBJ) {
  6072. const i = getCurrentInstance();
  6073. if (!i) {
  6074. warn$1(`useModel() called without active instance.`);
  6075. return reactivity.ref();
  6076. }
  6077. if (!i.propsOptions[0][name]) {
  6078. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  6079. return reactivity.ref();
  6080. }
  6081. const camelizedName = shared.camelize(name);
  6082. const hyphenatedName = shared.hyphenate(name);
  6083. const modifiers = getModelModifiers(props, name);
  6084. const res = reactivity.customRef((track, trigger) => {
  6085. let localValue;
  6086. let prevSetValue = shared.EMPTY_OBJ;
  6087. let prevEmittedValue;
  6088. watchSyncEffect(() => {
  6089. const propValue = props[name];
  6090. if (shared.hasChanged(localValue, propValue)) {
  6091. localValue = propValue;
  6092. trigger();
  6093. }
  6094. });
  6095. return {
  6096. get() {
  6097. track();
  6098. return options.get ? options.get(localValue) : localValue;
  6099. },
  6100. set(value) {
  6101. const emittedValue = options.set ? options.set(value) : value;
  6102. if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
  6103. return;
  6104. }
  6105. const rawProps = i.vnode.props;
  6106. if (!(rawProps && // check if parent has passed v-model
  6107. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  6108. localValue = value;
  6109. trigger();
  6110. }
  6111. i.emit(`update:${name}`, emittedValue);
  6112. if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
  6113. trigger();
  6114. }
  6115. prevSetValue = value;
  6116. prevEmittedValue = emittedValue;
  6117. }
  6118. };
  6119. });
  6120. res[Symbol.iterator] = () => {
  6121. let i2 = 0;
  6122. return {
  6123. next() {
  6124. if (i2 < 2) {
  6125. return { value: i2++ ? modifiers || shared.EMPTY_OBJ : res, done: false };
  6126. } else {
  6127. return { done: true };
  6128. }
  6129. }
  6130. };
  6131. };
  6132. return res;
  6133. }
  6134. const getModelModifiers = (props, modelName) => {
  6135. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${shared.camelize(modelName)}Modifiers`] || props[`${shared.hyphenate(modelName)}Modifiers`];
  6136. };
  6137. function emit(instance, event, ...rawArgs) {
  6138. if (instance.isUnmounted) return;
  6139. const props = instance.vnode.props || shared.EMPTY_OBJ;
  6140. {
  6141. const {
  6142. emitsOptions,
  6143. propsOptions: [propsOptions]
  6144. } = instance;
  6145. if (emitsOptions) {
  6146. if (!(event in emitsOptions) && true) {
  6147. if (!propsOptions || !(shared.toHandlerKey(shared.camelize(event)) in propsOptions)) {
  6148. warn$1(
  6149. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${shared.toHandlerKey(shared.camelize(event))}" prop.`
  6150. );
  6151. }
  6152. } else {
  6153. const validator = emitsOptions[event];
  6154. if (shared.isFunction(validator)) {
  6155. const isValid = validator(...rawArgs);
  6156. if (!isValid) {
  6157. warn$1(
  6158. `Invalid event arguments: event validation failed for event "${event}".`
  6159. );
  6160. }
  6161. }
  6162. }
  6163. }
  6164. }
  6165. let args = rawArgs;
  6166. const isModelListener = event.startsWith("update:");
  6167. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  6168. if (modifiers) {
  6169. if (modifiers.trim) {
  6170. args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
  6171. }
  6172. if (modifiers.number) {
  6173. args = rawArgs.map(shared.looseToNumber);
  6174. }
  6175. }
  6176. {
  6177. devtoolsComponentEmit(instance, event, args);
  6178. }
  6179. {
  6180. const lowerCaseEvent = event.toLowerCase();
  6181. if (lowerCaseEvent !== event && props[shared.toHandlerKey(lowerCaseEvent)]) {
  6182. warn$1(
  6183. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  6184. instance,
  6185. instance.type
  6186. )} 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 "${shared.hyphenate(
  6187. event
  6188. )}" instead of "${event}".`
  6189. );
  6190. }
  6191. }
  6192. let handlerName;
  6193. let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
  6194. props[handlerName = shared.toHandlerKey(shared.camelize(event))];
  6195. if (!handler && isModelListener) {
  6196. handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
  6197. }
  6198. if (handler) {
  6199. callWithAsyncErrorHandling(
  6200. handler,
  6201. instance,
  6202. 6,
  6203. args
  6204. );
  6205. }
  6206. const onceHandler = props[handlerName + `Once`];
  6207. if (onceHandler) {
  6208. if (!instance.emitted) {
  6209. instance.emitted = {};
  6210. } else if (instance.emitted[handlerName]) {
  6211. return;
  6212. }
  6213. instance.emitted[handlerName] = true;
  6214. callWithAsyncErrorHandling(
  6215. onceHandler,
  6216. instance,
  6217. 6,
  6218. args
  6219. );
  6220. }
  6221. }
  6222. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  6223. const cache = appContext.emitsCache;
  6224. const cached = cache.get(comp);
  6225. if (cached !== void 0) {
  6226. return cached;
  6227. }
  6228. const raw = comp.emits;
  6229. let normalized = {};
  6230. let hasExtends = false;
  6231. if (!shared.isFunction(comp)) {
  6232. const extendEmits = (raw2) => {
  6233. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  6234. if (normalizedFromExtend) {
  6235. hasExtends = true;
  6236. shared.extend(normalized, normalizedFromExtend);
  6237. }
  6238. };
  6239. if (!asMixin && appContext.mixins.length) {
  6240. appContext.mixins.forEach(extendEmits);
  6241. }
  6242. if (comp.extends) {
  6243. extendEmits(comp.extends);
  6244. }
  6245. if (comp.mixins) {
  6246. comp.mixins.forEach(extendEmits);
  6247. }
  6248. }
  6249. if (!raw && !hasExtends) {
  6250. if (shared.isObject(comp)) {
  6251. cache.set(comp, null);
  6252. }
  6253. return null;
  6254. }
  6255. if (shared.isArray(raw)) {
  6256. raw.forEach((key) => normalized[key] = null);
  6257. } else {
  6258. shared.extend(normalized, raw);
  6259. }
  6260. if (shared.isObject(comp)) {
  6261. cache.set(comp, normalized);
  6262. }
  6263. return normalized;
  6264. }
  6265. function isEmitListener(options, key) {
  6266. if (!options || !shared.isOn(key)) {
  6267. return false;
  6268. }
  6269. key = key.slice(2).replace(/Once$/, "");
  6270. return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
  6271. }
  6272. let accessedAttrs = false;
  6273. function markAttrsAccessed() {
  6274. accessedAttrs = true;
  6275. }
  6276. function renderComponentRoot(instance) {
  6277. const {
  6278. type: Component,
  6279. vnode,
  6280. proxy,
  6281. withProxy,
  6282. propsOptions: [propsOptions],
  6283. slots,
  6284. attrs,
  6285. emit,
  6286. render,
  6287. renderCache,
  6288. props,
  6289. data,
  6290. setupState,
  6291. ctx,
  6292. inheritAttrs
  6293. } = instance;
  6294. const prev = setCurrentRenderingInstance(instance);
  6295. let result;
  6296. let fallthroughAttrs;
  6297. {
  6298. accessedAttrs = false;
  6299. }
  6300. try {
  6301. if (vnode.shapeFlag & 4) {
  6302. const proxyToUse = withProxy || proxy;
  6303. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  6304. get(target, key, receiver) {
  6305. warn$1(
  6306. `Property '${String(
  6307. key
  6308. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  6309. );
  6310. return Reflect.get(target, key, receiver);
  6311. }
  6312. }) : proxyToUse;
  6313. result = normalizeVNode(
  6314. render.call(
  6315. thisProxy,
  6316. proxyToUse,
  6317. renderCache,
  6318. true ? reactivity.shallowReadonly(props) : props,
  6319. setupState,
  6320. data,
  6321. ctx
  6322. )
  6323. );
  6324. fallthroughAttrs = attrs;
  6325. } else {
  6326. const render2 = Component;
  6327. if (attrs === props) {
  6328. markAttrsAccessed();
  6329. }
  6330. result = normalizeVNode(
  6331. render2.length > 1 ? render2(
  6332. true ? reactivity.shallowReadonly(props) : props,
  6333. true ? {
  6334. get attrs() {
  6335. markAttrsAccessed();
  6336. return reactivity.shallowReadonly(attrs);
  6337. },
  6338. slots,
  6339. emit
  6340. } : { attrs, slots, emit }
  6341. ) : render2(
  6342. true ? reactivity.shallowReadonly(props) : props,
  6343. null
  6344. )
  6345. );
  6346. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  6347. }
  6348. } catch (err) {
  6349. blockStack.length = 0;
  6350. handleError(err, instance, 1);
  6351. result = createVNode(Comment);
  6352. }
  6353. let root = result;
  6354. let setRoot = void 0;
  6355. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  6356. [root, setRoot] = getChildRoot(result);
  6357. }
  6358. if (fallthroughAttrs && inheritAttrs !== false) {
  6359. const keys = Object.keys(fallthroughAttrs);
  6360. const { shapeFlag } = root;
  6361. if (keys.length) {
  6362. if (shapeFlag & (1 | 6)) {
  6363. if (propsOptions && keys.some(shared.isModelListener)) {
  6364. fallthroughAttrs = filterModelListeners(
  6365. fallthroughAttrs,
  6366. propsOptions
  6367. );
  6368. }
  6369. root = cloneVNode(root, fallthroughAttrs, false, true);
  6370. } else if (!accessedAttrs && root.type !== Comment) {
  6371. const allAttrs = Object.keys(attrs);
  6372. const eventAttrs = [];
  6373. const extraAttrs = [];
  6374. for (let i = 0, l = allAttrs.length; i < l; i++) {
  6375. const key = allAttrs[i];
  6376. if (shared.isOn(key)) {
  6377. if (!shared.isModelListener(key)) {
  6378. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  6379. }
  6380. } else {
  6381. extraAttrs.push(key);
  6382. }
  6383. }
  6384. if (extraAttrs.length) {
  6385. warn$1(
  6386. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  6387. );
  6388. }
  6389. if (eventAttrs.length) {
  6390. warn$1(
  6391. `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.`
  6392. );
  6393. }
  6394. }
  6395. }
  6396. }
  6397. if (vnode.dirs) {
  6398. if (!isElementRoot(root)) {
  6399. warn$1(
  6400. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  6401. );
  6402. }
  6403. root = cloneVNode(root, null, false, true);
  6404. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  6405. }
  6406. if (vnode.transition) {
  6407. if (!isElementRoot(root)) {
  6408. warn$1(
  6409. `Component inside <Transition> renders non-element root node that cannot be animated.`
  6410. );
  6411. }
  6412. setTransitionHooks(root, vnode.transition);
  6413. }
  6414. if (setRoot) {
  6415. setRoot(root);
  6416. } else {
  6417. result = root;
  6418. }
  6419. setCurrentRenderingInstance(prev);
  6420. return result;
  6421. }
  6422. const getChildRoot = (vnode) => {
  6423. const rawChildren = vnode.children;
  6424. const dynamicChildren = vnode.dynamicChildren;
  6425. const childRoot = filterSingleRoot(rawChildren, false);
  6426. if (!childRoot) {
  6427. return [vnode, void 0];
  6428. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  6429. return getChildRoot(childRoot);
  6430. }
  6431. const index = rawChildren.indexOf(childRoot);
  6432. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  6433. const setRoot = (updatedRoot) => {
  6434. rawChildren[index] = updatedRoot;
  6435. if (dynamicChildren) {
  6436. if (dynamicIndex > -1) {
  6437. dynamicChildren[dynamicIndex] = updatedRoot;
  6438. } else if (updatedRoot.patchFlag > 0) {
  6439. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  6440. }
  6441. }
  6442. };
  6443. return [normalizeVNode(childRoot), setRoot];
  6444. };
  6445. function filterSingleRoot(children, recurse = true) {
  6446. let singleRoot;
  6447. for (let i = 0; i < children.length; i++) {
  6448. const child = children[i];
  6449. if (isVNode(child)) {
  6450. if (child.type !== Comment || child.children === "v-if") {
  6451. if (singleRoot) {
  6452. return;
  6453. } else {
  6454. singleRoot = child;
  6455. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  6456. return filterSingleRoot(singleRoot.children);
  6457. }
  6458. }
  6459. }
  6460. } else {
  6461. return;
  6462. }
  6463. }
  6464. return singleRoot;
  6465. }
  6466. const getFunctionalFallthrough = (attrs) => {
  6467. let res;
  6468. for (const key in attrs) {
  6469. if (key === "class" || key === "style" || shared.isOn(key)) {
  6470. (res || (res = {}))[key] = attrs[key];
  6471. }
  6472. }
  6473. return res;
  6474. };
  6475. const filterModelListeners = (attrs, props) => {
  6476. const res = {};
  6477. for (const key in attrs) {
  6478. if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
  6479. res[key] = attrs[key];
  6480. }
  6481. }
  6482. return res;
  6483. };
  6484. const isElementRoot = (vnode) => {
  6485. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  6486. };
  6487. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  6488. const { props: prevProps, children: prevChildren, component } = prevVNode;
  6489. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  6490. const emits = component.emitsOptions;
  6491. if ((prevChildren || nextChildren) && isHmrUpdating) {
  6492. return true;
  6493. }
  6494. if (nextVNode.dirs || nextVNode.transition) {
  6495. return true;
  6496. }
  6497. if (optimized && patchFlag >= 0) {
  6498. if (patchFlag & 1024) {
  6499. return true;
  6500. }
  6501. if (patchFlag & 16) {
  6502. if (!prevProps) {
  6503. return !!nextProps;
  6504. }
  6505. return hasPropsChanged(prevProps, nextProps, emits);
  6506. } else if (patchFlag & 8) {
  6507. const dynamicProps = nextVNode.dynamicProps;
  6508. for (let i = 0; i < dynamicProps.length; i++) {
  6509. const key = dynamicProps[i];
  6510. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  6511. return true;
  6512. }
  6513. }
  6514. }
  6515. } else {
  6516. if (prevChildren || nextChildren) {
  6517. if (!nextChildren || !nextChildren.$stable) {
  6518. return true;
  6519. }
  6520. }
  6521. if (prevProps === nextProps) {
  6522. return false;
  6523. }
  6524. if (!prevProps) {
  6525. return !!nextProps;
  6526. }
  6527. if (!nextProps) {
  6528. return true;
  6529. }
  6530. return hasPropsChanged(prevProps, nextProps, emits);
  6531. }
  6532. return false;
  6533. }
  6534. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  6535. const nextKeys = Object.keys(nextProps);
  6536. if (nextKeys.length !== Object.keys(prevProps).length) {
  6537. return true;
  6538. }
  6539. for (let i = 0; i < nextKeys.length; i++) {
  6540. const key = nextKeys[i];
  6541. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  6542. return true;
  6543. }
  6544. }
  6545. return false;
  6546. }
  6547. function updateHOCHostEl({ vnode, parent }, el) {
  6548. while (parent) {
  6549. const root = parent.subTree;
  6550. if (root.suspense && root.suspense.activeBranch === vnode) {
  6551. root.el = vnode.el;
  6552. }
  6553. if (root === vnode) {
  6554. (vnode = parent.vnode).el = el;
  6555. parent = parent.parent;
  6556. } else {
  6557. break;
  6558. }
  6559. }
  6560. }
  6561. const isSuspense = (type) => type.__isSuspense;
  6562. let suspenseId = 0;
  6563. const SuspenseImpl = {
  6564. name: "Suspense",
  6565. // In order to make Suspense tree-shakable, we need to avoid importing it
  6566. // directly in the renderer. The renderer checks for the __isSuspense flag
  6567. // on a vnode's type and calls the `process` method, passing in renderer
  6568. // internals.
  6569. __isSuspense: true,
  6570. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  6571. if (n1 == null) {
  6572. mountSuspense(
  6573. n2,
  6574. container,
  6575. anchor,
  6576. parentComponent,
  6577. parentSuspense,
  6578. namespace,
  6579. slotScopeIds,
  6580. optimized,
  6581. rendererInternals
  6582. );
  6583. } else {
  6584. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  6585. n2.suspense = n1.suspense;
  6586. n2.suspense.vnode = n2;
  6587. n2.el = n1.el;
  6588. return;
  6589. }
  6590. patchSuspense(
  6591. n1,
  6592. n2,
  6593. container,
  6594. anchor,
  6595. parentComponent,
  6596. namespace,
  6597. slotScopeIds,
  6598. optimized,
  6599. rendererInternals
  6600. );
  6601. }
  6602. },
  6603. hydrate: hydrateSuspense,
  6604. normalize: normalizeSuspenseChildren
  6605. };
  6606. const Suspense = SuspenseImpl ;
  6607. function triggerEvent(vnode, name) {
  6608. const eventListener = vnode.props && vnode.props[name];
  6609. if (shared.isFunction(eventListener)) {
  6610. eventListener();
  6611. }
  6612. }
  6613. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  6614. const {
  6615. p: patch,
  6616. o: { createElement }
  6617. } = rendererInternals;
  6618. const hiddenContainer = createElement("div");
  6619. const suspense = vnode.suspense = createSuspenseBoundary(
  6620. vnode,
  6621. parentSuspense,
  6622. parentComponent,
  6623. container,
  6624. hiddenContainer,
  6625. anchor,
  6626. namespace,
  6627. slotScopeIds,
  6628. optimized,
  6629. rendererInternals
  6630. );
  6631. patch(
  6632. null,
  6633. suspense.pendingBranch = vnode.ssContent,
  6634. hiddenContainer,
  6635. null,
  6636. parentComponent,
  6637. suspense,
  6638. namespace,
  6639. slotScopeIds
  6640. );
  6641. if (suspense.deps > 0) {
  6642. triggerEvent(vnode, "onPending");
  6643. triggerEvent(vnode, "onFallback");
  6644. patch(
  6645. null,
  6646. vnode.ssFallback,
  6647. container,
  6648. anchor,
  6649. parentComponent,
  6650. null,
  6651. // fallback tree will not have suspense context
  6652. namespace,
  6653. slotScopeIds
  6654. );
  6655. setActiveBranch(suspense, vnode.ssFallback);
  6656. } else {
  6657. suspense.resolve(false, true);
  6658. }
  6659. }
  6660. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  6661. const suspense = n2.suspense = n1.suspense;
  6662. suspense.vnode = n2;
  6663. n2.el = n1.el;
  6664. const newBranch = n2.ssContent;
  6665. const newFallback = n2.ssFallback;
  6666. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  6667. if (pendingBranch) {
  6668. suspense.pendingBranch = newBranch;
  6669. if (isSameVNodeType(newBranch, pendingBranch)) {
  6670. patch(
  6671. pendingBranch,
  6672. newBranch,
  6673. suspense.hiddenContainer,
  6674. null,
  6675. parentComponent,
  6676. suspense,
  6677. namespace,
  6678. slotScopeIds,
  6679. optimized
  6680. );
  6681. if (suspense.deps <= 0) {
  6682. suspense.resolve();
  6683. } else if (isInFallback) {
  6684. if (!isHydrating) {
  6685. patch(
  6686. activeBranch,
  6687. newFallback,
  6688. container,
  6689. anchor,
  6690. parentComponent,
  6691. null,
  6692. // fallback tree will not have suspense context
  6693. namespace,
  6694. slotScopeIds,
  6695. optimized
  6696. );
  6697. setActiveBranch(suspense, newFallback);
  6698. }
  6699. }
  6700. } else {
  6701. suspense.pendingId = suspenseId++;
  6702. if (isHydrating) {
  6703. suspense.isHydrating = false;
  6704. suspense.activeBranch = pendingBranch;
  6705. } else {
  6706. unmount(pendingBranch, parentComponent, suspense);
  6707. }
  6708. suspense.deps = 0;
  6709. suspense.effects.length = 0;
  6710. suspense.hiddenContainer = createElement("div");
  6711. if (isInFallback) {
  6712. patch(
  6713. null,
  6714. newBranch,
  6715. suspense.hiddenContainer,
  6716. null,
  6717. parentComponent,
  6718. suspense,
  6719. namespace,
  6720. slotScopeIds,
  6721. optimized
  6722. );
  6723. if (suspense.deps <= 0) {
  6724. suspense.resolve();
  6725. } else {
  6726. patch(
  6727. activeBranch,
  6728. newFallback,
  6729. container,
  6730. anchor,
  6731. parentComponent,
  6732. null,
  6733. // fallback tree will not have suspense context
  6734. namespace,
  6735. slotScopeIds,
  6736. optimized
  6737. );
  6738. setActiveBranch(suspense, newFallback);
  6739. }
  6740. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  6741. patch(
  6742. activeBranch,
  6743. newBranch,
  6744. container,
  6745. anchor,
  6746. parentComponent,
  6747. suspense,
  6748. namespace,
  6749. slotScopeIds,
  6750. optimized
  6751. );
  6752. suspense.resolve(true);
  6753. } else {
  6754. patch(
  6755. null,
  6756. newBranch,
  6757. suspense.hiddenContainer,
  6758. null,
  6759. parentComponent,
  6760. suspense,
  6761. namespace,
  6762. slotScopeIds,
  6763. optimized
  6764. );
  6765. if (suspense.deps <= 0) {
  6766. suspense.resolve();
  6767. }
  6768. }
  6769. }
  6770. } else {
  6771. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  6772. patch(
  6773. activeBranch,
  6774. newBranch,
  6775. container,
  6776. anchor,
  6777. parentComponent,
  6778. suspense,
  6779. namespace,
  6780. slotScopeIds,
  6781. optimized
  6782. );
  6783. setActiveBranch(suspense, newBranch);
  6784. } else {
  6785. triggerEvent(n2, "onPending");
  6786. suspense.pendingBranch = newBranch;
  6787. if (newBranch.shapeFlag & 512) {
  6788. suspense.pendingId = newBranch.component.suspenseId;
  6789. } else {
  6790. suspense.pendingId = suspenseId++;
  6791. }
  6792. patch(
  6793. null,
  6794. newBranch,
  6795. suspense.hiddenContainer,
  6796. null,
  6797. parentComponent,
  6798. suspense,
  6799. namespace,
  6800. slotScopeIds,
  6801. optimized
  6802. );
  6803. if (suspense.deps <= 0) {
  6804. suspense.resolve();
  6805. } else {
  6806. const { timeout, pendingId } = suspense;
  6807. if (timeout > 0) {
  6808. setTimeout(() => {
  6809. if (suspense.pendingId === pendingId) {
  6810. suspense.fallback(newFallback);
  6811. }
  6812. }, timeout);
  6813. } else if (timeout === 0) {
  6814. suspense.fallback(newFallback);
  6815. }
  6816. }
  6817. }
  6818. }
  6819. }
  6820. let hasWarned = false;
  6821. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  6822. if (!hasWarned) {
  6823. hasWarned = true;
  6824. console[console.info ? "info" : "log"](
  6825. `<Suspense> is an experimental feature and its API will likely change.`
  6826. );
  6827. }
  6828. const {
  6829. p: patch,
  6830. m: move,
  6831. um: unmount,
  6832. n: next,
  6833. o: { parentNode, remove }
  6834. } = rendererInternals;
  6835. let parentSuspenseId;
  6836. const isSuspensible = isVNodeSuspensible(vnode);
  6837. if (isSuspensible) {
  6838. if (parentSuspense && parentSuspense.pendingBranch) {
  6839. parentSuspenseId = parentSuspense.pendingId;
  6840. parentSuspense.deps++;
  6841. }
  6842. }
  6843. const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
  6844. {
  6845. assertNumber(timeout, `Suspense timeout`);
  6846. }
  6847. const initialAnchor = anchor;
  6848. const suspense = {
  6849. vnode,
  6850. parent: parentSuspense,
  6851. parentComponent,
  6852. namespace,
  6853. container,
  6854. hiddenContainer,
  6855. deps: 0,
  6856. pendingId: suspenseId++,
  6857. timeout: typeof timeout === "number" ? timeout : -1,
  6858. activeBranch: null,
  6859. pendingBranch: null,
  6860. isInFallback: !isHydrating,
  6861. isHydrating,
  6862. isUnmounted: false,
  6863. effects: [],
  6864. resolve(resume = false, sync = false) {
  6865. {
  6866. if (!resume && !suspense.pendingBranch) {
  6867. throw new Error(
  6868. `suspense.resolve() is called without a pending branch.`
  6869. );
  6870. }
  6871. if (suspense.isUnmounted) {
  6872. throw new Error(
  6873. `suspense.resolve() is called on an already unmounted suspense boundary.`
  6874. );
  6875. }
  6876. }
  6877. const {
  6878. vnode: vnode2,
  6879. activeBranch,
  6880. pendingBranch,
  6881. pendingId,
  6882. effects,
  6883. parentComponent: parentComponent2,
  6884. container: container2
  6885. } = suspense;
  6886. let delayEnter = false;
  6887. if (suspense.isHydrating) {
  6888. suspense.isHydrating = false;
  6889. } else if (!resume) {
  6890. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  6891. if (delayEnter) {
  6892. activeBranch.transition.afterLeave = () => {
  6893. if (pendingId === suspense.pendingId) {
  6894. move(
  6895. pendingBranch,
  6896. container2,
  6897. anchor === initialAnchor ? next(activeBranch) : anchor,
  6898. 0
  6899. );
  6900. queuePostFlushCb(effects);
  6901. }
  6902. };
  6903. }
  6904. if (activeBranch) {
  6905. if (parentNode(activeBranch.el) === container2) {
  6906. anchor = next(activeBranch);
  6907. }
  6908. unmount(activeBranch, parentComponent2, suspense, true);
  6909. }
  6910. if (!delayEnter) {
  6911. move(pendingBranch, container2, anchor, 0);
  6912. }
  6913. }
  6914. setActiveBranch(suspense, pendingBranch);
  6915. suspense.pendingBranch = null;
  6916. suspense.isInFallback = false;
  6917. let parent = suspense.parent;
  6918. let hasUnresolvedAncestor = false;
  6919. while (parent) {
  6920. if (parent.pendingBranch) {
  6921. parent.effects.push(...effects);
  6922. hasUnresolvedAncestor = true;
  6923. break;
  6924. }
  6925. parent = parent.parent;
  6926. }
  6927. if (!hasUnresolvedAncestor && !delayEnter) {
  6928. queuePostFlushCb(effects);
  6929. }
  6930. suspense.effects = [];
  6931. if (isSuspensible) {
  6932. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  6933. parentSuspense.deps--;
  6934. if (parentSuspense.deps === 0 && !sync) {
  6935. parentSuspense.resolve();
  6936. }
  6937. }
  6938. }
  6939. triggerEvent(vnode2, "onResolve");
  6940. },
  6941. fallback(fallbackVNode) {
  6942. if (!suspense.pendingBranch) {
  6943. return;
  6944. }
  6945. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  6946. triggerEvent(vnode2, "onFallback");
  6947. const anchor2 = next(activeBranch);
  6948. const mountFallback = () => {
  6949. if (!suspense.isInFallback) {
  6950. return;
  6951. }
  6952. patch(
  6953. null,
  6954. fallbackVNode,
  6955. container2,
  6956. anchor2,
  6957. parentComponent2,
  6958. null,
  6959. // fallback tree will not have suspense context
  6960. namespace2,
  6961. slotScopeIds,
  6962. optimized
  6963. );
  6964. setActiveBranch(suspense, fallbackVNode);
  6965. };
  6966. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  6967. if (delayEnter) {
  6968. activeBranch.transition.afterLeave = mountFallback;
  6969. }
  6970. suspense.isInFallback = true;
  6971. unmount(
  6972. activeBranch,
  6973. parentComponent2,
  6974. null,
  6975. // no suspense so unmount hooks fire now
  6976. true
  6977. // shouldRemove
  6978. );
  6979. if (!delayEnter) {
  6980. mountFallback();
  6981. }
  6982. },
  6983. move(container2, anchor2, type) {
  6984. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  6985. suspense.container = container2;
  6986. },
  6987. next() {
  6988. return suspense.activeBranch && next(suspense.activeBranch);
  6989. },
  6990. registerDep(instance, setupRenderEffect, optimized2) {
  6991. const isInPendingSuspense = !!suspense.pendingBranch;
  6992. if (isInPendingSuspense) {
  6993. suspense.deps++;
  6994. }
  6995. const hydratedEl = instance.vnode.el;
  6996. instance.asyncDep.catch((err) => {
  6997. handleError(err, instance, 0);
  6998. }).then((asyncSetupResult) => {
  6999. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  7000. return;
  7001. }
  7002. instance.asyncResolved = true;
  7003. const { vnode: vnode2 } = instance;
  7004. {
  7005. pushWarningContext(vnode2);
  7006. }
  7007. handleSetupResult(instance, asyncSetupResult, false);
  7008. if (hydratedEl) {
  7009. vnode2.el = hydratedEl;
  7010. }
  7011. const placeholder = !hydratedEl && instance.subTree.el;
  7012. setupRenderEffect(
  7013. instance,
  7014. vnode2,
  7015. // component may have been moved before resolve.
  7016. // if this is not a hydration, instance.subTree will be the comment
  7017. // placeholder.
  7018. parentNode(hydratedEl || instance.subTree.el),
  7019. // anchor will not be used if this is hydration, so only need to
  7020. // consider the comment placeholder case.
  7021. hydratedEl ? null : next(instance.subTree),
  7022. suspense,
  7023. namespace,
  7024. optimized2
  7025. );
  7026. if (placeholder) {
  7027. remove(placeholder);
  7028. }
  7029. updateHOCHostEl(instance, vnode2.el);
  7030. {
  7031. popWarningContext();
  7032. }
  7033. if (isInPendingSuspense && --suspense.deps === 0) {
  7034. suspense.resolve();
  7035. }
  7036. });
  7037. },
  7038. unmount(parentSuspense2, doRemove) {
  7039. suspense.isUnmounted = true;
  7040. if (suspense.activeBranch) {
  7041. unmount(
  7042. suspense.activeBranch,
  7043. parentComponent,
  7044. parentSuspense2,
  7045. doRemove
  7046. );
  7047. }
  7048. if (suspense.pendingBranch) {
  7049. unmount(
  7050. suspense.pendingBranch,
  7051. parentComponent,
  7052. parentSuspense2,
  7053. doRemove
  7054. );
  7055. }
  7056. }
  7057. };
  7058. return suspense;
  7059. }
  7060. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  7061. const suspense = vnode.suspense = createSuspenseBoundary(
  7062. vnode,
  7063. parentSuspense,
  7064. parentComponent,
  7065. node.parentNode,
  7066. // eslint-disable-next-line no-restricted-globals
  7067. document.createElement("div"),
  7068. null,
  7069. namespace,
  7070. slotScopeIds,
  7071. optimized,
  7072. rendererInternals,
  7073. true
  7074. );
  7075. const result = hydrateNode(
  7076. node,
  7077. suspense.pendingBranch = vnode.ssContent,
  7078. parentComponent,
  7079. suspense,
  7080. slotScopeIds,
  7081. optimized
  7082. );
  7083. if (suspense.deps === 0) {
  7084. suspense.resolve(false, true);
  7085. }
  7086. return result;
  7087. }
  7088. function normalizeSuspenseChildren(vnode) {
  7089. const { shapeFlag, children } = vnode;
  7090. const isSlotChildren = shapeFlag & 32;
  7091. vnode.ssContent = normalizeSuspenseSlot(
  7092. isSlotChildren ? children.default : children
  7093. );
  7094. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  7095. }
  7096. function normalizeSuspenseSlot(s) {
  7097. let block;
  7098. if (shared.isFunction(s)) {
  7099. const trackBlock = isBlockTreeEnabled && s._c;
  7100. if (trackBlock) {
  7101. s._d = false;
  7102. openBlock();
  7103. }
  7104. s = s();
  7105. if (trackBlock) {
  7106. s._d = true;
  7107. block = currentBlock;
  7108. closeBlock();
  7109. }
  7110. }
  7111. if (shared.isArray(s)) {
  7112. const singleChild = filterSingleRoot(s);
  7113. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  7114. warn$1(`<Suspense> slots expect a single root node.`);
  7115. }
  7116. s = singleChild;
  7117. }
  7118. s = normalizeVNode(s);
  7119. if (block && !s.dynamicChildren) {
  7120. s.dynamicChildren = block.filter((c) => c !== s);
  7121. }
  7122. return s;
  7123. }
  7124. function queueEffectWithSuspense(fn, suspense) {
  7125. if (suspense && suspense.pendingBranch) {
  7126. if (shared.isArray(fn)) {
  7127. suspense.effects.push(...fn);
  7128. } else {
  7129. suspense.effects.push(fn);
  7130. }
  7131. } else {
  7132. queuePostFlushCb(fn);
  7133. }
  7134. }
  7135. function setActiveBranch(suspense, branch) {
  7136. suspense.activeBranch = branch;
  7137. const { vnode, parentComponent } = suspense;
  7138. let el = branch.el;
  7139. while (!el && branch.component) {
  7140. branch = branch.component.subTree;
  7141. el = branch.el;
  7142. }
  7143. vnode.el = el;
  7144. if (parentComponent && parentComponent.subTree === vnode) {
  7145. parentComponent.vnode.el = el;
  7146. updateHOCHostEl(parentComponent, el);
  7147. }
  7148. }
  7149. function isVNodeSuspensible(vnode) {
  7150. const suspensible = vnode.props && vnode.props.suspensible;
  7151. return suspensible != null && suspensible !== false;
  7152. }
  7153. const Fragment = Symbol.for("v-fgt");
  7154. const Text = Symbol.for("v-txt");
  7155. const Comment = Symbol.for("v-cmt");
  7156. const Static = Symbol.for("v-stc");
  7157. const blockStack = [];
  7158. let currentBlock = null;
  7159. function openBlock(disableTracking = false) {
  7160. blockStack.push(currentBlock = disableTracking ? null : []);
  7161. }
  7162. function closeBlock() {
  7163. blockStack.pop();
  7164. currentBlock = blockStack[blockStack.length - 1] || null;
  7165. }
  7166. let isBlockTreeEnabled = 1;
  7167. function setBlockTracking(value) {
  7168. isBlockTreeEnabled += value;
  7169. if (value < 0 && currentBlock) {
  7170. currentBlock.hasOnce = true;
  7171. }
  7172. }
  7173. function setupBlock(vnode) {
  7174. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
  7175. closeBlock();
  7176. if (isBlockTreeEnabled > 0 && currentBlock) {
  7177. currentBlock.push(vnode);
  7178. }
  7179. return vnode;
  7180. }
  7181. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  7182. return setupBlock(
  7183. createBaseVNode(
  7184. type,
  7185. props,
  7186. children,
  7187. patchFlag,
  7188. dynamicProps,
  7189. shapeFlag,
  7190. true
  7191. )
  7192. );
  7193. }
  7194. function createBlock(type, props, children, patchFlag, dynamicProps) {
  7195. return setupBlock(
  7196. createVNode(
  7197. type,
  7198. props,
  7199. children,
  7200. patchFlag,
  7201. dynamicProps,
  7202. true
  7203. )
  7204. );
  7205. }
  7206. function isVNode(value) {
  7207. return value ? value.__v_isVNode === true : false;
  7208. }
  7209. function isSameVNodeType(n1, n2) {
  7210. if (n2.shapeFlag & 6 && n1.component) {
  7211. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  7212. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  7213. n1.shapeFlag &= ~256;
  7214. n2.shapeFlag &= ~512;
  7215. return false;
  7216. }
  7217. }
  7218. return n1.type === n2.type && n1.key === n2.key;
  7219. }
  7220. let vnodeArgsTransformer;
  7221. function transformVNodeArgs(transformer) {
  7222. vnodeArgsTransformer = transformer;
  7223. }
  7224. const createVNodeWithArgsTransform = (...args) => {
  7225. return _createVNode(
  7226. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  7227. );
  7228. };
  7229. const normalizeKey = ({ key }) => key != null ? key : null;
  7230. const normalizeRef = ({
  7231. ref,
  7232. ref_key,
  7233. ref_for
  7234. }) => {
  7235. if (typeof ref === "number") {
  7236. ref = "" + ref;
  7237. }
  7238. return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  7239. };
  7240. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  7241. const vnode = {
  7242. __v_isVNode: true,
  7243. __v_skip: true,
  7244. type,
  7245. props,
  7246. key: props && normalizeKey(props),
  7247. ref: props && normalizeRef(props),
  7248. scopeId: currentScopeId,
  7249. slotScopeIds: null,
  7250. children,
  7251. component: null,
  7252. suspense: null,
  7253. ssContent: null,
  7254. ssFallback: null,
  7255. dirs: null,
  7256. transition: null,
  7257. el: null,
  7258. anchor: null,
  7259. target: null,
  7260. targetStart: null,
  7261. targetAnchor: null,
  7262. staticCount: 0,
  7263. shapeFlag,
  7264. patchFlag,
  7265. dynamicProps,
  7266. dynamicChildren: null,
  7267. appContext: null,
  7268. ctx: currentRenderingInstance
  7269. };
  7270. if (needFullChildrenNormalization) {
  7271. normalizeChildren(vnode, children);
  7272. if (shapeFlag & 128) {
  7273. type.normalize(vnode);
  7274. }
  7275. } else if (children) {
  7276. vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
  7277. }
  7278. if (vnode.key !== vnode.key) {
  7279. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  7280. }
  7281. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  7282. !isBlockNode && // has current parent block
  7283. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  7284. // component nodes also should always be patched, because even if the
  7285. // component doesn't need to update, it needs to persist the instance on to
  7286. // the next vnode so that it can be properly unmounted later.
  7287. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  7288. // vnode should not be considered dynamic due to handler caching.
  7289. vnode.patchFlag !== 32) {
  7290. currentBlock.push(vnode);
  7291. }
  7292. return vnode;
  7293. }
  7294. const createVNode = createVNodeWithArgsTransform ;
  7295. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  7296. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  7297. if (!type) {
  7298. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  7299. }
  7300. type = Comment;
  7301. }
  7302. if (isVNode(type)) {
  7303. const cloned = cloneVNode(
  7304. type,
  7305. props,
  7306. true
  7307. /* mergeRef: true */
  7308. );
  7309. if (children) {
  7310. normalizeChildren(cloned, children);
  7311. }
  7312. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  7313. if (cloned.shapeFlag & 6) {
  7314. currentBlock[currentBlock.indexOf(type)] = cloned;
  7315. } else {
  7316. currentBlock.push(cloned);
  7317. }
  7318. }
  7319. cloned.patchFlag = -2;
  7320. return cloned;
  7321. }
  7322. if (isClassComponent(type)) {
  7323. type = type.__vccOpts;
  7324. }
  7325. if (props) {
  7326. props = guardReactiveProps(props);
  7327. let { class: klass, style } = props;
  7328. if (klass && !shared.isString(klass)) {
  7329. props.class = shared.normalizeClass(klass);
  7330. }
  7331. if (shared.isObject(style)) {
  7332. if (reactivity.isProxy(style) && !shared.isArray(style)) {
  7333. style = shared.extend({}, style);
  7334. }
  7335. props.style = shared.normalizeStyle(style);
  7336. }
  7337. }
  7338. const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
  7339. if (shapeFlag & 4 && reactivity.isProxy(type)) {
  7340. type = reactivity.toRaw(type);
  7341. warn$1(
  7342. `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\`.`,
  7343. `
  7344. Component that was made reactive: `,
  7345. type
  7346. );
  7347. }
  7348. return createBaseVNode(
  7349. type,
  7350. props,
  7351. children,
  7352. patchFlag,
  7353. dynamicProps,
  7354. shapeFlag,
  7355. isBlockNode,
  7356. true
  7357. );
  7358. }
  7359. function guardReactiveProps(props) {
  7360. if (!props) return null;
  7361. return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
  7362. }
  7363. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  7364. const { props, ref, patchFlag, children, transition } = vnode;
  7365. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  7366. const cloned = {
  7367. __v_isVNode: true,
  7368. __v_skip: true,
  7369. type: vnode.type,
  7370. props: mergedProps,
  7371. key: mergedProps && normalizeKey(mergedProps),
  7372. ref: extraProps && extraProps.ref ? (
  7373. // #2078 in the case of <component :is="vnode" ref="extra"/>
  7374. // if the vnode itself already has a ref, cloneVNode will need to merge
  7375. // the refs so the single vnode can be set on multiple refs
  7376. mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  7377. ) : ref,
  7378. scopeId: vnode.scopeId,
  7379. slotScopeIds: vnode.slotScopeIds,
  7380. children: patchFlag === -1 && shared.isArray(children) ? children.map(deepCloneVNode) : children,
  7381. target: vnode.target,
  7382. targetStart: vnode.targetStart,
  7383. targetAnchor: vnode.targetAnchor,
  7384. staticCount: vnode.staticCount,
  7385. shapeFlag: vnode.shapeFlag,
  7386. // if the vnode is cloned with extra props, we can no longer assume its
  7387. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  7388. // note: preserve flag for fragments since they use the flag for children
  7389. // fast paths only.
  7390. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  7391. dynamicProps: vnode.dynamicProps,
  7392. dynamicChildren: vnode.dynamicChildren,
  7393. appContext: vnode.appContext,
  7394. dirs: vnode.dirs,
  7395. transition,
  7396. // These should technically only be non-null on mounted VNodes. However,
  7397. // they *should* be copied for kept-alive vnodes. So we just always copy
  7398. // them since them being non-null during a mount doesn't affect the logic as
  7399. // they will simply be overwritten.
  7400. component: vnode.component,
  7401. suspense: vnode.suspense,
  7402. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  7403. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  7404. el: vnode.el,
  7405. anchor: vnode.anchor,
  7406. ctx: vnode.ctx,
  7407. ce: vnode.ce
  7408. };
  7409. if (transition && cloneTransition) {
  7410. setTransitionHooks(
  7411. cloned,
  7412. transition.clone(cloned)
  7413. );
  7414. }
  7415. return cloned;
  7416. }
  7417. function deepCloneVNode(vnode) {
  7418. const cloned = cloneVNode(vnode);
  7419. if (shared.isArray(vnode.children)) {
  7420. cloned.children = vnode.children.map(deepCloneVNode);
  7421. }
  7422. return cloned;
  7423. }
  7424. function createTextVNode(text = " ", flag = 0) {
  7425. return createVNode(Text, null, text, flag);
  7426. }
  7427. function createStaticVNode(content, numberOfNodes) {
  7428. const vnode = createVNode(Static, null, content);
  7429. vnode.staticCount = numberOfNodes;
  7430. return vnode;
  7431. }
  7432. function createCommentVNode(text = "", asBlock = false) {
  7433. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  7434. }
  7435. function normalizeVNode(child) {
  7436. if (child == null || typeof child === "boolean") {
  7437. return createVNode(Comment);
  7438. } else if (shared.isArray(child)) {
  7439. return createVNode(
  7440. Fragment,
  7441. null,
  7442. // #3666, avoid reference pollution when reusing vnode
  7443. child.slice()
  7444. );
  7445. } else if (typeof child === "object") {
  7446. return cloneIfMounted(child);
  7447. } else {
  7448. return createVNode(Text, null, String(child));
  7449. }
  7450. }
  7451. function cloneIfMounted(child) {
  7452. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  7453. }
  7454. function normalizeChildren(vnode, children) {
  7455. let type = 0;
  7456. const { shapeFlag } = vnode;
  7457. if (children == null) {
  7458. children = null;
  7459. } else if (shared.isArray(children)) {
  7460. type = 16;
  7461. } else if (typeof children === "object") {
  7462. if (shapeFlag & (1 | 64)) {
  7463. const slot = children.default;
  7464. if (slot) {
  7465. slot._c && (slot._d = false);
  7466. normalizeChildren(vnode, slot());
  7467. slot._c && (slot._d = true);
  7468. }
  7469. return;
  7470. } else {
  7471. type = 32;
  7472. const slotFlag = children._;
  7473. if (!slotFlag && !isInternalObject(children)) {
  7474. children._ctx = currentRenderingInstance;
  7475. } else if (slotFlag === 3 && currentRenderingInstance) {
  7476. if (currentRenderingInstance.slots._ === 1) {
  7477. children._ = 1;
  7478. } else {
  7479. children._ = 2;
  7480. vnode.patchFlag |= 1024;
  7481. }
  7482. }
  7483. }
  7484. } else if (shared.isFunction(children)) {
  7485. children = { default: children, _ctx: currentRenderingInstance };
  7486. type = 32;
  7487. } else {
  7488. children = String(children);
  7489. if (shapeFlag & 64) {
  7490. type = 16;
  7491. children = [createTextVNode(children)];
  7492. } else {
  7493. type = 8;
  7494. }
  7495. }
  7496. vnode.children = children;
  7497. vnode.shapeFlag |= type;
  7498. }
  7499. function mergeProps(...args) {
  7500. const ret = {};
  7501. for (let i = 0; i < args.length; i++) {
  7502. const toMerge = args[i];
  7503. for (const key in toMerge) {
  7504. if (key === "class") {
  7505. if (ret.class !== toMerge.class) {
  7506. ret.class = shared.normalizeClass([ret.class, toMerge.class]);
  7507. }
  7508. } else if (key === "style") {
  7509. ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
  7510. } else if (shared.isOn(key)) {
  7511. const existing = ret[key];
  7512. const incoming = toMerge[key];
  7513. if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
  7514. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  7515. }
  7516. } else if (key !== "") {
  7517. ret[key] = toMerge[key];
  7518. }
  7519. }
  7520. }
  7521. return ret;
  7522. }
  7523. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  7524. callWithAsyncErrorHandling(hook, instance, 7, [
  7525. vnode,
  7526. prevVNode
  7527. ]);
  7528. }
  7529. const emptyAppContext = createAppContext();
  7530. let uid = 0;
  7531. function createComponentInstance(vnode, parent, suspense) {
  7532. const type = vnode.type;
  7533. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  7534. const instance = {
  7535. uid: uid++,
  7536. vnode,
  7537. type,
  7538. parent,
  7539. appContext,
  7540. root: null,
  7541. // to be immediately set
  7542. next: null,
  7543. subTree: null,
  7544. // will be set synchronously right after creation
  7545. effect: null,
  7546. update: null,
  7547. // will be set synchronously right after creation
  7548. job: null,
  7549. scope: new reactivity.EffectScope(
  7550. true
  7551. /* detached */
  7552. ),
  7553. render: null,
  7554. proxy: null,
  7555. exposed: null,
  7556. exposeProxy: null,
  7557. withProxy: null,
  7558. provides: parent ? parent.provides : Object.create(appContext.provides),
  7559. ids: parent ? parent.ids : ["", 0, 0],
  7560. accessCache: null,
  7561. renderCache: [],
  7562. // local resolved assets
  7563. components: null,
  7564. directives: null,
  7565. // resolved props and emits options
  7566. propsOptions: normalizePropsOptions(type, appContext),
  7567. emitsOptions: normalizeEmitsOptions(type, appContext),
  7568. // emit
  7569. emit: null,
  7570. // to be set immediately
  7571. emitted: null,
  7572. // props default value
  7573. propsDefaults: shared.EMPTY_OBJ,
  7574. // inheritAttrs
  7575. inheritAttrs: type.inheritAttrs,
  7576. // state
  7577. ctx: shared.EMPTY_OBJ,
  7578. data: shared.EMPTY_OBJ,
  7579. props: shared.EMPTY_OBJ,
  7580. attrs: shared.EMPTY_OBJ,
  7581. slots: shared.EMPTY_OBJ,
  7582. refs: shared.EMPTY_OBJ,
  7583. setupState: shared.EMPTY_OBJ,
  7584. setupContext: null,
  7585. // suspense related
  7586. suspense,
  7587. suspenseId: suspense ? suspense.pendingId : 0,
  7588. asyncDep: null,
  7589. asyncResolved: false,
  7590. // lifecycle hooks
  7591. // not using enums here because it results in computed properties
  7592. isMounted: false,
  7593. isUnmounted: false,
  7594. isDeactivated: false,
  7595. bc: null,
  7596. c: null,
  7597. bm: null,
  7598. m: null,
  7599. bu: null,
  7600. u: null,
  7601. um: null,
  7602. bum: null,
  7603. da: null,
  7604. a: null,
  7605. rtg: null,
  7606. rtc: null,
  7607. ec: null,
  7608. sp: null
  7609. };
  7610. {
  7611. instance.ctx = createDevRenderContext(instance);
  7612. }
  7613. instance.root = parent ? parent.root : instance;
  7614. instance.emit = emit.bind(null, instance);
  7615. if (vnode.ce) {
  7616. vnode.ce(instance);
  7617. }
  7618. return instance;
  7619. }
  7620. let currentInstance = null;
  7621. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  7622. let internalSetCurrentInstance;
  7623. let setInSSRSetupState;
  7624. {
  7625. const g = shared.getGlobalThis();
  7626. const registerGlobalSetter = (key, setter) => {
  7627. let setters;
  7628. if (!(setters = g[key])) setters = g[key] = [];
  7629. setters.push(setter);
  7630. return (v) => {
  7631. if (setters.length > 1) setters.forEach((set) => set(v));
  7632. else setters[0](v);
  7633. };
  7634. };
  7635. internalSetCurrentInstance = registerGlobalSetter(
  7636. `__VUE_INSTANCE_SETTERS__`,
  7637. (v) => currentInstance = v
  7638. );
  7639. setInSSRSetupState = registerGlobalSetter(
  7640. `__VUE_SSR_SETTERS__`,
  7641. (v) => isInSSRComponentSetup = v
  7642. );
  7643. }
  7644. const setCurrentInstance = (instance) => {
  7645. const prev = currentInstance;
  7646. internalSetCurrentInstance(instance);
  7647. instance.scope.on();
  7648. return () => {
  7649. instance.scope.off();
  7650. internalSetCurrentInstance(prev);
  7651. };
  7652. };
  7653. const unsetCurrentInstance = () => {
  7654. currentInstance && currentInstance.scope.off();
  7655. internalSetCurrentInstance(null);
  7656. };
  7657. const isBuiltInTag = /* @__PURE__ */ shared.makeMap("slot,component");
  7658. function validateComponentName(name, { isNativeTag }) {
  7659. if (isBuiltInTag(name) || isNativeTag(name)) {
  7660. warn$1(
  7661. "Do not use built-in or reserved HTML elements as component id: " + name
  7662. );
  7663. }
  7664. }
  7665. function isStatefulComponent(instance) {
  7666. return instance.vnode.shapeFlag & 4;
  7667. }
  7668. let isInSSRComponentSetup = false;
  7669. function setupComponent(instance, isSSR = false, optimized = false) {
  7670. isSSR && setInSSRSetupState(isSSR);
  7671. const { props, children } = instance.vnode;
  7672. const isStateful = isStatefulComponent(instance);
  7673. initProps(instance, props, isStateful, isSSR);
  7674. initSlots(instance, children, optimized);
  7675. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  7676. isSSR && setInSSRSetupState(false);
  7677. return setupResult;
  7678. }
  7679. function setupStatefulComponent(instance, isSSR) {
  7680. var _a;
  7681. const Component = instance.type;
  7682. {
  7683. if (Component.name) {
  7684. validateComponentName(Component.name, instance.appContext.config);
  7685. }
  7686. if (Component.components) {
  7687. const names = Object.keys(Component.components);
  7688. for (let i = 0; i < names.length; i++) {
  7689. validateComponentName(names[i], instance.appContext.config);
  7690. }
  7691. }
  7692. if (Component.directives) {
  7693. const names = Object.keys(Component.directives);
  7694. for (let i = 0; i < names.length; i++) {
  7695. validateDirectiveName(names[i]);
  7696. }
  7697. }
  7698. if (Component.compilerOptions && isRuntimeOnly()) {
  7699. warn$1(
  7700. `"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.`
  7701. );
  7702. }
  7703. }
  7704. instance.accessCache = /* @__PURE__ */ Object.create(null);
  7705. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  7706. {
  7707. exposePropsOnRenderContext(instance);
  7708. }
  7709. const { setup } = Component;
  7710. if (setup) {
  7711. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  7712. const reset = setCurrentInstance(instance);
  7713. reactivity.pauseTracking();
  7714. const setupResult = callWithErrorHandling(
  7715. setup,
  7716. instance,
  7717. 0,
  7718. [
  7719. reactivity.shallowReadonly(instance.props) ,
  7720. setupContext
  7721. ]
  7722. );
  7723. reactivity.resetTracking();
  7724. reset();
  7725. if (shared.isPromise(setupResult)) {
  7726. if (!isAsyncWrapper(instance)) markAsyncBoundary(instance);
  7727. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  7728. if (isSSR) {
  7729. return setupResult.then((resolvedResult) => {
  7730. handleSetupResult(instance, resolvedResult, isSSR);
  7731. }).catch((e) => {
  7732. handleError(e, instance, 0);
  7733. });
  7734. } else {
  7735. instance.asyncDep = setupResult;
  7736. if (!instance.suspense) {
  7737. const name = (_a = Component.name) != null ? _a : "Anonymous";
  7738. warn$1(
  7739. `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.`
  7740. );
  7741. }
  7742. }
  7743. } else {
  7744. handleSetupResult(instance, setupResult, isSSR);
  7745. }
  7746. } else {
  7747. finishComponentSetup(instance, isSSR);
  7748. }
  7749. }
  7750. function handleSetupResult(instance, setupResult, isSSR) {
  7751. if (shared.isFunction(setupResult)) {
  7752. if (instance.type.__ssrInlineRender) {
  7753. instance.ssrRender = setupResult;
  7754. } else {
  7755. instance.render = setupResult;
  7756. }
  7757. } else if (shared.isObject(setupResult)) {
  7758. if (isVNode(setupResult)) {
  7759. warn$1(
  7760. `setup() should not return VNodes directly - return a render function instead.`
  7761. );
  7762. }
  7763. {
  7764. instance.devtoolsRawSetupState = setupResult;
  7765. }
  7766. instance.setupState = reactivity.proxyRefs(setupResult);
  7767. {
  7768. exposeSetupStateOnRenderContext(instance);
  7769. }
  7770. } else if (setupResult !== void 0) {
  7771. warn$1(
  7772. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  7773. );
  7774. }
  7775. finishComponentSetup(instance, isSSR);
  7776. }
  7777. let compile;
  7778. let installWithProxy;
  7779. function registerRuntimeCompiler(_compile) {
  7780. compile = _compile;
  7781. installWithProxy = (i) => {
  7782. if (i.render._rc) {
  7783. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  7784. }
  7785. };
  7786. }
  7787. const isRuntimeOnly = () => !compile;
  7788. function finishComponentSetup(instance, isSSR, skipOptions) {
  7789. const Component = instance.type;
  7790. if (!instance.render) {
  7791. if (!isSSR && compile && !Component.render) {
  7792. const template = Component.template || resolveMergedOptions(instance).template;
  7793. if (template) {
  7794. {
  7795. startMeasure(instance, `compile`);
  7796. }
  7797. const { isCustomElement, compilerOptions } = instance.appContext.config;
  7798. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  7799. const finalCompilerOptions = shared.extend(
  7800. shared.extend(
  7801. {
  7802. isCustomElement,
  7803. delimiters
  7804. },
  7805. compilerOptions
  7806. ),
  7807. componentCompilerOptions
  7808. );
  7809. Component.render = compile(template, finalCompilerOptions);
  7810. {
  7811. endMeasure(instance, `compile`);
  7812. }
  7813. }
  7814. }
  7815. instance.render = Component.render || shared.NOOP;
  7816. if (installWithProxy) {
  7817. installWithProxy(instance);
  7818. }
  7819. }
  7820. {
  7821. const reset = setCurrentInstance(instance);
  7822. reactivity.pauseTracking();
  7823. try {
  7824. applyOptions(instance);
  7825. } finally {
  7826. reactivity.resetTracking();
  7827. reset();
  7828. }
  7829. }
  7830. if (!Component.render && instance.render === shared.NOOP && !isSSR) {
  7831. if (!compile && Component.template) {
  7832. warn$1(
  7833. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (``)
  7834. );
  7835. } else {
  7836. warn$1(`Component is missing template or render function: `, Component);
  7837. }
  7838. }
  7839. }
  7840. const attrsProxyHandlers = {
  7841. get(target, key) {
  7842. markAttrsAccessed();
  7843. reactivity.track(target, "get", "");
  7844. return target[key];
  7845. },
  7846. set() {
  7847. warn$1(`setupContext.attrs is readonly.`);
  7848. return false;
  7849. },
  7850. deleteProperty() {
  7851. warn$1(`setupContext.attrs is readonly.`);
  7852. return false;
  7853. }
  7854. } ;
  7855. function getSlotsProxy(instance) {
  7856. return new Proxy(instance.slots, {
  7857. get(target, key) {
  7858. reactivity.track(instance, "get", "$slots");
  7859. return target[key];
  7860. }
  7861. });
  7862. }
  7863. function createSetupContext(instance) {
  7864. const expose = (exposed) => {
  7865. {
  7866. if (instance.exposed) {
  7867. warn$1(`expose() should be called only once per setup().`);
  7868. }
  7869. if (exposed != null) {
  7870. let exposedType = typeof exposed;
  7871. if (exposedType === "object") {
  7872. if (shared.isArray(exposed)) {
  7873. exposedType = "array";
  7874. } else if (reactivity.isRef(exposed)) {
  7875. exposedType = "ref";
  7876. }
  7877. }
  7878. if (exposedType !== "object") {
  7879. warn$1(
  7880. `expose() should be passed a plain object, received ${exposedType}.`
  7881. );
  7882. }
  7883. }
  7884. }
  7885. instance.exposed = exposed || {};
  7886. };
  7887. {
  7888. let attrsProxy;
  7889. let slotsProxy;
  7890. return Object.freeze({
  7891. get attrs() {
  7892. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  7893. },
  7894. get slots() {
  7895. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  7896. },
  7897. get emit() {
  7898. return (event, ...args) => instance.emit(event, ...args);
  7899. },
  7900. expose
  7901. });
  7902. }
  7903. }
  7904. function getComponentPublicInstance(instance) {
  7905. if (instance.exposed) {
  7906. return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
  7907. get(target, key) {
  7908. if (key in target) {
  7909. return target[key];
  7910. } else if (key in publicPropertiesMap) {
  7911. return publicPropertiesMap[key](instance);
  7912. }
  7913. },
  7914. has(target, key) {
  7915. return key in target || key in publicPropertiesMap;
  7916. }
  7917. }));
  7918. } else {
  7919. return instance.proxy;
  7920. }
  7921. }
  7922. const classifyRE = /(?:^|[-_])(\w)/g;
  7923. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  7924. function getComponentName(Component, includeInferred = true) {
  7925. return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  7926. }
  7927. function formatComponentName(instance, Component, isRoot = false) {
  7928. let name = getComponentName(Component);
  7929. if (!name && Component.__file) {
  7930. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  7931. if (match) {
  7932. name = match[1];
  7933. }
  7934. }
  7935. if (!name && instance && instance.parent) {
  7936. const inferFromRegistry = (registry) => {
  7937. for (const key in registry) {
  7938. if (registry[key] === Component) {
  7939. return key;
  7940. }
  7941. }
  7942. };
  7943. name = inferFromRegistry(
  7944. instance.components || instance.parent.type.components
  7945. ) || inferFromRegistry(instance.appContext.components);
  7946. }
  7947. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  7948. }
  7949. function isClassComponent(value) {
  7950. return shared.isFunction(value) && "__vccOpts" in value;
  7951. }
  7952. const computed = (getterOrOptions, debugOptions) => {
  7953. const c = reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
  7954. {
  7955. const i = getCurrentInstance();
  7956. if (i && i.appContext.config.warnRecursiveComputed) {
  7957. c._warnRecursive = true;
  7958. }
  7959. }
  7960. return c;
  7961. };
  7962. function h(type, propsOrChildren, children) {
  7963. const l = arguments.length;
  7964. if (l === 2) {
  7965. if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
  7966. if (isVNode(propsOrChildren)) {
  7967. return createVNode(type, null, [propsOrChildren]);
  7968. }
  7969. return createVNode(type, propsOrChildren);
  7970. } else {
  7971. return createVNode(type, null, propsOrChildren);
  7972. }
  7973. } else {
  7974. if (l > 3) {
  7975. children = Array.prototype.slice.call(arguments, 2);
  7976. } else if (l === 3 && isVNode(children)) {
  7977. children = [children];
  7978. }
  7979. return createVNode(type, propsOrChildren, children);
  7980. }
  7981. }
  7982. function initCustomFormatter() {
  7983. if (typeof window === "undefined") {
  7984. return;
  7985. }
  7986. const vueStyle = { style: "color:#3ba776" };
  7987. const numberStyle = { style: "color:#1677ff" };
  7988. const stringStyle = { style: "color:#f5222d" };
  7989. const keywordStyle = { style: "color:#eb2f96" };
  7990. const formatter = {
  7991. __vue_custom_formatter: true,
  7992. header(obj) {
  7993. if (!shared.isObject(obj)) {
  7994. return null;
  7995. }
  7996. if (obj.__isVue) {
  7997. return ["div", vueStyle, `VueInstance`];
  7998. } else if (reactivity.isRef(obj)) {
  7999. return [
  8000. "div",
  8001. {},
  8002. ["span", vueStyle, genRefFlag(obj)],
  8003. "<",
  8004. // avoid debugger accessing value affecting behavior
  8005. formatValue("_value" in obj ? obj._value : obj),
  8006. `>`
  8007. ];
  8008. } else if (reactivity.isReactive(obj)) {
  8009. return [
  8010. "div",
  8011. {},
  8012. ["span", vueStyle, reactivity.isShallow(obj) ? "ShallowReactive" : "Reactive"],
  8013. "<",
  8014. formatValue(obj),
  8015. `>${reactivity.isReadonly(obj) ? ` (readonly)` : ``}`
  8016. ];
  8017. } else if (reactivity.isReadonly(obj)) {
  8018. return [
  8019. "div",
  8020. {},
  8021. ["span", vueStyle, reactivity.isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  8022. "<",
  8023. formatValue(obj),
  8024. ">"
  8025. ];
  8026. }
  8027. return null;
  8028. },
  8029. hasBody(obj) {
  8030. return obj && obj.__isVue;
  8031. },
  8032. body(obj) {
  8033. if (obj && obj.__isVue) {
  8034. return [
  8035. "div",
  8036. {},
  8037. ...formatInstance(obj.$)
  8038. ];
  8039. }
  8040. }
  8041. };
  8042. function formatInstance(instance) {
  8043. const blocks = [];
  8044. if (instance.type.props && instance.props) {
  8045. blocks.push(createInstanceBlock("props", reactivity.toRaw(instance.props)));
  8046. }
  8047. if (instance.setupState !== shared.EMPTY_OBJ) {
  8048. blocks.push(createInstanceBlock("setup", instance.setupState));
  8049. }
  8050. if (instance.data !== shared.EMPTY_OBJ) {
  8051. blocks.push(createInstanceBlock("data", reactivity.toRaw(instance.data)));
  8052. }
  8053. const computed = extractKeys(instance, "computed");
  8054. if (computed) {
  8055. blocks.push(createInstanceBlock("computed", computed));
  8056. }
  8057. const injected = extractKeys(instance, "inject");
  8058. if (injected) {
  8059. blocks.push(createInstanceBlock("injected", injected));
  8060. }
  8061. blocks.push([
  8062. "div",
  8063. {},
  8064. [
  8065. "span",
  8066. {
  8067. style: keywordStyle.style + ";opacity:0.66"
  8068. },
  8069. "$ (internal): "
  8070. ],
  8071. ["object", { object: instance }]
  8072. ]);
  8073. return blocks;
  8074. }
  8075. function createInstanceBlock(type, target) {
  8076. target = shared.extend({}, target);
  8077. if (!Object.keys(target).length) {
  8078. return ["span", {}];
  8079. }
  8080. return [
  8081. "div",
  8082. { style: "line-height:1.25em;margin-bottom:0.6em" },
  8083. [
  8084. "div",
  8085. {
  8086. style: "color:#476582"
  8087. },
  8088. type
  8089. ],
  8090. [
  8091. "div",
  8092. {
  8093. style: "padding-left:1.25em"
  8094. },
  8095. ...Object.keys(target).map((key) => {
  8096. return [
  8097. "div",
  8098. {},
  8099. ["span", keywordStyle, key + ": "],
  8100. formatValue(target[key], false)
  8101. ];
  8102. })
  8103. ]
  8104. ];
  8105. }
  8106. function formatValue(v, asRaw = true) {
  8107. if (typeof v === "number") {
  8108. return ["span", numberStyle, v];
  8109. } else if (typeof v === "string") {
  8110. return ["span", stringStyle, JSON.stringify(v)];
  8111. } else if (typeof v === "boolean") {
  8112. return ["span", keywordStyle, v];
  8113. } else if (shared.isObject(v)) {
  8114. return ["object", { object: asRaw ? reactivity.toRaw(v) : v }];
  8115. } else {
  8116. return ["span", stringStyle, String(v)];
  8117. }
  8118. }
  8119. function extractKeys(instance, type) {
  8120. const Comp = instance.type;
  8121. if (shared.isFunction(Comp)) {
  8122. return;
  8123. }
  8124. const extracted = {};
  8125. for (const key in instance.ctx) {
  8126. if (isKeyOfType(Comp, key, type)) {
  8127. extracted[key] = instance.ctx[key];
  8128. }
  8129. }
  8130. return extracted;
  8131. }
  8132. function isKeyOfType(Comp, key, type) {
  8133. const opts = Comp[type];
  8134. if (shared.isArray(opts) && opts.includes(key) || shared.isObject(opts) && key in opts) {
  8135. return true;
  8136. }
  8137. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  8138. return true;
  8139. }
  8140. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  8141. return true;
  8142. }
  8143. }
  8144. function genRefFlag(v) {
  8145. if (reactivity.isShallow(v)) {
  8146. return `ShallowRef`;
  8147. }
  8148. if (v.effect) {
  8149. return `ComputedRef`;
  8150. }
  8151. return `Ref`;
  8152. }
  8153. if (window.devtoolsFormatters) {
  8154. window.devtoolsFormatters.push(formatter);
  8155. } else {
  8156. window.devtoolsFormatters = [formatter];
  8157. }
  8158. }
  8159. function withMemo(memo, render, cache, index) {
  8160. const cached = cache[index];
  8161. if (cached && isMemoSame(cached, memo)) {
  8162. return cached;
  8163. }
  8164. const ret = render();
  8165. ret.memo = memo.slice();
  8166. ret.cacheIndex = index;
  8167. return cache[index] = ret;
  8168. }
  8169. function isMemoSame(cached, memo) {
  8170. const prev = cached.memo;
  8171. if (prev.length != memo.length) {
  8172. return false;
  8173. }
  8174. for (let i = 0; i < prev.length; i++) {
  8175. if (shared.hasChanged(prev[i], memo[i])) {
  8176. return false;
  8177. }
  8178. }
  8179. if (isBlockTreeEnabled > 0 && currentBlock) {
  8180. currentBlock.push(cached);
  8181. }
  8182. return true;
  8183. }
  8184. const version = "3.5.4";
  8185. const warn = warn$1 ;
  8186. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  8187. const devtools = devtools$1 ;
  8188. const setDevtoolsHook = setDevtoolsHook$1 ;
  8189. const _ssrUtils = {
  8190. createComponentInstance,
  8191. setupComponent,
  8192. renderComponentRoot,
  8193. setCurrentRenderingInstance,
  8194. isVNode: isVNode,
  8195. normalizeVNode,
  8196. getComponentPublicInstance,
  8197. ensureValidVNode,
  8198. pushWarningContext,
  8199. popWarningContext
  8200. };
  8201. const ssrUtils = _ssrUtils ;
  8202. const resolveFilter = null;
  8203. const compatUtils = null;
  8204. const DeprecationTypes = null;
  8205. exports.EffectScope = reactivity.EffectScope;
  8206. exports.ReactiveEffect = reactivity.ReactiveEffect;
  8207. exports.TrackOpTypes = reactivity.TrackOpTypes;
  8208. exports.TriggerOpTypes = reactivity.TriggerOpTypes;
  8209. exports.customRef = reactivity.customRef;
  8210. exports.effect = reactivity.effect;
  8211. exports.effectScope = reactivity.effectScope;
  8212. exports.getCurrentScope = reactivity.getCurrentScope;
  8213. exports.getCurrentWatcher = reactivity.getCurrentWatcher;
  8214. exports.isProxy = reactivity.isProxy;
  8215. exports.isReactive = reactivity.isReactive;
  8216. exports.isReadonly = reactivity.isReadonly;
  8217. exports.isRef = reactivity.isRef;
  8218. exports.isShallow = reactivity.isShallow;
  8219. exports.markRaw = reactivity.markRaw;
  8220. exports.onScopeDispose = reactivity.onScopeDispose;
  8221. exports.onWatcherCleanup = reactivity.onWatcherCleanup;
  8222. exports.proxyRefs = reactivity.proxyRefs;
  8223. exports.reactive = reactivity.reactive;
  8224. exports.readonly = reactivity.readonly;
  8225. exports.ref = reactivity.ref;
  8226. exports.shallowReactive = reactivity.shallowReactive;
  8227. exports.shallowReadonly = reactivity.shallowReadonly;
  8228. exports.shallowRef = reactivity.shallowRef;
  8229. exports.stop = reactivity.stop;
  8230. exports.toRaw = reactivity.toRaw;
  8231. exports.toRef = reactivity.toRef;
  8232. exports.toRefs = reactivity.toRefs;
  8233. exports.toValue = reactivity.toValue;
  8234. exports.triggerRef = reactivity.triggerRef;
  8235. exports.unref = reactivity.unref;
  8236. exports.camelize = shared.camelize;
  8237. exports.capitalize = shared.capitalize;
  8238. exports.normalizeClass = shared.normalizeClass;
  8239. exports.normalizeProps = shared.normalizeProps;
  8240. exports.normalizeStyle = shared.normalizeStyle;
  8241. exports.toDisplayString = shared.toDisplayString;
  8242. exports.toHandlerKey = shared.toHandlerKey;
  8243. exports.BaseTransition = BaseTransition;
  8244. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  8245. exports.Comment = Comment;
  8246. exports.DeprecationTypes = DeprecationTypes;
  8247. exports.ErrorCodes = ErrorCodes;
  8248. exports.ErrorTypeStrings = ErrorTypeStrings;
  8249. exports.Fragment = Fragment;
  8250. exports.KeepAlive = KeepAlive;
  8251. exports.Static = Static;
  8252. exports.Suspense = Suspense;
  8253. exports.Teleport = Teleport;
  8254. exports.Text = Text;
  8255. exports.assertNumber = assertNumber;
  8256. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  8257. exports.callWithErrorHandling = callWithErrorHandling;
  8258. exports.cloneVNode = cloneVNode;
  8259. exports.compatUtils = compatUtils;
  8260. exports.computed = computed;
  8261. exports.createBlock = createBlock;
  8262. exports.createCommentVNode = createCommentVNode;
  8263. exports.createElementBlock = createElementBlock;
  8264. exports.createElementVNode = createBaseVNode;
  8265. exports.createHydrationRenderer = createHydrationRenderer;
  8266. exports.createPropsRestProxy = createPropsRestProxy;
  8267. exports.createRenderer = createRenderer;
  8268. exports.createSlots = createSlots;
  8269. exports.createStaticVNode = createStaticVNode;
  8270. exports.createTextVNode = createTextVNode;
  8271. exports.createVNode = createVNode;
  8272. exports.defineAsyncComponent = defineAsyncComponent;
  8273. exports.defineComponent = defineComponent;
  8274. exports.defineEmits = defineEmits;
  8275. exports.defineExpose = defineExpose;
  8276. exports.defineModel = defineModel;
  8277. exports.defineOptions = defineOptions;
  8278. exports.defineProps = defineProps;
  8279. exports.defineSlots = defineSlots;
  8280. exports.devtools = devtools;
  8281. exports.getCurrentInstance = getCurrentInstance;
  8282. exports.getTransitionRawChildren = getTransitionRawChildren;
  8283. exports.guardReactiveProps = guardReactiveProps;
  8284. exports.h = h;
  8285. exports.handleError = handleError;
  8286. exports.hasInjectionContext = hasInjectionContext;
  8287. exports.hydrateOnIdle = hydrateOnIdle;
  8288. exports.hydrateOnInteraction = hydrateOnInteraction;
  8289. exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
  8290. exports.hydrateOnVisible = hydrateOnVisible;
  8291. exports.initCustomFormatter = initCustomFormatter;
  8292. exports.inject = inject;
  8293. exports.isMemoSame = isMemoSame;
  8294. exports.isRuntimeOnly = isRuntimeOnly;
  8295. exports.isVNode = isVNode;
  8296. exports.mergeDefaults = mergeDefaults;
  8297. exports.mergeModels = mergeModels;
  8298. exports.mergeProps = mergeProps;
  8299. exports.nextTick = nextTick;
  8300. exports.onActivated = onActivated;
  8301. exports.onBeforeMount = onBeforeMount;
  8302. exports.onBeforeUnmount = onBeforeUnmount;
  8303. exports.onBeforeUpdate = onBeforeUpdate;
  8304. exports.onDeactivated = onDeactivated;
  8305. exports.onErrorCaptured = onErrorCaptured;
  8306. exports.onMounted = onMounted;
  8307. exports.onRenderTracked = onRenderTracked;
  8308. exports.onRenderTriggered = onRenderTriggered;
  8309. exports.onServerPrefetch = onServerPrefetch;
  8310. exports.onUnmounted = onUnmounted;
  8311. exports.onUpdated = onUpdated;
  8312. exports.openBlock = openBlock;
  8313. exports.popScopeId = popScopeId;
  8314. exports.provide = provide;
  8315. exports.pushScopeId = pushScopeId;
  8316. exports.queuePostFlushCb = queuePostFlushCb;
  8317. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  8318. exports.renderList = renderList;
  8319. exports.renderSlot = renderSlot;
  8320. exports.resolveComponent = resolveComponent;
  8321. exports.resolveDirective = resolveDirective;
  8322. exports.resolveDynamicComponent = resolveDynamicComponent;
  8323. exports.resolveFilter = resolveFilter;
  8324. exports.resolveTransitionHooks = resolveTransitionHooks;
  8325. exports.setBlockTracking = setBlockTracking;
  8326. exports.setDevtoolsHook = setDevtoolsHook;
  8327. exports.setTransitionHooks = setTransitionHooks;
  8328. exports.ssrContextKey = ssrContextKey;
  8329. exports.ssrUtils = ssrUtils;
  8330. exports.toHandlers = toHandlers;
  8331. exports.transformVNodeArgs = transformVNodeArgs;
  8332. exports.useAttrs = useAttrs;
  8333. exports.useId = useId;
  8334. exports.useModel = useModel;
  8335. exports.useSSRContext = useSSRContext;
  8336. exports.useSlots = useSlots;
  8337. exports.useTemplateRef = useTemplateRef;
  8338. exports.useTransitionState = useTransitionState;
  8339. exports.version = version;
  8340. exports.warn = warn;
  8341. exports.watch = watch;
  8342. exports.watchEffect = watchEffect;
  8343. exports.watchPostEffect = watchPostEffect;
  8344. exports.watchSyncEffect = watchSyncEffect;
  8345. exports.withAsyncContext = withAsyncContext;
  8346. exports.withCtx = withCtx;
  8347. exports.withDefaults = withDefaults;
  8348. exports.withDirectives = withDirectives;
  8349. exports.withMemo = withMemo;
  8350. exports.withScopeId = withScopeId;