vue.runtime.common.js 158 KB

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