vue.runtime.esm.js 174 KB

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