vue.runtime.js 144 KB

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