vue.runtime.js 233 KB

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