vue.runtime.common.dev.js 218 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423
  1. /*!
  2. * Vue.js v2.6.12
  3. * (c) 2014-2020 Evan You
  4. * Released under the MIT License.
  5. */
  6. 'use strict';
  7. /* */
  8. var emptyObject = Object.freeze({});
  9. // These helpers produce better VM code in JS engines due to their
  10. // explicitness and function inlining.
  11. function isUndef (v) {
  12. return v === undefined || v === null
  13. }
  14. function isDef (v) {
  15. return v !== undefined && v !== null
  16. }
  17. function isTrue (v) {
  18. return v === true
  19. }
  20. function isFalse (v) {
  21. return v === false
  22. }
  23. /**
  24. * Check if value is primitive.
  25. */
  26. function isPrimitive (value) {
  27. return (
  28. typeof value === 'string' ||
  29. typeof value === 'number' ||
  30. // $flow-disable-line
  31. typeof value === 'symbol' ||
  32. typeof value === 'boolean'
  33. )
  34. }
  35. /**
  36. * Quick object check - this is primarily used to tell
  37. * Objects from primitive values when we know the value
  38. * is a JSON-compliant type.
  39. */
  40. function isObject (obj) {
  41. return obj !== null && typeof obj === 'object'
  42. }
  43. /**
  44. * Get the raw type string of a value, e.g., [object Object].
  45. */
  46. var _toString = Object.prototype.toString;
  47. function toRawType (value) {
  48. return _toString.call(value).slice(8, -1)
  49. }
  50. /**
  51. * Strict object type check. Only returns true
  52. * for plain JavaScript objects.
  53. */
  54. function isPlainObject (obj) {
  55. return _toString.call(obj) === '[object Object]'
  56. }
  57. function isRegExp (v) {
  58. return _toString.call(v) === '[object RegExp]'
  59. }
  60. /**
  61. * Check if val is a valid array index.
  62. */
  63. function isValidArrayIndex (val) {
  64. var n = parseFloat(String(val));
  65. return n >= 0 && Math.floor(n) === n && isFinite(val)
  66. }
  67. function isPromise (val) {
  68. return (
  69. isDef(val) &&
  70. typeof val.then === 'function' &&
  71. typeof val.catch === 'function'
  72. )
  73. }
  74. /**
  75. * Convert a value to a string that is actually rendered.
  76. */
  77. function toString (val) {
  78. return val == null
  79. ? ''
  80. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  81. ? JSON.stringify(val, null, 2)
  82. : String(val)
  83. }
  84. /**
  85. * Convert an input value to a number for persistence.
  86. * If the conversion fails, return original string.
  87. */
  88. function toNumber (val) {
  89. var n = parseFloat(val);
  90. return isNaN(n) ? val : n
  91. }
  92. /**
  93. * Make a map and return a function for checking if a key
  94. * is in that map.
  95. */
  96. function makeMap (
  97. str,
  98. expectsLowerCase
  99. ) {
  100. var map = Object.create(null);
  101. var list = str.split(',');
  102. for (var i = 0; i < list.length; i++) {
  103. map[list[i]] = true;
  104. }
  105. return expectsLowerCase
  106. ? function (val) { return map[val.toLowerCase()]; }
  107. : function (val) { return map[val]; }
  108. }
  109. /**
  110. * Check if a tag is a built-in tag.
  111. */
  112. var isBuiltInTag = makeMap('slot,component', true);
  113. /**
  114. * Check if an attribute is a reserved attribute.
  115. */
  116. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  117. /**
  118. * Remove an item from an array.
  119. */
  120. function remove (arr, item) {
  121. if (arr.length) {
  122. var index = arr.indexOf(item);
  123. if (index > -1) {
  124. return arr.splice(index, 1)
  125. }
  126. }
  127. }
  128. /**
  129. * Check whether an object has the property.
  130. */
  131. var hasOwnProperty = Object.prototype.hasOwnProperty;
  132. function hasOwn (obj, key) {
  133. return hasOwnProperty.call(obj, key)
  134. }
  135. /**
  136. * Create a cached version of a pure function.
  137. */
  138. function cached (fn) {
  139. var cache = Object.create(null);
  140. return (function cachedFn (str) {
  141. var hit = cache[str];
  142. return hit || (cache[str] = fn(str))
  143. })
  144. }
  145. /**
  146. * Camelize a hyphen-delimited string.
  147. */
  148. var camelizeRE = /-(\w)/g;
  149. var camelize = cached(function (str) {
  150. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  151. });
  152. /**
  153. * Capitalize a string.
  154. */
  155. var capitalize = cached(function (str) {
  156. return str.charAt(0).toUpperCase() + str.slice(1)
  157. });
  158. /**
  159. * Hyphenate a camelCase string.
  160. */
  161. var hyphenateRE = /\B([A-Z])/g;
  162. var hyphenate = cached(function (str) {
  163. return str.replace(hyphenateRE, '-$1').toLowerCase()
  164. });
  165. /**
  166. * Simple bind polyfill for environments that do not support it,
  167. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  168. * since native bind is now performant enough in most browsers.
  169. * But removing it would mean breaking code that was able to run in
  170. * PhantomJS 1.x, so this must be kept for backward compatibility.
  171. */
  172. /* istanbul ignore next */
  173. function polyfillBind (fn, ctx) {
  174. function boundFn (a) {
  175. var l = arguments.length;
  176. return l
  177. ? l > 1
  178. ? fn.apply(ctx, arguments)
  179. : fn.call(ctx, a)
  180. : fn.call(ctx)
  181. }
  182. boundFn._length = fn.length;
  183. return boundFn
  184. }
  185. function nativeBind (fn, ctx) {
  186. return fn.bind(ctx)
  187. }
  188. var bind = Function.prototype.bind
  189. ? nativeBind
  190. : polyfillBind;
  191. /**
  192. * Convert an Array-like object to a real Array.
  193. */
  194. function toArray (list, start) {
  195. start = start || 0;
  196. var i = list.length - start;
  197. var ret = new Array(i);
  198. while (i--) {
  199. ret[i] = list[i + start];
  200. }
  201. return ret
  202. }
  203. /**
  204. * Mix properties into target object.
  205. */
  206. function extend (to, _from) {
  207. for (var key in _from) {
  208. to[key] = _from[key];
  209. }
  210. return to
  211. }
  212. /**
  213. * Merge an Array of Objects into a single Object.
  214. */
  215. function toObject (arr) {
  216. var res = {};
  217. for (var i = 0; i < arr.length; i++) {
  218. if (arr[i]) {
  219. extend(res, arr[i]);
  220. }
  221. }
  222. return res
  223. }
  224. /* eslint-disable no-unused-vars */
  225. /**
  226. * Perform no operation.
  227. * Stubbing args to make Flow happy without leaving useless transpiled code
  228. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  229. */
  230. function noop (a, b, c) {}
  231. /**
  232. * Always return false.
  233. */
  234. var no = function (a, b, c) { return false; };
  235. /* eslint-enable no-unused-vars */
  236. /**
  237. * Return the same value.
  238. */
  239. var identity = function (_) { return _; };
  240. /**
  241. * Check if two values are loosely equal - that is,
  242. * if they are plain objects, do they have the same shape?
  243. */
  244. function looseEqual (a, b) {
  245. if (a === b) { return true }
  246. var isObjectA = isObject(a);
  247. var isObjectB = isObject(b);
  248. if (isObjectA && isObjectB) {
  249. try {
  250. var isArrayA = Array.isArray(a);
  251. var isArrayB = Array.isArray(b);
  252. if (isArrayA && isArrayB) {
  253. return a.length === b.length && a.every(function (e, i) {
  254. return looseEqual(e, b[i])
  255. })
  256. } else if (a instanceof Date && b instanceof Date) {
  257. return a.getTime() === b.getTime()
  258. } else if (!isArrayA && !isArrayB) {
  259. var keysA = Object.keys(a);
  260. var keysB = Object.keys(b);
  261. return keysA.length === keysB.length && keysA.every(function (key) {
  262. return looseEqual(a[key], b[key])
  263. })
  264. } else {
  265. /* istanbul ignore next */
  266. return false
  267. }
  268. } catch (e) {
  269. /* istanbul ignore next */
  270. return false
  271. }
  272. } else if (!isObjectA && !isObjectB) {
  273. return String(a) === String(b)
  274. } else {
  275. return false
  276. }
  277. }
  278. /**
  279. * Return the first index at which a loosely equal value can be
  280. * found in the array (if value is a plain object, the array must
  281. * contain an object of the same shape), or -1 if it is not present.
  282. */
  283. function looseIndexOf (arr, val) {
  284. for (var i = 0; i < arr.length; i++) {
  285. if (looseEqual(arr[i], val)) { return i }
  286. }
  287. return -1
  288. }
  289. /**
  290. * Ensure a function is called only once.
  291. */
  292. function once (fn) {
  293. var called = false;
  294. return function () {
  295. if (!called) {
  296. called = true;
  297. fn.apply(this, arguments);
  298. }
  299. }
  300. }
  301. var SSR_ATTR = 'data-server-rendered';
  302. var ASSET_TYPES = [
  303. 'component',
  304. 'directive',
  305. 'filter'
  306. ];
  307. var LIFECYCLE_HOOKS = [
  308. 'beforeCreate',
  309. 'created',
  310. 'beforeMount',
  311. 'mounted',
  312. 'beforeUpdate',
  313. 'updated',
  314. 'beforeDestroy',
  315. 'destroyed',
  316. 'activated',
  317. 'deactivated',
  318. 'errorCaptured',
  319. 'serverPrefetch'
  320. ];
  321. /* */
  322. var config = ({
  323. /**
  324. * Option merge strategies (used in core/util/options)
  325. */
  326. // $flow-disable-line
  327. optionMergeStrategies: Object.create(null),
  328. /**
  329. * Whether to suppress warnings.
  330. */
  331. silent: false,
  332. /**
  333. * Show production mode tip message on boot?
  334. */
  335. productionTip: "development" !== 'production',
  336. /**
  337. * Whether to enable devtools
  338. */
  339. devtools: "development" !== 'production',
  340. /**
  341. * Whether to record perf
  342. */
  343. performance: false,
  344. /**
  345. * Error handler for watcher errors
  346. */
  347. errorHandler: null,
  348. /**
  349. * Warn handler for watcher warns
  350. */
  351. warnHandler: null,
  352. /**
  353. * Ignore certain custom elements
  354. */
  355. ignoredElements: [],
  356. /**
  357. * Custom user key aliases for v-on
  358. */
  359. // $flow-disable-line
  360. keyCodes: Object.create(null),
  361. /**
  362. * Check if a tag is reserved so that it cannot be registered as a
  363. * component. This is platform-dependent and may be overwritten.
  364. */
  365. isReservedTag: no,
  366. /**
  367. * Check if an attribute is reserved so that it cannot be used as a component
  368. * prop. This is platform-dependent and may be overwritten.
  369. */
  370. isReservedAttr: no,
  371. /**
  372. * Check if a tag is an unknown element.
  373. * Platform-dependent.
  374. */
  375. isUnknownElement: no,
  376. /**
  377. * Get the namespace of an element
  378. */
  379. getTagNamespace: noop,
  380. /**
  381. * Parse the real tag name for the specific platform.
  382. */
  383. parsePlatformTagName: identity,
  384. /**
  385. * Check if an attribute must be bound using property, e.g. value
  386. * Platform-dependent.
  387. */
  388. mustUseProp: no,
  389. /**
  390. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  391. * This will significantly reduce performance if set to false.
  392. */
  393. async: true,
  394. /**
  395. * Exposed for legacy reasons
  396. */
  397. _lifecycleHooks: LIFECYCLE_HOOKS
  398. });
  399. /* */
  400. /**
  401. * unicode letters used for parsing html tags, component names and property paths.
  402. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  403. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  404. */
  405. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  406. /**
  407. * Check if a string starts with $ or _
  408. */
  409. function isReserved (str) {
  410. var c = (str + '').charCodeAt(0);
  411. return c === 0x24 || c === 0x5F
  412. }
  413. /**
  414. * Define a property.
  415. */
  416. function def (obj, key, val, enumerable) {
  417. Object.defineProperty(obj, key, {
  418. value: val,
  419. enumerable: !!enumerable,
  420. writable: true,
  421. configurable: true
  422. });
  423. }
  424. /**
  425. * Parse simple path.
  426. */
  427. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  428. function parsePath (path) {
  429. if (bailRE.test(path)) {
  430. return
  431. }
  432. var segments = path.split('.');
  433. return function (obj) {
  434. for (var i = 0; i < segments.length; i++) {
  435. if (!obj) { return }
  436. obj = obj[segments[i]];
  437. }
  438. return obj
  439. }
  440. }
  441. /* */
  442. // can we use __proto__?
  443. var hasProto = '__proto__' in {};
  444. // Browser environment sniffing
  445. var inBrowser = typeof window !== 'undefined';
  446. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  447. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  448. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  449. var isIE = UA && /msie|trident/.test(UA);
  450. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  451. var isEdge = UA && UA.indexOf('edge/') > 0;
  452. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  453. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  454. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  455. var isPhantomJS = UA && /phantomjs/.test(UA);
  456. var isFF = UA && UA.match(/firefox\/(\d+)/);
  457. // Firefox has a "watch" function on Object.prototype...
  458. var nativeWatch = ({}).watch;
  459. var supportsPassive = false;
  460. if (inBrowser) {
  461. try {
  462. var opts = {};
  463. Object.defineProperty(opts, 'passive', ({
  464. get: function get () {
  465. /* istanbul ignore next */
  466. supportsPassive = true;
  467. }
  468. })); // https://github.com/facebook/flow/issues/285
  469. window.addEventListener('test-passive', null, opts);
  470. } catch (e) {}
  471. }
  472. // this needs to be lazy-evaled because vue may be required before
  473. // vue-server-renderer can set VUE_ENV
  474. var _isServer;
  475. var isServerRendering = function () {
  476. if (_isServer === undefined) {
  477. /* istanbul ignore if */
  478. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  479. // detect presence of vue-server-renderer and avoid
  480. // Webpack shimming the process
  481. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  482. } else {
  483. _isServer = false;
  484. }
  485. }
  486. return _isServer
  487. };
  488. // detect devtools
  489. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  490. /* istanbul ignore next */
  491. function isNative (Ctor) {
  492. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  493. }
  494. var hasSymbol =
  495. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  496. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  497. var _Set;
  498. /* istanbul ignore if */ // $flow-disable-line
  499. if (typeof Set !== 'undefined' && isNative(Set)) {
  500. // use native Set when available.
  501. _Set = Set;
  502. } else {
  503. // a non-standard Set polyfill that only works with primitive keys.
  504. _Set = /*@__PURE__*/(function () {
  505. function Set () {
  506. this.set = Object.create(null);
  507. }
  508. Set.prototype.has = function has (key) {
  509. return this.set[key] === true
  510. };
  511. Set.prototype.add = function add (key) {
  512. this.set[key] = true;
  513. };
  514. Set.prototype.clear = function clear () {
  515. this.set = Object.create(null);
  516. };
  517. return Set;
  518. }());
  519. }
  520. /* */
  521. var warn = noop;
  522. var tip = noop;
  523. var generateComponentTrace = (noop); // work around flow check
  524. var formatComponentName = (noop);
  525. {
  526. var hasConsole = typeof console !== 'undefined';
  527. var classifyRE = /(?:^|[-_])(\w)/g;
  528. var classify = function (str) { return str
  529. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  530. .replace(/[-_]/g, ''); };
  531. warn = function (msg, vm) {
  532. var trace = vm ? generateComponentTrace(vm) : '';
  533. if (config.warnHandler) {
  534. config.warnHandler.call(null, msg, vm, trace);
  535. } else if (hasConsole && (!config.silent)) {
  536. console.error(("[Vue warn]: " + msg + trace));
  537. }
  538. };
  539. tip = function (msg, vm) {
  540. if (hasConsole && (!config.silent)) {
  541. console.warn("[Vue tip]: " + msg + (
  542. vm ? generateComponentTrace(vm) : ''
  543. ));
  544. }
  545. };
  546. formatComponentName = function (vm, includeFile) {
  547. if (vm.$root === vm) {
  548. return '<Root>'
  549. }
  550. var options = typeof vm === 'function' && vm.cid != null
  551. ? vm.options
  552. : vm._isVue
  553. ? vm.$options || vm.constructor.options
  554. : vm;
  555. var name = options.name || options._componentTag;
  556. var file = options.__file;
  557. if (!name && file) {
  558. var match = file.match(/([^/\\]+)\.vue$/);
  559. name = match && match[1];
  560. }
  561. return (
  562. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  563. (file && includeFile !== false ? (" at " + file) : '')
  564. )
  565. };
  566. var repeat = function (str, n) {
  567. var res = '';
  568. while (n) {
  569. if (n % 2 === 1) { res += str; }
  570. if (n > 1) { str += str; }
  571. n >>= 1;
  572. }
  573. return res
  574. };
  575. generateComponentTrace = function (vm) {
  576. if (vm._isVue && vm.$parent) {
  577. var tree = [];
  578. var currentRecursiveSequence = 0;
  579. while (vm) {
  580. if (tree.length > 0) {
  581. var last = tree[tree.length - 1];
  582. if (last.constructor === vm.constructor) {
  583. currentRecursiveSequence++;
  584. vm = vm.$parent;
  585. continue
  586. } else if (currentRecursiveSequence > 0) {
  587. tree[tree.length - 1] = [last, currentRecursiveSequence];
  588. currentRecursiveSequence = 0;
  589. }
  590. }
  591. tree.push(vm);
  592. vm = vm.$parent;
  593. }
  594. return '\n\nfound in\n\n' + tree
  595. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  596. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  597. : formatComponentName(vm))); })
  598. .join('\n')
  599. } else {
  600. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  601. }
  602. };
  603. }
  604. /* */
  605. var uid = 0;
  606. /**
  607. * A dep is an observable that can have multiple
  608. * directives subscribing to it.
  609. */
  610. var Dep = function Dep () {
  611. this.id = uid++;
  612. this.subs = [];
  613. };
  614. Dep.prototype.addSub = function addSub (sub) {
  615. this.subs.push(sub);
  616. };
  617. Dep.prototype.removeSub = function removeSub (sub) {
  618. remove(this.subs, sub);
  619. };
  620. Dep.prototype.depend = function depend () {
  621. if (Dep.target) {
  622. Dep.target.addDep(this);
  623. }
  624. };
  625. Dep.prototype.notify = function notify () {
  626. // stabilize the subscriber list first
  627. var subs = this.subs.slice();
  628. if (!config.async) {
  629. // subs aren't sorted in scheduler if not running async
  630. // we need to sort them now to make sure they fire in correct
  631. // order
  632. subs.sort(function (a, b) { return a.id - b.id; });
  633. }
  634. for (var i = 0, l = subs.length; i < l; i++) {
  635. subs[i].update();
  636. }
  637. };
  638. // The current target watcher being evaluated.
  639. // This is globally unique because only one watcher
  640. // can be evaluated at a time.
  641. Dep.target = null;
  642. var targetStack = [];
  643. function pushTarget (target) {
  644. targetStack.push(target);
  645. Dep.target = target;
  646. }
  647. function popTarget () {
  648. targetStack.pop();
  649. Dep.target = targetStack[targetStack.length - 1];
  650. }
  651. /* */
  652. var VNode = function VNode (
  653. tag,
  654. data,
  655. children,
  656. text,
  657. elm,
  658. context,
  659. componentOptions,
  660. asyncFactory
  661. ) {
  662. this.tag = tag;
  663. this.data = data;
  664. this.children = children;
  665. this.text = text;
  666. this.elm = elm;
  667. this.ns = undefined;
  668. this.context = context;
  669. this.fnContext = undefined;
  670. this.fnOptions = undefined;
  671. this.fnScopeId = undefined;
  672. this.key = data && data.key;
  673. this.componentOptions = componentOptions;
  674. this.componentInstance = undefined;
  675. this.parent = undefined;
  676. this.raw = false;
  677. this.isStatic = false;
  678. this.isRootInsert = true;
  679. this.isComment = false;
  680. this.isCloned = false;
  681. this.isOnce = false;
  682. this.asyncFactory = asyncFactory;
  683. this.asyncMeta = undefined;
  684. this.isAsyncPlaceholder = false;
  685. };
  686. var prototypeAccessors = { child: { configurable: true } };
  687. // DEPRECATED: alias for componentInstance for backwards compat.
  688. /* istanbul ignore next */
  689. prototypeAccessors.child.get = function () {
  690. return this.componentInstance
  691. };
  692. Object.defineProperties( VNode.prototype, prototypeAccessors );
  693. var createEmptyVNode = function (text) {
  694. if ( text === void 0 ) text = '';
  695. var node = new VNode();
  696. node.text = text;
  697. node.isComment = true;
  698. return node
  699. };
  700. function createTextVNode (val) {
  701. return new VNode(undefined, undefined, undefined, String(val))
  702. }
  703. // optimized shallow clone
  704. // used for static nodes and slot nodes because they may be reused across
  705. // multiple renders, cloning them avoids errors when DOM manipulations rely
  706. // on their elm reference.
  707. function cloneVNode (vnode) {
  708. var cloned = new VNode(
  709. vnode.tag,
  710. vnode.data,
  711. // #7975
  712. // clone children array to avoid mutating original in case of cloning
  713. // a child.
  714. vnode.children && vnode.children.slice(),
  715. vnode.text,
  716. vnode.elm,
  717. vnode.context,
  718. vnode.componentOptions,
  719. vnode.asyncFactory
  720. );
  721. cloned.ns = vnode.ns;
  722. cloned.isStatic = vnode.isStatic;
  723. cloned.key = vnode.key;
  724. cloned.isComment = vnode.isComment;
  725. cloned.fnContext = vnode.fnContext;
  726. cloned.fnOptions = vnode.fnOptions;
  727. cloned.fnScopeId = vnode.fnScopeId;
  728. cloned.asyncMeta = vnode.asyncMeta;
  729. cloned.isCloned = true;
  730. return cloned
  731. }
  732. /*
  733. * not type checking this file because flow doesn't play well with
  734. * dynamically accessing methods on Array prototype
  735. */
  736. var arrayProto = Array.prototype;
  737. var arrayMethods = Object.create(arrayProto);
  738. var methodsToPatch = [
  739. 'push',
  740. 'pop',
  741. 'shift',
  742. 'unshift',
  743. 'splice',
  744. 'sort',
  745. 'reverse'
  746. ];
  747. /**
  748. * Intercept mutating methods and emit events
  749. */
  750. methodsToPatch.forEach(function (method) {
  751. // cache original method
  752. var original = arrayProto[method];
  753. def(arrayMethods, method, function mutator () {
  754. var args = [], len = arguments.length;
  755. while ( len-- ) args[ len ] = arguments[ len ];
  756. var result = original.apply(this, args);
  757. var ob = this.__ob__;
  758. var inserted;
  759. switch (method) {
  760. case 'push':
  761. case 'unshift':
  762. inserted = args;
  763. break
  764. case 'splice':
  765. inserted = args.slice(2);
  766. break
  767. }
  768. if (inserted) { ob.observeArray(inserted); }
  769. // notify change
  770. ob.dep.notify();
  771. return result
  772. });
  773. });
  774. /* */
  775. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  776. /**
  777. * In some cases we may want to disable observation inside a component's
  778. * update computation.
  779. */
  780. var shouldObserve = true;
  781. function toggleObserving (value) {
  782. shouldObserve = value;
  783. }
  784. /**
  785. * Observer class that is attached to each observed
  786. * object. Once attached, the observer converts the target
  787. * object's property keys into getter/setters that
  788. * collect dependencies and dispatch updates.
  789. */
  790. var Observer = function Observer (value) {
  791. this.value = value;
  792. this.dep = new Dep();
  793. this.vmCount = 0;
  794. def(value, '__ob__', this);
  795. if (Array.isArray(value)) {
  796. if (hasProto) {
  797. protoAugment(value, arrayMethods);
  798. } else {
  799. copyAugment(value, arrayMethods, arrayKeys);
  800. }
  801. this.observeArray(value);
  802. } else {
  803. this.walk(value);
  804. }
  805. };
  806. /**
  807. * Walk through all properties and convert them into
  808. * getter/setters. This method should only be called when
  809. * value type is Object.
  810. */
  811. Observer.prototype.walk = function walk (obj) {
  812. var keys = Object.keys(obj);
  813. for (var i = 0; i < keys.length; i++) {
  814. defineReactive$$1(obj, keys[i]);
  815. }
  816. };
  817. /**
  818. * Observe a list of Array items.
  819. */
  820. Observer.prototype.observeArray = function observeArray (items) {
  821. for (var i = 0, l = items.length; i < l; i++) {
  822. observe(items[i]);
  823. }
  824. };
  825. // helpers
  826. /**
  827. * Augment a target Object or Array by intercepting
  828. * the prototype chain using __proto__
  829. */
  830. function protoAugment (target, src) {
  831. /* eslint-disable no-proto */
  832. target.__proto__ = src;
  833. /* eslint-enable no-proto */
  834. }
  835. /**
  836. * Augment a target Object or Array by defining
  837. * hidden properties.
  838. */
  839. /* istanbul ignore next */
  840. function copyAugment (target, src, keys) {
  841. for (var i = 0, l = keys.length; i < l; i++) {
  842. var key = keys[i];
  843. def(target, key, src[key]);
  844. }
  845. }
  846. /**
  847. * Attempt to create an observer instance for a value,
  848. * returns the new observer if successfully observed,
  849. * or the existing observer if the value already has one.
  850. */
  851. function observe (value, asRootData) {
  852. if (!isObject(value) || value instanceof VNode) {
  853. return
  854. }
  855. var ob;
  856. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  857. ob = value.__ob__;
  858. } else if (
  859. shouldObserve &&
  860. !isServerRendering() &&
  861. (Array.isArray(value) || isPlainObject(value)) &&
  862. Object.isExtensible(value) &&
  863. !value._isVue
  864. ) {
  865. ob = new Observer(value);
  866. }
  867. if (asRootData && ob) {
  868. ob.vmCount++;
  869. }
  870. return ob
  871. }
  872. /**
  873. * Define a reactive property on an Object.
  874. */
  875. function defineReactive$$1 (
  876. obj,
  877. key,
  878. val,
  879. customSetter,
  880. shallow
  881. ) {
  882. var dep = new Dep();
  883. var property = Object.getOwnPropertyDescriptor(obj, key);
  884. if (property && property.configurable === false) {
  885. return
  886. }
  887. // cater for pre-defined getter/setters
  888. var getter = property && property.get;
  889. var setter = property && property.set;
  890. if ((!getter || setter) && arguments.length === 2) {
  891. val = obj[key];
  892. }
  893. var childOb = !shallow && observe(val);
  894. Object.defineProperty(obj, key, {
  895. enumerable: true,
  896. configurable: true,
  897. get: function reactiveGetter () {
  898. var value = getter ? getter.call(obj) : val;
  899. if (Dep.target) {
  900. dep.depend();
  901. if (childOb) {
  902. childOb.dep.depend();
  903. if (Array.isArray(value)) {
  904. dependArray(value);
  905. }
  906. }
  907. }
  908. return value
  909. },
  910. set: function reactiveSetter (newVal) {
  911. var value = getter ? getter.call(obj) : val;
  912. /* eslint-disable no-self-compare */
  913. if (newVal === value || (newVal !== newVal && value !== value)) {
  914. return
  915. }
  916. /* eslint-enable no-self-compare */
  917. if (customSetter) {
  918. customSetter();
  919. }
  920. // #7981: for accessor properties without setter
  921. if (getter && !setter) { return }
  922. if (setter) {
  923. setter.call(obj, newVal);
  924. } else {
  925. val = newVal;
  926. }
  927. childOb = !shallow && observe(newVal);
  928. dep.notify();
  929. }
  930. });
  931. }
  932. /**
  933. * Set a property on an object. Adds the new property and
  934. * triggers change notification if the property doesn't
  935. * already exist.
  936. */
  937. function set (target, key, val) {
  938. if (isUndef(target) || isPrimitive(target)
  939. ) {
  940. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  941. }
  942. if (Array.isArray(target) && isValidArrayIndex(key)) {
  943. target.length = Math.max(target.length, key);
  944. target.splice(key, 1, val);
  945. return val
  946. }
  947. if (key in target && !(key in Object.prototype)) {
  948. target[key] = val;
  949. return val
  950. }
  951. var ob = (target).__ob__;
  952. if (target._isVue || (ob && ob.vmCount)) {
  953. warn(
  954. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  955. 'at runtime - declare it upfront in the data option.'
  956. );
  957. return val
  958. }
  959. if (!ob) {
  960. target[key] = val;
  961. return val
  962. }
  963. defineReactive$$1(ob.value, key, val);
  964. ob.dep.notify();
  965. return val
  966. }
  967. /**
  968. * Delete a property and trigger change if necessary.
  969. */
  970. function del (target, key) {
  971. if (isUndef(target) || isPrimitive(target)
  972. ) {
  973. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  974. }
  975. if (Array.isArray(target) && isValidArrayIndex(key)) {
  976. target.splice(key, 1);
  977. return
  978. }
  979. var ob = (target).__ob__;
  980. if (target._isVue || (ob && ob.vmCount)) {
  981. warn(
  982. 'Avoid deleting properties on a Vue instance or its root $data ' +
  983. '- just set it to null.'
  984. );
  985. return
  986. }
  987. if (!hasOwn(target, key)) {
  988. return
  989. }
  990. delete target[key];
  991. if (!ob) {
  992. return
  993. }
  994. ob.dep.notify();
  995. }
  996. /**
  997. * Collect dependencies on array elements when the array is touched, since
  998. * we cannot intercept array element access like property getters.
  999. */
  1000. function dependArray (value) {
  1001. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1002. e = value[i];
  1003. e && e.__ob__ && e.__ob__.dep.depend();
  1004. if (Array.isArray(e)) {
  1005. dependArray(e);
  1006. }
  1007. }
  1008. }
  1009. /* */
  1010. /**
  1011. * Option overwriting strategies are functions that handle
  1012. * how to merge a parent option value and a child option
  1013. * value into the final value.
  1014. */
  1015. var strats = config.optionMergeStrategies;
  1016. /**
  1017. * Options with restrictions
  1018. */
  1019. {
  1020. strats.el = strats.propsData = function (parent, child, vm, key) {
  1021. if (!vm) {
  1022. warn(
  1023. "option \"" + key + "\" can only be used during instance " +
  1024. 'creation with the `new` keyword.'
  1025. );
  1026. }
  1027. return defaultStrat(parent, child)
  1028. };
  1029. }
  1030. /**
  1031. * Helper that recursively merges two data objects together.
  1032. */
  1033. function mergeData (to, from) {
  1034. if (!from) { return to }
  1035. var key, toVal, fromVal;
  1036. var keys = hasSymbol
  1037. ? Reflect.ownKeys(from)
  1038. : Object.keys(from);
  1039. for (var i = 0; i < keys.length; i++) {
  1040. key = keys[i];
  1041. // in case the object is already observed...
  1042. if (key === '__ob__') { continue }
  1043. toVal = to[key];
  1044. fromVal = from[key];
  1045. if (!hasOwn(to, key)) {
  1046. set(to, key, fromVal);
  1047. } else if (
  1048. toVal !== fromVal &&
  1049. isPlainObject(toVal) &&
  1050. isPlainObject(fromVal)
  1051. ) {
  1052. mergeData(toVal, fromVal);
  1053. }
  1054. }
  1055. return to
  1056. }
  1057. /**
  1058. * Data
  1059. */
  1060. function mergeDataOrFn (
  1061. parentVal,
  1062. childVal,
  1063. vm
  1064. ) {
  1065. if (!vm) {
  1066. // in a Vue.extend merge, both should be functions
  1067. if (!childVal) {
  1068. return parentVal
  1069. }
  1070. if (!parentVal) {
  1071. return childVal
  1072. }
  1073. // when parentVal & childVal are both present,
  1074. // we need to return a function that returns the
  1075. // merged result of both functions... no need to
  1076. // check if parentVal is a function here because
  1077. // it has to be a function to pass previous merges.
  1078. return function mergedDataFn () {
  1079. return mergeData(
  1080. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1081. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1082. )
  1083. }
  1084. } else {
  1085. return function mergedInstanceDataFn () {
  1086. // instance merge
  1087. var instanceData = typeof childVal === 'function'
  1088. ? childVal.call(vm, vm)
  1089. : childVal;
  1090. var defaultData = typeof parentVal === 'function'
  1091. ? parentVal.call(vm, vm)
  1092. : parentVal;
  1093. if (instanceData) {
  1094. return mergeData(instanceData, defaultData)
  1095. } else {
  1096. return defaultData
  1097. }
  1098. }
  1099. }
  1100. }
  1101. strats.data = function (
  1102. parentVal,
  1103. childVal,
  1104. vm
  1105. ) {
  1106. if (!vm) {
  1107. if (childVal && typeof childVal !== 'function') {
  1108. warn(
  1109. 'The "data" option should be a function ' +
  1110. 'that returns a per-instance value in component ' +
  1111. 'definitions.',
  1112. vm
  1113. );
  1114. return parentVal
  1115. }
  1116. return mergeDataOrFn(parentVal, childVal)
  1117. }
  1118. return mergeDataOrFn(parentVal, childVal, vm)
  1119. };
  1120. /**
  1121. * Hooks and props are merged as arrays.
  1122. */
  1123. function mergeHook (
  1124. parentVal,
  1125. childVal
  1126. ) {
  1127. var res = childVal
  1128. ? parentVal
  1129. ? parentVal.concat(childVal)
  1130. : Array.isArray(childVal)
  1131. ? childVal
  1132. : [childVal]
  1133. : parentVal;
  1134. return res
  1135. ? dedupeHooks(res)
  1136. : res
  1137. }
  1138. function dedupeHooks (hooks) {
  1139. var res = [];
  1140. for (var i = 0; i < hooks.length; i++) {
  1141. if (res.indexOf(hooks[i]) === -1) {
  1142. res.push(hooks[i]);
  1143. }
  1144. }
  1145. return res
  1146. }
  1147. LIFECYCLE_HOOKS.forEach(function (hook) {
  1148. strats[hook] = mergeHook;
  1149. });
  1150. /**
  1151. * Assets
  1152. *
  1153. * When a vm is present (instance creation), we need to do
  1154. * a three-way merge between constructor options, instance
  1155. * options and parent options.
  1156. */
  1157. function mergeAssets (
  1158. parentVal,
  1159. childVal,
  1160. vm,
  1161. key
  1162. ) {
  1163. var res = Object.create(parentVal || null);
  1164. if (childVal) {
  1165. assertObjectType(key, childVal, vm);
  1166. return extend(res, childVal)
  1167. } else {
  1168. return res
  1169. }
  1170. }
  1171. ASSET_TYPES.forEach(function (type) {
  1172. strats[type + 's'] = mergeAssets;
  1173. });
  1174. /**
  1175. * Watchers.
  1176. *
  1177. * Watchers hashes should not overwrite one
  1178. * another, so we merge them as arrays.
  1179. */
  1180. strats.watch = function (
  1181. parentVal,
  1182. childVal,
  1183. vm,
  1184. key
  1185. ) {
  1186. // work around Firefox's Object.prototype.watch...
  1187. if (parentVal === nativeWatch) { parentVal = undefined; }
  1188. if (childVal === nativeWatch) { childVal = undefined; }
  1189. /* istanbul ignore if */
  1190. if (!childVal) { return Object.create(parentVal || null) }
  1191. {
  1192. assertObjectType(key, childVal, vm);
  1193. }
  1194. if (!parentVal) { return childVal }
  1195. var ret = {};
  1196. extend(ret, parentVal);
  1197. for (var key$1 in childVal) {
  1198. var parent = ret[key$1];
  1199. var child = childVal[key$1];
  1200. if (parent && !Array.isArray(parent)) {
  1201. parent = [parent];
  1202. }
  1203. ret[key$1] = parent
  1204. ? parent.concat(child)
  1205. : Array.isArray(child) ? child : [child];
  1206. }
  1207. return ret
  1208. };
  1209. /**
  1210. * Other object hashes.
  1211. */
  1212. strats.props =
  1213. strats.methods =
  1214. strats.inject =
  1215. strats.computed = function (
  1216. parentVal,
  1217. childVal,
  1218. vm,
  1219. key
  1220. ) {
  1221. if (childVal && "development" !== 'production') {
  1222. assertObjectType(key, childVal, vm);
  1223. }
  1224. if (!parentVal) { return childVal }
  1225. var ret = Object.create(null);
  1226. extend(ret, parentVal);
  1227. if (childVal) { extend(ret, childVal); }
  1228. return ret
  1229. };
  1230. strats.provide = mergeDataOrFn;
  1231. /**
  1232. * Default strategy.
  1233. */
  1234. var defaultStrat = function (parentVal, childVal) {
  1235. return childVal === undefined
  1236. ? parentVal
  1237. : childVal
  1238. };
  1239. /**
  1240. * Validate component names
  1241. */
  1242. function checkComponents (options) {
  1243. for (var key in options.components) {
  1244. validateComponentName(key);
  1245. }
  1246. }
  1247. function validateComponentName (name) {
  1248. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1249. warn(
  1250. 'Invalid component name: "' + name + '". Component names ' +
  1251. 'should conform to valid custom element name in html5 specification.'
  1252. );
  1253. }
  1254. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1255. warn(
  1256. 'Do not use built-in or reserved HTML elements as component ' +
  1257. 'id: ' + name
  1258. );
  1259. }
  1260. }
  1261. /**
  1262. * Ensure all props option syntax are normalized into the
  1263. * Object-based format.
  1264. */
  1265. function normalizeProps (options, vm) {
  1266. var props = options.props;
  1267. if (!props) { return }
  1268. var res = {};
  1269. var i, val, name;
  1270. if (Array.isArray(props)) {
  1271. i = props.length;
  1272. while (i--) {
  1273. val = props[i];
  1274. if (typeof val === 'string') {
  1275. name = camelize(val);
  1276. res[name] = { type: null };
  1277. } else {
  1278. warn('props must be strings when using array syntax.');
  1279. }
  1280. }
  1281. } else if (isPlainObject(props)) {
  1282. for (var key in props) {
  1283. val = props[key];
  1284. name = camelize(key);
  1285. res[name] = isPlainObject(val)
  1286. ? val
  1287. : { type: val };
  1288. }
  1289. } else {
  1290. warn(
  1291. "Invalid value for option \"props\": expected an Array or an Object, " +
  1292. "but got " + (toRawType(props)) + ".",
  1293. vm
  1294. );
  1295. }
  1296. options.props = res;
  1297. }
  1298. /**
  1299. * Normalize all injections into Object-based format
  1300. */
  1301. function normalizeInject (options, vm) {
  1302. var inject = options.inject;
  1303. if (!inject) { return }
  1304. var normalized = options.inject = {};
  1305. if (Array.isArray(inject)) {
  1306. for (var i = 0; i < inject.length; i++) {
  1307. normalized[inject[i]] = { from: inject[i] };
  1308. }
  1309. } else if (isPlainObject(inject)) {
  1310. for (var key in inject) {
  1311. var val = inject[key];
  1312. normalized[key] = isPlainObject(val)
  1313. ? extend({ from: key }, val)
  1314. : { from: val };
  1315. }
  1316. } else {
  1317. warn(
  1318. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1319. "but got " + (toRawType(inject)) + ".",
  1320. vm
  1321. );
  1322. }
  1323. }
  1324. /**
  1325. * Normalize raw function directives into object format.
  1326. */
  1327. function normalizeDirectives (options) {
  1328. var dirs = options.directives;
  1329. if (dirs) {
  1330. for (var key in dirs) {
  1331. var def$$1 = dirs[key];
  1332. if (typeof def$$1 === 'function') {
  1333. dirs[key] = { bind: def$$1, update: def$$1 };
  1334. }
  1335. }
  1336. }
  1337. }
  1338. function assertObjectType (name, value, vm) {
  1339. if (!isPlainObject(value)) {
  1340. warn(
  1341. "Invalid value for option \"" + name + "\": expected an Object, " +
  1342. "but got " + (toRawType(value)) + ".",
  1343. vm
  1344. );
  1345. }
  1346. }
  1347. /**
  1348. * Merge two option objects into a new one.
  1349. * Core utility used in both instantiation and inheritance.
  1350. */
  1351. function mergeOptions (
  1352. parent,
  1353. child,
  1354. vm
  1355. ) {
  1356. {
  1357. checkComponents(child);
  1358. }
  1359. if (typeof child === 'function') {
  1360. child = child.options;
  1361. }
  1362. normalizeProps(child, vm);
  1363. normalizeInject(child, vm);
  1364. normalizeDirectives(child);
  1365. // Apply extends and mixins on the child options,
  1366. // but only if it is a raw options object that isn't
  1367. // the result of another mergeOptions call.
  1368. // Only merged options has the _base property.
  1369. if (!child._base) {
  1370. if (child.extends) {
  1371. parent = mergeOptions(parent, child.extends, vm);
  1372. }
  1373. if (child.mixins) {
  1374. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1375. parent = mergeOptions(parent, child.mixins[i], vm);
  1376. }
  1377. }
  1378. }
  1379. var options = {};
  1380. var key;
  1381. for (key in parent) {
  1382. mergeField(key);
  1383. }
  1384. for (key in child) {
  1385. if (!hasOwn(parent, key)) {
  1386. mergeField(key);
  1387. }
  1388. }
  1389. function mergeField (key) {
  1390. var strat = strats[key] || defaultStrat;
  1391. options[key] = strat(parent[key], child[key], vm, key);
  1392. }
  1393. return options
  1394. }
  1395. /**
  1396. * Resolve an asset.
  1397. * This function is used because child instances need access
  1398. * to assets defined in its ancestor chain.
  1399. */
  1400. function resolveAsset (
  1401. options,
  1402. type,
  1403. id,
  1404. warnMissing
  1405. ) {
  1406. /* istanbul ignore if */
  1407. if (typeof id !== 'string') {
  1408. return
  1409. }
  1410. var assets = options[type];
  1411. // check local registration variations first
  1412. if (hasOwn(assets, id)) { return assets[id] }
  1413. var camelizedId = camelize(id);
  1414. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1415. var PascalCaseId = capitalize(camelizedId);
  1416. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1417. // fallback to prototype chain
  1418. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1419. if (warnMissing && !res) {
  1420. warn(
  1421. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1422. options
  1423. );
  1424. }
  1425. return res
  1426. }
  1427. /* */
  1428. function validateProp (
  1429. key,
  1430. propOptions,
  1431. propsData,
  1432. vm
  1433. ) {
  1434. var prop = propOptions[key];
  1435. var absent = !hasOwn(propsData, key);
  1436. var value = propsData[key];
  1437. // boolean casting
  1438. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1439. if (booleanIndex > -1) {
  1440. if (absent && !hasOwn(prop, 'default')) {
  1441. value = false;
  1442. } else if (value === '' || value === hyphenate(key)) {
  1443. // only cast empty string / same name to boolean if
  1444. // boolean has higher priority
  1445. var stringIndex = getTypeIndex(String, prop.type);
  1446. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1447. value = true;
  1448. }
  1449. }
  1450. }
  1451. // check default value
  1452. if (value === undefined) {
  1453. value = getPropDefaultValue(vm, prop, key);
  1454. // since the default value is a fresh copy,
  1455. // make sure to observe it.
  1456. var prevShouldObserve = shouldObserve;
  1457. toggleObserving(true);
  1458. observe(value);
  1459. toggleObserving(prevShouldObserve);
  1460. }
  1461. {
  1462. assertProp(prop, key, value, vm, absent);
  1463. }
  1464. return value
  1465. }
  1466. /**
  1467. * Get the default value of a prop.
  1468. */
  1469. function getPropDefaultValue (vm, prop, key) {
  1470. // no default, return undefined
  1471. if (!hasOwn(prop, 'default')) {
  1472. return undefined
  1473. }
  1474. var def = prop.default;
  1475. // warn against non-factory defaults for Object & Array
  1476. if (isObject(def)) {
  1477. warn(
  1478. 'Invalid default value for prop "' + key + '": ' +
  1479. 'Props with type Object/Array must use a factory function ' +
  1480. 'to return the default value.',
  1481. vm
  1482. );
  1483. }
  1484. // the raw prop value was also undefined from previous render,
  1485. // return previous default value to avoid unnecessary watcher trigger
  1486. if (vm && vm.$options.propsData &&
  1487. vm.$options.propsData[key] === undefined &&
  1488. vm._props[key] !== undefined
  1489. ) {
  1490. return vm._props[key]
  1491. }
  1492. // call factory function for non-Function types
  1493. // a value is Function if its prototype is function even across different execution context
  1494. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1495. ? def.call(vm)
  1496. : def
  1497. }
  1498. /**
  1499. * Assert whether a prop is valid.
  1500. */
  1501. function assertProp (
  1502. prop,
  1503. name,
  1504. value,
  1505. vm,
  1506. absent
  1507. ) {
  1508. if (prop.required && absent) {
  1509. warn(
  1510. 'Missing required prop: "' + name + '"',
  1511. vm
  1512. );
  1513. return
  1514. }
  1515. if (value == null && !prop.required) {
  1516. return
  1517. }
  1518. var type = prop.type;
  1519. var valid = !type || type === true;
  1520. var expectedTypes = [];
  1521. if (type) {
  1522. if (!Array.isArray(type)) {
  1523. type = [type];
  1524. }
  1525. for (var i = 0; i < type.length && !valid; i++) {
  1526. var assertedType = assertType(value, type[i]);
  1527. expectedTypes.push(assertedType.expectedType || '');
  1528. valid = assertedType.valid;
  1529. }
  1530. }
  1531. if (!valid) {
  1532. warn(
  1533. getInvalidTypeMessage(name, value, expectedTypes),
  1534. vm
  1535. );
  1536. return
  1537. }
  1538. var validator = prop.validator;
  1539. if (validator) {
  1540. if (!validator(value)) {
  1541. warn(
  1542. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1543. vm
  1544. );
  1545. }
  1546. }
  1547. }
  1548. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1549. function assertType (value, type) {
  1550. var valid;
  1551. var expectedType = getType(type);
  1552. if (simpleCheckRE.test(expectedType)) {
  1553. var t = typeof value;
  1554. valid = t === expectedType.toLowerCase();
  1555. // for primitive wrapper objects
  1556. if (!valid && t === 'object') {
  1557. valid = value instanceof type;
  1558. }
  1559. } else if (expectedType === 'Object') {
  1560. valid = isPlainObject(value);
  1561. } else if (expectedType === 'Array') {
  1562. valid = Array.isArray(value);
  1563. } else {
  1564. valid = value instanceof type;
  1565. }
  1566. return {
  1567. valid: valid,
  1568. expectedType: expectedType
  1569. }
  1570. }
  1571. /**
  1572. * Use function string name to check built-in types,
  1573. * because a simple equality check will fail when running
  1574. * across different vms / iframes.
  1575. */
  1576. function getType (fn) {
  1577. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1578. return match ? match[1] : ''
  1579. }
  1580. function isSameType (a, b) {
  1581. return getType(a) === getType(b)
  1582. }
  1583. function getTypeIndex (type, expectedTypes) {
  1584. if (!Array.isArray(expectedTypes)) {
  1585. return isSameType(expectedTypes, type) ? 0 : -1
  1586. }
  1587. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1588. if (isSameType(expectedTypes[i], type)) {
  1589. return i
  1590. }
  1591. }
  1592. return -1
  1593. }
  1594. function getInvalidTypeMessage (name, value, expectedTypes) {
  1595. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1596. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1597. var expectedType = expectedTypes[0];
  1598. var receivedType = toRawType(value);
  1599. var expectedValue = styleValue(value, expectedType);
  1600. var receivedValue = styleValue(value, receivedType);
  1601. // check if we need to specify expected value
  1602. if (expectedTypes.length === 1 &&
  1603. isExplicable(expectedType) &&
  1604. !isBoolean(expectedType, receivedType)) {
  1605. message += " with value " + expectedValue;
  1606. }
  1607. message += ", got " + receivedType + " ";
  1608. // check if we need to specify received value
  1609. if (isExplicable(receivedType)) {
  1610. message += "with value " + receivedValue + ".";
  1611. }
  1612. return message
  1613. }
  1614. function styleValue (value, type) {
  1615. if (type === 'String') {
  1616. return ("\"" + value + "\"")
  1617. } else if (type === 'Number') {
  1618. return ("" + (Number(value)))
  1619. } else {
  1620. return ("" + value)
  1621. }
  1622. }
  1623. function isExplicable (value) {
  1624. var explicitTypes = ['string', 'number', 'boolean'];
  1625. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1626. }
  1627. function isBoolean () {
  1628. var args = [], len = arguments.length;
  1629. while ( len-- ) args[ len ] = arguments[ len ];
  1630. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1631. }
  1632. /* */
  1633. function handleError (err, vm, info) {
  1634. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1635. // See: https://github.com/vuejs/vuex/issues/1505
  1636. pushTarget();
  1637. try {
  1638. if (vm) {
  1639. var cur = vm;
  1640. while ((cur = cur.$parent)) {
  1641. var hooks = cur.$options.errorCaptured;
  1642. if (hooks) {
  1643. for (var i = 0; i < hooks.length; i++) {
  1644. try {
  1645. var capture = hooks[i].call(cur, err, vm, info) === false;
  1646. if (capture) { return }
  1647. } catch (e) {
  1648. globalHandleError(e, cur, 'errorCaptured hook');
  1649. }
  1650. }
  1651. }
  1652. }
  1653. }
  1654. globalHandleError(err, vm, info);
  1655. } finally {
  1656. popTarget();
  1657. }
  1658. }
  1659. function invokeWithErrorHandling (
  1660. handler,
  1661. context,
  1662. args,
  1663. vm,
  1664. info
  1665. ) {
  1666. var res;
  1667. try {
  1668. res = args ? handler.apply(context, args) : handler.call(context);
  1669. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1670. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1671. // issue #9511
  1672. // avoid catch triggering multiple times when nested calls
  1673. res._handled = true;
  1674. }
  1675. } catch (e) {
  1676. handleError(e, vm, info);
  1677. }
  1678. return res
  1679. }
  1680. function globalHandleError (err, vm, info) {
  1681. if (config.errorHandler) {
  1682. try {
  1683. return config.errorHandler.call(null, err, vm, info)
  1684. } catch (e) {
  1685. // if the user intentionally throws the original error in the handler,
  1686. // do not log it twice
  1687. if (e !== err) {
  1688. logError(e, null, 'config.errorHandler');
  1689. }
  1690. }
  1691. }
  1692. logError(err, vm, info);
  1693. }
  1694. function logError (err, vm, info) {
  1695. {
  1696. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1697. }
  1698. /* istanbul ignore else */
  1699. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1700. console.error(err);
  1701. } else {
  1702. throw err
  1703. }
  1704. }
  1705. /* */
  1706. var isUsingMicroTask = false;
  1707. var callbacks = [];
  1708. var pending = false;
  1709. function flushCallbacks () {
  1710. pending = false;
  1711. var copies = callbacks.slice(0);
  1712. callbacks.length = 0;
  1713. for (var i = 0; i < copies.length; i++) {
  1714. copies[i]();
  1715. }
  1716. }
  1717. // Here we have async deferring wrappers using microtasks.
  1718. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1719. // However, it has subtle problems when state is changed right before repaint
  1720. // (e.g. #6813, out-in transitions).
  1721. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1722. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1723. // So we now use microtasks everywhere, again.
  1724. // A major drawback of this tradeoff is that there are some scenarios
  1725. // where microtasks have too high a priority and fire in between supposedly
  1726. // sequential events (e.g. #4521, #6690, which have workarounds)
  1727. // or even between bubbling of the same event (#6566).
  1728. var timerFunc;
  1729. // The nextTick behavior leverages the microtask queue, which can be accessed
  1730. // via either native Promise.then or MutationObserver.
  1731. // MutationObserver has wider support, however it is seriously bugged in
  1732. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1733. // completely stops working after triggering a few times... so, if native
  1734. // Promise is available, we will use it:
  1735. /* istanbul ignore next, $flow-disable-line */
  1736. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1737. var p = Promise.resolve();
  1738. timerFunc = function () {
  1739. p.then(flushCallbacks);
  1740. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1741. // it can get stuck in a weird state where callbacks are pushed into the
  1742. // microtask queue but the queue isn't being flushed, until the browser
  1743. // needs to do some other work, e.g. handle a timer. Therefore we can
  1744. // "force" the microtask queue to be flushed by adding an empty timer.
  1745. if (isIOS) { setTimeout(noop); }
  1746. };
  1747. isUsingMicroTask = true;
  1748. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1749. isNative(MutationObserver) ||
  1750. // PhantomJS and iOS 7.x
  1751. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1752. )) {
  1753. // Use MutationObserver where native Promise is not available,
  1754. // e.g. PhantomJS, iOS7, Android 4.4
  1755. // (#6466 MutationObserver is unreliable in IE11)
  1756. var counter = 1;
  1757. var observer = new MutationObserver(flushCallbacks);
  1758. var textNode = document.createTextNode(String(counter));
  1759. observer.observe(textNode, {
  1760. characterData: true
  1761. });
  1762. timerFunc = function () {
  1763. counter = (counter + 1) % 2;
  1764. textNode.data = String(counter);
  1765. };
  1766. isUsingMicroTask = true;
  1767. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1768. // Fallback to setImmediate.
  1769. // Technically it leverages the (macro) task queue,
  1770. // but it is still a better choice than setTimeout.
  1771. timerFunc = function () {
  1772. setImmediate(flushCallbacks);
  1773. };
  1774. } else {
  1775. // Fallback to setTimeout.
  1776. timerFunc = function () {
  1777. setTimeout(flushCallbacks, 0);
  1778. };
  1779. }
  1780. function nextTick (cb, ctx) {
  1781. var _resolve;
  1782. callbacks.push(function () {
  1783. if (cb) {
  1784. try {
  1785. cb.call(ctx);
  1786. } catch (e) {
  1787. handleError(e, ctx, 'nextTick');
  1788. }
  1789. } else if (_resolve) {
  1790. _resolve(ctx);
  1791. }
  1792. });
  1793. if (!pending) {
  1794. pending = true;
  1795. timerFunc();
  1796. }
  1797. // $flow-disable-line
  1798. if (!cb && typeof Promise !== 'undefined') {
  1799. return new Promise(function (resolve) {
  1800. _resolve = resolve;
  1801. })
  1802. }
  1803. }
  1804. /* */
  1805. /* not type checking this file because flow doesn't play well with Proxy */
  1806. var initProxy;
  1807. {
  1808. var allowedGlobals = makeMap(
  1809. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1810. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1811. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1812. 'require' // for Webpack/Browserify
  1813. );
  1814. var warnNonPresent = function (target, key) {
  1815. warn(
  1816. "Property or method \"" + key + "\" is not defined on the instance but " +
  1817. 'referenced during render. Make sure that this property is reactive, ' +
  1818. 'either in the data option, or for class-based components, by ' +
  1819. 'initializing the property. ' +
  1820. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1821. target
  1822. );
  1823. };
  1824. var warnReservedPrefix = function (target, key) {
  1825. warn(
  1826. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1827. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1828. 'prevent conflicts with Vue internals. ' +
  1829. 'See: https://vuejs.org/v2/api/#data',
  1830. target
  1831. );
  1832. };
  1833. var hasProxy =
  1834. typeof Proxy !== 'undefined' && isNative(Proxy);
  1835. if (hasProxy) {
  1836. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1837. config.keyCodes = new Proxy(config.keyCodes, {
  1838. set: function set (target, key, value) {
  1839. if (isBuiltInModifier(key)) {
  1840. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1841. return false
  1842. } else {
  1843. target[key] = value;
  1844. return true
  1845. }
  1846. }
  1847. });
  1848. }
  1849. var hasHandler = {
  1850. has: function has (target, key) {
  1851. var has = key in target;
  1852. var isAllowed = allowedGlobals(key) ||
  1853. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1854. if (!has && !isAllowed) {
  1855. if (key in target.$data) { warnReservedPrefix(target, key); }
  1856. else { warnNonPresent(target, key); }
  1857. }
  1858. return has || !isAllowed
  1859. }
  1860. };
  1861. var getHandler = {
  1862. get: function get (target, key) {
  1863. if (typeof key === 'string' && !(key in target)) {
  1864. if (key in target.$data) { warnReservedPrefix(target, key); }
  1865. else { warnNonPresent(target, key); }
  1866. }
  1867. return target[key]
  1868. }
  1869. };
  1870. initProxy = function initProxy (vm) {
  1871. if (hasProxy) {
  1872. // determine which proxy handler to use
  1873. var options = vm.$options;
  1874. var handlers = options.render && options.render._withStripped
  1875. ? getHandler
  1876. : hasHandler;
  1877. vm._renderProxy = new Proxy(vm, handlers);
  1878. } else {
  1879. vm._renderProxy = vm;
  1880. }
  1881. };
  1882. }
  1883. /* */
  1884. var seenObjects = new _Set();
  1885. /**
  1886. * Recursively traverse an object to evoke all converted
  1887. * getters, so that every nested property inside the object
  1888. * is collected as a "deep" dependency.
  1889. */
  1890. function traverse (val) {
  1891. _traverse(val, seenObjects);
  1892. seenObjects.clear();
  1893. }
  1894. function _traverse (val, seen) {
  1895. var i, keys;
  1896. var isA = Array.isArray(val);
  1897. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1898. return
  1899. }
  1900. if (val.__ob__) {
  1901. var depId = val.__ob__.dep.id;
  1902. if (seen.has(depId)) {
  1903. return
  1904. }
  1905. seen.add(depId);
  1906. }
  1907. if (isA) {
  1908. i = val.length;
  1909. while (i--) { _traverse(val[i], seen); }
  1910. } else {
  1911. keys = Object.keys(val);
  1912. i = keys.length;
  1913. while (i--) { _traverse(val[keys[i]], seen); }
  1914. }
  1915. }
  1916. var mark;
  1917. var measure;
  1918. {
  1919. var perf = inBrowser && window.performance;
  1920. /* istanbul ignore if */
  1921. if (
  1922. perf &&
  1923. perf.mark &&
  1924. perf.measure &&
  1925. perf.clearMarks &&
  1926. perf.clearMeasures
  1927. ) {
  1928. mark = function (tag) { return perf.mark(tag); };
  1929. measure = function (name, startTag, endTag) {
  1930. perf.measure(name, startTag, endTag);
  1931. perf.clearMarks(startTag);
  1932. perf.clearMarks(endTag);
  1933. // perf.clearMeasures(name)
  1934. };
  1935. }
  1936. }
  1937. /* */
  1938. var normalizeEvent = cached(function (name) {
  1939. var passive = name.charAt(0) === '&';
  1940. name = passive ? name.slice(1) : name;
  1941. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1942. name = once$$1 ? name.slice(1) : name;
  1943. var capture = name.charAt(0) === '!';
  1944. name = capture ? name.slice(1) : name;
  1945. return {
  1946. name: name,
  1947. once: once$$1,
  1948. capture: capture,
  1949. passive: passive
  1950. }
  1951. });
  1952. function createFnInvoker (fns, vm) {
  1953. function invoker () {
  1954. var arguments$1 = arguments;
  1955. var fns = invoker.fns;
  1956. if (Array.isArray(fns)) {
  1957. var cloned = fns.slice();
  1958. for (var i = 0; i < cloned.length; i++) {
  1959. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1960. }
  1961. } else {
  1962. // return handler return value for single handlers
  1963. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1964. }
  1965. }
  1966. invoker.fns = fns;
  1967. return invoker
  1968. }
  1969. function updateListeners (
  1970. on,
  1971. oldOn,
  1972. add,
  1973. remove$$1,
  1974. createOnceHandler,
  1975. vm
  1976. ) {
  1977. var name, def$$1, cur, old, event;
  1978. for (name in on) {
  1979. def$$1 = cur = on[name];
  1980. old = oldOn[name];
  1981. event = normalizeEvent(name);
  1982. if (isUndef(cur)) {
  1983. warn(
  1984. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1985. vm
  1986. );
  1987. } else if (isUndef(old)) {
  1988. if (isUndef(cur.fns)) {
  1989. cur = on[name] = createFnInvoker(cur, vm);
  1990. }
  1991. if (isTrue(event.once)) {
  1992. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1993. }
  1994. add(event.name, cur, event.capture, event.passive, event.params);
  1995. } else if (cur !== old) {
  1996. old.fns = cur;
  1997. on[name] = old;
  1998. }
  1999. }
  2000. for (name in oldOn) {
  2001. if (isUndef(on[name])) {
  2002. event = normalizeEvent(name);
  2003. remove$$1(event.name, oldOn[name], event.capture);
  2004. }
  2005. }
  2006. }
  2007. /* */
  2008. function mergeVNodeHook (def, hookKey, hook) {
  2009. if (def instanceof VNode) {
  2010. def = def.data.hook || (def.data.hook = {});
  2011. }
  2012. var invoker;
  2013. var oldHook = def[hookKey];
  2014. function wrappedHook () {
  2015. hook.apply(this, arguments);
  2016. // important: remove merged hook to ensure it's called only once
  2017. // and prevent memory leak
  2018. remove(invoker.fns, wrappedHook);
  2019. }
  2020. if (isUndef(oldHook)) {
  2021. // no existing hook
  2022. invoker = createFnInvoker([wrappedHook]);
  2023. } else {
  2024. /* istanbul ignore if */
  2025. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2026. // already a merged invoker
  2027. invoker = oldHook;
  2028. invoker.fns.push(wrappedHook);
  2029. } else {
  2030. // existing plain hook
  2031. invoker = createFnInvoker([oldHook, wrappedHook]);
  2032. }
  2033. }
  2034. invoker.merged = true;
  2035. def[hookKey] = invoker;
  2036. }
  2037. /* */
  2038. function extractPropsFromVNodeData (
  2039. data,
  2040. Ctor,
  2041. tag
  2042. ) {
  2043. // we are only extracting raw values here.
  2044. // validation and default values are handled in the child
  2045. // component itself.
  2046. var propOptions = Ctor.options.props;
  2047. if (isUndef(propOptions)) {
  2048. return
  2049. }
  2050. var res = {};
  2051. var attrs = data.attrs;
  2052. var props = data.props;
  2053. if (isDef(attrs) || isDef(props)) {
  2054. for (var key in propOptions) {
  2055. var altKey = hyphenate(key);
  2056. {
  2057. var keyInLowerCase = key.toLowerCase();
  2058. if (
  2059. key !== keyInLowerCase &&
  2060. attrs && hasOwn(attrs, keyInLowerCase)
  2061. ) {
  2062. tip(
  2063. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2064. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2065. " \"" + key + "\". " +
  2066. "Note that HTML attributes are case-insensitive and camelCased " +
  2067. "props need to use their kebab-case equivalents when using in-DOM " +
  2068. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2069. );
  2070. }
  2071. }
  2072. checkProp(res, props, key, altKey, true) ||
  2073. checkProp(res, attrs, key, altKey, false);
  2074. }
  2075. }
  2076. return res
  2077. }
  2078. function checkProp (
  2079. res,
  2080. hash,
  2081. key,
  2082. altKey,
  2083. preserve
  2084. ) {
  2085. if (isDef(hash)) {
  2086. if (hasOwn(hash, key)) {
  2087. res[key] = hash[key];
  2088. if (!preserve) {
  2089. delete hash[key];
  2090. }
  2091. return true
  2092. } else if (hasOwn(hash, altKey)) {
  2093. res[key] = hash[altKey];
  2094. if (!preserve) {
  2095. delete hash[altKey];
  2096. }
  2097. return true
  2098. }
  2099. }
  2100. return false
  2101. }
  2102. /* */
  2103. // The template compiler attempts to minimize the need for normalization by
  2104. // statically analyzing the template at compile time.
  2105. //
  2106. // For plain HTML markup, normalization can be completely skipped because the
  2107. // generated render function is guaranteed to return Array<VNode>. There are
  2108. // two cases where extra normalization is needed:
  2109. // 1. When the children contains components - because a functional component
  2110. // may return an Array instead of a single root. In this case, just a simple
  2111. // normalization is needed - if any child is an Array, we flatten the whole
  2112. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2113. // because functional components already normalize their own children.
  2114. function simpleNormalizeChildren (children) {
  2115. for (var i = 0; i < children.length; i++) {
  2116. if (Array.isArray(children[i])) {
  2117. return Array.prototype.concat.apply([], children)
  2118. }
  2119. }
  2120. return children
  2121. }
  2122. // 2. When the children contains constructs that always generated nested Arrays,
  2123. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2124. // with hand-written render functions / JSX. In such cases a full normalization
  2125. // is needed to cater to all possible types of children values.
  2126. function normalizeChildren (children) {
  2127. return isPrimitive(children)
  2128. ? [createTextVNode(children)]
  2129. : Array.isArray(children)
  2130. ? normalizeArrayChildren(children)
  2131. : undefined
  2132. }
  2133. function isTextNode (node) {
  2134. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2135. }
  2136. function normalizeArrayChildren (children, nestedIndex) {
  2137. var res = [];
  2138. var i, c, lastIndex, last;
  2139. for (i = 0; i < children.length; i++) {
  2140. c = children[i];
  2141. if (isUndef(c) || typeof c === 'boolean') { continue }
  2142. lastIndex = res.length - 1;
  2143. last = res[lastIndex];
  2144. // nested
  2145. if (Array.isArray(c)) {
  2146. if (c.length > 0) {
  2147. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2148. // merge adjacent text nodes
  2149. if (isTextNode(c[0]) && isTextNode(last)) {
  2150. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2151. c.shift();
  2152. }
  2153. res.push.apply(res, c);
  2154. }
  2155. } else if (isPrimitive(c)) {
  2156. if (isTextNode(last)) {
  2157. // merge adjacent text nodes
  2158. // this is necessary for SSR hydration because text nodes are
  2159. // essentially merged when rendered to HTML strings
  2160. res[lastIndex] = createTextVNode(last.text + c);
  2161. } else if (c !== '') {
  2162. // convert primitive to vnode
  2163. res.push(createTextVNode(c));
  2164. }
  2165. } else {
  2166. if (isTextNode(c) && isTextNode(last)) {
  2167. // merge adjacent text nodes
  2168. res[lastIndex] = createTextVNode(last.text + c.text);
  2169. } else {
  2170. // default key for nested array children (likely generated by v-for)
  2171. if (isTrue(children._isVList) &&
  2172. isDef(c.tag) &&
  2173. isUndef(c.key) &&
  2174. isDef(nestedIndex)) {
  2175. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2176. }
  2177. res.push(c);
  2178. }
  2179. }
  2180. }
  2181. return res
  2182. }
  2183. /* */
  2184. function initProvide (vm) {
  2185. var provide = vm.$options.provide;
  2186. if (provide) {
  2187. vm._provided = typeof provide === 'function'
  2188. ? provide.call(vm)
  2189. : provide;
  2190. }
  2191. }
  2192. function initInjections (vm) {
  2193. var result = resolveInject(vm.$options.inject, vm);
  2194. if (result) {
  2195. toggleObserving(false);
  2196. Object.keys(result).forEach(function (key) {
  2197. /* istanbul ignore else */
  2198. {
  2199. defineReactive$$1(vm, key, result[key], function () {
  2200. warn(
  2201. "Avoid mutating an injected value directly since the changes will be " +
  2202. "overwritten whenever the provided component re-renders. " +
  2203. "injection being mutated: \"" + key + "\"",
  2204. vm
  2205. );
  2206. });
  2207. }
  2208. });
  2209. toggleObserving(true);
  2210. }
  2211. }
  2212. function resolveInject (inject, vm) {
  2213. if (inject) {
  2214. // inject is :any because flow is not smart enough to figure out cached
  2215. var result = Object.create(null);
  2216. var keys = hasSymbol
  2217. ? Reflect.ownKeys(inject)
  2218. : Object.keys(inject);
  2219. for (var i = 0; i < keys.length; i++) {
  2220. var key = keys[i];
  2221. // #6574 in case the inject object is observed...
  2222. if (key === '__ob__') { continue }
  2223. var provideKey = inject[key].from;
  2224. var source = vm;
  2225. while (source) {
  2226. if (source._provided && hasOwn(source._provided, provideKey)) {
  2227. result[key] = source._provided[provideKey];
  2228. break
  2229. }
  2230. source = source.$parent;
  2231. }
  2232. if (!source) {
  2233. if ('default' in inject[key]) {
  2234. var provideDefault = inject[key].default;
  2235. result[key] = typeof provideDefault === 'function'
  2236. ? provideDefault.call(vm)
  2237. : provideDefault;
  2238. } else {
  2239. warn(("Injection \"" + key + "\" not found"), vm);
  2240. }
  2241. }
  2242. }
  2243. return result
  2244. }
  2245. }
  2246. /* */
  2247. /**
  2248. * Runtime helper for resolving raw children VNodes into a slot object.
  2249. */
  2250. function resolveSlots (
  2251. children,
  2252. context
  2253. ) {
  2254. if (!children || !children.length) {
  2255. return {}
  2256. }
  2257. var slots = {};
  2258. for (var i = 0, l = children.length; i < l; i++) {
  2259. var child = children[i];
  2260. var data = child.data;
  2261. // remove slot attribute if the node is resolved as a Vue slot node
  2262. if (data && data.attrs && data.attrs.slot) {
  2263. delete data.attrs.slot;
  2264. }
  2265. // named slots should only be respected if the vnode was rendered in the
  2266. // same context.
  2267. if ((child.context === context || child.fnContext === context) &&
  2268. data && data.slot != null
  2269. ) {
  2270. var name = data.slot;
  2271. var slot = (slots[name] || (slots[name] = []));
  2272. if (child.tag === 'template') {
  2273. slot.push.apply(slot, child.children || []);
  2274. } else {
  2275. slot.push(child);
  2276. }
  2277. } else {
  2278. (slots.default || (slots.default = [])).push(child);
  2279. }
  2280. }
  2281. // ignore slots that contains only whitespace
  2282. for (var name$1 in slots) {
  2283. if (slots[name$1].every(isWhitespace)) {
  2284. delete slots[name$1];
  2285. }
  2286. }
  2287. return slots
  2288. }
  2289. function isWhitespace (node) {
  2290. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2291. }
  2292. /* */
  2293. function normalizeScopedSlots (
  2294. slots,
  2295. normalSlots,
  2296. prevSlots
  2297. ) {
  2298. var res;
  2299. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2300. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2301. var key = slots && slots.$key;
  2302. if (!slots) {
  2303. res = {};
  2304. } else if (slots._normalized) {
  2305. // fast path 1: child component re-render only, parent did not change
  2306. return slots._normalized
  2307. } else if (
  2308. isStable &&
  2309. prevSlots &&
  2310. prevSlots !== emptyObject &&
  2311. key === prevSlots.$key &&
  2312. !hasNormalSlots &&
  2313. !prevSlots.$hasNormal
  2314. ) {
  2315. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2316. // only need to normalize once
  2317. return prevSlots
  2318. } else {
  2319. res = {};
  2320. for (var key$1 in slots) {
  2321. if (slots[key$1] && key$1[0] !== '$') {
  2322. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2323. }
  2324. }
  2325. }
  2326. // expose normal slots on scopedSlots
  2327. for (var key$2 in normalSlots) {
  2328. if (!(key$2 in res)) {
  2329. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2330. }
  2331. }
  2332. // avoriaz seems to mock a non-extensible $scopedSlots object
  2333. // and when that is passed down this would cause an error
  2334. if (slots && Object.isExtensible(slots)) {
  2335. (slots)._normalized = res;
  2336. }
  2337. def(res, '$stable', isStable);
  2338. def(res, '$key', key);
  2339. def(res, '$hasNormal', hasNormalSlots);
  2340. return res
  2341. }
  2342. function normalizeScopedSlot(normalSlots, key, fn) {
  2343. var normalized = function () {
  2344. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2345. res = res && typeof res === 'object' && !Array.isArray(res)
  2346. ? [res] // single vnode
  2347. : normalizeChildren(res);
  2348. return res && (
  2349. res.length === 0 ||
  2350. (res.length === 1 && res[0].isComment) // #9658
  2351. ) ? undefined
  2352. : res
  2353. };
  2354. // this is a slot using the new v-slot syntax without scope. although it is
  2355. // compiled as a scoped slot, render fn users would expect it to be present
  2356. // on this.$slots because the usage is semantically a normal slot.
  2357. if (fn.proxy) {
  2358. Object.defineProperty(normalSlots, key, {
  2359. get: normalized,
  2360. enumerable: true,
  2361. configurable: true
  2362. });
  2363. }
  2364. return normalized
  2365. }
  2366. function proxyNormalSlot(slots, key) {
  2367. return function () { return slots[key]; }
  2368. }
  2369. /* */
  2370. /**
  2371. * Runtime helper for rendering v-for lists.
  2372. */
  2373. function renderList (
  2374. val,
  2375. render
  2376. ) {
  2377. var ret, i, l, keys, key;
  2378. if (Array.isArray(val) || typeof val === 'string') {
  2379. ret = new Array(val.length);
  2380. for (i = 0, l = val.length; i < l; i++) {
  2381. ret[i] = render(val[i], i);
  2382. }
  2383. } else if (typeof val === 'number') {
  2384. ret = new Array(val);
  2385. for (i = 0; i < val; i++) {
  2386. ret[i] = render(i + 1, i);
  2387. }
  2388. } else if (isObject(val)) {
  2389. if (hasSymbol && val[Symbol.iterator]) {
  2390. ret = [];
  2391. var iterator = val[Symbol.iterator]();
  2392. var result = iterator.next();
  2393. while (!result.done) {
  2394. ret.push(render(result.value, ret.length));
  2395. result = iterator.next();
  2396. }
  2397. } else {
  2398. keys = Object.keys(val);
  2399. ret = new Array(keys.length);
  2400. for (i = 0, l = keys.length; i < l; i++) {
  2401. key = keys[i];
  2402. ret[i] = render(val[key], key, i);
  2403. }
  2404. }
  2405. }
  2406. if (!isDef(ret)) {
  2407. ret = [];
  2408. }
  2409. (ret)._isVList = true;
  2410. return ret
  2411. }
  2412. /* */
  2413. /**
  2414. * Runtime helper for rendering <slot>
  2415. */
  2416. function renderSlot (
  2417. name,
  2418. fallback,
  2419. props,
  2420. bindObject
  2421. ) {
  2422. var scopedSlotFn = this.$scopedSlots[name];
  2423. var nodes;
  2424. if (scopedSlotFn) { // scoped slot
  2425. props = props || {};
  2426. if (bindObject) {
  2427. if (!isObject(bindObject)) {
  2428. warn(
  2429. 'slot v-bind without argument expects an Object',
  2430. this
  2431. );
  2432. }
  2433. props = extend(extend({}, bindObject), props);
  2434. }
  2435. nodes = scopedSlotFn(props) || fallback;
  2436. } else {
  2437. nodes = this.$slots[name] || fallback;
  2438. }
  2439. var target = props && props.slot;
  2440. if (target) {
  2441. return this.$createElement('template', { slot: target }, nodes)
  2442. } else {
  2443. return nodes
  2444. }
  2445. }
  2446. /* */
  2447. /**
  2448. * Runtime helper for resolving filters
  2449. */
  2450. function resolveFilter (id) {
  2451. return resolveAsset(this.$options, 'filters', id, true) || identity
  2452. }
  2453. /* */
  2454. function isKeyNotMatch (expect, actual) {
  2455. if (Array.isArray(expect)) {
  2456. return expect.indexOf(actual) === -1
  2457. } else {
  2458. return expect !== actual
  2459. }
  2460. }
  2461. /**
  2462. * Runtime helper for checking keyCodes from config.
  2463. * exposed as Vue.prototype._k
  2464. * passing in eventKeyName as last argument separately for backwards compat
  2465. */
  2466. function checkKeyCodes (
  2467. eventKeyCode,
  2468. key,
  2469. builtInKeyCode,
  2470. eventKeyName,
  2471. builtInKeyName
  2472. ) {
  2473. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2474. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2475. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2476. } else if (mappedKeyCode) {
  2477. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2478. } else if (eventKeyName) {
  2479. return hyphenate(eventKeyName) !== key
  2480. }
  2481. }
  2482. /* */
  2483. /**
  2484. * Runtime helper for merging v-bind="object" into a VNode's data.
  2485. */
  2486. function bindObjectProps (
  2487. data,
  2488. tag,
  2489. value,
  2490. asProp,
  2491. isSync
  2492. ) {
  2493. if (value) {
  2494. if (!isObject(value)) {
  2495. warn(
  2496. 'v-bind without argument expects an Object or Array value',
  2497. this
  2498. );
  2499. } else {
  2500. if (Array.isArray(value)) {
  2501. value = toObject(value);
  2502. }
  2503. var hash;
  2504. var loop = function ( key ) {
  2505. if (
  2506. key === 'class' ||
  2507. key === 'style' ||
  2508. isReservedAttribute(key)
  2509. ) {
  2510. hash = data;
  2511. } else {
  2512. var type = data.attrs && data.attrs.type;
  2513. hash = asProp || config.mustUseProp(tag, type, key)
  2514. ? data.domProps || (data.domProps = {})
  2515. : data.attrs || (data.attrs = {});
  2516. }
  2517. var camelizedKey = camelize(key);
  2518. var hyphenatedKey = hyphenate(key);
  2519. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2520. hash[key] = value[key];
  2521. if (isSync) {
  2522. var on = data.on || (data.on = {});
  2523. on[("update:" + key)] = function ($event) {
  2524. value[key] = $event;
  2525. };
  2526. }
  2527. }
  2528. };
  2529. for (var key in value) loop( key );
  2530. }
  2531. }
  2532. return data
  2533. }
  2534. /* */
  2535. /**
  2536. * Runtime helper for rendering static trees.
  2537. */
  2538. function renderStatic (
  2539. index,
  2540. isInFor
  2541. ) {
  2542. var cached = this._staticTrees || (this._staticTrees = []);
  2543. var tree = cached[index];
  2544. // if has already-rendered static tree and not inside v-for,
  2545. // we can reuse the same tree.
  2546. if (tree && !isInFor) {
  2547. return tree
  2548. }
  2549. // otherwise, render a fresh tree.
  2550. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2551. this._renderProxy,
  2552. null,
  2553. this // for render fns generated for functional component templates
  2554. );
  2555. markStatic(tree, ("__static__" + index), false);
  2556. return tree
  2557. }
  2558. /**
  2559. * Runtime helper for v-once.
  2560. * Effectively it means marking the node as static with a unique key.
  2561. */
  2562. function markOnce (
  2563. tree,
  2564. index,
  2565. key
  2566. ) {
  2567. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2568. return tree
  2569. }
  2570. function markStatic (
  2571. tree,
  2572. key,
  2573. isOnce
  2574. ) {
  2575. if (Array.isArray(tree)) {
  2576. for (var i = 0; i < tree.length; i++) {
  2577. if (tree[i] && typeof tree[i] !== 'string') {
  2578. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2579. }
  2580. }
  2581. } else {
  2582. markStaticNode(tree, key, isOnce);
  2583. }
  2584. }
  2585. function markStaticNode (node, key, isOnce) {
  2586. node.isStatic = true;
  2587. node.key = key;
  2588. node.isOnce = isOnce;
  2589. }
  2590. /* */
  2591. function bindObjectListeners (data, value) {
  2592. if (value) {
  2593. if (!isPlainObject(value)) {
  2594. warn(
  2595. 'v-on without argument expects an Object value',
  2596. this
  2597. );
  2598. } else {
  2599. var on = data.on = data.on ? extend({}, data.on) : {};
  2600. for (var key in value) {
  2601. var existing = on[key];
  2602. var ours = value[key];
  2603. on[key] = existing ? [].concat(existing, ours) : ours;
  2604. }
  2605. }
  2606. }
  2607. return data
  2608. }
  2609. /* */
  2610. function resolveScopedSlots (
  2611. fns, // see flow/vnode
  2612. res,
  2613. // the following are added in 2.6
  2614. hasDynamicKeys,
  2615. contentHashKey
  2616. ) {
  2617. res = res || { $stable: !hasDynamicKeys };
  2618. for (var i = 0; i < fns.length; i++) {
  2619. var slot = fns[i];
  2620. if (Array.isArray(slot)) {
  2621. resolveScopedSlots(slot, res, hasDynamicKeys);
  2622. } else if (slot) {
  2623. // marker for reverse proxying v-slot without scope on this.$slots
  2624. if (slot.proxy) {
  2625. slot.fn.proxy = true;
  2626. }
  2627. res[slot.key] = slot.fn;
  2628. }
  2629. }
  2630. if (contentHashKey) {
  2631. (res).$key = contentHashKey;
  2632. }
  2633. return res
  2634. }
  2635. /* */
  2636. function bindDynamicKeys (baseObj, values) {
  2637. for (var i = 0; i < values.length; i += 2) {
  2638. var key = values[i];
  2639. if (typeof key === 'string' && key) {
  2640. baseObj[values[i]] = values[i + 1];
  2641. } else if (key !== '' && key !== null) {
  2642. // null is a special value for explicitly removing a binding
  2643. warn(
  2644. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2645. this
  2646. );
  2647. }
  2648. }
  2649. return baseObj
  2650. }
  2651. // helper to dynamically append modifier runtime markers to event names.
  2652. // ensure only append when value is already string, otherwise it will be cast
  2653. // to string and cause the type check to miss.
  2654. function prependModifier (value, symbol) {
  2655. return typeof value === 'string' ? symbol + value : value
  2656. }
  2657. /* */
  2658. function installRenderHelpers (target) {
  2659. target._o = markOnce;
  2660. target._n = toNumber;
  2661. target._s = toString;
  2662. target._l = renderList;
  2663. target._t = renderSlot;
  2664. target._q = looseEqual;
  2665. target._i = looseIndexOf;
  2666. target._m = renderStatic;
  2667. target._f = resolveFilter;
  2668. target._k = checkKeyCodes;
  2669. target._b = bindObjectProps;
  2670. target._v = createTextVNode;
  2671. target._e = createEmptyVNode;
  2672. target._u = resolveScopedSlots;
  2673. target._g = bindObjectListeners;
  2674. target._d = bindDynamicKeys;
  2675. target._p = prependModifier;
  2676. }
  2677. /* */
  2678. function FunctionalRenderContext (
  2679. data,
  2680. props,
  2681. children,
  2682. parent,
  2683. Ctor
  2684. ) {
  2685. var this$1 = this;
  2686. var options = Ctor.options;
  2687. // ensure the createElement function in functional components
  2688. // gets a unique context - this is necessary for correct named slot check
  2689. var contextVm;
  2690. if (hasOwn(parent, '_uid')) {
  2691. contextVm = Object.create(parent);
  2692. // $flow-disable-line
  2693. contextVm._original = parent;
  2694. } else {
  2695. // the context vm passed in is a functional context as well.
  2696. // in this case we want to make sure we are able to get a hold to the
  2697. // real context instance.
  2698. contextVm = parent;
  2699. // $flow-disable-line
  2700. parent = parent._original;
  2701. }
  2702. var isCompiled = isTrue(options._compiled);
  2703. var needNormalization = !isCompiled;
  2704. this.data = data;
  2705. this.props = props;
  2706. this.children = children;
  2707. this.parent = parent;
  2708. this.listeners = data.on || emptyObject;
  2709. this.injections = resolveInject(options.inject, parent);
  2710. this.slots = function () {
  2711. if (!this$1.$slots) {
  2712. normalizeScopedSlots(
  2713. data.scopedSlots,
  2714. this$1.$slots = resolveSlots(children, parent)
  2715. );
  2716. }
  2717. return this$1.$slots
  2718. };
  2719. Object.defineProperty(this, 'scopedSlots', ({
  2720. enumerable: true,
  2721. get: function get () {
  2722. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2723. }
  2724. }));
  2725. // support for compiled functional template
  2726. if (isCompiled) {
  2727. // exposing $options for renderStatic()
  2728. this.$options = options;
  2729. // pre-resolve slots for renderSlot()
  2730. this.$slots = this.slots();
  2731. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2732. }
  2733. if (options._scopeId) {
  2734. this._c = function (a, b, c, d) {
  2735. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2736. if (vnode && !Array.isArray(vnode)) {
  2737. vnode.fnScopeId = options._scopeId;
  2738. vnode.fnContext = parent;
  2739. }
  2740. return vnode
  2741. };
  2742. } else {
  2743. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2744. }
  2745. }
  2746. installRenderHelpers(FunctionalRenderContext.prototype);
  2747. function createFunctionalComponent (
  2748. Ctor,
  2749. propsData,
  2750. data,
  2751. contextVm,
  2752. children
  2753. ) {
  2754. var options = Ctor.options;
  2755. var props = {};
  2756. var propOptions = options.props;
  2757. if (isDef(propOptions)) {
  2758. for (var key in propOptions) {
  2759. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2760. }
  2761. } else {
  2762. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2763. if (isDef(data.props)) { mergeProps(props, data.props); }
  2764. }
  2765. var renderContext = new FunctionalRenderContext(
  2766. data,
  2767. props,
  2768. children,
  2769. contextVm,
  2770. Ctor
  2771. );
  2772. var vnode = options.render.call(null, renderContext._c, renderContext);
  2773. if (vnode instanceof VNode) {
  2774. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2775. } else if (Array.isArray(vnode)) {
  2776. var vnodes = normalizeChildren(vnode) || [];
  2777. var res = new Array(vnodes.length);
  2778. for (var i = 0; i < vnodes.length; i++) {
  2779. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2780. }
  2781. return res
  2782. }
  2783. }
  2784. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2785. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2786. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2787. // that should not be matched to match.
  2788. var clone = cloneVNode(vnode);
  2789. clone.fnContext = contextVm;
  2790. clone.fnOptions = options;
  2791. {
  2792. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2793. }
  2794. if (data.slot) {
  2795. (clone.data || (clone.data = {})).slot = data.slot;
  2796. }
  2797. return clone
  2798. }
  2799. function mergeProps (to, from) {
  2800. for (var key in from) {
  2801. to[camelize(key)] = from[key];
  2802. }
  2803. }
  2804. /* */
  2805. /* */
  2806. /* */
  2807. /* */
  2808. // inline hooks to be invoked on component VNodes during patch
  2809. var componentVNodeHooks = {
  2810. init: function init (vnode, hydrating) {
  2811. if (
  2812. vnode.componentInstance &&
  2813. !vnode.componentInstance._isDestroyed &&
  2814. vnode.data.keepAlive
  2815. ) {
  2816. // kept-alive components, treat as a patch
  2817. var mountedNode = vnode; // work around flow
  2818. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2819. } else {
  2820. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2821. vnode,
  2822. activeInstance
  2823. );
  2824. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2825. }
  2826. },
  2827. prepatch: function prepatch (oldVnode, vnode) {
  2828. var options = vnode.componentOptions;
  2829. var child = vnode.componentInstance = oldVnode.componentInstance;
  2830. updateChildComponent(
  2831. child,
  2832. options.propsData, // updated props
  2833. options.listeners, // updated listeners
  2834. vnode, // new parent vnode
  2835. options.children // new children
  2836. );
  2837. },
  2838. insert: function insert (vnode) {
  2839. var context = vnode.context;
  2840. var componentInstance = vnode.componentInstance;
  2841. if (!componentInstance._isMounted) {
  2842. componentInstance._isMounted = true;
  2843. callHook(componentInstance, 'mounted');
  2844. }
  2845. if (vnode.data.keepAlive) {
  2846. if (context._isMounted) {
  2847. // vue-router#1212
  2848. // During updates, a kept-alive component's child components may
  2849. // change, so directly walking the tree here may call activated hooks
  2850. // on incorrect children. Instead we push them into a queue which will
  2851. // be processed after the whole patch process ended.
  2852. queueActivatedComponent(componentInstance);
  2853. } else {
  2854. activateChildComponent(componentInstance, true /* direct */);
  2855. }
  2856. }
  2857. },
  2858. destroy: function destroy (vnode) {
  2859. var componentInstance = vnode.componentInstance;
  2860. if (!componentInstance._isDestroyed) {
  2861. if (!vnode.data.keepAlive) {
  2862. componentInstance.$destroy();
  2863. } else {
  2864. deactivateChildComponent(componentInstance, true /* direct */);
  2865. }
  2866. }
  2867. }
  2868. };
  2869. var hooksToMerge = Object.keys(componentVNodeHooks);
  2870. function createComponent (
  2871. Ctor,
  2872. data,
  2873. context,
  2874. children,
  2875. tag
  2876. ) {
  2877. if (isUndef(Ctor)) {
  2878. return
  2879. }
  2880. var baseCtor = context.$options._base;
  2881. // plain options object: turn it into a constructor
  2882. if (isObject(Ctor)) {
  2883. Ctor = baseCtor.extend(Ctor);
  2884. }
  2885. // if at this stage it's not a constructor or an async component factory,
  2886. // reject.
  2887. if (typeof Ctor !== 'function') {
  2888. {
  2889. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2890. }
  2891. return
  2892. }
  2893. // async component
  2894. var asyncFactory;
  2895. if (isUndef(Ctor.cid)) {
  2896. asyncFactory = Ctor;
  2897. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2898. if (Ctor === undefined) {
  2899. // return a placeholder node for async component, which is rendered
  2900. // as a comment node but preserves all the raw information for the node.
  2901. // the information will be used for async server-rendering and hydration.
  2902. return createAsyncPlaceholder(
  2903. asyncFactory,
  2904. data,
  2905. context,
  2906. children,
  2907. tag
  2908. )
  2909. }
  2910. }
  2911. data = data || {};
  2912. // resolve constructor options in case global mixins are applied after
  2913. // component constructor creation
  2914. resolveConstructorOptions(Ctor);
  2915. // transform component v-model data into props & events
  2916. if (isDef(data.model)) {
  2917. transformModel(Ctor.options, data);
  2918. }
  2919. // extract props
  2920. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2921. // functional component
  2922. if (isTrue(Ctor.options.functional)) {
  2923. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2924. }
  2925. // extract listeners, since these needs to be treated as
  2926. // child component listeners instead of DOM listeners
  2927. var listeners = data.on;
  2928. // replace with listeners with .native modifier
  2929. // so it gets processed during parent component patch.
  2930. data.on = data.nativeOn;
  2931. if (isTrue(Ctor.options.abstract)) {
  2932. // abstract components do not keep anything
  2933. // other than props & listeners & slot
  2934. // work around flow
  2935. var slot = data.slot;
  2936. data = {};
  2937. if (slot) {
  2938. data.slot = slot;
  2939. }
  2940. }
  2941. // install component management hooks onto the placeholder node
  2942. installComponentHooks(data);
  2943. // return a placeholder vnode
  2944. var name = Ctor.options.name || tag;
  2945. var vnode = new VNode(
  2946. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2947. data, undefined, undefined, undefined, context,
  2948. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2949. asyncFactory
  2950. );
  2951. return vnode
  2952. }
  2953. function createComponentInstanceForVnode (
  2954. vnode, // we know it's MountedComponentVNode but flow doesn't
  2955. parent // activeInstance in lifecycle state
  2956. ) {
  2957. var options = {
  2958. _isComponent: true,
  2959. _parentVnode: vnode,
  2960. parent: parent
  2961. };
  2962. // check inline-template render functions
  2963. var inlineTemplate = vnode.data.inlineTemplate;
  2964. if (isDef(inlineTemplate)) {
  2965. options.render = inlineTemplate.render;
  2966. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2967. }
  2968. return new vnode.componentOptions.Ctor(options)
  2969. }
  2970. function installComponentHooks (data) {
  2971. var hooks = data.hook || (data.hook = {});
  2972. for (var i = 0; i < hooksToMerge.length; i++) {
  2973. var key = hooksToMerge[i];
  2974. var existing = hooks[key];
  2975. var toMerge = componentVNodeHooks[key];
  2976. if (existing !== toMerge && !(existing && existing._merged)) {
  2977. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2978. }
  2979. }
  2980. }
  2981. function mergeHook$1 (f1, f2) {
  2982. var merged = function (a, b) {
  2983. // flow complains about extra args which is why we use any
  2984. f1(a, b);
  2985. f2(a, b);
  2986. };
  2987. merged._merged = true;
  2988. return merged
  2989. }
  2990. // transform component v-model info (value and callback) into
  2991. // prop and event handler respectively.
  2992. function transformModel (options, data) {
  2993. var prop = (options.model && options.model.prop) || 'value';
  2994. var event = (options.model && options.model.event) || 'input'
  2995. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  2996. var on = data.on || (data.on = {});
  2997. var existing = on[event];
  2998. var callback = data.model.callback;
  2999. if (isDef(existing)) {
  3000. if (
  3001. Array.isArray(existing)
  3002. ? existing.indexOf(callback) === -1
  3003. : existing !== callback
  3004. ) {
  3005. on[event] = [callback].concat(existing);
  3006. }
  3007. } else {
  3008. on[event] = callback;
  3009. }
  3010. }
  3011. /* */
  3012. var SIMPLE_NORMALIZE = 1;
  3013. var ALWAYS_NORMALIZE = 2;
  3014. // wrapper function for providing a more flexible interface
  3015. // without getting yelled at by flow
  3016. function createElement (
  3017. context,
  3018. tag,
  3019. data,
  3020. children,
  3021. normalizationType,
  3022. alwaysNormalize
  3023. ) {
  3024. if (Array.isArray(data) || isPrimitive(data)) {
  3025. normalizationType = children;
  3026. children = data;
  3027. data = undefined;
  3028. }
  3029. if (isTrue(alwaysNormalize)) {
  3030. normalizationType = ALWAYS_NORMALIZE;
  3031. }
  3032. return _createElement(context, tag, data, children, normalizationType)
  3033. }
  3034. function _createElement (
  3035. context,
  3036. tag,
  3037. data,
  3038. children,
  3039. normalizationType
  3040. ) {
  3041. if (isDef(data) && isDef((data).__ob__)) {
  3042. warn(
  3043. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3044. 'Always create fresh vnode data objects in each render!',
  3045. context
  3046. );
  3047. return createEmptyVNode()
  3048. }
  3049. // object syntax in v-bind
  3050. if (isDef(data) && isDef(data.is)) {
  3051. tag = data.is;
  3052. }
  3053. if (!tag) {
  3054. // in case of component :is set to falsy value
  3055. return createEmptyVNode()
  3056. }
  3057. // warn against non-primitive key
  3058. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3059. ) {
  3060. {
  3061. warn(
  3062. 'Avoid using non-primitive value as key, ' +
  3063. 'use string/number value instead.',
  3064. context
  3065. );
  3066. }
  3067. }
  3068. // support single function children as default scoped slot
  3069. if (Array.isArray(children) &&
  3070. typeof children[0] === 'function'
  3071. ) {
  3072. data = data || {};
  3073. data.scopedSlots = { default: children[0] };
  3074. children.length = 0;
  3075. }
  3076. if (normalizationType === ALWAYS_NORMALIZE) {
  3077. children = normalizeChildren(children);
  3078. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3079. children = simpleNormalizeChildren(children);
  3080. }
  3081. var vnode, ns;
  3082. if (typeof tag === 'string') {
  3083. var Ctor;
  3084. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3085. if (config.isReservedTag(tag)) {
  3086. // platform built-in elements
  3087. if (isDef(data) && isDef(data.nativeOn)) {
  3088. warn(
  3089. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3090. context
  3091. );
  3092. }
  3093. vnode = new VNode(
  3094. config.parsePlatformTagName(tag), data, children,
  3095. undefined, undefined, context
  3096. );
  3097. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3098. // component
  3099. vnode = createComponent(Ctor, data, context, children, tag);
  3100. } else {
  3101. // unknown or unlisted namespaced elements
  3102. // check at runtime because it may get assigned a namespace when its
  3103. // parent normalizes children
  3104. vnode = new VNode(
  3105. tag, data, children,
  3106. undefined, undefined, context
  3107. );
  3108. }
  3109. } else {
  3110. // direct component options / constructor
  3111. vnode = createComponent(tag, data, context, children);
  3112. }
  3113. if (Array.isArray(vnode)) {
  3114. return vnode
  3115. } else if (isDef(vnode)) {
  3116. if (isDef(ns)) { applyNS(vnode, ns); }
  3117. if (isDef(data)) { registerDeepBindings(data); }
  3118. return vnode
  3119. } else {
  3120. return createEmptyVNode()
  3121. }
  3122. }
  3123. function applyNS (vnode, ns, force) {
  3124. vnode.ns = ns;
  3125. if (vnode.tag === 'foreignObject') {
  3126. // use default namespace inside foreignObject
  3127. ns = undefined;
  3128. force = true;
  3129. }
  3130. if (isDef(vnode.children)) {
  3131. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3132. var child = vnode.children[i];
  3133. if (isDef(child.tag) && (
  3134. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3135. applyNS(child, ns, force);
  3136. }
  3137. }
  3138. }
  3139. }
  3140. // ref #5318
  3141. // necessary to ensure parent re-render when deep bindings like :style and
  3142. // :class are used on slot nodes
  3143. function registerDeepBindings (data) {
  3144. if (isObject(data.style)) {
  3145. traverse(data.style);
  3146. }
  3147. if (isObject(data.class)) {
  3148. traverse(data.class);
  3149. }
  3150. }
  3151. /* */
  3152. function initRender (vm) {
  3153. vm._vnode = null; // the root of the child tree
  3154. vm._staticTrees = null; // v-once cached trees
  3155. var options = vm.$options;
  3156. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3157. var renderContext = parentVnode && parentVnode.context;
  3158. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3159. vm.$scopedSlots = emptyObject;
  3160. // bind the createElement fn to this instance
  3161. // so that we get proper render context inside it.
  3162. // args order: tag, data, children, normalizationType, alwaysNormalize
  3163. // internal version is used by render functions compiled from templates
  3164. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3165. // normalization is always applied for the public version, used in
  3166. // user-written render functions.
  3167. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3168. // $attrs & $listeners are exposed for easier HOC creation.
  3169. // they need to be reactive so that HOCs using them are always updated
  3170. var parentData = parentVnode && parentVnode.data;
  3171. /* istanbul ignore else */
  3172. {
  3173. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3174. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3175. }, true);
  3176. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3177. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3178. }, true);
  3179. }
  3180. }
  3181. var currentRenderingInstance = null;
  3182. function renderMixin (Vue) {
  3183. // install runtime convenience helpers
  3184. installRenderHelpers(Vue.prototype);
  3185. Vue.prototype.$nextTick = function (fn) {
  3186. return nextTick(fn, this)
  3187. };
  3188. Vue.prototype._render = function () {
  3189. var vm = this;
  3190. var ref = vm.$options;
  3191. var render = ref.render;
  3192. var _parentVnode = ref._parentVnode;
  3193. if (_parentVnode) {
  3194. vm.$scopedSlots = normalizeScopedSlots(
  3195. _parentVnode.data.scopedSlots,
  3196. vm.$slots,
  3197. vm.$scopedSlots
  3198. );
  3199. }
  3200. // set parent vnode. this allows render functions to have access
  3201. // to the data on the placeholder node.
  3202. vm.$vnode = _parentVnode;
  3203. // render self
  3204. var vnode;
  3205. try {
  3206. // There's no need to maintain a stack because all render fns are called
  3207. // separately from one another. Nested component's render fns are called
  3208. // when parent component is patched.
  3209. currentRenderingInstance = vm;
  3210. vnode = render.call(vm._renderProxy, vm.$createElement);
  3211. } catch (e) {
  3212. handleError(e, vm, "render");
  3213. // return error render result,
  3214. // or previous vnode to prevent render error causing blank component
  3215. /* istanbul ignore else */
  3216. if (vm.$options.renderError) {
  3217. try {
  3218. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3219. } catch (e) {
  3220. handleError(e, vm, "renderError");
  3221. vnode = vm._vnode;
  3222. }
  3223. } else {
  3224. vnode = vm._vnode;
  3225. }
  3226. } finally {
  3227. currentRenderingInstance = null;
  3228. }
  3229. // if the returned array contains only a single node, allow it
  3230. if (Array.isArray(vnode) && vnode.length === 1) {
  3231. vnode = vnode[0];
  3232. }
  3233. // return empty vnode in case the render function errored out
  3234. if (!(vnode instanceof VNode)) {
  3235. if (Array.isArray(vnode)) {
  3236. warn(
  3237. 'Multiple root nodes returned from render function. Render function ' +
  3238. 'should return a single root node.',
  3239. vm
  3240. );
  3241. }
  3242. vnode = createEmptyVNode();
  3243. }
  3244. // set parent
  3245. vnode.parent = _parentVnode;
  3246. return vnode
  3247. };
  3248. }
  3249. /* */
  3250. function ensureCtor (comp, base) {
  3251. if (
  3252. comp.__esModule ||
  3253. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3254. ) {
  3255. comp = comp.default;
  3256. }
  3257. return isObject(comp)
  3258. ? base.extend(comp)
  3259. : comp
  3260. }
  3261. function createAsyncPlaceholder (
  3262. factory,
  3263. data,
  3264. context,
  3265. children,
  3266. tag
  3267. ) {
  3268. var node = createEmptyVNode();
  3269. node.asyncFactory = factory;
  3270. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3271. return node
  3272. }
  3273. function resolveAsyncComponent (
  3274. factory,
  3275. baseCtor
  3276. ) {
  3277. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3278. return factory.errorComp
  3279. }
  3280. if (isDef(factory.resolved)) {
  3281. return factory.resolved
  3282. }
  3283. var owner = currentRenderingInstance;
  3284. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3285. // already pending
  3286. factory.owners.push(owner);
  3287. }
  3288. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3289. return factory.loadingComp
  3290. }
  3291. if (owner && !isDef(factory.owners)) {
  3292. var owners = factory.owners = [owner];
  3293. var sync = true;
  3294. var timerLoading = null;
  3295. var timerTimeout = null
  3296. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3297. var forceRender = function (renderCompleted) {
  3298. for (var i = 0, l = owners.length; i < l; i++) {
  3299. (owners[i]).$forceUpdate();
  3300. }
  3301. if (renderCompleted) {
  3302. owners.length = 0;
  3303. if (timerLoading !== null) {
  3304. clearTimeout(timerLoading);
  3305. timerLoading = null;
  3306. }
  3307. if (timerTimeout !== null) {
  3308. clearTimeout(timerTimeout);
  3309. timerTimeout = null;
  3310. }
  3311. }
  3312. };
  3313. var resolve = once(function (res) {
  3314. // cache resolved
  3315. factory.resolved = ensureCtor(res, baseCtor);
  3316. // invoke callbacks only if this is not a synchronous resolve
  3317. // (async resolves are shimmed as synchronous during SSR)
  3318. if (!sync) {
  3319. forceRender(true);
  3320. } else {
  3321. owners.length = 0;
  3322. }
  3323. });
  3324. var reject = once(function (reason) {
  3325. warn(
  3326. "Failed to resolve async component: " + (String(factory)) +
  3327. (reason ? ("\nReason: " + reason) : '')
  3328. );
  3329. if (isDef(factory.errorComp)) {
  3330. factory.error = true;
  3331. forceRender(true);
  3332. }
  3333. });
  3334. var res = factory(resolve, reject);
  3335. if (isObject(res)) {
  3336. if (isPromise(res)) {
  3337. // () => Promise
  3338. if (isUndef(factory.resolved)) {
  3339. res.then(resolve, reject);
  3340. }
  3341. } else if (isPromise(res.component)) {
  3342. res.component.then(resolve, reject);
  3343. if (isDef(res.error)) {
  3344. factory.errorComp = ensureCtor(res.error, baseCtor);
  3345. }
  3346. if (isDef(res.loading)) {
  3347. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3348. if (res.delay === 0) {
  3349. factory.loading = true;
  3350. } else {
  3351. timerLoading = setTimeout(function () {
  3352. timerLoading = null;
  3353. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3354. factory.loading = true;
  3355. forceRender(false);
  3356. }
  3357. }, res.delay || 200);
  3358. }
  3359. }
  3360. if (isDef(res.timeout)) {
  3361. timerTimeout = setTimeout(function () {
  3362. timerTimeout = null;
  3363. if (isUndef(factory.resolved)) {
  3364. reject(
  3365. "timeout (" + (res.timeout) + "ms)"
  3366. );
  3367. }
  3368. }, res.timeout);
  3369. }
  3370. }
  3371. }
  3372. sync = false;
  3373. // return in case resolved synchronously
  3374. return factory.loading
  3375. ? factory.loadingComp
  3376. : factory.resolved
  3377. }
  3378. }
  3379. /* */
  3380. function isAsyncPlaceholder (node) {
  3381. return node.isComment && node.asyncFactory
  3382. }
  3383. /* */
  3384. function getFirstComponentChild (children) {
  3385. if (Array.isArray(children)) {
  3386. for (var i = 0; i < children.length; i++) {
  3387. var c = children[i];
  3388. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3389. return c
  3390. }
  3391. }
  3392. }
  3393. }
  3394. /* */
  3395. /* */
  3396. function initEvents (vm) {
  3397. vm._events = Object.create(null);
  3398. vm._hasHookEvent = false;
  3399. // init parent attached events
  3400. var listeners = vm.$options._parentListeners;
  3401. if (listeners) {
  3402. updateComponentListeners(vm, listeners);
  3403. }
  3404. }
  3405. var target;
  3406. function add (event, fn) {
  3407. target.$on(event, fn);
  3408. }
  3409. function remove$1 (event, fn) {
  3410. target.$off(event, fn);
  3411. }
  3412. function createOnceHandler (event, fn) {
  3413. var _target = target;
  3414. return function onceHandler () {
  3415. var res = fn.apply(null, arguments);
  3416. if (res !== null) {
  3417. _target.$off(event, onceHandler);
  3418. }
  3419. }
  3420. }
  3421. function updateComponentListeners (
  3422. vm,
  3423. listeners,
  3424. oldListeners
  3425. ) {
  3426. target = vm;
  3427. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3428. target = undefined;
  3429. }
  3430. function eventsMixin (Vue) {
  3431. var hookRE = /^hook:/;
  3432. Vue.prototype.$on = function (event, fn) {
  3433. var vm = this;
  3434. if (Array.isArray(event)) {
  3435. for (var i = 0, l = event.length; i < l; i++) {
  3436. vm.$on(event[i], fn);
  3437. }
  3438. } else {
  3439. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3440. // optimize hook:event cost by using a boolean flag marked at registration
  3441. // instead of a hash lookup
  3442. if (hookRE.test(event)) {
  3443. vm._hasHookEvent = true;
  3444. }
  3445. }
  3446. return vm
  3447. };
  3448. Vue.prototype.$once = function (event, fn) {
  3449. var vm = this;
  3450. function on () {
  3451. vm.$off(event, on);
  3452. fn.apply(vm, arguments);
  3453. }
  3454. on.fn = fn;
  3455. vm.$on(event, on);
  3456. return vm
  3457. };
  3458. Vue.prototype.$off = function (event, fn) {
  3459. var vm = this;
  3460. // all
  3461. if (!arguments.length) {
  3462. vm._events = Object.create(null);
  3463. return vm
  3464. }
  3465. // array of events
  3466. if (Array.isArray(event)) {
  3467. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3468. vm.$off(event[i$1], fn);
  3469. }
  3470. return vm
  3471. }
  3472. // specific event
  3473. var cbs = vm._events[event];
  3474. if (!cbs) {
  3475. return vm
  3476. }
  3477. if (!fn) {
  3478. vm._events[event] = null;
  3479. return vm
  3480. }
  3481. // specific handler
  3482. var cb;
  3483. var i = cbs.length;
  3484. while (i--) {
  3485. cb = cbs[i];
  3486. if (cb === fn || cb.fn === fn) {
  3487. cbs.splice(i, 1);
  3488. break
  3489. }
  3490. }
  3491. return vm
  3492. };
  3493. Vue.prototype.$emit = function (event) {
  3494. var vm = this;
  3495. {
  3496. var lowerCaseEvent = event.toLowerCase();
  3497. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3498. tip(
  3499. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3500. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3501. "Note that HTML attributes are case-insensitive and you cannot use " +
  3502. "v-on to listen to camelCase events when using in-DOM templates. " +
  3503. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3504. );
  3505. }
  3506. }
  3507. var cbs = vm._events[event];
  3508. if (cbs) {
  3509. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3510. var args = toArray(arguments, 1);
  3511. var info = "event handler for \"" + event + "\"";
  3512. for (var i = 0, l = cbs.length; i < l; i++) {
  3513. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3514. }
  3515. }
  3516. return vm
  3517. };
  3518. }
  3519. /* */
  3520. var activeInstance = null;
  3521. var isUpdatingChildComponent = false;
  3522. function setActiveInstance(vm) {
  3523. var prevActiveInstance = activeInstance;
  3524. activeInstance = vm;
  3525. return function () {
  3526. activeInstance = prevActiveInstance;
  3527. }
  3528. }
  3529. function initLifecycle (vm) {
  3530. var options = vm.$options;
  3531. // locate first non-abstract parent
  3532. var parent = options.parent;
  3533. if (parent && !options.abstract) {
  3534. while (parent.$options.abstract && parent.$parent) {
  3535. parent = parent.$parent;
  3536. }
  3537. parent.$children.push(vm);
  3538. }
  3539. vm.$parent = parent;
  3540. vm.$root = parent ? parent.$root : vm;
  3541. vm.$children = [];
  3542. vm.$refs = {};
  3543. vm._watcher = null;
  3544. vm._inactive = null;
  3545. vm._directInactive = false;
  3546. vm._isMounted = false;
  3547. vm._isDestroyed = false;
  3548. vm._isBeingDestroyed = false;
  3549. }
  3550. function lifecycleMixin (Vue) {
  3551. Vue.prototype._update = function (vnode, hydrating) {
  3552. var vm = this;
  3553. var prevEl = vm.$el;
  3554. var prevVnode = vm._vnode;
  3555. var restoreActiveInstance = setActiveInstance(vm);
  3556. vm._vnode = vnode;
  3557. // Vue.prototype.__patch__ is injected in entry points
  3558. // based on the rendering backend used.
  3559. if (!prevVnode) {
  3560. // initial render
  3561. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3562. } else {
  3563. // updates
  3564. vm.$el = vm.__patch__(prevVnode, vnode);
  3565. }
  3566. restoreActiveInstance();
  3567. // update __vue__ reference
  3568. if (prevEl) {
  3569. prevEl.__vue__ = null;
  3570. }
  3571. if (vm.$el) {
  3572. vm.$el.__vue__ = vm;
  3573. }
  3574. // if parent is an HOC, update its $el as well
  3575. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3576. vm.$parent.$el = vm.$el;
  3577. }
  3578. // updated hook is called by the scheduler to ensure that children are
  3579. // updated in a parent's updated hook.
  3580. };
  3581. Vue.prototype.$forceUpdate = function () {
  3582. var vm = this;
  3583. if (vm._watcher) {
  3584. vm._watcher.update();
  3585. }
  3586. };
  3587. Vue.prototype.$destroy = function () {
  3588. var vm = this;
  3589. if (vm._isBeingDestroyed) {
  3590. return
  3591. }
  3592. callHook(vm, 'beforeDestroy');
  3593. vm._isBeingDestroyed = true;
  3594. // remove self from parent
  3595. var parent = vm.$parent;
  3596. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3597. remove(parent.$children, vm);
  3598. }
  3599. // teardown watchers
  3600. if (vm._watcher) {
  3601. vm._watcher.teardown();
  3602. }
  3603. var i = vm._watchers.length;
  3604. while (i--) {
  3605. vm._watchers[i].teardown();
  3606. }
  3607. // remove reference from data ob
  3608. // frozen object may not have observer.
  3609. if (vm._data.__ob__) {
  3610. vm._data.__ob__.vmCount--;
  3611. }
  3612. // call the last hook...
  3613. vm._isDestroyed = true;
  3614. // invoke destroy hooks on current rendered tree
  3615. vm.__patch__(vm._vnode, null);
  3616. // fire destroyed hook
  3617. callHook(vm, 'destroyed');
  3618. // turn off all instance listeners.
  3619. vm.$off();
  3620. // remove __vue__ reference
  3621. if (vm.$el) {
  3622. vm.$el.__vue__ = null;
  3623. }
  3624. // release circular reference (#6759)
  3625. if (vm.$vnode) {
  3626. vm.$vnode.parent = null;
  3627. }
  3628. };
  3629. }
  3630. function mountComponent (
  3631. vm,
  3632. el,
  3633. hydrating
  3634. ) {
  3635. vm.$el = el;
  3636. if (!vm.$options.render) {
  3637. vm.$options.render = createEmptyVNode;
  3638. {
  3639. /* istanbul ignore if */
  3640. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3641. vm.$options.el || el) {
  3642. warn(
  3643. 'You are using the runtime-only build of Vue where the template ' +
  3644. 'compiler is not available. Either pre-compile the templates into ' +
  3645. 'render functions, or use the compiler-included build.',
  3646. vm
  3647. );
  3648. } else {
  3649. warn(
  3650. 'Failed to mount component: template or render function not defined.',
  3651. vm
  3652. );
  3653. }
  3654. }
  3655. }
  3656. callHook(vm, 'beforeMount');
  3657. var updateComponent;
  3658. /* istanbul ignore if */
  3659. if (config.performance && mark) {
  3660. updateComponent = function () {
  3661. var name = vm._name;
  3662. var id = vm._uid;
  3663. var startTag = "vue-perf-start:" + id;
  3664. var endTag = "vue-perf-end:" + id;
  3665. mark(startTag);
  3666. var vnode = vm._render();
  3667. mark(endTag);
  3668. measure(("vue " + name + " render"), startTag, endTag);
  3669. mark(startTag);
  3670. vm._update(vnode, hydrating);
  3671. mark(endTag);
  3672. measure(("vue " + name + " patch"), startTag, endTag);
  3673. };
  3674. } else {
  3675. updateComponent = function () {
  3676. vm._update(vm._render(), hydrating);
  3677. };
  3678. }
  3679. // we set this to vm._watcher inside the watcher's constructor
  3680. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3681. // component's mounted hook), which relies on vm._watcher being already defined
  3682. new Watcher(vm, updateComponent, noop, {
  3683. before: function before () {
  3684. if (vm._isMounted && !vm._isDestroyed) {
  3685. callHook(vm, 'beforeUpdate');
  3686. }
  3687. }
  3688. }, true /* isRenderWatcher */);
  3689. hydrating = false;
  3690. // manually mounted instance, call mounted on self
  3691. // mounted is called for render-created child components in its inserted hook
  3692. if (vm.$vnode == null) {
  3693. vm._isMounted = true;
  3694. callHook(vm, 'mounted');
  3695. }
  3696. return vm
  3697. }
  3698. function updateChildComponent (
  3699. vm,
  3700. propsData,
  3701. listeners,
  3702. parentVnode,
  3703. renderChildren
  3704. ) {
  3705. {
  3706. isUpdatingChildComponent = true;
  3707. }
  3708. // determine whether component has slot children
  3709. // we need to do this before overwriting $options._renderChildren.
  3710. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3711. // dynamic slot names). Static scoped slots compiled from template has the
  3712. // "$stable" marker.
  3713. var newScopedSlots = parentVnode.data.scopedSlots;
  3714. var oldScopedSlots = vm.$scopedSlots;
  3715. var hasDynamicScopedSlot = !!(
  3716. (newScopedSlots && !newScopedSlots.$stable) ||
  3717. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3718. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3719. );
  3720. // Any static slot children from the parent may have changed during parent's
  3721. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3722. // update is necessary to ensure correctness.
  3723. var needsForceUpdate = !!(
  3724. renderChildren || // has new static slots
  3725. vm.$options._renderChildren || // has old static slots
  3726. hasDynamicScopedSlot
  3727. );
  3728. vm.$options._parentVnode = parentVnode;
  3729. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3730. if (vm._vnode) { // update child tree's parent
  3731. vm._vnode.parent = parentVnode;
  3732. }
  3733. vm.$options._renderChildren = renderChildren;
  3734. // update $attrs and $listeners hash
  3735. // these are also reactive so they may trigger child update if the child
  3736. // used them during render
  3737. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3738. vm.$listeners = listeners || emptyObject;
  3739. // update props
  3740. if (propsData && vm.$options.props) {
  3741. toggleObserving(false);
  3742. var props = vm._props;
  3743. var propKeys = vm.$options._propKeys || [];
  3744. for (var i = 0; i < propKeys.length; i++) {
  3745. var key = propKeys[i];
  3746. var propOptions = vm.$options.props; // wtf flow?
  3747. props[key] = validateProp(key, propOptions, propsData, vm);
  3748. }
  3749. toggleObserving(true);
  3750. // keep a copy of raw propsData
  3751. vm.$options.propsData = propsData;
  3752. }
  3753. // update listeners
  3754. listeners = listeners || emptyObject;
  3755. var oldListeners = vm.$options._parentListeners;
  3756. vm.$options._parentListeners = listeners;
  3757. updateComponentListeners(vm, listeners, oldListeners);
  3758. // resolve slots + force update if has children
  3759. if (needsForceUpdate) {
  3760. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3761. vm.$forceUpdate();
  3762. }
  3763. {
  3764. isUpdatingChildComponent = false;
  3765. }
  3766. }
  3767. function isInInactiveTree (vm) {
  3768. while (vm && (vm = vm.$parent)) {
  3769. if (vm._inactive) { return true }
  3770. }
  3771. return false
  3772. }
  3773. function activateChildComponent (vm, direct) {
  3774. if (direct) {
  3775. vm._directInactive = false;
  3776. if (isInInactiveTree(vm)) {
  3777. return
  3778. }
  3779. } else if (vm._directInactive) {
  3780. return
  3781. }
  3782. if (vm._inactive || vm._inactive === null) {
  3783. vm._inactive = false;
  3784. for (var i = 0; i < vm.$children.length; i++) {
  3785. activateChildComponent(vm.$children[i]);
  3786. }
  3787. callHook(vm, 'activated');
  3788. }
  3789. }
  3790. function deactivateChildComponent (vm, direct) {
  3791. if (direct) {
  3792. vm._directInactive = true;
  3793. if (isInInactiveTree(vm)) {
  3794. return
  3795. }
  3796. }
  3797. if (!vm._inactive) {
  3798. vm._inactive = true;
  3799. for (var i = 0; i < vm.$children.length; i++) {
  3800. deactivateChildComponent(vm.$children[i]);
  3801. }
  3802. callHook(vm, 'deactivated');
  3803. }
  3804. }
  3805. function callHook (vm, hook) {
  3806. // #7573 disable dep collection when invoking lifecycle hooks
  3807. pushTarget();
  3808. var handlers = vm.$options[hook];
  3809. var info = hook + " hook";
  3810. if (handlers) {
  3811. for (var i = 0, j = handlers.length; i < j; i++) {
  3812. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3813. }
  3814. }
  3815. if (vm._hasHookEvent) {
  3816. vm.$emit('hook:' + hook);
  3817. }
  3818. popTarget();
  3819. }
  3820. /* */
  3821. var MAX_UPDATE_COUNT = 100;
  3822. var queue = [];
  3823. var activatedChildren = [];
  3824. var has = {};
  3825. var circular = {};
  3826. var waiting = false;
  3827. var flushing = false;
  3828. var index = 0;
  3829. /**
  3830. * Reset the scheduler's state.
  3831. */
  3832. function resetSchedulerState () {
  3833. index = queue.length = activatedChildren.length = 0;
  3834. has = {};
  3835. {
  3836. circular = {};
  3837. }
  3838. waiting = flushing = false;
  3839. }
  3840. // Async edge case #6566 requires saving the timestamp when event listeners are
  3841. // attached. However, calling performance.now() has a perf overhead especially
  3842. // if the page has thousands of event listeners. Instead, we take a timestamp
  3843. // every time the scheduler flushes and use that for all event listeners
  3844. // attached during that flush.
  3845. var currentFlushTimestamp = 0;
  3846. // Async edge case fix requires storing an event listener's attach timestamp.
  3847. var getNow = Date.now;
  3848. // Determine what event timestamp the browser is using. Annoyingly, the
  3849. // timestamp can either be hi-res (relative to page load) or low-res
  3850. // (relative to UNIX epoch), so in order to compare time we have to use the
  3851. // same timestamp type when saving the flush timestamp.
  3852. // All IE versions use low-res event timestamps, and have problematic clock
  3853. // implementations (#9632)
  3854. if (inBrowser && !isIE) {
  3855. var performance = window.performance;
  3856. if (
  3857. performance &&
  3858. typeof performance.now === 'function' &&
  3859. getNow() > document.createEvent('Event').timeStamp
  3860. ) {
  3861. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3862. // smaller than it, it means the event is using a hi-res timestamp,
  3863. // and we need to use the hi-res version for event listener timestamps as
  3864. // well.
  3865. getNow = function () { return performance.now(); };
  3866. }
  3867. }
  3868. /**
  3869. * Flush both queues and run the watchers.
  3870. */
  3871. function flushSchedulerQueue () {
  3872. currentFlushTimestamp = getNow();
  3873. flushing = true;
  3874. var watcher, id;
  3875. // Sort queue before flush.
  3876. // This ensures that:
  3877. // 1. Components are updated from parent to child. (because parent is always
  3878. // created before the child)
  3879. // 2. A component's user watchers are run before its render watcher (because
  3880. // user watchers are created before the render watcher)
  3881. // 3. If a component is destroyed during a parent component's watcher run,
  3882. // its watchers can be skipped.
  3883. queue.sort(function (a, b) { return a.id - b.id; });
  3884. // do not cache length because more watchers might be pushed
  3885. // as we run existing watchers
  3886. for (index = 0; index < queue.length; index++) {
  3887. watcher = queue[index];
  3888. if (watcher.before) {
  3889. watcher.before();
  3890. }
  3891. id = watcher.id;
  3892. has[id] = null;
  3893. watcher.run();
  3894. // in dev build, check and stop circular updates.
  3895. if (has[id] != null) {
  3896. circular[id] = (circular[id] || 0) + 1;
  3897. if (circular[id] > MAX_UPDATE_COUNT) {
  3898. warn(
  3899. 'You may have an infinite update loop ' + (
  3900. watcher.user
  3901. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3902. : "in a component render function."
  3903. ),
  3904. watcher.vm
  3905. );
  3906. break
  3907. }
  3908. }
  3909. }
  3910. // keep copies of post queues before resetting state
  3911. var activatedQueue = activatedChildren.slice();
  3912. var updatedQueue = queue.slice();
  3913. resetSchedulerState();
  3914. // call component updated and activated hooks
  3915. callActivatedHooks(activatedQueue);
  3916. callUpdatedHooks(updatedQueue);
  3917. // devtool hook
  3918. /* istanbul ignore if */
  3919. if (devtools && config.devtools) {
  3920. devtools.emit('flush');
  3921. }
  3922. }
  3923. function callUpdatedHooks (queue) {
  3924. var i = queue.length;
  3925. while (i--) {
  3926. var watcher = queue[i];
  3927. var vm = watcher.vm;
  3928. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3929. callHook(vm, 'updated');
  3930. }
  3931. }
  3932. }
  3933. /**
  3934. * Queue a kept-alive component that was activated during patch.
  3935. * The queue will be processed after the entire tree has been patched.
  3936. */
  3937. function queueActivatedComponent (vm) {
  3938. // setting _inactive to false here so that a render function can
  3939. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3940. vm._inactive = false;
  3941. activatedChildren.push(vm);
  3942. }
  3943. function callActivatedHooks (queue) {
  3944. for (var i = 0; i < queue.length; i++) {
  3945. queue[i]._inactive = true;
  3946. activateChildComponent(queue[i], true /* true */);
  3947. }
  3948. }
  3949. /**
  3950. * Push a watcher into the watcher queue.
  3951. * Jobs with duplicate IDs will be skipped unless it's
  3952. * pushed when the queue is being flushed.
  3953. */
  3954. function queueWatcher (watcher) {
  3955. var id = watcher.id;
  3956. if (has[id] == null) {
  3957. has[id] = true;
  3958. if (!flushing) {
  3959. queue.push(watcher);
  3960. } else {
  3961. // if already flushing, splice the watcher based on its id
  3962. // if already past its id, it will be run next immediately.
  3963. var i = queue.length - 1;
  3964. while (i > index && queue[i].id > watcher.id) {
  3965. i--;
  3966. }
  3967. queue.splice(i + 1, 0, watcher);
  3968. }
  3969. // queue the flush
  3970. if (!waiting) {
  3971. waiting = true;
  3972. if (!config.async) {
  3973. flushSchedulerQueue();
  3974. return
  3975. }
  3976. nextTick(flushSchedulerQueue);
  3977. }
  3978. }
  3979. }
  3980. /* */
  3981. var uid$2 = 0;
  3982. /**
  3983. * A watcher parses an expression, collects dependencies,
  3984. * and fires callback when the expression value changes.
  3985. * This is used for both the $watch() api and directives.
  3986. */
  3987. var Watcher = function Watcher (
  3988. vm,
  3989. expOrFn,
  3990. cb,
  3991. options,
  3992. isRenderWatcher
  3993. ) {
  3994. this.vm = vm;
  3995. if (isRenderWatcher) {
  3996. vm._watcher = this;
  3997. }
  3998. vm._watchers.push(this);
  3999. // options
  4000. if (options) {
  4001. this.deep = !!options.deep;
  4002. this.user = !!options.user;
  4003. this.lazy = !!options.lazy;
  4004. this.sync = !!options.sync;
  4005. this.before = options.before;
  4006. } else {
  4007. this.deep = this.user = this.lazy = this.sync = false;
  4008. }
  4009. this.cb = cb;
  4010. this.id = ++uid$2; // uid for batching
  4011. this.active = true;
  4012. this.dirty = this.lazy; // for lazy watchers
  4013. this.deps = [];
  4014. this.newDeps = [];
  4015. this.depIds = new _Set();
  4016. this.newDepIds = new _Set();
  4017. this.expression = expOrFn.toString();
  4018. // parse expression for getter
  4019. if (typeof expOrFn === 'function') {
  4020. this.getter = expOrFn;
  4021. } else {
  4022. this.getter = parsePath(expOrFn);
  4023. if (!this.getter) {
  4024. this.getter = noop;
  4025. warn(
  4026. "Failed watching path: \"" + expOrFn + "\" " +
  4027. 'Watcher only accepts simple dot-delimited paths. ' +
  4028. 'For full control, use a function instead.',
  4029. vm
  4030. );
  4031. }
  4032. }
  4033. this.value = this.lazy
  4034. ? undefined
  4035. : this.get();
  4036. };
  4037. /**
  4038. * Evaluate the getter, and re-collect dependencies.
  4039. */
  4040. Watcher.prototype.get = function get () {
  4041. pushTarget(this);
  4042. var value;
  4043. var vm = this.vm;
  4044. try {
  4045. value = this.getter.call(vm, vm);
  4046. } catch (e) {
  4047. if (this.user) {
  4048. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4049. } else {
  4050. throw e
  4051. }
  4052. } finally {
  4053. // "touch" every property so they are all tracked as
  4054. // dependencies for deep watching
  4055. if (this.deep) {
  4056. traverse(value);
  4057. }
  4058. popTarget();
  4059. this.cleanupDeps();
  4060. }
  4061. return value
  4062. };
  4063. /**
  4064. * Add a dependency to this directive.
  4065. */
  4066. Watcher.prototype.addDep = function addDep (dep) {
  4067. var id = dep.id;
  4068. if (!this.newDepIds.has(id)) {
  4069. this.newDepIds.add(id);
  4070. this.newDeps.push(dep);
  4071. if (!this.depIds.has(id)) {
  4072. dep.addSub(this);
  4073. }
  4074. }
  4075. };
  4076. /**
  4077. * Clean up for dependency collection.
  4078. */
  4079. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4080. var i = this.deps.length;
  4081. while (i--) {
  4082. var dep = this.deps[i];
  4083. if (!this.newDepIds.has(dep.id)) {
  4084. dep.removeSub(this);
  4085. }
  4086. }
  4087. var tmp = this.depIds;
  4088. this.depIds = this.newDepIds;
  4089. this.newDepIds = tmp;
  4090. this.newDepIds.clear();
  4091. tmp = this.deps;
  4092. this.deps = this.newDeps;
  4093. this.newDeps = tmp;
  4094. this.newDeps.length = 0;
  4095. };
  4096. /**
  4097. * Subscriber interface.
  4098. * Will be called when a dependency changes.
  4099. */
  4100. Watcher.prototype.update = function update () {
  4101. /* istanbul ignore else */
  4102. if (this.lazy) {
  4103. this.dirty = true;
  4104. } else if (this.sync) {
  4105. this.run();
  4106. } else {
  4107. queueWatcher(this);
  4108. }
  4109. };
  4110. /**
  4111. * Scheduler job interface.
  4112. * Will be called by the scheduler.
  4113. */
  4114. Watcher.prototype.run = function run () {
  4115. if (this.active) {
  4116. var value = this.get();
  4117. if (
  4118. value !== this.value ||
  4119. // Deep watchers and watchers on Object/Arrays should fire even
  4120. // when the value is the same, because the value may
  4121. // have mutated.
  4122. isObject(value) ||
  4123. this.deep
  4124. ) {
  4125. // set new value
  4126. var oldValue = this.value;
  4127. this.value = value;
  4128. if (this.user) {
  4129. try {
  4130. this.cb.call(this.vm, value, oldValue);
  4131. } catch (e) {
  4132. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4133. }
  4134. } else {
  4135. this.cb.call(this.vm, value, oldValue);
  4136. }
  4137. }
  4138. }
  4139. };
  4140. /**
  4141. * Evaluate the value of the watcher.
  4142. * This only gets called for lazy watchers.
  4143. */
  4144. Watcher.prototype.evaluate = function evaluate () {
  4145. this.value = this.get();
  4146. this.dirty = false;
  4147. };
  4148. /**
  4149. * Depend on all deps collected by this watcher.
  4150. */
  4151. Watcher.prototype.depend = function depend () {
  4152. var i = this.deps.length;
  4153. while (i--) {
  4154. this.deps[i].depend();
  4155. }
  4156. };
  4157. /**
  4158. * Remove self from all dependencies' subscriber list.
  4159. */
  4160. Watcher.prototype.teardown = function teardown () {
  4161. if (this.active) {
  4162. // remove self from vm's watcher list
  4163. // this is a somewhat expensive operation so we skip it
  4164. // if the vm is being destroyed.
  4165. if (!this.vm._isBeingDestroyed) {
  4166. remove(this.vm._watchers, this);
  4167. }
  4168. var i = this.deps.length;
  4169. while (i--) {
  4170. this.deps[i].removeSub(this);
  4171. }
  4172. this.active = false;
  4173. }
  4174. };
  4175. /* */
  4176. var sharedPropertyDefinition = {
  4177. enumerable: true,
  4178. configurable: true,
  4179. get: noop,
  4180. set: noop
  4181. };
  4182. function proxy (target, sourceKey, key) {
  4183. sharedPropertyDefinition.get = function proxyGetter () {
  4184. return this[sourceKey][key]
  4185. };
  4186. sharedPropertyDefinition.set = function proxySetter (val) {
  4187. this[sourceKey][key] = val;
  4188. };
  4189. Object.defineProperty(target, key, sharedPropertyDefinition);
  4190. }
  4191. function initState (vm) {
  4192. vm._watchers = [];
  4193. var opts = vm.$options;
  4194. if (opts.props) { initProps(vm, opts.props); }
  4195. if (opts.methods) { initMethods(vm, opts.methods); }
  4196. if (opts.data) {
  4197. initData(vm);
  4198. } else {
  4199. observe(vm._data = {}, true /* asRootData */);
  4200. }
  4201. if (opts.computed) { initComputed(vm, opts.computed); }
  4202. if (opts.watch && opts.watch !== nativeWatch) {
  4203. initWatch(vm, opts.watch);
  4204. }
  4205. }
  4206. function initProps (vm, propsOptions) {
  4207. var propsData = vm.$options.propsData || {};
  4208. var props = vm._props = {};
  4209. // cache prop keys so that future props updates can iterate using Array
  4210. // instead of dynamic object key enumeration.
  4211. var keys = vm.$options._propKeys = [];
  4212. var isRoot = !vm.$parent;
  4213. // root instance props should be converted
  4214. if (!isRoot) {
  4215. toggleObserving(false);
  4216. }
  4217. var loop = function ( key ) {
  4218. keys.push(key);
  4219. var value = validateProp(key, propsOptions, propsData, vm);
  4220. /* istanbul ignore else */
  4221. {
  4222. var hyphenatedKey = hyphenate(key);
  4223. if (isReservedAttribute(hyphenatedKey) ||
  4224. config.isReservedAttr(hyphenatedKey)) {
  4225. warn(
  4226. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4227. vm
  4228. );
  4229. }
  4230. defineReactive$$1(props, key, value, function () {
  4231. if (!isRoot && !isUpdatingChildComponent) {
  4232. warn(
  4233. "Avoid mutating a prop directly since the value will be " +
  4234. "overwritten whenever the parent component re-renders. " +
  4235. "Instead, use a data or computed property based on the prop's " +
  4236. "value. Prop being mutated: \"" + key + "\"",
  4237. vm
  4238. );
  4239. }
  4240. });
  4241. }
  4242. // static props are already proxied on the component's prototype
  4243. // during Vue.extend(). We only need to proxy props defined at
  4244. // instantiation here.
  4245. if (!(key in vm)) {
  4246. proxy(vm, "_props", key);
  4247. }
  4248. };
  4249. for (var key in propsOptions) loop( key );
  4250. toggleObserving(true);
  4251. }
  4252. function initData (vm) {
  4253. var data = vm.$options.data;
  4254. data = vm._data = typeof data === 'function'
  4255. ? getData(data, vm)
  4256. : data || {};
  4257. if (!isPlainObject(data)) {
  4258. data = {};
  4259. warn(
  4260. 'data functions should return an object:\n' +
  4261. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4262. vm
  4263. );
  4264. }
  4265. // proxy data on instance
  4266. var keys = Object.keys(data);
  4267. var props = vm.$options.props;
  4268. var methods = vm.$options.methods;
  4269. var i = keys.length;
  4270. while (i--) {
  4271. var key = keys[i];
  4272. {
  4273. if (methods && hasOwn(methods, key)) {
  4274. warn(
  4275. ("Method \"" + key + "\" has already been defined as a data property."),
  4276. vm
  4277. );
  4278. }
  4279. }
  4280. if (props && hasOwn(props, key)) {
  4281. warn(
  4282. "The data property \"" + key + "\" is already declared as a prop. " +
  4283. "Use prop default value instead.",
  4284. vm
  4285. );
  4286. } else if (!isReserved(key)) {
  4287. proxy(vm, "_data", key);
  4288. }
  4289. }
  4290. // observe data
  4291. observe(data, true /* asRootData */);
  4292. }
  4293. function getData (data, vm) {
  4294. // #7573 disable dep collection when invoking data getters
  4295. pushTarget();
  4296. try {
  4297. return data.call(vm, vm)
  4298. } catch (e) {
  4299. handleError(e, vm, "data()");
  4300. return {}
  4301. } finally {
  4302. popTarget();
  4303. }
  4304. }
  4305. var computedWatcherOptions = { lazy: true };
  4306. function initComputed (vm, computed) {
  4307. // $flow-disable-line
  4308. var watchers = vm._computedWatchers = Object.create(null);
  4309. // computed properties are just getters during SSR
  4310. var isSSR = isServerRendering();
  4311. for (var key in computed) {
  4312. var userDef = computed[key];
  4313. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4314. if (getter == null) {
  4315. warn(
  4316. ("Getter is missing for computed property \"" + key + "\"."),
  4317. vm
  4318. );
  4319. }
  4320. if (!isSSR) {
  4321. // create internal watcher for the computed property.
  4322. watchers[key] = new Watcher(
  4323. vm,
  4324. getter || noop,
  4325. noop,
  4326. computedWatcherOptions
  4327. );
  4328. }
  4329. // component-defined computed properties are already defined on the
  4330. // component prototype. We only need to define computed properties defined
  4331. // at instantiation here.
  4332. if (!(key in vm)) {
  4333. defineComputed(vm, key, userDef);
  4334. } else {
  4335. if (key in vm.$data) {
  4336. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4337. } else if (vm.$options.props && key in vm.$options.props) {
  4338. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4339. }
  4340. }
  4341. }
  4342. }
  4343. function defineComputed (
  4344. target,
  4345. key,
  4346. userDef
  4347. ) {
  4348. var shouldCache = !isServerRendering();
  4349. if (typeof userDef === 'function') {
  4350. sharedPropertyDefinition.get = shouldCache
  4351. ? createComputedGetter(key)
  4352. : createGetterInvoker(userDef);
  4353. sharedPropertyDefinition.set = noop;
  4354. } else {
  4355. sharedPropertyDefinition.get = userDef.get
  4356. ? shouldCache && userDef.cache !== false
  4357. ? createComputedGetter(key)
  4358. : createGetterInvoker(userDef.get)
  4359. : noop;
  4360. sharedPropertyDefinition.set = userDef.set || noop;
  4361. }
  4362. if (sharedPropertyDefinition.set === noop) {
  4363. sharedPropertyDefinition.set = function () {
  4364. warn(
  4365. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4366. this
  4367. );
  4368. };
  4369. }
  4370. Object.defineProperty(target, key, sharedPropertyDefinition);
  4371. }
  4372. function createComputedGetter (key) {
  4373. return function computedGetter () {
  4374. var watcher = this._computedWatchers && this._computedWatchers[key];
  4375. if (watcher) {
  4376. if (watcher.dirty) {
  4377. watcher.evaluate();
  4378. }
  4379. if (Dep.target) {
  4380. watcher.depend();
  4381. }
  4382. return watcher.value
  4383. }
  4384. }
  4385. }
  4386. function createGetterInvoker(fn) {
  4387. return function computedGetter () {
  4388. return fn.call(this, this)
  4389. }
  4390. }
  4391. function initMethods (vm, methods) {
  4392. var props = vm.$options.props;
  4393. for (var key in methods) {
  4394. {
  4395. if (typeof methods[key] !== 'function') {
  4396. warn(
  4397. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4398. "Did you reference the function correctly?",
  4399. vm
  4400. );
  4401. }
  4402. if (props && hasOwn(props, key)) {
  4403. warn(
  4404. ("Method \"" + key + "\" has already been defined as a prop."),
  4405. vm
  4406. );
  4407. }
  4408. if ((key in vm) && isReserved(key)) {
  4409. warn(
  4410. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4411. "Avoid defining component methods that start with _ or $."
  4412. );
  4413. }
  4414. }
  4415. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4416. }
  4417. }
  4418. function initWatch (vm, watch) {
  4419. for (var key in watch) {
  4420. var handler = watch[key];
  4421. if (Array.isArray(handler)) {
  4422. for (var i = 0; i < handler.length; i++) {
  4423. createWatcher(vm, key, handler[i]);
  4424. }
  4425. } else {
  4426. createWatcher(vm, key, handler);
  4427. }
  4428. }
  4429. }
  4430. function createWatcher (
  4431. vm,
  4432. expOrFn,
  4433. handler,
  4434. options
  4435. ) {
  4436. if (isPlainObject(handler)) {
  4437. options = handler;
  4438. handler = handler.handler;
  4439. }
  4440. if (typeof handler === 'string') {
  4441. handler = vm[handler];
  4442. }
  4443. return vm.$watch(expOrFn, handler, options)
  4444. }
  4445. function stateMixin (Vue) {
  4446. // flow somehow has problems with directly declared definition object
  4447. // when using Object.defineProperty, so we have to procedurally build up
  4448. // the object here.
  4449. var dataDef = {};
  4450. dataDef.get = function () { return this._data };
  4451. var propsDef = {};
  4452. propsDef.get = function () { return this._props };
  4453. {
  4454. dataDef.set = function () {
  4455. warn(
  4456. 'Avoid replacing instance root $data. ' +
  4457. 'Use nested data properties instead.',
  4458. this
  4459. );
  4460. };
  4461. propsDef.set = function () {
  4462. warn("$props is readonly.", this);
  4463. };
  4464. }
  4465. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4466. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4467. Vue.prototype.$set = set;
  4468. Vue.prototype.$delete = del;
  4469. Vue.prototype.$watch = function (
  4470. expOrFn,
  4471. cb,
  4472. options
  4473. ) {
  4474. var vm = this;
  4475. if (isPlainObject(cb)) {
  4476. return createWatcher(vm, expOrFn, cb, options)
  4477. }
  4478. options = options || {};
  4479. options.user = true;
  4480. var watcher = new Watcher(vm, expOrFn, cb, options);
  4481. if (options.immediate) {
  4482. try {
  4483. cb.call(vm, watcher.value);
  4484. } catch (error) {
  4485. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4486. }
  4487. }
  4488. return function unwatchFn () {
  4489. watcher.teardown();
  4490. }
  4491. };
  4492. }
  4493. /* */
  4494. var uid$3 = 0;
  4495. function initMixin (Vue) {
  4496. Vue.prototype._init = function (options) {
  4497. var vm = this;
  4498. // a uid
  4499. vm._uid = uid$3++;
  4500. var startTag, endTag;
  4501. /* istanbul ignore if */
  4502. if (config.performance && mark) {
  4503. startTag = "vue-perf-start:" + (vm._uid);
  4504. endTag = "vue-perf-end:" + (vm._uid);
  4505. mark(startTag);
  4506. }
  4507. // a flag to avoid this being observed
  4508. vm._isVue = true;
  4509. // merge options
  4510. if (options && options._isComponent) {
  4511. // optimize internal component instantiation
  4512. // since dynamic options merging is pretty slow, and none of the
  4513. // internal component options needs special treatment.
  4514. initInternalComponent(vm, options);
  4515. } else {
  4516. vm.$options = mergeOptions(
  4517. resolveConstructorOptions(vm.constructor),
  4518. options || {},
  4519. vm
  4520. );
  4521. }
  4522. /* istanbul ignore else */
  4523. {
  4524. initProxy(vm);
  4525. }
  4526. // expose real self
  4527. vm._self = vm;
  4528. initLifecycle(vm);
  4529. initEvents(vm);
  4530. initRender(vm);
  4531. callHook(vm, 'beforeCreate');
  4532. initInjections(vm); // resolve injections before data/props
  4533. initState(vm);
  4534. initProvide(vm); // resolve provide after data/props
  4535. callHook(vm, 'created');
  4536. /* istanbul ignore if */
  4537. if (config.performance && mark) {
  4538. vm._name = formatComponentName(vm, false);
  4539. mark(endTag);
  4540. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4541. }
  4542. if (vm.$options.el) {
  4543. vm.$mount(vm.$options.el);
  4544. }
  4545. };
  4546. }
  4547. function initInternalComponent (vm, options) {
  4548. var opts = vm.$options = Object.create(vm.constructor.options);
  4549. // doing this because it's faster than dynamic enumeration.
  4550. var parentVnode = options._parentVnode;
  4551. opts.parent = options.parent;
  4552. opts._parentVnode = parentVnode;
  4553. var vnodeComponentOptions = parentVnode.componentOptions;
  4554. opts.propsData = vnodeComponentOptions.propsData;
  4555. opts._parentListeners = vnodeComponentOptions.listeners;
  4556. opts._renderChildren = vnodeComponentOptions.children;
  4557. opts._componentTag = vnodeComponentOptions.tag;
  4558. if (options.render) {
  4559. opts.render = options.render;
  4560. opts.staticRenderFns = options.staticRenderFns;
  4561. }
  4562. }
  4563. function resolveConstructorOptions (Ctor) {
  4564. var options = Ctor.options;
  4565. if (Ctor.super) {
  4566. var superOptions = resolveConstructorOptions(Ctor.super);
  4567. var cachedSuperOptions = Ctor.superOptions;
  4568. if (superOptions !== cachedSuperOptions) {
  4569. // super option changed,
  4570. // need to resolve new options.
  4571. Ctor.superOptions = superOptions;
  4572. // check if there are any late-modified/attached options (#4976)
  4573. var modifiedOptions = resolveModifiedOptions(Ctor);
  4574. // update base extend options
  4575. if (modifiedOptions) {
  4576. extend(Ctor.extendOptions, modifiedOptions);
  4577. }
  4578. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4579. if (options.name) {
  4580. options.components[options.name] = Ctor;
  4581. }
  4582. }
  4583. }
  4584. return options
  4585. }
  4586. function resolveModifiedOptions (Ctor) {
  4587. var modified;
  4588. var latest = Ctor.options;
  4589. var sealed = Ctor.sealedOptions;
  4590. for (var key in latest) {
  4591. if (latest[key] !== sealed[key]) {
  4592. if (!modified) { modified = {}; }
  4593. modified[key] = latest[key];
  4594. }
  4595. }
  4596. return modified
  4597. }
  4598. function Vue (options) {
  4599. if (!(this instanceof Vue)
  4600. ) {
  4601. warn('Vue is a constructor and should be called with the `new` keyword');
  4602. }
  4603. this._init(options);
  4604. }
  4605. initMixin(Vue);
  4606. stateMixin(Vue);
  4607. eventsMixin(Vue);
  4608. lifecycleMixin(Vue);
  4609. renderMixin(Vue);
  4610. /* */
  4611. function initUse (Vue) {
  4612. Vue.use = function (plugin) {
  4613. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4614. if (installedPlugins.indexOf(plugin) > -1) {
  4615. return this
  4616. }
  4617. // additional parameters
  4618. var args = toArray(arguments, 1);
  4619. args.unshift(this);
  4620. if (typeof plugin.install === 'function') {
  4621. plugin.install.apply(plugin, args);
  4622. } else if (typeof plugin === 'function') {
  4623. plugin.apply(null, args);
  4624. }
  4625. installedPlugins.push(plugin);
  4626. return this
  4627. };
  4628. }
  4629. /* */
  4630. function initMixin$1 (Vue) {
  4631. Vue.mixin = function (mixin) {
  4632. this.options = mergeOptions(this.options, mixin);
  4633. return this
  4634. };
  4635. }
  4636. /* */
  4637. function initExtend (Vue) {
  4638. /**
  4639. * Each instance constructor, including Vue, has a unique
  4640. * cid. This enables us to create wrapped "child
  4641. * constructors" for prototypal inheritance and cache them.
  4642. */
  4643. Vue.cid = 0;
  4644. var cid = 1;
  4645. /**
  4646. * Class inheritance
  4647. */
  4648. Vue.extend = function (extendOptions) {
  4649. extendOptions = extendOptions || {};
  4650. var Super = this;
  4651. var SuperId = Super.cid;
  4652. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4653. if (cachedCtors[SuperId]) {
  4654. return cachedCtors[SuperId]
  4655. }
  4656. var name = extendOptions.name || Super.options.name;
  4657. if (name) {
  4658. validateComponentName(name);
  4659. }
  4660. var Sub = function VueComponent (options) {
  4661. this._init(options);
  4662. };
  4663. Sub.prototype = Object.create(Super.prototype);
  4664. Sub.prototype.constructor = Sub;
  4665. Sub.cid = cid++;
  4666. Sub.options = mergeOptions(
  4667. Super.options,
  4668. extendOptions
  4669. );
  4670. Sub['super'] = Super;
  4671. // For props and computed properties, we define the proxy getters on
  4672. // the Vue instances at extension time, on the extended prototype. This
  4673. // avoids Object.defineProperty calls for each instance created.
  4674. if (Sub.options.props) {
  4675. initProps$1(Sub);
  4676. }
  4677. if (Sub.options.computed) {
  4678. initComputed$1(Sub);
  4679. }
  4680. // allow further extension/mixin/plugin usage
  4681. Sub.extend = Super.extend;
  4682. Sub.mixin = Super.mixin;
  4683. Sub.use = Super.use;
  4684. // create asset registers, so extended classes
  4685. // can have their private assets too.
  4686. ASSET_TYPES.forEach(function (type) {
  4687. Sub[type] = Super[type];
  4688. });
  4689. // enable recursive self-lookup
  4690. if (name) {
  4691. Sub.options.components[name] = Sub;
  4692. }
  4693. // keep a reference to the super options at extension time.
  4694. // later at instantiation we can check if Super's options have
  4695. // been updated.
  4696. Sub.superOptions = Super.options;
  4697. Sub.extendOptions = extendOptions;
  4698. Sub.sealedOptions = extend({}, Sub.options);
  4699. // cache constructor
  4700. cachedCtors[SuperId] = Sub;
  4701. return Sub
  4702. };
  4703. }
  4704. function initProps$1 (Comp) {
  4705. var props = Comp.options.props;
  4706. for (var key in props) {
  4707. proxy(Comp.prototype, "_props", key);
  4708. }
  4709. }
  4710. function initComputed$1 (Comp) {
  4711. var computed = Comp.options.computed;
  4712. for (var key in computed) {
  4713. defineComputed(Comp.prototype, key, computed[key]);
  4714. }
  4715. }
  4716. /* */
  4717. function initAssetRegisters (Vue) {
  4718. /**
  4719. * Create asset registration methods.
  4720. */
  4721. ASSET_TYPES.forEach(function (type) {
  4722. Vue[type] = function (
  4723. id,
  4724. definition
  4725. ) {
  4726. if (!definition) {
  4727. return this.options[type + 's'][id]
  4728. } else {
  4729. /* istanbul ignore if */
  4730. if (type === 'component') {
  4731. validateComponentName(id);
  4732. }
  4733. if (type === 'component' && isPlainObject(definition)) {
  4734. definition.name = definition.name || id;
  4735. definition = this.options._base.extend(definition);
  4736. }
  4737. if (type === 'directive' && typeof definition === 'function') {
  4738. definition = { bind: definition, update: definition };
  4739. }
  4740. this.options[type + 's'][id] = definition;
  4741. return definition
  4742. }
  4743. };
  4744. });
  4745. }
  4746. /* */
  4747. function getComponentName (opts) {
  4748. return opts && (opts.Ctor.options.name || opts.tag)
  4749. }
  4750. function matches (pattern, name) {
  4751. if (Array.isArray(pattern)) {
  4752. return pattern.indexOf(name) > -1
  4753. } else if (typeof pattern === 'string') {
  4754. return pattern.split(',').indexOf(name) > -1
  4755. } else if (isRegExp(pattern)) {
  4756. return pattern.test(name)
  4757. }
  4758. /* istanbul ignore next */
  4759. return false
  4760. }
  4761. function pruneCache (keepAliveInstance, filter) {
  4762. var cache = keepAliveInstance.cache;
  4763. var keys = keepAliveInstance.keys;
  4764. var _vnode = keepAliveInstance._vnode;
  4765. for (var key in cache) {
  4766. var cachedNode = cache[key];
  4767. if (cachedNode) {
  4768. var name = getComponentName(cachedNode.componentOptions);
  4769. if (name && !filter(name)) {
  4770. pruneCacheEntry(cache, key, keys, _vnode);
  4771. }
  4772. }
  4773. }
  4774. }
  4775. function pruneCacheEntry (
  4776. cache,
  4777. key,
  4778. keys,
  4779. current
  4780. ) {
  4781. var cached$$1 = cache[key];
  4782. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4783. cached$$1.componentInstance.$destroy();
  4784. }
  4785. cache[key] = null;
  4786. remove(keys, key);
  4787. }
  4788. var patternTypes = [String, RegExp, Array];
  4789. var KeepAlive = {
  4790. name: 'keep-alive',
  4791. abstract: true,
  4792. props: {
  4793. include: patternTypes,
  4794. exclude: patternTypes,
  4795. max: [String, Number]
  4796. },
  4797. created: function created () {
  4798. this.cache = Object.create(null);
  4799. this.keys = [];
  4800. },
  4801. destroyed: function destroyed () {
  4802. for (var key in this.cache) {
  4803. pruneCacheEntry(this.cache, key, this.keys);
  4804. }
  4805. },
  4806. mounted: function mounted () {
  4807. var this$1 = this;
  4808. this.$watch('include', function (val) {
  4809. pruneCache(this$1, function (name) { return matches(val, name); });
  4810. });
  4811. this.$watch('exclude', function (val) {
  4812. pruneCache(this$1, function (name) { return !matches(val, name); });
  4813. });
  4814. },
  4815. render: function render () {
  4816. var slot = this.$slots.default;
  4817. var vnode = getFirstComponentChild(slot);
  4818. var componentOptions = vnode && vnode.componentOptions;
  4819. if (componentOptions) {
  4820. // check pattern
  4821. var name = getComponentName(componentOptions);
  4822. var ref = this;
  4823. var include = ref.include;
  4824. var exclude = ref.exclude;
  4825. if (
  4826. // not included
  4827. (include && (!name || !matches(include, name))) ||
  4828. // excluded
  4829. (exclude && name && matches(exclude, name))
  4830. ) {
  4831. return vnode
  4832. }
  4833. var ref$1 = this;
  4834. var cache = ref$1.cache;
  4835. var keys = ref$1.keys;
  4836. var key = vnode.key == null
  4837. // same constructor may get registered as different local components
  4838. // so cid alone is not enough (#3269)
  4839. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4840. : vnode.key;
  4841. if (cache[key]) {
  4842. vnode.componentInstance = cache[key].componentInstance;
  4843. // make current key freshest
  4844. remove(keys, key);
  4845. keys.push(key);
  4846. } else {
  4847. cache[key] = vnode;
  4848. keys.push(key);
  4849. // prune oldest entry
  4850. if (this.max && keys.length > parseInt(this.max)) {
  4851. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4852. }
  4853. }
  4854. vnode.data.keepAlive = true;
  4855. }
  4856. return vnode || (slot && slot[0])
  4857. }
  4858. };
  4859. var builtInComponents = {
  4860. KeepAlive: KeepAlive
  4861. };
  4862. /* */
  4863. function initGlobalAPI (Vue) {
  4864. // config
  4865. var configDef = {};
  4866. configDef.get = function () { return config; };
  4867. {
  4868. configDef.set = function () {
  4869. warn(
  4870. 'Do not replace the Vue.config object, set individual fields instead.'
  4871. );
  4872. };
  4873. }
  4874. Object.defineProperty(Vue, 'config', configDef);
  4875. // exposed util methods.
  4876. // NOTE: these are not considered part of the public API - avoid relying on
  4877. // them unless you are aware of the risk.
  4878. Vue.util = {
  4879. warn: warn,
  4880. extend: extend,
  4881. mergeOptions: mergeOptions,
  4882. defineReactive: defineReactive$$1
  4883. };
  4884. Vue.set = set;
  4885. Vue.delete = del;
  4886. Vue.nextTick = nextTick;
  4887. // 2.6 explicit observable API
  4888. Vue.observable = function (obj) {
  4889. observe(obj);
  4890. return obj
  4891. };
  4892. Vue.options = Object.create(null);
  4893. ASSET_TYPES.forEach(function (type) {
  4894. Vue.options[type + 's'] = Object.create(null);
  4895. });
  4896. // this is used to identify the "base" constructor to extend all plain-object
  4897. // components with in Weex's multi-instance scenarios.
  4898. Vue.options._base = Vue;
  4899. extend(Vue.options.components, builtInComponents);
  4900. initUse(Vue);
  4901. initMixin$1(Vue);
  4902. initExtend(Vue);
  4903. initAssetRegisters(Vue);
  4904. }
  4905. initGlobalAPI(Vue);
  4906. Object.defineProperty(Vue.prototype, '$isServer', {
  4907. get: isServerRendering
  4908. });
  4909. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4910. get: function get () {
  4911. /* istanbul ignore next */
  4912. return this.$vnode && this.$vnode.ssrContext
  4913. }
  4914. });
  4915. // expose FunctionalRenderContext for ssr runtime helper installation
  4916. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4917. value: FunctionalRenderContext
  4918. });
  4919. Vue.version = '2.6.12';
  4920. /* */
  4921. // these are reserved for web because they are directly compiled away
  4922. // during template compilation
  4923. var isReservedAttr = makeMap('style,class');
  4924. // attributes that should be using props for binding
  4925. var acceptValue = makeMap('input,textarea,option,select,progress');
  4926. var mustUseProp = function (tag, type, attr) {
  4927. return (
  4928. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4929. (attr === 'selected' && tag === 'option') ||
  4930. (attr === 'checked' && tag === 'input') ||
  4931. (attr === 'muted' && tag === 'video')
  4932. )
  4933. };
  4934. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4935. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4936. var convertEnumeratedValue = function (key, value) {
  4937. return isFalsyAttrValue(value) || value === 'false'
  4938. ? 'false'
  4939. // allow arbitrary string value for contenteditable
  4940. : key === 'contenteditable' && isValidContentEditableValue(value)
  4941. ? value
  4942. : 'true'
  4943. };
  4944. var isBooleanAttr = makeMap(
  4945. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4946. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4947. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4948. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4949. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4950. 'truespeed,typemustmatch,visible'
  4951. );
  4952. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4953. var isXlink = function (name) {
  4954. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4955. };
  4956. var getXlinkProp = function (name) {
  4957. return isXlink(name) ? name.slice(6, name.length) : ''
  4958. };
  4959. var isFalsyAttrValue = function (val) {
  4960. return val == null || val === false
  4961. };
  4962. /* */
  4963. function genClassForVnode (vnode) {
  4964. var data = vnode.data;
  4965. var parentNode = vnode;
  4966. var childNode = vnode;
  4967. while (isDef(childNode.componentInstance)) {
  4968. childNode = childNode.componentInstance._vnode;
  4969. if (childNode && childNode.data) {
  4970. data = mergeClassData(childNode.data, data);
  4971. }
  4972. }
  4973. while (isDef(parentNode = parentNode.parent)) {
  4974. if (parentNode && parentNode.data) {
  4975. data = mergeClassData(data, parentNode.data);
  4976. }
  4977. }
  4978. return renderClass(data.staticClass, data.class)
  4979. }
  4980. function mergeClassData (child, parent) {
  4981. return {
  4982. staticClass: concat(child.staticClass, parent.staticClass),
  4983. class: isDef(child.class)
  4984. ? [child.class, parent.class]
  4985. : parent.class
  4986. }
  4987. }
  4988. function renderClass (
  4989. staticClass,
  4990. dynamicClass
  4991. ) {
  4992. if (isDef(staticClass) || isDef(dynamicClass)) {
  4993. return concat(staticClass, stringifyClass(dynamicClass))
  4994. }
  4995. /* istanbul ignore next */
  4996. return ''
  4997. }
  4998. function concat (a, b) {
  4999. return a ? b ? (a + ' ' + b) : a : (b || '')
  5000. }
  5001. function stringifyClass (value) {
  5002. if (Array.isArray(value)) {
  5003. return stringifyArray(value)
  5004. }
  5005. if (isObject(value)) {
  5006. return stringifyObject(value)
  5007. }
  5008. if (typeof value === 'string') {
  5009. return value
  5010. }
  5011. /* istanbul ignore next */
  5012. return ''
  5013. }
  5014. function stringifyArray (value) {
  5015. var res = '';
  5016. var stringified;
  5017. for (var i = 0, l = value.length; i < l; i++) {
  5018. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5019. if (res) { res += ' '; }
  5020. res += stringified;
  5021. }
  5022. }
  5023. return res
  5024. }
  5025. function stringifyObject (value) {
  5026. var res = '';
  5027. for (var key in value) {
  5028. if (value[key]) {
  5029. if (res) { res += ' '; }
  5030. res += key;
  5031. }
  5032. }
  5033. return res
  5034. }
  5035. /* */
  5036. var namespaceMap = {
  5037. svg: 'http://www.w3.org/2000/svg',
  5038. math: 'http://www.w3.org/1998/Math/MathML'
  5039. };
  5040. var isHTMLTag = makeMap(
  5041. 'html,body,base,head,link,meta,style,title,' +
  5042. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5043. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5044. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5045. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5046. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5047. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5048. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5049. 'output,progress,select,textarea,' +
  5050. 'details,dialog,menu,menuitem,summary,' +
  5051. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5052. );
  5053. // this map is intentionally selective, only covering SVG elements that may
  5054. // contain child elements.
  5055. var isSVG = makeMap(
  5056. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5057. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5058. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5059. true
  5060. );
  5061. var isReservedTag = function (tag) {
  5062. return isHTMLTag(tag) || isSVG(tag)
  5063. };
  5064. function getTagNamespace (tag) {
  5065. if (isSVG(tag)) {
  5066. return 'svg'
  5067. }
  5068. // basic support for MathML
  5069. // note it doesn't support other MathML elements being component roots
  5070. if (tag === 'math') {
  5071. return 'math'
  5072. }
  5073. }
  5074. var unknownElementCache = Object.create(null);
  5075. function isUnknownElement (tag) {
  5076. /* istanbul ignore if */
  5077. if (!inBrowser) {
  5078. return true
  5079. }
  5080. if (isReservedTag(tag)) {
  5081. return false
  5082. }
  5083. tag = tag.toLowerCase();
  5084. /* istanbul ignore if */
  5085. if (unknownElementCache[tag] != null) {
  5086. return unknownElementCache[tag]
  5087. }
  5088. var el = document.createElement(tag);
  5089. if (tag.indexOf('-') > -1) {
  5090. // http://stackoverflow.com/a/28210364/1070244
  5091. return (unknownElementCache[tag] = (
  5092. el.constructor === window.HTMLUnknownElement ||
  5093. el.constructor === window.HTMLElement
  5094. ))
  5095. } else {
  5096. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5097. }
  5098. }
  5099. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5100. /* */
  5101. /**
  5102. * Query an element selector if it's not an element already.
  5103. */
  5104. function query (el) {
  5105. if (typeof el === 'string') {
  5106. var selected = document.querySelector(el);
  5107. if (!selected) {
  5108. warn(
  5109. 'Cannot find element: ' + el
  5110. );
  5111. return document.createElement('div')
  5112. }
  5113. return selected
  5114. } else {
  5115. return el
  5116. }
  5117. }
  5118. /* */
  5119. function createElement$1 (tagName, vnode) {
  5120. var elm = document.createElement(tagName);
  5121. if (tagName !== 'select') {
  5122. return elm
  5123. }
  5124. // false or null will remove the attribute but undefined will not
  5125. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5126. elm.setAttribute('multiple', 'multiple');
  5127. }
  5128. return elm
  5129. }
  5130. function createElementNS (namespace, tagName) {
  5131. return document.createElementNS(namespaceMap[namespace], tagName)
  5132. }
  5133. function createTextNode (text) {
  5134. return document.createTextNode(text)
  5135. }
  5136. function createComment (text) {
  5137. return document.createComment(text)
  5138. }
  5139. function insertBefore (parentNode, newNode, referenceNode) {
  5140. parentNode.insertBefore(newNode, referenceNode);
  5141. }
  5142. function removeChild (node, child) {
  5143. node.removeChild(child);
  5144. }
  5145. function appendChild (node, child) {
  5146. node.appendChild(child);
  5147. }
  5148. function parentNode (node) {
  5149. return node.parentNode
  5150. }
  5151. function nextSibling (node) {
  5152. return node.nextSibling
  5153. }
  5154. function tagName (node) {
  5155. return node.tagName
  5156. }
  5157. function setTextContent (node, text) {
  5158. node.textContent = text;
  5159. }
  5160. function setStyleScope (node, scopeId) {
  5161. node.setAttribute(scopeId, '');
  5162. }
  5163. var nodeOps = /*#__PURE__*/Object.freeze({
  5164. createElement: createElement$1,
  5165. createElementNS: createElementNS,
  5166. createTextNode: createTextNode,
  5167. createComment: createComment,
  5168. insertBefore: insertBefore,
  5169. removeChild: removeChild,
  5170. appendChild: appendChild,
  5171. parentNode: parentNode,
  5172. nextSibling: nextSibling,
  5173. tagName: tagName,
  5174. setTextContent: setTextContent,
  5175. setStyleScope: setStyleScope
  5176. });
  5177. /* */
  5178. var ref = {
  5179. create: function create (_, vnode) {
  5180. registerRef(vnode);
  5181. },
  5182. update: function update (oldVnode, vnode) {
  5183. if (oldVnode.data.ref !== vnode.data.ref) {
  5184. registerRef(oldVnode, true);
  5185. registerRef(vnode);
  5186. }
  5187. },
  5188. destroy: function destroy (vnode) {
  5189. registerRef(vnode, true);
  5190. }
  5191. };
  5192. function registerRef (vnode, isRemoval) {
  5193. var key = vnode.data.ref;
  5194. if (!isDef(key)) { return }
  5195. var vm = vnode.context;
  5196. var ref = vnode.componentInstance || vnode.elm;
  5197. var refs = vm.$refs;
  5198. if (isRemoval) {
  5199. if (Array.isArray(refs[key])) {
  5200. remove(refs[key], ref);
  5201. } else if (refs[key] === ref) {
  5202. refs[key] = undefined;
  5203. }
  5204. } else {
  5205. if (vnode.data.refInFor) {
  5206. if (!Array.isArray(refs[key])) {
  5207. refs[key] = [ref];
  5208. } else if (refs[key].indexOf(ref) < 0) {
  5209. // $flow-disable-line
  5210. refs[key].push(ref);
  5211. }
  5212. } else {
  5213. refs[key] = ref;
  5214. }
  5215. }
  5216. }
  5217. /**
  5218. * Virtual DOM patching algorithm based on Snabbdom by
  5219. * Simon Friis Vindum (@paldepind)
  5220. * Licensed under the MIT License
  5221. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5222. *
  5223. * modified by Evan You (@yyx990803)
  5224. *
  5225. * Not type-checking this because this file is perf-critical and the cost
  5226. * of making flow understand it is not worth it.
  5227. */
  5228. var emptyNode = new VNode('', {}, []);
  5229. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5230. function sameVnode (a, b) {
  5231. return (
  5232. a.key === b.key && (
  5233. (
  5234. a.tag === b.tag &&
  5235. a.isComment === b.isComment &&
  5236. isDef(a.data) === isDef(b.data) &&
  5237. sameInputType(a, b)
  5238. ) || (
  5239. isTrue(a.isAsyncPlaceholder) &&
  5240. a.asyncFactory === b.asyncFactory &&
  5241. isUndef(b.asyncFactory.error)
  5242. )
  5243. )
  5244. )
  5245. }
  5246. function sameInputType (a, b) {
  5247. if (a.tag !== 'input') { return true }
  5248. var i;
  5249. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5250. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5251. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5252. }
  5253. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5254. var i, key;
  5255. var map = {};
  5256. for (i = beginIdx; i <= endIdx; ++i) {
  5257. key = children[i].key;
  5258. if (isDef(key)) { map[key] = i; }
  5259. }
  5260. return map
  5261. }
  5262. function createPatchFunction (backend) {
  5263. var i, j;
  5264. var cbs = {};
  5265. var modules = backend.modules;
  5266. var nodeOps = backend.nodeOps;
  5267. for (i = 0; i < hooks.length; ++i) {
  5268. cbs[hooks[i]] = [];
  5269. for (j = 0; j < modules.length; ++j) {
  5270. if (isDef(modules[j][hooks[i]])) {
  5271. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5272. }
  5273. }
  5274. }
  5275. function emptyNodeAt (elm) {
  5276. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5277. }
  5278. function createRmCb (childElm, listeners) {
  5279. function remove$$1 () {
  5280. if (--remove$$1.listeners === 0) {
  5281. removeNode(childElm);
  5282. }
  5283. }
  5284. remove$$1.listeners = listeners;
  5285. return remove$$1
  5286. }
  5287. function removeNode (el) {
  5288. var parent = nodeOps.parentNode(el);
  5289. // element may have already been removed due to v-html / v-text
  5290. if (isDef(parent)) {
  5291. nodeOps.removeChild(parent, el);
  5292. }
  5293. }
  5294. function isUnknownElement$$1 (vnode, inVPre) {
  5295. return (
  5296. !inVPre &&
  5297. !vnode.ns &&
  5298. !(
  5299. config.ignoredElements.length &&
  5300. config.ignoredElements.some(function (ignore) {
  5301. return isRegExp(ignore)
  5302. ? ignore.test(vnode.tag)
  5303. : ignore === vnode.tag
  5304. })
  5305. ) &&
  5306. config.isUnknownElement(vnode.tag)
  5307. )
  5308. }
  5309. var creatingElmInVPre = 0;
  5310. function createElm (
  5311. vnode,
  5312. insertedVnodeQueue,
  5313. parentElm,
  5314. refElm,
  5315. nested,
  5316. ownerArray,
  5317. index
  5318. ) {
  5319. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5320. // This vnode was used in a previous render!
  5321. // now it's used as a new node, overwriting its elm would cause
  5322. // potential patch errors down the road when it's used as an insertion
  5323. // reference node. Instead, we clone the node on-demand before creating
  5324. // associated DOM element for it.
  5325. vnode = ownerArray[index] = cloneVNode(vnode);
  5326. }
  5327. vnode.isRootInsert = !nested; // for transition enter check
  5328. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5329. return
  5330. }
  5331. var data = vnode.data;
  5332. var children = vnode.children;
  5333. var tag = vnode.tag;
  5334. if (isDef(tag)) {
  5335. {
  5336. if (data && data.pre) {
  5337. creatingElmInVPre++;
  5338. }
  5339. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5340. warn(
  5341. 'Unknown custom element: <' + tag + '> - did you ' +
  5342. 'register the component correctly? For recursive components, ' +
  5343. 'make sure to provide the "name" option.',
  5344. vnode.context
  5345. );
  5346. }
  5347. }
  5348. vnode.elm = vnode.ns
  5349. ? nodeOps.createElementNS(vnode.ns, tag)
  5350. : nodeOps.createElement(tag, vnode);
  5351. setScope(vnode);
  5352. /* istanbul ignore if */
  5353. {
  5354. createChildren(vnode, children, insertedVnodeQueue);
  5355. if (isDef(data)) {
  5356. invokeCreateHooks(vnode, insertedVnodeQueue);
  5357. }
  5358. insert(parentElm, vnode.elm, refElm);
  5359. }
  5360. if (data && data.pre) {
  5361. creatingElmInVPre--;
  5362. }
  5363. } else if (isTrue(vnode.isComment)) {
  5364. vnode.elm = nodeOps.createComment(vnode.text);
  5365. insert(parentElm, vnode.elm, refElm);
  5366. } else {
  5367. vnode.elm = nodeOps.createTextNode(vnode.text);
  5368. insert(parentElm, vnode.elm, refElm);
  5369. }
  5370. }
  5371. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5372. var i = vnode.data;
  5373. if (isDef(i)) {
  5374. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5375. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5376. i(vnode, false /* hydrating */);
  5377. }
  5378. // after calling the init hook, if the vnode is a child component
  5379. // it should've created a child instance and mounted it. the child
  5380. // component also has set the placeholder vnode's elm.
  5381. // in that case we can just return the element and be done.
  5382. if (isDef(vnode.componentInstance)) {
  5383. initComponent(vnode, insertedVnodeQueue);
  5384. insert(parentElm, vnode.elm, refElm);
  5385. if (isTrue(isReactivated)) {
  5386. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5387. }
  5388. return true
  5389. }
  5390. }
  5391. }
  5392. function initComponent (vnode, insertedVnodeQueue) {
  5393. if (isDef(vnode.data.pendingInsert)) {
  5394. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5395. vnode.data.pendingInsert = null;
  5396. }
  5397. vnode.elm = vnode.componentInstance.$el;
  5398. if (isPatchable(vnode)) {
  5399. invokeCreateHooks(vnode, insertedVnodeQueue);
  5400. setScope(vnode);
  5401. } else {
  5402. // empty component root.
  5403. // skip all element-related modules except for ref (#3455)
  5404. registerRef(vnode);
  5405. // make sure to invoke the insert hook
  5406. insertedVnodeQueue.push(vnode);
  5407. }
  5408. }
  5409. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5410. var i;
  5411. // hack for #4339: a reactivated component with inner transition
  5412. // does not trigger because the inner node's created hooks are not called
  5413. // again. It's not ideal to involve module-specific logic in here but
  5414. // there doesn't seem to be a better way to do it.
  5415. var innerNode = vnode;
  5416. while (innerNode.componentInstance) {
  5417. innerNode = innerNode.componentInstance._vnode;
  5418. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5419. for (i = 0; i < cbs.activate.length; ++i) {
  5420. cbs.activate[i](emptyNode, innerNode);
  5421. }
  5422. insertedVnodeQueue.push(innerNode);
  5423. break
  5424. }
  5425. }
  5426. // unlike a newly created component,
  5427. // a reactivated keep-alive component doesn't insert itself
  5428. insert(parentElm, vnode.elm, refElm);
  5429. }
  5430. function insert (parent, elm, ref$$1) {
  5431. if (isDef(parent)) {
  5432. if (isDef(ref$$1)) {
  5433. if (nodeOps.parentNode(ref$$1) === parent) {
  5434. nodeOps.insertBefore(parent, elm, ref$$1);
  5435. }
  5436. } else {
  5437. nodeOps.appendChild(parent, elm);
  5438. }
  5439. }
  5440. }
  5441. function createChildren (vnode, children, insertedVnodeQueue) {
  5442. if (Array.isArray(children)) {
  5443. {
  5444. checkDuplicateKeys(children);
  5445. }
  5446. for (var i = 0; i < children.length; ++i) {
  5447. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5448. }
  5449. } else if (isPrimitive(vnode.text)) {
  5450. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5451. }
  5452. }
  5453. function isPatchable (vnode) {
  5454. while (vnode.componentInstance) {
  5455. vnode = vnode.componentInstance._vnode;
  5456. }
  5457. return isDef(vnode.tag)
  5458. }
  5459. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5460. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5461. cbs.create[i$1](emptyNode, vnode);
  5462. }
  5463. i = vnode.data.hook; // Reuse variable
  5464. if (isDef(i)) {
  5465. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5466. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5467. }
  5468. }
  5469. // set scope id attribute for scoped CSS.
  5470. // this is implemented as a special case to avoid the overhead
  5471. // of going through the normal attribute patching process.
  5472. function setScope (vnode) {
  5473. var i;
  5474. if (isDef(i = vnode.fnScopeId)) {
  5475. nodeOps.setStyleScope(vnode.elm, i);
  5476. } else {
  5477. var ancestor = vnode;
  5478. while (ancestor) {
  5479. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5480. nodeOps.setStyleScope(vnode.elm, i);
  5481. }
  5482. ancestor = ancestor.parent;
  5483. }
  5484. }
  5485. // for slot content they should also get the scopeId from the host instance.
  5486. if (isDef(i = activeInstance) &&
  5487. i !== vnode.context &&
  5488. i !== vnode.fnContext &&
  5489. isDef(i = i.$options._scopeId)
  5490. ) {
  5491. nodeOps.setStyleScope(vnode.elm, i);
  5492. }
  5493. }
  5494. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5495. for (; startIdx <= endIdx; ++startIdx) {
  5496. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5497. }
  5498. }
  5499. function invokeDestroyHook (vnode) {
  5500. var i, j;
  5501. var data = vnode.data;
  5502. if (isDef(data)) {
  5503. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5504. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5505. }
  5506. if (isDef(i = vnode.children)) {
  5507. for (j = 0; j < vnode.children.length; ++j) {
  5508. invokeDestroyHook(vnode.children[j]);
  5509. }
  5510. }
  5511. }
  5512. function removeVnodes (vnodes, startIdx, endIdx) {
  5513. for (; startIdx <= endIdx; ++startIdx) {
  5514. var ch = vnodes[startIdx];
  5515. if (isDef(ch)) {
  5516. if (isDef(ch.tag)) {
  5517. removeAndInvokeRemoveHook(ch);
  5518. invokeDestroyHook(ch);
  5519. } else { // Text node
  5520. removeNode(ch.elm);
  5521. }
  5522. }
  5523. }
  5524. }
  5525. function removeAndInvokeRemoveHook (vnode, rm) {
  5526. if (isDef(rm) || isDef(vnode.data)) {
  5527. var i;
  5528. var listeners = cbs.remove.length + 1;
  5529. if (isDef(rm)) {
  5530. // we have a recursively passed down rm callback
  5531. // increase the listeners count
  5532. rm.listeners += listeners;
  5533. } else {
  5534. // directly removing
  5535. rm = createRmCb(vnode.elm, listeners);
  5536. }
  5537. // recursively invoke hooks on child component root node
  5538. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5539. removeAndInvokeRemoveHook(i, rm);
  5540. }
  5541. for (i = 0; i < cbs.remove.length; ++i) {
  5542. cbs.remove[i](vnode, rm);
  5543. }
  5544. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5545. i(vnode, rm);
  5546. } else {
  5547. rm();
  5548. }
  5549. } else {
  5550. removeNode(vnode.elm);
  5551. }
  5552. }
  5553. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5554. var oldStartIdx = 0;
  5555. var newStartIdx = 0;
  5556. var oldEndIdx = oldCh.length - 1;
  5557. var oldStartVnode = oldCh[0];
  5558. var oldEndVnode = oldCh[oldEndIdx];
  5559. var newEndIdx = newCh.length - 1;
  5560. var newStartVnode = newCh[0];
  5561. var newEndVnode = newCh[newEndIdx];
  5562. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5563. // removeOnly is a special flag used only by <transition-group>
  5564. // to ensure removed elements stay in correct relative positions
  5565. // during leaving transitions
  5566. var canMove = !removeOnly;
  5567. {
  5568. checkDuplicateKeys(newCh);
  5569. }
  5570. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5571. if (isUndef(oldStartVnode)) {
  5572. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5573. } else if (isUndef(oldEndVnode)) {
  5574. oldEndVnode = oldCh[--oldEndIdx];
  5575. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5576. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5577. oldStartVnode = oldCh[++oldStartIdx];
  5578. newStartVnode = newCh[++newStartIdx];
  5579. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5580. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5581. oldEndVnode = oldCh[--oldEndIdx];
  5582. newEndVnode = newCh[--newEndIdx];
  5583. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5584. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5585. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5586. oldStartVnode = oldCh[++oldStartIdx];
  5587. newEndVnode = newCh[--newEndIdx];
  5588. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5589. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5590. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5591. oldEndVnode = oldCh[--oldEndIdx];
  5592. newStartVnode = newCh[++newStartIdx];
  5593. } else {
  5594. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5595. idxInOld = isDef(newStartVnode.key)
  5596. ? oldKeyToIdx[newStartVnode.key]
  5597. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5598. if (isUndef(idxInOld)) { // New element
  5599. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5600. } else {
  5601. vnodeToMove = oldCh[idxInOld];
  5602. if (sameVnode(vnodeToMove, newStartVnode)) {
  5603. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5604. oldCh[idxInOld] = undefined;
  5605. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5606. } else {
  5607. // same key but different element. treat as new element
  5608. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5609. }
  5610. }
  5611. newStartVnode = newCh[++newStartIdx];
  5612. }
  5613. }
  5614. if (oldStartIdx > oldEndIdx) {
  5615. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5616. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5617. } else if (newStartIdx > newEndIdx) {
  5618. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5619. }
  5620. }
  5621. function checkDuplicateKeys (children) {
  5622. var seenKeys = {};
  5623. for (var i = 0; i < children.length; i++) {
  5624. var vnode = children[i];
  5625. var key = vnode.key;
  5626. if (isDef(key)) {
  5627. if (seenKeys[key]) {
  5628. warn(
  5629. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5630. vnode.context
  5631. );
  5632. } else {
  5633. seenKeys[key] = true;
  5634. }
  5635. }
  5636. }
  5637. }
  5638. function findIdxInOld (node, oldCh, start, end) {
  5639. for (var i = start; i < end; i++) {
  5640. var c = oldCh[i];
  5641. if (isDef(c) && sameVnode(node, c)) { return i }
  5642. }
  5643. }
  5644. function patchVnode (
  5645. oldVnode,
  5646. vnode,
  5647. insertedVnodeQueue,
  5648. ownerArray,
  5649. index,
  5650. removeOnly
  5651. ) {
  5652. if (oldVnode === vnode) {
  5653. return
  5654. }
  5655. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5656. // clone reused vnode
  5657. vnode = ownerArray[index] = cloneVNode(vnode);
  5658. }
  5659. var elm = vnode.elm = oldVnode.elm;
  5660. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5661. if (isDef(vnode.asyncFactory.resolved)) {
  5662. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5663. } else {
  5664. vnode.isAsyncPlaceholder = true;
  5665. }
  5666. return
  5667. }
  5668. // reuse element for static trees.
  5669. // note we only do this if the vnode is cloned -
  5670. // if the new node is not cloned it means the render functions have been
  5671. // reset by the hot-reload-api and we need to do a proper re-render.
  5672. if (isTrue(vnode.isStatic) &&
  5673. isTrue(oldVnode.isStatic) &&
  5674. vnode.key === oldVnode.key &&
  5675. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5676. ) {
  5677. vnode.componentInstance = oldVnode.componentInstance;
  5678. return
  5679. }
  5680. var i;
  5681. var data = vnode.data;
  5682. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5683. i(oldVnode, vnode);
  5684. }
  5685. var oldCh = oldVnode.children;
  5686. var ch = vnode.children;
  5687. if (isDef(data) && isPatchable(vnode)) {
  5688. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5689. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5690. }
  5691. if (isUndef(vnode.text)) {
  5692. if (isDef(oldCh) && isDef(ch)) {
  5693. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5694. } else if (isDef(ch)) {
  5695. {
  5696. checkDuplicateKeys(ch);
  5697. }
  5698. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5699. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5700. } else if (isDef(oldCh)) {
  5701. removeVnodes(oldCh, 0, oldCh.length - 1);
  5702. } else if (isDef(oldVnode.text)) {
  5703. nodeOps.setTextContent(elm, '');
  5704. }
  5705. } else if (oldVnode.text !== vnode.text) {
  5706. nodeOps.setTextContent(elm, vnode.text);
  5707. }
  5708. if (isDef(data)) {
  5709. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5710. }
  5711. }
  5712. function invokeInsertHook (vnode, queue, initial) {
  5713. // delay insert hooks for component root nodes, invoke them after the
  5714. // element is really inserted
  5715. if (isTrue(initial) && isDef(vnode.parent)) {
  5716. vnode.parent.data.pendingInsert = queue;
  5717. } else {
  5718. for (var i = 0; i < queue.length; ++i) {
  5719. queue[i].data.hook.insert(queue[i]);
  5720. }
  5721. }
  5722. }
  5723. var hydrationBailed = false;
  5724. // list of modules that can skip create hook during hydration because they
  5725. // are already rendered on the client or has no need for initialization
  5726. // Note: style is excluded because it relies on initial clone for future
  5727. // deep updates (#7063).
  5728. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5729. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5730. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5731. var i;
  5732. var tag = vnode.tag;
  5733. var data = vnode.data;
  5734. var children = vnode.children;
  5735. inVPre = inVPre || (data && data.pre);
  5736. vnode.elm = elm;
  5737. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5738. vnode.isAsyncPlaceholder = true;
  5739. return true
  5740. }
  5741. // assert node match
  5742. {
  5743. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5744. return false
  5745. }
  5746. }
  5747. if (isDef(data)) {
  5748. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5749. if (isDef(i = vnode.componentInstance)) {
  5750. // child component. it should have hydrated its own tree.
  5751. initComponent(vnode, insertedVnodeQueue);
  5752. return true
  5753. }
  5754. }
  5755. if (isDef(tag)) {
  5756. if (isDef(children)) {
  5757. // empty element, allow client to pick up and populate children
  5758. if (!elm.hasChildNodes()) {
  5759. createChildren(vnode, children, insertedVnodeQueue);
  5760. } else {
  5761. // v-html and domProps: innerHTML
  5762. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5763. if (i !== elm.innerHTML) {
  5764. /* istanbul ignore if */
  5765. if (typeof console !== 'undefined' &&
  5766. !hydrationBailed
  5767. ) {
  5768. hydrationBailed = true;
  5769. console.warn('Parent: ', elm);
  5770. console.warn('server innerHTML: ', i);
  5771. console.warn('client innerHTML: ', elm.innerHTML);
  5772. }
  5773. return false
  5774. }
  5775. } else {
  5776. // iterate and compare children lists
  5777. var childrenMatch = true;
  5778. var childNode = elm.firstChild;
  5779. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5780. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5781. childrenMatch = false;
  5782. break
  5783. }
  5784. childNode = childNode.nextSibling;
  5785. }
  5786. // if childNode is not null, it means the actual childNodes list is
  5787. // longer than the virtual children list.
  5788. if (!childrenMatch || childNode) {
  5789. /* istanbul ignore if */
  5790. if (typeof console !== 'undefined' &&
  5791. !hydrationBailed
  5792. ) {
  5793. hydrationBailed = true;
  5794. console.warn('Parent: ', elm);
  5795. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5796. }
  5797. return false
  5798. }
  5799. }
  5800. }
  5801. }
  5802. if (isDef(data)) {
  5803. var fullInvoke = false;
  5804. for (var key in data) {
  5805. if (!isRenderedModule(key)) {
  5806. fullInvoke = true;
  5807. invokeCreateHooks(vnode, insertedVnodeQueue);
  5808. break
  5809. }
  5810. }
  5811. if (!fullInvoke && data['class']) {
  5812. // ensure collecting deps for deep class bindings for future updates
  5813. traverse(data['class']);
  5814. }
  5815. }
  5816. } else if (elm.data !== vnode.text) {
  5817. elm.data = vnode.text;
  5818. }
  5819. return true
  5820. }
  5821. function assertNodeMatch (node, vnode, inVPre) {
  5822. if (isDef(vnode.tag)) {
  5823. return vnode.tag.indexOf('vue-component') === 0 || (
  5824. !isUnknownElement$$1(vnode, inVPre) &&
  5825. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5826. )
  5827. } else {
  5828. return node.nodeType === (vnode.isComment ? 8 : 3)
  5829. }
  5830. }
  5831. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5832. if (isUndef(vnode)) {
  5833. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5834. return
  5835. }
  5836. var isInitialPatch = false;
  5837. var insertedVnodeQueue = [];
  5838. if (isUndef(oldVnode)) {
  5839. // empty mount (likely as component), create new root element
  5840. isInitialPatch = true;
  5841. createElm(vnode, insertedVnodeQueue);
  5842. } else {
  5843. var isRealElement = isDef(oldVnode.nodeType);
  5844. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5845. // patch existing root node
  5846. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5847. } else {
  5848. if (isRealElement) {
  5849. // mounting to a real element
  5850. // check if this is server-rendered content and if we can perform
  5851. // a successful hydration.
  5852. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5853. oldVnode.removeAttribute(SSR_ATTR);
  5854. hydrating = true;
  5855. }
  5856. if (isTrue(hydrating)) {
  5857. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5858. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5859. return oldVnode
  5860. } else {
  5861. warn(
  5862. 'The client-side rendered virtual DOM tree is not matching ' +
  5863. 'server-rendered content. This is likely caused by incorrect ' +
  5864. 'HTML markup, for example nesting block-level elements inside ' +
  5865. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5866. 'full client-side render.'
  5867. );
  5868. }
  5869. }
  5870. // either not server-rendered, or hydration failed.
  5871. // create an empty node and replace it
  5872. oldVnode = emptyNodeAt(oldVnode);
  5873. }
  5874. // replacing existing element
  5875. var oldElm = oldVnode.elm;
  5876. var parentElm = nodeOps.parentNode(oldElm);
  5877. // create new node
  5878. createElm(
  5879. vnode,
  5880. insertedVnodeQueue,
  5881. // extremely rare edge case: do not insert if old element is in a
  5882. // leaving transition. Only happens when combining transition +
  5883. // keep-alive + HOCs. (#4590)
  5884. oldElm._leaveCb ? null : parentElm,
  5885. nodeOps.nextSibling(oldElm)
  5886. );
  5887. // update parent placeholder node element, recursively
  5888. if (isDef(vnode.parent)) {
  5889. var ancestor = vnode.parent;
  5890. var patchable = isPatchable(vnode);
  5891. while (ancestor) {
  5892. for (var i = 0; i < cbs.destroy.length; ++i) {
  5893. cbs.destroy[i](ancestor);
  5894. }
  5895. ancestor.elm = vnode.elm;
  5896. if (patchable) {
  5897. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5898. cbs.create[i$1](emptyNode, ancestor);
  5899. }
  5900. // #6513
  5901. // invoke insert hooks that may have been merged by create hooks.
  5902. // e.g. for directives that uses the "inserted" hook.
  5903. var insert = ancestor.data.hook.insert;
  5904. if (insert.merged) {
  5905. // start at index 1 to avoid re-invoking component mounted hook
  5906. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5907. insert.fns[i$2]();
  5908. }
  5909. }
  5910. } else {
  5911. registerRef(ancestor);
  5912. }
  5913. ancestor = ancestor.parent;
  5914. }
  5915. }
  5916. // destroy old node
  5917. if (isDef(parentElm)) {
  5918. removeVnodes([oldVnode], 0, 0);
  5919. } else if (isDef(oldVnode.tag)) {
  5920. invokeDestroyHook(oldVnode);
  5921. }
  5922. }
  5923. }
  5924. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5925. return vnode.elm
  5926. }
  5927. }
  5928. /* */
  5929. var directives = {
  5930. create: updateDirectives,
  5931. update: updateDirectives,
  5932. destroy: function unbindDirectives (vnode) {
  5933. updateDirectives(vnode, emptyNode);
  5934. }
  5935. };
  5936. function updateDirectives (oldVnode, vnode) {
  5937. if (oldVnode.data.directives || vnode.data.directives) {
  5938. _update(oldVnode, vnode);
  5939. }
  5940. }
  5941. function _update (oldVnode, vnode) {
  5942. var isCreate = oldVnode === emptyNode;
  5943. var isDestroy = vnode === emptyNode;
  5944. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5945. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5946. var dirsWithInsert = [];
  5947. var dirsWithPostpatch = [];
  5948. var key, oldDir, dir;
  5949. for (key in newDirs) {
  5950. oldDir = oldDirs[key];
  5951. dir = newDirs[key];
  5952. if (!oldDir) {
  5953. // new directive, bind
  5954. callHook$1(dir, 'bind', vnode, oldVnode);
  5955. if (dir.def && dir.def.inserted) {
  5956. dirsWithInsert.push(dir);
  5957. }
  5958. } else {
  5959. // existing directive, update
  5960. dir.oldValue = oldDir.value;
  5961. dir.oldArg = oldDir.arg;
  5962. callHook$1(dir, 'update', vnode, oldVnode);
  5963. if (dir.def && dir.def.componentUpdated) {
  5964. dirsWithPostpatch.push(dir);
  5965. }
  5966. }
  5967. }
  5968. if (dirsWithInsert.length) {
  5969. var callInsert = function () {
  5970. for (var i = 0; i < dirsWithInsert.length; i++) {
  5971. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5972. }
  5973. };
  5974. if (isCreate) {
  5975. mergeVNodeHook(vnode, 'insert', callInsert);
  5976. } else {
  5977. callInsert();
  5978. }
  5979. }
  5980. if (dirsWithPostpatch.length) {
  5981. mergeVNodeHook(vnode, 'postpatch', function () {
  5982. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5983. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5984. }
  5985. });
  5986. }
  5987. if (!isCreate) {
  5988. for (key in oldDirs) {
  5989. if (!newDirs[key]) {
  5990. // no longer present, unbind
  5991. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5992. }
  5993. }
  5994. }
  5995. }
  5996. var emptyModifiers = Object.create(null);
  5997. function normalizeDirectives$1 (
  5998. dirs,
  5999. vm
  6000. ) {
  6001. var res = Object.create(null);
  6002. if (!dirs) {
  6003. // $flow-disable-line
  6004. return res
  6005. }
  6006. var i, dir;
  6007. for (i = 0; i < dirs.length; i++) {
  6008. dir = dirs[i];
  6009. if (!dir.modifiers) {
  6010. // $flow-disable-line
  6011. dir.modifiers = emptyModifiers;
  6012. }
  6013. res[getRawDirName(dir)] = dir;
  6014. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6015. }
  6016. // $flow-disable-line
  6017. return res
  6018. }
  6019. function getRawDirName (dir) {
  6020. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6021. }
  6022. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6023. var fn = dir.def && dir.def[hook];
  6024. if (fn) {
  6025. try {
  6026. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6027. } catch (e) {
  6028. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6029. }
  6030. }
  6031. }
  6032. var baseModules = [
  6033. ref,
  6034. directives
  6035. ];
  6036. /* */
  6037. function updateAttrs (oldVnode, vnode) {
  6038. var opts = vnode.componentOptions;
  6039. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6040. return
  6041. }
  6042. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6043. return
  6044. }
  6045. var key, cur, old;
  6046. var elm = vnode.elm;
  6047. var oldAttrs = oldVnode.data.attrs || {};
  6048. var attrs = vnode.data.attrs || {};
  6049. // clone observed objects, as the user probably wants to mutate it
  6050. if (isDef(attrs.__ob__)) {
  6051. attrs = vnode.data.attrs = extend({}, attrs);
  6052. }
  6053. for (key in attrs) {
  6054. cur = attrs[key];
  6055. old = oldAttrs[key];
  6056. if (old !== cur) {
  6057. setAttr(elm, key, cur);
  6058. }
  6059. }
  6060. // #4391: in IE9, setting type can reset value for input[type=radio]
  6061. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6062. /* istanbul ignore if */
  6063. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6064. setAttr(elm, 'value', attrs.value);
  6065. }
  6066. for (key in oldAttrs) {
  6067. if (isUndef(attrs[key])) {
  6068. if (isXlink(key)) {
  6069. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6070. } else if (!isEnumeratedAttr(key)) {
  6071. elm.removeAttribute(key);
  6072. }
  6073. }
  6074. }
  6075. }
  6076. function setAttr (el, key, value) {
  6077. if (el.tagName.indexOf('-') > -1) {
  6078. baseSetAttr(el, key, value);
  6079. } else if (isBooleanAttr(key)) {
  6080. // set attribute for blank value
  6081. // e.g. <option disabled>Select one</option>
  6082. if (isFalsyAttrValue(value)) {
  6083. el.removeAttribute(key);
  6084. } else {
  6085. // technically allowfullscreen is a boolean attribute for <iframe>,
  6086. // but Flash expects a value of "true" when used on <embed> tag
  6087. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6088. ? 'true'
  6089. : key;
  6090. el.setAttribute(key, value);
  6091. }
  6092. } else if (isEnumeratedAttr(key)) {
  6093. el.setAttribute(key, convertEnumeratedValue(key, value));
  6094. } else if (isXlink(key)) {
  6095. if (isFalsyAttrValue(value)) {
  6096. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6097. } else {
  6098. el.setAttributeNS(xlinkNS, key, value);
  6099. }
  6100. } else {
  6101. baseSetAttr(el, key, value);
  6102. }
  6103. }
  6104. function baseSetAttr (el, key, value) {
  6105. if (isFalsyAttrValue(value)) {
  6106. el.removeAttribute(key);
  6107. } else {
  6108. // #7138: IE10 & 11 fires input event when setting placeholder on
  6109. // <textarea>... block the first input event and remove the blocker
  6110. // immediately.
  6111. /* istanbul ignore if */
  6112. if (
  6113. isIE && !isIE9 &&
  6114. el.tagName === 'TEXTAREA' &&
  6115. key === 'placeholder' && value !== '' && !el.__ieph
  6116. ) {
  6117. var blocker = function (e) {
  6118. e.stopImmediatePropagation();
  6119. el.removeEventListener('input', blocker);
  6120. };
  6121. el.addEventListener('input', blocker);
  6122. // $flow-disable-line
  6123. el.__ieph = true; /* IE placeholder patched */
  6124. }
  6125. el.setAttribute(key, value);
  6126. }
  6127. }
  6128. var attrs = {
  6129. create: updateAttrs,
  6130. update: updateAttrs
  6131. };
  6132. /* */
  6133. function updateClass (oldVnode, vnode) {
  6134. var el = vnode.elm;
  6135. var data = vnode.data;
  6136. var oldData = oldVnode.data;
  6137. if (
  6138. isUndef(data.staticClass) &&
  6139. isUndef(data.class) && (
  6140. isUndef(oldData) || (
  6141. isUndef(oldData.staticClass) &&
  6142. isUndef(oldData.class)
  6143. )
  6144. )
  6145. ) {
  6146. return
  6147. }
  6148. var cls = genClassForVnode(vnode);
  6149. // handle transition classes
  6150. var transitionClass = el._transitionClasses;
  6151. if (isDef(transitionClass)) {
  6152. cls = concat(cls, stringifyClass(transitionClass));
  6153. }
  6154. // set the class
  6155. if (cls !== el._prevClass) {
  6156. el.setAttribute('class', cls);
  6157. el._prevClass = cls;
  6158. }
  6159. }
  6160. var klass = {
  6161. create: updateClass,
  6162. update: updateClass
  6163. };
  6164. /* */
  6165. /* */
  6166. /* */
  6167. /* */
  6168. // in some cases, the event used has to be determined at runtime
  6169. // so we used some reserved tokens during compile.
  6170. var RANGE_TOKEN = '__r';
  6171. var CHECKBOX_RADIO_TOKEN = '__c';
  6172. /* */
  6173. // normalize v-model event tokens that can only be determined at runtime.
  6174. // it's important to place the event as the first in the array because
  6175. // the whole point is ensuring the v-model callback gets called before
  6176. // user-attached handlers.
  6177. function normalizeEvents (on) {
  6178. /* istanbul ignore if */
  6179. if (isDef(on[RANGE_TOKEN])) {
  6180. // IE input[type=range] only supports `change` event
  6181. var event = isIE ? 'change' : 'input';
  6182. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6183. delete on[RANGE_TOKEN];
  6184. }
  6185. // This was originally intended to fix #4521 but no longer necessary
  6186. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6187. /* istanbul ignore if */
  6188. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6189. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6190. delete on[CHECKBOX_RADIO_TOKEN];
  6191. }
  6192. }
  6193. var target$1;
  6194. function createOnceHandler$1 (event, handler, capture) {
  6195. var _target = target$1; // save current target element in closure
  6196. return function onceHandler () {
  6197. var res = handler.apply(null, arguments);
  6198. if (res !== null) {
  6199. remove$2(event, onceHandler, capture, _target);
  6200. }
  6201. }
  6202. }
  6203. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6204. // implementation and does not fire microtasks in between event propagation, so
  6205. // safe to exclude.
  6206. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6207. function add$1 (
  6208. name,
  6209. handler,
  6210. capture,
  6211. passive
  6212. ) {
  6213. // async edge case #6566: inner click event triggers patch, event handler
  6214. // attached to outer element during patch, and triggered again. This
  6215. // happens because browsers fire microtask ticks between event propagation.
  6216. // the solution is simple: we save the timestamp when a handler is attached,
  6217. // and the handler would only fire if the event passed to it was fired
  6218. // AFTER it was attached.
  6219. if (useMicrotaskFix) {
  6220. var attachedTimestamp = currentFlushTimestamp;
  6221. var original = handler;
  6222. handler = original._wrapper = function (e) {
  6223. if (
  6224. // no bubbling, should always fire.
  6225. // this is just a safety net in case event.timeStamp is unreliable in
  6226. // certain weird environments...
  6227. e.target === e.currentTarget ||
  6228. // event is fired after handler attachment
  6229. e.timeStamp >= attachedTimestamp ||
  6230. // bail for environments that have buggy event.timeStamp implementations
  6231. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6232. // #9681 QtWebEngine event.timeStamp is negative value
  6233. e.timeStamp <= 0 ||
  6234. // #9448 bail if event is fired in another document in a multi-page
  6235. // electron/nw.js app, since event.timeStamp will be using a different
  6236. // starting reference
  6237. e.target.ownerDocument !== document
  6238. ) {
  6239. return original.apply(this, arguments)
  6240. }
  6241. };
  6242. }
  6243. target$1.addEventListener(
  6244. name,
  6245. handler,
  6246. supportsPassive
  6247. ? { capture: capture, passive: passive }
  6248. : capture
  6249. );
  6250. }
  6251. function remove$2 (
  6252. name,
  6253. handler,
  6254. capture,
  6255. _target
  6256. ) {
  6257. (_target || target$1).removeEventListener(
  6258. name,
  6259. handler._wrapper || handler,
  6260. capture
  6261. );
  6262. }
  6263. function updateDOMListeners (oldVnode, vnode) {
  6264. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6265. return
  6266. }
  6267. var on = vnode.data.on || {};
  6268. var oldOn = oldVnode.data.on || {};
  6269. target$1 = vnode.elm;
  6270. normalizeEvents(on);
  6271. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6272. target$1 = undefined;
  6273. }
  6274. var events = {
  6275. create: updateDOMListeners,
  6276. update: updateDOMListeners
  6277. };
  6278. /* */
  6279. var svgContainer;
  6280. function updateDOMProps (oldVnode, vnode) {
  6281. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6282. return
  6283. }
  6284. var key, cur;
  6285. var elm = vnode.elm;
  6286. var oldProps = oldVnode.data.domProps || {};
  6287. var props = vnode.data.domProps || {};
  6288. // clone observed objects, as the user probably wants to mutate it
  6289. if (isDef(props.__ob__)) {
  6290. props = vnode.data.domProps = extend({}, props);
  6291. }
  6292. for (key in oldProps) {
  6293. if (!(key in props)) {
  6294. elm[key] = '';
  6295. }
  6296. }
  6297. for (key in props) {
  6298. cur = props[key];
  6299. // ignore children if the node has textContent or innerHTML,
  6300. // as these will throw away existing DOM nodes and cause removal errors
  6301. // on subsequent patches (#3360)
  6302. if (key === 'textContent' || key === 'innerHTML') {
  6303. if (vnode.children) { vnode.children.length = 0; }
  6304. if (cur === oldProps[key]) { continue }
  6305. // #6601 work around Chrome version <= 55 bug where single textNode
  6306. // replaced by innerHTML/textContent retains its parentNode property
  6307. if (elm.childNodes.length === 1) {
  6308. elm.removeChild(elm.childNodes[0]);
  6309. }
  6310. }
  6311. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6312. // store value as _value as well since
  6313. // non-string values will be stringified
  6314. elm._value = cur;
  6315. // avoid resetting cursor position when value is the same
  6316. var strCur = isUndef(cur) ? '' : String(cur);
  6317. if (shouldUpdateValue(elm, strCur)) {
  6318. elm.value = strCur;
  6319. }
  6320. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6321. // IE doesn't support innerHTML for SVG elements
  6322. svgContainer = svgContainer || document.createElement('div');
  6323. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6324. var svg = svgContainer.firstChild;
  6325. while (elm.firstChild) {
  6326. elm.removeChild(elm.firstChild);
  6327. }
  6328. while (svg.firstChild) {
  6329. elm.appendChild(svg.firstChild);
  6330. }
  6331. } else if (
  6332. // skip the update if old and new VDOM state is the same.
  6333. // `value` is handled separately because the DOM value may be temporarily
  6334. // out of sync with VDOM state due to focus, composition and modifiers.
  6335. // This #4521 by skipping the unnecessary `checked` update.
  6336. cur !== oldProps[key]
  6337. ) {
  6338. // some property updates can throw
  6339. // e.g. `value` on <progress> w/ non-finite value
  6340. try {
  6341. elm[key] = cur;
  6342. } catch (e) {}
  6343. }
  6344. }
  6345. }
  6346. // check platforms/web/util/attrs.js acceptValue
  6347. function shouldUpdateValue (elm, checkVal) {
  6348. return (!elm.composing && (
  6349. elm.tagName === 'OPTION' ||
  6350. isNotInFocusAndDirty(elm, checkVal) ||
  6351. isDirtyWithModifiers(elm, checkVal)
  6352. ))
  6353. }
  6354. function isNotInFocusAndDirty (elm, checkVal) {
  6355. // return true when textbox (.number and .trim) loses focus and its value is
  6356. // not equal to the updated value
  6357. var notInFocus = true;
  6358. // #6157
  6359. // work around IE bug when accessing document.activeElement in an iframe
  6360. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6361. return notInFocus && elm.value !== checkVal
  6362. }
  6363. function isDirtyWithModifiers (elm, newVal) {
  6364. var value = elm.value;
  6365. var modifiers = elm._vModifiers; // injected by v-model runtime
  6366. if (isDef(modifiers)) {
  6367. if (modifiers.number) {
  6368. return toNumber(value) !== toNumber(newVal)
  6369. }
  6370. if (modifiers.trim) {
  6371. return value.trim() !== newVal.trim()
  6372. }
  6373. }
  6374. return value !== newVal
  6375. }
  6376. var domProps = {
  6377. create: updateDOMProps,
  6378. update: updateDOMProps
  6379. };
  6380. /* */
  6381. var parseStyleText = cached(function (cssText) {
  6382. var res = {};
  6383. var listDelimiter = /;(?![^(]*\))/g;
  6384. var propertyDelimiter = /:(.+)/;
  6385. cssText.split(listDelimiter).forEach(function (item) {
  6386. if (item) {
  6387. var tmp = item.split(propertyDelimiter);
  6388. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6389. }
  6390. });
  6391. return res
  6392. });
  6393. // merge static and dynamic style data on the same vnode
  6394. function normalizeStyleData (data) {
  6395. var style = normalizeStyleBinding(data.style);
  6396. // static style is pre-processed into an object during compilation
  6397. // and is always a fresh object, so it's safe to merge into it
  6398. return data.staticStyle
  6399. ? extend(data.staticStyle, style)
  6400. : style
  6401. }
  6402. // normalize possible array / string values into Object
  6403. function normalizeStyleBinding (bindingStyle) {
  6404. if (Array.isArray(bindingStyle)) {
  6405. return toObject(bindingStyle)
  6406. }
  6407. if (typeof bindingStyle === 'string') {
  6408. return parseStyleText(bindingStyle)
  6409. }
  6410. return bindingStyle
  6411. }
  6412. /**
  6413. * parent component style should be after child's
  6414. * so that parent component's style could override it
  6415. */
  6416. function getStyle (vnode, checkChild) {
  6417. var res = {};
  6418. var styleData;
  6419. if (checkChild) {
  6420. var childNode = vnode;
  6421. while (childNode.componentInstance) {
  6422. childNode = childNode.componentInstance._vnode;
  6423. if (
  6424. childNode && childNode.data &&
  6425. (styleData = normalizeStyleData(childNode.data))
  6426. ) {
  6427. extend(res, styleData);
  6428. }
  6429. }
  6430. }
  6431. if ((styleData = normalizeStyleData(vnode.data))) {
  6432. extend(res, styleData);
  6433. }
  6434. var parentNode = vnode;
  6435. while ((parentNode = parentNode.parent)) {
  6436. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6437. extend(res, styleData);
  6438. }
  6439. }
  6440. return res
  6441. }
  6442. /* */
  6443. var cssVarRE = /^--/;
  6444. var importantRE = /\s*!important$/;
  6445. var setProp = function (el, name, val) {
  6446. /* istanbul ignore if */
  6447. if (cssVarRE.test(name)) {
  6448. el.style.setProperty(name, val);
  6449. } else if (importantRE.test(val)) {
  6450. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  6451. } else {
  6452. var normalizedName = normalize(name);
  6453. if (Array.isArray(val)) {
  6454. // Support values array created by autoprefixer, e.g.
  6455. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6456. // Set them one by one, and the browser will only set those it can recognize
  6457. for (var i = 0, len = val.length; i < len; i++) {
  6458. el.style[normalizedName] = val[i];
  6459. }
  6460. } else {
  6461. el.style[normalizedName] = val;
  6462. }
  6463. }
  6464. };
  6465. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6466. var emptyStyle;
  6467. var normalize = cached(function (prop) {
  6468. emptyStyle = emptyStyle || document.createElement('div').style;
  6469. prop = camelize(prop);
  6470. if (prop !== 'filter' && (prop in emptyStyle)) {
  6471. return prop
  6472. }
  6473. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6474. for (var i = 0; i < vendorNames.length; i++) {
  6475. var name = vendorNames[i] + capName;
  6476. if (name in emptyStyle) {
  6477. return name
  6478. }
  6479. }
  6480. });
  6481. function updateStyle (oldVnode, vnode) {
  6482. var data = vnode.data;
  6483. var oldData = oldVnode.data;
  6484. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6485. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6486. ) {
  6487. return
  6488. }
  6489. var cur, name;
  6490. var el = vnode.elm;
  6491. var oldStaticStyle = oldData.staticStyle;
  6492. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6493. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6494. var oldStyle = oldStaticStyle || oldStyleBinding;
  6495. var style = normalizeStyleBinding(vnode.data.style) || {};
  6496. // store normalized style under a different key for next diff
  6497. // make sure to clone it if it's reactive, since the user likely wants
  6498. // to mutate it.
  6499. vnode.data.normalizedStyle = isDef(style.__ob__)
  6500. ? extend({}, style)
  6501. : style;
  6502. var newStyle = getStyle(vnode, true);
  6503. for (name in oldStyle) {
  6504. if (isUndef(newStyle[name])) {
  6505. setProp(el, name, '');
  6506. }
  6507. }
  6508. for (name in newStyle) {
  6509. cur = newStyle[name];
  6510. if (cur !== oldStyle[name]) {
  6511. // ie9 setting to null has no effect, must use empty string
  6512. setProp(el, name, cur == null ? '' : cur);
  6513. }
  6514. }
  6515. }
  6516. var style = {
  6517. create: updateStyle,
  6518. update: updateStyle
  6519. };
  6520. /* */
  6521. var whitespaceRE = /\s+/;
  6522. /**
  6523. * Add class with compatibility for SVG since classList is not supported on
  6524. * SVG elements in IE
  6525. */
  6526. function addClass (el, cls) {
  6527. /* istanbul ignore if */
  6528. if (!cls || !(cls = cls.trim())) {
  6529. return
  6530. }
  6531. /* istanbul ignore else */
  6532. if (el.classList) {
  6533. if (cls.indexOf(' ') > -1) {
  6534. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  6535. } else {
  6536. el.classList.add(cls);
  6537. }
  6538. } else {
  6539. var cur = " " + (el.getAttribute('class') || '') + " ";
  6540. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6541. el.setAttribute('class', (cur + cls).trim());
  6542. }
  6543. }
  6544. }
  6545. /**
  6546. * Remove class with compatibility for SVG since classList is not supported on
  6547. * SVG elements in IE
  6548. */
  6549. function removeClass (el, cls) {
  6550. /* istanbul ignore if */
  6551. if (!cls || !(cls = cls.trim())) {
  6552. return
  6553. }
  6554. /* istanbul ignore else */
  6555. if (el.classList) {
  6556. if (cls.indexOf(' ') > -1) {
  6557. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  6558. } else {
  6559. el.classList.remove(cls);
  6560. }
  6561. if (!el.classList.length) {
  6562. el.removeAttribute('class');
  6563. }
  6564. } else {
  6565. var cur = " " + (el.getAttribute('class') || '') + " ";
  6566. var tar = ' ' + cls + ' ';
  6567. while (cur.indexOf(tar) >= 0) {
  6568. cur = cur.replace(tar, ' ');
  6569. }
  6570. cur = cur.trim();
  6571. if (cur) {
  6572. el.setAttribute('class', cur);
  6573. } else {
  6574. el.removeAttribute('class');
  6575. }
  6576. }
  6577. }
  6578. /* */
  6579. function resolveTransition (def$$1) {
  6580. if (!def$$1) {
  6581. return
  6582. }
  6583. /* istanbul ignore else */
  6584. if (typeof def$$1 === 'object') {
  6585. var res = {};
  6586. if (def$$1.css !== false) {
  6587. extend(res, autoCssTransition(def$$1.name || 'v'));
  6588. }
  6589. extend(res, def$$1);
  6590. return res
  6591. } else if (typeof def$$1 === 'string') {
  6592. return autoCssTransition(def$$1)
  6593. }
  6594. }
  6595. var autoCssTransition = cached(function (name) {
  6596. return {
  6597. enterClass: (name + "-enter"),
  6598. enterToClass: (name + "-enter-to"),
  6599. enterActiveClass: (name + "-enter-active"),
  6600. leaveClass: (name + "-leave"),
  6601. leaveToClass: (name + "-leave-to"),
  6602. leaveActiveClass: (name + "-leave-active")
  6603. }
  6604. });
  6605. var hasTransition = inBrowser && !isIE9;
  6606. var TRANSITION = 'transition';
  6607. var ANIMATION = 'animation';
  6608. // Transition property/event sniffing
  6609. var transitionProp = 'transition';
  6610. var transitionEndEvent = 'transitionend';
  6611. var animationProp = 'animation';
  6612. var animationEndEvent = 'animationend';
  6613. if (hasTransition) {
  6614. /* istanbul ignore if */
  6615. if (window.ontransitionend === undefined &&
  6616. window.onwebkittransitionend !== undefined
  6617. ) {
  6618. transitionProp = 'WebkitTransition';
  6619. transitionEndEvent = 'webkitTransitionEnd';
  6620. }
  6621. if (window.onanimationend === undefined &&
  6622. window.onwebkitanimationend !== undefined
  6623. ) {
  6624. animationProp = 'WebkitAnimation';
  6625. animationEndEvent = 'webkitAnimationEnd';
  6626. }
  6627. }
  6628. // binding to window is necessary to make hot reload work in IE in strict mode
  6629. var raf = inBrowser
  6630. ? window.requestAnimationFrame
  6631. ? window.requestAnimationFrame.bind(window)
  6632. : setTimeout
  6633. : /* istanbul ignore next */ function (fn) { return fn(); };
  6634. function nextFrame (fn) {
  6635. raf(function () {
  6636. raf(fn);
  6637. });
  6638. }
  6639. function addTransitionClass (el, cls) {
  6640. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6641. if (transitionClasses.indexOf(cls) < 0) {
  6642. transitionClasses.push(cls);
  6643. addClass(el, cls);
  6644. }
  6645. }
  6646. function removeTransitionClass (el, cls) {
  6647. if (el._transitionClasses) {
  6648. remove(el._transitionClasses, cls);
  6649. }
  6650. removeClass(el, cls);
  6651. }
  6652. function whenTransitionEnds (
  6653. el,
  6654. expectedType,
  6655. cb
  6656. ) {
  6657. var ref = getTransitionInfo(el, expectedType);
  6658. var type = ref.type;
  6659. var timeout = ref.timeout;
  6660. var propCount = ref.propCount;
  6661. if (!type) { return cb() }
  6662. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6663. var ended = 0;
  6664. var end = function () {
  6665. el.removeEventListener(event, onEnd);
  6666. cb();
  6667. };
  6668. var onEnd = function (e) {
  6669. if (e.target === el) {
  6670. if (++ended >= propCount) {
  6671. end();
  6672. }
  6673. }
  6674. };
  6675. setTimeout(function () {
  6676. if (ended < propCount) {
  6677. end();
  6678. }
  6679. }, timeout + 1);
  6680. el.addEventListener(event, onEnd);
  6681. }
  6682. var transformRE = /\b(transform|all)(,|$)/;
  6683. function getTransitionInfo (el, expectedType) {
  6684. var styles = window.getComputedStyle(el);
  6685. // JSDOM may return undefined for transition properties
  6686. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  6687. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  6688. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6689. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  6690. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  6691. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6692. var type;
  6693. var timeout = 0;
  6694. var propCount = 0;
  6695. /* istanbul ignore if */
  6696. if (expectedType === TRANSITION) {
  6697. if (transitionTimeout > 0) {
  6698. type = TRANSITION;
  6699. timeout = transitionTimeout;
  6700. propCount = transitionDurations.length;
  6701. }
  6702. } else if (expectedType === ANIMATION) {
  6703. if (animationTimeout > 0) {
  6704. type = ANIMATION;
  6705. timeout = animationTimeout;
  6706. propCount = animationDurations.length;
  6707. }
  6708. } else {
  6709. timeout = Math.max(transitionTimeout, animationTimeout);
  6710. type = timeout > 0
  6711. ? transitionTimeout > animationTimeout
  6712. ? TRANSITION
  6713. : ANIMATION
  6714. : null;
  6715. propCount = type
  6716. ? type === TRANSITION
  6717. ? transitionDurations.length
  6718. : animationDurations.length
  6719. : 0;
  6720. }
  6721. var hasTransform =
  6722. type === TRANSITION &&
  6723. transformRE.test(styles[transitionProp + 'Property']);
  6724. return {
  6725. type: type,
  6726. timeout: timeout,
  6727. propCount: propCount,
  6728. hasTransform: hasTransform
  6729. }
  6730. }
  6731. function getTimeout (delays, durations) {
  6732. /* istanbul ignore next */
  6733. while (delays.length < durations.length) {
  6734. delays = delays.concat(delays);
  6735. }
  6736. return Math.max.apply(null, durations.map(function (d, i) {
  6737. return toMs(d) + toMs(delays[i])
  6738. }))
  6739. }
  6740. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  6741. // in a locale-dependent way, using a comma instead of a dot.
  6742. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  6743. // as a floor function) causing unexpected behaviors
  6744. function toMs (s) {
  6745. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  6746. }
  6747. /* */
  6748. function enter (vnode, toggleDisplay) {
  6749. var el = vnode.elm;
  6750. // call leave callback now
  6751. if (isDef(el._leaveCb)) {
  6752. el._leaveCb.cancelled = true;
  6753. el._leaveCb();
  6754. }
  6755. var data = resolveTransition(vnode.data.transition);
  6756. if (isUndef(data)) {
  6757. return
  6758. }
  6759. /* istanbul ignore if */
  6760. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6761. return
  6762. }
  6763. var css = data.css;
  6764. var type = data.type;
  6765. var enterClass = data.enterClass;
  6766. var enterToClass = data.enterToClass;
  6767. var enterActiveClass = data.enterActiveClass;
  6768. var appearClass = data.appearClass;
  6769. var appearToClass = data.appearToClass;
  6770. var appearActiveClass = data.appearActiveClass;
  6771. var beforeEnter = data.beforeEnter;
  6772. var enter = data.enter;
  6773. var afterEnter = data.afterEnter;
  6774. var enterCancelled = data.enterCancelled;
  6775. var beforeAppear = data.beforeAppear;
  6776. var appear = data.appear;
  6777. var afterAppear = data.afterAppear;
  6778. var appearCancelled = data.appearCancelled;
  6779. var duration = data.duration;
  6780. // activeInstance will always be the <transition> component managing this
  6781. // transition. One edge case to check is when the <transition> is placed
  6782. // as the root node of a child component. In that case we need to check
  6783. // <transition>'s parent for appear check.
  6784. var context = activeInstance;
  6785. var transitionNode = activeInstance.$vnode;
  6786. while (transitionNode && transitionNode.parent) {
  6787. context = transitionNode.context;
  6788. transitionNode = transitionNode.parent;
  6789. }
  6790. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6791. if (isAppear && !appear && appear !== '') {
  6792. return
  6793. }
  6794. var startClass = isAppear && appearClass
  6795. ? appearClass
  6796. : enterClass;
  6797. var activeClass = isAppear && appearActiveClass
  6798. ? appearActiveClass
  6799. : enterActiveClass;
  6800. var toClass = isAppear && appearToClass
  6801. ? appearToClass
  6802. : enterToClass;
  6803. var beforeEnterHook = isAppear
  6804. ? (beforeAppear || beforeEnter)
  6805. : beforeEnter;
  6806. var enterHook = isAppear
  6807. ? (typeof appear === 'function' ? appear : enter)
  6808. : enter;
  6809. var afterEnterHook = isAppear
  6810. ? (afterAppear || afterEnter)
  6811. : afterEnter;
  6812. var enterCancelledHook = isAppear
  6813. ? (appearCancelled || enterCancelled)
  6814. : enterCancelled;
  6815. var explicitEnterDuration = toNumber(
  6816. isObject(duration)
  6817. ? duration.enter
  6818. : duration
  6819. );
  6820. if (explicitEnterDuration != null) {
  6821. checkDuration(explicitEnterDuration, 'enter', vnode);
  6822. }
  6823. var expectsCSS = css !== false && !isIE9;
  6824. var userWantsControl = getHookArgumentsLength(enterHook);
  6825. var cb = el._enterCb = once(function () {
  6826. if (expectsCSS) {
  6827. removeTransitionClass(el, toClass);
  6828. removeTransitionClass(el, activeClass);
  6829. }
  6830. if (cb.cancelled) {
  6831. if (expectsCSS) {
  6832. removeTransitionClass(el, startClass);
  6833. }
  6834. enterCancelledHook && enterCancelledHook(el);
  6835. } else {
  6836. afterEnterHook && afterEnterHook(el);
  6837. }
  6838. el._enterCb = null;
  6839. });
  6840. if (!vnode.data.show) {
  6841. // remove pending leave element on enter by injecting an insert hook
  6842. mergeVNodeHook(vnode, 'insert', function () {
  6843. var parent = el.parentNode;
  6844. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6845. if (pendingNode &&
  6846. pendingNode.tag === vnode.tag &&
  6847. pendingNode.elm._leaveCb
  6848. ) {
  6849. pendingNode.elm._leaveCb();
  6850. }
  6851. enterHook && enterHook(el, cb);
  6852. });
  6853. }
  6854. // start enter transition
  6855. beforeEnterHook && beforeEnterHook(el);
  6856. if (expectsCSS) {
  6857. addTransitionClass(el, startClass);
  6858. addTransitionClass(el, activeClass);
  6859. nextFrame(function () {
  6860. removeTransitionClass(el, startClass);
  6861. if (!cb.cancelled) {
  6862. addTransitionClass(el, toClass);
  6863. if (!userWantsControl) {
  6864. if (isValidDuration(explicitEnterDuration)) {
  6865. setTimeout(cb, explicitEnterDuration);
  6866. } else {
  6867. whenTransitionEnds(el, type, cb);
  6868. }
  6869. }
  6870. }
  6871. });
  6872. }
  6873. if (vnode.data.show) {
  6874. toggleDisplay && toggleDisplay();
  6875. enterHook && enterHook(el, cb);
  6876. }
  6877. if (!expectsCSS && !userWantsControl) {
  6878. cb();
  6879. }
  6880. }
  6881. function leave (vnode, rm) {
  6882. var el = vnode.elm;
  6883. // call enter callback now
  6884. if (isDef(el._enterCb)) {
  6885. el._enterCb.cancelled = true;
  6886. el._enterCb();
  6887. }
  6888. var data = resolveTransition(vnode.data.transition);
  6889. if (isUndef(data) || el.nodeType !== 1) {
  6890. return rm()
  6891. }
  6892. /* istanbul ignore if */
  6893. if (isDef(el._leaveCb)) {
  6894. return
  6895. }
  6896. var css = data.css;
  6897. var type = data.type;
  6898. var leaveClass = data.leaveClass;
  6899. var leaveToClass = data.leaveToClass;
  6900. var leaveActiveClass = data.leaveActiveClass;
  6901. var beforeLeave = data.beforeLeave;
  6902. var leave = data.leave;
  6903. var afterLeave = data.afterLeave;
  6904. var leaveCancelled = data.leaveCancelled;
  6905. var delayLeave = data.delayLeave;
  6906. var duration = data.duration;
  6907. var expectsCSS = css !== false && !isIE9;
  6908. var userWantsControl = getHookArgumentsLength(leave);
  6909. var explicitLeaveDuration = toNumber(
  6910. isObject(duration)
  6911. ? duration.leave
  6912. : duration
  6913. );
  6914. if (isDef(explicitLeaveDuration)) {
  6915. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6916. }
  6917. var cb = el._leaveCb = once(function () {
  6918. if (el.parentNode && el.parentNode._pending) {
  6919. el.parentNode._pending[vnode.key] = null;
  6920. }
  6921. if (expectsCSS) {
  6922. removeTransitionClass(el, leaveToClass);
  6923. removeTransitionClass(el, leaveActiveClass);
  6924. }
  6925. if (cb.cancelled) {
  6926. if (expectsCSS) {
  6927. removeTransitionClass(el, leaveClass);
  6928. }
  6929. leaveCancelled && leaveCancelled(el);
  6930. } else {
  6931. rm();
  6932. afterLeave && afterLeave(el);
  6933. }
  6934. el._leaveCb = null;
  6935. });
  6936. if (delayLeave) {
  6937. delayLeave(performLeave);
  6938. } else {
  6939. performLeave();
  6940. }
  6941. function performLeave () {
  6942. // the delayed leave may have already been cancelled
  6943. if (cb.cancelled) {
  6944. return
  6945. }
  6946. // record leaving element
  6947. if (!vnode.data.show && el.parentNode) {
  6948. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6949. }
  6950. beforeLeave && beforeLeave(el);
  6951. if (expectsCSS) {
  6952. addTransitionClass(el, leaveClass);
  6953. addTransitionClass(el, leaveActiveClass);
  6954. nextFrame(function () {
  6955. removeTransitionClass(el, leaveClass);
  6956. if (!cb.cancelled) {
  6957. addTransitionClass(el, leaveToClass);
  6958. if (!userWantsControl) {
  6959. if (isValidDuration(explicitLeaveDuration)) {
  6960. setTimeout(cb, explicitLeaveDuration);
  6961. } else {
  6962. whenTransitionEnds(el, type, cb);
  6963. }
  6964. }
  6965. }
  6966. });
  6967. }
  6968. leave && leave(el, cb);
  6969. if (!expectsCSS && !userWantsControl) {
  6970. cb();
  6971. }
  6972. }
  6973. }
  6974. // only used in dev mode
  6975. function checkDuration (val, name, vnode) {
  6976. if (typeof val !== 'number') {
  6977. warn(
  6978. "<transition> explicit " + name + " duration is not a valid number - " +
  6979. "got " + (JSON.stringify(val)) + ".",
  6980. vnode.context
  6981. );
  6982. } else if (isNaN(val)) {
  6983. warn(
  6984. "<transition> explicit " + name + " duration is NaN - " +
  6985. 'the duration expression might be incorrect.',
  6986. vnode.context
  6987. );
  6988. }
  6989. }
  6990. function isValidDuration (val) {
  6991. return typeof val === 'number' && !isNaN(val)
  6992. }
  6993. /**
  6994. * Normalize a transition hook's argument length. The hook may be:
  6995. * - a merged hook (invoker) with the original in .fns
  6996. * - a wrapped component method (check ._length)
  6997. * - a plain function (.length)
  6998. */
  6999. function getHookArgumentsLength (fn) {
  7000. if (isUndef(fn)) {
  7001. return false
  7002. }
  7003. var invokerFns = fn.fns;
  7004. if (isDef(invokerFns)) {
  7005. // invoker
  7006. return getHookArgumentsLength(
  7007. Array.isArray(invokerFns)
  7008. ? invokerFns[0]
  7009. : invokerFns
  7010. )
  7011. } else {
  7012. return (fn._length || fn.length) > 1
  7013. }
  7014. }
  7015. function _enter (_, vnode) {
  7016. if (vnode.data.show !== true) {
  7017. enter(vnode);
  7018. }
  7019. }
  7020. var transition = inBrowser ? {
  7021. create: _enter,
  7022. activate: _enter,
  7023. remove: function remove$$1 (vnode, rm) {
  7024. /* istanbul ignore else */
  7025. if (vnode.data.show !== true) {
  7026. leave(vnode, rm);
  7027. } else {
  7028. rm();
  7029. }
  7030. }
  7031. } : {};
  7032. var platformModules = [
  7033. attrs,
  7034. klass,
  7035. events,
  7036. domProps,
  7037. style,
  7038. transition
  7039. ];
  7040. /* */
  7041. // the directive module should be applied last, after all
  7042. // built-in modules have been applied.
  7043. var modules = platformModules.concat(baseModules);
  7044. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7045. /**
  7046. * Not type checking this file because flow doesn't like attaching
  7047. * properties to Elements.
  7048. */
  7049. /* istanbul ignore if */
  7050. if (isIE9) {
  7051. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7052. document.addEventListener('selectionchange', function () {
  7053. var el = document.activeElement;
  7054. if (el && el.vmodel) {
  7055. trigger(el, 'input');
  7056. }
  7057. });
  7058. }
  7059. var directive = {
  7060. inserted: function inserted (el, binding, vnode, oldVnode) {
  7061. if (vnode.tag === 'select') {
  7062. // #6903
  7063. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7064. mergeVNodeHook(vnode, 'postpatch', function () {
  7065. directive.componentUpdated(el, binding, vnode);
  7066. });
  7067. } else {
  7068. setSelected(el, binding, vnode.context);
  7069. }
  7070. el._vOptions = [].map.call(el.options, getValue);
  7071. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7072. el._vModifiers = binding.modifiers;
  7073. if (!binding.modifiers.lazy) {
  7074. el.addEventListener('compositionstart', onCompositionStart);
  7075. el.addEventListener('compositionend', onCompositionEnd);
  7076. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7077. // switching focus before confirming composition choice
  7078. // this also fixes the issue where some browsers e.g. iOS Chrome
  7079. // fires "change" instead of "input" on autocomplete.
  7080. el.addEventListener('change', onCompositionEnd);
  7081. /* istanbul ignore if */
  7082. if (isIE9) {
  7083. el.vmodel = true;
  7084. }
  7085. }
  7086. }
  7087. },
  7088. componentUpdated: function componentUpdated (el, binding, vnode) {
  7089. if (vnode.tag === 'select') {
  7090. setSelected(el, binding, vnode.context);
  7091. // in case the options rendered by v-for have changed,
  7092. // it's possible that the value is out-of-sync with the rendered options.
  7093. // detect such cases and filter out values that no longer has a matching
  7094. // option in the DOM.
  7095. var prevOptions = el._vOptions;
  7096. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7097. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7098. // trigger change event if
  7099. // no matching option found for at least one value
  7100. var needReset = el.multiple
  7101. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7102. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7103. if (needReset) {
  7104. trigger(el, 'change');
  7105. }
  7106. }
  7107. }
  7108. }
  7109. };
  7110. function setSelected (el, binding, vm) {
  7111. actuallySetSelected(el, binding, vm);
  7112. /* istanbul ignore if */
  7113. if (isIE || isEdge) {
  7114. setTimeout(function () {
  7115. actuallySetSelected(el, binding, vm);
  7116. }, 0);
  7117. }
  7118. }
  7119. function actuallySetSelected (el, binding, vm) {
  7120. var value = binding.value;
  7121. var isMultiple = el.multiple;
  7122. if (isMultiple && !Array.isArray(value)) {
  7123. warn(
  7124. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7125. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7126. vm
  7127. );
  7128. return
  7129. }
  7130. var selected, option;
  7131. for (var i = 0, l = el.options.length; i < l; i++) {
  7132. option = el.options[i];
  7133. if (isMultiple) {
  7134. selected = looseIndexOf(value, getValue(option)) > -1;
  7135. if (option.selected !== selected) {
  7136. option.selected = selected;
  7137. }
  7138. } else {
  7139. if (looseEqual(getValue(option), value)) {
  7140. if (el.selectedIndex !== i) {
  7141. el.selectedIndex = i;
  7142. }
  7143. return
  7144. }
  7145. }
  7146. }
  7147. if (!isMultiple) {
  7148. el.selectedIndex = -1;
  7149. }
  7150. }
  7151. function hasNoMatchingOption (value, options) {
  7152. return options.every(function (o) { return !looseEqual(o, value); })
  7153. }
  7154. function getValue (option) {
  7155. return '_value' in option
  7156. ? option._value
  7157. : option.value
  7158. }
  7159. function onCompositionStart (e) {
  7160. e.target.composing = true;
  7161. }
  7162. function onCompositionEnd (e) {
  7163. // prevent triggering an input event for no reason
  7164. if (!e.target.composing) { return }
  7165. e.target.composing = false;
  7166. trigger(e.target, 'input');
  7167. }
  7168. function trigger (el, type) {
  7169. var e = document.createEvent('HTMLEvents');
  7170. e.initEvent(type, true, true);
  7171. el.dispatchEvent(e);
  7172. }
  7173. /* */
  7174. // recursively search for possible transition defined inside the component root
  7175. function locateNode (vnode) {
  7176. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7177. ? locateNode(vnode.componentInstance._vnode)
  7178. : vnode
  7179. }
  7180. var show = {
  7181. bind: function bind (el, ref, vnode) {
  7182. var value = ref.value;
  7183. vnode = locateNode(vnode);
  7184. var transition$$1 = vnode.data && vnode.data.transition;
  7185. var originalDisplay = el.__vOriginalDisplay =
  7186. el.style.display === 'none' ? '' : el.style.display;
  7187. if (value && transition$$1) {
  7188. vnode.data.show = true;
  7189. enter(vnode, function () {
  7190. el.style.display = originalDisplay;
  7191. });
  7192. } else {
  7193. el.style.display = value ? originalDisplay : 'none';
  7194. }
  7195. },
  7196. update: function update (el, ref, vnode) {
  7197. var value = ref.value;
  7198. var oldValue = ref.oldValue;
  7199. /* istanbul ignore if */
  7200. if (!value === !oldValue) { return }
  7201. vnode = locateNode(vnode);
  7202. var transition$$1 = vnode.data && vnode.data.transition;
  7203. if (transition$$1) {
  7204. vnode.data.show = true;
  7205. if (value) {
  7206. enter(vnode, function () {
  7207. el.style.display = el.__vOriginalDisplay;
  7208. });
  7209. } else {
  7210. leave(vnode, function () {
  7211. el.style.display = 'none';
  7212. });
  7213. }
  7214. } else {
  7215. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7216. }
  7217. },
  7218. unbind: function unbind (
  7219. el,
  7220. binding,
  7221. vnode,
  7222. oldVnode,
  7223. isDestroy
  7224. ) {
  7225. if (!isDestroy) {
  7226. el.style.display = el.__vOriginalDisplay;
  7227. }
  7228. }
  7229. };
  7230. var platformDirectives = {
  7231. model: directive,
  7232. show: show
  7233. };
  7234. /* */
  7235. var transitionProps = {
  7236. name: String,
  7237. appear: Boolean,
  7238. css: Boolean,
  7239. mode: String,
  7240. type: String,
  7241. enterClass: String,
  7242. leaveClass: String,
  7243. enterToClass: String,
  7244. leaveToClass: String,
  7245. enterActiveClass: String,
  7246. leaveActiveClass: String,
  7247. appearClass: String,
  7248. appearActiveClass: String,
  7249. appearToClass: String,
  7250. duration: [Number, String, Object]
  7251. };
  7252. // in case the child is also an abstract component, e.g. <keep-alive>
  7253. // we want to recursively retrieve the real component to be rendered
  7254. function getRealChild (vnode) {
  7255. var compOptions = vnode && vnode.componentOptions;
  7256. if (compOptions && compOptions.Ctor.options.abstract) {
  7257. return getRealChild(getFirstComponentChild(compOptions.children))
  7258. } else {
  7259. return vnode
  7260. }
  7261. }
  7262. function extractTransitionData (comp) {
  7263. var data = {};
  7264. var options = comp.$options;
  7265. // props
  7266. for (var key in options.propsData) {
  7267. data[key] = comp[key];
  7268. }
  7269. // events.
  7270. // extract listeners and pass them directly to the transition methods
  7271. var listeners = options._parentListeners;
  7272. for (var key$1 in listeners) {
  7273. data[camelize(key$1)] = listeners[key$1];
  7274. }
  7275. return data
  7276. }
  7277. function placeholder (h, rawChild) {
  7278. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7279. return h('keep-alive', {
  7280. props: rawChild.componentOptions.propsData
  7281. })
  7282. }
  7283. }
  7284. function hasParentTransition (vnode) {
  7285. while ((vnode = vnode.parent)) {
  7286. if (vnode.data.transition) {
  7287. return true
  7288. }
  7289. }
  7290. }
  7291. function isSameChild (child, oldChild) {
  7292. return oldChild.key === child.key && oldChild.tag === child.tag
  7293. }
  7294. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7295. var isVShowDirective = function (d) { return d.name === 'show'; };
  7296. var Transition = {
  7297. name: 'transition',
  7298. props: transitionProps,
  7299. abstract: true,
  7300. render: function render (h) {
  7301. var this$1 = this;
  7302. var children = this.$slots.default;
  7303. if (!children) {
  7304. return
  7305. }
  7306. // filter out text nodes (possible whitespaces)
  7307. children = children.filter(isNotTextNode);
  7308. /* istanbul ignore if */
  7309. if (!children.length) {
  7310. return
  7311. }
  7312. // warn multiple elements
  7313. if (children.length > 1) {
  7314. warn(
  7315. '<transition> can only be used on a single element. Use ' +
  7316. '<transition-group> for lists.',
  7317. this.$parent
  7318. );
  7319. }
  7320. var mode = this.mode;
  7321. // warn invalid mode
  7322. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7323. ) {
  7324. warn(
  7325. 'invalid <transition> mode: ' + mode,
  7326. this.$parent
  7327. );
  7328. }
  7329. var rawChild = children[0];
  7330. // if this is a component root node and the component's
  7331. // parent container node also has transition, skip.
  7332. if (hasParentTransition(this.$vnode)) {
  7333. return rawChild
  7334. }
  7335. // apply transition data to child
  7336. // use getRealChild() to ignore abstract components e.g. keep-alive
  7337. var child = getRealChild(rawChild);
  7338. /* istanbul ignore if */
  7339. if (!child) {
  7340. return rawChild
  7341. }
  7342. if (this._leaving) {
  7343. return placeholder(h, rawChild)
  7344. }
  7345. // ensure a key that is unique to the vnode type and to this transition
  7346. // component instance. This key will be used to remove pending leaving nodes
  7347. // during entering.
  7348. var id = "__transition-" + (this._uid) + "-";
  7349. child.key = child.key == null
  7350. ? child.isComment
  7351. ? id + 'comment'
  7352. : id + child.tag
  7353. : isPrimitive(child.key)
  7354. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7355. : child.key;
  7356. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7357. var oldRawChild = this._vnode;
  7358. var oldChild = getRealChild(oldRawChild);
  7359. // mark v-show
  7360. // so that the transition module can hand over the control to the directive
  7361. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7362. child.data.show = true;
  7363. }
  7364. if (
  7365. oldChild &&
  7366. oldChild.data &&
  7367. !isSameChild(child, oldChild) &&
  7368. !isAsyncPlaceholder(oldChild) &&
  7369. // #6687 component root is a comment node
  7370. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7371. ) {
  7372. // replace old child transition data with fresh one
  7373. // important for dynamic transitions!
  7374. var oldData = oldChild.data.transition = extend({}, data);
  7375. // handle transition mode
  7376. if (mode === 'out-in') {
  7377. // return placeholder node and queue update when leave finishes
  7378. this._leaving = true;
  7379. mergeVNodeHook(oldData, 'afterLeave', function () {
  7380. this$1._leaving = false;
  7381. this$1.$forceUpdate();
  7382. });
  7383. return placeholder(h, rawChild)
  7384. } else if (mode === 'in-out') {
  7385. if (isAsyncPlaceholder(child)) {
  7386. return oldRawChild
  7387. }
  7388. var delayedLeave;
  7389. var performLeave = function () { delayedLeave(); };
  7390. mergeVNodeHook(data, 'afterEnter', performLeave);
  7391. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7392. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7393. }
  7394. }
  7395. return rawChild
  7396. }
  7397. };
  7398. /* */
  7399. var props = extend({
  7400. tag: String,
  7401. moveClass: String
  7402. }, transitionProps);
  7403. delete props.mode;
  7404. var TransitionGroup = {
  7405. props: props,
  7406. beforeMount: function beforeMount () {
  7407. var this$1 = this;
  7408. var update = this._update;
  7409. this._update = function (vnode, hydrating) {
  7410. var restoreActiveInstance = setActiveInstance(this$1);
  7411. // force removing pass
  7412. this$1.__patch__(
  7413. this$1._vnode,
  7414. this$1.kept,
  7415. false, // hydrating
  7416. true // removeOnly (!important, avoids unnecessary moves)
  7417. );
  7418. this$1._vnode = this$1.kept;
  7419. restoreActiveInstance();
  7420. update.call(this$1, vnode, hydrating);
  7421. };
  7422. },
  7423. render: function render (h) {
  7424. var tag = this.tag || this.$vnode.data.tag || 'span';
  7425. var map = Object.create(null);
  7426. var prevChildren = this.prevChildren = this.children;
  7427. var rawChildren = this.$slots.default || [];
  7428. var children = this.children = [];
  7429. var transitionData = extractTransitionData(this);
  7430. for (var i = 0; i < rawChildren.length; i++) {
  7431. var c = rawChildren[i];
  7432. if (c.tag) {
  7433. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7434. children.push(c);
  7435. map[c.key] = c
  7436. ;(c.data || (c.data = {})).transition = transitionData;
  7437. } else {
  7438. var opts = c.componentOptions;
  7439. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7440. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7441. }
  7442. }
  7443. }
  7444. if (prevChildren) {
  7445. var kept = [];
  7446. var removed = [];
  7447. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7448. var c$1 = prevChildren[i$1];
  7449. c$1.data.transition = transitionData;
  7450. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7451. if (map[c$1.key]) {
  7452. kept.push(c$1);
  7453. } else {
  7454. removed.push(c$1);
  7455. }
  7456. }
  7457. this.kept = h(tag, null, kept);
  7458. this.removed = removed;
  7459. }
  7460. return h(tag, null, children)
  7461. },
  7462. updated: function updated () {
  7463. var children = this.prevChildren;
  7464. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7465. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7466. return
  7467. }
  7468. // we divide the work into three loops to avoid mixing DOM reads and writes
  7469. // in each iteration - which helps prevent layout thrashing.
  7470. children.forEach(callPendingCbs);
  7471. children.forEach(recordPosition);
  7472. children.forEach(applyTranslation);
  7473. // force reflow to put everything in position
  7474. // assign to this to avoid being removed in tree-shaking
  7475. // $flow-disable-line
  7476. this._reflow = document.body.offsetHeight;
  7477. children.forEach(function (c) {
  7478. if (c.data.moved) {
  7479. var el = c.elm;
  7480. var s = el.style;
  7481. addTransitionClass(el, moveClass);
  7482. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7483. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7484. if (e && e.target !== el) {
  7485. return
  7486. }
  7487. if (!e || /transform$/.test(e.propertyName)) {
  7488. el.removeEventListener(transitionEndEvent, cb);
  7489. el._moveCb = null;
  7490. removeTransitionClass(el, moveClass);
  7491. }
  7492. });
  7493. }
  7494. });
  7495. },
  7496. methods: {
  7497. hasMove: function hasMove (el, moveClass) {
  7498. /* istanbul ignore if */
  7499. if (!hasTransition) {
  7500. return false
  7501. }
  7502. /* istanbul ignore if */
  7503. if (this._hasMove) {
  7504. return this._hasMove
  7505. }
  7506. // Detect whether an element with the move class applied has
  7507. // CSS transitions. Since the element may be inside an entering
  7508. // transition at this very moment, we make a clone of it and remove
  7509. // all other transition classes applied to ensure only the move class
  7510. // is applied.
  7511. var clone = el.cloneNode();
  7512. if (el._transitionClasses) {
  7513. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7514. }
  7515. addClass(clone, moveClass);
  7516. clone.style.display = 'none';
  7517. this.$el.appendChild(clone);
  7518. var info = getTransitionInfo(clone);
  7519. this.$el.removeChild(clone);
  7520. return (this._hasMove = info.hasTransform)
  7521. }
  7522. }
  7523. };
  7524. function callPendingCbs (c) {
  7525. /* istanbul ignore if */
  7526. if (c.elm._moveCb) {
  7527. c.elm._moveCb();
  7528. }
  7529. /* istanbul ignore if */
  7530. if (c.elm._enterCb) {
  7531. c.elm._enterCb();
  7532. }
  7533. }
  7534. function recordPosition (c) {
  7535. c.data.newPos = c.elm.getBoundingClientRect();
  7536. }
  7537. function applyTranslation (c) {
  7538. var oldPos = c.data.pos;
  7539. var newPos = c.data.newPos;
  7540. var dx = oldPos.left - newPos.left;
  7541. var dy = oldPos.top - newPos.top;
  7542. if (dx || dy) {
  7543. c.data.moved = true;
  7544. var s = c.elm.style;
  7545. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7546. s.transitionDuration = '0s';
  7547. }
  7548. }
  7549. var platformComponents = {
  7550. Transition: Transition,
  7551. TransitionGroup: TransitionGroup
  7552. };
  7553. /* */
  7554. // install platform specific utils
  7555. Vue.config.mustUseProp = mustUseProp;
  7556. Vue.config.isReservedTag = isReservedTag;
  7557. Vue.config.isReservedAttr = isReservedAttr;
  7558. Vue.config.getTagNamespace = getTagNamespace;
  7559. Vue.config.isUnknownElement = isUnknownElement;
  7560. // install platform runtime directives & components
  7561. extend(Vue.options.directives, platformDirectives);
  7562. extend(Vue.options.components, platformComponents);
  7563. // install platform patch function
  7564. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7565. // public mount method
  7566. Vue.prototype.$mount = function (
  7567. el,
  7568. hydrating
  7569. ) {
  7570. el = el && inBrowser ? query(el) : undefined;
  7571. return mountComponent(this, el, hydrating)
  7572. };
  7573. // devtools global hook
  7574. /* istanbul ignore next */
  7575. if (inBrowser) {
  7576. setTimeout(function () {
  7577. if (config.devtools) {
  7578. if (devtools) {
  7579. devtools.emit('init', Vue);
  7580. } else {
  7581. console[console.info ? 'info' : 'log'](
  7582. 'Download the Vue Devtools extension for a better development experience:\n' +
  7583. 'https://github.com/vuejs/vue-devtools'
  7584. );
  7585. }
  7586. }
  7587. if (config.productionTip !== false &&
  7588. typeof console !== 'undefined'
  7589. ) {
  7590. console[console.info ? 'info' : 'log'](
  7591. "You are running Vue in development mode.\n" +
  7592. "Make sure to turn on production mode when deploying for production.\n" +
  7593. "See more tips at https://vuejs.org/guide/deployment.html"
  7594. );
  7595. }
  7596. }, 0);
  7597. }
  7598. /* */
  7599. module.exports = Vue;