vue.runtime.esm.dev.js 294 KB

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