vue.runtime.js 180 KB

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