vue.runtime.js 235 KB

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