vue.common.js 141 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613
  1. /*!
  2. * Vue.js v2.0.3
  3. * (c) 2014-2016 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, 10);
  24. return (n || n === 0) ? n : val
  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$1 (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-delmited 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$1 (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. * Generate a static keys string from compiler modules.
  180. */
  181. function genStaticKeys (modules) {
  182. return modules.reduce(function (keys, m) {
  183. return keys.concat(m.staticKeys || [])
  184. }, []).join(',')
  185. }
  186. /**
  187. * Check if two values are loosely equal - that is,
  188. * if they are plain objects, do they have the same shape?
  189. */
  190. function looseEqual (a, b) {
  191. /* eslint-disable eqeqeq */
  192. return a == b || (
  193. isObject(a) && isObject(b)
  194. ? JSON.stringify(a) === JSON.stringify(b)
  195. : false
  196. )
  197. /* eslint-enable eqeqeq */
  198. }
  199. function looseIndexOf (arr, val) {
  200. for (var i = 0; i < arr.length; i++) {
  201. if (looseEqual(arr[i], val)) { return i }
  202. }
  203. return -1
  204. }
  205. /* */
  206. var config = {
  207. /**
  208. * Option merge strategies (used in core/util/options)
  209. */
  210. optionMergeStrategies: Object.create(null),
  211. /**
  212. * Whether to suppress warnings.
  213. */
  214. silent: false,
  215. /**
  216. * Whether to enable devtools
  217. */
  218. devtools: process.env.NODE_ENV !== 'production',
  219. /**
  220. * Error handler for watcher errors
  221. */
  222. errorHandler: null,
  223. /**
  224. * Ignore certain custom elements
  225. */
  226. ignoredElements: null,
  227. /**
  228. * Custom user key aliases for v-on
  229. */
  230. keyCodes: Object.create(null),
  231. /**
  232. * Check if a tag is reserved so that it cannot be registered as a
  233. * component. This is platform-dependent and may be overwritten.
  234. */
  235. isReservedTag: no,
  236. /**
  237. * Check if a tag is an unknown element.
  238. * Platform-dependent.
  239. */
  240. isUnknownElement: no,
  241. /**
  242. * Get the namespace of an element
  243. */
  244. getTagNamespace: noop,
  245. /**
  246. * Check if an attribute must be bound using property, e.g. value
  247. * Platform-dependent.
  248. */
  249. mustUseProp: no,
  250. /**
  251. * List of asset types that a component can own.
  252. */
  253. _assetTypes: [
  254. 'component',
  255. 'directive',
  256. 'filter'
  257. ],
  258. /**
  259. * List of lifecycle hooks.
  260. */
  261. _lifecycleHooks: [
  262. 'beforeCreate',
  263. 'created',
  264. 'beforeMount',
  265. 'mounted',
  266. 'beforeUpdate',
  267. 'updated',
  268. 'beforeDestroy',
  269. 'destroyed',
  270. 'activated',
  271. 'deactivated'
  272. ],
  273. /**
  274. * Max circular updates allowed in a scheduler flush cycle.
  275. */
  276. _maxUpdateCount: 100,
  277. /**
  278. * Server rendering?
  279. */
  280. _isServer: process.env.VUE_ENV === 'server'
  281. };
  282. /* */
  283. /**
  284. * Check if a string starts with $ or _
  285. */
  286. function isReserved (str) {
  287. var c = (str + '').charCodeAt(0);
  288. return c === 0x24 || c === 0x5F
  289. }
  290. /**
  291. * Define a property.
  292. */
  293. function def (obj, key, val, enumerable) {
  294. Object.defineProperty(obj, key, {
  295. value: val,
  296. enumerable: !!enumerable,
  297. writable: true,
  298. configurable: true
  299. });
  300. }
  301. /**
  302. * Parse simple path.
  303. */
  304. var bailRE = /[^\w\.\$]/;
  305. function parsePath (path) {
  306. if (bailRE.test(path)) {
  307. return
  308. } else {
  309. var segments = path.split('.');
  310. return function (obj) {
  311. for (var i = 0; i < segments.length; i++) {
  312. if (!obj) { return }
  313. obj = obj[segments[i]];
  314. }
  315. return obj
  316. }
  317. }
  318. }
  319. /* */
  320. /* globals MutationObserver */
  321. // can we use __proto__?
  322. var hasProto = '__proto__' in {};
  323. // Browser environment sniffing
  324. var inBrowser =
  325. typeof window !== 'undefined' &&
  326. Object.prototype.toString.call(window) !== '[object Object]';
  327. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  328. var isIE = UA && /msie|trident/.test(UA);
  329. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  330. var isEdge = UA && UA.indexOf('edge/') > 0;
  331. var isAndroid = UA && UA.indexOf('android') > 0;
  332. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  333. // detect devtools
  334. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  335. /* istanbul ignore next */
  336. function isNative (Ctor) {
  337. return /native code/.test(Ctor.toString())
  338. }
  339. /**
  340. * Defer a task to execute it asynchronously.
  341. */
  342. var nextTick = (function () {
  343. var callbacks = [];
  344. var pending = false;
  345. var timerFunc;
  346. function nextTickHandler () {
  347. pending = false;
  348. var copies = callbacks.slice(0);
  349. callbacks.length = 0;
  350. for (var i = 0; i < copies.length; i++) {
  351. copies[i]();
  352. }
  353. }
  354. // the nextTick behavior leverages the microtask queue, which can be accessed
  355. // via either native Promise.then or MutationObserver.
  356. // MutationObserver has wider support, however it is seriously bugged in
  357. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  358. // completely stops working after triggering a few times... so, if native
  359. // Promise is available, we will use it:
  360. /* istanbul ignore if */
  361. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  362. var p = Promise.resolve();
  363. timerFunc = function () {
  364. p.then(nextTickHandler);
  365. // in problematic UIWebViews, Promise.then doesn't completely break, but
  366. // it can get stuck in a weird state where callbacks are pushed into the
  367. // microtask queue but the queue isn't being flushed, until the browser
  368. // needs to do some other work, e.g. handle a timer. Therefore we can
  369. // "force" the microtask queue to be flushed by adding an empty timer.
  370. if (isIOS) { setTimeout(noop); }
  371. };
  372. } else if (typeof MutationObserver !== 'undefined' && (
  373. isNative(MutationObserver) ||
  374. // PhantomJS and iOS 7.x
  375. MutationObserver.toString() === '[object MutationObserverConstructor]'
  376. )) {
  377. // use MutationObserver where native Promise is not available,
  378. // e.g. PhantomJS IE11, iOS7, Android 4.4
  379. var counter = 1;
  380. var observer = new MutationObserver(nextTickHandler);
  381. var textNode = document.createTextNode(String(counter));
  382. observer.observe(textNode, {
  383. characterData: true
  384. });
  385. timerFunc = function () {
  386. counter = (counter + 1) % 2;
  387. textNode.data = String(counter);
  388. };
  389. } else {
  390. // fallback to setTimeout
  391. /* istanbul ignore next */
  392. timerFunc = function () {
  393. setTimeout(nextTickHandler, 0);
  394. };
  395. }
  396. return function queueNextTick (cb, ctx) {
  397. var func = ctx
  398. ? function () { cb.call(ctx); }
  399. : cb;
  400. callbacks.push(func);
  401. if (!pending) {
  402. pending = true;
  403. timerFunc();
  404. }
  405. }
  406. })();
  407. var _Set;
  408. /* istanbul ignore if */
  409. if (typeof Set !== 'undefined' && isNative(Set)) {
  410. // use native Set when available.
  411. _Set = Set;
  412. } else {
  413. // a non-standard Set polyfill that only works with primitive keys.
  414. _Set = (function () {
  415. function Set () {
  416. this.set = Object.create(null);
  417. }
  418. Set.prototype.has = function has (key) {
  419. return this.set[key] !== undefined
  420. };
  421. Set.prototype.add = function add (key) {
  422. this.set[key] = 1;
  423. };
  424. Set.prototype.clear = function clear () {
  425. this.set = Object.create(null);
  426. };
  427. return Set;
  428. }());
  429. }
  430. /* not type checking this file because flow doesn't play well with Proxy */
  431. var hasProxy;
  432. var proxyHandlers;
  433. var initProxy;
  434. if (process.env.NODE_ENV !== 'production') {
  435. var allowedGlobals = makeMap(
  436. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  437. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  438. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  439. 'require' // for Webpack/Browserify
  440. );
  441. hasProxy =
  442. typeof Proxy !== 'undefined' &&
  443. Proxy.toString().match(/native code/);
  444. proxyHandlers = {
  445. has: function has (target, key) {
  446. var has = key in target;
  447. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  448. if (!has && !isAllowed) {
  449. warn(
  450. "Property or method \"" + key + "\" is not defined on the instance but " +
  451. "referenced during render. Make sure to declare reactive data " +
  452. "properties in the data option.",
  453. target
  454. );
  455. }
  456. return has || !isAllowed
  457. }
  458. };
  459. initProxy = function initProxy (vm) {
  460. if (hasProxy) {
  461. vm._renderProxy = new Proxy(vm, proxyHandlers);
  462. } else {
  463. vm._renderProxy = vm;
  464. }
  465. };
  466. }
  467. /* */
  468. var uid$2 = 0;
  469. /**
  470. * A dep is an observable that can have multiple
  471. * directives subscribing to it.
  472. */
  473. var Dep = function Dep () {
  474. this.id = uid$2++;
  475. this.subs = [];
  476. };
  477. Dep.prototype.addSub = function addSub (sub) {
  478. this.subs.push(sub);
  479. };
  480. Dep.prototype.removeSub = function removeSub (sub) {
  481. remove$1(this.subs, sub);
  482. };
  483. Dep.prototype.depend = function depend () {
  484. if (Dep.target) {
  485. Dep.target.addDep(this);
  486. }
  487. };
  488. Dep.prototype.notify = function notify () {
  489. // stablize the subscriber list first
  490. var subs = this.subs.slice();
  491. for (var i = 0, l = subs.length; i < l; i++) {
  492. subs[i].update();
  493. }
  494. };
  495. // the current target watcher being evaluated.
  496. // this is globally unique because there could be only one
  497. // watcher being evaluated at any time.
  498. Dep.target = null;
  499. var targetStack = [];
  500. function pushTarget (_target) {
  501. if (Dep.target) { targetStack.push(Dep.target); }
  502. Dep.target = _target;
  503. }
  504. function popTarget () {
  505. Dep.target = targetStack.pop();
  506. }
  507. /* */
  508. var queue = [];
  509. var has$1 = {};
  510. var circular = {};
  511. var waiting = false;
  512. var flushing = false;
  513. var index = 0;
  514. /**
  515. * Reset the scheduler's state.
  516. */
  517. function resetSchedulerState () {
  518. queue.length = 0;
  519. has$1 = {};
  520. if (process.env.NODE_ENV !== 'production') {
  521. circular = {};
  522. }
  523. waiting = flushing = false;
  524. }
  525. /**
  526. * Flush both queues and run the watchers.
  527. */
  528. function flushSchedulerQueue () {
  529. flushing = true;
  530. // Sort queue before flush.
  531. // This ensures that:
  532. // 1. Components are updated from parent to child. (because parent is always
  533. // created before the child)
  534. // 2. A component's user watchers are run before its render watcher (because
  535. // user watchers are created before the render watcher)
  536. // 3. If a component is destroyed during a parent component's watcher run,
  537. // its watchers can be skipped.
  538. queue.sort(function (a, b) { return a.id - b.id; });
  539. // do not cache length because more watchers might be pushed
  540. // as we run existing watchers
  541. for (index = 0; index < queue.length; index++) {
  542. var watcher = queue[index];
  543. var id = watcher.id;
  544. has$1[id] = null;
  545. watcher.run();
  546. // in dev build, check and stop circular updates.
  547. if (process.env.NODE_ENV !== 'production' && has$1[id] != null) {
  548. circular[id] = (circular[id] || 0) + 1;
  549. if (circular[id] > config._maxUpdateCount) {
  550. warn(
  551. 'You may have an infinite update loop ' + (
  552. watcher.user
  553. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  554. : "in a component render function."
  555. ),
  556. watcher.vm
  557. );
  558. break
  559. }
  560. }
  561. }
  562. // devtool hook
  563. /* istanbul ignore if */
  564. if (devtools && config.devtools) {
  565. devtools.emit('flush');
  566. }
  567. resetSchedulerState();
  568. }
  569. /**
  570. * Push a watcher into the watcher queue.
  571. * Jobs with duplicate IDs will be skipped unless it's
  572. * pushed when the queue is being flushed.
  573. */
  574. function queueWatcher (watcher) {
  575. var id = watcher.id;
  576. if (has$1[id] == null) {
  577. has$1[id] = true;
  578. if (!flushing) {
  579. queue.push(watcher);
  580. } else {
  581. // if already flushing, splice the watcher based on its id
  582. // if already past its id, it will be run next immediately.
  583. var i = queue.length - 1;
  584. while (i >= 0 && queue[i].id > watcher.id) {
  585. i--;
  586. }
  587. queue.splice(Math.max(i, index) + 1, 0, watcher);
  588. }
  589. // queue the flush
  590. if (!waiting) {
  591. waiting = true;
  592. nextTick(flushSchedulerQueue);
  593. }
  594. }
  595. }
  596. /* */
  597. var uid$1 = 0;
  598. /**
  599. * A watcher parses an expression, collects dependencies,
  600. * and fires callback when the expression value changes.
  601. * This is used for both the $watch() api and directives.
  602. */
  603. var Watcher = function Watcher (
  604. vm,
  605. expOrFn,
  606. cb,
  607. options
  608. ) {
  609. if ( options === void 0 ) options = {};
  610. this.vm = vm;
  611. vm._watchers.push(this);
  612. // options
  613. this.deep = !!options.deep;
  614. this.user = !!options.user;
  615. this.lazy = !!options.lazy;
  616. this.sync = !!options.sync;
  617. this.expression = expOrFn.toString();
  618. this.cb = cb;
  619. this.id = ++uid$1; // uid for batching
  620. this.active = true;
  621. this.dirty = this.lazy; // for lazy watchers
  622. this.deps = [];
  623. this.newDeps = [];
  624. this.depIds = new _Set();
  625. this.newDepIds = new _Set();
  626. // parse expression for getter
  627. if (typeof expOrFn === 'function') {
  628. this.getter = expOrFn;
  629. } else {
  630. this.getter = parsePath(expOrFn);
  631. if (!this.getter) {
  632. this.getter = function () {};
  633. process.env.NODE_ENV !== 'production' && warn(
  634. "Failed watching path: \"" + expOrFn + "\" " +
  635. 'Watcher only accepts simple dot-delimited paths. ' +
  636. 'For full control, use a function instead.',
  637. vm
  638. );
  639. }
  640. }
  641. this.value = this.lazy
  642. ? undefined
  643. : this.get();
  644. };
  645. /**
  646. * Evaluate the getter, and re-collect dependencies.
  647. */
  648. Watcher.prototype.get = function get () {
  649. pushTarget(this);
  650. var value = this.getter.call(this.vm, this.vm);
  651. // "touch" every property so they are all tracked as
  652. // dependencies for deep watching
  653. if (this.deep) {
  654. traverse(value);
  655. }
  656. popTarget();
  657. this.cleanupDeps();
  658. return value
  659. };
  660. /**
  661. * Add a dependency to this directive.
  662. */
  663. Watcher.prototype.addDep = function addDep (dep) {
  664. var id = dep.id;
  665. if (!this.newDepIds.has(id)) {
  666. this.newDepIds.add(id);
  667. this.newDeps.push(dep);
  668. if (!this.depIds.has(id)) {
  669. dep.addSub(this);
  670. }
  671. }
  672. };
  673. /**
  674. * Clean up for dependency collection.
  675. */
  676. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  677. var this$1 = this;
  678. var i = this.deps.length;
  679. while (i--) {
  680. var dep = this$1.deps[i];
  681. if (!this$1.newDepIds.has(dep.id)) {
  682. dep.removeSub(this$1);
  683. }
  684. }
  685. var tmp = this.depIds;
  686. this.depIds = this.newDepIds;
  687. this.newDepIds = tmp;
  688. this.newDepIds.clear();
  689. tmp = this.deps;
  690. this.deps = this.newDeps;
  691. this.newDeps = tmp;
  692. this.newDeps.length = 0;
  693. };
  694. /**
  695. * Subscriber interface.
  696. * Will be called when a dependency changes.
  697. */
  698. Watcher.prototype.update = function update () {
  699. /* istanbul ignore else */
  700. if (this.lazy) {
  701. this.dirty = true;
  702. } else if (this.sync) {
  703. this.run();
  704. } else {
  705. queueWatcher(this);
  706. }
  707. };
  708. /**
  709. * Scheduler job interface.
  710. * Will be called by the scheduler.
  711. */
  712. Watcher.prototype.run = function run () {
  713. if (this.active) {
  714. var value = this.get();
  715. if (
  716. value !== this.value ||
  717. // Deep watchers and watchers on Object/Arrays should fire even
  718. // when the value is the same, because the value may
  719. // have mutated.
  720. isObject(value) ||
  721. this.deep
  722. ) {
  723. // set new value
  724. var oldValue = this.value;
  725. this.value = value;
  726. if (this.user) {
  727. try {
  728. this.cb.call(this.vm, value, oldValue);
  729. } catch (e) {
  730. process.env.NODE_ENV !== 'production' && warn(
  731. ("Error in watcher \"" + (this.expression) + "\""),
  732. this.vm
  733. );
  734. /* istanbul ignore else */
  735. if (config.errorHandler) {
  736. config.errorHandler.call(null, e, this.vm);
  737. } else {
  738. throw e
  739. }
  740. }
  741. } else {
  742. this.cb.call(this.vm, value, oldValue);
  743. }
  744. }
  745. }
  746. };
  747. /**
  748. * Evaluate the value of the watcher.
  749. * This only gets called for lazy watchers.
  750. */
  751. Watcher.prototype.evaluate = function evaluate () {
  752. this.value = this.get();
  753. this.dirty = false;
  754. };
  755. /**
  756. * Depend on all deps collected by this watcher.
  757. */
  758. Watcher.prototype.depend = function depend () {
  759. var this$1 = this;
  760. var i = this.deps.length;
  761. while (i--) {
  762. this$1.deps[i].depend();
  763. }
  764. };
  765. /**
  766. * Remove self from all dependencies' subcriber list.
  767. */
  768. Watcher.prototype.teardown = function teardown () {
  769. var this$1 = this;
  770. if (this.active) {
  771. // remove self from vm's watcher list
  772. // this is a somewhat expensive operation so we skip it
  773. // if the vm is being destroyed or is performing a v-for
  774. // re-render (the watcher list is then filtered by v-for).
  775. if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  776. remove$1(this.vm._watchers, this);
  777. }
  778. var i = this.deps.length;
  779. while (i--) {
  780. this$1.deps[i].removeSub(this$1);
  781. }
  782. this.active = false;
  783. }
  784. };
  785. /**
  786. * Recursively traverse an object to evoke all converted
  787. * getters, so that every nested property inside the object
  788. * is collected as a "deep" dependency.
  789. */
  790. var seenObjects = new _Set();
  791. function traverse (val, seen) {
  792. var i, keys;
  793. if (!seen) {
  794. seen = seenObjects;
  795. seen.clear();
  796. }
  797. var isA = Array.isArray(val);
  798. var isO = isObject(val);
  799. if ((isA || isO) && Object.isExtensible(val)) {
  800. if (val.__ob__) {
  801. var depId = val.__ob__.dep.id;
  802. if (seen.has(depId)) {
  803. return
  804. } else {
  805. seen.add(depId);
  806. }
  807. }
  808. if (isA) {
  809. i = val.length;
  810. while (i--) { traverse(val[i], seen); }
  811. } else if (isO) {
  812. keys = Object.keys(val);
  813. i = keys.length;
  814. while (i--) { traverse(val[keys[i]], seen); }
  815. }
  816. }
  817. }
  818. /*
  819. * not type checking this file because flow doesn't play well with
  820. * dynamically accessing methods on Array prototype
  821. */
  822. var arrayProto = Array.prototype;
  823. var arrayMethods = Object.create(arrayProto);[
  824. 'push',
  825. 'pop',
  826. 'shift',
  827. 'unshift',
  828. 'splice',
  829. 'sort',
  830. 'reverse'
  831. ]
  832. .forEach(function (method) {
  833. // cache original method
  834. var original = arrayProto[method];
  835. def(arrayMethods, method, function mutator () {
  836. var arguments$1 = arguments;
  837. // avoid leaking arguments:
  838. // http://jsperf.com/closure-with-arguments
  839. var i = arguments.length;
  840. var args = new Array(i);
  841. while (i--) {
  842. args[i] = arguments$1[i];
  843. }
  844. var result = original.apply(this, args);
  845. var ob = this.__ob__;
  846. var inserted;
  847. switch (method) {
  848. case 'push':
  849. inserted = args;
  850. break
  851. case 'unshift':
  852. inserted = args;
  853. break
  854. case 'splice':
  855. inserted = args.slice(2);
  856. break
  857. }
  858. if (inserted) { ob.observeArray(inserted); }
  859. // notify change
  860. ob.dep.notify();
  861. return result
  862. });
  863. });
  864. /* */
  865. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  866. /**
  867. * By default, when a reactive property is set, the new value is
  868. * also converted to become reactive. However when passing down props,
  869. * we don't want to force conversion because the value may be a nested value
  870. * under a frozen data structure. Converting it would defeat the optimization.
  871. */
  872. var observerState = {
  873. shouldConvert: true,
  874. isSettingProps: false
  875. };
  876. /**
  877. * Observer class that are attached to each observed
  878. * object. Once attached, the observer converts target
  879. * object's property keys into getter/setters that
  880. * collect dependencies and dispatches updates.
  881. */
  882. var Observer = function Observer (value) {
  883. this.value = value;
  884. this.dep = new Dep();
  885. this.vmCount = 0;
  886. def(value, '__ob__', this);
  887. if (Array.isArray(value)) {
  888. var augment = hasProto
  889. ? protoAugment
  890. : copyAugment;
  891. augment(value, arrayMethods, arrayKeys);
  892. this.observeArray(value);
  893. } else {
  894. this.walk(value);
  895. }
  896. };
  897. /**
  898. * Walk through each property and convert them into
  899. * getter/setters. This method should only be called when
  900. * value type is Object.
  901. */
  902. Observer.prototype.walk = function walk (obj) {
  903. var keys = Object.keys(obj);
  904. for (var i = 0; i < keys.length; i++) {
  905. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  906. }
  907. };
  908. /**
  909. * Observe a list of Array items.
  910. */
  911. Observer.prototype.observeArray = function observeArray (items) {
  912. for (var i = 0, l = items.length; i < l; i++) {
  913. observe(items[i]);
  914. }
  915. };
  916. // helpers
  917. /**
  918. * Augment an target Object or Array by intercepting
  919. * the prototype chain using __proto__
  920. */
  921. function protoAugment (target, src) {
  922. /* eslint-disable no-proto */
  923. target.__proto__ = src;
  924. /* eslint-enable no-proto */
  925. }
  926. /**
  927. * Augment an target Object or Array by defining
  928. * hidden properties.
  929. *
  930. * istanbul ignore next
  931. */
  932. function copyAugment (target, src, keys) {
  933. for (var i = 0, l = keys.length; i < l; i++) {
  934. var key = keys[i];
  935. def(target, key, src[key]);
  936. }
  937. }
  938. /**
  939. * Attempt to create an observer instance for a value,
  940. * returns the new observer if successfully observed,
  941. * or the existing observer if the value already has one.
  942. */
  943. function observe (value) {
  944. if (!isObject(value)) {
  945. return
  946. }
  947. var ob;
  948. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  949. ob = value.__ob__;
  950. } else if (
  951. observerState.shouldConvert &&
  952. !config._isServer &&
  953. (Array.isArray(value) || isPlainObject(value)) &&
  954. Object.isExtensible(value) &&
  955. !value._isVue
  956. ) {
  957. ob = new Observer(value);
  958. }
  959. return ob
  960. }
  961. /**
  962. * Define a reactive property on an Object.
  963. */
  964. function defineReactive$$1 (
  965. obj,
  966. key,
  967. val,
  968. customSetter
  969. ) {
  970. var dep = new Dep();
  971. var property = Object.getOwnPropertyDescriptor(obj, key);
  972. if (property && property.configurable === false) {
  973. return
  974. }
  975. // cater for pre-defined getter/setters
  976. var getter = property && property.get;
  977. var setter = property && property.set;
  978. var childOb = observe(val);
  979. Object.defineProperty(obj, key, {
  980. enumerable: true,
  981. configurable: true,
  982. get: function reactiveGetter () {
  983. var value = getter ? getter.call(obj) : val;
  984. if (Dep.target) {
  985. dep.depend();
  986. if (childOb) {
  987. childOb.dep.depend();
  988. }
  989. if (Array.isArray(value)) {
  990. dependArray(value);
  991. }
  992. }
  993. return value
  994. },
  995. set: function reactiveSetter (newVal) {
  996. var value = getter ? getter.call(obj) : val;
  997. if (newVal === value) {
  998. return
  999. }
  1000. if (process.env.NODE_ENV !== 'production' && customSetter) {
  1001. customSetter();
  1002. }
  1003. if (setter) {
  1004. setter.call(obj, newVal);
  1005. } else {
  1006. val = newVal;
  1007. }
  1008. childOb = observe(newVal);
  1009. dep.notify();
  1010. }
  1011. });
  1012. }
  1013. /**
  1014. * Set a property on an object. Adds the new property and
  1015. * triggers change notification if the property doesn't
  1016. * already exist.
  1017. */
  1018. function set (obj, key, val) {
  1019. if (Array.isArray(obj)) {
  1020. obj.splice(key, 1, val);
  1021. return val
  1022. }
  1023. if (hasOwn(obj, key)) {
  1024. obj[key] = val;
  1025. return
  1026. }
  1027. var ob = obj.__ob__;
  1028. if (obj._isVue || (ob && ob.vmCount)) {
  1029. process.env.NODE_ENV !== 'production' && warn(
  1030. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1031. 'at runtime - declare it upfront in the data option.'
  1032. );
  1033. return
  1034. }
  1035. if (!ob) {
  1036. obj[key] = val;
  1037. return
  1038. }
  1039. defineReactive$$1(ob.value, key, val);
  1040. ob.dep.notify();
  1041. return val
  1042. }
  1043. /**
  1044. * Delete a property and trigger change if necessary.
  1045. */
  1046. function del (obj, key) {
  1047. var ob = obj.__ob__;
  1048. if (obj._isVue || (ob && ob.vmCount)) {
  1049. process.env.NODE_ENV !== 'production' && warn(
  1050. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1051. '- just set it to null.'
  1052. );
  1053. return
  1054. }
  1055. if (!hasOwn(obj, key)) {
  1056. return
  1057. }
  1058. delete obj[key];
  1059. if (!ob) {
  1060. return
  1061. }
  1062. ob.dep.notify();
  1063. }
  1064. /**
  1065. * Collect dependencies on array elements when the array is touched, since
  1066. * we cannot intercept array element access like property getters.
  1067. */
  1068. function dependArray (value) {
  1069. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  1070. e = value[i];
  1071. e && e.__ob__ && e.__ob__.dep.depend();
  1072. if (Array.isArray(e)) {
  1073. dependArray(e);
  1074. }
  1075. }
  1076. }
  1077. /* */
  1078. function initState (vm) {
  1079. vm._watchers = [];
  1080. initProps(vm);
  1081. initData(vm);
  1082. initComputed(vm);
  1083. initMethods(vm);
  1084. initWatch(vm);
  1085. }
  1086. function initProps (vm) {
  1087. var props = vm.$options.props;
  1088. if (props) {
  1089. var propsData = vm.$options.propsData || {};
  1090. var keys = vm.$options._propKeys = Object.keys(props);
  1091. var isRoot = !vm.$parent;
  1092. // root instance props should be converted
  1093. observerState.shouldConvert = isRoot;
  1094. var loop = function ( i ) {
  1095. var key = keys[i];
  1096. /* istanbul ignore else */
  1097. if (process.env.NODE_ENV !== 'production') {
  1098. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
  1099. if (vm.$parent && !observerState.isSettingProps) {
  1100. warn(
  1101. "Avoid mutating a prop directly since the value will be " +
  1102. "overwritten whenever the parent component re-renders. " +
  1103. "Instead, use a data or computed property based on the prop's " +
  1104. "value. Prop being mutated: \"" + key + "\"",
  1105. vm
  1106. );
  1107. }
  1108. });
  1109. } else {
  1110. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm));
  1111. }
  1112. };
  1113. for (var i = 0; i < keys.length; i++) loop( i );
  1114. observerState.shouldConvert = true;
  1115. }
  1116. }
  1117. function initData (vm) {
  1118. var data = vm.$options.data;
  1119. data = vm._data = typeof data === 'function'
  1120. ? data.call(vm)
  1121. : data || {};
  1122. if (!isPlainObject(data)) {
  1123. data = {};
  1124. process.env.NODE_ENV !== 'production' && warn(
  1125. 'data functions should return an object.',
  1126. vm
  1127. );
  1128. }
  1129. // proxy data on instance
  1130. var keys = Object.keys(data);
  1131. var props = vm.$options.props;
  1132. var i = keys.length;
  1133. while (i--) {
  1134. if (props && hasOwn(props, keys[i])) {
  1135. process.env.NODE_ENV !== 'production' && warn(
  1136. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  1137. "Use prop default value instead.",
  1138. vm
  1139. );
  1140. } else {
  1141. proxy(vm, keys[i]);
  1142. }
  1143. }
  1144. // observe data
  1145. observe(data);
  1146. data.__ob__ && data.__ob__.vmCount++;
  1147. }
  1148. var computedSharedDefinition = {
  1149. enumerable: true,
  1150. configurable: true,
  1151. get: noop,
  1152. set: noop
  1153. };
  1154. function initComputed (vm) {
  1155. var computed = vm.$options.computed;
  1156. if (computed) {
  1157. for (var key in computed) {
  1158. var userDef = computed[key];
  1159. if (typeof userDef === 'function') {
  1160. computedSharedDefinition.get = makeComputedGetter(userDef, vm);
  1161. computedSharedDefinition.set = noop;
  1162. } else {
  1163. computedSharedDefinition.get = userDef.get
  1164. ? userDef.cache !== false
  1165. ? makeComputedGetter(userDef.get, vm)
  1166. : bind$1(userDef.get, vm)
  1167. : noop;
  1168. computedSharedDefinition.set = userDef.set
  1169. ? bind$1(userDef.set, vm)
  1170. : noop;
  1171. }
  1172. Object.defineProperty(vm, key, computedSharedDefinition);
  1173. }
  1174. }
  1175. }
  1176. function makeComputedGetter (getter, owner) {
  1177. var watcher = new Watcher(owner, getter, noop, {
  1178. lazy: true
  1179. });
  1180. return function computedGetter () {
  1181. if (watcher.dirty) {
  1182. watcher.evaluate();
  1183. }
  1184. if (Dep.target) {
  1185. watcher.depend();
  1186. }
  1187. return watcher.value
  1188. }
  1189. }
  1190. function initMethods (vm) {
  1191. var methods = vm.$options.methods;
  1192. if (methods) {
  1193. for (var key in methods) {
  1194. vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
  1195. if (process.env.NODE_ENV !== 'production' && methods[key] == null) {
  1196. warn(
  1197. "method \"" + key + "\" has an undefined value in the component definition. " +
  1198. "Did you reference the function correctly?",
  1199. vm
  1200. );
  1201. }
  1202. }
  1203. }
  1204. }
  1205. function initWatch (vm) {
  1206. var watch = vm.$options.watch;
  1207. if (watch) {
  1208. for (var key in watch) {
  1209. var handler = watch[key];
  1210. if (Array.isArray(handler)) {
  1211. for (var i = 0; i < handler.length; i++) {
  1212. createWatcher(vm, key, handler[i]);
  1213. }
  1214. } else {
  1215. createWatcher(vm, key, handler);
  1216. }
  1217. }
  1218. }
  1219. }
  1220. function createWatcher (vm, key, handler) {
  1221. var options;
  1222. if (isPlainObject(handler)) {
  1223. options = handler;
  1224. handler = handler.handler;
  1225. }
  1226. if (typeof handler === 'string') {
  1227. handler = vm[handler];
  1228. }
  1229. vm.$watch(key, handler, options);
  1230. }
  1231. function stateMixin (Vue) {
  1232. // flow somehow has problems with directly declared definition object
  1233. // when using Object.defineProperty, so we have to procedurally build up
  1234. // the object here.
  1235. var dataDef = {};
  1236. dataDef.get = function () {
  1237. return this._data
  1238. };
  1239. if (process.env.NODE_ENV !== 'production') {
  1240. dataDef.set = function (newData) {
  1241. warn(
  1242. 'Avoid replacing instance root $data. ' +
  1243. 'Use nested data properties instead.',
  1244. this
  1245. );
  1246. };
  1247. }
  1248. Object.defineProperty(Vue.prototype, '$data', dataDef);
  1249. Vue.prototype.$set = set;
  1250. Vue.prototype.$delete = del;
  1251. Vue.prototype.$watch = function (
  1252. expOrFn,
  1253. cb,
  1254. options
  1255. ) {
  1256. var vm = this;
  1257. options = options || {};
  1258. options.user = true;
  1259. var watcher = new Watcher(vm, expOrFn, cb, options);
  1260. if (options.immediate) {
  1261. cb.call(vm, watcher.value);
  1262. }
  1263. return function unwatchFn () {
  1264. watcher.teardown();
  1265. }
  1266. };
  1267. }
  1268. function proxy (vm, key) {
  1269. if (!isReserved(key)) {
  1270. Object.defineProperty(vm, key, {
  1271. configurable: true,
  1272. enumerable: true,
  1273. get: function proxyGetter () {
  1274. return vm._data[key]
  1275. },
  1276. set: function proxySetter (val) {
  1277. vm._data[key] = val;
  1278. }
  1279. });
  1280. }
  1281. }
  1282. /* */
  1283. var VNode = function VNode (
  1284. tag,
  1285. data,
  1286. children,
  1287. text,
  1288. elm,
  1289. ns,
  1290. context,
  1291. componentOptions
  1292. ) {
  1293. this.tag = tag;
  1294. this.data = data;
  1295. this.children = children;
  1296. this.text = text;
  1297. this.elm = elm;
  1298. this.ns = ns;
  1299. this.context = context;
  1300. this.functionalContext = undefined;
  1301. this.key = data && data.key;
  1302. this.componentOptions = componentOptions;
  1303. this.child = undefined;
  1304. this.parent = undefined;
  1305. this.raw = false;
  1306. this.isStatic = false;
  1307. this.isRootInsert = true;
  1308. this.isComment = false;
  1309. this.isCloned = false;
  1310. };
  1311. var emptyVNode = function () {
  1312. var node = new VNode();
  1313. node.text = '';
  1314. node.isComment = true;
  1315. return node
  1316. };
  1317. // optimized shallow clone
  1318. // used for static nodes and slot nodes because they may be reused across
  1319. // multiple renders, cloning them avoids errors when DOM manipulations rely
  1320. // on their elm reference.
  1321. function cloneVNode (vnode) {
  1322. var cloned = new VNode(
  1323. vnode.tag,
  1324. vnode.data,
  1325. vnode.children,
  1326. vnode.text,
  1327. vnode.elm,
  1328. vnode.ns,
  1329. vnode.context,
  1330. vnode.componentOptions
  1331. );
  1332. cloned.isStatic = vnode.isStatic;
  1333. cloned.key = vnode.key;
  1334. cloned.isCloned = true;
  1335. return cloned
  1336. }
  1337. function cloneVNodes (vnodes) {
  1338. var res = new Array(vnodes.length);
  1339. for (var i = 0; i < vnodes.length; i++) {
  1340. res[i] = cloneVNode(vnodes[i]);
  1341. }
  1342. return res
  1343. }
  1344. /* */
  1345. function mergeVNodeHook (def, hookKey, hook, key) {
  1346. key = key + hookKey;
  1347. var injectedHash = def.__injected || (def.__injected = {});
  1348. if (!injectedHash[key]) {
  1349. injectedHash[key] = true;
  1350. var oldHook = def[hookKey];
  1351. if (oldHook) {
  1352. def[hookKey] = function () {
  1353. oldHook.apply(this, arguments);
  1354. hook.apply(this, arguments);
  1355. };
  1356. } else {
  1357. def[hookKey] = hook;
  1358. }
  1359. }
  1360. }
  1361. /* */
  1362. function updateListeners (
  1363. on,
  1364. oldOn,
  1365. add,
  1366. remove$$1,
  1367. vm
  1368. ) {
  1369. var name, cur, old, fn, event, capture;
  1370. for (name in on) {
  1371. cur = on[name];
  1372. old = oldOn[name];
  1373. if (!cur) {
  1374. process.env.NODE_ENV !== 'production' && warn(
  1375. "Invalid handler for event \"" + name + "\": got " + String(cur),
  1376. vm
  1377. );
  1378. } else if (!old) {
  1379. capture = name.charAt(0) === '!';
  1380. event = capture ? name.slice(1) : name;
  1381. if (Array.isArray(cur)) {
  1382. add(event, (cur.invoker = arrInvoker(cur)), capture);
  1383. } else {
  1384. if (!cur.invoker) {
  1385. fn = cur;
  1386. cur = on[name] = {};
  1387. cur.fn = fn;
  1388. cur.invoker = fnInvoker(cur);
  1389. }
  1390. add(event, cur.invoker, capture);
  1391. }
  1392. } else if (cur !== old) {
  1393. if (Array.isArray(old)) {
  1394. old.length = cur.length;
  1395. for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
  1396. on[name] = old;
  1397. } else {
  1398. old.fn = cur;
  1399. on[name] = old;
  1400. }
  1401. }
  1402. }
  1403. for (name in oldOn) {
  1404. if (!on[name]) {
  1405. event = name.charAt(0) === '!' ? name.slice(1) : name;
  1406. remove$$1(event, oldOn[name].invoker);
  1407. }
  1408. }
  1409. }
  1410. function arrInvoker (arr) {
  1411. return function (ev) {
  1412. var arguments$1 = arguments;
  1413. var single = arguments.length === 1;
  1414. for (var i = 0; i < arr.length; i++) {
  1415. single ? arr[i](ev) : arr[i].apply(null, arguments$1);
  1416. }
  1417. }
  1418. }
  1419. function fnInvoker (o) {
  1420. return function (ev) {
  1421. var single = arguments.length === 1;
  1422. single ? o.fn(ev) : o.fn.apply(null, arguments);
  1423. }
  1424. }
  1425. /* */
  1426. function normalizeChildren (
  1427. children,
  1428. ns,
  1429. nestedIndex
  1430. ) {
  1431. if (isPrimitive(children)) {
  1432. return [createTextVNode(children)]
  1433. }
  1434. if (Array.isArray(children)) {
  1435. var res = [];
  1436. for (var i = 0, l = children.length; i < l; i++) {
  1437. var c = children[i];
  1438. var last = res[res.length - 1];
  1439. // nested
  1440. if (Array.isArray(c)) {
  1441. res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
  1442. } else if (isPrimitive(c)) {
  1443. if (last && last.text) {
  1444. last.text += String(c);
  1445. } else if (c !== '') {
  1446. // convert primitive to vnode
  1447. res.push(createTextVNode(c));
  1448. }
  1449. } else if (c instanceof VNode) {
  1450. if (c.text && last && last.text) {
  1451. last.text += c.text;
  1452. } else {
  1453. // inherit parent namespace
  1454. if (ns) {
  1455. applyNS(c, ns);
  1456. }
  1457. // default key for nested array children (likely generated by v-for)
  1458. if (c.tag && c.key == null && nestedIndex != null) {
  1459. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  1460. }
  1461. res.push(c);
  1462. }
  1463. }
  1464. }
  1465. return res
  1466. }
  1467. }
  1468. function createTextVNode (val) {
  1469. return new VNode(undefined, undefined, undefined, String(val))
  1470. }
  1471. function applyNS (vnode, ns) {
  1472. if (vnode.tag && !vnode.ns) {
  1473. vnode.ns = ns;
  1474. if (vnode.children) {
  1475. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1476. applyNS(vnode.children[i], ns);
  1477. }
  1478. }
  1479. }
  1480. }
  1481. /* */
  1482. function getFirstComponentChild (children) {
  1483. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  1484. }
  1485. /* */
  1486. var activeInstance = null;
  1487. function initLifecycle (vm) {
  1488. var options = vm.$options;
  1489. // locate first non-abstract parent
  1490. var parent = options.parent;
  1491. if (parent && !options.abstract) {
  1492. while (parent.$options.abstract && parent.$parent) {
  1493. parent = parent.$parent;
  1494. }
  1495. parent.$children.push(vm);
  1496. }
  1497. vm.$parent = parent;
  1498. vm.$root = parent ? parent.$root : vm;
  1499. vm.$children = [];
  1500. vm.$refs = {};
  1501. vm._watcher = null;
  1502. vm._inactive = false;
  1503. vm._isMounted = false;
  1504. vm._isDestroyed = false;
  1505. vm._isBeingDestroyed = false;
  1506. }
  1507. function lifecycleMixin (Vue) {
  1508. Vue.prototype._mount = function (
  1509. el,
  1510. hydrating
  1511. ) {
  1512. var vm = this;
  1513. vm.$el = el;
  1514. if (!vm.$options.render) {
  1515. vm.$options.render = emptyVNode;
  1516. if (process.env.NODE_ENV !== 'production') {
  1517. /* istanbul ignore if */
  1518. if (vm.$options.template) {
  1519. warn(
  1520. 'You are using the runtime-only build of Vue where the template ' +
  1521. 'option is not available. Either pre-compile the templates into ' +
  1522. 'render functions, or use the compiler-included build.',
  1523. vm
  1524. );
  1525. } else {
  1526. warn(
  1527. 'Failed to mount component: template or render function not defined.',
  1528. vm
  1529. );
  1530. }
  1531. }
  1532. }
  1533. callHook(vm, 'beforeMount');
  1534. vm._watcher = new Watcher(vm, function () {
  1535. vm._update(vm._render(), hydrating);
  1536. }, noop);
  1537. hydrating = false;
  1538. // manually mounted instance, call mounted on self
  1539. // mounted is called for render-created child components in its inserted hook
  1540. if (vm.$vnode == null) {
  1541. vm._isMounted = true;
  1542. callHook(vm, 'mounted');
  1543. }
  1544. return vm
  1545. };
  1546. Vue.prototype._update = function (vnode, hydrating) {
  1547. var vm = this;
  1548. if (vm._isMounted) {
  1549. callHook(vm, 'beforeUpdate');
  1550. }
  1551. var prevEl = vm.$el;
  1552. var prevActiveInstance = activeInstance;
  1553. activeInstance = vm;
  1554. var prevVnode = vm._vnode;
  1555. vm._vnode = vnode;
  1556. if (!prevVnode) {
  1557. // Vue.prototype.__patch__ is injected in entry points
  1558. // based on the rendering backend used.
  1559. vm.$el = vm.__patch__(vm.$el, vnode, hydrating);
  1560. } else {
  1561. vm.$el = vm.__patch__(prevVnode, vnode);
  1562. }
  1563. activeInstance = prevActiveInstance;
  1564. // update __vue__ reference
  1565. if (prevEl) {
  1566. prevEl.__vue__ = null;
  1567. }
  1568. if (vm.$el) {
  1569. vm.$el.__vue__ = vm;
  1570. }
  1571. // if parent is an HOC, update its $el as well
  1572. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  1573. vm.$parent.$el = vm.$el;
  1574. }
  1575. if (vm._isMounted) {
  1576. callHook(vm, 'updated');
  1577. }
  1578. };
  1579. Vue.prototype._updateFromParent = function (
  1580. propsData,
  1581. listeners,
  1582. parentVnode,
  1583. renderChildren
  1584. ) {
  1585. var vm = this;
  1586. var hasChildren = !!(vm.$options._renderChildren || renderChildren);
  1587. vm.$options._parentVnode = parentVnode;
  1588. vm.$options._renderChildren = renderChildren;
  1589. // update props
  1590. if (propsData && vm.$options.props) {
  1591. observerState.shouldConvert = false;
  1592. if (process.env.NODE_ENV !== 'production') {
  1593. observerState.isSettingProps = true;
  1594. }
  1595. var propKeys = vm.$options._propKeys || [];
  1596. for (var i = 0; i < propKeys.length; i++) {
  1597. var key = propKeys[i];
  1598. vm[key] = validateProp(key, vm.$options.props, propsData, vm);
  1599. }
  1600. observerState.shouldConvert = true;
  1601. if (process.env.NODE_ENV !== 'production') {
  1602. observerState.isSettingProps = false;
  1603. }
  1604. }
  1605. // update listeners
  1606. if (listeners) {
  1607. var oldListeners = vm.$options._parentListeners;
  1608. vm.$options._parentListeners = listeners;
  1609. vm._updateListeners(listeners, oldListeners);
  1610. }
  1611. // resolve slots + force update if has children
  1612. if (hasChildren) {
  1613. vm.$slots = resolveSlots(renderChildren, vm._renderContext);
  1614. vm.$forceUpdate();
  1615. }
  1616. };
  1617. Vue.prototype.$forceUpdate = function () {
  1618. var vm = this;
  1619. if (vm._watcher) {
  1620. vm._watcher.update();
  1621. }
  1622. };
  1623. Vue.prototype.$destroy = function () {
  1624. var vm = this;
  1625. if (vm._isBeingDestroyed) {
  1626. return
  1627. }
  1628. callHook(vm, 'beforeDestroy');
  1629. vm._isBeingDestroyed = true;
  1630. // remove self from parent
  1631. var parent = vm.$parent;
  1632. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  1633. remove$1(parent.$children, vm);
  1634. }
  1635. // teardown watchers
  1636. if (vm._watcher) {
  1637. vm._watcher.teardown();
  1638. }
  1639. var i = vm._watchers.length;
  1640. while (i--) {
  1641. vm._watchers[i].teardown();
  1642. }
  1643. // remove reference from data ob
  1644. // frozen object may not have observer.
  1645. if (vm._data.__ob__) {
  1646. vm._data.__ob__.vmCount--;
  1647. }
  1648. // call the last hook...
  1649. vm._isDestroyed = true;
  1650. callHook(vm, 'destroyed');
  1651. // turn off all instance listeners.
  1652. vm.$off();
  1653. // remove __vue__ reference
  1654. if (vm.$el) {
  1655. vm.$el.__vue__ = null;
  1656. }
  1657. // invoke destroy hooks on current rendered tree
  1658. vm.__patch__(vm._vnode, null);
  1659. };
  1660. }
  1661. function callHook (vm, hook) {
  1662. var handlers = vm.$options[hook];
  1663. if (handlers) {
  1664. for (var i = 0, j = handlers.length; i < j; i++) {
  1665. handlers[i].call(vm);
  1666. }
  1667. }
  1668. vm.$emit('hook:' + hook);
  1669. }
  1670. /* */
  1671. var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
  1672. var hooksToMerge = Object.keys(hooks);
  1673. function createComponent (
  1674. Ctor,
  1675. data,
  1676. context,
  1677. children,
  1678. tag
  1679. ) {
  1680. if (!Ctor) {
  1681. return
  1682. }
  1683. if (isObject(Ctor)) {
  1684. Ctor = Vue$2.extend(Ctor);
  1685. }
  1686. if (typeof Ctor !== 'function') {
  1687. if (process.env.NODE_ENV !== 'production') {
  1688. warn(("Invalid Component definition: " + (String(Ctor))), context);
  1689. }
  1690. return
  1691. }
  1692. // async component
  1693. if (!Ctor.cid) {
  1694. if (Ctor.resolved) {
  1695. Ctor = Ctor.resolved;
  1696. } else {
  1697. Ctor = resolveAsyncComponent(Ctor, function () {
  1698. // it's ok to queue this on every render because
  1699. // $forceUpdate is buffered by the scheduler.
  1700. context.$forceUpdate();
  1701. });
  1702. if (!Ctor) {
  1703. // return nothing if this is indeed an async component
  1704. // wait for the callback to trigger parent update.
  1705. return
  1706. }
  1707. }
  1708. }
  1709. data = data || {};
  1710. // extract props
  1711. var propsData = extractProps(data, Ctor);
  1712. // functional component
  1713. if (Ctor.options.functional) {
  1714. return createFunctionalComponent(Ctor, propsData, data, context, children)
  1715. }
  1716. // extract listeners, since these needs to be treated as
  1717. // child component listeners instead of DOM listeners
  1718. var listeners = data.on;
  1719. // replace with listeners with .native modifier
  1720. data.on = data.nativeOn;
  1721. if (Ctor.options.abstract) {
  1722. // abstract components do not keep anything
  1723. // other than props & listeners
  1724. data = {};
  1725. }
  1726. // merge component management hooks onto the placeholder node
  1727. mergeHooks(data);
  1728. // return a placeholder vnode
  1729. var name = Ctor.options.name || tag;
  1730. var vnode = new VNode(
  1731. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  1732. data, undefined, undefined, undefined, undefined, context,
  1733. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  1734. );
  1735. return vnode
  1736. }
  1737. function createFunctionalComponent (
  1738. Ctor,
  1739. propsData,
  1740. data,
  1741. context,
  1742. children
  1743. ) {
  1744. var props = {};
  1745. var propOptions = Ctor.options.props;
  1746. if (propOptions) {
  1747. for (var key in propOptions) {
  1748. props[key] = validateProp(key, propOptions, propsData);
  1749. }
  1750. }
  1751. var vnode = Ctor.options.render.call(
  1752. null,
  1753. // ensure the createElement function in functional components
  1754. // gets a unique context - this is necessary for correct named slot check
  1755. bind$1(createElement, { _self: Object.create(context) }),
  1756. {
  1757. props: props,
  1758. data: data,
  1759. parent: context,
  1760. children: normalizeChildren(children),
  1761. slots: function () { return resolveSlots(children, context); }
  1762. }
  1763. );
  1764. if (vnode instanceof VNode) {
  1765. vnode.functionalContext = context;
  1766. if (data.slot) {
  1767. (vnode.data || (vnode.data = {})).slot = data.slot;
  1768. }
  1769. }
  1770. return vnode
  1771. }
  1772. function createComponentInstanceForVnode (
  1773. vnode, // we know it's MountedComponentVNode but flow doesn't
  1774. parent // activeInstance in lifecycle state
  1775. ) {
  1776. var vnodeComponentOptions = vnode.componentOptions;
  1777. var options = {
  1778. _isComponent: true,
  1779. parent: parent,
  1780. propsData: vnodeComponentOptions.propsData,
  1781. _componentTag: vnodeComponentOptions.tag,
  1782. _parentVnode: vnode,
  1783. _parentListeners: vnodeComponentOptions.listeners,
  1784. _renderChildren: vnodeComponentOptions.children
  1785. };
  1786. // check inline-template render functions
  1787. var inlineTemplate = vnode.data.inlineTemplate;
  1788. if (inlineTemplate) {
  1789. options.render = inlineTemplate.render;
  1790. options.staticRenderFns = inlineTemplate.staticRenderFns;
  1791. }
  1792. return new vnodeComponentOptions.Ctor(options)
  1793. }
  1794. function init (vnode, hydrating) {
  1795. if (!vnode.child || vnode.child._isDestroyed) {
  1796. var child = vnode.child = createComponentInstanceForVnode(vnode, activeInstance);
  1797. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  1798. }
  1799. }
  1800. function prepatch (
  1801. oldVnode,
  1802. vnode
  1803. ) {
  1804. var options = vnode.componentOptions;
  1805. var child = vnode.child = oldVnode.child;
  1806. child._updateFromParent(
  1807. options.propsData, // updated props
  1808. options.listeners, // updated listeners
  1809. vnode, // new parent vnode
  1810. options.children // new children
  1811. );
  1812. }
  1813. function insert (vnode) {
  1814. if (!vnode.child._isMounted) {
  1815. vnode.child._isMounted = true;
  1816. callHook(vnode.child, 'mounted');
  1817. }
  1818. if (vnode.data.keepAlive) {
  1819. vnode.child._inactive = false;
  1820. callHook(vnode.child, 'activated');
  1821. }
  1822. }
  1823. function destroy$1 (vnode) {
  1824. if (!vnode.child._isDestroyed) {
  1825. if (!vnode.data.keepAlive) {
  1826. vnode.child.$destroy();
  1827. } else {
  1828. vnode.child._inactive = true;
  1829. callHook(vnode.child, 'deactivated');
  1830. }
  1831. }
  1832. }
  1833. function resolveAsyncComponent (
  1834. factory,
  1835. cb
  1836. ) {
  1837. if (factory.requested) {
  1838. // pool callbacks
  1839. factory.pendingCallbacks.push(cb);
  1840. } else {
  1841. factory.requested = true;
  1842. var cbs = factory.pendingCallbacks = [cb];
  1843. var sync = true;
  1844. var resolve = function (res) {
  1845. if (isObject(res)) {
  1846. res = Vue$2.extend(res);
  1847. }
  1848. // cache resolved
  1849. factory.resolved = res;
  1850. // invoke callbacks only if this is not a synchronous resolve
  1851. // (async resolves are shimmed as synchronous during SSR)
  1852. if (!sync) {
  1853. for (var i = 0, l = cbs.length; i < l; i++) {
  1854. cbs[i](res);
  1855. }
  1856. }
  1857. };
  1858. var reject = function (reason) {
  1859. process.env.NODE_ENV !== 'production' && warn(
  1860. "Failed to resolve async component: " + (String(factory)) +
  1861. (reason ? ("\nReason: " + reason) : '')
  1862. );
  1863. };
  1864. var res = factory(resolve, reject);
  1865. // handle promise
  1866. if (res && typeof res.then === 'function' && !factory.resolved) {
  1867. res.then(resolve, reject);
  1868. }
  1869. sync = false;
  1870. // return in case resolved synchronously
  1871. return factory.resolved
  1872. }
  1873. }
  1874. function extractProps (data, Ctor) {
  1875. // we are only extrating raw values here.
  1876. // validation and default values are handled in the child
  1877. // component itself.
  1878. var propOptions = Ctor.options.props;
  1879. if (!propOptions) {
  1880. return
  1881. }
  1882. var res = {};
  1883. var attrs = data.attrs;
  1884. var props = data.props;
  1885. var domProps = data.domProps;
  1886. if (attrs || props || domProps) {
  1887. for (var key in propOptions) {
  1888. var altKey = hyphenate(key);
  1889. checkProp(res, props, key, altKey, true) ||
  1890. checkProp(res, attrs, key, altKey) ||
  1891. checkProp(res, domProps, key, altKey);
  1892. }
  1893. }
  1894. return res
  1895. }
  1896. function checkProp (
  1897. res,
  1898. hash,
  1899. key,
  1900. altKey,
  1901. preserve
  1902. ) {
  1903. if (hash) {
  1904. if (hasOwn(hash, key)) {
  1905. res[key] = hash[key];
  1906. if (!preserve) {
  1907. delete hash[key];
  1908. }
  1909. return true
  1910. } else if (hasOwn(hash, altKey)) {
  1911. res[key] = hash[altKey];
  1912. if (!preserve) {
  1913. delete hash[altKey];
  1914. }
  1915. return true
  1916. }
  1917. }
  1918. return false
  1919. }
  1920. function mergeHooks (data) {
  1921. if (!data.hook) {
  1922. data.hook = {};
  1923. }
  1924. for (var i = 0; i < hooksToMerge.length; i++) {
  1925. var key = hooksToMerge[i];
  1926. var fromParent = data.hook[key];
  1927. var ours = hooks[key];
  1928. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  1929. }
  1930. }
  1931. function mergeHook$1 (a, b) {
  1932. // since all hooks have at most two args, use fixed args
  1933. // to avoid having to use fn.apply().
  1934. return function (_, __) {
  1935. a(_, __);
  1936. b(_, __);
  1937. }
  1938. }
  1939. /* */
  1940. // wrapper function for providing a more flexible interface
  1941. // without getting yelled at by flow
  1942. function createElement (
  1943. tag,
  1944. data,
  1945. children
  1946. ) {
  1947. if (data && (Array.isArray(data) || typeof data !== 'object')) {
  1948. children = data;
  1949. data = undefined;
  1950. }
  1951. // make sure to use real instance instead of proxy as context
  1952. return _createElement(this._self, tag, data, children)
  1953. }
  1954. function _createElement (
  1955. context,
  1956. tag,
  1957. data,
  1958. children
  1959. ) {
  1960. if (data && data.__ob__) {
  1961. process.env.NODE_ENV !== 'production' && warn(
  1962. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  1963. 'Always create fresh vnode data objects in each render!',
  1964. context
  1965. );
  1966. return
  1967. }
  1968. if (!tag) {
  1969. // in case of component :is set to falsy value
  1970. return emptyVNode()
  1971. }
  1972. if (typeof tag === 'string') {
  1973. var Ctor;
  1974. var ns = config.getTagNamespace(tag);
  1975. if (config.isReservedTag(tag)) {
  1976. // platform built-in elements
  1977. return new VNode(
  1978. tag, data, normalizeChildren(children, ns),
  1979. undefined, undefined, ns, context
  1980. )
  1981. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  1982. // component
  1983. return createComponent(Ctor, data, context, children, tag)
  1984. } else {
  1985. // unknown or unlisted namespaced elements
  1986. // check at runtime because it may get assigned a namespace when its
  1987. // parent normalizes children
  1988. return new VNode(
  1989. tag, data, normalizeChildren(children, ns),
  1990. undefined, undefined, ns, context
  1991. )
  1992. }
  1993. } else {
  1994. // direct component options / constructor
  1995. return createComponent(tag, data, context, children)
  1996. }
  1997. }
  1998. /* */
  1999. function initRender (vm) {
  2000. vm.$vnode = null; // the placeholder node in parent tree
  2001. vm._vnode = null; // the root of the child tree
  2002. vm._staticTrees = null;
  2003. vm._renderContext = vm.$options._parentVnode && vm.$options._parentVnode.context;
  2004. vm.$slots = resolveSlots(vm.$options._renderChildren, vm._renderContext);
  2005. // bind the public createElement fn to this instance
  2006. // so that we get proper render context inside it.
  2007. vm.$createElement = bind$1(createElement, vm);
  2008. if (vm.$options.el) {
  2009. vm.$mount(vm.$options.el);
  2010. }
  2011. }
  2012. function renderMixin (Vue) {
  2013. Vue.prototype.$nextTick = function (fn) {
  2014. nextTick(fn, this);
  2015. };
  2016. Vue.prototype._render = function () {
  2017. var vm = this;
  2018. var ref = vm.$options;
  2019. var render = ref.render;
  2020. var staticRenderFns = ref.staticRenderFns;
  2021. var _parentVnode = ref._parentVnode;
  2022. if (vm._isMounted) {
  2023. // clone slot nodes on re-renders
  2024. for (var key in vm.$slots) {
  2025. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  2026. }
  2027. }
  2028. if (staticRenderFns && !vm._staticTrees) {
  2029. vm._staticTrees = [];
  2030. }
  2031. // set parent vnode. this allows render functions to have access
  2032. // to the data on the placeholder node.
  2033. vm.$vnode = _parentVnode;
  2034. // render self
  2035. var vnode;
  2036. try {
  2037. vnode = render.call(vm._renderProxy, vm.$createElement);
  2038. } catch (e) {
  2039. if (process.env.NODE_ENV !== 'production') {
  2040. warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
  2041. }
  2042. /* istanbul ignore else */
  2043. if (config.errorHandler) {
  2044. config.errorHandler.call(null, e, vm);
  2045. } else {
  2046. if (config._isServer) {
  2047. throw e
  2048. } else {
  2049. setTimeout(function () { throw e }, 0);
  2050. }
  2051. }
  2052. // return previous vnode to prevent render error causing blank component
  2053. vnode = vm._vnode;
  2054. }
  2055. // return empty vnode in case the render function errored out
  2056. if (!(vnode instanceof VNode)) {
  2057. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  2058. warn(
  2059. 'Multiple root nodes returned from render function. Render function ' +
  2060. 'should return a single root node.',
  2061. vm
  2062. );
  2063. }
  2064. vnode = emptyVNode();
  2065. }
  2066. // set parent
  2067. vnode.parent = _parentVnode;
  2068. return vnode
  2069. };
  2070. // shorthands used in render functions
  2071. Vue.prototype._h = createElement;
  2072. // toString for mustaches
  2073. Vue.prototype._s = _toString;
  2074. // number conversion
  2075. Vue.prototype._n = toNumber;
  2076. // empty vnode
  2077. Vue.prototype._e = emptyVNode;
  2078. // loose equal
  2079. Vue.prototype._q = looseEqual;
  2080. // loose indexOf
  2081. Vue.prototype._i = looseIndexOf;
  2082. // render static tree by index
  2083. Vue.prototype._m = function renderStatic (
  2084. index,
  2085. isInFor
  2086. ) {
  2087. var tree = this._staticTrees[index];
  2088. // if has already-rendered static tree and not inside v-for,
  2089. // we can reuse the same tree by doing a shallow clone.
  2090. if (tree && !isInFor) {
  2091. return Array.isArray(tree)
  2092. ? cloneVNodes(tree)
  2093. : cloneVNode(tree)
  2094. }
  2095. // otherwise, render a fresh tree.
  2096. tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
  2097. if (Array.isArray(tree)) {
  2098. for (var i = 0; i < tree.length; i++) {
  2099. if (typeof tree[i] !== 'string') {
  2100. tree[i].isStatic = true;
  2101. tree[i].key = "__static__" + index + "_" + i;
  2102. }
  2103. }
  2104. } else {
  2105. tree.isStatic = true;
  2106. tree.key = "__static__" + index;
  2107. }
  2108. return tree
  2109. };
  2110. // filter resolution helper
  2111. var identity = function (_) { return _; };
  2112. Vue.prototype._f = function resolveFilter (id) {
  2113. return resolveAsset(this.$options, 'filters', id, true) || identity
  2114. };
  2115. // render v-for
  2116. Vue.prototype._l = function renderList (
  2117. val,
  2118. render
  2119. ) {
  2120. var ret, i, l, keys, key;
  2121. if (Array.isArray(val)) {
  2122. ret = new Array(val.length);
  2123. for (i = 0, l = val.length; i < l; i++) {
  2124. ret[i] = render(val[i], i);
  2125. }
  2126. } else if (typeof val === 'number') {
  2127. ret = new Array(val);
  2128. for (i = 0; i < val; i++) {
  2129. ret[i] = render(i + 1, i);
  2130. }
  2131. } else if (isObject(val)) {
  2132. keys = Object.keys(val);
  2133. ret = new Array(keys.length);
  2134. for (i = 0, l = keys.length; i < l; i++) {
  2135. key = keys[i];
  2136. ret[i] = render(val[key], key, i);
  2137. }
  2138. }
  2139. return ret
  2140. };
  2141. // renderSlot
  2142. Vue.prototype._t = function (
  2143. name,
  2144. fallback
  2145. ) {
  2146. var slotNodes = this.$slots[name];
  2147. // warn duplicate slot usage
  2148. if (slotNodes && process.env.NODE_ENV !== 'production') {
  2149. slotNodes._rendered && warn(
  2150. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  2151. "- this will likely cause render errors.",
  2152. this
  2153. );
  2154. slotNodes._rendered = true;
  2155. }
  2156. return slotNodes || fallback
  2157. };
  2158. // apply v-bind object
  2159. Vue.prototype._b = function bindProps (
  2160. data,
  2161. value,
  2162. asProp
  2163. ) {
  2164. if (value) {
  2165. if (!isObject(value)) {
  2166. process.env.NODE_ENV !== 'production' && warn(
  2167. 'v-bind without argument expects an Object or Array value',
  2168. this
  2169. );
  2170. } else {
  2171. if (Array.isArray(value)) {
  2172. value = toObject(value);
  2173. }
  2174. for (var key in value) {
  2175. if (key === 'class' || key === 'style') {
  2176. data[key] = value[key];
  2177. } else {
  2178. var hash = asProp || config.mustUseProp(key)
  2179. ? data.domProps || (data.domProps = {})
  2180. : data.attrs || (data.attrs = {});
  2181. hash[key] = value[key];
  2182. }
  2183. }
  2184. }
  2185. }
  2186. return data
  2187. };
  2188. // expose v-on keyCodes
  2189. Vue.prototype._k = function getKeyCodes (key) {
  2190. return config.keyCodes[key]
  2191. };
  2192. }
  2193. function resolveSlots (
  2194. renderChildren,
  2195. context
  2196. ) {
  2197. var slots = {};
  2198. if (!renderChildren) {
  2199. return slots
  2200. }
  2201. var children = normalizeChildren(renderChildren) || [];
  2202. var defaultSlot = [];
  2203. var name, child;
  2204. for (var i = 0, l = children.length; i < l; i++) {
  2205. child = children[i];
  2206. // named slots should only be respected if the vnode was rendered in the
  2207. // same context.
  2208. if ((child.context === context || child.functionalContext === context) &&
  2209. child.data && (name = child.data.slot)) {
  2210. var slot = (slots[name] || (slots[name] = []));
  2211. if (child.tag === 'template') {
  2212. slot.push.apply(slot, child.children);
  2213. } else {
  2214. slot.push(child);
  2215. }
  2216. } else {
  2217. defaultSlot.push(child);
  2218. }
  2219. }
  2220. // ignore single whitespace
  2221. if (defaultSlot.length && !(
  2222. defaultSlot.length === 1 &&
  2223. (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  2224. )) {
  2225. slots.default = defaultSlot;
  2226. }
  2227. return slots
  2228. }
  2229. /* */
  2230. function initEvents (vm) {
  2231. vm._events = Object.create(null);
  2232. // init parent attached events
  2233. var listeners = vm.$options._parentListeners;
  2234. var on = bind$1(vm.$on, vm);
  2235. var off = bind$1(vm.$off, vm);
  2236. vm._updateListeners = function (listeners, oldListeners) {
  2237. updateListeners(listeners, oldListeners || {}, on, off, vm);
  2238. };
  2239. if (listeners) {
  2240. vm._updateListeners(listeners);
  2241. }
  2242. }
  2243. function eventsMixin (Vue) {
  2244. Vue.prototype.$on = function (event, fn) {
  2245. var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
  2246. return vm
  2247. };
  2248. Vue.prototype.$once = function (event, fn) {
  2249. var vm = this;
  2250. function on () {
  2251. vm.$off(event, on);
  2252. fn.apply(vm, arguments);
  2253. }
  2254. on.fn = fn;
  2255. vm.$on(event, on);
  2256. return vm
  2257. };
  2258. Vue.prototype.$off = function (event, fn) {
  2259. var vm = this;
  2260. // all
  2261. if (!arguments.length) {
  2262. vm._events = Object.create(null);
  2263. return vm
  2264. }
  2265. // specific event
  2266. var cbs = vm._events[event];
  2267. if (!cbs) {
  2268. return vm
  2269. }
  2270. if (arguments.length === 1) {
  2271. vm._events[event] = null;
  2272. return vm
  2273. }
  2274. // specific handler
  2275. var cb;
  2276. var i = cbs.length;
  2277. while (i--) {
  2278. cb = cbs[i];
  2279. if (cb === fn || cb.fn === fn) {
  2280. cbs.splice(i, 1);
  2281. break
  2282. }
  2283. }
  2284. return vm
  2285. };
  2286. Vue.prototype.$emit = function (event) {
  2287. var vm = this;
  2288. var cbs = vm._events[event];
  2289. if (cbs) {
  2290. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2291. var args = toArray(arguments, 1);
  2292. for (var i = 0, l = cbs.length; i < l; i++) {
  2293. cbs[i].apply(vm, args);
  2294. }
  2295. }
  2296. return vm
  2297. };
  2298. }
  2299. /* */
  2300. var uid = 0;
  2301. function initMixin (Vue) {
  2302. Vue.prototype._init = function (options) {
  2303. var vm = this;
  2304. // a uid
  2305. vm._uid = uid++;
  2306. // a flag to avoid this being observed
  2307. vm._isVue = true;
  2308. // merge options
  2309. if (options && options._isComponent) {
  2310. // optimize internal component instantiation
  2311. // since dynamic options merging is pretty slow, and none of the
  2312. // internal component options needs special treatment.
  2313. initInternalComponent(vm, options);
  2314. } else {
  2315. vm.$options = mergeOptions(
  2316. resolveConstructorOptions(vm),
  2317. options || {},
  2318. vm
  2319. );
  2320. }
  2321. /* istanbul ignore else */
  2322. if (process.env.NODE_ENV !== 'production') {
  2323. initProxy(vm);
  2324. } else {
  2325. vm._renderProxy = vm;
  2326. }
  2327. // expose real self
  2328. vm._self = vm;
  2329. initLifecycle(vm);
  2330. initEvents(vm);
  2331. callHook(vm, 'beforeCreate');
  2332. initState(vm);
  2333. callHook(vm, 'created');
  2334. initRender(vm);
  2335. };
  2336. function initInternalComponent (vm, options) {
  2337. var opts = vm.$options = Object.create(resolveConstructorOptions(vm));
  2338. // doing this because it's faster than dynamic enumeration.
  2339. opts.parent = options.parent;
  2340. opts.propsData = options.propsData;
  2341. opts._parentVnode = options._parentVnode;
  2342. opts._parentListeners = options._parentListeners;
  2343. opts._renderChildren = options._renderChildren;
  2344. opts._componentTag = options._componentTag;
  2345. if (options.render) {
  2346. opts.render = options.render;
  2347. opts.staticRenderFns = options.staticRenderFns;
  2348. }
  2349. }
  2350. function resolveConstructorOptions (vm) {
  2351. var Ctor = vm.constructor;
  2352. var options = Ctor.options;
  2353. if (Ctor.super) {
  2354. var superOptions = Ctor.super.options;
  2355. var cachedSuperOptions = Ctor.superOptions;
  2356. if (superOptions !== cachedSuperOptions) {
  2357. // super option changed
  2358. Ctor.superOptions = superOptions;
  2359. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  2360. if (options.name) {
  2361. options.components[options.name] = Ctor;
  2362. }
  2363. }
  2364. }
  2365. return options
  2366. }
  2367. }
  2368. function Vue$2 (options) {
  2369. if (process.env.NODE_ENV !== 'production' &&
  2370. !(this instanceof Vue$2)) {
  2371. warn('Vue is a constructor and should be called with the `new` keyword');
  2372. }
  2373. this._init(options);
  2374. }
  2375. initMixin(Vue$2);
  2376. stateMixin(Vue$2);
  2377. eventsMixin(Vue$2);
  2378. lifecycleMixin(Vue$2);
  2379. renderMixin(Vue$2);
  2380. var warn = noop;
  2381. var formatComponentName;
  2382. if (process.env.NODE_ENV !== 'production') {
  2383. var hasConsole = typeof console !== 'undefined';
  2384. warn = function (msg, vm) {
  2385. if (hasConsole && (!config.silent)) {
  2386. console.error("[Vue warn]: " + msg + " " + (
  2387. vm ? formatLocation(formatComponentName(vm)) : ''
  2388. ));
  2389. }
  2390. };
  2391. formatComponentName = function (vm) {
  2392. if (vm.$root === vm) {
  2393. return 'root instance'
  2394. }
  2395. var name = vm._isVue
  2396. ? vm.$options.name || vm.$options._componentTag
  2397. : vm.name;
  2398. return (
  2399. (name ? ("component <" + name + ">") : "anonymous component") +
  2400. (vm._isVue && vm.$options.__file ? (" at " + (vm.$options.__file)) : '')
  2401. )
  2402. };
  2403. var formatLocation = function (str) {
  2404. if (str === 'anonymous component') {
  2405. str += " - use the \"name\" option for better debugging messages.";
  2406. }
  2407. return ("\n(found in " + str + ")")
  2408. };
  2409. }
  2410. /* */
  2411. /**
  2412. * Option overwriting strategies are functions that handle
  2413. * how to merge a parent option value and a child option
  2414. * value into the final value.
  2415. */
  2416. var strats = config.optionMergeStrategies;
  2417. /**
  2418. * Options with restrictions
  2419. */
  2420. if (process.env.NODE_ENV !== 'production') {
  2421. strats.el = strats.propsData = function (parent, child, vm, key) {
  2422. if (!vm) {
  2423. warn(
  2424. "option \"" + key + "\" can only be used during instance " +
  2425. 'creation with the `new` keyword.'
  2426. );
  2427. }
  2428. return defaultStrat(parent, child)
  2429. };
  2430. }
  2431. /**
  2432. * Helper that recursively merges two data objects together.
  2433. */
  2434. function mergeData (to, from) {
  2435. var key, toVal, fromVal;
  2436. for (key in from) {
  2437. toVal = to[key];
  2438. fromVal = from[key];
  2439. if (!hasOwn(to, key)) {
  2440. set(to, key, fromVal);
  2441. } else if (isObject(toVal) && isObject(fromVal)) {
  2442. mergeData(toVal, fromVal);
  2443. }
  2444. }
  2445. return to
  2446. }
  2447. /**
  2448. * Data
  2449. */
  2450. strats.data = function (
  2451. parentVal,
  2452. childVal,
  2453. vm
  2454. ) {
  2455. if (!vm) {
  2456. // in a Vue.extend merge, both should be functions
  2457. if (!childVal) {
  2458. return parentVal
  2459. }
  2460. if (typeof childVal !== 'function') {
  2461. process.env.NODE_ENV !== 'production' && warn(
  2462. 'The "data" option should be a function ' +
  2463. 'that returns a per-instance value in component ' +
  2464. 'definitions.',
  2465. vm
  2466. );
  2467. return parentVal
  2468. }
  2469. if (!parentVal) {
  2470. return childVal
  2471. }
  2472. // when parentVal & childVal are both present,
  2473. // we need to return a function that returns the
  2474. // merged result of both functions... no need to
  2475. // check if parentVal is a function here because
  2476. // it has to be a function to pass previous merges.
  2477. return function mergedDataFn () {
  2478. return mergeData(
  2479. childVal.call(this),
  2480. parentVal.call(this)
  2481. )
  2482. }
  2483. } else if (parentVal || childVal) {
  2484. return function mergedInstanceDataFn () {
  2485. // instance merge
  2486. var instanceData = typeof childVal === 'function'
  2487. ? childVal.call(vm)
  2488. : childVal;
  2489. var defaultData = typeof parentVal === 'function'
  2490. ? parentVal.call(vm)
  2491. : undefined;
  2492. if (instanceData) {
  2493. return mergeData(instanceData, defaultData)
  2494. } else {
  2495. return defaultData
  2496. }
  2497. }
  2498. }
  2499. };
  2500. /**
  2501. * Hooks and param attributes are merged as arrays.
  2502. */
  2503. function mergeHook (
  2504. parentVal,
  2505. childVal
  2506. ) {
  2507. return childVal
  2508. ? parentVal
  2509. ? parentVal.concat(childVal)
  2510. : Array.isArray(childVal)
  2511. ? childVal
  2512. : [childVal]
  2513. : parentVal
  2514. }
  2515. config._lifecycleHooks.forEach(function (hook) {
  2516. strats[hook] = mergeHook;
  2517. });
  2518. /**
  2519. * Assets
  2520. *
  2521. * When a vm is present (instance creation), we need to do
  2522. * a three-way merge between constructor options, instance
  2523. * options and parent options.
  2524. */
  2525. function mergeAssets (parentVal, childVal) {
  2526. var res = Object.create(parentVal || null);
  2527. return childVal
  2528. ? extend(res, childVal)
  2529. : res
  2530. }
  2531. config._assetTypes.forEach(function (type) {
  2532. strats[type + 's'] = mergeAssets;
  2533. });
  2534. /**
  2535. * Watchers.
  2536. *
  2537. * Watchers hashes should not overwrite one
  2538. * another, so we merge them as arrays.
  2539. */
  2540. strats.watch = function (parentVal, childVal) {
  2541. /* istanbul ignore if */
  2542. if (!childVal) { return parentVal }
  2543. if (!parentVal) { return childVal }
  2544. var ret = {};
  2545. extend(ret, parentVal);
  2546. for (var key in childVal) {
  2547. var parent = ret[key];
  2548. var child = childVal[key];
  2549. if (parent && !Array.isArray(parent)) {
  2550. parent = [parent];
  2551. }
  2552. ret[key] = parent
  2553. ? parent.concat(child)
  2554. : [child];
  2555. }
  2556. return ret
  2557. };
  2558. /**
  2559. * Other object hashes.
  2560. */
  2561. strats.props =
  2562. strats.methods =
  2563. strats.computed = function (parentVal, childVal) {
  2564. if (!childVal) { return parentVal }
  2565. if (!parentVal) { return childVal }
  2566. var ret = Object.create(null);
  2567. extend(ret, parentVal);
  2568. extend(ret, childVal);
  2569. return ret
  2570. };
  2571. /**
  2572. * Default strategy.
  2573. */
  2574. var defaultStrat = function (parentVal, childVal) {
  2575. return childVal === undefined
  2576. ? parentVal
  2577. : childVal
  2578. };
  2579. /**
  2580. * Make sure component options get converted to actual
  2581. * constructors.
  2582. */
  2583. function normalizeComponents (options) {
  2584. if (options.components) {
  2585. var components = options.components;
  2586. var def;
  2587. for (var key in components) {
  2588. var lower = key.toLowerCase();
  2589. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  2590. process.env.NODE_ENV !== 'production' && warn(
  2591. 'Do not use built-in or reserved HTML elements as component ' +
  2592. 'id: ' + key
  2593. );
  2594. continue
  2595. }
  2596. def = components[key];
  2597. if (isPlainObject(def)) {
  2598. components[key] = Vue$2.extend(def);
  2599. }
  2600. }
  2601. }
  2602. }
  2603. /**
  2604. * Ensure all props option syntax are normalized into the
  2605. * Object-based format.
  2606. */
  2607. function normalizeProps (options) {
  2608. var props = options.props;
  2609. if (!props) { return }
  2610. var res = {};
  2611. var i, val, name;
  2612. if (Array.isArray(props)) {
  2613. i = props.length;
  2614. while (i--) {
  2615. val = props[i];
  2616. if (typeof val === 'string') {
  2617. name = camelize(val);
  2618. res[name] = { type: null };
  2619. } else if (process.env.NODE_ENV !== 'production') {
  2620. warn('props must be strings when using array syntax.');
  2621. }
  2622. }
  2623. } else if (isPlainObject(props)) {
  2624. for (var key in props) {
  2625. val = props[key];
  2626. name = camelize(key);
  2627. res[name] = isPlainObject(val)
  2628. ? val
  2629. : { type: val };
  2630. }
  2631. }
  2632. options.props = res;
  2633. }
  2634. /**
  2635. * Normalize raw function directives into object format.
  2636. */
  2637. function normalizeDirectives (options) {
  2638. var dirs = options.directives;
  2639. if (dirs) {
  2640. for (var key in dirs) {
  2641. var def = dirs[key];
  2642. if (typeof def === 'function') {
  2643. dirs[key] = { bind: def, update: def };
  2644. }
  2645. }
  2646. }
  2647. }
  2648. /**
  2649. * Merge two option objects into a new one.
  2650. * Core utility used in both instantiation and inheritance.
  2651. */
  2652. function mergeOptions (
  2653. parent,
  2654. child,
  2655. vm
  2656. ) {
  2657. normalizeComponents(child);
  2658. normalizeProps(child);
  2659. normalizeDirectives(child);
  2660. var extendsFrom = child.extends;
  2661. if (extendsFrom) {
  2662. parent = typeof extendsFrom === 'function'
  2663. ? mergeOptions(parent, extendsFrom.options, vm)
  2664. : mergeOptions(parent, extendsFrom, vm);
  2665. }
  2666. if (child.mixins) {
  2667. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2668. var mixin = child.mixins[i];
  2669. if (mixin.prototype instanceof Vue$2) {
  2670. mixin = mixin.options;
  2671. }
  2672. parent = mergeOptions(parent, mixin, vm);
  2673. }
  2674. }
  2675. var options = {};
  2676. var key;
  2677. for (key in parent) {
  2678. mergeField(key);
  2679. }
  2680. for (key in child) {
  2681. if (!hasOwn(parent, key)) {
  2682. mergeField(key);
  2683. }
  2684. }
  2685. function mergeField (key) {
  2686. var strat = strats[key] || defaultStrat;
  2687. options[key] = strat(parent[key], child[key], vm, key);
  2688. }
  2689. return options
  2690. }
  2691. /**
  2692. * Resolve an asset.
  2693. * This function is used because child instances need access
  2694. * to assets defined in its ancestor chain.
  2695. */
  2696. function resolveAsset (
  2697. options,
  2698. type,
  2699. id,
  2700. warnMissing
  2701. ) {
  2702. /* istanbul ignore if */
  2703. if (typeof id !== 'string') {
  2704. return
  2705. }
  2706. var assets = options[type];
  2707. var res = assets[id] ||
  2708. // camelCase ID
  2709. assets[camelize(id)] ||
  2710. // Pascal Case ID
  2711. assets[capitalize(camelize(id))];
  2712. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  2713. warn(
  2714. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2715. options
  2716. );
  2717. }
  2718. return res
  2719. }
  2720. /* */
  2721. function validateProp (
  2722. key,
  2723. propOptions,
  2724. propsData,
  2725. vm
  2726. ) {
  2727. var prop = propOptions[key];
  2728. var absent = !hasOwn(propsData, key);
  2729. var value = propsData[key];
  2730. // handle boolean props
  2731. if (isBooleanType(prop.type)) {
  2732. if (absent && !hasOwn(prop, 'default')) {
  2733. value = false;
  2734. } else if (value === '' || value === hyphenate(key)) {
  2735. value = true;
  2736. }
  2737. }
  2738. // check default value
  2739. if (value === undefined) {
  2740. value = getPropDefaultValue(vm, prop, key);
  2741. // since the default value is a fresh copy,
  2742. // make sure to observe it.
  2743. var prevShouldConvert = observerState.shouldConvert;
  2744. observerState.shouldConvert = true;
  2745. observe(value);
  2746. observerState.shouldConvert = prevShouldConvert;
  2747. }
  2748. if (process.env.NODE_ENV !== 'production') {
  2749. assertProp(prop, key, value, vm, absent);
  2750. }
  2751. return value
  2752. }
  2753. /**
  2754. * Get the default value of a prop.
  2755. */
  2756. function getPropDefaultValue (vm, prop, name) {
  2757. // no default, return undefined
  2758. if (!hasOwn(prop, 'default')) {
  2759. return undefined
  2760. }
  2761. var def = prop.default;
  2762. // warn against non-factory defaults for Object & Array
  2763. if (isObject(def)) {
  2764. process.env.NODE_ENV !== 'production' && warn(
  2765. 'Invalid default value for prop "' + name + '": ' +
  2766. 'Props with type Object/Array must use a factory function ' +
  2767. 'to return the default value.',
  2768. vm
  2769. );
  2770. }
  2771. // call factory function for non-Function types
  2772. return typeof def === 'function' && prop.type !== Function
  2773. ? def.call(vm)
  2774. : def
  2775. }
  2776. /**
  2777. * Assert whether a prop is valid.
  2778. */
  2779. function assertProp (
  2780. prop,
  2781. name,
  2782. value,
  2783. vm,
  2784. absent
  2785. ) {
  2786. if (prop.required && absent) {
  2787. warn(
  2788. 'Missing required prop: "' + name + '"',
  2789. vm
  2790. );
  2791. return
  2792. }
  2793. if (value == null && !prop.required) {
  2794. return
  2795. }
  2796. var type = prop.type;
  2797. var valid = !type || type === true;
  2798. var expectedTypes = [];
  2799. if (type) {
  2800. if (!Array.isArray(type)) {
  2801. type = [type];
  2802. }
  2803. for (var i = 0; i < type.length && !valid; i++) {
  2804. var assertedType = assertType(value, type[i]);
  2805. expectedTypes.push(assertedType.expectedType);
  2806. valid = assertedType.valid;
  2807. }
  2808. }
  2809. if (!valid) {
  2810. warn(
  2811. 'Invalid prop: type check failed for prop "' + name + '".' +
  2812. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  2813. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  2814. vm
  2815. );
  2816. return
  2817. }
  2818. var validator = prop.validator;
  2819. if (validator) {
  2820. if (!validator(value)) {
  2821. warn(
  2822. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  2823. vm
  2824. );
  2825. }
  2826. }
  2827. }
  2828. /**
  2829. * Assert the type of a value
  2830. */
  2831. function assertType (value, type) {
  2832. var valid;
  2833. var expectedType = getType(type);
  2834. if (expectedType === 'String') {
  2835. valid = typeof value === (expectedType = 'string');
  2836. } else if (expectedType === 'Number') {
  2837. valid = typeof value === (expectedType = 'number');
  2838. } else if (expectedType === 'Boolean') {
  2839. valid = typeof value === (expectedType = 'boolean');
  2840. } else if (expectedType === 'Function') {
  2841. valid = typeof value === (expectedType = 'function');
  2842. } else if (expectedType === 'Object') {
  2843. valid = isPlainObject(value);
  2844. } else if (expectedType === 'Array') {
  2845. valid = Array.isArray(value);
  2846. } else {
  2847. valid = value instanceof type;
  2848. }
  2849. return {
  2850. valid: valid,
  2851. expectedType: expectedType
  2852. }
  2853. }
  2854. /**
  2855. * Use function string name to check built-in types,
  2856. * because a simple equality check will fail when running
  2857. * across different vms / iframes.
  2858. */
  2859. function getType (fn) {
  2860. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  2861. return match && match[1]
  2862. }
  2863. function isBooleanType (fn) {
  2864. if (!Array.isArray(fn)) {
  2865. return getType(fn) === 'Boolean'
  2866. }
  2867. for (var i = 0, len = fn.length; i < len; i++) {
  2868. if (getType(fn[i]) === 'Boolean') {
  2869. return true
  2870. }
  2871. }
  2872. /* istanbul ignore next */
  2873. return false
  2874. }
  2875. var util = Object.freeze({
  2876. defineReactive: defineReactive$$1,
  2877. _toString: _toString,
  2878. toNumber: toNumber,
  2879. makeMap: makeMap,
  2880. isBuiltInTag: isBuiltInTag,
  2881. remove: remove$1,
  2882. hasOwn: hasOwn,
  2883. isPrimitive: isPrimitive,
  2884. cached: cached,
  2885. camelize: camelize,
  2886. capitalize: capitalize,
  2887. hyphenate: hyphenate,
  2888. bind: bind$1,
  2889. toArray: toArray,
  2890. extend: extend,
  2891. isObject: isObject,
  2892. isPlainObject: isPlainObject,
  2893. toObject: toObject,
  2894. noop: noop,
  2895. no: no,
  2896. genStaticKeys: genStaticKeys,
  2897. looseEqual: looseEqual,
  2898. looseIndexOf: looseIndexOf,
  2899. isReserved: isReserved,
  2900. def: def,
  2901. parsePath: parsePath,
  2902. hasProto: hasProto,
  2903. inBrowser: inBrowser,
  2904. UA: UA,
  2905. isIE: isIE,
  2906. isIE9: isIE9,
  2907. isEdge: isEdge,
  2908. isAndroid: isAndroid,
  2909. isIOS: isIOS,
  2910. devtools: devtools,
  2911. nextTick: nextTick,
  2912. get _Set () { return _Set; },
  2913. mergeOptions: mergeOptions,
  2914. resolveAsset: resolveAsset,
  2915. get warn () { return warn; },
  2916. get formatComponentName () { return formatComponentName; },
  2917. validateProp: validateProp
  2918. });
  2919. /* */
  2920. function initUse (Vue) {
  2921. Vue.use = function (plugin) {
  2922. /* istanbul ignore if */
  2923. if (plugin.installed) {
  2924. return
  2925. }
  2926. // additional parameters
  2927. var args = toArray(arguments, 1);
  2928. args.unshift(this);
  2929. if (typeof plugin.install === 'function') {
  2930. plugin.install.apply(plugin, args);
  2931. } else {
  2932. plugin.apply(null, args);
  2933. }
  2934. plugin.installed = true;
  2935. return this
  2936. };
  2937. }
  2938. /* */
  2939. function initMixin$1 (Vue) {
  2940. Vue.mixin = function (mixin) {
  2941. Vue.options = mergeOptions(Vue.options, mixin);
  2942. };
  2943. }
  2944. /* */
  2945. function initExtend (Vue) {
  2946. /**
  2947. * Each instance constructor, including Vue, has a unique
  2948. * cid. This enables us to create wrapped "child
  2949. * constructors" for prototypal inheritance and cache them.
  2950. */
  2951. Vue.cid = 0;
  2952. var cid = 1;
  2953. /**
  2954. * Class inheritance
  2955. */
  2956. Vue.extend = function (extendOptions) {
  2957. extendOptions = extendOptions || {};
  2958. var Super = this;
  2959. var isFirstExtend = Super.cid === 0;
  2960. if (isFirstExtend && extendOptions._Ctor) {
  2961. return extendOptions._Ctor
  2962. }
  2963. var name = extendOptions.name || Super.options.name;
  2964. if (process.env.NODE_ENV !== 'production') {
  2965. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  2966. warn(
  2967. 'Invalid component name: "' + name + '". Component names ' +
  2968. 'can only contain alphanumeric characaters and the hyphen.'
  2969. );
  2970. name = null;
  2971. }
  2972. }
  2973. var Sub = function VueComponent (options) {
  2974. this._init(options);
  2975. };
  2976. Sub.prototype = Object.create(Super.prototype);
  2977. Sub.prototype.constructor = Sub;
  2978. Sub.cid = cid++;
  2979. Sub.options = mergeOptions(
  2980. Super.options,
  2981. extendOptions
  2982. );
  2983. Sub['super'] = Super;
  2984. // allow further extension
  2985. Sub.extend = Super.extend;
  2986. // create asset registers, so extended classes
  2987. // can have their private assets too.
  2988. config._assetTypes.forEach(function (type) {
  2989. Sub[type] = Super[type];
  2990. });
  2991. // enable recursive self-lookup
  2992. if (name) {
  2993. Sub.options.components[name] = Sub;
  2994. }
  2995. // keep a reference to the super options at extension time.
  2996. // later at instantiation we can check if Super's options have
  2997. // been updated.
  2998. Sub.superOptions = Super.options;
  2999. Sub.extendOptions = extendOptions;
  3000. // cache constructor
  3001. if (isFirstExtend) {
  3002. extendOptions._Ctor = Sub;
  3003. }
  3004. return Sub
  3005. };
  3006. }
  3007. /* */
  3008. function initAssetRegisters (Vue) {
  3009. /**
  3010. * Create asset registration methods.
  3011. */
  3012. config._assetTypes.forEach(function (type) {
  3013. Vue[type] = function (
  3014. id,
  3015. definition
  3016. ) {
  3017. if (!definition) {
  3018. return this.options[type + 's'][id]
  3019. } else {
  3020. /* istanbul ignore if */
  3021. if (process.env.NODE_ENV !== 'production') {
  3022. if (type === 'component' && config.isReservedTag(id)) {
  3023. warn(
  3024. 'Do not use built-in or reserved HTML elements as component ' +
  3025. 'id: ' + id
  3026. );
  3027. }
  3028. }
  3029. if (type === 'component' && isPlainObject(definition)) {
  3030. definition.name = definition.name || id;
  3031. definition = Vue.extend(definition);
  3032. }
  3033. if (type === 'directive' && typeof definition === 'function') {
  3034. definition = { bind: definition, update: definition };
  3035. }
  3036. this.options[type + 's'][id] = definition;
  3037. return definition
  3038. }
  3039. };
  3040. });
  3041. }
  3042. var KeepAlive = {
  3043. name: 'keep-alive',
  3044. abstract: true,
  3045. created: function created () {
  3046. this.cache = Object.create(null);
  3047. },
  3048. render: function render () {
  3049. var vnode = getFirstComponentChild(this.$slots.default);
  3050. if (vnode && vnode.componentOptions) {
  3051. var opts = vnode.componentOptions;
  3052. var key = vnode.key == null
  3053. // same constructor may get registered as different local components
  3054. // so cid alone is not enough (#3269)
  3055. ? opts.Ctor.cid + '::' + opts.tag
  3056. : vnode.key;
  3057. if (this.cache[key]) {
  3058. vnode.child = this.cache[key].child;
  3059. } else {
  3060. this.cache[key] = vnode;
  3061. }
  3062. vnode.data.keepAlive = true;
  3063. }
  3064. return vnode
  3065. },
  3066. destroyed: function destroyed () {
  3067. var this$1 = this;
  3068. for (var key in this.cache) {
  3069. var vnode = this$1.cache[key];
  3070. callHook(vnode.child, 'deactivated');
  3071. vnode.child.$destroy();
  3072. }
  3073. }
  3074. };
  3075. var builtInComponents = {
  3076. KeepAlive: KeepAlive
  3077. };
  3078. /* */
  3079. function initGlobalAPI (Vue) {
  3080. // config
  3081. var configDef = {};
  3082. configDef.get = function () { return config; };
  3083. if (process.env.NODE_ENV !== 'production') {
  3084. configDef.set = function () {
  3085. warn(
  3086. 'Do not replace the Vue.config object, set individual fields instead.'
  3087. );
  3088. };
  3089. }
  3090. Object.defineProperty(Vue, 'config', configDef);
  3091. Vue.util = util;
  3092. Vue.set = set;
  3093. Vue.delete = del;
  3094. Vue.nextTick = nextTick;
  3095. Vue.options = Object.create(null);
  3096. config._assetTypes.forEach(function (type) {
  3097. Vue.options[type + 's'] = Object.create(null);
  3098. });
  3099. extend(Vue.options.components, builtInComponents);
  3100. initUse(Vue);
  3101. initMixin$1(Vue);
  3102. initExtend(Vue);
  3103. initAssetRegisters(Vue);
  3104. }
  3105. initGlobalAPI(Vue$2);
  3106. Object.defineProperty(Vue$2.prototype, '$isServer', {
  3107. get: function () { return config._isServer; }
  3108. });
  3109. Vue$2.version = '2.0.3';
  3110. /* */
  3111. // attributes that should be using props for binding
  3112. var mustUseProp = makeMap('value,selected,checked,muted');
  3113. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  3114. var isBooleanAttr = makeMap(
  3115. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  3116. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  3117. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  3118. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  3119. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  3120. 'truespeed,typemustmatch,visible'
  3121. );
  3122. var isAttr = makeMap(
  3123. 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  3124. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  3125. 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
  3126. 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  3127. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
  3128. 'form,formaction,headers,<th>,height,hidden,high,href,hreflang,http-equiv,' +
  3129. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  3130. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  3131. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  3132. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  3133. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  3134. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  3135. 'target,title,type,usemap,value,width,wrap'
  3136. );
  3137. var xlinkNS = 'http://www.w3.org/1999/xlink';
  3138. var isXlink = function (name) {
  3139. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  3140. };
  3141. var getXlinkProp = function (name) {
  3142. return isXlink(name) ? name.slice(6, name.length) : ''
  3143. };
  3144. var isFalsyAttrValue = function (val) {
  3145. return val == null || val === false
  3146. };
  3147. /* */
  3148. function genClassForVnode (vnode) {
  3149. var data = vnode.data;
  3150. var parentNode = vnode;
  3151. var childNode = vnode;
  3152. while (childNode.child) {
  3153. childNode = childNode.child._vnode;
  3154. if (childNode.data) {
  3155. data = mergeClassData(childNode.data, data);
  3156. }
  3157. }
  3158. while ((parentNode = parentNode.parent)) {
  3159. if (parentNode.data) {
  3160. data = mergeClassData(data, parentNode.data);
  3161. }
  3162. }
  3163. return genClassFromData(data)
  3164. }
  3165. function mergeClassData (child, parent) {
  3166. return {
  3167. staticClass: concat(child.staticClass, parent.staticClass),
  3168. class: child.class
  3169. ? [child.class, parent.class]
  3170. : parent.class
  3171. }
  3172. }
  3173. function genClassFromData (data) {
  3174. var dynamicClass = data.class;
  3175. var staticClass = data.staticClass;
  3176. if (staticClass || dynamicClass) {
  3177. return concat(staticClass, stringifyClass(dynamicClass))
  3178. }
  3179. /* istanbul ignore next */
  3180. return ''
  3181. }
  3182. function concat (a, b) {
  3183. return a ? b ? (a + ' ' + b) : a : (b || '')
  3184. }
  3185. function stringifyClass (value) {
  3186. var res = '';
  3187. if (!value) {
  3188. return res
  3189. }
  3190. if (typeof value === 'string') {
  3191. return value
  3192. }
  3193. if (Array.isArray(value)) {
  3194. var stringified;
  3195. for (var i = 0, l = value.length; i < l; i++) {
  3196. if (value[i]) {
  3197. if ((stringified = stringifyClass(value[i]))) {
  3198. res += stringified + ' ';
  3199. }
  3200. }
  3201. }
  3202. return res.slice(0, -1)
  3203. }
  3204. if (isObject(value)) {
  3205. for (var key in value) {
  3206. if (value[key]) { res += key + ' '; }
  3207. }
  3208. return res.slice(0, -1)
  3209. }
  3210. /* istanbul ignore next */
  3211. return res
  3212. }
  3213. /* */
  3214. var namespaceMap = {
  3215. svg: 'http://www.w3.org/2000/svg',
  3216. math: 'http://www.w3.org/1998/Math/MathML'
  3217. };
  3218. var isHTMLTag = makeMap(
  3219. 'html,body,base,head,link,meta,style,title,' +
  3220. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  3221. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  3222. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  3223. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  3224. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  3225. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  3226. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  3227. 'output,progress,select,textarea,' +
  3228. 'details,dialog,menu,menuitem,summary,' +
  3229. 'content,element,shadow,template'
  3230. );
  3231. var isUnaryTag = makeMap(
  3232. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  3233. 'link,meta,param,source,track,wbr',
  3234. true
  3235. );
  3236. // Elements that you can, intentionally, leave open
  3237. // (and which close themselves)
  3238. var canBeLeftOpenTag = makeMap(
  3239. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  3240. true
  3241. );
  3242. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  3243. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  3244. var isNonPhrasingTag = makeMap(
  3245. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  3246. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  3247. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  3248. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  3249. 'title,tr,track',
  3250. true
  3251. );
  3252. // this map is intentionally selective, only covering SVG elements that may
  3253. // contain child elements.
  3254. var isSVG = makeMap(
  3255. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,' +
  3256. 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  3257. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  3258. true
  3259. );
  3260. var isReservedTag = function (tag) {
  3261. return isHTMLTag(tag) || isSVG(tag)
  3262. };
  3263. function getTagNamespace (tag) {
  3264. if (isSVG(tag)) {
  3265. return 'svg'
  3266. }
  3267. // basic support for MathML
  3268. // note it doesn't support other MathML elements being component roots
  3269. if (tag === 'math') {
  3270. return 'math'
  3271. }
  3272. }
  3273. var unknownElementCache = Object.create(null);
  3274. function isUnknownElement (tag) {
  3275. /* istanbul ignore if */
  3276. if (!inBrowser) {
  3277. return true
  3278. }
  3279. if (isReservedTag(tag)) {
  3280. return false
  3281. }
  3282. tag = tag.toLowerCase();
  3283. /* istanbul ignore if */
  3284. if (unknownElementCache[tag] != null) {
  3285. return unknownElementCache[tag]
  3286. }
  3287. var el = document.createElement(tag);
  3288. if (tag.indexOf('-') > -1) {
  3289. // http://stackoverflow.com/a/28210364/1070244
  3290. return (unknownElementCache[tag] = (
  3291. el.constructor === window.HTMLUnknownElement ||
  3292. el.constructor === window.HTMLElement
  3293. ))
  3294. } else {
  3295. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  3296. }
  3297. }
  3298. /* */
  3299. /**
  3300. * Query an element selector if it's not an element already.
  3301. */
  3302. function query (el) {
  3303. if (typeof el === 'string') {
  3304. var selector = el;
  3305. el = document.querySelector(el);
  3306. if (!el) {
  3307. process.env.NODE_ENV !== 'production' && warn(
  3308. 'Cannot find element: ' + selector
  3309. );
  3310. return document.createElement('div')
  3311. }
  3312. }
  3313. return el
  3314. }
  3315. /* */
  3316. function createElement$1 (tagName, vnode) {
  3317. var elm = document.createElement(tagName);
  3318. if (tagName !== 'select') {
  3319. return elm
  3320. }
  3321. if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) {
  3322. elm.setAttribute('multiple', 'multiple');
  3323. }
  3324. return elm
  3325. }
  3326. function createElementNS (namespace, tagName) {
  3327. return document.createElementNS(namespaceMap[namespace], tagName)
  3328. }
  3329. function createTextNode (text) {
  3330. return document.createTextNode(text)
  3331. }
  3332. function createComment (text) {
  3333. return document.createComment(text)
  3334. }
  3335. function insertBefore (parentNode, newNode, referenceNode) {
  3336. parentNode.insertBefore(newNode, referenceNode);
  3337. }
  3338. function removeChild (node, child) {
  3339. node.removeChild(child);
  3340. }
  3341. function appendChild (node, child) {
  3342. node.appendChild(child);
  3343. }
  3344. function parentNode (node) {
  3345. return node.parentNode
  3346. }
  3347. function nextSibling (node) {
  3348. return node.nextSibling
  3349. }
  3350. function tagName (node) {
  3351. return node.tagName
  3352. }
  3353. function setTextContent (node, text) {
  3354. node.textContent = text;
  3355. }
  3356. function childNodes (node) {
  3357. return node.childNodes
  3358. }
  3359. function setAttribute (node, key, val) {
  3360. node.setAttribute(key, val);
  3361. }
  3362. var nodeOps = Object.freeze({
  3363. createElement: createElement$1,
  3364. createElementNS: createElementNS,
  3365. createTextNode: createTextNode,
  3366. createComment: createComment,
  3367. insertBefore: insertBefore,
  3368. removeChild: removeChild,
  3369. appendChild: appendChild,
  3370. parentNode: parentNode,
  3371. nextSibling: nextSibling,
  3372. tagName: tagName,
  3373. setTextContent: setTextContent,
  3374. childNodes: childNodes,
  3375. setAttribute: setAttribute
  3376. });
  3377. /* */
  3378. var ref = {
  3379. create: function create (_, vnode) {
  3380. registerRef(vnode);
  3381. },
  3382. update: function update (oldVnode, vnode) {
  3383. if (oldVnode.data.ref !== vnode.data.ref) {
  3384. registerRef(oldVnode, true);
  3385. registerRef(vnode);
  3386. }
  3387. },
  3388. destroy: function destroy (vnode) {
  3389. registerRef(vnode, true);
  3390. }
  3391. };
  3392. function registerRef (vnode, isRemoval) {
  3393. var key = vnode.data.ref;
  3394. if (!key) { return }
  3395. var vm = vnode.context;
  3396. var ref = vnode.child || vnode.elm;
  3397. var refs = vm.$refs;
  3398. if (isRemoval) {
  3399. if (Array.isArray(refs[key])) {
  3400. remove$1(refs[key], ref);
  3401. } else if (refs[key] === ref) {
  3402. refs[key] = undefined;
  3403. }
  3404. } else {
  3405. if (vnode.data.refInFor) {
  3406. if (Array.isArray(refs[key])) {
  3407. refs[key].push(ref);
  3408. } else {
  3409. refs[key] = [ref];
  3410. }
  3411. } else {
  3412. refs[key] = ref;
  3413. }
  3414. }
  3415. }
  3416. /**
  3417. * Virtual DOM patching algorithm based on Snabbdom by
  3418. * Simon Friis Vindum (@paldepind)
  3419. * Licensed under the MIT License
  3420. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  3421. *
  3422. * modified by Evan You (@yyx990803)
  3423. *
  3424. /*
  3425. * Not type-checking this because this file is perf-critical and the cost
  3426. * of making flow understand it is not worth it.
  3427. */
  3428. var emptyNode = new VNode('', {}, []);
  3429. var hooks$1 = ['create', 'update', 'remove', 'destroy'];
  3430. function isUndef (s) {
  3431. return s == null
  3432. }
  3433. function isDef (s) {
  3434. return s != null
  3435. }
  3436. function sameVnode (vnode1, vnode2) {
  3437. return (
  3438. vnode1.key === vnode2.key &&
  3439. vnode1.tag === vnode2.tag &&
  3440. vnode1.isComment === vnode2.isComment &&
  3441. !vnode1.data === !vnode2.data
  3442. )
  3443. }
  3444. function createKeyToOldIdx (children, beginIdx, endIdx) {
  3445. var i, key;
  3446. var map = {};
  3447. for (i = beginIdx; i <= endIdx; ++i) {
  3448. key = children[i].key;
  3449. if (isDef(key)) { map[key] = i; }
  3450. }
  3451. return map
  3452. }
  3453. function createPatchFunction (backend) {
  3454. var i, j;
  3455. var cbs = {};
  3456. var modules = backend.modules;
  3457. var nodeOps = backend.nodeOps;
  3458. for (i = 0; i < hooks$1.length; ++i) {
  3459. cbs[hooks$1[i]] = [];
  3460. for (j = 0; j < modules.length; ++j) {
  3461. if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
  3462. }
  3463. }
  3464. function emptyNodeAt (elm) {
  3465. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  3466. }
  3467. function createRmCb (childElm, listeners) {
  3468. function remove$$1 () {
  3469. if (--remove$$1.listeners === 0) {
  3470. removeElement(childElm);
  3471. }
  3472. }
  3473. remove$$1.listeners = listeners;
  3474. return remove$$1
  3475. }
  3476. function removeElement (el) {
  3477. var parent = nodeOps.parentNode(el);
  3478. nodeOps.removeChild(parent, el);
  3479. }
  3480. function createElm (vnode, insertedVnodeQueue, nested) {
  3481. var i;
  3482. var data = vnode.data;
  3483. vnode.isRootInsert = !nested;
  3484. if (isDef(data)) {
  3485. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode); }
  3486. // after calling the init hook, if the vnode is a child component
  3487. // it should've created a child instance and mounted it. the child
  3488. // component also has set the placeholder vnode's elm.
  3489. // in that case we can just return the element and be done.
  3490. if (isDef(i = vnode.child)) {
  3491. initComponent(vnode, insertedVnodeQueue);
  3492. return vnode.elm
  3493. }
  3494. }
  3495. var children = vnode.children;
  3496. var tag = vnode.tag;
  3497. if (isDef(tag)) {
  3498. if (process.env.NODE_ENV !== 'production') {
  3499. if (
  3500. !vnode.ns &&
  3501. !(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
  3502. config.isUnknownElement(tag)
  3503. ) {
  3504. warn(
  3505. 'Unknown custom element: <' + tag + '> - did you ' +
  3506. 'register the component correctly? For recursive components, ' +
  3507. 'make sure to provide the "name" option.',
  3508. vnode.context
  3509. );
  3510. }
  3511. }
  3512. vnode.elm = vnode.ns
  3513. ? nodeOps.createElementNS(vnode.ns, tag)
  3514. : nodeOps.createElement(tag, vnode);
  3515. setScope(vnode);
  3516. createChildren(vnode, children, insertedVnodeQueue);
  3517. if (isDef(data)) {
  3518. invokeCreateHooks(vnode, insertedVnodeQueue);
  3519. }
  3520. } else if (vnode.isComment) {
  3521. vnode.elm = nodeOps.createComment(vnode.text);
  3522. } else {
  3523. vnode.elm = nodeOps.createTextNode(vnode.text);
  3524. }
  3525. return vnode.elm
  3526. }
  3527. function createChildren (vnode, children, insertedVnodeQueue) {
  3528. if (Array.isArray(children)) {
  3529. for (var i = 0; i < children.length; ++i) {
  3530. nodeOps.appendChild(vnode.elm, createElm(children[i], insertedVnodeQueue, true));
  3531. }
  3532. } else if (isPrimitive(vnode.text)) {
  3533. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  3534. }
  3535. }
  3536. function isPatchable (vnode) {
  3537. while (vnode.child) {
  3538. vnode = vnode.child._vnode;
  3539. }
  3540. return isDef(vnode.tag)
  3541. }
  3542. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  3543. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  3544. cbs.create[i$1](emptyNode, vnode);
  3545. }
  3546. i = vnode.data.hook; // Reuse variable
  3547. if (isDef(i)) {
  3548. if (i.create) { i.create(emptyNode, vnode); }
  3549. if (i.insert) { insertedVnodeQueue.push(vnode); }
  3550. }
  3551. }
  3552. function initComponent (vnode, insertedVnodeQueue) {
  3553. if (vnode.data.pendingInsert) {
  3554. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  3555. }
  3556. vnode.elm = vnode.child.$el;
  3557. if (isPatchable(vnode)) {
  3558. invokeCreateHooks(vnode, insertedVnodeQueue);
  3559. setScope(vnode);
  3560. } else {
  3561. // empty component root.
  3562. // skip all element-related modules except for ref (#3455)
  3563. registerRef(vnode);
  3564. // make sure to invoke the insert hook
  3565. insertedVnodeQueue.push(vnode);
  3566. }
  3567. }
  3568. // set scope id attribute for scoped CSS.
  3569. // this is implemented as a special case to avoid the overhead
  3570. // of going through the normal attribute patching process.
  3571. function setScope (vnode) {
  3572. var i;
  3573. if (isDef(i = vnode.context) && isDef(i = i.$options._scopeId)) {
  3574. nodeOps.setAttribute(vnode.elm, i, '');
  3575. }
  3576. if (isDef(i = activeInstance) &&
  3577. i !== vnode.context &&
  3578. isDef(i = i.$options._scopeId)) {
  3579. nodeOps.setAttribute(vnode.elm, i, '');
  3580. }
  3581. }
  3582. function addVnodes (parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  3583. for (; startIdx <= endIdx; ++startIdx) {
  3584. nodeOps.insertBefore(parentElm, createElm(vnodes[startIdx], insertedVnodeQueue), before);
  3585. }
  3586. }
  3587. function invokeDestroyHook (vnode) {
  3588. var i, j;
  3589. var data = vnode.data;
  3590. if (isDef(data)) {
  3591. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  3592. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  3593. }
  3594. if (isDef(i = vnode.children)) {
  3595. for (j = 0; j < vnode.children.length; ++j) {
  3596. invokeDestroyHook(vnode.children[j]);
  3597. }
  3598. }
  3599. }
  3600. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  3601. for (; startIdx <= endIdx; ++startIdx) {
  3602. var ch = vnodes[startIdx];
  3603. if (isDef(ch)) {
  3604. if (isDef(ch.tag)) {
  3605. removeAndInvokeRemoveHook(ch);
  3606. invokeDestroyHook(ch);
  3607. } else { // Text node
  3608. nodeOps.removeChild(parentElm, ch.elm);
  3609. }
  3610. }
  3611. }
  3612. }
  3613. function removeAndInvokeRemoveHook (vnode, rm) {
  3614. if (rm || isDef(vnode.data)) {
  3615. var listeners = cbs.remove.length + 1;
  3616. if (!rm) {
  3617. // directly removing
  3618. rm = createRmCb(vnode.elm, listeners);
  3619. } else {
  3620. // we have a recursively passed down rm callback
  3621. // increase the listeners count
  3622. rm.listeners += listeners;
  3623. }
  3624. // recursively invoke hooks on child component root node
  3625. if (isDef(i = vnode.child) && isDef(i = i._vnode) && isDef(i.data)) {
  3626. removeAndInvokeRemoveHook(i, rm);
  3627. }
  3628. for (i = 0; i < cbs.remove.length; ++i) {
  3629. cbs.remove[i](vnode, rm);
  3630. }
  3631. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  3632. i(vnode, rm);
  3633. } else {
  3634. rm();
  3635. }
  3636. } else {
  3637. removeElement(vnode.elm);
  3638. }
  3639. }
  3640. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  3641. var oldStartIdx = 0;
  3642. var newStartIdx = 0;
  3643. var oldEndIdx = oldCh.length - 1;
  3644. var oldStartVnode = oldCh[0];
  3645. var oldEndVnode = oldCh[oldEndIdx];
  3646. var newEndIdx = newCh.length - 1;
  3647. var newStartVnode = newCh[0];
  3648. var newEndVnode = newCh[newEndIdx];
  3649. var oldKeyToIdx, idxInOld, elmToMove, before;
  3650. // removeOnly is a special flag used only by <transition-group>
  3651. // to ensure removed elements stay in correct relative positions
  3652. // during leaving transitions
  3653. var canMove = !removeOnly;
  3654. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  3655. if (isUndef(oldStartVnode)) {
  3656. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  3657. } else if (isUndef(oldEndVnode)) {
  3658. oldEndVnode = oldCh[--oldEndIdx];
  3659. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  3660. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  3661. oldStartVnode = oldCh[++oldStartIdx];
  3662. newStartVnode = newCh[++newStartIdx];
  3663. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  3664. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  3665. oldEndVnode = oldCh[--oldEndIdx];
  3666. newEndVnode = newCh[--newEndIdx];
  3667. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  3668. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  3669. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  3670. oldStartVnode = oldCh[++oldStartIdx];
  3671. newEndVnode = newCh[--newEndIdx];
  3672. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  3673. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  3674. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  3675. oldEndVnode = oldCh[--oldEndIdx];
  3676. newStartVnode = newCh[++newStartIdx];
  3677. } else {
  3678. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  3679. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  3680. if (isUndef(idxInOld)) { // New element
  3681. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  3682. newStartVnode = newCh[++newStartIdx];
  3683. } else {
  3684. elmToMove = oldCh[idxInOld];
  3685. /* istanbul ignore if */
  3686. if (process.env.NODE_ENV !== 'production' && !elmToMove) {
  3687. warn(
  3688. 'It seems there are duplicate keys that is causing an update error. ' +
  3689. 'Make sure each v-for item has a unique key.'
  3690. );
  3691. }
  3692. if (elmToMove.tag !== newStartVnode.tag) {
  3693. // same key but different element. treat as new element
  3694. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  3695. newStartVnode = newCh[++newStartIdx];
  3696. } else {
  3697. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  3698. oldCh[idxInOld] = undefined;
  3699. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  3700. newStartVnode = newCh[++newStartIdx];
  3701. }
  3702. }
  3703. }
  3704. }
  3705. if (oldStartIdx > oldEndIdx) {
  3706. before = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  3707. addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  3708. } else if (newStartIdx > newEndIdx) {
  3709. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  3710. }
  3711. }
  3712. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  3713. if (oldVnode === vnode) {
  3714. return
  3715. }
  3716. // reuse element for static trees.
  3717. // note we only do this if the vnode is cloned -
  3718. // if the new node is not cloned it means the render functions have been
  3719. // reset by the hot-reload-api and we need to do a proper re-render.
  3720. if (vnode.isStatic &&
  3721. oldVnode.isStatic &&
  3722. vnode.key === oldVnode.key &&
  3723. vnode.isCloned) {
  3724. vnode.elm = oldVnode.elm;
  3725. return
  3726. }
  3727. var i;
  3728. var data = vnode.data;
  3729. var hasData = isDef(data);
  3730. if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  3731. i(oldVnode, vnode);
  3732. }
  3733. var elm = vnode.elm = oldVnode.elm;
  3734. var oldCh = oldVnode.children;
  3735. var ch = vnode.children;
  3736. if (hasData && isPatchable(vnode)) {
  3737. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  3738. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  3739. }
  3740. if (isUndef(vnode.text)) {
  3741. if (isDef(oldCh) && isDef(ch)) {
  3742. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  3743. } else if (isDef(ch)) {
  3744. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  3745. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  3746. } else if (isDef(oldCh)) {
  3747. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  3748. } else if (isDef(oldVnode.text)) {
  3749. nodeOps.setTextContent(elm, '');
  3750. }
  3751. } else if (oldVnode.text !== vnode.text) {
  3752. nodeOps.setTextContent(elm, vnode.text);
  3753. }
  3754. if (hasData) {
  3755. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  3756. }
  3757. }
  3758. function invokeInsertHook (vnode, queue, initial) {
  3759. // delay insert hooks for component root nodes, invoke them after the
  3760. // element is really inserted
  3761. if (initial && vnode.parent) {
  3762. vnode.parent.data.pendingInsert = queue;
  3763. } else {
  3764. for (var i = 0; i < queue.length; ++i) {
  3765. queue[i].data.hook.insert(queue[i]);
  3766. }
  3767. }
  3768. }
  3769. var bailed = false;
  3770. function hydrate (elm, vnode, insertedVnodeQueue) {
  3771. if (process.env.NODE_ENV !== 'production') {
  3772. if (!assertNodeMatch(elm, vnode)) {
  3773. return false
  3774. }
  3775. }
  3776. vnode.elm = elm;
  3777. var tag = vnode.tag;
  3778. var data = vnode.data;
  3779. var children = vnode.children;
  3780. if (isDef(data)) {
  3781. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  3782. if (isDef(i = vnode.child)) {
  3783. // child component. it should have hydrated its own tree.
  3784. initComponent(vnode, insertedVnodeQueue);
  3785. return true
  3786. }
  3787. }
  3788. if (isDef(tag)) {
  3789. if (isDef(children)) {
  3790. var childNodes = nodeOps.childNodes(elm);
  3791. // empty element, allow client to pick up and populate children
  3792. if (!childNodes.length) {
  3793. createChildren(vnode, children, insertedVnodeQueue);
  3794. } else {
  3795. var childrenMatch = true;
  3796. if (childNodes.length !== children.length) {
  3797. childrenMatch = false;
  3798. } else {
  3799. for (var i$1 = 0; i$1 < children.length; i$1++) {
  3800. if (!hydrate(childNodes[i$1], children[i$1], insertedVnodeQueue)) {
  3801. childrenMatch = false;
  3802. break
  3803. }
  3804. }
  3805. }
  3806. if (!childrenMatch) {
  3807. if (process.env.NODE_ENV !== 'production' &&
  3808. typeof console !== 'undefined' &&
  3809. !bailed) {
  3810. bailed = true;
  3811. console.warn('Parent: ', elm);
  3812. console.warn('Mismatching childNodes vs. VNodes: ', childNodes, children);
  3813. }
  3814. return false
  3815. }
  3816. }
  3817. }
  3818. if (isDef(data)) {
  3819. invokeCreateHooks(vnode, insertedVnodeQueue);
  3820. }
  3821. }
  3822. return true
  3823. }
  3824. function assertNodeMatch (node, vnode) {
  3825. if (vnode.tag) {
  3826. return (
  3827. vnode.tag.indexOf('vue-component') === 0 ||
  3828. vnode.tag === nodeOps.tagName(node).toLowerCase()
  3829. )
  3830. } else {
  3831. return _toString(vnode.text) === node.data
  3832. }
  3833. }
  3834. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  3835. if (!vnode) {
  3836. if (oldVnode) { invokeDestroyHook(oldVnode); }
  3837. return
  3838. }
  3839. var elm, parent;
  3840. var isInitialPatch = false;
  3841. var insertedVnodeQueue = [];
  3842. if (!oldVnode) {
  3843. // empty mount, create new root element
  3844. isInitialPatch = true;
  3845. createElm(vnode, insertedVnodeQueue);
  3846. } else {
  3847. var isRealElement = isDef(oldVnode.nodeType);
  3848. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  3849. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  3850. } else {
  3851. if (isRealElement) {
  3852. // mounting to a real element
  3853. // check if this is server-rendered content and if we can perform
  3854. // a successful hydration.
  3855. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  3856. oldVnode.removeAttribute('server-rendered');
  3857. hydrating = true;
  3858. }
  3859. if (hydrating) {
  3860. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  3861. invokeInsertHook(vnode, insertedVnodeQueue, true);
  3862. return oldVnode
  3863. } else if (process.env.NODE_ENV !== 'production') {
  3864. warn(
  3865. 'The client-side rendered virtual DOM tree is not matching ' +
  3866. 'server-rendered content. This is likely caused by incorrect ' +
  3867. 'HTML markup, for example nesting block-level elements inside ' +
  3868. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  3869. 'full client-side render.'
  3870. );
  3871. }
  3872. }
  3873. // either not server-rendered, or hydration failed.
  3874. // create an empty node and replace it
  3875. oldVnode = emptyNodeAt(oldVnode);
  3876. }
  3877. elm = oldVnode.elm;
  3878. parent = nodeOps.parentNode(elm);
  3879. createElm(vnode, insertedVnodeQueue);
  3880. // component root element replaced.
  3881. // update parent placeholder node element.
  3882. if (vnode.parent) {
  3883. vnode.parent.elm = vnode.elm;
  3884. if (isPatchable(vnode)) {
  3885. for (var i = 0; i < cbs.create.length; ++i) {
  3886. cbs.create[i](emptyNode, vnode.parent);
  3887. }
  3888. }
  3889. }
  3890. if (parent !== null) {
  3891. nodeOps.insertBefore(parent, vnode.elm, nodeOps.nextSibling(elm));
  3892. removeVnodes(parent, [oldVnode], 0, 0);
  3893. } else if (isDef(oldVnode.tag)) {
  3894. invokeDestroyHook(oldVnode);
  3895. }
  3896. }
  3897. }
  3898. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  3899. return vnode.elm
  3900. }
  3901. }
  3902. /* */
  3903. var directives = {
  3904. create: updateDirectives,
  3905. update: updateDirectives,
  3906. destroy: function unbindDirectives (vnode) {
  3907. updateDirectives(vnode, emptyNode);
  3908. }
  3909. };
  3910. function updateDirectives (
  3911. oldVnode,
  3912. vnode
  3913. ) {
  3914. if (!oldVnode.data.directives && !vnode.data.directives) {
  3915. return
  3916. }
  3917. var isCreate = oldVnode === emptyNode;
  3918. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  3919. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  3920. var dirsWithInsert = [];
  3921. var dirsWithPostpatch = [];
  3922. var key, oldDir, dir;
  3923. for (key in newDirs) {
  3924. oldDir = oldDirs[key];
  3925. dir = newDirs[key];
  3926. if (!oldDir) {
  3927. // new directive, bind
  3928. callHook$1(dir, 'bind', vnode, oldVnode);
  3929. if (dir.def && dir.def.inserted) {
  3930. dirsWithInsert.push(dir);
  3931. }
  3932. } else {
  3933. // existing directive, update
  3934. dir.oldValue = oldDir.value;
  3935. callHook$1(dir, 'update', vnode, oldVnode);
  3936. if (dir.def && dir.def.componentUpdated) {
  3937. dirsWithPostpatch.push(dir);
  3938. }
  3939. }
  3940. }
  3941. if (dirsWithInsert.length) {
  3942. var callInsert = function () {
  3943. dirsWithInsert.forEach(function (dir) {
  3944. callHook$1(dir, 'inserted', vnode, oldVnode);
  3945. });
  3946. };
  3947. if (isCreate) {
  3948. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert');
  3949. } else {
  3950. callInsert();
  3951. }
  3952. }
  3953. if (dirsWithPostpatch.length) {
  3954. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  3955. dirsWithPostpatch.forEach(function (dir) {
  3956. callHook$1(dir, 'componentUpdated', vnode, oldVnode);
  3957. });
  3958. }, 'dir-postpatch');
  3959. }
  3960. if (!isCreate) {
  3961. for (key in oldDirs) {
  3962. if (!newDirs[key]) {
  3963. // no longer present, unbind
  3964. callHook$1(oldDirs[key], 'unbind', oldVnode);
  3965. }
  3966. }
  3967. }
  3968. }
  3969. var emptyModifiers = Object.create(null);
  3970. function normalizeDirectives$1 (
  3971. dirs,
  3972. vm
  3973. ) {
  3974. var res = Object.create(null);
  3975. if (!dirs) {
  3976. return res
  3977. }
  3978. var i, dir;
  3979. for (i = 0; i < dirs.length; i++) {
  3980. dir = dirs[i];
  3981. if (!dir.modifiers) {
  3982. dir.modifiers = emptyModifiers;
  3983. }
  3984. res[getRawDirName(dir)] = dir;
  3985. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  3986. }
  3987. return res
  3988. }
  3989. function getRawDirName (dir) {
  3990. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  3991. }
  3992. function callHook$1 (dir, hook, vnode, oldVnode) {
  3993. var fn = dir.def && dir.def[hook];
  3994. if (fn) {
  3995. fn(vnode.elm, dir, vnode, oldVnode);
  3996. }
  3997. }
  3998. var baseModules = [
  3999. ref,
  4000. directives
  4001. ];
  4002. /* */
  4003. function updateAttrs (oldVnode, vnode) {
  4004. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  4005. return
  4006. }
  4007. var key, cur, old;
  4008. var elm = vnode.elm;
  4009. var oldAttrs = oldVnode.data.attrs || {};
  4010. var attrs = vnode.data.attrs || {};
  4011. // clone observed objects, as the user probably wants to mutate it
  4012. if (attrs.__ob__) {
  4013. attrs = vnode.data.attrs = extend({}, attrs);
  4014. }
  4015. for (key in attrs) {
  4016. cur = attrs[key];
  4017. old = oldAttrs[key];
  4018. if (old !== cur) {
  4019. setAttr(elm, key, cur);
  4020. }
  4021. }
  4022. for (key in oldAttrs) {
  4023. if (attrs[key] == null) {
  4024. if (isXlink(key)) {
  4025. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4026. } else if (!isEnumeratedAttr(key)) {
  4027. elm.removeAttribute(key);
  4028. }
  4029. }
  4030. }
  4031. }
  4032. function setAttr (el, key, value) {
  4033. if (isBooleanAttr(key)) {
  4034. // set attribute for blank value
  4035. // e.g. <option disabled>Select one</option>
  4036. if (isFalsyAttrValue(value)) {
  4037. el.removeAttribute(key);
  4038. } else {
  4039. el.setAttribute(key, key);
  4040. }
  4041. } else if (isEnumeratedAttr(key)) {
  4042. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  4043. } else if (isXlink(key)) {
  4044. if (isFalsyAttrValue(value)) {
  4045. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4046. } else {
  4047. el.setAttributeNS(xlinkNS, key, value);
  4048. }
  4049. } else {
  4050. if (isFalsyAttrValue(value)) {
  4051. el.removeAttribute(key);
  4052. } else {
  4053. el.setAttribute(key, value);
  4054. }
  4055. }
  4056. }
  4057. var attrs = {
  4058. create: updateAttrs,
  4059. update: updateAttrs
  4060. };
  4061. /* */
  4062. function updateClass (oldVnode, vnode) {
  4063. var el = vnode.elm;
  4064. var data = vnode.data;
  4065. var oldData = oldVnode.data;
  4066. if (!data.staticClass && !data.class &&
  4067. (!oldData || (!oldData.staticClass && !oldData.class))) {
  4068. return
  4069. }
  4070. var cls = genClassForVnode(vnode);
  4071. // handle transition classes
  4072. var transitionClass = el._transitionClasses;
  4073. if (transitionClass) {
  4074. cls = concat(cls, stringifyClass(transitionClass));
  4075. }
  4076. // set the class
  4077. if (cls !== el._prevClass) {
  4078. el.setAttribute('class', cls);
  4079. el._prevClass = cls;
  4080. }
  4081. }
  4082. var klass = {
  4083. create: updateClass,
  4084. update: updateClass
  4085. };
  4086. // skip type checking this file because we need to attach private properties
  4087. // to elements
  4088. function updateDOMListeners (oldVnode, vnode) {
  4089. if (!oldVnode.data.on && !vnode.data.on) {
  4090. return
  4091. }
  4092. var on = vnode.data.on || {};
  4093. var oldOn = oldVnode.data.on || {};
  4094. var add = vnode.elm._v_add || (vnode.elm._v_add = function (event, handler, capture) {
  4095. vnode.elm.addEventListener(event, handler, capture);
  4096. });
  4097. var remove = vnode.elm._v_remove || (vnode.elm._v_remove = function (event, handler) {
  4098. vnode.elm.removeEventListener(event, handler);
  4099. });
  4100. updateListeners(on, oldOn, add, remove, vnode.context);
  4101. }
  4102. var events = {
  4103. create: updateDOMListeners,
  4104. update: updateDOMListeners
  4105. };
  4106. /* */
  4107. function updateDOMProps (oldVnode, vnode) {
  4108. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  4109. return
  4110. }
  4111. var key, cur;
  4112. var elm = vnode.elm;
  4113. var oldProps = oldVnode.data.domProps || {};
  4114. var props = vnode.data.domProps || {};
  4115. // clone observed objects, as the user probably wants to mutate it
  4116. if (props.__ob__) {
  4117. props = vnode.data.domProps = extend({}, props);
  4118. }
  4119. for (key in oldProps) {
  4120. if (props[key] == null) {
  4121. elm[key] = undefined;
  4122. }
  4123. }
  4124. for (key in props) {
  4125. // ignore children if the node has textContent or innerHTML,
  4126. // as these will throw away existing DOM nodes and cause removal errors
  4127. // on subsequent patches (#3360)
  4128. if ((key === 'textContent' || key === 'innerHTML') && vnode.children) {
  4129. vnode.children.length = 0;
  4130. }
  4131. cur = props[key];
  4132. if (key === 'value') {
  4133. // store value as _value as well since
  4134. // non-string values will be stringified
  4135. elm._value = cur;
  4136. // avoid resetting cursor position when value is the same
  4137. var strCur = cur == null ? '' : String(cur);
  4138. if (elm.value !== strCur && !elm.composing) {
  4139. elm.value = strCur;
  4140. }
  4141. } else {
  4142. elm[key] = cur;
  4143. }
  4144. }
  4145. }
  4146. var domProps = {
  4147. create: updateDOMProps,
  4148. update: updateDOMProps
  4149. };
  4150. /* */
  4151. var prefixes = ['Webkit', 'Moz', 'ms'];
  4152. var testEl;
  4153. var normalize = cached(function (prop) {
  4154. testEl = testEl || document.createElement('div');
  4155. prop = camelize(prop);
  4156. if (prop !== 'filter' && (prop in testEl.style)) {
  4157. return prop
  4158. }
  4159. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  4160. for (var i = 0; i < prefixes.length; i++) {
  4161. var prefixed = prefixes[i] + upper;
  4162. if (prefixed in testEl.style) {
  4163. return prefixed
  4164. }
  4165. }
  4166. });
  4167. function updateStyle (oldVnode, vnode) {
  4168. if ((!oldVnode.data || !oldVnode.data.style) && !vnode.data.style) {
  4169. return
  4170. }
  4171. var cur, name;
  4172. var el = vnode.elm;
  4173. var oldStyle = oldVnode.data.style || {};
  4174. var style = vnode.data.style || {};
  4175. // handle string
  4176. if (typeof style === 'string') {
  4177. el.style.cssText = style;
  4178. return
  4179. }
  4180. var needClone = style.__ob__;
  4181. // handle array syntax
  4182. if (Array.isArray(style)) {
  4183. style = vnode.data.style = toObject(style);
  4184. }
  4185. // clone the style for future updates,
  4186. // in case the user mutates the style object in-place.
  4187. if (needClone) {
  4188. style = vnode.data.style = extend({}, style);
  4189. }
  4190. for (name in oldStyle) {
  4191. if (style[name] == null) {
  4192. el.style[normalize(name)] = '';
  4193. }
  4194. }
  4195. for (name in style) {
  4196. cur = style[name];
  4197. if (cur !== oldStyle[name]) {
  4198. // ie9 setting to null has no effect, must use empty string
  4199. el.style[normalize(name)] = cur == null ? '' : cur;
  4200. }
  4201. }
  4202. }
  4203. var style = {
  4204. create: updateStyle,
  4205. update: updateStyle
  4206. };
  4207. /* */
  4208. /**
  4209. * Add class with compatibility for SVG since classList is not supported on
  4210. * SVG elements in IE
  4211. */
  4212. function addClass (el, cls) {
  4213. /* istanbul ignore else */
  4214. if (el.classList) {
  4215. if (cls.indexOf(' ') > -1) {
  4216. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  4217. } else {
  4218. el.classList.add(cls);
  4219. }
  4220. } else {
  4221. var cur = ' ' + el.getAttribute('class') + ' ';
  4222. if (cur.indexOf(' ' + cls + ' ') < 0) {
  4223. el.setAttribute('class', (cur + cls).trim());
  4224. }
  4225. }
  4226. }
  4227. /**
  4228. * Remove class with compatibility for SVG since classList is not supported on
  4229. * SVG elements in IE
  4230. */
  4231. function removeClass (el, cls) {
  4232. /* istanbul ignore else */
  4233. if (el.classList) {
  4234. if (cls.indexOf(' ') > -1) {
  4235. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  4236. } else {
  4237. el.classList.remove(cls);
  4238. }
  4239. } else {
  4240. var cur = ' ' + el.getAttribute('class') + ' ';
  4241. var tar = ' ' + cls + ' ';
  4242. while (cur.indexOf(tar) >= 0) {
  4243. cur = cur.replace(tar, ' ');
  4244. }
  4245. el.setAttribute('class', cur.trim());
  4246. }
  4247. }
  4248. /* */
  4249. var hasTransition = inBrowser && !isIE9;
  4250. var TRANSITION = 'transition';
  4251. var ANIMATION = 'animation';
  4252. // Transition property/event sniffing
  4253. var transitionProp = 'transition';
  4254. var transitionEndEvent = 'transitionend';
  4255. var animationProp = 'animation';
  4256. var animationEndEvent = 'animationend';
  4257. if (hasTransition) {
  4258. /* istanbul ignore if */
  4259. if (window.ontransitionend === undefined &&
  4260. window.onwebkittransitionend !== undefined) {
  4261. transitionProp = 'WebkitTransition';
  4262. transitionEndEvent = 'webkitTransitionEnd';
  4263. }
  4264. if (window.onanimationend === undefined &&
  4265. window.onwebkitanimationend !== undefined) {
  4266. animationProp = 'WebkitAnimation';
  4267. animationEndEvent = 'webkitAnimationEnd';
  4268. }
  4269. }
  4270. var raf = (inBrowser && window.requestAnimationFrame) || setTimeout;
  4271. function nextFrame (fn) {
  4272. raf(function () {
  4273. raf(fn);
  4274. });
  4275. }
  4276. function addTransitionClass (el, cls) {
  4277. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  4278. addClass(el, cls);
  4279. }
  4280. function removeTransitionClass (el, cls) {
  4281. if (el._transitionClasses) {
  4282. remove$1(el._transitionClasses, cls);
  4283. }
  4284. removeClass(el, cls);
  4285. }
  4286. function whenTransitionEnds (
  4287. el,
  4288. expectedType,
  4289. cb
  4290. ) {
  4291. var ref = getTransitionInfo(el, expectedType);
  4292. var type = ref.type;
  4293. var timeout = ref.timeout;
  4294. var propCount = ref.propCount;
  4295. if (!type) { return cb() }
  4296. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  4297. var ended = 0;
  4298. var end = function () {
  4299. el.removeEventListener(event, onEnd);
  4300. cb();
  4301. };
  4302. var onEnd = function (e) {
  4303. if (e.target === el) {
  4304. if (++ended >= propCount) {
  4305. end();
  4306. }
  4307. }
  4308. };
  4309. setTimeout(function () {
  4310. if (ended < propCount) {
  4311. end();
  4312. }
  4313. }, timeout + 1);
  4314. el.addEventListener(event, onEnd);
  4315. }
  4316. var transformRE = /\b(transform|all)(,|$)/;
  4317. function getTransitionInfo (el, expectedType) {
  4318. var styles = window.getComputedStyle(el);
  4319. var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
  4320. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  4321. var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
  4322. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  4323. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  4324. var animationTimeout = getTimeout(animationDelays, animationDurations);
  4325. var type;
  4326. var timeout = 0;
  4327. var propCount = 0;
  4328. /* istanbul ignore if */
  4329. if (expectedType === TRANSITION) {
  4330. if (transitionTimeout > 0) {
  4331. type = TRANSITION;
  4332. timeout = transitionTimeout;
  4333. propCount = transitionDurations.length;
  4334. }
  4335. } else if (expectedType === ANIMATION) {
  4336. if (animationTimeout > 0) {
  4337. type = ANIMATION;
  4338. timeout = animationTimeout;
  4339. propCount = animationDurations.length;
  4340. }
  4341. } else {
  4342. timeout = Math.max(transitionTimeout, animationTimeout);
  4343. type = timeout > 0
  4344. ? transitionTimeout > animationTimeout
  4345. ? TRANSITION
  4346. : ANIMATION
  4347. : null;
  4348. propCount = type
  4349. ? type === TRANSITION
  4350. ? transitionDurations.length
  4351. : animationDurations.length
  4352. : 0;
  4353. }
  4354. var hasTransform =
  4355. type === TRANSITION &&
  4356. transformRE.test(styles[transitionProp + 'Property']);
  4357. return {
  4358. type: type,
  4359. timeout: timeout,
  4360. propCount: propCount,
  4361. hasTransform: hasTransform
  4362. }
  4363. }
  4364. function getTimeout (delays, durations) {
  4365. return Math.max.apply(null, durations.map(function (d, i) {
  4366. return toMs(d) + toMs(delays[i])
  4367. }))
  4368. }
  4369. function toMs (s) {
  4370. return Number(s.slice(0, -1)) * 1000
  4371. }
  4372. /* */
  4373. function enter (vnode) {
  4374. var el = vnode.elm;
  4375. // call leave callback now
  4376. if (el._leaveCb) {
  4377. el._leaveCb.cancelled = true;
  4378. el._leaveCb();
  4379. }
  4380. var data = resolveTransition(vnode.data.transition);
  4381. if (!data) {
  4382. return
  4383. }
  4384. /* istanbul ignore if */
  4385. if (el._enterCb || el.nodeType !== 1) {
  4386. return
  4387. }
  4388. var css = data.css;
  4389. var type = data.type;
  4390. var enterClass = data.enterClass;
  4391. var enterActiveClass = data.enterActiveClass;
  4392. var appearClass = data.appearClass;
  4393. var appearActiveClass = data.appearActiveClass;
  4394. var beforeEnter = data.beforeEnter;
  4395. var enter = data.enter;
  4396. var afterEnter = data.afterEnter;
  4397. var enterCancelled = data.enterCancelled;
  4398. var beforeAppear = data.beforeAppear;
  4399. var appear = data.appear;
  4400. var afterAppear = data.afterAppear;
  4401. var appearCancelled = data.appearCancelled;
  4402. // activeInstance will always be the <transition> component managing this
  4403. // transition. One edge case to check is when the <transition> is placed
  4404. // as the root node of a child component. In that case we need to check
  4405. // <transition>'s parent for appear check.
  4406. var transitionNode = activeInstance.$vnode;
  4407. var context = transitionNode && transitionNode.parent
  4408. ? transitionNode.parent.context
  4409. : activeInstance;
  4410. var isAppear = !context._isMounted || !vnode.isRootInsert;
  4411. if (isAppear && !appear && appear !== '') {
  4412. return
  4413. }
  4414. var startClass = isAppear ? appearClass : enterClass;
  4415. var activeClass = isAppear ? appearActiveClass : enterActiveClass;
  4416. var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter;
  4417. var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter;
  4418. var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter;
  4419. var enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled;
  4420. var expectsCSS = css !== false && !isIE9;
  4421. var userWantsControl =
  4422. enterHook &&
  4423. // enterHook may be a bound method which exposes
  4424. // the length of original fn as _length
  4425. (enterHook._length || enterHook.length) > 1;
  4426. var cb = el._enterCb = once(function () {
  4427. if (expectsCSS) {
  4428. removeTransitionClass(el, activeClass);
  4429. }
  4430. if (cb.cancelled) {
  4431. if (expectsCSS) {
  4432. removeTransitionClass(el, startClass);
  4433. }
  4434. enterCancelledHook && enterCancelledHook(el);
  4435. } else {
  4436. afterEnterHook && afterEnterHook(el);
  4437. }
  4438. el._enterCb = null;
  4439. });
  4440. if (!vnode.data.show) {
  4441. // remove pending leave element on enter by injecting an insert hook
  4442. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  4443. var parent = el.parentNode;
  4444. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  4445. if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
  4446. pendingNode.elm._leaveCb();
  4447. }
  4448. enterHook && enterHook(el, cb);
  4449. }, 'transition-insert');
  4450. }
  4451. // start enter transition
  4452. beforeEnterHook && beforeEnterHook(el);
  4453. if (expectsCSS) {
  4454. addTransitionClass(el, startClass);
  4455. addTransitionClass(el, activeClass);
  4456. nextFrame(function () {
  4457. removeTransitionClass(el, startClass);
  4458. if (!cb.cancelled && !userWantsControl) {
  4459. whenTransitionEnds(el, type, cb);
  4460. }
  4461. });
  4462. }
  4463. if (vnode.data.show) {
  4464. enterHook && enterHook(el, cb);
  4465. }
  4466. if (!expectsCSS && !userWantsControl) {
  4467. cb();
  4468. }
  4469. }
  4470. function leave (vnode, rm) {
  4471. var el = vnode.elm;
  4472. // call enter callback now
  4473. if (el._enterCb) {
  4474. el._enterCb.cancelled = true;
  4475. el._enterCb();
  4476. }
  4477. var data = resolveTransition(vnode.data.transition);
  4478. if (!data) {
  4479. return rm()
  4480. }
  4481. /* istanbul ignore if */
  4482. if (el._leaveCb || el.nodeType !== 1) {
  4483. return
  4484. }
  4485. var css = data.css;
  4486. var type = data.type;
  4487. var leaveClass = data.leaveClass;
  4488. var leaveActiveClass = data.leaveActiveClass;
  4489. var beforeLeave = data.beforeLeave;
  4490. var leave = data.leave;
  4491. var afterLeave = data.afterLeave;
  4492. var leaveCancelled = data.leaveCancelled;
  4493. var delayLeave = data.delayLeave;
  4494. var expectsCSS = css !== false && !isIE9;
  4495. var userWantsControl =
  4496. leave &&
  4497. // leave hook may be a bound method which exposes
  4498. // the length of original fn as _length
  4499. (leave._length || leave.length) > 1;
  4500. var cb = el._leaveCb = once(function () {
  4501. if (el.parentNode && el.parentNode._pending) {
  4502. el.parentNode._pending[vnode.key] = null;
  4503. }
  4504. if (expectsCSS) {
  4505. removeTransitionClass(el, leaveActiveClass);
  4506. }
  4507. if (cb.cancelled) {
  4508. if (expectsCSS) {
  4509. removeTransitionClass(el, leaveClass);
  4510. }
  4511. leaveCancelled && leaveCancelled(el);
  4512. } else {
  4513. rm();
  4514. afterLeave && afterLeave(el);
  4515. }
  4516. el._leaveCb = null;
  4517. });
  4518. if (delayLeave) {
  4519. delayLeave(performLeave);
  4520. } else {
  4521. performLeave();
  4522. }
  4523. function performLeave () {
  4524. // the delayed leave may have already been cancelled
  4525. if (cb.cancelled) {
  4526. return
  4527. }
  4528. // record leaving element
  4529. if (!vnode.data.show) {
  4530. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  4531. }
  4532. beforeLeave && beforeLeave(el);
  4533. if (expectsCSS) {
  4534. addTransitionClass(el, leaveClass);
  4535. addTransitionClass(el, leaveActiveClass);
  4536. nextFrame(function () {
  4537. removeTransitionClass(el, leaveClass);
  4538. if (!cb.cancelled && !userWantsControl) {
  4539. whenTransitionEnds(el, type, cb);
  4540. }
  4541. });
  4542. }
  4543. leave && leave(el, cb);
  4544. if (!expectsCSS && !userWantsControl) {
  4545. cb();
  4546. }
  4547. }
  4548. }
  4549. function resolveTransition (def$$1) {
  4550. if (!def$$1) {
  4551. return
  4552. }
  4553. /* istanbul ignore else */
  4554. if (typeof def$$1 === 'object') {
  4555. var res = {};
  4556. if (def$$1.css !== false) {
  4557. extend(res, autoCssTransition(def$$1.name || 'v'));
  4558. }
  4559. extend(res, def$$1);
  4560. return res
  4561. } else if (typeof def$$1 === 'string') {
  4562. return autoCssTransition(def$$1)
  4563. }
  4564. }
  4565. var autoCssTransition = cached(function (name) {
  4566. return {
  4567. enterClass: (name + "-enter"),
  4568. leaveClass: (name + "-leave"),
  4569. appearClass: (name + "-enter"),
  4570. enterActiveClass: (name + "-enter-active"),
  4571. leaveActiveClass: (name + "-leave-active"),
  4572. appearActiveClass: (name + "-enter-active")
  4573. }
  4574. });
  4575. function once (fn) {
  4576. var called = false;
  4577. return function () {
  4578. if (!called) {
  4579. called = true;
  4580. fn();
  4581. }
  4582. }
  4583. }
  4584. var transition = inBrowser ? {
  4585. create: function create (_, vnode) {
  4586. if (!vnode.data.show) {
  4587. enter(vnode);
  4588. }
  4589. },
  4590. remove: function remove (vnode, rm) {
  4591. /* istanbul ignore else */
  4592. if (!vnode.data.show) {
  4593. leave(vnode, rm);
  4594. } else {
  4595. rm();
  4596. }
  4597. }
  4598. } : {};
  4599. var platformModules = [
  4600. attrs,
  4601. klass,
  4602. events,
  4603. domProps,
  4604. style,
  4605. transition
  4606. ];
  4607. /* */
  4608. // the directive module should be applied last, after all
  4609. // built-in modules have been applied.
  4610. var modules = platformModules.concat(baseModules);
  4611. var patch$1 = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  4612. /**
  4613. * Not type checking this file because flow doesn't like attaching
  4614. * properties to Elements.
  4615. */
  4616. var modelableTagRE = /^input|select|textarea|vue-component-[0-9]+(-[0-9a-zA-Z_\-]*)?$/;
  4617. /* istanbul ignore if */
  4618. if (isIE9) {
  4619. // http://www.matts411.com/post/internet-explorer-9-oninput/
  4620. document.addEventListener('selectionchange', function () {
  4621. var el = document.activeElement;
  4622. if (el && el.vmodel) {
  4623. trigger(el, 'input');
  4624. }
  4625. });
  4626. }
  4627. var model = {
  4628. inserted: function inserted (el, binding, vnode) {
  4629. if (process.env.NODE_ENV !== 'production') {
  4630. if (!modelableTagRE.test(vnode.tag)) {
  4631. warn(
  4632. "v-model is not supported on element type: <" + (vnode.tag) + ">. " +
  4633. 'If you are working with contenteditable, it\'s recommended to ' +
  4634. 'wrap a library dedicated for that purpose inside a custom component.',
  4635. vnode.context
  4636. );
  4637. }
  4638. }
  4639. if (vnode.tag === 'select') {
  4640. var cb = function () {
  4641. setSelected(el, binding, vnode.context);
  4642. };
  4643. cb();
  4644. /* istanbul ignore if */
  4645. if (isIE || isEdge) {
  4646. setTimeout(cb, 0);
  4647. }
  4648. } else if (
  4649. (vnode.tag === 'textarea' || el.type === 'text') &&
  4650. !binding.modifiers.lazy
  4651. ) {
  4652. if (!isAndroid) {
  4653. el.addEventListener('compositionstart', onCompositionStart);
  4654. el.addEventListener('compositionend', onCompositionEnd);
  4655. }
  4656. /* istanbul ignore if */
  4657. if (isIE9) {
  4658. el.vmodel = true;
  4659. }
  4660. }
  4661. },
  4662. componentUpdated: function componentUpdated (el, binding, vnode) {
  4663. if (vnode.tag === 'select') {
  4664. setSelected(el, binding, vnode.context);
  4665. // in case the options rendered by v-for have changed,
  4666. // it's possible that the value is out-of-sync with the rendered options.
  4667. // detect such cases and filter out values that no longer has a matchig
  4668. // option in the DOM.
  4669. var needReset = el.multiple
  4670. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  4671. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  4672. if (needReset) {
  4673. trigger(el, 'change');
  4674. }
  4675. }
  4676. }
  4677. };
  4678. function setSelected (el, binding, vm) {
  4679. var value = binding.value;
  4680. var isMultiple = el.multiple;
  4681. if (isMultiple && !Array.isArray(value)) {
  4682. process.env.NODE_ENV !== 'production' && warn(
  4683. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  4684. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  4685. vm
  4686. );
  4687. return
  4688. }
  4689. var selected, option;
  4690. for (var i = 0, l = el.options.length; i < l; i++) {
  4691. option = el.options[i];
  4692. if (isMultiple) {
  4693. selected = looseIndexOf(value, getValue(option)) > -1;
  4694. if (option.selected !== selected) {
  4695. option.selected = selected;
  4696. }
  4697. } else {
  4698. if (looseEqual(getValue(option), value)) {
  4699. if (el.selectedIndex !== i) {
  4700. el.selectedIndex = i;
  4701. }
  4702. return
  4703. }
  4704. }
  4705. }
  4706. if (!isMultiple) {
  4707. el.selectedIndex = -1;
  4708. }
  4709. }
  4710. function hasNoMatchingOption (value, options) {
  4711. for (var i = 0, l = options.length; i < l; i++) {
  4712. if (looseEqual(getValue(options[i]), value)) {
  4713. return false
  4714. }
  4715. }
  4716. return true
  4717. }
  4718. function getValue (option) {
  4719. return '_value' in option
  4720. ? option._value
  4721. : option.value
  4722. }
  4723. function onCompositionStart (e) {
  4724. e.target.composing = true;
  4725. }
  4726. function onCompositionEnd (e) {
  4727. e.target.composing = false;
  4728. trigger(e.target, 'input');
  4729. }
  4730. function trigger (el, type) {
  4731. var e = document.createEvent('HTMLEvents');
  4732. e.initEvent(type, true, true);
  4733. el.dispatchEvent(e);
  4734. }
  4735. /* */
  4736. // recursively search for possible transition defined inside the component root
  4737. function locateNode (vnode) {
  4738. return vnode.child && (!vnode.data || !vnode.data.transition)
  4739. ? locateNode(vnode.child._vnode)
  4740. : vnode
  4741. }
  4742. var show = {
  4743. bind: function bind (el, ref, vnode) {
  4744. var value = ref.value;
  4745. vnode = locateNode(vnode);
  4746. var transition = vnode.data && vnode.data.transition;
  4747. if (value && transition && !isIE9) {
  4748. enter(vnode);
  4749. }
  4750. var originalDisplay = el.style.display === 'none' ? '' : el.style.display;
  4751. el.style.display = value ? originalDisplay : 'none';
  4752. el.__vOriginalDisplay = originalDisplay;
  4753. },
  4754. update: function update (el, ref, vnode) {
  4755. var value = ref.value;
  4756. var oldValue = ref.oldValue;
  4757. /* istanbul ignore if */
  4758. if (value === oldValue) { return }
  4759. vnode = locateNode(vnode);
  4760. var transition = vnode.data && vnode.data.transition;
  4761. if (transition && !isIE9) {
  4762. if (value) {
  4763. enter(vnode);
  4764. el.style.display = el.__vOriginalDisplay;
  4765. } else {
  4766. leave(vnode, function () {
  4767. el.style.display = 'none';
  4768. });
  4769. }
  4770. } else {
  4771. el.style.display = value ? el.__vOriginalDisplay : 'none';
  4772. }
  4773. }
  4774. };
  4775. var platformDirectives = {
  4776. model: model,
  4777. show: show
  4778. };
  4779. /* */
  4780. // Provides transition support for a single element/component.
  4781. // supports transition mode (out-in / in-out)
  4782. var transitionProps = {
  4783. name: String,
  4784. appear: Boolean,
  4785. css: Boolean,
  4786. mode: String,
  4787. type: String,
  4788. enterClass: String,
  4789. leaveClass: String,
  4790. enterActiveClass: String,
  4791. leaveActiveClass: String,
  4792. appearClass: String,
  4793. appearActiveClass: String
  4794. };
  4795. // in case the child is also an abstract component, e.g. <keep-alive>
  4796. // we want to recrusively retrieve the real component to be rendered
  4797. function getRealChild (vnode) {
  4798. var compOptions = vnode && vnode.componentOptions;
  4799. if (compOptions && compOptions.Ctor.options.abstract) {
  4800. return getRealChild(getFirstComponentChild(compOptions.children))
  4801. } else {
  4802. return vnode
  4803. }
  4804. }
  4805. function extractTransitionData (comp) {
  4806. var data = {};
  4807. var options = comp.$options;
  4808. // props
  4809. for (var key in options.propsData) {
  4810. data[key] = comp[key];
  4811. }
  4812. // events.
  4813. // extract listeners and pass them directly to the transition methods
  4814. var listeners = options._parentListeners;
  4815. for (var key$1 in listeners) {
  4816. data[camelize(key$1)] = listeners[key$1].fn;
  4817. }
  4818. return data
  4819. }
  4820. function placeholder (h, rawChild) {
  4821. return /\d-keep-alive$/.test(rawChild.tag)
  4822. ? h('keep-alive')
  4823. : null
  4824. }
  4825. function hasParentTransition (vnode) {
  4826. while ((vnode = vnode.parent)) {
  4827. if (vnode.data.transition) {
  4828. return true
  4829. }
  4830. }
  4831. }
  4832. var Transition = {
  4833. name: 'transition',
  4834. props: transitionProps,
  4835. abstract: true,
  4836. render: function render (h) {
  4837. var this$1 = this;
  4838. var children = this.$slots.default;
  4839. if (!children) {
  4840. return
  4841. }
  4842. // filter out text nodes (possible whitespaces)
  4843. children = children.filter(function (c) { return c.tag; });
  4844. /* istanbul ignore if */
  4845. if (!children.length) {
  4846. return
  4847. }
  4848. // warn multiple elements
  4849. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  4850. warn(
  4851. '<transition> can only be used on a single element. Use ' +
  4852. '<transition-group> for lists.',
  4853. this.$parent
  4854. );
  4855. }
  4856. var mode = this.mode;
  4857. // warn invalid mode
  4858. if (process.env.NODE_ENV !== 'production' &&
  4859. mode && mode !== 'in-out' && mode !== 'out-in') {
  4860. warn(
  4861. 'invalid <transition> mode: ' + mode,
  4862. this.$parent
  4863. );
  4864. }
  4865. var rawChild = children[0];
  4866. // if this is a component root node and the component's
  4867. // parent container node also has transition, skip.
  4868. if (hasParentTransition(this.$vnode)) {
  4869. return rawChild
  4870. }
  4871. // apply transition data to child
  4872. // use getRealChild() to ignore abstract components e.g. keep-alive
  4873. var child = getRealChild(rawChild);
  4874. /* istanbul ignore if */
  4875. if (!child) {
  4876. return rawChild
  4877. }
  4878. if (this._leaving) {
  4879. return placeholder(h, rawChild)
  4880. }
  4881. var key = child.key = child.key == null || child.isStatic
  4882. ? ("__v" + (child.tag + this._uid) + "__")
  4883. : child.key;
  4884. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  4885. var oldRawChild = this._vnode;
  4886. var oldChild = getRealChild(oldRawChild);
  4887. // mark v-show
  4888. // so that the transition module can hand over the control to the directive
  4889. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  4890. child.data.show = true;
  4891. }
  4892. if (oldChild && oldChild.data && oldChild.key !== key) {
  4893. // replace old child transition data with fresh one
  4894. // important for dynamic transitions!
  4895. var oldData = oldChild.data.transition = extend({}, data);
  4896. // handle transition mode
  4897. if (mode === 'out-in') {
  4898. // return placeholder node and queue update when leave finishes
  4899. this._leaving = true;
  4900. mergeVNodeHook(oldData, 'afterLeave', function () {
  4901. this$1._leaving = false;
  4902. this$1.$forceUpdate();
  4903. }, key);
  4904. return placeholder(h, rawChild)
  4905. } else if (mode === 'in-out') {
  4906. var delayedLeave;
  4907. var performLeave = function () { delayedLeave(); };
  4908. mergeVNodeHook(data, 'afterEnter', performLeave, key);
  4909. mergeVNodeHook(data, 'enterCancelled', performLeave, key);
  4910. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  4911. delayedLeave = leave;
  4912. }, key);
  4913. }
  4914. }
  4915. return rawChild
  4916. }
  4917. };
  4918. /* */
  4919. // Provides transition support for list items.
  4920. // supports move transitions using the FLIP technique.
  4921. // Because the vdom's children update algorithm is "unstable" - i.e.
  4922. // it doesn't guarantee the relative positioning of removed elements,
  4923. // we force transition-group to update its children into two passes:
  4924. // in the first pass, we remove all nodes that need to be removed,
  4925. // triggering their leaving transition; in the second pass, we insert/move
  4926. // into the final disired state. This way in the second pass removed
  4927. // nodes will remain where they should be.
  4928. var props = extend({
  4929. tag: String,
  4930. moveClass: String
  4931. }, transitionProps);
  4932. delete props.mode;
  4933. var TransitionGroup = {
  4934. props: props,
  4935. render: function render (h) {
  4936. var tag = this.tag || this.$vnode.data.tag || 'span';
  4937. var map = Object.create(null);
  4938. var prevChildren = this.prevChildren = this.children;
  4939. var rawChildren = this.$slots.default || [];
  4940. var children = this.children = [];
  4941. var transitionData = extractTransitionData(this);
  4942. for (var i = 0; i < rawChildren.length; i++) {
  4943. var c = rawChildren[i];
  4944. if (c.tag) {
  4945. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  4946. children.push(c);
  4947. map[c.key] = c
  4948. ;(c.data || (c.data = {})).transition = transitionData;
  4949. } else if (process.env.NODE_ENV !== 'production') {
  4950. var opts = c.componentOptions;
  4951. var name = opts
  4952. ? (opts.Ctor.options.name || opts.tag)
  4953. : c.tag;
  4954. warn(("<transition-group> children must be keyed: <" + name + ">"));
  4955. }
  4956. }
  4957. }
  4958. if (prevChildren) {
  4959. var kept = [];
  4960. var removed = [];
  4961. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  4962. var c$1 = prevChildren[i$1];
  4963. c$1.data.transition = transitionData;
  4964. c$1.data.pos = c$1.elm.getBoundingClientRect();
  4965. if (map[c$1.key]) {
  4966. kept.push(c$1);
  4967. } else {
  4968. removed.push(c$1);
  4969. }
  4970. }
  4971. this.kept = h(tag, null, kept);
  4972. this.removed = removed;
  4973. }
  4974. return h(tag, null, children)
  4975. },
  4976. beforeUpdate: function beforeUpdate () {
  4977. // force removing pass
  4978. this.__patch__(
  4979. this._vnode,
  4980. this.kept,
  4981. false, // hydrating
  4982. true // removeOnly (!important, avoids unnecessary moves)
  4983. );
  4984. this._vnode = this.kept;
  4985. },
  4986. updated: function updated () {
  4987. var children = this.prevChildren;
  4988. var moveClass = this.moveClass || (this.name + '-move');
  4989. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  4990. return
  4991. }
  4992. // we divide the work into three loops to avoid mixing DOM reads and writes
  4993. // in each iteration - which helps prevent layout thrashing.
  4994. children.forEach(callPendingCbs);
  4995. children.forEach(recordPosition);
  4996. children.forEach(applyTranslation);
  4997. // force reflow to put everything in position
  4998. var f = document.body.offsetHeight; // eslint-disable-line
  4999. children.forEach(function (c) {
  5000. if (c.data.moved) {
  5001. var el = c.elm;
  5002. var s = el.style;
  5003. addTransitionClass(el, moveClass);
  5004. s.transform = s.WebkitTransform = s.transitionDuration = '';
  5005. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  5006. if (!e || /transform$/.test(e.propertyName)) {
  5007. el.removeEventListener(transitionEndEvent, cb);
  5008. el._moveCb = null;
  5009. removeTransitionClass(el, moveClass);
  5010. }
  5011. });
  5012. }
  5013. });
  5014. },
  5015. methods: {
  5016. hasMove: function hasMove (el, moveClass) {
  5017. /* istanbul ignore if */
  5018. if (!hasTransition) {
  5019. return false
  5020. }
  5021. if (this._hasMove != null) {
  5022. return this._hasMove
  5023. }
  5024. addTransitionClass(el, moveClass);
  5025. var info = getTransitionInfo(el);
  5026. removeTransitionClass(el, moveClass);
  5027. return (this._hasMove = info.hasTransform)
  5028. }
  5029. }
  5030. };
  5031. function callPendingCbs (c) {
  5032. /* istanbul ignore if */
  5033. if (c.elm._moveCb) {
  5034. c.elm._moveCb();
  5035. }
  5036. /* istanbul ignore if */
  5037. if (c.elm._enterCb) {
  5038. c.elm._enterCb();
  5039. }
  5040. }
  5041. function recordPosition (c) {
  5042. c.data.newPos = c.elm.getBoundingClientRect();
  5043. }
  5044. function applyTranslation (c) {
  5045. var oldPos = c.data.pos;
  5046. var newPos = c.data.newPos;
  5047. var dx = oldPos.left - newPos.left;
  5048. var dy = oldPos.top - newPos.top;
  5049. if (dx || dy) {
  5050. c.data.moved = true;
  5051. var s = c.elm.style;
  5052. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  5053. s.transitionDuration = '0s';
  5054. }
  5055. }
  5056. var platformComponents = {
  5057. Transition: Transition,
  5058. TransitionGroup: TransitionGroup
  5059. };
  5060. /* */
  5061. // install platform specific utils
  5062. Vue$2.config.isUnknownElement = isUnknownElement;
  5063. Vue$2.config.isReservedTag = isReservedTag;
  5064. Vue$2.config.getTagNamespace = getTagNamespace;
  5065. Vue$2.config.mustUseProp = mustUseProp;
  5066. // install platform runtime directives & components
  5067. extend(Vue$2.options.directives, platformDirectives);
  5068. extend(Vue$2.options.components, platformComponents);
  5069. // install platform patch function
  5070. Vue$2.prototype.__patch__ = config._isServer ? noop : patch$1;
  5071. // wrap mount
  5072. Vue$2.prototype.$mount = function (
  5073. el,
  5074. hydrating
  5075. ) {
  5076. el = el && !config._isServer ? query(el) : undefined;
  5077. return this._mount(el, hydrating)
  5078. };
  5079. // devtools global hook
  5080. /* istanbul ignore next */
  5081. setTimeout(function () {
  5082. if (config.devtools) {
  5083. if (devtools) {
  5084. devtools.emit('init', Vue$2);
  5085. } else if (
  5086. process.env.NODE_ENV !== 'production' &&
  5087. inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
  5088. ) {
  5089. console.log(
  5090. 'Download the Vue Devtools for a better development experience:\n' +
  5091. 'https://github.com/vuejs/vue-devtools'
  5092. );
  5093. }
  5094. }
  5095. }, 0);
  5096. module.exports = Vue$2;