vue.runtime.js 157 KB

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