vue.runtime.js 170 KB

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