vue.runtime.js 188 KB

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