vue.runtime.common.js 174 KB

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