Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.runtime.esm.js 207KB

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