vue.runtime.common.dev.js 219 KB

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